diff options
author | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
commit | 3562e78743202e43aec8727005182a2558117eca (patch) | |
tree | 8f9113a77d12470c5c851a2a8e4cb02e89df7d43 /xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c | |
download | vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.gz vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.bz2 vcxsrv-3562e78743202e43aec8727005182a2558117eca.zip |
Checked in the following released items:
xkeyboard-config-1.4.tar.gz
ttf-bitstream-vera-1.10.tar.gz
font-alias-1.0.1.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sony-misc-1.0.0.tar.gz
font-schumacher-misc-1.0.0.tar.gz
font-mutt-misc-1.0.0.tar.gz
font-misc-misc-1.0.0.tar.gz
font-misc-meltho-1.0.0.tar.gz
font-micro-misc-1.0.0.tar.gz
font-jis-misc-1.0.0.tar.gz
font-isas-misc-1.0.0.tar.gz
font-dec-misc-1.0.0.tar.gz
font-daewoo-misc-1.0.0.tar.gz
font-cursor-misc-1.0.0.tar.gz
font-arabic-misc-1.0.0.tar.gz
font-winitzki-cyrillic-1.0.0.tar.gz
font-misc-cyrillic-1.0.0.tar.gz
font-cronyx-cyrillic-1.0.0.tar.gz
font-screen-cyrillic-1.0.1.tar.gz
font-xfree86-type1-1.0.1.tar.gz
font-adobe-utopia-type1-1.0.1.tar.gz
font-ibm-type1-1.0.0.tar.gz
font-bitstream-type1-1.0.0.tar.gz
font-bitstream-speedo-1.0.0.tar.gz
font-bh-ttf-1.0.0.tar.gz
font-bh-type1-1.0.0.tar.gz
font-bitstream-100dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-100dpi-1.0.0.tar.gz
font-bh-100dpi-1.0.0.tar.gz
font-adobe-utopia-100dpi-1.0.1.tar.gz
font-adobe-100dpi-1.0.0.tar.gz
font-util-1.0.1.tar.gz
font-bitstream-75dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-75dpi-1.0.0.tar.gz
font-adobe-utopia-75dpi-1.0.1.tar.gz
font-bh-75dpi-1.0.0.tar.gz
bdftopcf-1.0.1.tar.gz
font-adobe-75dpi-1.0.0.tar.gz
mkfontscale-1.0.6.tar.gz
openssl-0.9.8k.tar.gz
bigreqsproto-1.0.2.tar.gz
xtrans-1.2.2.tar.gz
resourceproto-1.0.2.tar.gz
inputproto-1.4.4.tar.gz
compositeproto-0.4.tar.gz
damageproto-1.1.0.tar.gz
zlib-1.2.3.tar.gz
xkbcomp-1.0.5.tar.gz
freetype-2.3.9.tar.gz
pthreads-w32-2-8-0-release.tar.gz
pixman-0.12.0.tar.gz
kbproto-1.0.3.tar.gz
evieext-1.0.2.tar.gz
fixesproto-4.0.tar.gz
recordproto-1.13.2.tar.gz
randrproto-1.2.2.tar.gz
scrnsaverproto-1.1.0.tar.gz
renderproto-0.9.3.tar.gz
xcmiscproto-1.1.2.tar.gz
fontsproto-2.0.2.tar.gz
xextproto-7.0.3.tar.gz
xproto-7.0.14.tar.gz
libXdmcp-1.0.2.tar.gz
libxkbfile-1.0.5.tar.gz
libfontenc-1.0.4.tar.gz
libXfont-1.3.4.tar.gz
libX11-1.1.5.tar.gz
libXau-1.0.4.tar.gz
libxcb-1.1.tar.gz
xorg-server-1.5.3.tar.gz
Diffstat (limited to 'xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c')
-rw-r--r-- | xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c | 311 |
1 files changed, 311 insertions, 0 deletions
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c new file mode 100644 index 000000000..c3432b803 --- /dev/null +++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c @@ -0,0 +1,311 @@ + + +#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 "cfb32.h" +#include "cfb8_32.h" +#include "mi.h" +#include "micmap.h" +#include "mistruct.h" +#include "dix.h" +#include "mibstore.h" +#include "mioverlay.h" +#include "xf86.h" +#include "xf86str.h" +#include "globals.h" + +/* CAUTION: We require that cfb8 and cfb32 were NOT + compiled with CFB_NEED_SCREEN_PRIVATE */ + +static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey; +DevPrivateKey cfb8_32GetGCPrivateKey(void) +{ + return cfb8_32GCPrivateKey; +} + +static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey; +DevPrivateKey cfb8_32GetScreenPrivateKey(void) +{ + return cfb8_32ScreenPrivateKey; +} + +static Bool +cfb8_32AllocatePrivates(ScreenPtr pScreen) +{ + cfb8_32ScreenPtr pScreenPriv; + + if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec)))) + return FALSE; + + dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv); + + + /* All cfb will have the same GC and Window private indicies */ + if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey)) + return FALSE; + + if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC))) + return FALSE; + + if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec))) + return FALSE; + + return TRUE; +} + +static void DestroyColormapNoop( + ColormapPtr pColormap) +{ + /* NOOP */ +} + +static void StoreColorsNoop( + ColormapPtr pColormap, + int ndef, + xColorItem * pdef) +{ + /* NOOP */ +} + +static Bool +cfb8_32SetupScreen( + ScreenPtr pScreen, + pointer pbits, /* pointer to screen bitmap */ + int xsize, int ysize, /* in pixels */ + int dpix, int dpiy, /* dots per inch */ + int width /* pixel width of frame buffer */ +){ + if (!cfb8_32AllocatePrivates(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_32GetImage; + pScreen->GetSpans = cfb8_32GetSpans; + pScreen->CreateWindow = cfb8_32CreateWindow; + pScreen->DestroyWindow = cfb8_32DestroyWindow; + pScreen->PositionWindow = cfb8_32PositionWindow; + pScreen->ChangeWindowAttributes = cfb8_32ChangeWindowAttributes; + pScreen->RealizeWindow = cfb32MapWindow; /* OK */ + pScreen->UnrealizeWindow = cfb32UnmapWindow; /* OK */ + pScreen->CopyWindow = cfb8_32CopyWindow; + pScreen->CreatePixmap = cfb32CreatePixmap; /* OK */ + pScreen->DestroyPixmap = cfb32DestroyPixmap; /* OK */ + pScreen->RealizeFont = mfbRealizeFont; + pScreen->UnrealizeFont = mfbUnrealizeFont; + pScreen->CreateGC = cfb8_32CreateGC; + pScreen->CreateColormap = miInitializeColormap; + pScreen->DestroyColormap = DestroyColormapNoop; + pScreen->InstallColormap = miInstallColormap; + pScreen->UninstallColormap = miUninstallColormap; + pScreen->ListInstalledColormaps = miListInstalledColormaps; + pScreen->StoreColors = StoreColorsNoop; + pScreen->ResolveColor = miResolveColor; + pScreen->BitmapToRegion = mfbPixmapToRegion; + + mfbRegisterCopyPlaneProc (pScreen, cfb8_32CopyPlane); + return TRUE; +} + +typedef struct { + pointer pbits; + int width; +} miScreenInitParmsRec, *miScreenInitParmsPtr; + +static Bool +cfb8_32CreateScreenResources(ScreenPtr pScreen) +{ + miScreenInitParmsPtr pScrInitParms; + int pitch; + Bool retval; + + /* get the pitch before mi destroys it */ + pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate; + pitch = pScrInitParms->width << 2; + + if((retval = miCreateScreenResources(pScreen))) { + /* fix the screen pixmap */ + PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate; + pPix->drawable.bitsPerPixel = 32; + pPix->drawable.depth = 8; + pPix->devKind = pitch; + } + + return retval; +} + + +static Bool +cfb8_32CloseScreen (int i, ScreenPtr pScreen) +{ + cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); + if(pScreenPriv->visualData) + xfree(pScreenPriv->visualData); + + xfree((pointer) pScreenPriv); + dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL); + + return(cfb32CloseScreen(i, pScreen)); +} + +static void +cfb8_32TransFunc( + ScreenPtr pScreen, + int nbox, + BoxPtr pbox +){ + cfb8_32FillBoxSolid8(&(WindowTable[pScreen->myNum]->drawable), + nbox, pbox, xf86Screens[pScreen->myNum]->colorKey); +} + +static Bool +cfb8_32InOverlayFunc(WindowPtr pWin) +{ + return (pWin->drawable.depth == 8); +} + +static Bool +cfb8_32FinishScreenInit( + ScreenPtr pScreen, + pointer pbits, /* pointer to screen bitmap */ + int xsize, int ysize, /* in pixels */ + int dpix, int dpiy, /* dots per inch */ + int width /* pixel width of frame buffer */ +){ + 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<<(32-1)), 8, -1)) + return FALSE; + if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, + rootdepth, ndepths, depths, + defaultVisual, nvisuals, visuals)) + return FALSE; + + pScreen->CreateScreenResources = cfb8_32CreateScreenResources; + pScreen->CloseScreen = cfb8_32CloseScreen; + pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */ + pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */ + + if (! miInitOverlay(pScreen, cfb8_32InOverlayFunc, cfb8_32TransFunc)) + return FALSE; + + return TRUE; +} + +static void +cfb8_32EnableDisableFBAccess ( + int index, + Bool enable +){ + ScreenPtr pScreen = screenInfo.screens[index]; + cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); + + miOverlaySetRootClip(pScreen, enable); + + (*pScreenPriv->EnableDisableFBAccess) (index, enable); +} + +static Atom overlayVisualsAtom; + +typedef struct { + CARD32 overlay_visual; + CARD32 transparent_type; + CARD32 value; + CARD32 layer; +} overlayVisualRec; + +static void +cfb8_32SetupVisuals (ScreenPtr pScreen) +{ + cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); + char atomString[] = {"SERVER_OVERLAY_VISUALS"}; + overlayVisualRec *overlayVisuals; + VisualID *visuals = NULL; + int numVisuals = 0; + DepthPtr pDepth = pScreen->allowedDepths; + int numDepths = pScreen->numDepths; + int i; + + /* find depth 8 visuals */ + for(i = 0; i < numDepths; i++, pDepth++) { + if(pDepth->depth == 8) { + numVisuals = pDepth->numVids; + visuals = pDepth->vids; + break; + } + } + + if(!numVisuals || !visuals) { + ErrorF("No overlay visuals found!\n"); + return; + } + + if(!(overlayVisuals = xalloc(numVisuals * sizeof(overlayVisualRec)))) + return; + + for(i = 0; i < numVisuals; i++) { + overlayVisuals[i].overlay_visual = visuals[i]; + overlayVisuals[i].transparent_type = 1; /* transparent pixel */ + overlayVisuals[i].value = pScreenPriv->key; + overlayVisuals[i].layer = 1; + } + + overlayVisualsAtom = MakeAtom(atomString, sizeof(atomString) - 1, TRUE); + xf86RegisterRootWindowProperty(pScreen->myNum, overlayVisualsAtom, + overlayVisualsAtom, 32, numVisuals * 4, overlayVisuals); + pScreenPriv->visualData = (pointer)overlayVisuals; +} + +Bool +cfb8_32ScreenInit( + ScreenPtr pScreen, + pointer pbits, /* pointer to screen bitmap */ + int xsize, int ysize, /* in pixels */ + int dpix, int dpiy, /* dots per inch */ + int w /* pixel width of frame buffer */ +){ + cfb8_32ScreenPtr pScreenPriv; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + if (!cfb8_32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, w)) + return FALSE; + + pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); + pScreenPriv->key = pScrn->colorKey; + pScreenPriv->visualData = NULL; + + + pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess; + pScrn->EnableDisableFBAccess = cfb8_32EnableDisableFBAccess; + + + if(cfb8_32FinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, w)) + { + cfb8_32SetupVisuals(pScreen); + return TRUE; + } + return FALSE; +} |