From 85d6380e6b822eb5842c8cb82bf2bbecd9d7968d Mon Sep 17 00:00:00 2001 From: Shixiong Ou Date: Tue, 23 Sep 2025 15:17:25 +0800 Subject: [PATCH] exa: use dixRegisterPrivateKey to create PRIVATE PIXMAP [WHY] There is a chance of a coredump occurring when stopping Xorg, the specific information is as follows: raise () from /lib/loongarch64-linux-gnu/libc.so.6 abort () from /lib/loongarch64-linux-gnu/libc.so.6 ?? () from /lib/loongarch64-linux-gnu/libc.so.6 __assert_fail () from /lib/loongarch64-linux-gnu/libc.so.6 dixGetPrivateAddr (key=, key=, privates=0xaab99cfea0) at ../../../../include/privates.h:121 dixGetPrivateAddr (key=, key=, privates=) at ../../../../exa/exa_driver.c:205 dixGetPrivate (key=, privates=) at ../../../../include/privates.h:136 exaDestroyPixmap_driver (pPixmap=) at ../../../../exa/exa_driver.c:195 FreePicture (pid=0, value=0xaab9fbf380) at ../../../../render/picture.c:1416 FreePicture (value=0xaab9fbf380, pid=pid@entry=0) at ../../../../render/picture.c:1379 exaUnrealizeGlyphCaches (pScreen=pScreen@entry=0xaab99cfad0, format=) at ../../../../exa/exa_glyphs.c:130 exaGlyphsFini (pScreen=pScreen@entry=0xaab99cfad0) at ../../../../exa/exa_glyphs.c:246 exaCloseScreen (pScreen=0xaab99cfad0) at ../../../../exa/exa.c:746 present_close_screen (screen=0xaab99cfad0) at ../../../../present/present_screen.c:70 CursorCloseScreen (pScreen=0xaab99cfad0) at ../../../../xfixes/cursor.c:205 This is because the screen specific private key has already been released by dixFreeScreenSpecificPrivates() function before calling ->CloseScreen(). [HOW] use dixRegisterPrivateKey to create PRIVATE PIXMAP. Signed-off-by: Shixiong Ou --- exa/exa.c | 4 ++-- exa/exa_priv.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exa/exa.c b/exa/exa.c index 0422c615f..f62d3c45e 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -36,6 +36,7 @@ #include "exa.h" DevPrivateKeyRec exaScreenPrivateKeyRec; +DevPrivateKeyRec exaPixmapPrivateKeyRec; #ifdef MITSHM static ShmFuncs exaShmFuncs = { NULL, NULL }; @@ -945,8 +946,7 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo) * Hookup offscreen pixmaps */ if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) { - if (!dixRegisterScreenSpecificPrivateKey - (pScreen, &pExaScr->pixmapPrivateKeyRec, PRIVATE_PIXMAP, + if (!dixRegisterPrivateKey(&exaPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof(ExaPixmapPrivRec))) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate pixmap private\n", diff --git a/exa/exa_priv.h b/exa/exa_priv.h index f9e166c66..4da0a6683 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -210,11 +210,11 @@ typedef struct { PixmapPtr srcPix; PixmapPtr maskPix; - DevPrivateKeyRec pixmapPrivateKeyRec; DevPrivateKeyRec gcPrivateKeyRec; } ExaScreenPrivRec, *ExaScreenPrivPtr; extern DevPrivateKeyRec exaScreenPrivateKeyRec; +extern DevPrivateKeyRec exaPixmapPrivateKeyRec; #define exaScreenPrivateKey (&exaScreenPrivateKeyRec) @@ -272,7 +272,7 @@ extern DevPrivateKeyRec exaScreenPrivateKeyRec; #define EXA_PIXMAP_SCORE_PINNED 1000 #define EXA_PIXMAP_SCORE_INIT 1001 -#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &ExaGetScreenPriv((p)->drawable.pScreen)->pixmapPrivateKeyRec)) +#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&p->devPrivates, &exaPixmapPrivateKeyRec)) #define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p) #define EXA_RANGE_PITCH (1 << 0)