--- a/src/video/fbcon/SDL_fbvideo.h Fri Jul 13 10:15:52 2001 +0000
+++ b/src/video/fbcon/SDL_fbvideo.h Fri Jul 13 10:19:51 2001 +0000
@@ -43,18 +43,13 @@
/* 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;
char *base;
unsigned int size;
struct vidmem_bucket *next;
} vidmem_bucket;
-/* Information about the location of the surface in hardware memory */
-struct private_hwdata {
- int x;
- int y;
-};
-
/* Private display data */
struct SDL_PrivateVideoData {
int console_fd;
@@ -90,6 +85,7 @@
SDL_mutex *hw_lock;
void (*wait_vbl)(_THIS);
+ void (*wait_idle)(_THIS);
};
/* Old variable names */
#define console_fd (this->hidden->console_fd)
@@ -117,6 +113,7 @@
#define surfaces_memleft (this->hidden->surfaces_memleft)
#define hw_lock (this->hidden->hw_lock)
#define wait_vbl (this->hidden->wait_vbl)
+#define wait_idle (this->hidden->wait_idle)
/* Accelerator types that are supported by the driver, but are not
necessarily in the kernel headers on the system we compile on.
@@ -132,4 +129,39 @@
extern void FB_SavePaletteTo(_THIS, int palette_len, __u16 *area);
extern void FB_RestorePaletteFrom(_THIS, int palette_len, __u16 *area);
+/* These are utility functions for working with video surfaces */
+
+static __inline__ void FB_AddBusySurface(SDL_Surface *surface)
+{
+ ((vidmem_bucket *)surface->hwdata)->dirty = 1;
+}
+
+static __inline__ int FB_IsSurfaceBusy(SDL_Surface *surface)
+{
+ return ((vidmem_bucket *)surface->hwdata)->dirty;
+}
+
+static __inline__ void FB_WaitBusySurfaces(_THIS)
+{
+ vidmem_bucket *bucket;
+
+ /* Wait for graphic operations to complete */
+ wait_idle(this);
+
+ /* Clear all surface dirty bits */
+ for ( bucket=&surfaces; bucket; bucket=bucket->next ) {
+ bucket->dirty = 0;
+ }
+}
+
+static __inline__ void FB_dst_to_xy(_THIS, SDL_Surface *dst, int *x, int *y)
+{
+ *x = (long)((char *)dst->pixels - mapped_mem)%this->screen->pitch;
+ *y = (long)((char *)dst->pixels - mapped_mem)/this->screen->pitch;
+ if ( dst == this->screen ) {
+ *x += this->offset_x;
+ *y += this->offset_y;
+ }
+}
+
#endif /* _SDL_fbvideo_h */