Bug #5729: Convert xf8_16bpp to fb. chips(4) users please test.
This commit is contained in:
parent
4c7da86118
commit
83ea57bcc8
|
@ -1,3 +1,12 @@
|
||||||
|
2006-04-04 Adam Jackson <ajax@freedesktop.org>
|
||||||
|
|
||||||
|
* hw/xfree86/xf8_16bpp/Makefile.am:
|
||||||
|
* hw/xfree86/xf8_16bpp/cfb8_16.h:
|
||||||
|
* hw/xfree86/xf8_16bpp/cfb8_16module.c:
|
||||||
|
* hw/xfree86/xf8_16bpp/cfbscrinit.c:
|
||||||
|
* hw/xfree86/xf8_16bpp/cfbwindow.c:
|
||||||
|
Bug #5729: Convert xf8_16bpp to fb. chips(4) users please test.
|
||||||
|
|
||||||
2006-04-04 Adam Jackson <ajax@freedesktop.org>
|
2006-04-04 Adam Jackson <ajax@freedesktop.org>
|
||||||
|
|
||||||
* hw/darwin/darwin.c:
|
* hw/darwin/darwin.c:
|
||||||
|
|
|
@ -2,15 +2,10 @@ module_LTLIBRARIES = libxf8_16bpp.la
|
||||||
|
|
||||||
sdk_HEADERS = cfb8_16.h
|
sdk_HEADERS = cfb8_16.h
|
||||||
|
|
||||||
INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb
|
INCLUDES = $(XORG_INCS) -I$(top_srcdir)/fb
|
||||||
|
|
||||||
AM_CFLAGS = $(XORG_CFLAGS) @SERVER_DEFINES@ @MODULE_DEFINES@ @LOADER_DEFINES@
|
AM_CFLAGS = $(XORG_CFLAGS) @SERVER_DEFINES@ @MODULE_DEFINES@ @LOADER_DEFINES@
|
||||||
|
|
||||||
libxf8_16bpp_la_LDFLAGS = -avoid-version
|
libxf8_16bpp_la_LDFLAGS = -avoid-version
|
||||||
|
|
||||||
libxf8_16bpp_la_SOURCES = \
|
libxf8_16bpp_la_SOURCES = xf8_16module.c
|
||||||
cfb8_16module.c \
|
|
||||||
cfbscrinit.c \
|
|
||||||
cfbwindow.c
|
|
||||||
|
|
||||||
libxf8_16bpp_la_LIBADD = $(top_builddir)/cfb16/libcfb16.la
|
|
||||||
|
|
|
@ -1,4 +1,24 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfb8_16.h,v 1.1 1999/01/31 12:22:16 dawes Exp $ */
|
/*
|
||||||
|
* Copyright 2006 Adam Jackson.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||||
|
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||||
|
* the Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _CFB8_16_H
|
#ifndef _CFB8_16_H
|
||||||
#define _CFB8_16_H
|
#define _CFB8_16_H
|
||||||
|
@ -6,65 +26,11 @@
|
||||||
#include "regionstr.h"
|
#include "regionstr.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
|
|
||||||
typedef struct {
|
/* this has to stay misnamed for ABI reasons */
|
||||||
pointer pix8;
|
|
||||||
int width8;
|
|
||||||
pointer pix16;
|
|
||||||
int width16;
|
|
||||||
unsigned char key;
|
|
||||||
} cfb8_16ScreenRec, *cfb8_16ScreenPtr;
|
|
||||||
|
|
||||||
extern int cfb8_16ScreenPrivateIndex; /* XXX */
|
_X_EXPORT Bool
|
||||||
extern int cfb8_16GetScreenPrivateIndex(void);
|
cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
|
||||||
|
int xsize, int ysize, int dpix, int dpiy,
|
||||||
Bool
|
int width16, int width8);
|
||||||
cfb8_16ScreenInit (
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
pointer pbits16,
|
|
||||||
pointer pbits8,
|
|
||||||
int xsize, int ysize,
|
|
||||||
int dpix, int dpiy,
|
|
||||||
int width16,
|
|
||||||
int width8
|
|
||||||
);
|
|
||||||
|
|
||||||
void
|
|
||||||
cfb8_16PaintWindow (
|
|
||||||
WindowPtr pWin,
|
|
||||||
RegionPtr pRegion,
|
|
||||||
int what
|
|
||||||
);
|
|
||||||
|
|
||||||
Bool cfb8_16CreateWindow(WindowPtr pWin);
|
|
||||||
Bool cfb8_16DestroyWindow(WindowPtr pWin);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
cfb8_16PositionWindow(
|
|
||||||
WindowPtr pWin,
|
|
||||||
int x, int y
|
|
||||||
);
|
|
||||||
|
|
||||||
void
|
|
||||||
cfb8_16CopyWindow(
|
|
||||||
WindowPtr pWin,
|
|
||||||
DDXPointRec ptOldOrg,
|
|
||||||
RegionPtr prgnSrc
|
|
||||||
);
|
|
||||||
|
|
||||||
Bool
|
|
||||||
cfb8_16ChangeWindowAttributes(
|
|
||||||
WindowPtr pWin,
|
|
||||||
unsigned long mask
|
|
||||||
);
|
|
||||||
|
|
||||||
void
|
|
||||||
cfb8_16WindowExposures(
|
|
||||||
WindowPtr pWin,
|
|
||||||
RegionPtr pReg,
|
|
||||||
RegionPtr pOtherReg
|
|
||||||
);
|
|
||||||
|
|
||||||
#define CFB8_16_GET_SCREEN_PRIVATE(pScreen)\
|
|
||||||
(cfb8_16ScreenPtr)((pScreen)->devPrivates[cfb8_16GetScreenPrivateIndex()].ptr)
|
|
||||||
|
|
||||||
#endif /* _CFB8_16_H */
|
#endif /* _CFB8_16_H */
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
/* $XFree86$ */
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XFree86LOADER
|
|
||||||
|
|
||||||
#include "xf86Module.h"
|
|
||||||
|
|
||||||
static MODULESETUPPROTO(xf8_16bppSetup);
|
|
||||||
|
|
||||||
static XF86ModuleVersionInfo VersRec =
|
|
||||||
{
|
|
||||||
"xf8_16bpp",
|
|
||||||
MODULEVENDORSTRING,
|
|
||||||
MODINFOSTRING1,
|
|
||||||
MODINFOSTRING2,
|
|
||||||
XORG_VERSION_CURRENT,
|
|
||||||
1, 0, 0,
|
|
||||||
ABI_CLASS_ANSIC, /* Only need the ansic layer */
|
|
||||||
ABI_ANSIC_VERSION,
|
|
||||||
NULL,
|
|
||||||
{0,0,0,0} /* signature, to be patched into the file by a tool */
|
|
||||||
};
|
|
||||||
|
|
||||||
XF86ModuleData xf8_16bppModuleData = { &VersRec, xf8_16bppSetup, NULL };
|
|
||||||
|
|
||||||
static pointer
|
|
||||||
xf8_16bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
|
||||||
{
|
|
||||||
if (!LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
|
|
||||||
errmaj, errmin))
|
|
||||||
return NULL;
|
|
||||||
if (!LoadSubModule(module, "cfb16", NULL, NULL, NULL, NULL,
|
|
||||||
errmaj, errmin))
|
|
||||||
return NULL;
|
|
||||||
return (pointer)1; /* non-NULL required to indicate success */
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,376 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (C) 1999. The XFree86 Project Inc.
|
|
||||||
|
|
||||||
Written by Mark Vojkovich (mvojkovi@ucsd.edu)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbscrinit.c,v 1.7 2000/01/21 01:12:24 dawes Exp $ */
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "servermd.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "resource.h"
|
|
||||||
#include "colormap.h"
|
|
||||||
#include "colormapst.h"
|
|
||||||
#define PSZ 8
|
|
||||||
#include "cfb.h"
|
|
||||||
#undef PSZ
|
|
||||||
#include "cfb16.h"
|
|
||||||
#include "cfb8_16.h"
|
|
||||||
#include "mi.h"
|
|
||||||
#include "micmap.h"
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "dix.h"
|
|
||||||
#include "mibstore.h"
|
|
||||||
#include "xf86str.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
|
|
||||||
/* CAUTION: We require that cfb8 and cfb16 were NOT
|
|
||||||
compiled with CFB_NEED_SCREEN_PRIVATE */
|
|
||||||
|
|
||||||
int cfb8_16ScreenPrivateIndex;
|
|
||||||
|
|
||||||
int cfb8_16GetScreenPrivateIndex(void) { return cfb8_16ScreenPrivateIndex; }
|
|
||||||
|
|
||||||
static unsigned long cfb8_16Generation = 0;
|
|
||||||
|
|
||||||
static PixmapPtr cfb8_16GetWindowPixmap(WindowPtr pWin);
|
|
||||||
static void
|
|
||||||
cfb8_16SaveAreas(
|
|
||||||
PixmapPtr pPixmap,
|
|
||||||
RegionPtr prgnSave,
|
|
||||||
int xorg,
|
|
||||||
int yorg,
|
|
||||||
WindowPtr pWin
|
|
||||||
);
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16RestoreAreas(
|
|
||||||
PixmapPtr pPixmap,
|
|
||||||
RegionPtr prgnRestore,
|
|
||||||
int xorg,
|
|
||||||
int yorg,
|
|
||||||
WindowPtr pWin
|
|
||||||
);
|
|
||||||
|
|
||||||
static BSFuncRec cfb8_16BSFuncRec = {
|
|
||||||
cfb8_16SaveAreas,
|
|
||||||
cfb8_16RestoreAreas,
|
|
||||||
(BackingStoreSetClipmaskRgnProcPtr) 0,
|
|
||||||
(BackingStoreGetImagePixmapProcPtr) 0,
|
|
||||||
(BackingStoreGetSpansPixmapProcPtr) 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16GetSpans(
|
|
||||||
DrawablePtr pDraw,
|
|
||||||
int wMax,
|
|
||||||
DDXPointPtr ppt,
|
|
||||||
int *pwidth,
|
|
||||||
int nspans,
|
|
||||||
char *pchardstStart
|
|
||||||
);
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16GetImage (
|
|
||||||
DrawablePtr pDraw,
|
|
||||||
int sx, int sy, int w, int h,
|
|
||||||
unsigned int format,
|
|
||||||
unsigned long planeMask,
|
|
||||||
char *pdstLine
|
|
||||||
);
|
|
||||||
|
|
||||||
static Bool cfb8_16CreateGC(GCPtr pGC);
|
|
||||||
static void cfb8_16EnableDisableFBAccess(int index, Bool enable);
|
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
cfb8_16AllocatePrivates(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
cfb8_16ScreenPtr pScreenPriv;
|
|
||||||
|
|
||||||
if(cfb8_16Generation != serverGeneration) {
|
|
||||||
if((cfb8_16ScreenPrivateIndex = AllocateScreenPrivateIndex()) < 0)
|
|
||||||
return FALSE;
|
|
||||||
cfb8_16Generation = serverGeneration;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(pScreenPriv = xalloc(sizeof(cfb8_16ScreenRec))))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pScreen->devPrivates[cfb8_16ScreenPrivateIndex].ptr = (pointer)pScreenPriv;
|
|
||||||
|
|
||||||
|
|
||||||
/* All cfb will have the same GC and Window private indicies */
|
|
||||||
if(!mfbAllocatePrivates(pScreen,&cfbWindowPrivateIndex, &cfbGCPrivateIndex))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* The cfb indicies are the mfb indicies. Reallocating them resizes them */
|
|
||||||
if(!AllocateWindowPrivate(pScreen,cfbWindowPrivateIndex,sizeof(cfbPrivWin)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if(!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
cfb8_16SetupScreen(
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
int xsize, int ysize, /* in pixels */
|
|
||||||
int dpix, int dpiy
|
|
||||||
){
|
|
||||||
if (!cfb8_16AllocatePrivates(pScreen))
|
|
||||||
return FALSE;
|
|
||||||
pScreen->defColormap = FakeClientID(0);
|
|
||||||
/* let CreateDefColormap do whatever it wants for pixels */
|
|
||||||
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
|
|
||||||
pScreen->QueryBestSize = mfbQueryBestSize;
|
|
||||||
/* SaveScreen */
|
|
||||||
pScreen->GetImage = cfb8_16GetImage;
|
|
||||||
pScreen->GetSpans = cfb8_16GetSpans;
|
|
||||||
pScreen->CreateWindow = cfb8_16CreateWindow;
|
|
||||||
pScreen->DestroyWindow = cfb8_16DestroyWindow;
|
|
||||||
pScreen->PositionWindow = cfb8_16PositionWindow;
|
|
||||||
pScreen->ChangeWindowAttributes = cfb8_16ChangeWindowAttributes;
|
|
||||||
pScreen->RealizeWindow = cfb16MapWindow; /* OK */
|
|
||||||
pScreen->UnrealizeWindow = cfb16UnmapWindow; /* OK */
|
|
||||||
pScreen->PaintWindowBackground = cfb8_16PaintWindow;
|
|
||||||
pScreen->PaintWindowBorder = cfb8_16PaintWindow;
|
|
||||||
pScreen->CopyWindow = cfb8_16CopyWindow;
|
|
||||||
pScreen->CreatePixmap = cfb16CreatePixmap; /* OK */
|
|
||||||
pScreen->DestroyPixmap = cfb16DestroyPixmap; /* OK */
|
|
||||||
pScreen->RealizeFont = mfbRealizeFont;
|
|
||||||
pScreen->UnrealizeFont = mfbUnrealizeFont;
|
|
||||||
pScreen->CreateGC = cfb8_16CreateGC;
|
|
||||||
pScreen->CreateColormap = miInitializeColormap;
|
|
||||||
pScreen->DestroyColormap = (DestroyColormapProcPtr)NoopDDA;
|
|
||||||
pScreen->InstallColormap = miInstallColormap;
|
|
||||||
pScreen->UninstallColormap = miUninstallColormap;
|
|
||||||
pScreen->ListInstalledColormaps = miListInstalledColormaps;
|
|
||||||
pScreen->StoreColors = (StoreColorsProcPtr)NoopDDA;
|
|
||||||
pScreen->ResolveColor = miResolveColor;
|
|
||||||
pScreen->BitmapToRegion = mfbPixmapToRegion;
|
|
||||||
|
|
||||||
mfbRegisterCopyPlaneProc (pScreen, cfbCopyPlane);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
cfb8_16CreateScreenResources(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
|
||||||
cfb8_16ScreenPtr pScreenPriv = CFB8_16_GET_SCREEN_PRIVATE(pScreen);
|
|
||||||
PixmapPtr pix8, pix16;
|
|
||||||
|
|
||||||
xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
|
|
||||||
|
|
||||||
pix8 = (*pScreen->CreatePixmap)(pScreen, 0, 0, 8);
|
|
||||||
pix16 = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScrn->depth);
|
|
||||||
if(!pix16 || !pix8)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pix8->drawable.width = pScreen->width;
|
|
||||||
pix8->drawable.height = pScreen->height;
|
|
||||||
pix8->devKind = pScreenPriv->width8;
|
|
||||||
pix8->devPrivate.ptr = pScreenPriv->pix8;
|
|
||||||
|
|
||||||
pix16->drawable.width = pScreen->width;
|
|
||||||
pix16->drawable.height = pScreen->height;
|
|
||||||
pix16->devKind = pScreenPriv->width16 * 2;
|
|
||||||
pix16->devPrivate.ptr = pScreenPriv->pix16;
|
|
||||||
|
|
||||||
pScreenPriv->pix8 = (pointer)pix8;
|
|
||||||
pScreenPriv->pix16 = (pointer)pix16;
|
|
||||||
|
|
||||||
pScreen->devPrivate = (pointer)pix16;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
cfb8_16CloseScreen (int i, ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
cfb8_16ScreenPtr pScreenPriv = CFB8_16_GET_SCREEN_PRIVATE(pScreen);
|
|
||||||
|
|
||||||
xfree((pointer) pScreenPriv);
|
|
||||||
|
|
||||||
return(cfb16CloseScreen(i, pScreen));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
cfb8_16FinishScreenInit(
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
int xsize, int ysize, /* in pixels */
|
|
||||||
int dpix, int dpiy /* dots per inch */
|
|
||||||
){
|
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
|
||||||
VisualPtr visuals;
|
|
||||||
DepthPtr depths;
|
|
||||||
int nvisuals;
|
|
||||||
int ndepths;
|
|
||||||
int rootdepth;
|
|
||||||
VisualID defaultVisual;
|
|
||||||
|
|
||||||
rootdepth = 0;
|
|
||||||
if (!miInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
|
|
||||||
&defaultVisual,((unsigned long)1<<(16-1)), 8, -1))
|
|
||||||
return FALSE;
|
|
||||||
if (! miScreenInit(pScreen, NULL, xsize, ysize, dpix, dpiy, 0,
|
|
||||||
rootdepth, ndepths, depths,
|
|
||||||
defaultVisual, nvisuals, visuals))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pScreen->BackingStoreFuncs = cfb8_16BSFuncRec;
|
|
||||||
pScreen->CreateScreenResources = cfb8_16CreateScreenResources;
|
|
||||||
pScreen->CloseScreen = cfb8_16CloseScreen;
|
|
||||||
pScreen->GetWindowPixmap = cfb8_16GetWindowPixmap;
|
|
||||||
pScreen->WindowExposures = cfb8_16WindowExposures;
|
|
||||||
|
|
||||||
pScrn->EnableDisableFBAccess = cfb8_16EnableDisableFBAccess;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
cfb8_16ScreenInit(
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
pointer pbits16, /* pointer to screen bitmap */
|
|
||||||
pointer pbits8,
|
|
||||||
int xsize, int ysize, /* in pixels */
|
|
||||||
int dpix, int dpiy, /* dots per inch */
|
|
||||||
int width16, /* pixel width of frame buffer */
|
|
||||||
int width8
|
|
||||||
){
|
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
|
||||||
cfb8_16ScreenPtr pScreenPriv;
|
|
||||||
|
|
||||||
if (!cfb8_16SetupScreen(pScreen, xsize, ysize, dpix, dpiy))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pScreenPriv = CFB8_16_GET_SCREEN_PRIVATE(pScreen);
|
|
||||||
pScreenPriv->pix8 = pbits8;
|
|
||||||
pScreenPriv->pix16 = pbits16;
|
|
||||||
pScreenPriv->width8 = width8;
|
|
||||||
pScreenPriv->width16 = width16;
|
|
||||||
pScreenPriv->key = pScrn->colorKey;
|
|
||||||
|
|
||||||
return cfb8_16FinishScreenInit(pScreen, xsize, ysize, dpix, dpiy);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static PixmapPtr
|
|
||||||
cfb8_16GetWindowPixmap(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
cfb8_16ScreenPtr pScreenPriv =
|
|
||||||
CFB8_16_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
|
|
||||||
|
|
||||||
return((pWin->drawable.bitsPerPixel == 16) ?
|
|
||||||
(PixmapPtr)pScreenPriv->pix16 : (PixmapPtr)pScreenPriv->pix8);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16GetImage (
|
|
||||||
DrawablePtr pDraw,
|
|
||||||
int sx, int sy, int w, int h,
|
|
||||||
unsigned int format,
|
|
||||||
unsigned long planemask,
|
|
||||||
char *pdstLine
|
|
||||||
){
|
|
||||||
if(!w || !h) return;
|
|
||||||
|
|
||||||
if(pDraw->bitsPerPixel == 16)
|
|
||||||
cfb16GetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
|
|
||||||
else
|
|
||||||
cfbGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16GetSpans(
|
|
||||||
DrawablePtr pDraw,
|
|
||||||
int wMax,
|
|
||||||
DDXPointPtr ppt,
|
|
||||||
int *pwidth,
|
|
||||||
int nspans,
|
|
||||||
char *pDst
|
|
||||||
){
|
|
||||||
if(pDraw->bitsPerPixel == 16)
|
|
||||||
cfb16GetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
|
|
||||||
else
|
|
||||||
cfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16SaveAreas(
|
|
||||||
PixmapPtr pPixmap,
|
|
||||||
RegionPtr prgnSave,
|
|
||||||
int xorg,
|
|
||||||
int yorg,
|
|
||||||
WindowPtr pWin
|
|
||||||
){
|
|
||||||
if(pWin->drawable.bitsPerPixel == 16)
|
|
||||||
cfb16SaveAreas(pPixmap, prgnSave, xorg, yorg, pWin);
|
|
||||||
else
|
|
||||||
cfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16RestoreAreas(
|
|
||||||
PixmapPtr pPixmap,
|
|
||||||
RegionPtr prgnRestore,
|
|
||||||
int xorg,
|
|
||||||
int yorg,
|
|
||||||
WindowPtr pWin
|
|
||||||
){
|
|
||||||
if(pWin->drawable.bitsPerPixel == 16)
|
|
||||||
cfb16RestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin);
|
|
||||||
else
|
|
||||||
cfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
cfb8_16CreateGC(GCPtr pGC)
|
|
||||||
{
|
|
||||||
if(pGC->depth == 8)
|
|
||||||
return(cfbCreateGC(pGC));
|
|
||||||
else
|
|
||||||
return(cfb16CreateGC(pGC));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cfb8_16EnableDisableFBAccess(int index, Bool enable)
|
|
||||||
{
|
|
||||||
ScreenPtr pScreen = xf86Screens[index]->pScreen;
|
|
||||||
cfb8_16ScreenPtr pScreenPriv = CFB8_16_GET_SCREEN_PRIVATE(pScreen);
|
|
||||||
static DevUnion devPrivates8[MAXSCREENS];
|
|
||||||
static DevUnion devPrivates16[MAXSCREENS];
|
|
||||||
PixmapPtr pix8, pix16;
|
|
||||||
|
|
||||||
pix8 = (PixmapPtr) pScreenPriv->pix8;
|
|
||||||
pix16 = (PixmapPtr) pScreenPriv->pix16;
|
|
||||||
|
|
||||||
if (enable)
|
|
||||||
{
|
|
||||||
pix8->devPrivate = devPrivates8[index];
|
|
||||||
pix16->devPrivate = devPrivates16[index];
|
|
||||||
}
|
|
||||||
xf86EnableDisableFBAccess (index, enable);
|
|
||||||
if (!enable)
|
|
||||||
{
|
|
||||||
devPrivates8[index] = pix8->devPrivate;
|
|
||||||
pix8->devPrivate.ptr = 0;
|
|
||||||
devPrivates16[index] = pix16->devPrivate;
|
|
||||||
pix16->devPrivate.ptr = 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,181 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (C) 1999. The XFree86 Project Inc.
|
|
||||||
|
|
||||||
Written by Mark Vojkovich (mvojkovi@ucsd.edu)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c,v 1.4tsi Exp $ */
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#define PSZ 8
|
|
||||||
#include "cfb.h"
|
|
||||||
#undef PSZ
|
|
||||||
#include "cfb16.h"
|
|
||||||
#include "cfb8_16.h"
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "cfbmskbits.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
|
|
||||||
/* We don't bother with cfb's fastBackground/Border so we don't
|
|
||||||
need to use the Window privates */
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
|
||||||
cfb8_16CreateWindow(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
cfbPrivWin *pPrivWin = cfbGetWindowPrivate(pWin);
|
|
||||||
|
|
||||||
pPrivWin->pRotatedBorder = NullPixmap;
|
|
||||||
pPrivWin->pRotatedBackground = NullPixmap;
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
pPrivWin->oldRotate.x = 0;
|
|
||||||
pPrivWin->oldRotate.y = 0;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
|
||||||
cfb8_16DestroyWindow(WindowPtr pWin)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
cfb8_16PositionWindow(
|
|
||||||
WindowPtr pWin,
|
|
||||||
int x, int y
|
|
||||||
){
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
cfb8_16CopyWindow(
|
|
||||||
WindowPtr pWin,
|
|
||||||
DDXPointRec ptOldOrg,
|
|
||||||
RegionPtr prgnSrc
|
|
||||||
){
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
cfb8_16ScreenPtr pScreenPriv =
|
|
||||||
CFB8_16_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
|
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
|
||||||
DDXPointPtr ppt, pptSrc;
|
|
||||||
RegionRec rgnDst;
|
|
||||||
BoxPtr pbox;
|
|
||||||
int i, nbox, dx, dy;
|
|
||||||
WindowPtr pRoot = WindowTable[pScreen->myNum];
|
|
||||||
|
|
||||||
REGION_NULL(pScreen, &rgnDst);
|
|
||||||
|
|
||||||
dx = ptOldOrg.x - pWin->drawable.x;
|
|
||||||
dy = ptOldOrg.y - pWin->drawable.y;
|
|
||||||
REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
|
|
||||||
REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
|
|
||||||
|
|
||||||
nbox = REGION_NUM_RECTS(&rgnDst);
|
|
||||||
if(nbox &&
|
|
||||||
(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
|
|
||||||
|
|
||||||
pbox = REGION_RECTS(&rgnDst);
|
|
||||||
for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
|
|
||||||
ppt->x = pbox->x1 + dx;
|
|
||||||
ppt->y = pbox->y1 + dy;
|
|
||||||
}
|
|
||||||
cfbDoBitbltCopy((DrawablePtr)pRoot, (DrawablePtr)pRoot,
|
|
||||||
GXcopy, &rgnDst, pptSrc, ~0L);
|
|
||||||
if(pWin->drawable.bitsPerPixel == 16)
|
|
||||||
cfb16DoBitbltCopy((DrawablePtr)pScreenPriv->pix16,
|
|
||||||
(DrawablePtr)pScreenPriv->pix16,
|
|
||||||
GXcopy, &rgnDst, pptSrc, ~0L);
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(pptSrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
REGION_UNINIT(pScreen, &rgnDst);
|
|
||||||
|
|
||||||
if(pWin->drawable.depth == 8) {
|
|
||||||
REGION_NULL(pScreen, &rgnDst);
|
|
||||||
miSegregateChildren(pWin, &rgnDst, pScrn->depth);
|
|
||||||
if(REGION_NOTEMPTY(pScreen, &rgnDst)) {
|
|
||||||
REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
|
|
||||||
nbox = REGION_NUM_RECTS(&rgnDst);
|
|
||||||
if(nbox &&
|
|
||||||
(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))){
|
|
||||||
|
|
||||||
pbox = REGION_RECTS(&rgnDst);
|
|
||||||
for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
|
|
||||||
ppt->x = pbox->x1 + dx;
|
|
||||||
ppt->y = pbox->y1 + dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfb16DoBitbltCopy((DrawablePtr)pScreenPriv->pix16,
|
|
||||||
(DrawablePtr)pScreenPriv->pix16,
|
|
||||||
GXcopy, &rgnDst, pptSrc, ~0L);
|
|
||||||
DEALLOCATE_LOCAL(pptSrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
REGION_UNINIT(pScreen, &rgnDst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
cfb8_16ChangeWindowAttributes(
|
|
||||||
WindowPtr pWin,
|
|
||||||
unsigned long mask
|
|
||||||
){
|
|
||||||
if (pWin->drawable.bitsPerPixel == 16)
|
|
||||||
return cfb16ChangeWindowAttributes(pWin,mask);
|
|
||||||
else
|
|
||||||
return cfbChangeWindowAttributes(pWin,mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
cfb8_16WindowExposures(
|
|
||||||
WindowPtr pWin,
|
|
||||||
RegionPtr pReg,
|
|
||||||
RegionPtr pOtherReg
|
|
||||||
){
|
|
||||||
|
|
||||||
if(REGION_NUM_RECTS(pReg) && (pWin->drawable.bitsPerPixel == 16)) {
|
|
||||||
cfb8_16ScreenPtr pScreenPriv =
|
|
||||||
CFB8_16_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
|
|
||||||
|
|
||||||
cfbFillBoxSolid((DrawablePtr)pScreenPriv->pix8,
|
|
||||||
REGION_NUM_RECTS(pReg), REGION_RECTS(pReg),
|
|
||||||
pScreenPriv->key);
|
|
||||||
}
|
|
||||||
|
|
||||||
miWindowExposures(pWin, pReg, pOtherReg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
cfb8_16PaintWindow (
|
|
||||||
WindowPtr pWin,
|
|
||||||
RegionPtr pRegion,
|
|
||||||
int what
|
|
||||||
){
|
|
||||||
if(pWin->drawable.bitsPerPixel == 16) {
|
|
||||||
cfb16PaintWindow(pWin, pRegion, what);
|
|
||||||
if(what == PW_BORDER) {
|
|
||||||
cfb8_16ScreenPtr pScreenPriv =
|
|
||||||
CFB8_16_GET_SCREEN_PRIVATE(pWin->drawable.pScreen);
|
|
||||||
|
|
||||||
cfbFillBoxSolid((DrawablePtr)pScreenPriv->pix8,
|
|
||||||
REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion),
|
|
||||||
pScreenPriv->key);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
cfbPaintWindow(pWin, pRegion, what);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue