~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to iplan2p4/iplscrinit.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XFree86: xc/programs/Xserver/iplan2p4/iplscrinit.c,v 3.2 1998/06/27 12:55:03 hohndel Exp $ */
2
 
/************************************************************
3
 
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
4
 
 
5
 
                    All Rights Reserved
6
 
 
7
 
Permission  to  use,  copy,  modify,  and  distribute   this
8
 
software  and  its documentation for any purpose and without
9
 
fee is hereby granted, provided that the above copyright no-
10
 
tice  appear  in all copies and that both that copyright no-
11
 
tice and this permission notice appear in  supporting  docu-
12
 
mentation,  and  that the names of Sun or X Consortium
13
 
not be used in advertising or publicity pertaining to 
14
 
distribution  of  the software  without specific prior 
15
 
written permission. Sun and X Consortium make no 
16
 
representations about the suitability of this software for 
17
 
any purpose. It is provided "as is" without any express or 
18
 
implied warranty.
19
 
 
20
 
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
21
 
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
22
 
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
23
 
ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
24
 
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
25
 
PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
26
 
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
27
 
THE USE OR PERFORMANCE OF THIS SOFTWARE.
28
 
 
29
 
********************************************************/
30
 
/* $XConsortium: iplscrinit.c,v 5.32 94/04/17 20:29:00 dpw Exp $ */
31
 
 
32
 
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
33
 
interleaved planes */
34
 
 
35
 
#ifdef HAVE_DIX_CONFIG_H
36
 
#include <dix-config.h>
37
 
#endif
38
 
 
39
 
#include <X11/X.h>
40
 
#include <X11/Xmd.h>
41
 
#include "servermd.h"
42
 
#include "scrnintstr.h"
43
 
#include "pixmapstr.h"
44
 
#include "resource.h"
45
 
#include "colormap.h"
46
 
#include "colormapst.h"
47
 
#include "ipl.h"
48
 
#include "mi.h"
49
 
#include "mistruct.h"
50
 
#include "dix.h"
51
 
#include "mibstore.h"
52
 
 
53
 
 
54
 
BSFuncRec iplBSFuncRec = {
55
 
    iplSaveAreas,
56
 
    iplRestoreAreas,
57
 
    (BackingStoreSetClipmaskRgnProcPtr) 0,
58
 
    (BackingStoreGetImagePixmapProcPtr) 0,
59
 
    (BackingStoreGetSpansPixmapProcPtr) 0,
60
 
};
61
 
 
62
 
Bool
63
 
iplCloseScreen (index, pScreen)
64
 
    int         index;
65
 
    ScreenPtr   pScreen;
66
 
{
67
 
    int     d;
68
 
    DepthPtr    depths = pScreen->allowedDepths;
69
 
 
70
 
    for (d = 0; d < pScreen->numDepths; d++)
71
 
        xfree (depths[d].vids);
72
 
    xfree (depths);
73
 
    xfree (pScreen->visuals);
74
 
#ifdef CFB_NEED_SCREEN_PRIVATE
75
 
    xfree (pScreen->devPrivates[iplScreenPrivateIndex].ptr);
76
 
#else
77
 
    xfree (pScreen->devPrivate);
78
 
#endif
79
 
    return TRUE;
80
 
}
81
 
 
82
 
Bool
83
 
iplSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
84
 
    register ScreenPtr pScreen;
85
 
    pointer pbits;              /* pointer to screen bitmap */
86
 
    int xsize, ysize;           /* in pixels */
87
 
    int dpix, dpiy;             /* dots per inch */
88
 
    int width;                  /* pixel width of frame buffer */
89
 
{
90
 
    int i;
91
 
    extern RegionPtr    (*iplPuntCopyPlane)();
92
 
 
93
 
    if (!iplAllocatePrivates(pScreen, (int *) 0, (int *) 0))
94
 
        return FALSE;
95
 
    pScreen->defColormap = FakeClientID(0);
96
 
    /* let CreateDefColormap do whatever it wants for pixels */ 
97
 
    pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
98
 
    pScreen->QueryBestSize = mfbQueryBestSize;
99
 
    /* SaveScreen */
100
 
    pScreen->GetImage = iplGetImage;
101
 
    pScreen->GetSpans = iplGetSpans;
102
 
    pScreen->CreateWindow = iplCreateWindow;
103
 
    pScreen->DestroyWindow = iplDestroyWindow;
104
 
    pScreen->PositionWindow = iplPositionWindow;
105
 
    pScreen->ChangeWindowAttributes = iplChangeWindowAttributes;
106
 
    pScreen->RealizeWindow = iplMapWindow;
107
 
    pScreen->UnrealizeWindow = iplUnmapWindow;
108
 
    pScreen->PaintWindowBackground = iplPaintWindow;
109
 
    pScreen->PaintWindowBorder = iplPaintWindow;
110
 
    pScreen->CopyWindow = iplCopyWindow;
111
 
    pScreen->CreatePixmap = iplCreatePixmap;
112
 
    pScreen->DestroyPixmap = iplDestroyPixmap;
113
 
    pScreen->RealizeFont = mfbRealizeFont;
114
 
    pScreen->UnrealizeFont = mfbUnrealizeFont;
115
 
    pScreen->CreateGC = iplCreateGC;
116
 
    pScreen->CreateColormap = iplInitializeColormap;
117
 
    pScreen->DestroyColormap = (void (*)())NoopDDA;
118
 
    pScreen->InstallColormap = iplInstallColormap;
119
 
    pScreen->UninstallColormap = iplUninstallColormap;
120
 
    pScreen->ListInstalledColormaps = iplListInstalledColormaps;
121
 
    pScreen->StoreColors = (void (*)())NoopDDA;
122
 
    pScreen->ResolveColor = iplResolveColor;
123
 
    pScreen->BitmapToRegion = mfbPixmapToRegion;
124
 
 
125
 
    mfbRegisterCopyPlaneProc (pScreen, iplCopyPlane);
126
 
    return TRUE;
127
 
}
128
 
 
129
 
