winft / disman

Qt/C++ display management library
GNU Lesser General Public License v2.1
3 stars 1 forks source link

Wayland backend fails on wlroots #44

Closed romangg closed 8 months ago

romangg commented 3 years ago

In GitLab by @jbeich on Nov 7, 2021, 13:40

Tested under Sway with wlroots 0.14.1 and 0.15.0 snapshot (2021-11-05, fc1ed72b). Unlike #43 manually starting disman_backend_launcher doesn't help. Besides, XRandR backend works fine.

$ WAYLAND_DEBUG=1 QT_LOGGING_RULES="*.debug=true" DISMAN_IN_PROCESS=1 XDG_SESSION_TYPE=wayland dismanctl -o
[4119623.869]  -> wl_display@1.get_registry(new id wl_registry@2)
[4119623.952]  -> wl_display@1.sync(new id wl_callback@3)
[4119624.099] wl_display@1.delete_id(3)
[4119624.113] wl_registry@2.global(1, "wl_shm", 1)
[4119624.130]  -> wl_registry@2.bind(1, "wl_shm", 1, new id [unknown]@4)
[4119624.140] wl_registry@2.global(2, "wl_drm", 2)
[4119624.147] wl_registry@2.global(3, "zwp_linux_dmabuf_v1", 3)
[4119624.153] wl_registry@2.global(4, "wl_compositor", 4)
[4119624.158]  -> wl_registry@2.bind(4, "wl_compositor", 3, new id [unknown]@5)
[4119624.165] wl_registry@2.global(5, "wl_subcompositor", 1)
[4119624.170]  -> wl_registry@2.bind(5, "wl_subcompositor", 1, new id [unknown]@6)
[4119624.176] wl_registry@2.global(6, "wl_data_device_manager", 3)
[4119624.182]  -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@7)
[4119624.188] wl_registry@2.global(7, "zwlr_gamma_control_manager_v1", 1)
[4119624.193] wl_registry@2.global(8, "zxdg_output_manager_v1", 3)
[4119624.198]  -> wl_registry@2.bind(8, "zxdg_output_manager_v1", 3, new id [unknown]@8)
[4119624.224]  -> wl_display@1.sync(new id wl_callback@9)
[4119624.227] wl_registry@2.global(9, "org_kde_kwin_idle", 1)
[4119624.233] wl_registry@2.global(10, "zwp_idle_inhibit_manager_v1", 1)
[4119624.239] wl_registry@2.global(11, "zwlr_layer_shell_v1", 4)
[4119624.243] wl_registry@2.global(12, "xdg_wm_base", 2)
[4119624.248] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
[4119624.254]  -> wl_registry@2.bind(13, "zwp_tablet_manager_v2", 1, new id [unknown]@10)
[4119624.260] wl_registry@2.global(14, "org_kde_kwin_server_decoration_manager", 1)
[4119624.265] wl_registry@2.global(15, "zxdg_decoration_manager_v1", 1)
[4119624.270] wl_registry@2.global(16, "zwp_relative_pointer_manager_v1", 1)
[4119624.275] wl_registry@2.global(17, "zwp_pointer_constraints_v1", 1)
[4119624.280] wl_registry@2.global(18, "wp_presentation", 1)
[4119624.287] wl_registry@2.global(19, "zwlr_output_manager_v1", 2)
[4119624.305] wl_registry@2.global(20, "zwlr_output_power_manager_v1", 1)
[4119624.312] wl_registry@2.global(21, "zwp_input_method_manager_v2", 1)
[4119624.318] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
[4119624.323] wl_registry@2.global(23, "zwlr_foreign_toplevel_manager_v1", 3)
[4119624.328] wl_registry@2.global(24, "wp_drm_lease_device_v1", 1)
[4119624.333] wl_registry@2.global(25, "zwlr_export_dmabuf_manager_v1", 1)
[4119624.337] wl_registry@2.global(26, "zwlr_screencopy_manager_v1", 3)
[4119624.342] wl_registry@2.global(27, "zwlr_data_control_manager_v1", 2)
[4119624.346] wl_registry@2.global(28, "zwp_primary_selection_device_manager_v1", 1)
[4119624.352]  -> wl_registry@2.bind(28, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@11)
[4119624.359] wl_registry@2.global(29, "wp_viewporter", 1)
[4119624.364] wl_registry@2.global(30, "zxdg_exporter_v1", 1)
[4119624.369] wl_registry@2.global(31, "zxdg_importer_v1", 1)
[4119624.375] wl_registry@2.global(32, "zxdg_exporter_v2", 1)
[4119624.394] wl_registry@2.global(33, "zxdg_importer_v2", 1)
[4119624.399] wl_registry@2.global(34, "xdg_activation_v1", 1)
[4119624.404] wl_registry@2.global(35, "zwp_virtual_keyboard_manager_v1", 1)
[4119624.408] wl_registry@2.global(36, "zwlr_virtual_pointer_manager_v1", 2)
[4119624.413] wl_registry@2.global(37, "zwlr_input_inhibit_manager_v1", 1)
[4119624.417] wl_registry@2.global(38, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[4119624.422] wl_registry@2.global(39, "wl_seat", 7)
[4119624.430]  -> wl_registry@2.bind(39, "wl_seat", 5, new id [unknown]@12)
[4119624.436]  -> wl_data_device_manager@7.get_data_device(new id wl_data_device@13, wl_seat@12)
[4119624.446]  -> zwp_primary_selection_device_manager_v1@11.get_device(new id zwp_primary_selection_device_v1@14, wl_seat@12)
[4119624.451]  -> zwp_tablet_manager_v2@10.get_tablet_seat(new id zwp_tablet_seat_v2@15, wl_seat@12)
[4119624.455] wl_registry@2.global(40, "zwp_pointer_gestures_v1", 3)
[4119624.461] wl_registry@2.global(54, "wl_output", 3)
[4119624.470]  -> wl_registry@2.bind(54, "wl_output", 2, new id [unknown]@16)
[4119624.486]  -> zxdg_output_manager_v1@8.get_xdg_output(new id zxdg_output_v1@17, wl_output@16)
[4119624.491] wl_callback@3.done(54658)
[4119624.562] wl_display@1.delete_id(9)
[4119624.571] wl_shm@4.format(0)
[4119624.578] wl_shm@4.format(1)
[4119624.581] wl_shm@4.format(875709016)
[4119624.585] wl_shm@4.format(875708993)
[4119624.587] wl_shm@4.format(875710274)
[4119624.589] wl_shm@4.format(842094674)
[4119624.591] wl_shm@4.format(842088786)
[4119624.593] wl_shm@4.format(892426322)
[4119624.595] wl_shm@4.format(892420434)
[4119624.597] wl_shm@4.format(909199186)
[4119624.607] wl_shm@4.format(808665688)
[4119624.610] wl_shm@4.format(808665665)
[4119624.612] wl_shm@4.format(1211384408)
[4119624.615] wl_shm@4.format(1211384385)
[4119624.617] wl_callback@9.done(54658)
[4119624.620] wl_seat@12.name("seat0")
[4119624.623] wl_seat@12.capabilities(3)
[4119624.638]  -> wl_seat@12.get_keyboard(new id wl_keyboard@9)
[4119624.647]  -> wl_seat@12.get_pointer(new id wl_pointer@3)
[4119624.650] wl_output@16.geometry(0, 0, 600, 340, 2, "Goldstar Company Ltd", "LG Ultra HD", 0)
[4119624.664] wl_output@16.mode(1, 3840, 2160, 60000)
[4119624.669] wl_output@16.scale(1)
[4119624.672] wl_output@16.done()
[4119624.706] zxdg_output_v1@17.name("DP-1")
[4119624.711] zxdg_output_v1@17.description("Goldstar Company Ltd LG Ultra HD 0x0000C784 (DP-1)")
[4119624.714] zxdg_output_v1@17.logical_position(0, 0)
[4119624.717] zxdg_output_v1@17.logical_size(3840, 2160)
[4119624.720] wl_output@16.done()
qt.xkb.compose: using xkb compose input context
qt.qpa.wayland: using input method: QComposeInputContext
qt.qpa.fonts: default fonts: system QFont(Sans Serif,9,-1,5,50,0,0,0,0,0) fixed QFont(monospace,9,-1,2,50,0,0,0,0,0)
disman: Selection for preferred backend: wayland
disman: Loading backend plugin: "/usr/local/lib/qt5/plugins/disman/wayland.so"
disman.backend: UPower not available, no lid detection. "Not connected to D-Bus server"
disman.backend.wayland: Loading Wayland backend.
kf.coreaddons: Checking for plugins in ("/usr/local/lib/qt5/plugins/disman/wayland", "/usr/local/bin/disman/wayland")
[4119635.781] wl_keyboard@9.keymap(1, fd 7, 53414)
[4119637.408] wl_keyboard@9.repeat_info(50, 200)
disman.backend.wayland: Connection to Wayland server timed out. Does the compositor support output management?
disman: Skipping "wayland" backend
disman: "Plugin does not provide valid Disman backend"
disman.ctl: Received initial config has error.
disman.ctl: Invalid config.
[4122606.708]  -> wl_pointer@3.release()
[4122606.719]  -> wl_keyboard@9.release()
[4122606.763]  -> zwp_tablet_seat_v2@15.destroy()
[4122606.767]  -> zwp_primary_selection_device_v1@14.destroy()
[4122606.776]  -> zxdg_output_v1@17.destroy()

$ DISMAN_IN_PROCESS=1 XDG_SESSION_TYPE=x11 dismanctl -o
disman.backend: Output config does not contain resolution key.
disman.backend: Mode entry does not contain refresh key.
disman.backend: Mode entry broken for: Output 33, XWAYLAND0 (XWAYLAND0)
  mode: 3840x2160@59980 (id 35)
  x,y: 0,0 w/h:3840x2160 (scale: 1)
  auto: rotate (only in tablet mode)
  physical size[mm]: 600x340
  enabled: yes, retention: undefined
  hash: f5f9ed482c6d23354110d74253efae63
}
Output: 33 XWAYLAND0 enabled Unknown Modes: 35:3840x2160@59980*! 36:2048x1536@59953 37:1920x1440@59967 38:1600x1200@59869 39:1440x1080@59988 40:1400x1050@59978 41:1280x1024@59894 42:1280x960@59939 43:1152x864@59958 44:1024x768@59920 45:800x600@59861 46:640x480@59375 47:320x240@59523 48:2560x1600@59986 49:1920x1200@59884 50:1680x1050@59954 51:1440x900@59887 52:1280x800@59810 53:720x480@59709 54:640x400@59952 55:320x200@58962 56:3200x1800@59956 57:2880x1620@59960 58:2560x1440@59960 59:2048x1152@59903 60:1920x1080@59962 61:1600x900@59946 62:1368x768@59882 63:1280x720@59855 64:1024x576@59899 65:864x486@59915 66:720x400@59550 67:640x350@59767 Geometry: 0,0 3840x2160 Scale: 1 Rotation: 1
Primary:XWAYLAND0

