Bug 1655747 [Linux] Implement SurfaceFormat::YUV format for DMABUFTextureHostOGL, r=sotaro

Differential Revision: https://phabricator.services.mozilla.com/D85270
This commit is contained in:
Martin Stransky 2020-07-30 18:52:40 +00:00
Родитель 7aec6c65c1
Коммит 55005b2f5b
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -162,6 +162,20 @@ void DMABUFTextureHostOGL::PushResourceUpdates(
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
break;
}
case gfx::SurfaceFormat::YUV: {
MOZ_ASSERT(aImageKeys.length() == 3);
MOZ_ASSERT(mSurface->GetTextureCount() == 3);
wr::ImageDescriptor descriptor0(
gfx::IntSize(mSurface->GetWidth(0), mSurface->GetHeight(0)),
gfx::SurfaceFormat::A8);
wr::ImageDescriptor descriptor1(
gfx::IntSize(mSurface->GetWidth(1), mSurface->GetHeight(1)),
gfx::SurfaceFormat::A8);
(aResources.*method)(aImageKeys[0], descriptor0, aExtID, imageType, 0);
(aResources.*method)(aImageKeys[1], descriptor1, aExtID, imageType, 1);
(aResources.*method)(aImageKeys[2], descriptor1, aExtID, imageType, 2);
break;
}
default: {
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
@ -197,6 +211,18 @@ void DMABUFTextureHostOGL::PushDisplayItems(
aPreferCompositorSurface);
break;
}
case gfx::SurfaceFormat::YUV: {
MOZ_ASSERT(aImageKeys.length() == 3);
MOZ_ASSERT(mSurface->GetTextureCount() == 3);
// Those images can only be generated at present by the VAAPI vp8 decoder
// which only supports 8 bits color depth.
aBuilder.PushYCbCrPlanarImage(
aBounds, aClip, true, aImageKeys[0], aImageKeys[1], aImageKeys[2],
wr::ColorDepth::Color8, wr::ToWrYuvColorSpace(GetYUVColorSpace()),
wr::ToWrColorRange(GetColorRange()), aFilter,
aPreferCompositorSurface);
break;
}
default: {
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}