Commit e9dbcf38 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Add code to check format support on Win GPU bots.

This CL only prints out the info in a test, so we could take
a look and wire them up in a follow-up.

Part of this CL will be reverted after we get the info.

This should only affect gl_unittests and should not turn any
bots red.

I believe this is the least intrusive way to gather what we need.

BUG=967860
TEST=bots
R=sunnyps@chromium.org

Change-Id: I216151660263a575a48542a2c21d914d0f12e3a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637863Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664943}
parent f7bddc8d
......@@ -301,10 +301,12 @@ void DirectCompositionSurfaceWin::SetScaledOverlaysSupportedForTesting(
}
// static
void DirectCompositionSurfaceWin::SetPreferYUY2OverlaysForTesting() {
void DirectCompositionSurfaceWin::SetOverlayFormatUsedForTesting(
DXGI_FORMAT format) {
DCHECK(format == DXGI_FORMAT_NV12 || format == DXGI_FORMAT_YUY2);
InitializeHardwareOverlaySupport();
g_overlay_format_used = DXGI_FORMAT_YUY2;
DCHECK_EQ(DXGI_FORMAT_YUY2, GetOverlayFormatUsed());
g_overlay_format_used = format;
DCHECK_EQ(format, GetOverlayFormatUsed());
}
// static
......
......@@ -74,7 +74,7 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL {
static void SetScaledOverlaysSupportedForTesting(bool value);
static void SetPreferYUY2OverlaysForTesting();
static void SetOverlayFormatUsedForTesting(DXGI_FORMAT format);
// GLSurfaceEGL implementation.
bool Initialize(GLSurfaceFormat format) override;
......
......@@ -67,6 +67,18 @@ void DestroySurface(scoped_refptr<DirectCompositionSurfaceWin> surface) {
base::RunLoop().RunUntilIdle();
}
bool CheckFormatSupport(DXGI_FORMAT format) {
Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device =
QueryD3D11DeviceObjectFromANGLE();
if (!d3d11_device)
return false;
UINT support_flags = 0;
if (FAILED(d3d11_device->CheckFormatSupport(format, &support_flags)))
return false;
LOG(ERROR) << "support_flag = 0x" << std::hex << support_flags;
return true;
}
Microsoft::WRL::ComPtr<ID3D11Texture2D> CreateNV12Texture(
const Microsoft::WRL::ComPtr<ID3D11Device>& d3d11_device,
const gfx::Size& size,
......@@ -116,6 +128,8 @@ class DirectCompositionSurfaceTest : public testing::Test {
context_ = CreateGLContext(surface_);
surface_->SetEnableDCLayers(true);
DirectCompositionSurfaceWin::SetScaledOverlaysSupportedForTesting(false);
DirectCompositionSurfaceWin::SetOverlayFormatUsedForTesting(
DXGI_FORMAT_NV12);
}
void TearDown() override {
......@@ -914,6 +928,11 @@ TEST_F(DirectCompositionPixelTest, NV12SwapChain) {
// are supported.
DirectCompositionSurfaceWin::SetScaledOverlaysSupportedForTesting(true);
// TODO(zmo): These are to collect format supports on Win10/AMD bot,
// and should be removed after the info is obtained.
EXPECT_TRUE(CheckFormatSupport(DXGI_FORMAT_NV12));
EXPECT_TRUE(CheckFormatSupport(DXGI_FORMAT_YUY2));
gfx::Size window_size(100, 100);
gfx::Size texture_size(50, 50);
// Pass content rect with odd with and height. Surface should round up
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment