<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Julien,<br>
<br>
sorry, totally missed that question.<br>
<br>
I think the cleanest approach would be that the OpenMAX state
tracker dlopen()s the EGL and tries to export the eglImage into a
dma_buf handle.<br>
<br>
No idea how to do this, but I'm pretty sure somebody on the
mailing list should know the details how this can be solved.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 13.07.2017 um 14:26 schrieb Julien Isorce:<br>
</div>
<blockquote type="cite"
cite="mid:CAHWPjbWxGtdOW80auDuYE0ozNBZxsV7ht=QRSRTAGyPJZ+QOag@mail.gmail.com">
<div dir="ltr">Hi,
<div><br>
</div>
<div>With Gurkirpal we have been blocked on this problem last
week and that would be great to get some input.</div>
<div>It is not really urgent because Gurkirpal switched to the
encoder work for the time being. </div>
<div><br>
</div>
<div>So the goal is from src/gallium/state_trackers/omx, to find
a way to retrieve the underlying struct pipe_texture given we
have an EGLDisplay and an EGLImage as inputs. So then we can
tell the decoder to use it directly.</div>
<div><br>
</div>
<div>In order to help Gurkirpal, I had another go more recently
and here are 2 solutions that seems to work but not sure if
this is 100 % valid (build deps, safe). It builds and does not
crash but some feedback would be great. By "it works", I just
mean that I can print the pipe_texture->width0 and height0
and values are correct. I have not tried to use the
pipe_texture, this will be Gurkirpal's job :) and because I am
not sure this is the right way. Note that the 2 following
functions return the same pointer. </div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>#include "dri_screen.h"</div>
<div>#include "egl_dri2.h"</div>
<div><br>
</div>
<div>static struct pipe_resource *</div>
<div>st_omx_pipe_texture_from_eglimage_v1(EGLDisplay
egldisplay, EGLImage eglimage)</div>
<div>{</div>
<div> _EGLDisplay *disp = egldisplay;</div>
<div> struct dri2_egl_display *dri2_egl_dpy =
disp->DriverData;</div>
<div> __DRIscreen *_dri_screen = dri2_egl_dpy->dri_screen;</div>
<div> struct dri_screen *st_dri_screen =
dri_screen(_dri_screen);</div>
<div> __DRIimage *_dri_image =
st_dri_screen->lookup_egl_image(st_dri_screen, eglimage);</div>
<div><br>
</div>
<div> return _dri_image->texture;</div>
<div>}</div>
<div><br>
</div>
<div>static struct pipe_resource *</div>
<div>st_omx_pipe_texture_from_eglimage_v2(EGLDisplay
egldisplay, EGLImage eglimage)</div>
<div>{</div>
<div> _EGLImage *img = eglimage;</div>
<div> struct dri2_egl_image *dri2_egl_img = (struct
dri2_egl_image*)img;</div>
<div> __DRIimage *_dri_image = dri2_egl_img->dri_image;</div>
<div><br>
</div>
<div> return _dri_image->texture;</div>
<div>}</div>
</div>
<div><br>
</div>
<div>And in the Makefile.am it is required to have:</div>
<div><br>
</div>
<div>
<div> AM_CFLAGS = \</div>
<div>+ -I$(top_srcdir)/include \</div>
<div>+ -I$(top_srcdir)/src/mapi \</div>
<div>+ -I$(top_srcdir)/src/mesa \</div>
<div>+ -I$(top_builddir)/src/mesa/drivers/dri/common \</div>
<div>+ -I$(top_srcdir)/src/mesa/drivers/dri/common \</div>
<div>+ -I$(top_srcdir)/src/egl/drivers/dri2 \</div>
<div>+ -I$(top_srcdir)/src/egl/main \</div>
<div>+ -I$(top_srcdir)/src/gbm/main \</div>
<div>+ -I$(top_srcdir)/src/loader \</div>
<div>+ -I$(top_srcdir)/src/gbm/backends/dri \</div>
<div>+ -I$(top_srcdir)/src/gallium/state_trackers/dri \</div>
<div> $(GALLIUM_CFLAGS) \</div>
<div>+ $(LIBDRM_CFLAGS) \</div>
<div> $(VISIBILITY_CFLAGS) \</div>
<div> $(VL_CFLAGS) \</div>
<div> $(XCB_DRI3_CFLAGS) \</div>
</div>
<div><br>
</div>
<div>So I wonder if this is the right approach or this should be
hook up in vl_screen or pipe_context somehow.</div>
<div>It looks to me the v1 is safer because it calls
lookup_egl_image which seems to go all the way down and
internally calls _eglCheckResource so it does some validity
check on the input pointers.</div>
<div>The v2 looks simpler but it does not even use the
egldisplay pointer.</div>
<div>Also I wonder if there is a way to avoid using
dri2_egl_display/dri2_egl_image.</div>
<div><br>
</div>
<div>Thx</div>
<div>Julien</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 8 July 2017 at 22:38, Gurkirpal
Singh <span dir="ltr"><<a
href="mailto:gurkirpal204@gmail.com" target="_blank"
moz-do-not-send="true">gurkirpal204@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,
<div><br>
</div>
<div>As a part of my GSoC project[1] I'm working on adding
OMX_UseEGLImage support in gallium/st/omx.</div>
<div><br>
</div>
<div>I have an egl_display[1] (<span
style="font-size:12.8px">OMX_NATIVE_WINDOWTYPE) and
the EGLImage[2] in the H.264 decoder component. I'm
looking some sort of method to get mesa pipe screen
pointer (or some other pipe structure) from the
egl_display and from which I can get struct
pipe_surface and eglimage pointer/id.</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">[1] <a
href="https://summerofcode.withgoogle.com/projects/#4737166321123328"
target="_blank" moz-do-not-send="true">https://summerofcode.<wbr>withgoogle.com/projects/#<wbr>4737166321123328</a></span></div>
<div><span style="font-size:12.8px">[2] <a
href="https://github.com/gpalsingh/mesa/blob/gsoc-dev/src/gallium/state_trackers/omx_tizonia/h264dprc.c#L205"
target="_blank" moz-do-not-send="true">https://github.com/<wbr>gpalsingh/mesa/blob/gsoc-dev/<wbr>src/gallium/state_trackers/<wbr>omx_tizonia/h264dprc.c#L205</a></span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">Thanks,</span></div>
<div><span style="font-size:12.8px">Gurkirpal</span></div>
</div>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org"
moz-do-not-send="true">mesa-dev@lists.freedesktop.org</a><br>
<a
href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
mesa-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>