From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: nicolas@ndufresne.ca, Rob Clark <robdclark@gmail.com>,
Stanimir Varbanov <stanimir.varbanov@linaro.org>
Cc: Discussion of the development of and with GStreamer
<gstreamer-devel@lists.freedesktop.org>,
Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: gstreamer: v4l2videodec plugin
Date: Thu, 28 Apr 2016 14:33:16 +0300 [thread overview]
Message-ID: <5721F4FC.30001@linaro.org> (raw)
In-Reply-To: <1460736595.973.5.camel@ndufresne.ca>
On 04/15/2016 07:09 PM, Nicolas Dufresne wrote:
> Le vendredi 15 avril 2016 à 11:58 -0400, Rob Clark a écrit :
>> The issue is probably the YUV format, which we cannot really deal
>> with
>> properly in gallium.. it's a similar issue to multi-planer even if
>> it
>> is in a single buffer.
>>
>> The best way to handle this would be to import the same dmabuf fd
>> twice, with appropriate offsets, to create one GL_RED eglimage for Y
>> and one GL_RG eglimage for UV, and then combine them in shader in a
>> similar way to how you'd handle separate Y and UV planes..
>
> That's the strategy we use in GStreamer, as very few GL stack support
> implicit color conversions. For that to work you need to implement the
> "offset" field in winsys_handle, that was added recently, and make sure
> you have R8 and RG88 support (usually this is just mapping).
Thanks,
OK, I have made the relevant changes in Mesa and now I have image but
the U and V components are swapped (the format is NV12, the UV plane is
at the same buffer but at offset). Digging further and tracing gstreamer
with apitrace I'm observing something weird.
The gst import dmabuf with following call:
eglCreateImageKHR(dpy = 0x7fa8013030, ctx = NULL, target =
EGL_LINUX_DMA_BUF_EXT, buffer = NULL, attrib_list = {EGL_WIDTH, 640,
EGL_HEIGHT, 360, EGL_LINUX_DRM_FOURCC_EXT, 943215175,
EGL_DMA_BUF_PLANE0_FD_EXT, 29, EGL_DMA_BUF_PLANE0_OFFSET_EXT, 942080,
EGL_DMA_BUF_PLANE0_PITCH_EXT, 1280, EGL_NONE}) = 0x7f980027d0
the fourcc format is DRM_FORMAT_GR88 (943215175 decimal).
after that:
glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_RG8,
width = 640, height = 360, border = 0, format = GL_RG, type =
GL_UNSIGNED_BYTE, pixels = NULL)
and finally on the fragment shader we have:
yuv.x=texture2D(Ytex, texcoord * tex_scale0).r;
yuv.yz=texture2D(UVtex, texcoord * tex_scale1).rg;
I was expecting to see DRM_FORMAT_RG88 / GL_RG and shader sampling
y <- r
z <- g
or DRM_FORMAT_GR88 / GL_RG and shader sampling
y <- g
z <- r
Also, browsing the code in Mesa for Intel i965 dri driver I found where
the __DRI_IMAGE_FORMAT_GR88 becomes MESA_FORMAT_R8G8_UNORM [1].
So I'm wondering is that intensional?
Depending on the answer I should make the same in the Gallium dri2 in
dri2_from_dma_bufs().
--
regards,
Stan
[1]
https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/common/dri_util.c#n878
next prev parent reply other threads:[~2016-04-28 11:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 12:03 gstreamer: v4l2videodec plugin Stanimir Varbanov
2016-04-11 12:11 ` Stanimir Varbanov
2016-04-11 12:55 ` Víctor M. Jáquez L.
2016-04-12 8:23 ` Stanimir Varbanov
2016-04-11 16:25 ` Nicolas Dufresne
2016-04-12 8:57 ` Stanimir Varbanov
2016-04-12 12:00 ` Stanimir Varbanov
2016-04-12 15:57 ` Nicolas Dufresne
2016-05-13 8:45 ` Stanimir Varbanov
2016-05-14 10:59 ` Nicolas Dufresne
2016-05-14 12:07 ` Stanimir Varbanov
2016-05-19 13:25 ` Philipp Zabel
2016-05-19 14:37 ` Nicolas Dufresne
2016-05-15 7:41 ` Nicolas Dufresne
2016-05-15 15:02 ` ayaka
2016-04-15 15:58 ` Rob Clark
2016-04-15 16:09 ` Nicolas Dufresne
2016-04-18 14:22 ` Rob Clark
2016-04-28 11:33 ` Stanimir Varbanov [this message]
2016-04-29 9:32 ` Stanimir Varbanov
2016-04-29 11:44 ` Rob Clark
2016-05-01 21:48 ` Nicolas Dufresne
2016-05-09 8:13 ` Stanimir Varbanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5721F4FC.30001@linaro.org \
--to=stanimir.varbanov@linaro.org \
--cc=gstreamer-devel@lists.freedesktop.org \
--cc=linux-media@vger.kernel.org \
--cc=nicolas@ndufresne.ca \
--cc=robdclark@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox