[Mesa-dev] Mesa (master): st/dri: add support for dma-buf importer (DRIimage v8)

Axel Davy axel.davy at ens.fr
Mon Mar 3 09:15:18 PST 2014


On 03/03/2014, Michel Dänzer wrote :
> On Son, 2014-03-02 at 17:21 -0800, Dave Airlie wrote:
> >/  Module: Mesa
> />/  Branch: master
> />/  Commit: 15b4ff3f4e9460320dd629026743e17fa7109156
> />/  URL:http://cgit.freedesktop.org/mesa/mesa/commit/?id=15b4ff3f4e9460320dd629026743e17fa7109156
> />/  
> />/  Author: Dave Airlie <airlied at redhat.com  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>>
> />/  Date:   Wed Dec 18 10:01:27 2013 +1000
> />/  
> />/  st/dri: add support for dma-buf importer (DRIimage v8)
> />/  
> />/  This is just a simple implementation that stores the extra values into the DRIimage
> />/  struct and just uses the fd importer. I haven't looked into what is required
> />/  to import YUV or deal with the extra parameters.
> />/  
> />/  Signed-off-by: Dave Airlie <airlied at redhat.com  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>>
> /
> 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=image at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=0x3684790, texture=texture at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=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=glamor_priv at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=0x25d7ec0, w=w at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=16, h=h at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=22, format=format at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=6408) at ../../src/glamor_fbo.c:344
> #8  0x00007f62abc9025f in glamor_create_fbo (glamor_priv=glamor_priv at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=0x25d7ec0, w=w at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=16, h=h at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=22, format=format at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=6408, flag=flag at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=0) at ../../src/glamor_fbo.c:392
> #9  0x00007f62abc6c7c8 in glamor_create_pixmap (screen=screen at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=0x25d48c0, w=w at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=16, h=h at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=22, depth=depth at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=24, usage=usage at entry  <http://lists.freedesktop.org/mailman/listinfo/mesa-dev>=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
When the extension to import dma-bufs is available, glamor creates its 
pixmaps differently to enable dri3 support.

Here the error you have is in the code to create pixmaps:
glamor creates an argb8888 gbm bo, then import the bo as an EGLImage.
It then get a texture from the image and use the texture for the pixmap.

This code is used to force all pixmaps to be argb8888, whereas by 
creating the texture directly you can't assert this.

The bug you hit comes from this code.

I already corrected a bug recently in gallium code when it was importing 
the gbm bo as EGLImage. A field wasn't copied.

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,
since it is used only with the dri3 call to convert a fd to a pixmap.

Axel Davy

>
> -- 
> Earthling Michel Dänzer            |http://www.amd.com  <http://www.amd.com/>
> Libre software enthusiast          |                Mesa and X developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140303/84fd27d3/attachment-0001.html>


More information about the mesa-dev mailing list