hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.1k stars 665 forks source link

Crash on linux with wayland and external monitor #3094

Open gucio321 opened 2 months ago

gucio321 commented 2 months ago

Ebitengine Version

6eb0271f83cb94340d5789344a1bfa22b06e8c54

Operating System

Go Version (go version)

go version go1.23.1 linux/amd64

What steps will reproduce the problem?

What is the expected result?

everything should be as it was before turning monitor off

What happens instead?

X Error of failed request:  BadRRCrtc (invalid Crtc parameter)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  20 (RRGetCrtcInfo)
  Crtc id in failed request: 0x56e
  Serial number of failed request:  1855
  Current serial number in output stream:  1855
exit status 1

Anything else you feel useful to add?

I use gnome-shell on Wayland, this is why I suppose that ebiten uses xwaylandbridge. Why does it need xorg?

gucio321 commented 2 months ago
gucio321 commented 2 months ago

I think ebiten uses glfw on linux. I have glfw v3.3 header in /usr/include/GLFW (idk what header ebiten uses)

gucio321 commented 2 months ago

first v3.3 was released in 2019 and the above issue was fixed in 2017, so I think this is a iplementation bug somewhere here (?)

hajimehoshi commented 2 months ago

Ebitengine dropped Wayland support from GLFW.

gucio321 commented 2 months ago

Ebitengine dropped Wayland support from GLFW.

So what deos it use for linux-wayland now? maybe I can share some more info?

hajimehoshi commented 2 months ago

IIUC an X emulation layer works.

gucio321 commented 2 months ago

interessting, on examples/fullscreen it panics with

[fullscreen (0) ]$ go run .
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x6d0c86]

goroutine 1 [running, locked to thread]:
github.com/hajimehoshi/ebiten/v2/internal/ui.(*Monitor).DeviceScaleFactor(...)
    /home/me/git/ebiten/internal/ui/monitor_glfw.go:45
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).registerWindowFramebufferSizeCallback.func1(0xc00017a608?, 0x280, 0x205)
    /home/me/git/ebiten/internal/ui/ui_glfw.go:968 +0x86
github.com/hajimehoshi/ebiten/v2/internal/glfw.goFramebufferSizeCB(0xc0000061c0?, 0x280, 0x205)
    /home/me/git/ebiten/internal/glfw/window_unix.go:147 +0x45
github.com/hajimehoshi/ebiten/v2/internal/glfw._Cfunc_glfwPollEvents()
    _cgo_gotypes.go:1004 +0x3f
github.com/hajimehoshi/ebiten/v2/internal/glfw.PollEvents()
    /home/me/git/ebiten/internal/glfw/window_unix.go:952 +0xf
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).update(0xc00017a608)
    /home/me/git/ebiten/internal/ui/ui_glfw.go:1377 +0x127
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).updateGame.func1()
    /home/me/git/ebiten/internal/ui/ui_glfw.go:1471 +0x45
github.com/hajimehoshi/ebiten/v2/internal/thread.(*OSThread).Loop.func1({0xc0001cc300?, 0x80?}, 0x20?)
    /home/me/git/ebiten/internal/thread/thread.go:67 +0x4f
github.com/hajimehoshi/ebiten/v2/internal/thread.(*OSThread).Loop(0xc00021ab00, {0x9632f8, 0xc0009cac30})
    /home/me/git/ebiten/internal/thread/thread.go:68 +0x79
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).runMultiThread(0xc00017a608, {0x9654e0, 0xc0000d2380}, 0xc000384dc0)
    /home/me/git/ebiten/internal/ui/run.go:75 +0x322
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).Run(0x961518?, {0x9654e0?, 0xc0000d2380?}, 0x3?)
    /home/me/git/ebiten/internal/ui/run.go:33 +0x30
github.com/hajimehoshi/ebiten/v2.RunGameWithOptions({0x961518, 0xc0009b71f8}, 0x0)
    /home/me/git/ebiten/run.go:345 +0x208
github.com/hajimehoshi/ebiten/v2.RunGame(...)
    /home/me/git/ebiten/run.go:236
main.main()
    /home/me/git/ebiten/examples/fullscreen/main.go:117 +0x56
exit status 2

so it uses glfw on wayland.