Created
January 26, 2022 20:36
-
-
Save kleinerm/d2f71bbe76ffe9d76ec8f18b46f73c7c to your computer and use it in GitHub Desktop.
Hack against x-server master/21.1 so it keeps controlling mouse cursor shape/position on a leased out RandR output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ee98f3b1c9d0239b460f7c772cbf0e1c0da33682 Mon Sep 17 00:00:00 2001 | |
From: Mario Kleiner <[email protected]> | |
Date: Tue, 25 Jan 2022 23:32:57 +0100 | |
Subject: [PATCH] Hacks for testing cursor control by server for a leased out | |
drm/randr output. | |
- Allow enable of atomic modesetting under modesetting-ddx to test how | |
an atomic server would behave. | |
- Disable some checks to allow X-Server to control cursor appearance and | |
position as usual. | |
-> Tested with amdgpu-ddx (non-atomic), modesetting-ddx (non-atomic / atomic). | |
-> Tested with atomic and non-atomic Vulkan client / lessee. | |
=> X-Server retains full control over cursor position and shape in all | |
tested conditions, ie. drmModeSetCursor / drmModeSetCursor2 / | |
drmModeMoveCursor works as usual on the leased out DRM output/ | |
RandR output. | |
=> No test of cursor plane control via atomic commit drmModeAtomicCommit(), | |
may or may not work, but probably does. | |
--- | |
hw/xfree86/drivers/modesetting/driver.c | 4 ++-- | |
hw/xfree86/modes/xf86Cursors.c | 4 ++-- | |
2 files changed, 4 insertions(+), 4 deletions(-) | |
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c | |
index fe3315a9c..0b3fe3af5 100644 | |
--- a/hw/xfree86/drivers/modesetting/driver.c | |
+++ b/hw/xfree86/drivers/modesetting/driver.c | |
@@ -1275,12 +1275,12 @@ PreInit(ScrnInfoPtr pScrn, int flags) | |
ms->atomic_modeset_capable = (ret == 0); | |
if (xf86ReturnOptValBool(ms->drmmode.Options, OPTION_ATOMIC, FALSE)) { | |
- ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 1); | |
+ ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 2); | |
ms->atomic_modeset = (ret == 0); | |
} else { | |
ms->atomic_modeset = FALSE; | |
} | |
- | |
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS atomic modesetting: %d\n", (int) ms->atomic_modeset); | |
ms->kms_has_modifiers = FALSE; | |
ret = drmGetCap(ms->fd, DRM_CAP_ADDFB2_MODIFIERS, &value); | |
if (ret == 0 && value != 0) | |
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c | |
index dba5f8877..3a6371789 100644 | |
--- a/hw/xfree86/modes/xf86Cursors.c | |
+++ b/hw/xfree86/modes/xf86Cursors.c | |
@@ -482,7 +482,7 @@ xf86_set_cursor_position(ScrnInfoPtr scrn, int x, int y) | |
for (c = 0; c < xf86_config->num_crtc; c++) { | |
xf86CrtcPtr crtc = xf86_config->crtc[c]; | |
- if (crtc->enabled) | |
+ //if (crtc->enabled) | |
xf86_crtc_set_cursor_position(crtc, x, y); | |
} | |
} | |
@@ -636,7 +636,7 @@ xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor) | |
for (c = 0; c < xf86_config->num_crtc; c++) { | |
xf86CrtcPtr crtc = xf86_config->crtc[c]; | |
- if (crtc->enabled) | |
+ //if (crtc->enabled) | |
if (!xf86_crtc_load_cursor_argb(crtc, cursor)) | |
return FALSE; | |
} | |
-- | |
2.32.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment