1
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf24_32bpp/cfbscrinit.c,v 1.4 1999/08/14 10:50:16 dawes Exp $ */
8
#include "scrnintstr.h"
12
#include "colormapst.h"
25
/* CAUTION: We require that cfb24 and cfb32 were NOT
26
compiled with CFB_NEED_SCREEN_PRIVATE */
28
static BSFuncRec cfb24_32BSFuncRec = {
31
(BackingStoreSetClipmaskRgnProcPtr) 0,
32
(BackingStoreGetImagePixmapProcPtr) 0,
33
(BackingStoreGetSpansPixmapProcPtr) 0,
37
int cfb24_32GCIndex = 1;
38
int cfb24_32PixmapIndex = 1;
40
static unsigned long cfb24_32Generation = 0;
41
extern WindowPtr *WindowTable;
44
cfb24_32AllocatePrivates(ScreenPtr pScreen)
46
if(cfb24_32Generation != serverGeneration) {
47
if( ((cfb24_32GCIndex = AllocateGCPrivateIndex()) < 0) |
48
((cfb24_32PixmapIndex = AllocatePixmapPrivateIndex()) < 0))
50
cfb24_32Generation = serverGeneration;
54
/* All cfb will have the same GC and Window private indicies */
55
if(!mfbAllocatePrivates(pScreen,&cfbWindowPrivateIndex, &cfbGCPrivateIndex))
58
/* The cfb indicies are the mfb indicies. Reallocating them resizes them */
59
if(!AllocateWindowPrivate(pScreen,cfbWindowPrivateIndex,sizeof(cfbPrivWin)))
62
if(!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
65
if(!AllocateGCPrivate(pScreen, cfb24_32GCIndex, sizeof(cfb24_32GCRec)))
68
if(!AllocatePixmapPrivate(
69
pScreen, cfb24_32PixmapIndex, sizeof(cfb24_32PixmapRec)))
79
pointer pbits, /* pointer to screen bitmap */
80
int xsize, int ysize, /* in pixels */
81
int dpix, int dpiy, /* dots per inch */
82
int width /* pixel width of frame buffer */
84
if (!cfb24_32AllocatePrivates(pScreen))
86
pScreen->defColormap = FakeClientID(0);
87
/* let CreateDefColormap do whatever it wants for pixels */
88
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
89
pScreen->QueryBestSize = mfbQueryBestSize;
91
pScreen->GetImage = cfb24_32GetImage;
92
pScreen->GetSpans = cfb24_32GetSpans;
93
pScreen->CreateWindow = cfb24_32CreateWindow;
94
pScreen->DestroyWindow = cfb24_32DestroyWindow;
95
pScreen->PositionWindow = cfb24_32PositionWindow;
96
pScreen->ChangeWindowAttributes = cfb24_32ChangeWindowAttributes;
97
pScreen->RealizeWindow = cfb24MapWindow; /* OK */
98
pScreen->UnrealizeWindow = cfb24UnmapWindow; /* OK */
99
pScreen->PaintWindowBackground = cfb24PaintWindow; /* OK */
100
pScreen->PaintWindowBorder = cfb24PaintWindow; /* OK */
101
pScreen->CopyWindow = cfb24_32CopyWindow;
102
pScreen->CreatePixmap = cfb24_32CreatePixmap;
103
pScreen->DestroyPixmap = cfb24_32DestroyPixmap;
104
pScreen->RealizeFont = mfbRealizeFont;
105
pScreen->UnrealizeFont = mfbUnrealizeFont;
106
pScreen->CreateGC = cfb24_32CreateGC;
107
pScreen->CreateColormap = miInitializeColormap;
108
pScreen->DestroyColormap = (void (*)())NoopDDA;
109
pScreen->InstallColormap = miInstallColormap;
110
pScreen->UninstallColormap = miUninstallColormap;
111
pScreen->ListInstalledColormaps = miListInstalledColormaps;
112
pScreen->StoreColors = (void (*)())NoopDDA;
113
pScreen->ResolveColor = miResolveColor;
114
pScreen->BitmapToRegion = mfbPixmapToRegion;
116
mfbRegisterCopyPlaneProc (pScreen, miCopyPlane);
123
} miScreenInitParmsRec, *miScreenInitParmsPtr;
126
cfb24_32CreateScreenResources(ScreenPtr pScreen)
128
miScreenInitParmsPtr pScrInitParms;
132
/* get the pitch before mi destroys it */
133
pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
134
pitch = BitmapBytePad(pScrInitParms->width * 24);
136
if((retval = miCreateScreenResources(pScreen))) {
137
/* fix the screen pixmap */
138
PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate;
139
pPix->drawable.bitsPerPixel = 24;
140
pPix->devKind = pitch;
148
cfb24_32FinishScreenInit(
150
pointer pbits, /* pointer to screen bitmap */
151
int xsize, int ysize, /* in pixels */
152
int dpix, int dpiy, /* dots per inch */
153
int width /* pixel width of frame buffer */
160
VisualID defaultVisual;
163
if (!miInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
164
&defaultVisual,((unsigned long)1<<(24-1)), 8, -1))
166
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
167
rootdepth, ndepths, depths,
168
defaultVisual, nvisuals, visuals))
171
pScreen->BackingStoreFuncs = cfb24_32BSFuncRec;
172
pScreen->CreateScreenResources = cfb24_32CreateScreenResources;
173
pScreen->CloseScreen = cfb32CloseScreen; /* OK */
174
pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */
175
pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */
182
pointer pbits, /* pointer to screen bitmap */
183
int xsize, int ysize, /* in pixels */
184
int dpix, int dpiy, /* dots per inch */
185
int width /* pixel width of frame buffer */
187
if (!cfb24_32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
189
return cfb24_32FinishScreenInit(
190
pScreen, pbits, xsize, ysize, dpix, dpiy, width);