Igalia / cog

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

cog Segmentation fault on STM32MP1 with modeset Renderer #508

Open DerArtem opened 2 years ago

DerArtem commented 2 years ago

Hello,

on my STM32MP1 i am getting a Segmentation fault when running cog. This seems to occour when something on the display changes. Eg, when I open a simple html website it is displayed on the screen. As soon as I click on something it crashes. Using gles renderer the issue does not occur, but I have graphic glitches.

On cog 0.12.4 this problem does not exist.

Here is a log of the segfault:

G_MESSAGES_DEBUG=all cog -P drm http://neverssl.com
(process:1232): Cog-Core-DEBUG: 19:40:06.410: ensure_extension_points: Extension points registered.
(process:1232): Cog-Core-DEBUG: 19:40:06.411: cog_modules_add_directory: Scanning '/usr/lib/cog/modules'
Cog-INFO: 19:40:06.438: com.igalia.Cog.Platform:
Cog-INFO: 19:40:06.439:   wl - 500/CogWlPlatform
Cog-INFO: 19:40:06.439:   drm - 200/CogDrmPlatform
Cog-INFO: 19:40:06.440:   headless - 100/CogHeadlessPlatform
(cog:1232): Cog-DEBUG: 19:40:06.489: platform_setup: Platform name: drm
(cog:1232): Cog-DRM-DEBUG: 19:40:06.508: init_config: overriding device_scale value, using 1.00 from shell
(cog:1232): Cog-DRM-DEBUG: 19:40:06.512: init_drm: enumerated device 0x587b0, available_nodes 1
(cog:1232): Cog-DRM-DEBUG: 19:40:06.512: init_drm:   DRM_NODE_PRIMARY: /dev/dri/card0
(cog:1232): Cog-DRM-DEBUG: 19:40:06.515: init_drm: using device 0x587b0, DRM_NODE_PRIMARY /dev/dri/card0
(cog:1232): Cog-DRM-DEBUG: 19:40:06.515: init_drm: 1 connectors available
(cog:1232): Cog-DRM-DEBUG: 19:40:06.515: init_drm:  connector id 33, type 16, connected, 1 usable modes
(cog:1232): Cog-DRM-DEBUG: 19:40:06.516: init_drm:    [0]: '1024x600', 1024x600@62, flags 0, type 72 (preferred)
(cog:1232): Cog-DRM-DEBUG: 19:40:06.518: init_drm: using connector id 33, type 16
(cog:1232): Cog-DRM-DEBUG: 19:40:06.519: init_drm: using mode [0] '1024x600' @ 62Hz
(cog:1232): Cog-DRM-DEBUG: 19:40:06.583: cog_drm_modeset_renderer_new: Using plane #34, crtc #38, connector #33 (atomic).

(cog:1232): Cog-DRM-WARNING **: 19:40:06.585: Renderer 'modeset' does not support rotation 0 (0 degrees).
(cog:1232): Cog-DRM-DEBUG: 19:40:06.616: cog_drm_platform_setup: Renderer 'modeset' initialized.
(cog:1232): Cog-Core-DEBUG: 19:40:06.621: gamepad setup: none
(cog:1232): Cog-DEBUG: 19:40:06.622: platform_setup: Selected CogDrmPlatform @ 0x38a60

