Commit 917ef219 authored by Brian Ho's avatar Brian Ho Committed by Commit Bot

viz: Convert P010 to RGBA-ish 1010102

Currently, P010 (both HDR and SDR) videos don't render on
SkiaRenderer on Chrome OS. One issue is that creating the SkImage
fails due to a color type/color format check [1].

The GrBackendFormat is created from a P010 format as GL_RGBA8_OES
when hitting a NOTREACHED code block [2]. Similarly, the SkColorType
is converted from P010 as kN32_SkColorType [3] which is a
platform-dependent alias of either kRGBA_ or kBGRA_ [4]. If the
platform supports a BGRA byte order, SkImage_Gpu::MakePromiseTexture
fails because RGBA != BGRA.

This CL handles P010 in some resource format conversion functions
by converting to its closest neighbor- RGBA1010102.

[1] https://source.chromium.org/chromium/chromium/src/+/master:third_party/skia/src/image/SkImage_Gpu.cpp;l=548;drc=1fc76ce6ff5553c3c1b98f34350c14887b6d4be7
[2] https://source.chromium.org/chromium/chromium/src/+/master:components/viz/common/resources/resource_format_utils.cc;l=337;drc=3e072dfcd46e4d23e7b985ffe97f784ec2731b86
[3] https://source.chromium.org/chromium/chromium/src/+/master:components/viz/common/resources/resource_format_utils.cc;l=66;drc=3e072dfcd46e4d23e7b985ffe97f784ec2731b86
[4] https://source.chromium.org/chromium/chromium/src/+/master:third_party/skia/include/core/SkImageInfo.h;l=96;drc=e3dc752d1c137b90e708d70e415d7cb1fd85326f

Bug: 1138518
Change-Id: Ib7788c73919222dff1c09e315317e623e28481e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2468443Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817676}
parent f2b0671f
......@@ -42,6 +42,7 @@ SkColorType ResourceFormatToClosestSkColorType(bool gpu_compositing,
case RGBX_8888:
case ETC1:
return kRGB_888x_SkColorType;
case P010:
case RGBA_1010102:
return kRGBA_1010102_SkColorType;
case BGRA_1010102:
......@@ -62,8 +63,6 @@ SkColorType ResourceFormatToClosestSkColorType(bool gpu_compositing,
case RG_88:
return kR8G8_unorm_SkColorType;
case BGRX_8888:
case P010:
return kN32_SkColorType;
case RGBA_F16:
return kRGBA_F16_SkColorType;
......@@ -323,6 +322,7 @@ unsigned int TextureStorageFormat(ResourceFormat format) {
case RGBX_8888:
case ETC1:
return GL_RGB8_OES;
case P010:
case RGBA_1010102:
case BGRA_1010102:
return GL_RGB10_A2_EXT;
......@@ -331,7 +331,6 @@ unsigned int TextureStorageFormat(ResourceFormat format) {
return GL_RGB8_OES;
case BGR_565:
case BGRX_8888:
case P010:
break;
}
NOTREACHED();
......
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