Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
524a1c8
modesetting: Add DRMMODE_PLANE_SIZE_HINTS
notbabaisyou Dec 19, 2025
dab0262
meson: Detect and define LIBDRM_PLANE_SIZE_HINTS
notbabaisyou Dec 19, 2025
b54e565
modesetting: Refactor drmmode_crtc_create_planes
notbabaisyou Dec 19, 2025
86cc463
modesetting: Add required structs for handling cursor dimensions
notbabaisyou Dec 19, 2025
5b3d96b
modesetting: Fix up cursor size probing.
notbabaisyou Dec 19, 2025
0ade777
modesetting: Use xnfcalloc instead of calloc
notbabaisyou Dec 19, 2025
f54d533
mi: miscrinit: Avoid breaking CloseScreen() chain
Dec 20, 2025
aa4a2cc
modesetting: Import front bo earlier
Dec 20, 2025
720cef5
dri3: Free formats on CloseScreen.
notbabaisyou Dec 22, 2025
8c003f0
dix,exa,glx: Add allocation failure guards.
notbabaisyou Dec 22, 2025
1bdb952
os: make FormatInt64() handle LONG_MIN correctly
alanc Dec 22, 2025
880232d
exa: Fix crash after CloseScreen()
Dec 22, 2025
b8d2f2a
modesetting: Add warning in drmmode_output_create_resources.
notbabaisyou Dec 22, 2025
b07c352
modesetting: Always finalize the cursor.
notbabaisyou Dec 22, 2025
d08afa3
dri2: Fix sw cursor rendering issue
Dec 22, 2025
2f13dd8
modesetting: Print error message for flip queue retry
notbabaisyou Dec 22, 2025
f931b89
xf86: Accept platform devices with efidrm/vesadrm DRM kernel drivers
tdz Dec 22, 2025
844d152
modesetting: Re-shuffle _modesettingRec around.
notbabaisyou Dec 22, 2025
582ca7d
modesetting: Track and use universal plane support
notbabaisyou Dec 22, 2025
35a5b93
modesetting: Guard gbm_bo_unmap behind GLAMOR_HAS_GBM_MAP
notbabaisyou Dec 30, 2025
3244663
xkb: Fix locked group indicator desync on multi-HID keyboards
Watkurem Dec 30, 2025
edad3b5
xfree86: Support Moore Threads GPU
jinpeng-mt Dec 30, 2025
2d13051
modesetting: Fix tab usage in ms_present_unflip
notbabaisyou Dec 30, 2025
19bc1ad
randr: clear primary screen's primaryOutput when the output is deleted
hongaoo Dec 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dix/dixfonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,8 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
c->saved = c->current;
c->haveSaved = TRUE;
free(c->savedName);
c->savedName = malloc(namelen + 1);
if (c->savedName)
memcpy(c->savedName, name, namelen + 1);
c->savedName = XNFalloc(namelen + 1);
memcpy(c->savedName, name, namelen + 1);
c->savedNameLen = namelen;
aliascount = 20;
}
Expand Down
3 changes: 3 additions & 0 deletions dri3/dri3.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ dri3_close_screen(ScreenPtr screen)

unwrap(screen_priv, screen, CloseScreen);

if (screen_priv->formats)
free(screen_priv->formats);

free(screen_priv);
return (*screen->CloseScreen) (screen);
}
Expand Down
16 changes: 6 additions & 10 deletions exa/exa.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,6 @@ exaCloseScreen(ScreenPtr pScreen)
unwrap(pExaScr, ps, Triangles);
unwrap(pExaScr, ps, AddTraps);

free(pExaScr);

return (*pScreen->CloseScreen) (pScreen);
}

Expand Down Expand Up @@ -876,27 +874,25 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)

ps = GetPictureScreenIfSet(pScreen);

