[PATCH weston 5/5] gl-renderer: use correct pixel shader for NV12 format uploaded to RG texture

Arnaud Vrac rawoul at gmail.com
Mon Dec 4 17:15:27 UTC 2017


On Mon, Dec 4, 2017 at 6:08 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 29 November 2017 at 14:25, Arnaud Vrac <rawoul at gmail.com> wrote:
>> Signed-off-by: Arnaud Vrac <rawoul at gmail.com>
>
> Please mention how you've spotted and/or verified this.
>
> I'm ~90% this is correct, although I would check with the author.
> Vincent, can you double check the patch/series [1]?

I'm also not 100% sure about this one, I found all three drivers I
mentionned on the cover letter displayed the wrong colors for NV12
with R/G textures. This just seemed the logical fix after reading the
pixel shaders code.

I'll mention this in the commit message.

Thanks,
-Arnaud

>
> Fixes: 00a03d2f724 ("gl-renderer: add support of WL_SHM_FORMAT_NV12")
> Cc: Vincent Abriou <vincent.abriou at st.com>
>
> -Emil
>> ---
>>  libweston/gl-renderer.c | 3 ++-
>>  1 file cNphanged, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
>> index 60a7bf06..4fffa78c 100644
>> --- a/libweston/gl-renderer.c
>> +++ b/libweston/gl-renderer.c
>> @@ -1596,7 +1596,6 @@ gl_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
>>                 }
>>                 break;
>>         case WL_SHM_FORMAT_NV12:
>> -               gs->shader = &gr->texture_shader_y_xuxv;
>>                 pitch = wl_shm_buffer_get_stride(shm_buffer);
>>                 gl_pixel_type = GL_UNSIGNED_BYTE;
>>                 num_planes = 2;
>> @@ -1605,9 +1604,11 @@ gl_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
>>                 gs->hsub[1] = 2;
>>                 gs->vsub[1] = 2;
>>                 if (gr->has_gl_texture_rg) {
>> +                       gs->shader = &gr->texture_shader_y_uv;
>>                         gl_format[0] = GL_R8_EXT;
>>                         gl_format[1] = GL_RG8_EXT;
>>                 } else {
>> +                       gs->shader = &gr->texture_shader_y_xuxv;
>>                         gl_format[0] = GL_LUMINANCE;
>>                         gl_format[1] = GL_LUMINANCE_ALPHA;
>>                 }
>> --
>> 2.15.0


More information about the wayland-devel mailing list