Mercurial > sdl-ios-xcode
annotate src/video/dga/SDL_dgavideo.c @ 1601:a79200e79a61
Hopefully fixed up DirectFB detection
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 23 Mar 2006 15:25:30 +0000 |
parents | 3ba88cb7eb1b |
children | 14717b52abc0 45669d4efd02 |
rev | line source |
---|---|
0 | 1 /* |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
19 Sam Lantinga |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
20 slouken@libsdl.org |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1306
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 /* DGA 2.0 based SDL video driver implementation. | |
25 */ | |
26 | |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
27 #include <stdio.h> |
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
28 |
0 | 29 #include <X11/Xlib.h> |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 #include "../Xext/extensions/xf86dga.h" |
0 | 31 |
32 #include "SDL_video.h" | |
33 #include "SDL_mouse.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
34 #include "../SDL_sysvideo.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
35 #include "../SDL_pixels_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
36 #include "../../events/SDL_events_c.h" |
0 | 37 #include "SDL_dgavideo.h" |
38 #include "SDL_dgamouse_c.h" | |
39 #include "SDL_dgaevents_c.h" | |
40 | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
41 /* get function pointers... */ |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
42 #include "../x11/SDL_x11dyn.h" |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
43 |
0 | 44 /* Initialization/Query functions */ |
45 static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat); | |
46 static SDL_Rect **DGA_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); | |
47 static SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | |
48 static int DGA_SetColors(_THIS, int firstcolor, int ncolors, | |
49 SDL_Color *colors); | |
50 static int DGA_SetGammaRamp(_THIS, Uint16 *ramp); | |
51 static void DGA_VideoQuit(_THIS); | |
52 | |
53 /* Hardware surface functions */ | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
54 static int DGA_InitHWSurfaces(_THIS, SDL_Surface *screen, Uint8 *base, int size); |
0 | 55 static void DGA_FreeHWSurfaces(_THIS); |
56 static int DGA_AllocHWSurface(_THIS, SDL_Surface *surface); | |
57 static int DGA_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color); | |
58 static int DGA_CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst); | |
59 static int DGA_LockHWSurface(_THIS, SDL_Surface *surface); | |
60 static void DGA_UnlockHWSurface(_THIS, SDL_Surface *surface); | |
61 static void DGA_FreeHWSurface(_THIS, SDL_Surface *surface); | |
62 static int DGA_FlipHWSurface(_THIS, SDL_Surface *surface); | |
63 | |
64 /* DGA driver bootstrap functions */ | |
65 | |
66 static int DGA_Available(void) | |
67 { | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
68 const char *display = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
69 Display *dpy = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
70 int available = 0; |
0 | 71 |
72 /* The driver is available is available if the display is local | |
73 and the DGA 2.0+ extension is available, and we can map mem. | |
74 */ | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
75 if ( SDL_X11_LoadSymbols() ) { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
76 if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) || |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
77 (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) { |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
78 dpy = XOpenDisplay(display); |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
79 if ( dpy ) { |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
80 int events, errors, major, minor; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
81 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
82 if ( SDL_NAME(XDGAQueryExtension)(dpy, &events, &errors) && |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
83 SDL_NAME(XDGAQueryVersion)(dpy, &major, &minor) ) { |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
84 int screen; |
0 | 85 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
86 screen = DefaultScreen(dpy); |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
87 if ( (major >= 2) && |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
88 SDL_NAME(XDGAOpenFramebuffer)(dpy, screen) ) { |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
89 available = 1; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
90 SDL_NAME(XDGACloseFramebuffer)(dpy, screen); |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
91 } |
0 | 92 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
93 XCloseDisplay(dpy); |
0 | 94 } |
95 } | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
96 SDL_X11_UnloadSymbols(); |
0 | 97 } |
98 return(available); | |
99 } | |
100 | |
101 static void DGA_DeleteDevice(SDL_VideoDevice *device) | |
102 { | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
103 if (device != NULL) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
104 SDL_free(device->hidden); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
105 SDL_free(device); |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
106 SDL_X11_UnloadSymbols(); |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
107 } |
0 | 108 } |
109 | |
110 static SDL_VideoDevice *DGA_CreateDevice(int devindex) | |
111 { | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
112 SDL_VideoDevice *device = NULL; |
0 | 113 |
114 /* Initialize all variables that we clean on shutdown */ | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
115 if (SDL_X11_LoadSymbols()) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
116 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); |
0 | 117 if ( device ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
118 SDL_memset(device, 0, (sizeof *device)); |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
119 device->hidden = (struct SDL_PrivateVideoData *) |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
120 SDL_malloc((sizeof *device->hidden)); |
0 | 121 } |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
122 if ( (device == NULL) || (device->hidden == NULL) ) { |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
123 SDL_OutOfMemory(); |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
124 if ( device ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
125 SDL_free(device); |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
126 } |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
127 SDL_X11_UnloadSymbols(); |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
128 return(0); |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
129 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
130 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); |
0 | 131 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
132 /* Set the function pointers */ |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
133 device->VideoInit = DGA_VideoInit; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
134 device->ListModes = DGA_ListModes; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
135 device->SetVideoMode = DGA_SetVideoMode; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
136 device->SetColors = DGA_SetColors; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
137 device->UpdateRects = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
138 device->VideoQuit = DGA_VideoQuit; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
139 device->AllocHWSurface = DGA_AllocHWSurface; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
140 device->CheckHWBlit = DGA_CheckHWBlit; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
141 device->FillHWRect = DGA_FillHWRect; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
142 device->SetHWColorKey = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
143 device->SetHWAlpha = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
144 device->LockHWSurface = DGA_LockHWSurface; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
145 device->UnlockHWSurface = DGA_UnlockHWSurface; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
146 device->FlipHWSurface = DGA_FlipHWSurface; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
147 device->FreeHWSurface = DGA_FreeHWSurface; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
148 device->SetGammaRamp = DGA_SetGammaRamp; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
149 device->GetGammaRamp = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
150 device->SetCaption = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
151 device->SetIcon = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
152 device->IconifyWindow = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
153 device->GrabInput = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
154 device->GetWMInfo = NULL; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
155 device->InitOSKeymap = DGA_InitOSKeymap; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
156 device->PumpEvents = DGA_PumpEvents; |
0 | 157 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
158 device->free = DGA_DeleteDevice; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
966
diff
changeset
|
159 } |
0 | 160 |
161 return device; | |
162 } | |
163 | |
164 VideoBootStrap DGA_bootstrap = { | |
165 "dga", "XFree86 DGA 2.0", | |
166 DGA_Available, DGA_CreateDevice | |
167 }; | |
168 | |
169 static int DGA_AddMode(_THIS, int bpp, int w, int h) | |
170 { | |
171 SDL_Rect *mode; | |
172 int i, index; | |
173 int next_mode; | |
174 | |
175 /* Check to see if we already have this mode */ | |
176 if ( bpp < 8 ) { /* Not supported */ | |
177 return(0); | |
178 } | |
179 index = ((bpp+7)/8)-1; | |
180 for ( i=0; i<SDL_nummodes[index]; ++i ) { | |
181 mode = SDL_modelist[index][i]; | |
182 if ( (mode->w == w) && (mode->h == h) ) { | |
183 return(0); | |
184 } | |
185 } | |
186 | |
187 /* Set up the new video mode rectangle */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
188 mode = (SDL_Rect *)SDL_malloc(sizeof *mode); |
0 | 189 if ( mode == NULL ) { |
190 SDL_OutOfMemory(); | |
191 return(-1); | |
192 } | |
193 mode->x = 0; | |
194 mode->y = 0; | |
195 mode->w = w; | |
196 mode->h = h; | |
197 | |
198 /* Allocate the new list of modes, and fill in the new mode */ | |
199 next_mode = SDL_nummodes[index]; | |
200 SDL_modelist[index] = (SDL_Rect **) | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
201 SDL_realloc(SDL_modelist[index], (1+next_mode+1)*sizeof(SDL_Rect *)); |
0 | 202 if ( SDL_modelist[index] == NULL ) { |
203 SDL_OutOfMemory(); | |
204 SDL_nummodes[index] = 0; | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
205 SDL_free(mode); |
0 | 206 return(-1); |
207 } | |
208 SDL_modelist[index][next_mode] = mode; | |
209 SDL_modelist[index][next_mode+1] = NULL; | |
210 SDL_nummodes[index]++; | |
211 | |
212 return(0); | |
213 } | |
214 | |
215 /* This whole function is a hack. :) */ | |
216 static Uint32 get_video_size(_THIS) | |
217 { | |
218 /* This is a non-exported function from libXxf86dga.a */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
219 extern unsigned char *SDL_NAME(XDGAGetMappedMemory)(int screen); |
0 | 220 FILE *proc; |
221 unsigned long mem; | |
222 unsigned start, stop; | |
223 char line[BUFSIZ]; | |
224 Uint32 size; | |
225 | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
226 mem = (unsigned long)SDL_NAME(XDGAGetMappedMemory)(DGA_Screen); |
0 | 227 size = 0; |
228 proc = fopen("/proc/self/maps", "r"); | |
229 if ( proc ) { | |
230 while ( fgets(line, sizeof(line)-1, proc) ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
231 SDL_sscanf(line, "%x-%x", &start, &stop); |
0 | 232 if ( start == mem ) { |
233 size = (Uint32)((stop-start)/1024); | |
234 break; | |
235 } | |
236 } | |
237 fclose(proc); | |
238 } | |
239 return(size); | |
240 } | |
241 | |
242 #ifdef DGA_DEBUG | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
243 static void PrintMode(SDL_NAME(XDGAMode) *mode) |
0 | 244 { |
245 printf("Mode: %s (%dx%d) at %d bpp (%f refresh, %d pitch) num: %d\n", | |
246 mode->name, | |
247 mode->viewportWidth, mode->viewportHeight, | |
248 mode->depth == 24 ? mode->bitsPerPixel : mode->depth, | |
249 mode->verticalRefresh, mode->bytesPerScanline, mode->num); | |
250 printf("\tRGB: 0x%8.8x 0x%8.8x 0x%8.8x (%d - %s)\n", | |
251 mode->redMask, mode->greenMask, mode->blueMask, | |
252 mode->visualClass, | |
253 mode->visualClass == TrueColor ? "truecolor" : | |
254 mode->visualClass == DirectColor ? "directcolor" : | |
255 mode->visualClass == PseudoColor ? "pseudocolor" : "unknown"); | |
256 printf("\tFlags: "); | |
257 if ( mode->flags & XDGAConcurrentAccess ) | |
258 printf(" XDGAConcurrentAccess"); | |
259 if ( mode->flags & XDGASolidFillRect ) | |
260 printf(" XDGASolidFillRect"); | |
261 if ( mode->flags & XDGABlitRect ) | |
262 printf(" XDGABlitRect"); | |
263 if ( mode->flags & XDGABlitTransRect ) | |
264 printf(" XDGABlitTransRect"); | |
265 if ( mode->flags & XDGAPixmap ) | |
266 printf(" XDGAPixmap"); | |
267 if ( mode->flags & XDGAInterlaced ) | |
268 printf(" XDGAInterlaced"); | |
269 if ( mode->flags & XDGADoublescan ) | |
270 printf(" XDGADoublescan"); | |
271 if ( mode->viewportFlags & XDGAFlipRetrace ) | |
272 printf(" XDGAFlipRetrace"); | |
273 if ( mode->viewportFlags & XDGAFlipImmediate ) | |
274 printf(" XDGAFlipImmediate"); | |
275 printf("\n"); | |
276 } | |
277 #endif /* DGA_DEBUG */ | |
278 | |
279 static int cmpmodes(const void *va, const void *vb) | |
280 { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
281 const SDL_NAME(XDGAMode) *a = (const SDL_NAME(XDGAMode) *)va; |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
282 const SDL_NAME(XDGAMode) *b = (const SDL_NAME(XDGAMode) *)vb; |
0 | 283 |
284 /* Prefer DirectColor visuals for otherwise equal modes */ | |
285 if ( (a->viewportWidth == b->viewportWidth) && | |
286 (b->viewportHeight == a->viewportHeight) ) { | |
966
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
287 if ( a->visualClass == DirectColor ) |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
288 return -1; |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
289 if ( b->visualClass == DirectColor ) |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
290 return 1; |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
291 return 0; |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
292 } else if ( a->viewportWidth == b->viewportWidth ) { |
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
293 return b->viewportHeight - a->viewportHeight; |
0 | 294 } else { |
966
f72cc0c7305f
Video modes are sorted width first, then height
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
295 return b->viewportWidth - a->viewportWidth; |
0 | 296 } |
297 } | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
298 static void UpdateHWInfo(_THIS, SDL_NAME(XDGAMode) *mode) |
0 | 299 { |
300 this->info.wm_available = 0; | |
301 this->info.hw_available = 1; | |
302 if ( mode->flags & XDGABlitRect ) { | |
303 this->info.blit_hw = 1; | |
304 } else { | |
305 this->info.blit_hw = 0; | |
306 } | |
307 if ( mode->flags & XDGABlitTransRect ) { | |
308 this->info.blit_hw_CC = 1; | |
309 } else { | |
310 this->info.blit_hw_CC = 0; | |
311 } | |
312 if ( mode->flags & XDGASolidFillRect ) { | |
313 this->info.blit_fill = 1; | |
314 } else { | |
315 this->info.blit_fill = 0; | |
316 } | |
317 this->info.video_mem = get_video_size(this); | |
318 } | |
319 | |
320 static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat) | |
321 { | |
322 const char *display; | |
323 int event_base, error_base; | |
324 int major_version, minor_version; | |
325 Visual *visual; | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
326 SDL_NAME(XDGAMode) *modes; |
0 | 327 int i, num_modes; |
328 | |
329 /* Open the X11 display */ | |
330 display = NULL; /* Get it from DISPLAY environment variable */ | |
331 | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
332 DGA_Display = XOpenDisplay(display); |
0 | 333 if ( DGA_Display == NULL ) { |
334 SDL_SetError("Couldn't open X11 display"); | |
335 return(-1); | |
336 } | |
337 | |
338 /* Check for the DGA extension */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
339 if ( ! SDL_NAME(XDGAQueryExtension)(DGA_Display, &event_base, &error_base) || |
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
340 ! SDL_NAME(XDGAQueryVersion)(DGA_Display, &major_version, &minor_version) ) { |
0 | 341 SDL_SetError("DGA extension not available"); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
342 XCloseDisplay(DGA_Display); |
0 | 343 return(-1); |
344 } | |
345 if ( major_version < 2 ) { | |
346 SDL_SetError("DGA driver requires DGA 2.0 or newer"); | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
347 XCloseDisplay(DGA_Display); |
0 | 348 return(-1); |
349 } | |
350 DGA_event_base = event_base; | |
351 | |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
352 /* Determine the current screen size */ |
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
353 this->info.current_w = DisplayWidth(DGA_Display, DGA_Screen); |
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
354 this->info.current_h = DisplayHeight(DGA_Display, DGA_Screen); |
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
355 |
0 | 356 /* Determine the current screen depth */ |
357 visual = DefaultVisual(DGA_Display, DGA_Screen); | |
358 { | |
359 XPixmapFormatValues *pix_format; | |
360 int i, num_formats; | |
361 | |
362 vformat->BitsPerPixel = DefaultDepth(DGA_Display, DGA_Screen); | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
363 pix_format = XListPixmapFormats(DGA_Display, &num_formats); |
0 | 364 if ( pix_format == NULL ) { |
365 SDL_SetError("Couldn't determine screen formats"); | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
366 XCloseDisplay(DGA_Display); |
0 | 367 return(-1); |
368 } | |
369 for ( i=0; i<num_formats; ++i ) { | |
370 if ( vformat->BitsPerPixel == pix_format[i].depth ) | |
371 break; | |
372 } | |
373 if ( i != num_formats ) | |
374 vformat->BitsPerPixel = pix_format[i].bits_per_pixel; | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
375 XFree((char *)pix_format); |
0 | 376 } |
377 if ( vformat->BitsPerPixel > 8 ) { | |
378 vformat->Rmask = visual->red_mask; | |
379 vformat->Gmask = visual->green_mask; | |
380 vformat->Bmask = visual->blue_mask; | |
381 } | |
382 | |
383 /* Open access to the framebuffer */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
384 if ( ! SDL_NAME(XDGAOpenFramebuffer)(DGA_Display, DGA_Screen) ) { |
0 | 385 SDL_SetError("Unable to map the video memory"); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
386 XCloseDisplay(DGA_Display); |
0 | 387 return(-1); |
388 } | |
389 | |
390 /* Query for the list of available video modes */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
391 modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes); |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
392 SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes); |
0 | 393 for ( i=0; i<num_modes; ++i ) { |
394 #ifdef DGA_DEBUG | |
395 PrintMode(&modes[i]); | |
396 #endif | |
397 if ( (modes[i].visualClass == PseudoColor) || | |
398 (modes[i].visualClass == DirectColor) || | |
399 (modes[i].visualClass == TrueColor) ) { | |
400 DGA_AddMode(this, modes[i].bitsPerPixel, | |
401 modes[i].viewportWidth, | |
402 modes[i].viewportHeight); | |
403 } | |
404 } | |
405 UpdateHWInfo(this, modes); | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
406 XFree(modes); |
0 | 407 |
408 /* Create the hardware surface lock mutex */ | |
409 hw_lock = SDL_CreateMutex(); | |
410 if ( hw_lock == NULL ) { | |
411 SDL_SetError("Unable to create lock mutex"); | |
412 DGA_VideoQuit(this); | |
413 return(-1); | |
414 } | |
415 | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
416 #ifdef LOCK_DGA_DISPLAY |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
417 /* Create the event lock so we're thread-safe.. :-/ */ |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
418 event_lock = SDL_CreateMutex(); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
419 #endif /* LOCK_DGA_DISPLAY */ |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
420 |
0 | 421 /* We're done! */ |
422 return(0); | |
423 } | |
424 | |
425 SDL_Rect **DGA_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) | |
426 { | |
427 return(SDL_modelist[((format->BitsPerPixel+7)/8)-1]); | |
428 } | |
429 | |
430 /* Various screen update functions available */ | |
431 static void DGA_DirectUpdate(_THIS, int numrects, SDL_Rect *rects); | |
432 | |
433 SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current, | |
434 int width, int height, int bpp, Uint32 flags) | |
435 { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
436 SDL_NAME(XDGAMode) *modes; |
0 | 437 int i, num_modes; |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
438 SDL_NAME(XDGADevice) *mode; |
0 | 439 int screen_len; |
440 Uint8 *surfaces_mem; | |
441 int surfaces_len; | |
442 | |
443 /* Free any previous colormap */ | |
444 if ( DGA_colormap ) { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
445 XFreeColormap(DGA_Display, DGA_colormap); |
0 | 446 DGA_colormap = 0; |
447 } | |
448 | |
449 /* Search for a matching video mode */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
450 modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes); |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
451 SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes); |
0 | 452 for ( i=0; i<num_modes; ++i ) { |
453 int depth; | |
454 | |
455 | |
456 depth = modes[i].depth; | |
457 if ( depth == 24 ) { /* Distinguish between 24 and 32 bpp */ | |
458 depth = modes[i].bitsPerPixel; | |
459 } | |
460 if ( (depth == bpp) && | |
461 (modes[i].viewportWidth == width) && | |
462 (modes[i].viewportHeight == height) && | |
463 ((modes[i].visualClass == PseudoColor) || | |
464 (modes[i].visualClass == DirectColor) || | |
465 (modes[i].visualClass == TrueColor)) ) { | |
466 break; | |
467 } | |
468 } | |
469 if ( i == num_modes ) { | |
470 SDL_SetError("No matching video mode found"); | |
471 return(NULL); | |
472 } | |
473 | |
474 /* Set the video mode */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
475 mode = SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, modes[i].num); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
476 XFree(modes); |
0 | 477 if ( mode == NULL ) { |
478 SDL_SetError("Unable to switch to requested mode"); | |
479 return(NULL); | |
480 } | |
559
b528214c8c9a
Fixed invalid memory access in DGA video driver (thanks ldb!)
Sam Lantinga <slouken@libsdl.org>
parents:
540
diff
changeset
|
481 DGA_visualClass = mode->mode.visualClass; |
0 | 482 memory_base = (Uint8 *)mode->data; |
483 memory_pitch = mode->mode.bytesPerScanline; | |
484 | |
485 /* Set up the new mode framebuffer */ | |
486 current->flags = (SDL_FULLSCREEN|SDL_HWSURFACE); | |
487 current->w = mode->mode.viewportWidth; | |
488 current->h = mode->mode.viewportHeight; | |
489 current->pitch = memory_pitch; | |
490 current->pixels = memory_base; | |
491 if ( ! SDL_ReallocFormat(current, mode->mode.bitsPerPixel, | |
492 mode->mode.redMask, | |
493 mode->mode.greenMask, | |
494 mode->mode.blueMask, 0) ) { | |
495 return(NULL); | |
496 } | |
497 screen_len = current->h*current->pitch; | |
498 | |
499 /* Create a colormap if necessary */ | |
500 if ( (DGA_visualClass == PseudoColor) || | |
501 (DGA_visualClass == DirectColor) ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
502 DGA_colormap = SDL_NAME(XDGACreateColormap)(DGA_Display, DGA_Screen, |
0 | 503 mode, AllocAll); |
504 if ( DGA_visualClass == PseudoColor ) { | |
505 current->flags |= SDL_HWPALETTE; | |
506 } else { | |
507 /* Initialize the colormap to the identity mapping */ | |
508 SDL_GetGammaRamp(0, 0, 0); | |
509 this->screen = current; | |
510 DGA_SetGammaRamp(this, this->gamma); | |
511 this->screen = NULL; | |
512 } | |
513 } else { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
514 DGA_colormap = SDL_NAME(XDGACreateColormap)(DGA_Display, DGA_Screen, |
0 | 515 mode, AllocNone); |
516 } | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
517 SDL_NAME(XDGAInstallColormap)(DGA_Display, DGA_Screen, DGA_colormap); |
0 | 518 |
519 /* Update the hardware capabilities */ | |
520 UpdateHWInfo(this, &mode->mode); | |
521 | |
522 /* Set up the information for hardware surfaces */ | |
523 surfaces_mem = (Uint8 *)current->pixels + screen_len; | |
524 surfaces_len = (mode->mode.imageHeight*current->pitch - screen_len); | |
525 | |
526 /* Update for double-buffering, if we can */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
527 SDL_NAME(XDGASetViewport)(DGA_Display, DGA_Screen, 0, 0, XDGAFlipRetrace); |
0 | 528 if ( flags & SDL_DOUBLEBUF ) { |
529 if ( mode->mode.imageHeight >= (current->h*2) ) { | |
530 current->flags |= SDL_DOUBLEBUF; | |
531 flip_page = 0; | |
532 flip_yoffset[0] = 0; | |
533 flip_yoffset[1] = current->h; | |
534 flip_address[0] = memory_base; | |
535 flip_address[1] = memory_base+screen_len; | |
536 surfaces_mem += screen_len; | |
537 surfaces_len -= screen_len; | |
538 } | |
539 } | |
540 | |
541 /* Allocate memory tracking for hardware surfaces */ | |
542 DGA_FreeHWSurfaces(this); | |
543 if ( surfaces_len < 0 ) { | |
544 surfaces_len = 0; | |
545 } | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
546 DGA_InitHWSurfaces(this, current, surfaces_mem, surfaces_len); |
0 | 547 |
202
401f0134f4f9
Fixed crash when using double-buffering with DGA
Sam Lantinga <slouken@libsdl.org>
parents:
105
diff
changeset
|
548 /* Expose the back buffer as surface memory */ |
401f0134f4f9
Fixed crash when using double-buffering with DGA
Sam Lantinga <slouken@libsdl.org>
parents:
105
diff
changeset
|
549 if ( current->flags & SDL_DOUBLEBUF ) { |
401f0134f4f9
Fixed crash when using double-buffering with DGA
Sam Lantinga <slouken@libsdl.org>
parents:
105
diff
changeset
|
550 this->screen = current; |
401f0134f4f9
Fixed crash when using double-buffering with DGA
Sam Lantinga <slouken@libsdl.org>
parents:
105
diff
changeset
|
551 DGA_FlipHWSurface(this, current); |
401f0134f4f9
Fixed crash when using double-buffering with DGA
Sam Lantinga <slouken@libsdl.org>
parents:
105
diff
changeset
|
552 this->screen = NULL; |
401f0134f4f9
Fixed crash when using double-buffering with DGA
Sam Lantinga <slouken@libsdl.org>
parents:
105
diff
changeset
|
553 } |
401f0134f4f9
Fixed crash when using double-buffering with DGA
Sam Lantinga <slouken@libsdl.org>
parents:
105
diff
changeset
|
554 |
0 | 555 /* Set the update rectangle function */ |
556 this->UpdateRects = DGA_DirectUpdate; | |
557 | |
558 /* Enable mouse and keyboard support */ | |
559 { long input_mask; | |
560 input_mask = (KeyPressMask | KeyReleaseMask); | |
561 input_mask |= (ButtonPressMask | ButtonReleaseMask); | |
562 input_mask |= PointerMotionMask; | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
563 SDL_NAME(XDGASelectInput)(DGA_Display, DGA_Screen, input_mask); |
0 | 564 } |
565 | |
566 /* We're done */ | |
567 return(current); | |
568 } | |
569 | |
570 #ifdef DGA_DEBUG | |
571 static void DGA_DumpHWSurfaces(_THIS) | |
572 { | |
573 vidmem_bucket *bucket; | |
574 | |
575 printf("Memory left: %d (%d total)\n", surfaces_memleft, surfaces_memtotal); | |
576 printf("\n"); | |
577 printf(" Base Size\n"); | |
578 for ( bucket=&surfaces; bucket; bucket=bucket->next ) { | |
579 printf("Bucket: %p, %d (%s)\n", bucket->base, bucket->size, bucket->used ? "used" : "free"); | |
580 if ( bucket->prev ) { | |
581 if ( bucket->base != bucket->prev->base+bucket->prev->size ) { | |
582 printf("Warning, corrupt bucket list! (prev)\n"); | |
583 } | |
584 } else { | |
585 if ( bucket != &surfaces ) { | |
586 printf("Warning, corrupt bucket list! (!prev)\n"); | |
587 } | |
588 } | |
589 if ( bucket->next ) { | |
590 if ( bucket->next->base != bucket->base+bucket->size ) { | |
591 printf("Warning, corrupt bucket list! (next)\n"); | |
592 } | |
593 } | |
594 } | |
595 printf("\n"); | |
596 } | |
597 #endif | |
598 | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
599 static int DGA_InitHWSurfaces(_THIS, SDL_Surface *screen, Uint8 *base, int size) |
0 | 600 { |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
601 vidmem_bucket *bucket; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
602 |
0 | 603 surfaces_memtotal = size; |
604 surfaces_memleft = size; | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
605 |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
606 if ( surfaces_memleft > 0 ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
607 bucket = (vidmem_bucket *)SDL_malloc(sizeof(*bucket)); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
608 if ( bucket == NULL ) { |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
609 SDL_OutOfMemory(); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
610 return(-1); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
611 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
612 bucket->prev = &surfaces; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
613 bucket->used = 0; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
614 bucket->dirty = 0; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
615 bucket->base = base; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
616 bucket->size = size; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
617 bucket->next = NULL; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
618 } else { |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
619 bucket = NULL; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
620 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
621 |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
622 surfaces.prev = NULL; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
623 surfaces.used = 1; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
624 surfaces.dirty = 0; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
625 surfaces.base = screen->pixels; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
626 surfaces.size = (unsigned int)((long)base - (long)surfaces.base); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
627 surfaces.next = bucket; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
628 screen->hwdata = (struct private_hwdata *)&surfaces; |
0 | 629 return(0); |
630 } | |
631 static void DGA_FreeHWSurfaces(_THIS) | |
632 { | |
633 vidmem_bucket *bucket, *freeable; | |
634 | |
635 bucket = surfaces.next; | |
636 while ( bucket ) { | |
637 freeable = bucket; | |
638 bucket = bucket->next; | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
639 SDL_free(freeable); |
0 | 640 } |
641 surfaces.next = NULL; | |
642 } | |
643 | |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
644 static __inline__ void DGA_AddBusySurface(SDL_Surface *surface) |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
645 { |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
646 ((vidmem_bucket *)surface->hwdata)->dirty = 1; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
647 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
648 |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
649 static __inline__ int DGA_IsSurfaceBusy(SDL_Surface *surface) |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
650 { |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
651 return ((vidmem_bucket *)surface->hwdata)->dirty; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
652 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
653 |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
654 static __inline__ void DGA_WaitBusySurfaces(_THIS) |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
655 { |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
656 vidmem_bucket *bucket; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
657 |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
658 /* Wait for graphic operations to complete */ |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
659 SDL_NAME(XDGASync)(DGA_Display, DGA_Screen); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
660 |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
661 /* Clear all surface dirty bits */ |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
662 for ( bucket=&surfaces; bucket; bucket=bucket->next ) { |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
663 bucket->dirty = 0; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
664 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
665 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
666 |
0 | 667 static int DGA_AllocHWSurface(_THIS, SDL_Surface *surface) |
668 { | |
669 vidmem_bucket *bucket; | |
670 int size; | |
671 int extra; | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
672 int retval = 0; |
0 | 673 |
674 /* Temporarily, we only allow surfaces the same width as display. | |
675 Some blitters require the pitch between two hardware surfaces | |
676 to be the same. Others have interesting alignment restrictions. | |
677 */ | |
678 if ( surface->pitch > SDL_VideoSurface->pitch ) { | |
679 SDL_SetError("Surface requested wider than screen"); | |
680 return(-1); | |
681 } | |
682 surface->pitch = SDL_VideoSurface->pitch; | |
683 size = surface->h * surface->pitch; | |
684 #ifdef DGA_DEBUG | |
685 fprintf(stderr, "Allocating bucket of %d bytes\n", size); | |
686 #endif | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
687 LOCK_DISPLAY(); |
0 | 688 |
689 /* Quick check for available mem */ | |
690 if ( size > surfaces_memleft ) { | |
691 SDL_SetError("Not enough video memory"); | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
692 retval = -1; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
693 goto done; |
0 | 694 } |
695 | |
696 /* Search for an empty bucket big enough */ | |
697 for ( bucket=&surfaces; bucket; bucket=bucket->next ) { | |
698 if ( ! bucket->used && (size <= bucket->size) ) { | |
699 break; | |
700 } | |
701 } | |
702 if ( bucket == NULL ) { | |
703 SDL_SetError("Video memory too fragmented"); | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
704 retval = -1; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
705 goto done; |
0 | 706 } |
707 | |
708 /* Create a new bucket for left-over memory */ | |
709 extra = (bucket->size - size); | |
710 if ( extra ) { | |
711 vidmem_bucket *newbucket; | |
712 | |
713 #ifdef DGA_DEBUG | |
714 fprintf(stderr, "Adding new free bucket of %d bytes\n", extra); | |
715 #endif | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
716 newbucket = (vidmem_bucket *)SDL_malloc(sizeof(*newbucket)); |
0 | 717 if ( newbucket == NULL ) { |
718 SDL_OutOfMemory(); | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
719 retval = -1; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
720 goto done; |
0 | 721 } |
722 newbucket->prev = bucket; | |
723 newbucket->used = 0; | |
724 newbucket->base = bucket->base+size; | |
725 newbucket->size = extra; | |
726 newbucket->next = bucket->next; | |
727 if ( bucket->next ) { | |
728 bucket->next->prev = newbucket; | |
729 } | |
730 bucket->next = newbucket; | |
731 } | |
732 | |
733 /* Set the current bucket values and return it! */ | |
734 bucket->used = 1; | |
735 bucket->size = size; | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
736 bucket->dirty = 0; |
0 | 737 #ifdef DGA_DEBUG |
738 fprintf(stderr, "Allocated %d bytes at %p\n", bucket->size, bucket->base); | |
739 #endif | |
740 surfaces_memleft -= size; | |
741 surface->flags |= SDL_HWSURFACE; | |
742 surface->pixels = bucket->base; | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
743 surface->hwdata = (struct private_hwdata *)bucket; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
744 done: |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
745 UNLOCK_DISPLAY(); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
746 return(retval); |
0 | 747 } |
748 static void DGA_FreeHWSurface(_THIS, SDL_Surface *surface) | |
749 { | |
750 vidmem_bucket *bucket, *freeable; | |
751 | |
752 /* Look for the bucket in the current list */ | |
102
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
753 for ( bucket=&surfaces; bucket; bucket=bucket->next ) { |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
754 if ( bucket == (vidmem_bucket *)surface->hwdata ) { |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
755 break; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
756 } |
0 | 757 } |
102
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
758 if ( bucket && bucket->used ) { |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
759 /* Add the memory back to the total */ |
0 | 760 #ifdef DGA_DEBUG |
761 printf("Freeing bucket of %d bytes\n", bucket->size); | |
762 #endif | |
102
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
763 surfaces_memleft += bucket->size; |
0 | 764 |
102
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
765 /* Can we merge the space with surrounding buckets? */ |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
766 bucket->used = 0; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
767 if ( bucket->next && ! bucket->next->used ) { |
0 | 768 #ifdef DGA_DEBUG |
769 printf("Merging with next bucket, for %d total bytes\n", bucket->size+bucket->next->size); | |
770 #endif | |
102
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
771 freeable = bucket->next; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
772 bucket->size += bucket->next->size; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
773 bucket->next = bucket->next->next; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
774 if ( bucket->next ) { |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
775 bucket->next->prev = bucket; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
776 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
777 SDL_free(freeable); |
0 | 778 } |
102
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
779 if ( bucket->prev && ! bucket->prev->used ) { |
0 | 780 #ifdef DGA_DEBUG |
781 printf("Merging with previous bucket, for %d total bytes\n", bucket->prev->size+bucket->size); | |
782 #endif | |
102
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
783 freeable = bucket; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
784 bucket->prev->size += bucket->size; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
785 bucket->prev->next = bucket->next; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
786 if ( bucket->next ) { |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
787 bucket->next->prev = bucket->prev; |
9162d62280b5
Don't crash if freeing a hardware surface after the video mode has been
Sam Lantinga <slouken@lokigames.com>
parents:
101
diff
changeset
|
788 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
789 SDL_free(freeable); |
0 | 790 } |
791 } | |
792 surface->pixels = NULL; | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
793 surface->hwdata = NULL; |
0 | 794 } |
795 | |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
796 static __inline__ void DGA_dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y) |
0 | 797 { |
798 *x = (long)((Uint8 *)dst->pixels - memory_base)%memory_pitch; | |
799 *y = (long)((Uint8 *)dst->pixels - memory_base)/memory_pitch; | |
800 } | |
801 | |
802 static int DGA_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color) | |
803 { | |
804 int x, y; | |
805 unsigned int w, h; | |
806 | |
807 /* Don't fill the visible part of the screen, wait until flipped */ | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
808 LOCK_DISPLAY(); |
0 | 809 if ( was_flipped && (dst == this->screen) ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
810 while ( SDL_NAME(XDGAGetViewportStatus)(DGA_Display, DGA_Screen) ) |
0 | 811 /* Keep waiting for the hardware ... */ ; |
812 was_flipped = 0; | |
813 } | |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
814 DGA_dst_to_xy(this, dst, &x, &y); |
0 | 815 x += rect->x; |
816 y += rect->y; | |
817 w = rect->w; | |
818 h = rect->h; | |
819 #if 0 | |
820 printf("Hardware accelerated rectangle fill: %dx%d at %d,%d\n", w, h, x, y); | |
821 #endif | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
822 SDL_NAME(XDGAFillRectangle)(DGA_Display, DGA_Screen, x, y, w, h, color); |
540
4bcfb93e0dfe
Greatly improved X11 DGA video speed (thanks Cezary!)
Sam Lantinga <slouken@libsdl.org>
parents:
462
diff
changeset
|
823 if ( !(this->screen->flags & SDL_DOUBLEBUF) ) { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
824 XFlush(DGA_Display); |
540
4bcfb93e0dfe
Greatly improved X11 DGA video speed (thanks Cezary!)
Sam Lantinga <slouken@libsdl.org>
parents:
462
diff
changeset
|
825 } |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
826 DGA_AddBusySurface(dst); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
827 UNLOCK_DISPLAY(); |
0 | 828 return(0); |
829 } | |
830 | |
831 static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, | |
832 SDL_Surface *dst, SDL_Rect *dstrect) | |
833 { | |
834 SDL_VideoDevice *this; | |
835 int srcx, srcy; | |
836 int dstx, dsty; | |
837 unsigned int w, h; | |
838 | |
839 this = current_video; | |
840 /* Don't blit to the visible part of the screen, wait until flipped */ | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
841 LOCK_DISPLAY(); |
0 | 842 if ( was_flipped && (dst == this->screen) ) { |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
843 while ( SDL_NAME(XDGAGetViewportStatus)(DGA_Display, DGA_Screen) ) |
0 | 844 /* Keep waiting for the hardware ... */ ; |
845 was_flipped = 0; | |
846 } | |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
847 DGA_dst_to_xy(this, src, &srcx, &srcy); |
0 | 848 srcx += srcrect->x; |
849 srcy += srcrect->y; | |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
850 DGA_dst_to_xy(this, dst, &dstx, &dsty); |
0 | 851 dstx += dstrect->x; |
852 dsty += dstrect->y; | |
853 w = srcrect->w; | |
854 h = srcrect->h; | |
855 #if 0 | |
856 printf("Blitting %dx%d from %d,%d to %d,%d\n", w, h, srcx, srcy, dstx, dsty); | |
857 #endif | |
858 if ( (src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
859 SDL_NAME(XDGACopyTransparentArea)(DGA_Display, DGA_Screen, |
0 | 860 srcx, srcy, w, h, dstx, dsty, src->format->colorkey); |
861 } else { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
862 SDL_NAME(XDGACopyArea)(DGA_Display, DGA_Screen, |
0 | 863 srcx, srcy, w, h, dstx, dsty); |
864 } | |
540
4bcfb93e0dfe
Greatly improved X11 DGA video speed (thanks Cezary!)
Sam Lantinga <slouken@libsdl.org>
parents:
462
diff
changeset
|
865 if ( !(this->screen->flags & SDL_DOUBLEBUF) ) { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
866 XFlush(DGA_Display); |
540
4bcfb93e0dfe
Greatly improved X11 DGA video speed (thanks Cezary!)
Sam Lantinga <slouken@libsdl.org>
parents:
462
diff
changeset
|
867 } |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
868 DGA_AddBusySurface(src); |
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
869 DGA_AddBusySurface(dst); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
870 UNLOCK_DISPLAY(); |
0 | 871 return(0); |
872 } | |
873 | |
874 static int DGA_CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst) | |
875 { | |
876 int accelerated; | |
877 | |
878 /* Set initial acceleration on */ | |
879 src->flags |= SDL_HWACCEL; | |
880 | |
881 /* Set the surface attributes */ | |
882 if ( (src->flags & SDL_SRCALPHA) == SDL_SRCALPHA ) { | |
883 if ( ! this->info.blit_hw_A ) { | |
884 src->flags &= ~SDL_HWACCEL; | |
885 } | |
886 } | |
887 if ( (src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY ) { | |
888 if ( ! this->info.blit_hw_CC ) { | |
889 src->flags &= ~SDL_HWACCEL; | |
890 } | |
891 } | |
892 | |
893 /* Check to see if final surface blit is accelerated */ | |
894 accelerated = !!(src->flags & SDL_HWACCEL); | |
895 if ( accelerated ) { | |
896 src->map->hw_blit = HWAccelBlit; | |
897 } | |
898 return(accelerated); | |
899 } | |
900 | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
901 static __inline__ void DGA_WaitFlip(_THIS) |
0 | 902 { |
903 if ( was_flipped ) { | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
904 while ( SDL_NAME(XDGAGetViewportStatus)(DGA_Display, DGA_Screen) ) |
0 | 905 /* Keep waiting for the hardware ... */ ; |
906 was_flipped = 0; | |
907 } | |
908 } | |
909 | |
910 static int DGA_LockHWSurface(_THIS, SDL_Surface *surface) | |
911 { | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
912 if ( surface == this->screen ) { |
0 | 913 SDL_mutexP(hw_lock); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
914 LOCK_DISPLAY(); |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
915 if ( DGA_IsSurfaceBusy(surface) ) { |
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
916 DGA_WaitBusySurfaces(this); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
917 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
918 DGA_WaitFlip(this); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
919 UNLOCK_DISPLAY(); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
920 } else { |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
921 if ( DGA_IsSurfaceBusy(surface) ) { |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
922 LOCK_DISPLAY(); |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
923 DGA_WaitBusySurfaces(this); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
924 UNLOCK_DISPLAY(); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
925 } |
0 | 926 } |
927 return(0); | |
928 } | |
929 static void DGA_UnlockHWSurface(_THIS, SDL_Surface *surface) | |
930 { | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
931 if ( surface == this->screen ) { |
0 | 932 SDL_mutexV(hw_lock); |
933 } | |
934 } | |
935 | |
936 static int DGA_FlipHWSurface(_THIS, SDL_Surface *surface) | |
937 { | |
938 /* Wait for vertical retrace and then flip display */ | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
939 LOCK_DISPLAY(); |
105
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
940 if ( DGA_IsSurfaceBusy(this->screen) ) { |
2136ea8953f9
Some minor name changes to clean up
Sam Lantinga <slouken@lokigames.com>
parents:
102
diff
changeset
|
941 DGA_WaitBusySurfaces(this); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
942 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
943 DGA_WaitFlip(this); |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
944 SDL_NAME(XDGASetViewport)(DGA_Display, DGA_Screen, |
0 | 945 0, flip_yoffset[flip_page], XDGAFlipRetrace); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
946 XFlush(DGA_Display); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
947 UNLOCK_DISPLAY(); |
0 | 948 was_flipped = 1; |
949 flip_page = !flip_page; | |
950 | |
951 surface->pixels = flip_address[flip_page]; | |
952 return(0); | |
953 } | |
954 | |
955 static void DGA_DirectUpdate(_THIS, int numrects, SDL_Rect *rects) | |
956 { | |
957 /* The application is already updating the visible video memory */ | |
958 return; | |
959 } | |
960 | |
961 static int DGA_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | |
962 { | |
963 int i; | |
964 XColor *xcmap; | |
965 | |
966 /* This happens on initialization */ | |
967 if ( ! DGA_colormap ) { | |
968 return(0); | |
969 } | |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
970 xcmap = SDL_stack_alloc(XColor, ncolors); |
0 | 971 for ( i=0; i<ncolors; ++i ) { |
972 xcmap[i].pixel = firstcolor + i; | |
973 xcmap[i].red = (colors[i].r<<8)|colors[i].r; | |
974 xcmap[i].green = (colors[i].g<<8)|colors[i].g; | |
975 xcmap[i].blue = (colors[i].b<<8)|colors[i].b; | |
976 xcmap[i].flags = (DoRed|DoGreen|DoBlue); | |
977 } | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
978 LOCK_DISPLAY(); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
979 XStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors); |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
980 XSync(DGA_Display, False); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
981 UNLOCK_DISPLAY(); |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
982 SDL_stack_free(xcmap); |
0 | 983 |
984 /* That was easy. :) */ | |
985 return(1); | |
986 } | |
987 | |
988 int DGA_SetGammaRamp(_THIS, Uint16 *ramp) | |
989 { | |
990 int i, ncolors; | |
991 XColor xcmap[256]; | |
992 | |
993 /* See if actually setting the gamma is supported */ | |
994 if ( DGA_visualClass != DirectColor ) { | |
995 SDL_SetError("Gamma correction not supported on this visual"); | |
996 return(-1); | |
997 } | |
998 | |
999 /* Calculate the appropriate palette for the given gamma ramp */ | |
1000 if ( this->screen->format->BitsPerPixel <= 16 ) { | |
1001 ncolors = 64; /* Is this right? */ | |
1002 } else { | |
1003 ncolors = 256; | |
1004 } | |
1005 for ( i=0; i<ncolors; ++i ) { | |
1006 Uint8 c = (256 * i / ncolors); | |
1007 xcmap[i].pixel = SDL_MapRGB(this->screen->format, c, c, c); | |
1008 xcmap[i].red = ramp[0*256+c]; | |
1009 xcmap[i].green = ramp[1*256+c]; | |
1010 xcmap[i].blue = ramp[2*256+c]; | |
1011 xcmap[i].flags = (DoRed|DoGreen|DoBlue); | |
1012 } | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1013 LOCK_DISPLAY(); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1014 XStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors); |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1015 XSync(DGA_Display, False); |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1016 UNLOCK_DISPLAY(); |
0 | 1017 return(0); |
1018 } | |
1019 | |
1020 void DGA_VideoQuit(_THIS) | |
1021 { | |
1022 int i, j; | |
1023 | |
1024 if ( DGA_Display ) { | |
1025 /* Free colormap, if necessary */ | |
1026 if ( DGA_colormap ) { | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1027 XFreeColormap(DGA_Display, DGA_colormap); |
0 | 1028 DGA_colormap = 0; |
1029 } | |
1030 | |
1031 /* Unmap memory and reset video mode */ | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1032 SDL_NAME(XDGACloseFramebuffer)(DGA_Display, DGA_Screen); |
0 | 1033 if ( this->screen ) { |
1034 /* Tell SDL not to free the pixels */ | |
1035 this->screen->pixels = NULL; | |
1036 } | |
292
eadc0746dfaf
Added SDL_LockRect() and SDL_UnlockRect()
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1037 SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, 0); |
0 | 1038 |
1039 /* Clear the lock mutex */ | |
1040 if ( hw_lock != NULL ) { | |
1041 SDL_DestroyMutex(hw_lock); | |
1042 hw_lock = NULL; | |
1043 } | |
101
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1044 #ifdef LOCK_DGA_DISPLAY |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1045 if ( event_lock != NULL ) { |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1046 SDL_DestroyMutex(event_lock); |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1047 event_lock = NULL; |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1048 } |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1049 #endif /* LOCK_DGA_DISPLAY */ |
825b2fa28e2e
DGA video driver is now thread-safe
Sam Lantinga <slouken@lokigames.com>
parents:
91
diff
changeset
|
1050 |
0 | 1051 |
1052 /* Clean up defined video modes */ | |
1053 for ( i=0; i<NUM_MODELISTS; ++i ) { | |
1054 if ( SDL_modelist[i] != NULL ) { | |
1055 for ( j=0; SDL_modelist[i][j]; ++j ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
1056 SDL_free(SDL_modelist[i][j]); |
0 | 1057 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
1058 SDL_free(SDL_modelist[i]); |
0 | 1059 SDL_modelist[i] = NULL; |
1060 } | |
1061 } | |
1062 | |
1063 /* Clean up the memory bucket list */ | |
1064 DGA_FreeHWSurfaces(this); | |
1065 | |
1066 /* Close up the display */ | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1545
diff
changeset
|
1067 XCloseDisplay(DGA_Display); |
0 | 1068 } |
1069 } |