if (!dixRegisterPrivateKey(&exaScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) {
LogMessage(X_WARNING, "EXA(%d): Failed to register screen private\n",
if (!dixRegisterPrivateKey(&exaScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof(ExaScreenPrivRec))) {
LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
pScreen->myNum);
return FALSE;
}

pExaScr = calloc(1, sizeof(ExaScreenPrivRec));
pExaScr = ExaGetScreenPriv(pScreen);
if (!pExaScr) {
LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
pScreen->myNum);
return FALSE;
}

pExaScr->info = pScreenInfo;

dixSetPrivate(&pScreen->devPrivates, exaScreenPrivateKey, pExaScr);

pExaScr->migration = ExaMigrationAlways;

exaDDXDriverInit(pScreen);

/* private re-allocated */
pExaScr = ExaGetScreenPriv(pScreen);

if (!dixRegisterScreenSpecificPrivateKey
(pScreen, &pExaScr->gcPrivateKeyRec, PRIVATE_GC, sizeof(ExaGCPrivRec))) {
LogMessage(X_WARNING, "EXA(%d): Failed to allocate GC private\n",
Expand Down
3 changes: 3 additions & 0 deletions exa/exa_mixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
if (w == 1 && h == 1) {
pExaPixmap->sys_ptr = malloc(paddedWidth);

if (!pExaPixmap->sys_ptr)
return NullPixmap;

/* Set up damage tracking */
pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
DamageReportNonEmpty, TRUE,
Expand Down
2 changes: 1 addition & 1 deletion exa/exa_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ extern DevPrivateKeyRec exaPixmapPrivateKeyRec;

#define exaScreenPrivateKey (&exaScreenPrivateKeyRec)

#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixGetPrivate(&(s)->devPrivates, exaScreenPrivateKey))
#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixGetPrivateAddr(&(s)->devPrivates, exaScreenPrivateKey))
#define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)

#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixGetPrivateAddr(&(gc)->devPrivates, &ExaGetScreenPriv(gc->pScreen)->gcPrivateKeyRec))
Expand Down
2 changes: 1 addition & 1 deletion glx/glxscreens.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
pGlxScreen->numFBConfigs = i;

pGlxScreen->visuals =
calloc(pGlxScreen->numFBConfigs, sizeof(__GLXconfig *));
XNFcallocarray(pGlxScreen->numFBConfigs, sizeof(__GLXconfig *));

/* First, try to choose featureful FBconfigs for the existing X visuals.
* Note that if multiple X visuals end up with the same FBconfig being
Expand Down
3 changes: 3 additions & 0 deletions hw/xfree86/common/xf86pciBus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,9 @@ xf86VideoPtrToDriverList(struct pci_device *dev, XF86MatchedDrivers *md)
case 0x102b:
driverList[0] = "mga";
break;
case 0x1ed5:
driverList[0] = "mtgpu";
break;
case 0x10c8:
driverList[0] = "neomagic";
break;
Expand Down
36 changes: 26 additions & 10 deletions hw/xfree86/common/xf86platformBus.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,32 @@ int platformSlotClaimed;

int xf86_num_platform_devices;

/**
* These kernel devices should be allowed
* to attach to modesetting by default.
*/
static const char* DEVICE_ALLOWLIST[] =
{
"hyperv_drm",
"simpledrm",
"vesadrm",
"efidrm",
"ofdrm"
};

struct xf86_platform_device *xf86_platform_devices;

static inline
Bool xf86_is_device_allowed(char* driver)
{
const int size = sizeof(DEVICE_ALLOWLIST) / sizeof(DEVICE_ALLOWLIST[0]);
for (int idx = 0; idx < size; idx++)
if (strcmp(driver, DEVICE_ALLOWLIST[idx]) == 0)
return TRUE;

return FALSE;
}

int
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
{
Expand Down Expand Up @@ -579,16 +603,8 @@ xf86platformProbeDev(DriverPtr drvp)
/* for non-seat0 servers assume first device is the master */
if (ServerIsNotSeat0()) {
break;
} else {
/* Accept the device if the driver is hyperv_drm */
if (strcmp(xf86_platform_devices[j].attribs->driver, "hyperv_drm") == 0)
break;
/* Accept the device if the driver is ofdrm */
if (strcmp(xf86_platform_devices[j].attribs->driver, "ofdrm") == 0)
break;
/* Accept the device if the driver is simpledrm */
if (strcmp(xf86_platform_devices[j].attribs->driver, "simpledrm") == 0)
break;
} else if (xf86_is_device_allowed(xf86_platform_devices[j].attribs->driver)) {
break;
}

if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
Expand Down
6 changes: 4 additions & 2 deletions hw/xfree86/drivers/modesetting/dri2.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,16 +619,18 @@ ms_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front,
*front_pix = *back_pix;
*back_pix = tmp_pix;

ms->glamor.egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);

/* Post damage on the front buffer so that listeners, such
* as DisplayLink know take a copy and shove it over the USB.
*/
region.extents.x1 = region.extents.y1 = 0;
region.extents.x2 = front_priv->pixmap->drawable.width;
region.extents.y2 = front_priv->pixmap->drawable.height;
region.data = NULL;

DamageRegionAppend(&front_priv->pixmap->drawable, &region);

ms->glamor.egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);

DamageRegionProcessPending(&front_priv->pixmap->drawable);
}

Expand Down
35 changes: 17 additions & 18 deletions hw/xfree86/drivers/modesetting/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,6 @@ PreInit(ScrnInfoPtr pScrn, int flags)
pEnt = xf86GetEntityInfo(pScrn->entityList[0]);

ms = modesettingPTR(pScrn);
ms->SaveGeneration = -1;
ms->pEnt = pEnt;
ms->drmmode.is_secondary = FALSE;
pScrn->displayWidth = 640; /* default it */
Expand Down Expand Up @@ -1401,17 +1400,6 @@ PreInit(ScrnInfoPtr pScrn, int flags)
ms->drmmode.sw_cursor = TRUE;
}

ms->max_cursor_width = 64;
ms->max_cursor_height = 64;
ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_WIDTH, &value);
if (!ret) {
ms->max_cursor_width = value;
}
ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_HEIGHT, &value);
if (!ret) {
ms->max_cursor_height = value;
}

