summaryrefslogtreecommitdiff
path: root/xserver/fb/fbpixmap.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
commitdbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch)
treef8963ef73903a7b4374adc2354dffbaa905112ac /xserver/fb/fbpixmap.c
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/fb/fbpixmap.c')
-rw-r--r--xserver/fb/fbpixmap.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/xserver/fb/fbpixmap.c b/xserver/fb/fbpixmap.c
index f79f7010d..311da9e62 100644
--- a/xserver/fb/fbpixmap.c
+++ b/xserver/fb/fbpixmap.c
@@ -1,6 +1,4 @@
/*
- * Id: fbpixmap.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
- *
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -31,7 +29,8 @@
#include "fb.h"
PixmapPtr
-fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp)
+fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
+ unsigned usage_hint)
{
PixmapPtr pPixmap;
size_t datasize;
@@ -43,11 +42,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp)
if (paddedWidth / 4 > 32767 || height > 32767)
return NullPixmap;
datasize = height * paddedWidth;
-#ifdef PIXPRIV
base = pScreen->totalPixmapSize;
-#else
- base = sizeof (PixmapRec);
-#endif
adjust = 0;
if (base & 7)
adjust = 8 - (base & 7);
@@ -82,11 +77,14 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp)
pPixmap->screen_y = 0;
#endif
+ pPixmap->usage_hint = usage_hint;
+
return pPixmap;
}
PixmapPtr
-fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth)
+fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
{
int bpp;
bpp = BitsPerPixel (depth);
@@ -94,7 +92,7 @@ fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth)
if (bpp == 32 && depth <= 24)
bpp = fbGetScreenPrivate(pScreen)->pix32bpp;
#endif
- return fbCreatePixmapBpp (pScreen, width, height, depth, bpp);
+ return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint);
}
Bool
@@ -102,6 +100,7 @@ fbDestroyPixmap (PixmapPtr pPixmap)
{
if(--pPixmap->refcnt)
return TRUE;
+ dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
return TRUE;
}
@@ -160,6 +159,8 @@ fbPixmapToRegion(PixmapPtr pPix)
FirstRect = REGION_BOXPTR(pReg);
rects = FirstRect;
+ fbPrepareAccess(&pPix->drawable);
+
pwLine = (FbBits *) pPix->devPrivate.ptr;
nWidth = pPix->devKind >> (FB_SHIFT-3);
@@ -174,7 +175,7 @@ fbPixmapToRegion(PixmapPtr pPix)
irectLineStart = rects - FirstRect;
/* If the Screen left most bit of the word is set, we're starting in
* a box */
- if(*pw & mask0)
+ if(READ(pw) & mask0)
{
fInBox = TRUE;
rx1 = 0;
@@ -185,7 +186,7 @@ fbPixmapToRegion(PixmapPtr pPix)
pwLineEnd = pw + (width >> FB_SHIFT);
for (base = 0; pw < pwLineEnd; base += FB_UNIT)
{
- w = *pw++;
+ w = READ(pw++);
if (fInBox)
{
if (!~w)
@@ -226,7 +227,7 @@ fbPixmapToRegion(PixmapPtr pPix)
if(width & FB_MASK)
{
/* Process final partial word on line */
- w = *pw++;
+ w = READ(pw++);
for(ib = 0; ib < (width & FB_MASK); ib++)
{
/* If the Screen left most bit of the word is set, we're
@@ -311,6 +312,8 @@ fbPixmapToRegion(PixmapPtr pPix)
pReg->data = (RegDataPtr)NULL;
}
}
+
+ fbFinishAccess(&pPix->drawable);
#ifdef DEBUG
if (!miValidRegion(pReg))
FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
@@ -362,6 +365,7 @@ fbValidateDrawable (DrawablePtr pDrawable)
if (!fbValidateBits (first, stride, FB_HEAD_BITS) ||
!fbValidateBits (last, stride, FB_TAIL_BITS))
fbInitializeDrawable(pDrawable);
+ fbFinishAccess (pDrawable);
}
void
@@ -383,5 +387,6 @@ fbInitializeDrawable (DrawablePtr pDrawable)
last = bits + stride * pDrawable->height;
fbSetBits (first, stride, FB_HEAD_BITS);
fbSetBits (last, stride, FB_TAIL_BITS);
+ fbFinishAccess (pDrawable);
}
#endif /* FB_DEBUG */