cosmic-comp
cosmic-comp copied to clipboard
Blank screen with virtio graphics
Wanted to try in a VM with hardware accelerated GPU with virtio and got black screen with cursor.
QLX worked fine. Using libvirt.
Hm, this used to work, but it seems like with virtio (accelerated or otherwise), I'm now getting Error testing state of device 'Some("/dev/dri/card0")' (Invalid argument)
?
Sounds like we might be adding a property the virtio driver doesn't support.
Needs a drm log to continue debugging.
Easiest way is to patch the start-cosmic
script to wrap the cosmic-session binary similar to these instructions from wlroots: https://github.com/swaywm/wlroots/wiki/DRM-Debugging
Oh, so you need to write a secret magic byte to /sys
to get information from DRM? Okay.
Looking at the flood of messages there, it includes:
[ 514.957116] virtio-pci 0000:00:01.0: [drm:drm_atomic_plane_check [drm]] [PLANE:31:plane-0] invalid pixel format AR24 little-endian (0x34325241), modifier 0x0
[ 514.957138] virtio-pci 0000:00:01.0: [drm:drm_atomic_check_only [drm]] [PLANE:31:plane-0] atomic core check failed
AR24
being argb8888
.
So looking at drm_info
:
Node: /dev/dri/card0
├───Driver: virtio_gpu (virtio GPU) version 0.1.0 (0)
│ ├───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 = 1
│ ├───DRM_CAP_VBLANK_HIGH_CRTC = 1
│ ├───DRM_CAP_DUMB_PREFERRED_DEPTH = 0
│ ├───DRM_CAP_DUMB_PREFER_SHADOW = 0
│ ├───DRM_CAP_PRIME = 3
│ ├───DRM_CAP_TIMESTAMP_MONOTONIC = 1
│ ├───DRM_CAP_ASYNC_PAGE_FLIP = 0
│ ├───DRM_CAP_CURSOR_WIDTH = 64
│ ├───DRM_CAP_CURSOR_HEIGHT = 64
│ ├───DRM_CAP_ADDFB2_MODIFIERS = 0
│ ├───DRM_CAP_PAGE_FLIP_TARGET = 0
│ ├───DRM_CAP_CRTC_IN_VBLANK_EVENT = 1
│ ├───DRM_CAP_SYNCOBJ = 0
│ └───DRM_CAP_SYNCOBJ_TIMELINE = 0
├───Device: PCI 1af4:1050
├───Framebuffer size
│ ├───Width: [32, 8192]
│ └───Height: [32, 8192]
├───Connectors
│ └───Connector 0
│ ├───Object ID: 34
│ ├───Type: virtual
│ ├───Status: connected
│ ├───Physical size: 260x190 mm
│ ├───Subpixel: unknown
│ ├───Encoders: {0}
│ ├───Modes
│ │ ├───[email protected] preferred driver nhsync nvsync
│ │ ├───[email protected] driver phsync pvsync 64:27
│ │ ├───[email protected] driver phsync pvsync 256:135
│ │ ├───[email protected] driver phsync pvsync 16:9
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver phsync pvsync 64:27
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver phsync pvsync
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver nhsync nvsync
│ │ ├───[email protected] driver phsync pvsync 16:9
│ │ ├───[email protected] driver phsync pvsync
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver phsync pvsync
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver phsync pvsync
│ │ ├───[email protected] driver phsync pvsync
│ │ ├───[email protected] driver nhsync pvsync
│ │ ├───[email protected] driver nhsync nvsync
│ │ ├───[email protected] driver phsync pvsync
│ │ ├───[email protected] driver nhsync nvsync 4:3
│ │ └───[email protected] driver nhsync nvsync
│ └───Properties
│ ├───"DPMS": enum {On, Standby, Suspend, Off} = On
│ ├───"link-status": enum {Good, Bad} = Good
│ ├───"non-desktop" (immutable): range [0, 1] = 0
│ ├───"TILE" (immutable): blob = 0
│ ├───"CRTC_ID" (atomic): object CRTC = 33
│ └───"EDID" (immutable): blob = 36
├───Encoders
│ └───Encoder 0
│ ├───Object ID: 35
│ ├───Type: virtual
│ ├───CRTCS: {0}
│ └───Clones: {0}
├───CRTCs
│ └───CRTC 0
│ ├───Object ID: 33
│ ├───Mode: [email protected] preferred driver nhsync nvsync
│ └───Properties
│ ├───"ACTIVE" (atomic): range [0, 1] = 1
│ ├───"MODE_ID" (atomic): blob = 38
│ │ └───[email protected] preferred driver nhsync nvsync
│ ├───"OUT_FENCE_PTR" (atomic): range [0, UINT64_MAX] = 0
│ └───"VRR_ENABLED": range [0, 1] = 0
└───Planes
├───Plane 0
│ ├───Object ID: 31
│ ├───CRTCs: {0}
│ ├───Formats:
│ │ └───XRGB8888 (0x34325258)
│ └───Properties
│ ├───"type" (immutable): enum {Overlay, Primary, Cursor} = Primary
│ ├───"FB_ID" (atomic): object framebuffer = 37
│ │ ├───Object ID: 37
│ │ ├───Size: 1024x768
│ │ ├───Pitch: 4096
│ │ ├───Bits per pixel: 32
│ │ └───Depth: 24
│ ├───"IN_FENCE_FD" (atomic): srange [-1, INT32_MAX] = -1
│ ├───"CRTC_ID" (atomic): object CRTC = 33
│ ├───"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] = 1024
│ ├───"CRTC_H" (atomic): range [0, INT32_MAX] = 768
│ ├───"SRC_X" (atomic): range [0, UINT32_MAX] = 0
│ ├───"SRC_Y" (atomic): range [0, UINT32_MAX] = 0
│ ├───"SRC_W" (atomic): range [0, UINT32_MAX] = 1024
│ └───"SRC_H" (atomic): range [0, UINT32_MAX] = 768
└───Plane 1
├───Object ID: 32
├───CRTCs: {0}
├───Formats:
│ └───ARGB8888 (0x34325241)
└───Properties
├───"type" (immutable): enum {Overlay, Primary, Cursor} = Cursor
├───"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
So Plane 0 supports only XRGB8888
, while Plane 1 supports only ARGB8888
.
It starts on virtio after adding XRGB8888
to the list in https://github.com/pop-os/cosmic-comp/blob/a683b7cd63e20222a723e1d23e375e10f094cd8d/src/backend/kms/mod.rs#L1310-L1315.
Trying to start a terminal though it panics at https://github.com/pop-os/cosmic-comp/blob/a683b7cd63e20222a723e1d23e375e10f094cd8d/src/backend/kms/mod.rs#L1477. When run with virtio without graphics acceleration. It does not fail there for accelerated virtio or for qxl.
Hopefully fixed (for the case with acceleration) by: https://github.com/Smithay/smithay/pull/1070
From my brief testing, it looks as though the Cosmic-Session does not successfully instance when run with virtio without acceleration. It does successfully instance when run with virtio with acceleration however.
I grabbed journal logs for posterity. cosmic-comp
version was 0.1~1708344589~22.04~849882a
(849882a7db8b3d753a4f14410090c691f614e868)
Still occurring for me on Gnome Boxes (with "3D Acceleration" both disabled and enabled, idk if that's the same thing as virtio acceleration)
@nebrelbug You must use QEMU with the QXL video adapter. GNOME Boxes does not configure this, so you have to use virt-manager if you need a GUI.
I am still getting this as well will update git pulls and let you know