pop-os / cosmic-comp

Compositor for the COSMIC desktop environment
GNU General Public License v3.0
492 stars 94 forks source link

Blank screen with virtio graphics #136

Open nazar-pc opened 1 year ago

nazar-pc commented 1 year ago

Wanted to try in a VM with hardware accelerated GPU with virtio and got black screen with cursor.

QLX worked fine. Using libvirt.

ids1024 commented 1 year ago

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)?

Drakulix commented 1 year ago

Sounds like we might be adding a property the virtio driver doesn't support.

Drakulix commented 1 year ago

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

ids1024 commented 1 year ago

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
│       │   ├───1024x768@74.99 preferred driver nhsync nvsync 
│       │   ├───5120x2160@50.00 driver phsync pvsync 64:27 
│       │   ├───4096x2160@50.00 driver phsync pvsync 256:135 
│       │   ├───3840x2160@50.00 driver phsync pvsync 16:9 
│       │   ├───1920x1440@60.00 driver nhsync pvsync 
│       │   ├───2560x1080@50.00 driver phsync pvsync 64:27 
│       │   ├───1856x1392@59.99 driver nhsync pvsync 
│       │   ├───1792x1344@60.00 driver nhsync pvsync 
│       │   ├───2048x1152@60.00 driver phsync pvsync 
│       │   ├───1920x1200@59.88 driver nhsync pvsync 
│       │   ├───1920x1080@60.00 driver nhsync nvsync 
│       │   ├───1920x1080@50.00 driver phsync pvsync 16:9 
│       │   ├───1600x1200@60.00 driver phsync pvsync 
│       │   ├───1680x1050@59.95 driver nhsync pvsync 
│       │   ├───1400x1050@59.98 driver nhsync pvsync 
│       │   ├───1280x1024@60.02 driver phsync pvsync 
│       │   ├───1440x900@59.89 driver nhsync pvsync 
│       │   ├───1280x960@60.00 driver phsync pvsync 
│       │   ├───1360x768@60.02 driver phsync pvsync 
│       │   ├───1280x768@59.87 driver nhsync pvsync 
│       │   ├───1024x768@60.00 driver nhsync nvsync 
│       │   ├───800x600@60.32 driver phsync pvsync 
│       │   ├───640x480@60.00 driver nhsync nvsync 4:3 
│       │   └───640x480@59.94 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: 1024x768@74.99 preferred driver nhsync nvsync 
│       └───Properties
│           ├───"ACTIVE" (atomic): range [0, 1] = 1
│           ├───"MODE_ID" (atomic): blob = 38
│           │   └───1024x768@74.99 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.

ids1024 commented 1 year ago

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.

Drakulix commented 1 year ago

Hopefully fixed (for the case with acceleration) by: https://github.com/Smithay/smithay/pull/1070

XV-02 commented 9 months ago

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)

cosmic_session_failure_nonaccelerated_virtio_journalctl.log

nebrelbug commented 6 months ago

Still occurring for me on Gnome Boxes (with "3D Acceleration" both disabled and enabled, idk if that's the same thing as virtio acceleration)

mmstick commented 6 months ago

@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.

nater1983 commented 3 months ago

image I am still getting this as well will update git pulls and let you know