diff src/video/dga/SDL_dgavideo.h @ 101:825b2fa28e2e

DGA video driver is now thread-safe Improved DGA hardware acceleration code
author Sam Lantinga <slouken@lokigames.com>
date Thu, 12 Jul 2001 20:42:22 +0000
parents 74212992fb08
children 2136ea8953f9
line wrap: on
line diff
--- a/src/video/dga/SDL_dgavideo.h	Wed Jul 11 20:18:52 2001 +0000
+++ b/src/video/dga/SDL_dgavideo.h	Thu Jul 12 20:42:22 2001 +0000
@@ -37,11 +37,22 @@
 /* Hidden "this" pointer for the video functions */
 #define _THIS	SDL_VideoDevice *this
 
+/* Define this if you need the DGA driver to be thread-safe */
+#define LOCK_DGA_DISPLAY
+#ifdef LOCK_DGA_DISPLAY
+#define LOCK_DISPLAY()		SDL_mutexP(event_lock)
+#define UNLOCK_DISPLAY()	SDL_mutexV(event_lock)
+#else
+#define LOCK_DISPLAY()
+#define UNLOCK_DISPLAY()
+#endif
+
 
 /* This is the structure we use to keep track of video memory */
 typedef struct vidmem_bucket {
 	struct vidmem_bucket *prev;
-	unsigned int used;
+	int used;
+	int dirty;
 	Uint8 *base;
 	unsigned int size;
 	struct vidmem_bucket *next;
@@ -82,6 +93,9 @@
 
 	/* Used to handle DGA events */
 	int event_base;
+#ifdef LOCK_DGA_DISPLAY
+	SDL_mutex *event_lock;
+#endif
 };
 /* Old variable names */
 #define DGA_Display		(this->hidden->DGA_Display)
@@ -102,5 +116,6 @@
 #define surfaces_memleft	(this->hidden->surfaces_memleft)
 #define hw_lock			(this->hidden->hw_lock)
 #define DGA_event_base		(this->hidden->event_base)
+#define event_lock		(this->hidden->event_lock)
 
 #endif /* _SDL_dgavideo_h */