From 27dba2abb29df233effdb3da06dce9f6f81c9612 Mon Sep 17 00:00:00 2001 From: Twaik Yont Date: Mon, 8 Apr 2024 19:18:55 +0300 Subject: [PATCH] Fixing dri3 pixmap allocating issue --- app/src/main/cpp/lorie/InitOutput.c | 6 +++--- app/src/main/cpp/lorie/dri3.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/cpp/lorie/InitOutput.c b/app/src/main/cpp/lorie/InitOutput.c index 46eae5f..ba8fff9 100644 --- a/app/src/main/cpp/lorie/InitOutput.c +++ b/app/src/main/cpp/lorie/InitOutput.c @@ -559,14 +559,14 @@ lorieScreenInit(ScreenPtr pScreen, unused int argc, unused char **argv) { pScreen->whitePixel = 1; if (FALSE + || !lorieInitDri3(pScreen) || !miSetVisualTypesAndMasks(24, ((1 << TrueColor) | (1 << DirectColor)), 8, TrueColor, 0xFF0000, 0x00FF00, 0x0000FF) || !miSetPixmapDepths() || !fbScreenInit(pScreen, NULL, pvfb->root.width, pvfb->root.height, monitorResolution, monitorResolution, 0, 32) || !fbPictureInit(pScreen, 0, 0) || !lorieRandRInit(pScreen) || !miPointerInitialize(pScreen, &loriePointerSpriteFuncs, &loriePointerCursorFuncs, TRUE) - || !fbCreateDefColormap(pScreen) - || !lorieInitDri3(pScreen)) + || !fbCreateDefColormap(pScreen)) return FALSE; wrap(pvfb, pScreen, CreateScreenResources, lorieCreateScreenResources) @@ -728,4 +728,4 @@ __GLXprovider __glXDRISWRastProvider = { glXDRIscreenProbe, "DRISWRAST", NULL -}; \ No newline at end of file +}; diff --git a/app/src/main/cpp/lorie/dri3.c b/app/src/main/cpp/lorie/dri3.c index 3e80e54..8ac0bfe 100644 --- a/app/src/main/cpp/lorie/dri3.c +++ b/app/src/main/cpp/lorie/dri3.c @@ -408,7 +408,7 @@ lorieDestroyPixmap(PixmapPtr pPixmap) { ScreenPtr pScreen = pPixmap->drawable.pScreen; lorieScrPriv(pScreen); - if (pPixmap->refcnt == 1) { + if (pPixmap->refcnt == 1 && !pPixmap->drawable.width && !pPixmap->drawable.height) { ptr = dixLookupPrivate(&pPixmap->devPrivates, &lorieMmappedPixPrivateKey); pPixPriv = dixLookupPrivate(&pPixmap->devPrivates, &lorieAHBPixPrivateKey); size = pPixmap->devKind * pPixmap->drawable.height; @@ -490,7 +490,7 @@ static PixmapPtr loriePixmapFromFds(ScreenPtr screen, CARD8 num_fds, const int * goto fail; } - dixSetPrivate(&pixmap->devPrivates, &lorieMmappedPixPrivateKey, pPixPriv); + dixSetPrivate(&pixmap->devPrivates, &lorieAHBPixPrivateKey, pPixPriv); // Sending signal to other end of socket to send buffer. uint8_t buf = 1; @@ -517,7 +517,7 @@ static PixmapPtr loriePixmapFromFds(ScreenPtr screen, CARD8 num_fds, const int * goto fail; } - screen->ModifyPixmapHeader(pixmap, desc.width, desc.height, 0, 0, desc.stride, NULL); + screen->ModifyPixmapHeader(pixmap, desc.width, desc.height, 0, 0, desc.stride * 4, NULL); return pixmap; } @@ -579,4 +579,4 @@ Bool lorieInitDri3(ScreenPtr pScreen) { dixSetPrivate(&pScreen->devPrivates, &lorieScrPrivateKey, pScrPriv); return TRUE; -} \ No newline at end of file +}