summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-08-04 23:23:21 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-08-04 23:23:21 +0200
commita6ce6c70cff5108f0751b662b8e52c83daab0722 (patch)
tree81b964822d69688feeed6c5e0f3c825247edca98 /exa
parent842373104d08d47efc863cecbe30431d3faebef1 (diff)
EXA: Simplify exaGetPixmapFirstPixel using GetImage.
Diffstat (limited to 'exa')
-rw-r--r--exa/exa_unaccel.c69
1 files changed, 24 insertions, 45 deletions
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 0d53b67d8..f4700adac 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -492,58 +492,37 @@ ExaCheckAddTraps (PicturePtr pPicture,
/**
* Gets the 0,0 pixel of a pixmap. Used for doing solid fills of tiled pixmaps
* that happen to be 1x1. Pixmap must be at least 8bpp.
- *
- * XXX This really belongs in fb, so it can be aware of tiling and etc.
*/
CARD32
exaGetPixmapFirstPixel (PixmapPtr pPixmap)
{
- CARD32 pixel;
- void *fb;
- Bool need_finish = FALSE;
- BoxRec box;
- RegionRec migration;
- ExaPixmapPriv (pPixmap);
- Bool sys_valid = pExaPixmap->pDamage &&
- !miPointInRegion(&pExaPixmap->validSys, 0, 0, &box);
- Bool damaged = pExaPixmap->pDamage &&
- miPointInRegion(DamageRegion(pExaPixmap->pDamage), 0, 0, &box);
- Bool offscreen = exaPixmapIsOffscreen(pPixmap);
-
- fb = pExaPixmap->sys_ptr;
-
- /* Try to avoid framebuffer readbacks */
- if ((!offscreen && !sys_valid && !damaged) ||
- (offscreen && (!sys_valid || damaged)))
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = 1;
- box.y2 = 1;
- REGION_INIT(pScreen, &migration, &box, 1);
-
- need_finish = TRUE;
-
- exaPrepareAccessReg(&pPixmap->drawable, EXA_PREPARE_SRC, &migration);
- fb = pPixmap->devPrivate.ptr;
- }
-
switch (pPixmap->drawable.bitsPerPixel) {
case 32:
- pixel = *(CARD32 *)fb;
- break;
+ {
+ CARD32 pixel;
+
+ pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
+ ZPixmap, ~0, (char*)&pixel);
+ return pixel;
+ }
case 16:
- pixel = *(CARD16 *)fb;
- break;
+ {
+ CARD16 pixel;
+
+ pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
+ ZPixmap, ~0, (char*)&pixel);
+ return pixel;
+ }
+ case 8:
+ {
+ CARD8 pixel;
+
+ pPixmap->drawable.pScreen->GetImage(&pPixmap->drawable, 0, 0, 1, 1,
+ ZPixmap, ~0, (char*)&pixel);
+ return pixel;
+ }
default:
- pixel = *(CARD8 *)fb;
- break;
+ FatalError("%s called for invalid bpp %d\n", __func__,
+ pPixmap->drawable.bitsPerPixel);
}
-
- if (need_finish) {
- exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
- REGION_UNINIT(pScreen, &migration);
- }
-
- return pixel;
}