$ wlr-randr
DP-1 "Goldstar Company Ltd LG Ultra HD 0x0000C784 (DP-1)"
  Physical size: 600x340 mm
  Enabled: yes
  Modes:
    640x480 px, 59.939999 Hz
    640x480 px, 59.939999 Hz
    640x480 px, 60.000000 Hz
    720x480 px, 59.939999 Hz
    720x480 px, 60.000000 Hz
    800x600 px, 60.317001 Hz
    1024x768 px, 60.004002 Hz
    1280x720 px, 59.939999 Hz
    1280x720 px, 60.000000 Hz
    1280x720 px, 60.000000 Hz
    1152x864 px, 59.972000 Hz
    1280x800 px, 59.810001 Hz
    1280x1024 px, 60.020000 Hz
    1600x900 px, 60.000000 Hz
    1920x1080 px, 59.939999 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 60.000000 Hz
    3840x2160 px, 30.000000 Hz
    3840x2160 px, 60.000000 Hz (preferred, current)
  Position: 0,0
  Transform: normal
  Scale: 1.000000
romangg commented 3 years ago

In the dismanctl -o output after the lines

disman.backend.wayland: Loading Wayland backend.
kf.coreaddons: Checking for plugins in ("/usr/local/lib/qt5/plugins/disman/wayland", "/usr/local/bin/disman/wayland")

