gl-renderer: Add support for WL_SHM_FORMAT_YUV444

We support this as an explicit YUV fallback path in gl-renderer's dmabuf
EGLImage import path, so might as well support it in the SHM path, given
it's just YUV420 with no subsampling.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone
2022-04-28 01:21:15 +01:00
committed by Pekka Paalanen
parent c2cfadfce9
commit 820f3ae866
2 changed files with 23 additions and 15 deletions
+5 -1
View File
@@ -1918,12 +1918,15 @@ gl_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer)
switch (buffer->pixel_format->format) {
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV444:
shader_variant = SHADER_VARIANT_Y_U_V;
pitch = wl_shm_buffer_get_stride(shm_buffer);
gl_pixel_type = GL_UNSIGNED_BYTE;
num_planes = 3;
offset[1] = offset[0] + pitch * buffer->height;
offset[2] = offset[1] + (pitch / 2) * (buffer->height / 2);
offset[2] = offset[1] +
(pitch / pixel_format_hsub(buffer->pixel_format, 1)) *
(buffer->height / pixel_format_vsub(buffer->pixel_format, 1));
gl_format[0] = GL_R8_EXT;
gl_format[1] = GL_R8_EXT;
gl_format[2] = GL_R8_EXT;
@@ -3693,6 +3696,7 @@ gl_renderer_display_create(struct weston_compositor *ec,
wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGB565);
wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_YUV420);
wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_YUV444);
wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_NV12);
wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_YUYV);
wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_XYUV8888);