Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Crash when fullscreening #3154

Closed
J0nnyMak0 opened this issue Aug 5, 2021 · 15 comments · Fixed by #3155
Closed

Crash when fullscreening #3154

J0nnyMak0 opened this issue Aug 5, 2021 · 15 comments · Fixed by #3155

Comments

@J0nnyMak0
Copy link
Contributor

I'm seeing a crash occasionally when fullscreening a window. Log attached.

sway version 1.6-f4cda515 (Aug  4 2021, branch 'master')

sway.log

@kennylevinsen
Copy link
Member

Moved to sway. Please attach full backtrace of a crash with debug symbols.

@emersion
Copy link
Member

emersion commented Aug 7, 2021

Please provide a stack trace. You can do so by compiling from source, reproducing the crash and then running coredumpctl gdb and then bt full.

Here are some instructions to compile from source: https://github.com/swaywm/sway/wiki/Development-Setup#compiling-as-a-subproject

@J0nnyMak0
Copy link
Contributor Author

Sorry, I was off-grid for a couple of weeks. Here are the stack and a new log.
gdb.txt
sway.log

@emersion
Copy link
Member

emersion commented Aug 24, 2021

drm_fb_import is called with a NULL buffer.

#0  0x00007f6bf4c27dab in wlr_addon_find (set=0x48, owner=0x555b7f62f810, impl=0x7f6bf4c73e40 <fb_addon_impl>) at ../subprojects/wlroots/util/addon.c:41
        addon = 0x555b7f700080
swaywm/sway#1  0x00007f6bf4bd375b in drm_fb_import (fb_ptr=0x555b7f631cd0, drm=0x555b7f62f810, buf=0x0, formats=0x555b7f631ce8) at ../subprojects/wlroots/backend/drm/renderer.c:324
        fb = 0xa00000005a0
        addon = 0x555b7f62f968
swaywm/sway#2  0x00007f6bf4bcdebf in drm_connector_set_pending_fb (conn=0x555b80344560, state=0x7ffcfd9c7d80) at ../subprojects/wlroots/backend/drm/drm.c:422
        drm = 0x555b7f62f810
        crtc = 0x555b7f62fa80
        plane = 0x555b7f631cb0
        __PRETTY_FUNCTION__ = "drm_connector_set_pending_fb"
        local_buf = 0x0
        ok = false
swaywm/sway#3  0x00007f6bf4bce421 in drm_connector_commit_state (conn=0x555b80344560, pending=0x555b80344670) at ../subprojects/wlroots/backend/drm/drm.c:544
        drm = 0x555b7f62f810
        state = 
          {committed = 1, damage = {extents = {x1 = 0, y1 = 0, x2 = 0, y2 = 0}, data = 0x7f6bf45db4f0}, enabled = false, scale = 0, transform = WL_OUTPUT_TRANSFORM_NORMAL, adaptive_sync_enabled = false, buffer = 0x555b804a5c50, mode_type = WLR_OUTPUT_STATE_MODE_FIXED, mode = 0x555b801ca990, custom_mode = {width = 0, height = 0, refresh = 0}, gamma_lut = 0x0, gamma_lut_size = 0}
        __PRETTY_FUNCTION__ = "drm_connector_commit_state"
swaywm/sway#4  0x00007f6bf4bce644 in drm_connector_commit (output=0x555b80344560) at ../subprojects/wlroots/backend/drm/drm.c:588
        conn = 0x555b80344560
swaywm/sway#5  0x00007f6bf4c1347f in wlr_output_commit (output=0x555b80344560) at ../subprojects/wlroots/types/wlr_output.c:837
        now = {tv_sec = 48482, tv_nsec = 833833487}
        pre_event = {output = 0x555b80344560, when = 0x7ffcfd9c7ec0}
        back_buffer = 0x0
        scale_updated = 76
        geometry_updated = 128
        committed = 21851
        event = {output = 0x555b804c59a0, committed = 2143805072, when = 0x555b804a5c50}

@emersion
Copy link
Member

Seems to be caused by a bad DMA-BUF:

00:00:58.509 [DEBUG] [wlr] [types/wlr_output.c:757] Direct scan-out buffer size mismatch
00:00:58.543 [ERROR] [wlr] [EGL] command: eglCreateImageKHR, error: EGL_BAD_MATCH (0x3009), message: "dri2_create_image_khr_texture"
00:00:58.543 [ERROR] [wlr] [render/egl.c:646] eglCreateImageKHR failed
00:00:58.543 [ERROR] [wlr] [render/gles2/texture.c:273] Failed to create EGL image from DMA-BUF

@J0nnyMak0
Copy link
Contributor Author

Do you still need something from me? How do I remove the waiting-on-reporter label?

@emersion
Copy link
Member

Do you know by any chance whether the client allocates buffer on a secondary GPU?

@J0nnyMak0
Copy link
Contributor Author

Do you know by any chance whether the client allocates buffer on a secondary GPU?

I'm guessing this is the case. The crash doesn't happen when external monitor (wired to secondary GPU) is disconnected.

@J0nnyMak0
Copy link
Contributor Author

This issue started happening with ebb6615

Funnily enough, that is also the commit that fixed the longstanding low refresh rate on secondary gpu issue (#2636), so it is worth keeping an eye out for any regressions on that front once this issue is fixed.

@J0nnyMak0
Copy link
Contributor Author

Maybe this can be moved back into wlroots?

@emersion
Copy link
Member

Hmm. I think we need to re-open the DRM FD in allocator_autocreate_with_drm_fd, just like we do in wlr_egl_create_with_drm_fd with the open_render_node call.

@emersion
Copy link
Member

emersion commented Sep 1, 2021

Can you try this? #3153

@emersion emersion transferred this issue from swaywm/sway Sep 1, 2021
@J0nnyMak0
Copy link
Contributor Author

Unfortunately that didn't help. New log and trace attached.
sway.log
gdb.txt

emersion added a commit to emersion/wlroots that referenced this issue Sep 1, 2021
drm_surface_blit returns NULL on error. This can happen e.g. when
the source buffer cannot be imported into EGL.

Closes: swaywm#3154
@emersion
Copy link
Member

emersion commented Sep 1, 2021

OK, I don't know why it took me so long to realize it, but the fix is pretty trivial: #3155

Can you give it a go?

@J0nnyMak0
Copy link
Contributor Author

That fixes it! Thanks!

emersion added a commit that referenced this issue Sep 3, 2021
drm_surface_blit returns NULL on error. This can happen e.g. when
the source buffer cannot be imported into EGL.

Closes: #3154
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants