<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 03/03/2014, Michel Dänzer wrote :<br>
    </div>
    <blockquote cite="mid:5314B681.2000707@ens.fr" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Son, 2014-03-02 at 17:21 -0800, Dave Airlie wrote:
><i> Module: Mesa
</i>><i> Branch: master
</i>><i> Commit: 15b4ff3f4e9460320dd629026743e17fa7109156
</i>><i> URL:    <a moz-do-not-send="true" href="http://cgit.freedesktop.org/mesa/mesa/commit/?id=15b4ff3f4e9460320dd629026743e17fa7109156">http://cgit.freedesktop.org/mesa/mesa/commit/?id=15b4ff3f4e9460320dd629026743e17fa7109156</a>
</i>><i> 
</i>><i> Author: Dave Airlie <<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">airlied at redhat.com</a>>
</i>><i> Date:   Wed Dec 18 10:01:27 2013 +1000
</i>><i> 
</i>><i> st/dri: add support for dma-buf importer (DRIimage v8)
</i>><i> 
</i>><i> This is just a simple implementation that stores the extra values into the DRIimage
</i>><i> struct and just uses the fd importer. I haven't looked into what is required
</i>><i> to import YUV or deal with the extra parameters.
</i>><i> 
</i>><i> Signed-off-by: Dave Airlie <<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">airlied at redhat.com</a>>
</i>
This change is causing problems for me with glamor on radeonsi. Running
piglit gpu.py, the X server crashes because loader is NULL in st/dri's
dri2_lookup_egl_image(), see backtrace below. Patching it to return NULL
in that case, piglit runs to completion, but some Mesa errors appear in
the X server's stderr:

Mesa: User error: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(non existant texture)
Mesa: 2 similar GL_INVALID_OPERATION errors
Mesa: User error: GL_INVALID_OPERATION in glTexSubImage2D(invalid texture image)
Mesa: 4 similar GL_INVALID_OPERATION errors
Mesa: User error: GL_INVALID_OPERATION in glFramebufferTexture2DEXT(non existant texture)

And some test windows leave artifacts on the screen.


Any ideas for a solution?


#0  0x00007f62aa4137b0 in dri2_lookup_egl_image (screen=<optimized out>, handle=0x3684790) at ../../../../../../src/gallium/state_trackers/dri/drm/dri2.c:555
#1  0x00007f62aa4123fd in dri_get_egl_image (smapi=0x2da3c60, egl_image=0x3684790, stimg=0x7fff24059bc0) at ../../../../../../src/gallium/state_trackers/dri/drm/dri_screen.c:321
#2  0x00007f62aa1b03fc in st_manager_get_egl_image_surface (st=0x342acb0, eglimg=<optimized out>) at ../../../src/mesa/state_tracker/st_manager.c:798
#3  0x00007f62aa187fb6 in st_egl_image_target_texture_2d (ctx=0x35f17b0, target=<optimized out>, texObj=0x34382f0, texImage=0x36a3710, image_handle=<optimized out>)
    at ../../../src/mesa/state_tracker/st_cb_eglimage.c:147
#4  0x00007f62aa1181eb in _mesa_EGLImageTargetTexture2DOES (target=3553, image=0x3684790) at ../../../src/mesa/main/teximage.c:3364
#5  0x00007f62aba619b8 in glamor_create_texture_from_image (image=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">image at entry</a>=0x3684790, texture=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">texture at entry</a>=0x7fff24059cec, glamor_egl=<optimized out>, glamor_egl=<optimized out>)
    at ../../src/glamor_egl.c:217
#6  0x00007f62aba61ca3 in glamor_egl_create_argb8888_based_texture (screen=<optimized out>, w=<optimized out>, h=<optimized out>) at ../../src/glamor_egl.c:255
#7  0x00007f62abc8fbec in _glamor_create_tex (glamor_priv=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">glamor_priv at entry</a>=0x25d7ec0, w=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">w at entry</a>=16, h=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">h at entry</a>=22, format=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">format at entry</a>=6408) at ../../src/glamor_fbo.c:344
#8  0x00007f62abc9025f in glamor_create_fbo (glamor_priv=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">glamor_priv at entry</a>=0x25d7ec0, w=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">w at entry</a>=16, h=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">h at entry</a>=22, format=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">format at entry</a>=6408, flag=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">flag at entry</a>=0) at ../../src/glamor_fbo.c:392
#9  0x00007f62abc6c7c8 in glamor_create_pixmap (screen=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">screen at entry</a>=0x25d48c0, w=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">w at entry</a>=16, h=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">h at entry</a>=22, depth=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">depth at entry</a>=24, usage=<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">usage at entry</a>=0) at ../../src/glamor.c:175
#10 0x00007f62ac103953 in radeon_glamor_create_pixmap (screen=0x25d48c0, w=16, h=22, depth=24, usage=0) at ../../src/radeon_glamor.c:185
#11 0x0000000000432837 in ProcCreatePixmap (client=0x3228080) at ../../dix/dispatch.c:1393
#12 0x00000000004368fe in Dispatch () at ../../dix/dispatch.c:433
#13 0x000000000043a6ba in dix_main (argc=3, argv=0x7fff2405a088, envp=<optimized out>) at ../../dix/main.c:294
</pre>
    </blockquote>
    When the extension to import dma-bufs is available, glamor creates
    its pixmaps differently to enable dri3 support.<br>
    <br>
    Here the error you have is in the code to create pixmaps:<br>
    glamor creates an argb8888 gbm bo, then import the bo as an
    EGLImage.<br>
    It then get a texture from the image and use the texture for the
    pixmap.<br>
    <br>
    This code is used to force all pixmaps to be argb8888, whereas by
    creating the texture directly you can't assert this.<br>
    <br>
    The bug you hit comes from this code.<br>
    <br>
    I already corrected a bug recently in gallium code when it was
    importing the gbm bo as EGLImage. A field wasn't copied.<br>
    <br>
    I can't say from where the bug you face comes (glamor or Mesa), but
    it shouldn't come from the code to import dma-bufs,<br>
    since it is used only with the dri3 call to convert a fd to a
    pixmap.<br>
    <br>
    Axel Davy<br>
    <br>
    <blockquote cite="mid:5314B681.2000707@ens.fr" type="cite">
      <pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">

-- 
Earthling Michel Dänzer            |                  <a moz-do-not-send="true" href="http://www.amd.com/">http://www.amd.com</a>
Libre software enthusiast          |                Mesa and X developer</pre>
    </blockquote>
    <br>
  </body>
</html>