Skip to content

Implement support for KMS cursor plane capture#1981

Merged
cgutman merged 5 commits intoLizardByte:nightlyfrom
cgutman:kms_cursor
Jan 6, 2024
Merged

Implement support for KMS cursor plane capture#1981
cgutman merged 5 commits intoLizardByte:nightlyfrom
cgutman:kms_cursor

Conversation

@cgutman
Copy link
Collaborator

@cgutman cgutman commented Jan 5, 2024

Description

This PR implements cursor plane capture for the kmsgrab codepath to allow cursor capture when hardware cursor support is in use. This new code replaces the old code that used XFixes to capture the cursor and removes the "off by default" cursor display behavior now that we're not relying on XFixes for cursor capture.

The code has the following restrictions/limitations:

  • It assumes at most 1 cursor plane per CRTC
  • Only linear ARGB8888 cursor buffers are supported
  • It can perform scaling (CRTC_W/CRTC_H != SRC_W/SRC_H) in the VAAPI encoding path but not the software encoding path
  • It assumes the underlying cursor buffer will not be modified in place
    • Modifications to the underlying dmabuf without a change to the FB_ID will not be captured, though using it as a texture atlas and adjusting the SRC_* properties to switch between cursors will work

The first restriction seems to be satisfied by every driver I checked on drmdb. The second restriction is satisfied by all desktop GPU drivers (i915, amdgpu, nouveau, and nvidia-drm) and probably nobody actually uses non-ARGB8888 buffers on embedded devices that support other formats.

The latter two will depend on the compositor. I doubt the last restriction will be violated by any modern compositors because it could lead to visible tearing if a half-updated cursor image is scanned out by the display hardware. However, I'm unsure if some compositors may rely on scaling for displaying cursors in some cases.

Compositors tested:

  • Mutter
  • Sway
  • KWin

GPU vendors tested:

  • Intel
  • AMD

Screenshot

Issues Fixed or Closed

Fixes #93

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@cgutman cgutman merged commit f88df0f into LizardByte:nightly Jan 6, 2024
KuleRucket pushed a commit to KuleRucket/Sunshine that referenced this pull request Jun 6, 2024
e-dong pushed a commit to e-dong/Sunshine that referenced this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KDE Plasma Wayland: Mouse cursor is not visible

1 participant