modesetting: Use the same cursor mask interleave as other drivers

There is no explanation for these values, but the one we are
currently using doesn't work.

Use the values from vendor-speciffic drivers, which do work.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2025-09-25 01:45:07 +03:00
committed by Enrico Weigelt
parent bbcf22183a
commit 4984b12967
3 changed files with 51 additions and 11 deletions

View File

@@ -40,6 +40,10 @@
#include <X11/extensions/randr.h>
#include <X11/extensions/Xv.h>
#ifdef GLAMOR_HAS_EGL
#include <epoxy/egl.h>
#endif
#include "config/hotplug_priv.h"
#include "dix/dix_priv.h"
#include "mi/mi_priv.h"
@@ -1852,6 +1856,44 @@ CreateWindow_oneshot(WindowPtr pWin)
return ret;
}
static int
modesetting_get_cursor_interleave(int scrnIndex)
{
#ifdef GLAMOR_HAS_EGL
const char* renderer = (const char*)glGetString(GL_RENDERER);
if (!renderer) {
/* Something went really wrong */
xf86DrvMsg(scrnIndex, X_WARNING,
"glGetString(GL_RENDERER) returned NULL, your GL is broken or not initialized\n");
}
const char* vendor = (const char*)glGetString(GL_VENDOR);
if (!vendor) {
/* Something went really wrong */
xf86DrvMsg(scrnIndex, X_WARNING,
"glGetString(GL_VENDOR) returned NULL, your GL is broken or not initialized\n");
}
#define CHECK_GL_NAME(name) ((renderer && strstr(renderer, name)) || (vendor && strstr(vendor, name)))
if (CHECK_GL_NAME("Intel")) {
/* from xf86-video-intel */
return HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64;
}
if (CHECK_GL_NAME("NVIDIA")) {
/* from xf86-video-{nouveau,nv} */
return HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32;
}
if (CHECK_GL_NAME("AMD")) {
/* from xf86-video-{amdgpu,ati} */
return HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
}
#undef CHECK_GL_NAME
#endif
return HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
}
static Bool
ScreenInit(ScreenPtr pScreen, int argc, char **argv)
{
@@ -1967,17 +2009,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
/* Need to extend HWcursor support to handle mask interleave */
if (!ms->drmmode.sw_cursor) {
/* XXX Is there any spec that says we should interleave the cursor bits? XXX */
int interleave;
if (cursor_dim.width >= 64)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64;
else if (cursor_dim.width >= 32)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32;
else if (cursor_dim.width >= 16)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16;
else if (cursor_dim.width >= 8)
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8;
else
interleave = HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
int interleave = modesetting_get_cursor_interleave(pScrn->scrnIndex);
xf86_cursors_init(pScreen, cursor_dim.width, cursor_dim.height,
interleave |

View File

@@ -8,6 +8,12 @@ modesetting_srcs = [
'vblank.c',
]
if epoxy_dep.found()
egl_dep = epoxy_dep
else
egl_dep = disabler()
endif
shared_module(
'modesetting_drv',
modesetting_srcs,
@@ -17,6 +23,7 @@ shared_module(
c_args: xorg_c_args,
dependencies: [
common_dep,
egl_dep,
udev_dep,
libdrm_dep,
gbm_dep,

View File

@@ -102,6 +102,7 @@ conf_data.set('CONFIG_WSCONS', host_machine.system() in ['openbsd', 'netbsd'] ?
conf_data.set('HAVE_XSHMFENCE', xshmfence_dep.found() ? '1' : false)
conf_data.set('WITH_LIBDRM', libdrm_required ? '1' : false)
conf_data.set('LIBDRM_HAS_PLANE_SIZE_HINTS', libdrm_required ? libdrm_dep.version().version_compare('>= 2.4.122') : false)
conf_data.set('GLAMOR_HAS_EGL', epoxy_dep.found() ? '1' : false)
conf_data.set('GLAMOR_HAS_EGL_QUERY_DMABUF',
epoxy_dep.found() and epoxy_dep.version().version_compare('>= 1.4.4') ? '1' : false)
conf_data.set('GLAMOR_HAS_EGL_QUERY_DRIVER',