summaryrefslogtreecommitdiff
path: root/drv/fb
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-03-07 14:49:18 +0000
committerDave Airlie <airlied@redhat.com>2012-03-07 14:49:18 +0000
commit1996a9ab247ceeb6e219559c7098e5ed7c1d9b6d (patch)
tree4fa9d6ceefe79f774ed070916773930ce5cc329e /drv/fb
parent28bd54572040fcc6587dd45e25b2e9f30b270d6c (diff)
fbgc: share
Diffstat (limited to 'drv/fb')
-rw-r--r--drv/fb/Makefile.am2
-rw-r--r--drv/fb/drvfb.h9
-rw-r--r--drv/fb/fb_sharelist.txt1
-rw-r--r--drv/fb/fbgc.c291
-rw-r--r--drv/fb/gen_fb_files7
5 files changed, 11 insertions, 299 deletions
diff --git a/drv/fb/Makefile.am b/drv/fb/Makefile.am
index dc4a3b45a..02fe54784 100644
--- a/drv/fb/Makefile.am
+++ b/drv/fb/Makefile.am
@@ -29,7 +29,7 @@ libdrvfb_la_SOURCES = \
drvfbfill.c \
drvfbfillrect.c \
drvfbfillsp.c \
- fbgc.c \
+ drvfbgc.c \
drvfbgetsp.c \
drvfbglyph.c \
drvfbimage.c \
diff --git a/drv/fb/drvfb.h b/drv/fb/drvfb.h
index 7cf822073..69059830a 100644
--- a/drv/fb/drvfb.h
+++ b/drv/fb/drvfb.h
@@ -39,8 +39,8 @@
#include "windowstr.h"
#include "privates.h"
#include "mi.h"
+#include "drvmigc.h"
#include "micmap.h"
-#include "migc.h"
#include "mibstore.h"
#include "picturestr.h"
@@ -589,9 +589,6 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
extern _X_EXPORT DevPrivateKey
drvfbGetGCPrivateKey (void);
-extern _X_EXPORT DevPrivateKey
-fbGetWinPrivateKey (void);
-
extern _X_EXPORT const DrvGCOps drvfbGCOps;
//extern _X_EXPORT const GCFuncs fbGCFuncs;
@@ -1585,13 +1582,13 @@ drvfbPushPixels (DrvGCPtr pGC,
extern _X_EXPORT Bool
drvfbCloseScreen (DrvScreenPtr pScreen);
-
+#if 0
extern _X_EXPORT Bool
fbRealizeFont(ScreenPtr pScreen, FontPtr pFont);
extern _X_EXPORT Bool
fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
-
+#endif
extern _X_EXPORT void
drvfbQueryBestSize (int class,
unsigned short *width, unsigned short *height,
diff --git a/drv/fb/fb_sharelist.txt b/drv/fb/fb_sharelist.txt
index 30e581391..8d493be23 100644
--- a/drv/fb/fb_sharelist.txt
+++ b/drv/fb/fb_sharelist.txt
@@ -24,3 +24,4 @@ fbstipple.c
fbtile.c
fbtrap.c
fbutil.c
+fbgc.c
diff --git a/drv/fb/fbgc.c b/drv/fb/fbgc.c
deleted file mode 100644
index 6471a8833..000000000
--- a/drv/fb/fbgc.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "drvfb.h"
-//#include "imped.h"
-
-
-const DrvGCFuncs drvfbGCFuncs = {
- drvfbValidateGC,
- drvmiChangeGC,
- drvmiCopyGC,
- drvmiDestroyGC,
- drvmiChangeClip,
- drvmiDestroyClip,
- drvmiCopyClip,
-};
-
-const DrvGCOps drvfbGCOps = {
- drvfbFillSpans,
- drvfbSetSpans,
- drvfbPutImage,
- drvfbCopyArea,
- NULL,
- drvfbPolyPoint,
- drvfbPolyLine,
- drvfbPolySegment,
- drvmiPolyRectangle,
- drvfbPolyArc,
- drvmiFillPolygon,
- drvfbPolyFillRect,
- drvmiPolyFillArc,
- drvmiPolyText8,
- drvmiPolyText16,
- drvmiImageText8,
- drvmiImageText16,
- drvfbImageGlyphBlt,
- drvfbPolyGlyphBlt,
- drvfbPushPixels,
-};
-
-Bool
-drvfbCreateGC(DrvGCPtr pGC)
-{
- pGC->ops = (DrvGCOps *) &drvfbGCOps;
- pGC->funcs = (DrvGCOps *) &drvfbGCFuncs;
- drvfbGetGCPrivate(pGC)->bpp = BitsPerPixel (pGC->depth);
- return TRUE;
-}
-
-/*
- * Pad pixmap to FB_UNIT bits wide
- */
-void
-drvfbPadPixmap (DrvPixmapPtr pPixmap)
-{
- int width;
- FbBits *bits;
- FbBits b;
- FbBits mask;
- int height;
- int w;
- int stride;
- int bpp;
- int xOff, yOff;
-
- drvfbGetDrawable (pPixmap, bits, stride, bpp, xOff, yOff);
-
- width = pPixmap->width * pPixmap->bitsPerPixel;
- height = pPixmap->height;
- mask = FbBitsMask (0, width);
- while (height--)
- {
- b = READ(bits) & mask;
- w = width;
- while (w < FB_UNIT)
- {
- b = b | FbScrRight(b, w);
- w <<= 1;
- }
- WRITE(bits, b);
- bits += stride;
- }
-
- drvfbFinishAccess (pPixmap);
-}
-
-/*
- * Verify that 'bits' repeats every 'len' bits
- */
-static Bool
-fbBitsRepeat (FbBits bits, int len, int width)
-{
- FbBits mask = FbBitsMask(0, len);
- FbBits orig = bits & mask;
- int i;
-
- if (width > FB_UNIT)
- width = FB_UNIT;
- for (i = 0; i < width / len; i++)
- {
- if ((bits & mask) != orig)
- return FALSE;
- bits = FbScrLeft(bits,len);
- }
- return TRUE;
-}
-
-/*
- * Check whether an entire bitmap line is a repetition of
- * the first 'len' bits
- */
-static Bool
-fbLineRepeat (FbBits *bits, int len, int width)
-{
- FbBits first = bits[0];
-
- if (!fbBitsRepeat (first, len, width))
- return FALSE;
- width = (width + FB_UNIT-1) >> FB_SHIFT;
- bits++;
- while (--width)
- if (READ(bits) != first)
- return FALSE;
- return TRUE;
-}
-
-/*
- * The even stipple code wants the first FB_UNIT/bpp bits on
- * each scanline to represent the entire stipple
- */
-static Bool
-fbCanEvenStipple (DrvPixmapPtr pStipple, int bpp)
-{
- int len = FB_UNIT / bpp;
- FbBits *bits;
- int stride;
- int stip_bpp;
- int stipXoff, stipYoff;
- int h;
-
- /* can't even stipple 24bpp drawables */
- if ((bpp & (bpp-1)) != 0)
- return FALSE;
- /* make sure the stipple width is a multiple of the even stipple width */
- if (pStipple->width % len != 0)
- return FALSE;
- drvfbGetDrawable (pStipple, bits, stride, stip_bpp, stipXoff, stipYoff);
- h = pStipple->height;
- /* check to see that the stipple repeats horizontally */
- while (h--)
- {
- if (!fbLineRepeat (bits, len, pStipple->width)) {
- drvfbFinishAccess (pStipple);
- return FALSE;
- }
- bits += stride;
- }
- drvfbFinishAccess (pStipple);
- return TRUE;
-}
-
-void
-drvfbValidateGC(DrvGCPtr pGC, unsigned long changes, DrvPixmapPtr pPixmap)
-{
- drvFbGCPrivPtr pPriv = drvfbGetGCPrivate(pGC);
- FbBits mask;
-
- if (pPriv->bpp != pPixmap->bitsPerPixel)
- {
- changes |= GCStipple|GCForeground|GCBackground|GCPlaneMask;
- pPriv->bpp = pPixmap->bitsPerPixel;
- }
- if ((changes & GCTile) && drvfbGetRotatedPixmap(pGC))
- {
- (*pGC->pDrvScreen->DestroyPixmap) (drvfbGetRotatedPixmap(pGC));
- drvfbGetRotatedPixmap(pGC) = 0;
- }
-
- if (pGC->fillStyle == FillTiled)
- {
- DrvPixmapPtr pOldTile, pNewTile;
-
- pOldTile = pGC->tile.pixmap;
- if (pOldTile->bitsPerPixel != pPixmap->bitsPerPixel)
- {
- pNewTile = drvfbGetRotatedPixmap(pGC);
- if (!pNewTile || pNewTile ->bitsPerPixel != pPixmap->bitsPerPixel)
- {
- if (pNewTile)
- (*pGC->pDrvScreen->DestroyPixmap) (pNewTile);
- pNewTile = drvfb24_32ReformatTile (pOldTile, pPixmap->bitsPerPixel);
- }
- if (pNewTile)
- {
- drvfbGetRotatedPixmap(pGC) = pOldTile;
- pGC->tile.pixmap = pNewTile;
- changes |= GCTile;
- }
- }
- }
- if (changes & GCTile)
- {
- if (!pGC->tileIsPixel &&
- FbEvenTile (pGC->tile.pixmap->width *
- pPixmap->bitsPerPixel))
- drvfbPadPixmap (pGC->tile.pixmap);
- }
- if (changes & GCStipple)
- {
- pPriv->evenStipple = FALSE;
-
- if (pGC->stipple) {
-
- /* can we do an even stipple ?? */
- if (FbEvenStip (pGC->stipple->width,
- pPixmap->bitsPerPixel) &&
- (fbCanEvenStipple (pGC->stipple, pPixmap->bitsPerPixel)))
- pPriv->evenStipple = TRUE;
-
- if (pGC->stipple->width * pPixmap->bitsPerPixel < FB_UNIT)
- drvfbPadPixmap (pGC->stipple);
- }
- }
- /*
- * Recompute reduced rop values
- */
- if (changes & (GCForeground|GCBackground|GCPlaneMask|GCFunction))
- {
- int s;
- FbBits depthMask;
-
- mask = FbFullMask(pPixmap->bitsPerPixel);
- depthMask = FbFullMask(pPixmap->depth);
-
- pPriv->fg = pGC->fgPixel & mask;
- pPriv->bg = pGC->bgPixel & mask;
-
- if ((pGC->planemask & depthMask) == depthMask)
- pPriv->pm = mask;
- else
- pPriv->pm = pGC->planemask & mask;
-
- s = pPixmap->bitsPerPixel;
- while (s < FB_UNIT)
- {
- pPriv->fg |= pPriv->fg << s;
- pPriv->bg |= pPriv->bg << s;
- pPriv->pm |= pPriv->pm << s;
- s <<= 1;
- }
- pPriv->and = fbAnd(pGC->alu, pPriv->fg, pPriv->pm);
- pPriv->xor = fbXor(pGC->alu, pPriv->fg, pPriv->pm);
- pPriv->bgand = fbAnd(pGC->alu, pPriv->bg, pPriv->pm);
- pPriv->bgxor = fbXor(pGC->alu, pPriv->bg, pPriv->pm);
- }
- if (changes & GCDashList)
- {
- unsigned short n = pGC->numInDashList;
- unsigned char *dash = pGC->dash;
- unsigned int dashLength = 0;
-
- while (n--)
- dashLength += (unsigned int ) *dash++;
- pPriv->dashLength = dashLength;
- }
-}
diff --git a/drv/fb/gen_fb_files b/drv/fb/gen_fb_files
index a51566814..5e52480d8 100644
--- a/drv/fb/gen_fb_files
+++ b/drv/fb/gen_fb_files
@@ -36,11 +36,16 @@ echo "s/fbGetStipDrawable/drvfbGetStipDrawable/g" >> mi.sed
echo "s/fbPrepareAccess/drvfbPrepareAccess/g" >> mi.sed
echo "s/fbFinishAccess/drvfbFinishAccess/g" >> mi.sed
echo "s/fbGetPixmapBitsData/drvfbGetPixmapBitsData/g" >> mi.sed
+echo "s/fbGetRotatedPixmap/drvfbGetRotatedPixmap/g" >> mi.sed
echo "s/->drawable\./->/g" >> mi.sed
echo "s/pDrawable->x/0/g" >> mi.sed
echo "s/pDrawable->y/0/g" >> mi.sed
echo "s/->pDrawable/->pPixmap/g" >> mi.sed
-
+echo "s/fbdrv/drvfb/g" >> mi.sed
+echo "s/fbDrv/drvfb/g" >> mi.sed
+echo "s/\&pPixmap->drawable/pPixmap/g" >> mi.sed
+echo "s/\&pStipple->drawable/pStipple/g" >> mi.sed
+echo "s/fbCopyArea/drvfbCopyArea/g" >> mi.sed
for i in `cat $1 | grep \.h$`
do
echo "s/"$i"/drv"$i"/g" >> mi.sed