#ifdef CFB_NEED_SCREEN_PRIVATE
130
 
Bool
131
 
iplCreateScreenResources(pScreen)
132
 
    ScreenPtr pScreen;
133
 
{
134
 
    Bool retval;
135
 
 
136
 
    pointer oldDevPrivate = pScreen->devPrivate;
137
 
    pScreen->devPrivate = pScreen->devPrivates[iplScreenPrivateIndex].ptr;
138
 
    retval = miCreateScreenResources(pScreen);
139
 
    pScreen->devPrivates[iplScreenPrivateIndex].ptr = pScreen->devPrivate;
140
 
    pScreen->devPrivate = oldDevPrivate;
141
 
    return retval;
142
 
}
143
 
#endif
144
 
 
145
 
Bool
146
 
iplFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
147
 
    register ScreenPtr pScreen;
148
 
    pointer pbits;              /* pointer to screen bitmap */
149
 
    int xsize, ysize;           /* in pixels */
150
 
    int dpix, dpiy;             /* dots per inch */
151
 
    int width;                  /* pixel width of frame buffer */
152
 
{
153
 
    int i, j;
154
 
#ifdef CFB_NEED_SCREEN_PRIVATE
155
 
    pointer oldDevPrivate;
156
 
#endif
157
 
    VisualPtr   visuals;
158
 
    DepthPtr    depths;
159
 
    int         nvisuals;
160
 
    int         ndepths;
161
 
    int         rootdepth;
162
 
    VisualID    defaultVisual;
163
 
 
164
 
    rootdepth = 0;
165
 
    if (!iplInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
166
 
                         &defaultVisual,((unsigned long)1<<(INTER_PLANES-1)), 8))
167
 
        return FALSE;
168
 
#ifdef CFB_NEED_SCREEN_PRIVATE
169
 
    oldDevPrivate = pScreen->devPrivate;
170
 
#endif
171
 
    if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
172
 
                        rootdepth, ndepths, depths,
173
 
                        defaultVisual, nvisuals, visuals))
174
 
        return FALSE;
175
 
    /* overwrite miCloseScreen with our own */
176
 
    pScreen->CloseScreen = iplCloseScreen;
177
 
#ifdef CFB_NEED_SCREEN_PRIVATE
178
 
    pScreen->CreateScreenResources = iplCreateScreenResources;
179
 
    pScreen->devPrivates[iplScreenPrivateIndex].ptr = pScreen->devPrivate;
180
 
    pScreen->devPrivate = oldDevPrivate;
181
 
#endif
182
 
    pScreen->BackingStoreFuncs = iplBSFuncRec;
183
 
    pScreen->GetScreenPixmap = iplGetScreenPixmap;
184
 
    pScreen->SetScreenPixmap = iplSetScreenPixmap;
185
 
    return TRUE;
186
 
}
187
 
 
188
 
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
189
 
Bool
190
 
iplScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
191
 
    register ScreenPtr pScreen;
192
 
    pointer pbits;              /* pointer to screen bitmap */
193
 
    int xsize, ysize;           /* in pixels */
194
 
    int dpix, dpiy;             /* dots per inch */
195
 
    int width;                  /* pixel width of frame buffer */
196
 
{
197
 
    if (!iplSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
198
 
        return FALSE;
199
 
    if (!iplFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
200
 
        return FALSE;
201
 
#if INTER_PLANES == 2
202
 
/* This shouldn't be necessary */
203
 
    PixmapWidthPaddingInfo[2].padPixelsLog2 = 4;
204
 
    PixmapWidthPaddingInfo[2].padRoundUp = 15;
205
 
    PixmapWidthPaddingInfo[2].padBytesLog2 = 2;
206
 
#endif
207
 
    return TRUE;
208
 
}
209
 
 
210
 
PixmapPtr
211
 
iplGetScreenPixmap(pScreen)
212
 
    ScreenPtr pScreen;
213
 
{
214
 
#ifdef CFB_NEED_SCREEN_PRIVATE
215
 
    return (PixmapPtr)(pScreen->devPrivates[iplScreenPrivateIndex].ptr);
216
 
#else
217
 
    return (PixmapPtr)(pScreen->devPrivate.ptr);
218
 
#endif
219
 
}
220
 
 
221
 
void
222
 
iplSetScreenPixmap(pPix)
223
 
    PixmapPtr pPix;
224
 
{
225
 
#ifdef CFB_NEED_SCREEN_PRIVATE
226
 
    if (pPix)
227
 
        pPix->drawable.pScreen->devPrivates[iplScreenPrivateIndex].ptr =
228
 
            (pointer)pPix;
229
 
#else
230
 
    if (pPix)
231
 
        pPix->drawable.pScreen->devPrivate.ptr = (pointer)pPix;
232
 
#endif
233
 
}