2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SDL_config.h"
24 #ifndef _SDL_dgavideo_h
25 #define _SDL_dgavideo_h
29 /* Apparently some X11 systems can't include this multiple times... */
30 #ifndef SDL_INCLUDED_XLIBINT_H
31 #define SDL_INCLUDED_XLIBINT_H 1
32 #include <X11/Xlibint.h>
35 #include <X11/Xproto.h>
37 #include "SDL_mouse.h"
38 #include "SDL_mutex.h"
39 #include "../SDL_sysvideo.h"
41 /* Hidden "this" pointer for the video functions */
42 #define _THIS SDL_VideoDevice *this
44 /* Define this if you need the DGA driver to be thread-safe */
45 #define LOCK_DGA_DISPLAY
46 #ifdef LOCK_DGA_DISPLAY
47 #define LOCK_DISPLAY() SDL_mutexP(event_lock)
48 #define UNLOCK_DISPLAY() SDL_mutexV(event_lock)
50 #define LOCK_DISPLAY()
51 #define UNLOCK_DISPLAY()
55 /* This is the structure we use to keep track of video memory */
56 typedef struct vidmem_bucket {
57 struct vidmem_bucket *prev;
62 struct vidmem_bucket *next;
65 /* Private display data */
66 struct SDL_PrivateVideoData {
68 Colormap DGA_colormap;
71 #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
72 int SDL_nummodes[NUM_MODELISTS];
73 SDL_Rect **SDL_modelist[NUM_MODELISTS];
75 /* Information for the video surface */
82 /* Information for hardware surfaces */
83 vidmem_bucket surfaces;
84 int surfaces_memtotal;
87 /* Information for double-buffering */
90 Uint8 *flip_address[2];
92 /* Used to handle DGA events */
94 #ifdef LOCK_DGA_DISPLAY
95 SDL_mutex *event_lock;
98 /* Screensaver settings */
99 int allow_screensaver;
102 /* Old variable names */
103 #define DGA_Display (this->hidden->DGA_Display)
104 #define DGA_Screen DefaultScreen(DGA_Display)
105 #define DGA_colormap (this->hidden->DGA_colormap)
106 #define DGA_visualClass (this->hidden->visualClass)
107 #define memory_base (this->hidden->memory_base)
108 #define memory_pitch (this->hidden->memory_pitch)
109 #define flip_page (this->hidden->flip_page)
110 #define flip_yoffset (this->hidden->flip_yoffset)
111 #define flip_address (this->hidden->flip_address)
112 #define sync_needed (this->hidden->sync_needed)
113 #define was_flipped (this->hidden->was_flipped)
114 #define SDL_nummodes (this->hidden->SDL_nummodes)
115 #define SDL_modelist (this->hidden->SDL_modelist)
116 #define surfaces (this->hidden->surfaces)
117 #define surfaces_memtotal (this->hidden->surfaces_memtotal)
118 #define surfaces_memleft (this->hidden->surfaces_memleft)
119 #define hw_lock (this->hidden->hw_lock)
120 #define DGA_event_base (this->hidden->event_base)
121 #define event_lock (this->hidden->event_lock)
122 #define allow_screensaver (this->hidden->allow_screensaver)
124 #endif /* _SDL_dgavideo_h */