<div dir="ltr">Hi Christian,<div><br></div><div>Thx for the suggestion. Actually I thought about dmabuf (ref project proposal), but not about opening the EGL so using an internal mesa function. Also eglExportDMABUFImageMESA is still tagged 'MESA' (EGL_MESA_image_dma_buf_export<wbr>). Compared to EGL_<b>EXT</b>_image_dma_buf_impor<wbr>t .</div><div>This need more thought so I will see later.</div><div><br></div><div>Also for dmabuf, 'ideally' the spec should just be improved to pass the fd directly to OMX_UseBuffer. Some board went ahead and exposed that as a vendor omx extension. </div><div><br></div><div>But so far <span style="font-size:12.8px">st_omx_pipe_texture_from_</span><span style="font-size:12.8px">e<wbr>glimage_v1 mentioned in previous email works fine (color issue is fixed now). So we will keep it like this for now.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thx</span></div><div><span style="font-size:12.8px">Julien</span></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 July 2017 at 16:39, Christian König <span dir="ltr"><<a href="mailto:deathsimple@vodafone.de" target="_blank">deathsimple@vodafone.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div class="m_3776783007517911473moz-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.<div><div class="h5"><br>
      <br>
      Am 13.07.2017 um 14:26 schrieb Julien Isorce:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <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/<wbr>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_<wbr>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_<wbr>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_<wbr>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/<wbr>drivers/dri/common \</div>
          <div>+       -I$(top_srcdir)/src/mesa/<wbr>drivers/dri/common \</div>
          <div>+       -I$(top_srcdir)/src/egl/<wbr>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/<wbr>backends/dri \</div>
          <div>+       -I$(top_srcdir)/src/gallium/<wbr>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_<wbr>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">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">https://summerofcode.withg<wbr>oogle.com/projects/#4737166321<wbr>123328</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">https://github.com/gpalsin<wbr>gh/mesa/blob/gsoc-dev/src/<wbr>gallium/state_trackers/omx_<wbr>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" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
            <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="m_3776783007517911473mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
mesa-dev mailing list
<a class="m_3776783007517911473moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a>
<a class="m_3776783007517911473moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  </div></div></div>

</blockquote></div><br></div>