From 3c0a965bd59525b427c6abf4aef192f581c6abdd Mon Sep 17 00:00:00 2001 From: Miko Mynttinen Date: Tue, 11 Aug 2020 01:13:30 +0000 Subject: [PATCH] Bug 1658113 - Set the surface format based on YCbCrDescriptor color depth r=jya Differential Revision: https://phabricator.services.mozilla.com/D86600 --- gfx/webrender_bindings/RenderExternalTextureHost.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gfx/webrender_bindings/RenderExternalTextureHost.cpp b/gfx/webrender_bindings/RenderExternalTextureHost.cpp index 4e818284a0fe..d8a6b8f2cd9e 100644 --- a/gfx/webrender_bindings/RenderExternalTextureHost.cpp +++ b/gfx/webrender_bindings/RenderExternalTextureHost.cpp @@ -61,16 +61,18 @@ bool RenderExternalTextureHost::CreateSurfaces() { mSize, mFormat); } else { const layers::YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor(); + const SurfaceFormat surfaceFormat = + SurfaceFormatForColorDepth(desc.colorDepth()); mSurfaces[0] = gfx::Factory::CreateWrappingDataSourceSurface( layers::ImageDataSerializer::GetYChannel(GetBuffer(), desc), - desc.yStride(), desc.ySize(), gfx::SurfaceFormat::A8); + desc.yStride(), desc.ySize(), surfaceFormat); mSurfaces[1] = gfx::Factory::CreateWrappingDataSourceSurface( layers::ImageDataSerializer::GetCbChannel(GetBuffer(), desc), - desc.cbCrStride(), desc.cbCrSize(), gfx::SurfaceFormat::A8); + desc.cbCrStride(), desc.cbCrSize(), surfaceFormat); mSurfaces[2] = gfx::Factory::CreateWrappingDataSourceSurface( layers::ImageDataSerializer::GetCrChannel(GetBuffer(), desc), - desc.cbCrStride(), desc.cbCrSize(), gfx::SurfaceFormat::A8); + desc.cbCrStride(), desc.cbCrSize(), surfaceFormat); } for (size_t i = 0; i < PlaneCount(); ++i) {