From d91c2881159e177d1edc6ffe916c93050b7c0ae2 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 25 Aug 2009 18:04:58 +0100 Subject: Get rid of ModifyPixmapHeader hook This has the effect of fixing text rendering, and also makes the code a lot clearer. --- src/glamo-kms-driver.c | 7 +++---- src/glamo-kms-exa.c | 35 +++++++++++------------------------ src/glamo-kms-exa.h | 3 +++ 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/glamo-kms-driver.c b/src/glamo-kms-driver.c index 32fdb4e..b2cfa7a 100644 --- a/src/glamo-kms-driver.c +++ b/src/glamo-kms-driver.c @@ -125,11 +125,10 @@ static Bool CreateFrontBuffer(ScrnInfoPtr pScrn) PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); unsigned int flags; - pScreen->ModifyPixmapHeader(rootPixmap, + GlamoKMSExaMakeFullyFledged(rootPixmap, pScrn->virtualX, pScrn->virtualY, pScrn->depth, pScrn->bitsPerPixel, - pScrn->displayWidth * pScrn->bitsPerPixel/8, - NULL); + pScrn->displayWidth*pScrn->bitsPerPixel/8); drmModeAddFB(pGlamo->drm_fd, pScrn->virtualX, @@ -300,7 +299,7 @@ static Bool GlamoKMSCreateScreenResources(ScreenPtr pScreen) rootPixmap = pScreen->GetScreenPixmap(pScreen); - if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL)) + if (!GlamoKMSExaMakeFullyFledged(rootPixmap, -1, -1, -1, -1, -1)) FatalError("Couldn't adjust screen pixmap\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Adding framebuffer....!\n"); diff --git a/src/glamo-kms-exa.c b/src/glamo-kms-exa.c index a7950c8..87839c7 100644 --- a/src/glamo-kms-exa.c +++ b/src/glamo-kms-exa.c @@ -471,9 +471,10 @@ static void GlamoKMSExaFinishAccess(PixmapPtr pPix, int index) } -static Bool GlamoKMSExaModifyPixmapHeader(PixmapPtr pPix, int width, int height, - int depth, int bitsPerPixel, - int devKind, pointer pPixData) +/* This essentially does the job of ModifyPixmapHeader, for the occasions + * when we need to update the properties of the screen pixmap. */ +Bool GlamoKMSExaMakeFullyFledged(PixmapPtr pPix, int width, int height, + int depth, int bitsPerPixel, int devKind) { ScreenPtr screen = pPix->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[screen->myNum]; @@ -493,14 +494,14 @@ static Bool GlamoKMSExaModifyPixmapHeader(PixmapPtr pPix, int width, int height, priv = exaGetPixmapDriverPrivate(pPix); if (!priv) { /* This should never, ever, happen */ - FatalError("NO PIXMAP PRIVATE\n"); + FatalError("Fledgeling pixmap had no driver private!\n"); return FALSE; } new_size = (width * height * depth) / 8; if ( new_size == 0 ) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Zero-sized pixmap in ModifyPixmapHeader" + "Fledgeling pixmap would still have zero size!" " %ix%i %i bpp depth=%i\n", width, height, bitsPerPixel, depth); new_size = 1; @@ -514,29 +515,15 @@ static Bool GlamoKMSExaModifyPixmapHeader(PixmapPtr pPix, int width, int height, GLAMO_GEM_DOMAIN_VRAM, 0); if ( priv->bo == NULL ) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to create buffer object" - " in ModifyPixmapHeader.\n"); + "Couldn't create buffer object for" + " fledgeling pixmap!\n"); return FALSE; } } else { - if ( priv->bo->size < new_size ) { - - /* Get rid of the old GEM object */ - glamo_bo_unref(priv->bo); - - /* Create a new one of the correct size */ - priv->bo = glamo_bo_open(pGlamo->bufmgr, 0, new_size, 2, - GLAMO_GEM_DOMAIN_VRAM, 0); - if ( priv->bo == NULL ) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to reallocate buffer object" - " in ModifyPixmapHeader.\n"); - return FALSE; - } - - } /* else, reallocation is not required */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Fledgeling pixmap already had a buffer object!\n"); } @@ -662,7 +649,7 @@ void GlamoKMSExaInit(ScrnInfoPtr pScrn) exa->CreatePixmap = GlamoKMSExaCreatePixmap; exa->DestroyPixmap = GlamoKMSExaDestroyPixmap; exa->PixmapIsOffscreen = GlamoKMSExaPixmapIsOffscreen; - exa->ModifyPixmapHeader = GlamoKMSExaModifyPixmapHeader; + exa->ModifyPixmapHeader = NULL; /* Hook up with libdrm */ pGlamo->bufmgr = glamo_bo_manager_gem_ctor(pGlamo->drm_fd); diff --git a/src/glamo-kms-exa.h b/src/glamo-kms-exa.h index 6452050..b39878a 100644 --- a/src/glamo-kms-exa.h +++ b/src/glamo-kms-exa.h @@ -25,3 +25,6 @@ extern void GlamoKMSExaInit(ScrnInfoPtr pScrn); extern void GlamoKMSExaClose(ScrnInfoPtr pScrn); extern unsigned int driGetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags); +extern Bool GlamoKMSExaMakeFullyFledged(PixmapPtr pPix, int width, int height, + int depth, int bitsPerPixel, + int devKind); -- cgit v1.2.3