Igalia / cog

WPE launcher and webapp container
MIT License
236 stars 61 forks source link

Segmentation fault for drm platform with gles renderer #722

Open sdubrava opened 2 months ago

sdubrava commented 2 months ago

Hi,

I'm trying to run cog on DRM/KMS platform without GPU:

cog --version
0.17.1 (WPE WebKit 2.40.5)

cog --platform=drm --platform-params='renderer=gles' http://example.com
Segmentation fault

The issue seems to come from https://github.com/Igalia/WPEBackend-fdo/blob/master/src/view-backend-exportable-fdo-egl.cpp#L229 when a null function pointer is called:

client->export_shm_buffer(data, buffer);

This is the backtrace resulting in the segmentation fault:

(gdb) bt
#0  (anonymous namespace)::ClientBundleEGL::exportBuffer
    (this=0xa1a2a140, bufferResource=0xa19ae4a0, shmBuffer=0xa1a2d410)
    at ../src/view-backend-exportable-fdo-egl.cpp:231
#1  0xb1a4068d in ViewBackend::exportShmBuffer
    (this=0xa1a291c0, bufferResource=0xa19ae4a0, shmBuffer=0xa1a2d410)
    at ../src/view-backend-private.cpp:87
#2  0xb1a49f39 in WS::ImplEGL::surfaceCommit (this=0xa1a29070, surface=...)
    at ../src/ws-egl.cpp:91
#3  0xb1a42e71 in operator() (__closure=0x0, surfaceResource=0xa19ae590)
    at ../src/ws.cpp:131
#4  0xb1a42e9a in _FUN () at ../src/ws.cpp:132
#5  0xb16b08d8 in ??? () at /usr/lib/libffi.so.8
#6  0xb16b0128 in ??? () at /usr/lib/libffi.so.8
#7  0xb1009e4d in ??? () at /usr/lib/libwayland-server.so.0
#8  0xb10058a2 in ??? () at /usr/lib/libwayland-server.so.0
#9  0xb10093c3 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
#10 0xb1a42a7d in operator() (__closure=0x0, base=0xa19aa810)
    at ../src/ws.cpp:77
#11 0xb1a42add in _FUN () at ../src/ws.cpp:86
#12 0xb2e8456b in g_main_dispatch (context=0xb7f40f30) at ../glib/gmain.c:3476
#13 0xb2ee5ffd in g_main_context_dispatch_unlocked (context=0xa1a2d180)
    at ../glib/gmain.c:4284
#14 g_main_context_iterate_unlocked.isra.0
--Type <RET> for more, q to quit, c to continue without paging--c
    (context=context@entry=0xb7f40f30, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4349
#15 0xb2e82624 in g_main_context_iteration (context=0xb7f40f30, may_block=1)
    at ../glib/gmain.c:4414
#16 0xb7d7d2fb in g_application_run
    (application=0xb2b1db00, argc=4, argv=0xbffffca4)
    at ../gio/gapplication.c:2577
#17 0x00403ef6 in main (argc=4, argv=0xbffffca4) at ../launcher/cog.c:41

Is handling SHM buffers supposed to be implemented for DRM/KMS platform with GLES renderer? I see that according to https://github.com/Igalia/cog/blob/master/platform/drm/cog-drm-gles-renderer.c#L389 the client is not initialized with export_shm_buffer callback.

Thank you, Slava