53 |
|
# include <X11/extensions/xf86vmode.h> |
54 |
|
#endif |
55 |
|
|
56 |
+ |
#ifdef ENABLE_FBDEV_DGA |
57 |
+ |
# include <sys/mman.h> |
58 |
+ |
#endif |
59 |
+ |
|
60 |
|
#include "main.h" |
61 |
|
#include "adb.h" |
62 |
|
#include "prefs.h" |
168 |
|
#endif |
169 |
|
|
170 |
|
// Mutex to protect palette |
171 |
< |
#ifdef HAVE_SPINLOCKS |
168 |
< |
static spinlock_t x_palette_lock = SPIN_LOCK_UNLOCKED; |
169 |
< |
#define LOCK_PALETTE spin_lock(&x_palette_lock) |
170 |
< |
#define UNLOCK_PALETTE spin_unlock(&x_palette_lock) |
171 |
< |
#elif defined(HAVE_PTHREADS) |
171 |
> |
#if defined(HAVE_PTHREADS) |
172 |
|
static pthread_mutex_t x_palette_lock = PTHREAD_MUTEX_INITIALIZER; |
173 |
|
#define LOCK_PALETTE pthread_mutex_lock(&x_palette_lock) |
174 |
|
#define UNLOCK_PALETTE pthread_mutex_unlock(&x_palette_lock) |
175 |
+ |
#elif defined(HAVE_SPINLOCKS) |
176 |
+ |
static spinlock_t x_palette_lock = SPIN_LOCK_UNLOCKED; |
177 |
+ |
#define LOCK_PALETTE spin_lock(&x_palette_lock) |
178 |
+ |
#define UNLOCK_PALETTE spin_unlock(&x_palette_lock) |
179 |
|
#else |
180 |
|
#define LOCK_PALETTE |
181 |
|
#define UNLOCK_PALETTE |
182 |
|
#endif |
183 |
|
|
184 |
|
// Mutex to protect frame buffer |
185 |
< |
#ifdef HAVE_SPINLOCKS |
182 |
< |
static spinlock_t frame_buffer_lock = SPIN_LOCK_UNLOCKED; |
183 |
< |
#define LOCK_FRAME_BUFFER spin_lock(&frame_buffer_lock) |
184 |
< |
#define UNLOCK_FRAME_BUFFER spin_unlock(&frame_buffer_lock) |
185 |
< |
#elif defined(HAVE_PTHREADS) |
185 |
> |
#if defined(HAVE_PTHREADS) |
186 |
|
static pthread_mutex_t frame_buffer_lock = PTHREAD_MUTEX_INITIALIZER; |
187 |
|
#define LOCK_FRAME_BUFFER pthread_mutex_lock(&frame_buffer_lock); |
188 |
|
#define UNLOCK_FRAME_BUFFER pthread_mutex_unlock(&frame_buffer_lock); |
189 |
+ |
#elif defined(HAVE_SPINLOCKS) |
190 |
+ |
static spinlock_t frame_buffer_lock = SPIN_LOCK_UNLOCKED; |
191 |
+ |
#define LOCK_FRAME_BUFFER spin_lock(&frame_buffer_lock) |
192 |
+ |
#define UNLOCK_FRAME_BUFFER spin_unlock(&frame_buffer_lock) |
193 |
|
#else |
194 |
|
#define LOCK_FRAME_BUFFER |
195 |
|
#define UNLOCK_FRAME_BUFFER |
697 |
|
} |
698 |
|
D(bug("[fbdev] visual: %s\n", fb_visual_str)); |
699 |
|
|
700 |
< |
if (fb_visual != FB_VISUAL_TRUECOLOR) { |
700 |
> |
if (fb_visual != FB_VISUAL_TRUECOLOR && fb_visual != FB_VISUAL_DIRECTCOLOR) { |
701 |
|
D(bug("[fbdev] visual '%s' not supported\n", fb_visual_str)); |
702 |
|
return false; |
703 |
|
} |
1023 |
|
#endif |
1024 |
|
|
1025 |
|
// Zero screen buffers, viRowBytes is initialized at this stage |
1026 |
< |
memset(the_buffer, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); |
1027 |
< |
memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); |
1026 |
> |
if (display_open) { |
1027 |
> |
memset(the_buffer, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); |
1028 |
> |
memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); |
1029 |
> |
} |
1030 |
|
return display_open; |
1031 |
|
} |
1032 |
|
|
1645 |
|
#endif |
1646 |
|
|
1647 |
|
// Open window/screen |
1648 |
< |
if (!open_display()) |
1648 |
> |
if (!open_display()) { |
1649 |
> |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
1650 |
|
return false; |
1651 |
+ |
} |
1652 |
|
|
1653 |
|
#if 0 |
1654 |
|
// Ignore errors from now on |
2549 |
|
} |
2550 |
|
return NULL; |
2551 |
|
} |
2552 |
+ |
|
2553 |
+ |
|
2554 |
+ |
/* |
2555 |
+ |
* Record dirty area from NQD |
2556 |
+ |
*/ |
2557 |
+ |
|
2558 |
+ |
void video_set_dirty_area(int x, int y, int w, int h) |
2559 |
+ |
{ |
2560 |
+ |
// TBD |
2561 |
+ |
} |