From 70ecd97401220d3fe2864b1aee5fb1399c7e534d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 May 2009 23:49:27 +0200 Subject: Don't try to accelerate 8bit solid fills, because in it's current shape it does not work. --- src/glamo-draw.c | 16 ++-------------- src/glamo-driver.c | 42 ++++++++++++++++++++++++++++++++++-------- src/glamo.h | 2 ++ 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/glamo-draw.c b/src/glamo-draw.c index 6d4ea15..17c1e6b 100644 --- a/src/glamo-draw.c +++ b/src/glamo-draw.c @@ -307,25 +307,13 @@ GLAMOExaPrepareSolid(PixmapPtr pPix, FbBits mask; RING_LOCALS; -/* if (pPix->drawable.bitsPerPixel != 16) - GLAMO_FALLBACK(("Only 16bpp is supported\n"));*/ + if (pPix->drawable.bitsPerPixel != 16) + GLAMO_FALLBACK(("Only 16bpp is supported\n")); mask = FbFullMask(16); if ((pm & mask) != mask) GLAMO_FALLBACK(("Can't do planemask 0x%08x\n", (unsigned int) pm)); - switch (pPix->drawable.bitsPerPixel) { - case 8: - if (pPix->devKind & 1) - return FALSE; - fg = (fg | fg << 8); - case 16: - break; - default: - return FALSE; - break; - } - op = GLAMOSolidRop[alu] << 8; offset = exaGetPixmapOffset(pPix); pitch = pPix->devKind; diff --git a/src/glamo-driver.c b/src/glamo-driver.c index d6d9624..23d045c 100644 --- a/src/glamo-driver.c +++ b/src/glamo-driver.c @@ -93,7 +93,10 @@ GlamoEnterVT(int scrnIndex, int flags); static void GlamoLeaveVT(int scrnIndex, int flags); -/* -------------------------------------------------------------------- */ +static void +GlamoLoadColormap(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual); + /* -------------------------------------------------------------------- */ static const xf86CrtcConfigFuncsRec glamo_crtc_config_funcs = { .resize = GlamoCrtcResize @@ -175,10 +178,6 @@ static const char *fbdevHWSymbols[] = { "fbdevHWMapVidmem", "fbdevHWUnmapVidmem", - /* colormap */ - "fbdevHWLoadPalette", - "fbdevHWLoadPaletteWeak", - /* ScrnInfo hooks */ "fbdevHWAdjustFrameWeak", "fbdevHWSaveScreen", @@ -418,9 +417,9 @@ GlamoPreInit(ScrnInfoPtr pScrn, int flags) pGlamo->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + pScrn->racMemFlags = RAC_FB | RAC_CURSOR | RAC_VIEWPORT; /* XXX Is this right? Can probably remove RAC_FB */ - pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + pScrn->racIoFlags = RAC_FB | RAC_CURSOR | RAC_VIEWPORT; fb_device = xf86FindOptionValue(pGlamo->pEnt->device->options, "Device"); @@ -619,6 +618,7 @@ GlamoScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) RR_Rotate_180 | RR_Rotate_270); #endif /* colormap */ + pGlamo->colormap = NULL; if (!miCreateDefColormap(pScreen)) { xf86DrvMsg(scrnIndex, X_ERROR, "internal error: miCreateDefColormap failed " @@ -627,7 +627,7 @@ GlamoScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } flags = CMAP_PALETTED_TRUECOLOR; - if (!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPaletteWeak(), + if (!xf86HandleColormaps(pScreen, 256, 8, GlamoLoadColormap, NULL, flags)) return FALSE; @@ -659,6 +659,11 @@ GlamoCloseScreen(int scrnIndex, ScreenPtr pScreen) fbdevHWUnmapVidmem(pScrn); GlamoUnmapMMIO(pScrn); + if (pGlamo->colormap) { + xfree(pGlamo->colormap); + pGlamo->colormap = NULL; + } + pScrn->vtSema = FALSE; pScreen->CreateScreenResources = pGlamo->CreateScreenResources; @@ -826,3 +831,24 @@ GlamoLeaveVT(int scrnIndex, int flags) { GlamoRestoreHW(pScrn); } +static void +GlamoLoadColormap(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual) { + GlamoPtr pGlamo = GlamoPTR(pScrn); + int i; + ErrorF("%s:%s[%d]\n", __FILE__, __func__, __LINE__); + + if (pGlamo->colormap) { + xfree (pGlamo->colormap); + } + + pGlamo->colormap = xalloc (sizeof(uint16_t) * numColors); + + for (i = 0; i < numColors; ++i) { + pGlamo->colormap[i] = + ((colors[indices[i]].red << 8) & 0xf700) | + ((colors[indices[i]].green << 3) & 0x7e0) | + (colors[indices[i]].blue >> 3); + } +} + diff --git a/src/glamo.h b/src/glamo.h index c5d18c3..6155259 100644 --- a/src/glamo.h +++ b/src/glamo.h @@ -132,6 +132,8 @@ typedef struct { /* Use hardware acceleration */ Bool accel; + + uint16_t *colormap; } GlamoRec, *GlamoPtr; #define GlamoPTR(p) ((GlamoPtr)((p)->driverPrivate)) -- cgit v1.2.3