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

Revert "Add pixel format support flags on Windows."

This reverts commit ca612692.

Reason for revert: doesn't explain why YUY2 swap chain creation
failed on Win10/AMD GPU, so this CL is unnecessary.

Original change's description:
> Add pixel format support flags on Windows.
> 
> The flags are queried through ID3D11Device::CheckFormatSupport().
> 
> Hopefully they can be used to bypass YUY2 related tests on AMD
> where creating a YUY2 swap chain fails.
> 
> Also, they can be useful diagnosing swap chain related issues
> from user machines, i.e., whether we assumed certain capabilities
> without checking.
> 
> BUG=967860
> TEST=bots
> R=​sunnyps@chromium.org,piman@chromium.org
> 
> Change-Id: I5dff9069b2fc53851cbffc5263bd4a2e0e03582f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637195
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Antoine Labour <piman@chromium.org>
> Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#665218}

TBR=dcheng@chromium.org,zmo@chromium.org,sunnyps@chromium.org,piman@chromium.org

Change-Id: Ic93530b90006c41da694a2bc7ae65d13d541b998
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 967860
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1639360Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665259}
parent d829f1d9
...@@ -184,15 +184,6 @@ std::unique_ptr<base::ListValue> BasicGpuInfoAsListValue( ...@@ -184,15 +184,6 @@ std::unique_ptr<base::ListValue> BasicGpuInfoAsListValue(
basic_info->Append(NewDescriptionValuePair( basic_info->Append(NewDescriptionValuePair(
"Direct composition", "Direct composition",
std::make_unique<base::Value>(gpu_info.direct_composition))); std::make_unique<base::Value>(gpu_info.direct_composition)));
basic_info->Append(NewDescriptionValuePair(
"BGRA format support",
base::StringPrintf("0x%08x", gpu_info.bgra_format_support)));
basic_info->Append(NewDescriptionValuePair(
"YUY2 format support",
base::StringPrintf("0x%08x", gpu_info.yuy2_format_support)));
basic_info->Append(NewDescriptionValuePair(
"NV12 format support",
base::StringPrintf("0x%08x", gpu_info.nv12_format_support)));
basic_info->Append(NewDescriptionValuePair( basic_info->Append(NewDescriptionValuePair(
"Supports overlays", "Supports overlays",
std::make_unique<base::Value>(gpu_info.supports_overlays))); std::make_unique<base::Value>(gpu_info.supports_overlays)));
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <stdint.h> #include <stdint.h>
#include "base/strings/stringprintf.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
namespace { namespace {
...@@ -237,9 +236,6 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { ...@@ -237,9 +236,6 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
bool can_support_threaded_texture_mailbox; bool can_support_threaded_texture_mailbox;
#if defined(OS_WIN) #if defined(OS_WIN)
bool direct_composition; bool direct_composition;
uint32_t bgra_format_support;
uint32_t yuy2_format_support;
uint32_t nv12_format_support;
bool supports_overlays; bool supports_overlays;
OverlaySupport yuy2_overlay_support; OverlaySupport yuy2_overlay_support;
OverlaySupport nv12_overlay_support; OverlaySupport nv12_overlay_support;
...@@ -305,12 +301,6 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const { ...@@ -305,12 +301,6 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
// TODO(kbr): add dx_diagnostics on Windows. // TODO(kbr): add dx_diagnostics on Windows.
#if defined(OS_WIN) #if defined(OS_WIN)
enumerator->AddBool("directComposition", direct_composition); enumerator->AddBool("directComposition", direct_composition);
enumerator->AddString("bgraFormatSupport",
base::StringPrintf("0x%08x", bgra_format_support));
enumerator->AddString("yuy2FormatSupport",
base::StringPrintf("0x%08x", yuy2_format_support));
enumerator->AddString("nv12FormatSupport",
base::StringPrintf("0x%08x", nv12_format_support));
enumerator->AddBool("supportsOverlays", supports_overlays); enumerator->AddBool("supportsOverlays", supports_overlays);
enumerator->AddString("yuy2OverlaySupport", enumerator->AddString("yuy2OverlaySupport",
OverlaySupportToString(yuy2_overlay_support)); OverlaySupportToString(yuy2_overlay_support));
......
...@@ -310,10 +310,6 @@ struct GPU_EXPORT GPUInfo { ...@@ -310,10 +310,6 @@ struct GPU_EXPORT GPUInfo {
#if defined(OS_WIN) #if defined(OS_WIN)
// True if we use direct composition surface on Windows. // True if we use direct composition surface on Windows.
bool direct_composition = false; bool direct_composition = false;
// The information returned by ID3D11Device::CheckFormatSupport().
uint32_t bgra_format_support = 0;
uint32_t yuy2_format_support = 0;
uint32_t nv12_format_support = 0;
// True if we use direct composition surface overlays on Windows. // True if we use direct composition surface overlays on Windows.
bool supports_overlays = false; bool supports_overlays = false;
......
...@@ -144,12 +144,6 @@ struct GpuInfo { ...@@ -144,12 +144,6 @@ struct GpuInfo {
[EnableIf=is_win] [EnableIf=is_win]
bool direct_composition; bool direct_composition;
[EnableIf=is_win] [EnableIf=is_win]
uint32 bgra_format_support;
[EnableIf=is_win]
uint32 yuy2_format_support;
[EnableIf=is_win]
uint32 nv12_format_support;
[EnableIf=is_win]
bool supports_overlays; bool supports_overlays;
[EnableIf=is_win] [EnableIf=is_win]
OverlaySupport yuy2_overlay_support; OverlaySupport yuy2_overlay_support;
......
...@@ -363,9 +363,6 @@ bool StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo>::Read( ...@@ -363,9 +363,6 @@ bool StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo>::Read(
#if defined(OS_WIN) #if defined(OS_WIN)
out->direct_composition = data.direct_composition(); out->direct_composition = data.direct_composition();
out->bgra_format_support = data.bgra_format_support();
out->yuy2_format_support = data.yuy2_format_support();
out->nv12_format_support = data.nv12_format_support();
out->supports_overlays = data.supports_overlays(); out->supports_overlays = data.supports_overlays();
#endif #endif
......
...@@ -322,18 +322,6 @@ struct StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo> { ...@@ -322,18 +322,6 @@ struct StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo> {
return input.direct_composition; return input.direct_composition;
} }
static uint32_t bgra_format_support(const gpu::GPUInfo& input) {
return input.bgra_format_support;
}
static uint32_t yuy2_format_support(const gpu::GPUInfo& input) {
return input.yuy2_format_support;
}
static uint32_t nv12_format_support(const gpu::GPUInfo& input) {
return input.nv12_format_support;
}
static bool supports_overlays(const gpu::GPUInfo& input) { static bool supports_overlays(const gpu::GPUInfo& input) {
return input.supports_overlays; return input.supports_overlays;
} }
......
...@@ -155,9 +155,6 @@ TEST_F(StructTraitsTest, GpuInfo) { ...@@ -155,9 +155,6 @@ TEST_F(StructTraitsTest, GpuInfo) {
const bool passthrough_cmd_decoder = true; const bool passthrough_cmd_decoder = true;
#if defined(OS_WIN) #if defined(OS_WIN)
const bool direct_composition = true; const bool direct_composition = true;
const uint32_t bgra_format_support = 0x33fef3f3;
const uint32_t yuy2_format_support = 0x3a820320;
const uint32_t nv12_format_support = 0xfa82c320;
const bool supports_overlays = true; const bool supports_overlays = true;
const OverlaySupport yuy2_overlay_support = OverlaySupport::kScaling; const OverlaySupport yuy2_overlay_support = OverlaySupport::kScaling;
const OverlaySupport nv12_overlay_support = OverlaySupport::kNone; const OverlaySupport nv12_overlay_support = OverlaySupport::kNone;
...@@ -202,9 +199,6 @@ TEST_F(StructTraitsTest, GpuInfo) { ...@@ -202,9 +199,6 @@ TEST_F(StructTraitsTest, GpuInfo) {
input.passthrough_cmd_decoder = passthrough_cmd_decoder; input.passthrough_cmd_decoder = passthrough_cmd_decoder;
#if defined(OS_WIN) #if defined(OS_WIN)
input.direct_composition = direct_composition; input.direct_composition = direct_composition;
input.bgra_format_support = bgra_format_support;
input.yuy2_format_support = yuy2_format_support;
input.nv12_format_support = nv12_format_support;
input.supports_overlays = supports_overlays; input.supports_overlays = supports_overlays;
input.yuy2_overlay_support = yuy2_overlay_support; input.yuy2_overlay_support = yuy2_overlay_support;
input.nv12_overlay_support = nv12_overlay_support; input.nv12_overlay_support = nv12_overlay_support;
...@@ -265,9 +259,6 @@ TEST_F(StructTraitsTest, GpuInfo) { ...@@ -265,9 +259,6 @@ TEST_F(StructTraitsTest, GpuInfo) {
EXPECT_EQ(passthrough_cmd_decoder, output.passthrough_cmd_decoder); EXPECT_EQ(passthrough_cmd_decoder, output.passthrough_cmd_decoder);
#if defined(OS_WIN) #if defined(OS_WIN)
EXPECT_EQ(direct_composition, output.direct_composition); EXPECT_EQ(direct_composition, output.direct_composition);
EXPECT_EQ(bgra_format_support, output.bgra_format_support);
EXPECT_EQ(yuy2_format_support, output.yuy2_format_support);
EXPECT_EQ(nv12_format_support, output.nv12_format_support);
EXPECT_EQ(supports_overlays, output.supports_overlays); EXPECT_EQ(supports_overlays, output.supports_overlays);
EXPECT_EQ(yuy2_overlay_support, output.yuy2_overlay_support); EXPECT_EQ(yuy2_overlay_support, output.yuy2_overlay_support);
EXPECT_EQ(nv12_overlay_support, output.nv12_overlay_support); EXPECT_EQ(nv12_overlay_support, output.nv12_overlay_support);
......
...@@ -92,15 +92,6 @@ void InitializePlatformOverlaySettings(GPUInfo* gpu_info) { ...@@ -92,15 +92,6 @@ void InitializePlatformOverlaySettings(GPUInfo* gpu_info) {
DCHECK(gpu_info); DCHECK(gpu_info);
gpu_info->direct_composition = gpu_info->direct_composition =
gl::DirectCompositionSurfaceWin::IsDirectCompositionSupported(); gl::DirectCompositionSurfaceWin::IsDirectCompositionSupported();
gpu_info->bgra_format_support = static_cast<uint32_t>(
gl::DirectCompositionSurfaceWin::GetFormatSupportFlags(
DXGI_FORMAT_B8G8R8A8_UNORM));
gpu_info->yuy2_format_support = static_cast<uint32_t>(
gl::DirectCompositionSurfaceWin::GetFormatSupportFlags(
DXGI_FORMAT_YUY2));
gpu_info->nv12_format_support = static_cast<uint32_t>(
gl::DirectCompositionSurfaceWin::GetFormatSupportFlags(
DXGI_FORMAT_NV12));
gpu_info->supports_overlays = gpu_info->supports_overlays =
gl::DirectCompositionSurfaceWin::AreOverlaysSupported(); gl::DirectCompositionSurfaceWin::AreOverlaysSupported();
gpu_info->nv12_overlay_support = FlagsToOverlaySupport( gpu_info->nv12_overlay_support = FlagsToOverlaySupport(
......
...@@ -276,18 +276,6 @@ UINT DirectCompositionSurfaceWin::GetOverlaySupportFlags(DXGI_FORMAT format) { ...@@ -276,18 +276,6 @@ UINT DirectCompositionSurfaceWin::GetOverlaySupportFlags(DXGI_FORMAT format) {
return g_yuy2_overlay_support_flags; return g_yuy2_overlay_support_flags;
} }
// static
UINT DirectCompositionSurfaceWin::GetFormatSupportFlags(DXGI_FORMAT format) {
Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device =
QueryD3D11DeviceObjectFromANGLE();
if (!d3d11_device)
return 0;
UINT support_flags = 0;
if (FAILED(d3d11_device->CheckFormatSupport(format, &support_flags)))
return 0;
return support_flags;
}
// static // static
gfx::Size DirectCompositionSurfaceWin::GetOverlayMonitorSize() { gfx::Size DirectCompositionSurfaceWin::GetOverlayMonitorSize() {
return g_overlay_monitor_size; return g_overlay_monitor_size;
......
...@@ -69,9 +69,6 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL { ...@@ -69,9 +69,6 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL {
// DXGI_OVERLAY_SUPPORT_FLAG_SCALING bits. // DXGI_OVERLAY_SUPPORT_FLAG_SCALING bits.
static UINT GetOverlaySupportFlags(DXGI_FORMAT format); static UINT GetOverlaySupportFlags(DXGI_FORMAT format);
// Returns queried flags from ID3D11Device::CheckFormatSupport().
static UINT GetFormatSupportFlags(DXGI_FORMAT format);
// Returns true if there is an HDR capable display connected. // Returns true if there is an HDR capable display connected.
static bool IsHDRSupported(); static bool IsHDRSupported();
......
...@@ -67,6 +67,18 @@ void DestroySurface(scoped_refptr<DirectCompositionSurfaceWin> surface) { ...@@ -67,6 +67,18 @@ void DestroySurface(scoped_refptr<DirectCompositionSurfaceWin> surface) {
base::RunLoop().RunUntilIdle(); 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( Microsoft::WRL::ComPtr<ID3D11Texture2D> CreateNV12Texture(
const Microsoft::WRL::ComPtr<ID3D11Device>& d3d11_device, const Microsoft::WRL::ComPtr<ID3D11Device>& d3d11_device,
const gfx::Size& size, const gfx::Size& size,
...@@ -916,6 +928,11 @@ TEST_F(DirectCompositionPixelTest, NV12SwapChain) { ...@@ -916,6 +928,11 @@ TEST_F(DirectCompositionPixelTest, NV12SwapChain) {
// are supported. // are supported.
DirectCompositionSurfaceWin::SetScaledOverlaysSupportedForTesting(true); 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 window_size(100, 100);
gfx::Size texture_size(50, 50); gfx::Size texture_size(50, 50);
// Pass content rect with odd with and height. Surface should round up // 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