it should print something about the plugins that were rejected. For example here in a sway session issuing DISMAN_IN_PROCESS=1 kdisplay it prints for me:

disman.backend.wayland: Backend "kwayland" rejected.
disman.backend.wayland: Backend "kwinft" rejected.
disman.backend.wayland: Backend "wlroots-wrapland" initialized.

Are the Wayland backend plugins installed at one of the paths mentioned in the log?

romangg commented 3 years ago

In GitLab by @jbeich on Nov 7, 2021, 14:16

Are the Wayland backend plugins installed at one of the paths mentioned in the log?

Yes, via system package.

$ pkg info -l disman | fgrep plugins
        /usr/local/lib/qt5/plugins/disman/fake.so
        /usr/local/lib/qt5/plugins/disman/qscreen.so
        /usr/local/lib/qt5/plugins/disman/randr.so
        /usr/local/lib/qt5/plugins/disman/wayland.so
        /usr/local/lib/qt5/plugins/disman/wayland/kwayland.so
        /usr/local/lib/qt5/plugins/disman/wayland/kwinft.so
        /usr/local/lib/qt5/plugins/disman/wayland/wlroots-wrapland.so
romangg commented 3 years ago

That looks right. So the Wayland connection times out according to the log. But we also find

[4119624.287] wl_registry@2.global(19, "zwlr_output_manager_v1", 2)

so it should actually choose the wlroots-wrapland library. I can't reproduce the issue in a sway session on my Linux box. You're on FreeBSD, could there be an issue with the plugin creation due to that? I'm asking because while Disman logs the Wayland connection timing out here it does not for any plugin print this line before.

romangg commented 3 years ago

In GitLab by @jbeich on Nov 7, 2021, 15:12

could there be an issue with the plugin creation due to that?

Yes, according to printf debugging that line fails for every plugin under disman/wayland/ directory. This is on kf5-kcoreaddons-5.87.0 where instantiate() is @deprecated Since 5.86, use @ref KPluginFactory::loadFactory or @ref KPluginFactory::instantiatePlugin when using KPluginFactory. Otherwise use QPluginLoader::instance() instead..

romangg commented 1 year ago

That's likely fixed due to the refactorings of backends and now only having a single one anymore on Wayland. Please reopen if this is not the case.