3 Copyright (c) 1990 X Consortium
5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
13 The above copyright notice and this permission notice shall be included
14 in all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 OTHER DEALINGS IN THE SOFTWARE.
24 Except as contained in this notice, the name of the X Consortium shall
25 not be used in advertising or otherwise to promote the sale, use or
26 other dealings in this Software without prior written authorization
27 from the X Consortium.
30 Copyright IBM Corporation 1987,1988,1989
33 Permission to use, copy, modify, and distribute this software and its
34 documentation for any purpose and without fee is hereby granted,
35 provided that the above copyright notice appear in all copies and that
36 both that copyright notice and this permission notice appear in
37 supporting documentation, and that the name of IBM not be
38 used in advertising or publicity pertaining to distribution of the
39 software without specific, written prior permission.
41 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
44 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
51 #ifdef HAVE_XORG_CONFIG_H
52 #include <xorg-config.h>
62 #include "scrnintstr.h"
66 /* XXX This remains to remind of the PC98 difference */
67 static VisualRec vgaVisuals
[] = {
68 /* StaticColor needs to be first so is can be used as the default */
69 /* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
71 { 0, StaticColor
, 4, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
72 { 0, StaticGray
, 4, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
73 { 0, GrayScale
, 4, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
74 { 0, PseudoColor
, 4, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
76 { 0, StaticColor
, 6, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
77 { 0, StaticGray
, 6, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
78 { 0, GrayScale
, 6, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
79 { 0, PseudoColor
, 6, 1 << VGA_MAXPLANES
, VGA_MAXPLANES
, 0, 0, 0, 0, 0, 0 },
87 FatalError("xf4bppNeverCalled was nevertheless called\n");
90 static BSFuncRec ppcBSFuncRec
= {
93 (BackingStoreSetClipmaskRgnProcPtr
) 0,
94 (BackingStoreGetImagePixmapProcPtr
) 0,
95 (BackingStoreGetSpansPixmapProcPtr
) 0,
106 pScreen
->defColormap
= 0 ;
111 static GCPtr sampleGCperDepth
[MAXFORMATS
+1] = { 0 };
112 static PixmapPtr samplePixmapPerDepth
[1] = { 0 };
114 /* GJA -- Took this from miscrinit.c.
115 * We want that devKind contains the distance in bytes between two scanlines.
116 * The computation that mi does is not appropriate for planar VGA.
117 * Therefore we provide here our own routine.
120 /* GJA -- WARNING: this is an internal structure declaration, taken from
125 pointer pbits
; /* pointer to framebuffer */
126 int width
; /* delta to add to a framebuffer addr to move one row down */
127 } miScreenInitParmsRec
, *miScreenInitParmsPtr
;
129 /* With the introduction of pixmap privates, the "screen pixmap" can no
130 * longer be created in miScreenInit, since all the modules that could
131 * possibly ask for pixmap private space have not been initialized at
132 * that time. pScreen->CreateScreenResources is called after all
133 * possible private-requesting modules have been inited; we create the
134 * screen pixmap here.
137 v16CreateScreenResources
142 miScreenInitParmsPtr pScrInitParms
;
145 pScrInitParms
= (miScreenInitParmsPtr
)pScreen
->devPrivate
;
147 /* if width is non-zero, pScreen->devPrivate will be a pixmap
148 * else it will just take the value pbits
150 if (pScrInitParms
->width
)
154 /* create a pixmap with no data, then redirect it to point to
157 pPixmap
= (*pScreen
->CreatePixmap
)(pScreen
, 0, 0, pScreen
->rootDepth
);
161 if (!(*pScreen
->ModifyPixmapHeader
)(pPixmap
, pScreen
->width
,
162 pScreen
->height
, pScreen
->rootDepth
, 8 /* bits per pixel */,
163 /* GJA: was PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), */
164 #define BITS_PER_BYTE_SHIFT 3
165 pScrInitParms
->width
>> BITS_PER_BYTE_SHIFT
,
166 pScrInitParms
->pbits
))
168 value
= (pointer
)pPixmap
;
172 value
= pScrInitParms
->pbits
;
174 xfree(pScreen
->devPrivate
); /* freeing miScreenInitParmsRec */
175 pScreen
->devPrivate
= value
; /* pPixmap or pbits */
181 xf4bppScreenInit( pScreen
, pbits
, virtx
, virty
, dpix
, dpiy
, width
)
194 VisualID defaultVisual
;
197 ret
= miInitVisuals(&visuals
, &depths
, &nvisuals
, &ndepths
, &rootdepth
,
198 &defaultVisual
, (unsigned long)1 << 8, 6, -1);
203 pScreen
->defColormap
= FakeClientID(0);
204 pScreen
-> whitePixel
= VGA_WHITE_PIXEL
;
205 pScreen
-> blackPixel
= VGA_BLACK_PIXEL
;
207 *(pScreen
-> GCperDepth
) = *(sampleGCperDepth
);
208 *(pScreen
-> PixmapPerDepth
) = *(samplePixmapPerDepth
);
209 pScreen
-> CloseScreen
= vgaScreenClose
;
210 pScreen
-> QueryBestSize
= xf4bppQueryBestSize
;
211 pScreen
-> GetImage
= xf4bppGetImage
;
212 pScreen
-> GetSpans
= xf4bppGetSpans
;
213 pScreen
-> CreateWindow
= xf4bppCreateWindowForXYhardware
;
214 pScreen
-> DestroyWindow
= xf4bppDestroyWindow
;
215 pScreen
-> PositionWindow
= xf4bppPositionWindow
;
216 pScreen
-> PaintWindowBackground
= xf4bppPaintWindow
;
217 pScreen
-> PaintWindowBorder
= xf4bppPaintWindow
;
218 pScreen
-> CopyWindow
= xf4bppCopyWindow
;
219 pScreen
-> CreatePixmap
= xf4bppCreatePixmap
;
220 pScreen
-> SaveDoomedAreas
= (SaveDoomedAreasProcPtr
)NoopDDA
;
221 pScreen
-> RestoreAreas
= (RestoreAreasProcPtr
)NoopDDA
;
222 pScreen
-> ExposeCopy
= (ExposeCopyProcPtr
)NoopDDA
;
223 pScreen
-> TranslateBackingStore
= (TranslateBackingStoreProcPtr
)NoopDDA
;
224 pScreen
-> ClearBackingStore
= (ClearBackingStoreProcPtr
)NoopDDA
;
225 pScreen
-> DrawGuarantee
= (DrawGuaranteeProcPtr
)NoopDDA
;
226 pScreen
-> CreateGC
= xf4bppCreateGC
;
227 pScreen
-> CreateColormap
= xf4bppInitializeColormap
;
228 pScreen
-> DestroyColormap
= (DestroyColormapProcPtr
)NoopDDA
;
229 pScreen
-> InstallColormap
= miInstallColormap
;
230 pScreen
-> UninstallColormap
= miUninstallColormap
;
231 pScreen
-> ListInstalledColormaps
= miListInstalledColormaps
;
232 pScreen
-> StoreColors
= (StoreColorsProcPtr
)NoopDDA
;
233 pScreen
-> ResolveColor
= xf4bppResolveColor
;
234 mfbFillInScreen(pScreen
);
236 if (!mfbAllocatePrivates(pScreen
, (int*)NULL
, (int*)NULL
))
239 if (!miScreenInit(pScreen
, pbits
, virtx
, virty
, dpix
, dpiy
, width
,
240 rootdepth
, ndepths
, depths
, defaultVisual
/* See above */,
243 pScreen
->BackingStoreFuncs
= ppcBSFuncRec
;
245 /* GJA -- Now we override the supplied default: */
246 pScreen
-> CreateScreenResources
= v16CreateScreenResources
;
248 mfbRegisterCopyPlaneProc(pScreen
,miCopyPlane
); /* GJA -- R4->R5 */