mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
multi-texture-format: Add P010 YCbCr format
It's the 10 bit equivalent to NV12 and uses the same layout as P016, i.e. 16 bit components with the lowest 6 bits set to 0 (padding), allowing us to use 16 bit "subformats". Thus adding support is quite trivial as we can reuse the NV12 shader. The format is widely supported in decoding and display hardware (on Intel since Kaby Lake), as well as modern codecs (AV1, VP9, HEVC) and has visible quality advantages over NV12. Note that the additional colors are lost if composited to a 8 bit RGB framebuffer. Switching between direct scanout and compositing can thus cause quality differences. This is no new phenomena, however, as the same is the case already for e.g. GL clients using 10 bit formats - including video players. Also note that P012 and P016 could trivially added as well - it's not done here as they are uncommen and thus hard to test. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
This commit is contained in:
parent
66799c1aa0
commit
a9c24ff653
@ -62,6 +62,7 @@ static const CoglDrmFormatMap meta_cogl_drm_format_map[] = {
|
||||
{ DRM_FORMAT_ABGR16161616F, COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE, META_MULTI_TEXTURE_FORMAT_SIMPLE },
|
||||
{ DRM_FORMAT_YUYV, COGL_PIXEL_FORMAT_ANY, META_MULTI_TEXTURE_FORMAT_YUYV },
|
||||
{ DRM_FORMAT_NV12, COGL_PIXEL_FORMAT_ANY, META_MULTI_TEXTURE_FORMAT_NV12 },
|
||||
{ DRM_FORMAT_P010, COGL_PIXEL_FORMAT_ANY, META_MULTI_TEXTURE_FORMAT_P010 },
|
||||
{ DRM_FORMAT_YUV420, COGL_PIXEL_FORMAT_ANY, META_MULTI_TEXTURE_FORMAT_YUV420 },
|
||||
#elif G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBX_8888, META_MULTI_TEXTURE_FORMAT_SIMPLE },
|
||||
|
@ -135,6 +135,16 @@ static MetaMultiTextureFormatInfo multi_format_table[] = {
|
||||
.rgb_shader = y_uv_shader,
|
||||
.snippet_once = G_ONCE_INIT,
|
||||
},
|
||||
[META_MULTI_TEXTURE_FORMAT_P010] = {
|
||||
.name = "P010",
|
||||
.n_planes = 2,
|
||||
.subformats = { COGL_PIXEL_FORMAT_G_16, COGL_PIXEL_FORMAT_RG_1616 },
|
||||
.plane_indices = { 0, 1 },
|
||||
.hsub = { 1, 2 },
|
||||
.vsub = { 1, 2 },
|
||||
.rgb_shader = y_uv_shader,
|
||||
.snippet_once = G_ONCE_INIT,
|
||||
},
|
||||
/* 3 plane YUV */
|
||||
[META_MULTI_TEXTURE_FORMAT_YUV420] = {
|
||||
.name = "YUV420",
|
||||
|
@ -37,6 +37,7 @@ typedef enum _MetaMultiTextureFormat
|
||||
META_MULTI_TEXTURE_FORMAT_SIMPLE,
|
||||
META_MULTI_TEXTURE_FORMAT_YUYV,
|
||||
META_MULTI_TEXTURE_FORMAT_NV12,
|
||||
META_MULTI_TEXTURE_FORMAT_P010,
|
||||
META_MULTI_TEXTURE_FORMAT_YUV420,
|
||||
} MetaMultiTextureFormat;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user