(cog:1232): GLib-GIO-WARNING **: 19:40:06.670: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal.  It should do one of these.
(process:1240): GLib-GIO-DEBUG: 19:40:06.834: Failed to initialize portal (GNetworkMonitorPortal) for gio-network-monitor: Not using portals
(process:1240): GLib-GIO-DEBUG: 19:40:06.862: _g_io_module_get_default: Found default implementation networkmanager (GNetworkMonitorNM) for ?gio-network-monitor?
(process:1240): GLib-GIO-DEBUG: 19:40:06.870: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ?gio-vfs?
(process:1240): GLib-GIO-DEBUG: 19:40:06.892: _g_io_module_get_default: Found default implementation dummy (GDummyProxyResolver) for ?gio-proxy-resolver?
(process:1240): GLib-GIO-DEBUG: 19:40:06.894: GSocketClient: Starting new address enumeration
(process:1240): GLib-GIO-DEBUG: 19:40:06.933: GSocketClient: Address enumeration succeeded
(process:1240): GLib-GIO-DEBUG: 19:40:06.933: GSocketClient: Starting TCP connection attempt
(WPEWebProcess:1241): GLib-GIO-DEBUG: 19:40:06.999: Failed to initialize portal (GPowerProfileMonitorPortal) for gio-power-profile-monitor: Not using portals
(WPEWebProcess:1241): GLib-GIO-DEBUG: 19:40:07.004: _g_io_module_get_default: Found default implementation dbus (GPowerProfileMonitorDBus) for ?gio-power-profile-monitor?
(process:1240): GLib-GIO-DEBUG: 19:40:07.110: GSocketClient: TCP connection successful
(process:1240): GLib-GIO-DEBUG: 19:40:07.110: GSocketClient: Starting application layer connection
(process:1240): GLib-GIO-DEBUG: 19:40:07.110: GSocketClient: Connection successful!
Cog-Core-Message: 19:40:07.569: <http://neverssl.com/> Load started.
Cog-Core-Message: 19:40:07.773: <http://neverssl.com/> Loading...
Cog-Core-Message: 19:40:07.827: <http://neverssl.com/> Loaded successfully.
Cog-Core-Message: 19:40:07.878: <http://neverssl.com/> Load started.
(process:1240): GLib-GIO-DEBUG: 19:40:07.883: GSocketClient: Starting new address enumeration
(process:1240): GLib-GIO-DEBUG: 19:40:07.904: GSocketClient: Address enumeration succeeded
(process:1240): GLib-GIO-DEBUG: 19:40:07.905: GSocketClient: Starting TCP connection attempt
(process:1240): GLib-GIO-DEBUG: 19:40:07.906: GSocketClient: Connection attempt failed: Network is unreachable
(process:1240): GLib-GIO-DEBUG: 19:40:07.906: GSocketClient: Starting new address enumeration
(process:1240): GLib-GIO-DEBUG: 19:40:07.915: GSocketClient: Address enumeration succeeded
(process:1240): GLib-GIO-DEBUG: 19:40:07.916: GSocketClient: Starting TCP connection attempt
(process:1240): GLib-GIO-DEBUG: 19:40:08.096: GSocketClient: TCP connection successful
(process:1240): GLib-GIO-DEBUG: 19:40:08.096: GSocketClient: Starting application layer connection
(process:1240): GLib-GIO-DEBUG: 19:40:08.097: GSocketClient: Connection successful!
Cog-Core-Message: 19:40:08.291: <http://majesticsublimefunmorning.neverssl.com/online/> Redirected.
Cog-Core-Message: 19:40:08.508: <http://majesticsublimefunmorning.neverssl.com/online/> Loading...
Cog-Core-Message: 19:40:09.113: <http://majesticsublimefunmorning.neverssl.com/online/> Loaded successfully.
Segmentation fault
DerArtem commented 2 years ago

From gdb I am only getting this backtrace:

Thread 1 "cog" received signal SIGSEGV, Segmentation fault.
0xb251f5e8 in enable_tile_status () from target:/usr/lib/libEGL.so.1
(gdb) bt
#0  0xb251f5e8 in enable_tile_status () from target:/usr/lib/libEGL.so.1
#1  0xb263cebc in ffi_call_SYSV () from target:/usr/lib/libffi.so.8
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
aperezdc commented 1 year ago

@DerArtem I suppose this is the board, which according to this PDF comes with a Vivante GPU, and I assume the screen output is configured to use the built-in MIPI DSI interface, in which case would use imx-drm. Can you confirm this is indeed your setup?

I suspect this configuration has stopped working after https://github.com/Igalia/cog/pull/371 or (less likely) https://github.com/Igalia/cog/pull/392&mdash;these have been the biggest changes in the DRM plug-in in the last year.

OTOH, the GLES renderer should work without glitching in this configuration, so I think that grants a separate issue report.

aperezdc commented 1 year ago

@DerArtem Can you try disabling atomic mode setting? Something like this should do:

cat > cog.conf <<EOF
[drm]
disable-atomic-modesetting=false
EOF
cog -C cog.conf -P drm $URL

If the above causes glitches, then we know that the GLES renderer is glitching because currently it does not currently use atomic modesetting. If that works and doesn't glitch, then we know we have some issue in the atomic modesetting handling in the modeset renderer.

@DerArtem One more question: are you using Etnaviv or the Vivante proprietary GPU driver?