swaywm / wlroots

A modular Wayland compositor library
https://gitlab.freedesktop.org/wlroots/wlroots/
MIT License
2.15k stars 340 forks source link

Support devices without hardware cursors #1584

Open ascent12 opened 5 years ago

ascent12 commented 5 years ago

The DRM backend currently makes some assumptions that a hardware cursor will always be present. I've been made aware of a device which this is not the case, and we should handle this properly.

It was some displaylink attached device. drm_info output:

Device: /dev/dri/card1
├───Driver: evdi 1.6.0 20180913
│   ├───DRM_CLIENT_CAP_STEREO_3D supported
│   ├───DRM_CLIENT_CAP_UNIVERSAL_PLANES supported
│   ├───DRM_CLIENT_CAP_ATOMIC supported
│   ├───DRM_CLIENT_CAP_ASPECT_RATIO supported
│   ├───DRM_CLIENT_CAP_WRITEBACK_CONNECTORS supported
│   ├───DRM_CAP_DUMB_BUFFER = true
│   ├───DRM_CAP_VBLANK_HIGH_CRTC = true
│   ├───DRM_CAP_DUMB_PREFERRED_DEPTH = 24
│   ├───DRM_CAP_DUMB_PREFER_SHADOW = false
│   ├───DRM_CAP_PRIME supported
│   │   ├───DRM_PRIME_CAP_IMPORT = true
│   │   └───DRM_PRIME_CAP_EXPORT = true
│   ├───DRM_CAP_TIMESTAMP_MONOTONIC = true
│   ├───DRM_CAP_ASYNC_PAGE_FLIP = false
│   ├───DRM_CAP_CURSOR_WIDTH = 64
│   ├───DRM_CAP_CURSOR_HEIGHT = 64
│   ├───DRM_CAP_ADDFB2_MODIFIERS = false
│   ├───DRM_CAP_PAGE_FLIP_TARGET = false
│   ├───DRM_CAP_CRTC_IN_VBLANK_EVENT = true
│   └───DRM_CAP_SYNCOBJ = false
├───Connectors
│   └───Connector 0
│       ├───Object ID: 31
│       ├───Type: DVI-I
│       ├───Status: Connected
│       ├───Physical size: 340x190 mm
│       ├───Subpixel: Unknown
│       ├───Encoders: {0}
│       ├───Modes
│       │   ├───1920x1080@60.00 preferred driver phsync pvsync 
│       │   ├───1920x1080@59.94 driver phsync pvsync 16:9 
│       │   ├───1680x1050@59.88 driver phsync nvsync 
│       │   ├───1280x1024@60.02 driver phsync pvsync 
│       │   ├───1440x900@59.90 driver phsync nvsync 
│       │   ├───1280x960@60.00 driver phsync pvsync 
│       │   ├───1280x720@60.00 driver phsync pvsync 
│       │   ├───1280x720@59.94 driver phsync pvsync 16:9 
│       │   ├───1024x768@60.00 driver nhsync nvsync 
│       │   ├───800x600@60.32 driver phsync pvsync 
│       │   ├───800x600@56.25 driver phsync pvsync 
│       │   ├───848x480@60.00 driver phsync pvsync 
│       │   ├───640x480@60.00 driver nhsync nvsync 4:3 
│       │   ├───640x480@59.94 driver nhsync nvsync 
│       │   └───720x400@70.08 driver nhsync pvsync 
│       └───Properties
│           ├───"EDID" (Immutable): Blob - 46
│           ├───"DPMS": Enum {On, Standby, Suspend, Off} - On
│           ├───"link-status": Enum {Good, Bad} - Good
│           ├───"non-desktop" (Immutable): Range [0, 1] - 0
│           └───"CRTC_ID" (Atomic): Object CRTC - 0
├───Encoders
│   └───Encoder 0
│       ├───Object ID: 30
│       ├───Type: TMDS
│       ├───CRTCS: {0}
│       └───Clones: {}
├───CRTCs
│   └───CRTC 0
│       ├───Object ID: 29
│       └───Properties
│           ├───"ACTIVE" (Atomic): Range [0, 1] - 0
│           ├───"MODE_ID" (Atomic): Blob - 0
│           └───"OUT_FENCE_PTR" (Atomic): Range [0, UINT64_MAX] - 0
└───Planes
    └───Plane 0
        ├───Object ID: 28
        ├───CRTCS: {0}
        ├───Formats:
        │   ├───XRGB8888
        │   ├───ARGB8888
        │   ├───XBGR8888
        │   └───ABGR8888
        └───Properties
            ├───"type" (Immutable): Enum {Overlay, Primary, Cursor} - Primary
            ├───"FB_ID" (Atomic): Object Framebuffer - 0
            ├───"IN_FENCE_FD" (Atomic): SRange [-1, INT32_MAX] - -1
            ├───"CRTC_ID" (Atomic): Object CRTC - 0
            ├───"CRTC_X" (Atomic): SRange [INT32_MIN, INT32_MAX] - 0
            ├───"CRTC_Y" (Atomic): SRange [INT32_MIN, INT32_MAX] - 0
            ├───"CRTC_W" (Atomic): Range [0, INT32_MAX] - 0
            ├───"CRTC_H" (Atomic): Range [0, INT32_MAX] - 0
            ├───"SRC_X" (Atomic): Range [0, UINT32_MAX] - 0
            ├───"SRC_Y" (Atomic): Range [0, UINT32_MAX] - 0
            ├───"SRC_W" (Atomic): Range [0, UINT32_MAX] - 0
            └───"SRC_H" (Atomic): Range [0, UINT32_MAX] - 0

Notice the lack of a cursor plane.


wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1584

AdrianVovk commented 5 years ago

I've run into this on two GPUs so far: On an NVIDIA GTX 1070 and an NVIDIA GT 710 2G. Setting WLR_NO_HARDWARE_CURSORS=1 makes the cursor work in the latter case (I don't own the former device so I didn't get to test for sure). Both are running with nouveau.