[Mesa-dev] Sampling DRM_FORMAT_YUYV in GLSL

Volker Vogelhuber v.vogelhuber at digitalendoscopy.de
Tue May 9 11:54:31 UTC 2017


Hi Daniel,
> Hi Volker,
>
> On 9 May 2017 at 12:32, Volker Vogelhuber
> <v.vogelhuber at digitalendoscopy.de> wrote:
>> On 09.05.2017 12:59, Philipp Zabel wrote:
>>> You create two separate EGLImages, calling eglCreateImage once for each
>>> plane. See for example:
>>>
>>> https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/gst-libs/gst/gl/gstglupload.c#n646
>>>
>>> or
>>>
>>> https://cgit.freedesktop.org/wayland/weston/tree/libweston/gl-renderer.c#n1536
>> That assumes I have two planes available. But as mentioned the planes
>> are created internally by dri2_create_image_dma_buf during my call of
>> eglCreateImage.
>> So from the API point of view I only have one FD from the V4L2 buffer that
>> is of type
>> FOURCC('Y','U','Y','V'). Passing that FD to eglCreateImage returns only one
>> EGLImage.
>> Although understanding gstreamer code is always a bit hard, I think in their
>> case they have
>> a mulit plane V4L2 buffer, where I only have a single plane buffer.
> What Philipp is suggesting is that you import the same plane to an
> EGLImage twice: once as DRM_FORMAT_RG8 and once as
> DRM_FORMAT_ARGB8888. This gives you two EGLImages, which you bind to
> two separate texture units / samplers: you sample the Y channel from
> the DRM_FORMAT_RG8 image (ignoring the other channel), and you sample
> the U and V channels from the DRM_FORMAT_ARGB8888 image (ignoring the
> other two channels). This is what GStreamer and Weston do when
> confronted with such a buffer, and it does work.
>
>> That's why I wonder if there is a way to retrieve the "second" EGLImage
>> after eglCreateImage
>> has been called for the single V4L2 DMABUF file descriptor.
> There is not a way to do this.
>
>
Ah, OK, now I got it. Thanks! I guess the DRM_FORMAT_ARGB8888
width parameter has to be half the original width, as I only have 16bit 
per pixel.



More information about the mesa-dev mailing list