try_enable_glamor(pScrn);

if (!ms->drmmode.glamor) {
Expand Down Expand Up @@ -1478,15 +1466,22 @@ PreInit(ScrnInfoPtr pScrn, int flags)
ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 0);
ms->atomic_modeset_capable = (ret == 0);

/*
* Universal planes are implied by atomic modeset. However, if atomic modeset
* is disabled, universal planes are still useful for us to understand what
* modifiers the primary plane can support (see drmmode_crtc_create_planes())
*/
ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
ms->universal_planes = (ret == 0);

/* TearFree requires glamor and, if PageFlip is enabled, universal planes */
if (xf86ReturnOptValBool(ms->drmmode.Options, OPTION_TEARFREE, TRUE)) {
if (pScrn->is_gpu) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"TearFree cannot synchronize PRIME; use 'PRIME Synchronization' instead\n");
} else if (ms->drmmode.glamor) {
/* Atomic modesetting implicitly enables universal planes */
if (!ms->drmmode.pageflip ||
!drmSetClientCap(ms->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
if (!ms->drmmode.pageflip || ms->universal_planes) {
ms->drmmode.tearfree_enable = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TearFree: enabled\n");
} else {
Expand Down Expand Up @@ -2136,10 +2131,15 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
PointPriv->spriteFuncs = &drmmode_sprite_funcs;
}

/* Get the maximum cursor size. */
drmmode_cursor_dim_rec cursor_dim = { 0 };
if (!drmmode_get_largest_cursor(pScrn, &cursor_dim))
return FALSE;

/* Need to extend HWcursor support to handle mask interleave */
if (!ms->drmmode.sw_cursor)
xf86_cursors_init(pScreen, ms->max_cursor_width, ms->max_cursor_height,
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
xf86_cursors_init(pScreen, cursor_dim.width, cursor_dim.height,
HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED |
HARDWARE_CURSOR_UPDATE_UNHIDDEN |
HARDWARE_CURSOR_ARGB);

Expand Down Expand Up @@ -2362,8 +2362,7 @@ CloseScreen(ScreenPtr pScreen)
ms->drmmode.shadow_fb2 = NULL;
}

if (!ms->drmmode.sw_cursor)
xf86_cursors_fini(pScreen);
xf86_cursors_fini(pScreen);

drmmode_uevent_fini(pScrn, &ms->drmmode);

Expand Down
15 changes: 5 additions & 10 deletions hw/xfree86/drivers/modesetting/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,14 @@ struct ms_drm_queue {

typedef struct _modesettingRec {
int fd;
Bool fd_passed;

int Chipset;
EntityInfoPtr pEnt;

Bool fd_passed;
Bool noAccel;

EntityInfoPtr pEnt;
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow;
unsigned int SaveGeneration;

CreateScreenResourcesProcPtr createScreenResources;
ScreenBlockHandlerProcPtr BlockHandler;
miPointerSpriteFuncPtr SpriteFuncs;
Expand All @@ -126,20 +124,17 @@ typedef struct _modesettingRec {
* @{
*/
Bool atomic_modeset_capable;
Bool universal_planes;
Bool pending_modeset;
Bool kms_has_modifiers;
/** @} */

DamagePtr damage;
Bool dirty_enabled;

uint32_t min_cursor_width, min_cursor_height;
uint32_t max_cursor_width, max_cursor_height;

Bool has_queue_sequence;
Bool tried_queue_sequence;

Bool kms_has_modifiers;

/* VRR support */
Bool vrr_support;
WindowPtr flip_window;
Expand Down
Loading