When running piglit/egl-copy-buffers, we get a segfault:
#0 0x00007ffff720a7b7 in dri3_fence_reset (c=0x422ad0, buffer=0x0) at ../../src/loader/loader_dri3_helper.c:245 #1 0x00007ffff720ba38 in loader_dri3_copy_drawable (draw=0x587010, dest=96468995, src=96468994) at ../../src/loader/loader_dri3_helper.c:822 #2 0x00007ffff71fc75c in dri3_copy_buffers (drv=0x422370, disp=0x421ab0, surf=0x586d00, native_pixmap_target=0x5c00003) at ../../src/egl/drivers/dri2/platform_x11_dri3.c:441 #3 0x00007ffff71f515d in dri2_copy_buffers (drv=0x422370, disp=0x421ab0, surf=0x586d00, native_pixmap_target=0x5c00003) at ../../src/egl/drivers/dri2/egl_dri2.c:1682 #4 0x00007ffff71e647c in eglCopyBuffers (dpy=0x421ab0, surface=0x586d00, target=96468995) at ../../src/egl/main/eglapi.c:1429 #5 0x0000000000402f2d in draw (state=0x7fffffffceb0) at /home/user/git/piglit/tests/egl/egl-copy-buffers.c:78 #6 0x00000000004028c3 in event_loop (state=0x7fffffffceb0, test=0x7fffffffcf30) at /home/user/git/piglit/tests/egl/egl-util.c:164 #7 0x0000000000402df3 in egl_util_run (test=0x7fffffffcf30, argc=1, argv=0x7fffffffd048) at /home/user/git/piglit/tests/egl/egl-util.c:304 #8 0x0000000000402ff7 in main (argc=1, argv=0x7fffffffd048) at /home/user/git/piglit/tests/egl/egl-copy-buffers.c:1
The drawable in question is associated with a X11 pixmap and doesn't have a fake front buffer. The call to dri3_fake_frontbuffer() returns NULL, so loader_dri3_copy_drawable() passes it to dri3_fence_reset(), which tries to access buffer->shm_fence, resulting in a segfault.
Further testing (not on the current piglit test) shows we can't just return early from loader_dri3_copy_drawable(): we need to run dri3_copy_area(). So this patch does that by avoiding the dri3_fence_* calls.
Now I'm still learning this area so I'm not really sure on what are the consequences of avoiding the synchronization primitives here in this situation where egl is copying contents to an X11 pixmap, so the real fix may be different, but at least here we can avoid the segfault and brief testing shows things work as expected.
Signed-off-by: Paulo Zanoni firstname.lastname@example.org