Re: [AD] X11 unresponsiveness and vsync |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Here's an update patch. I cleaned up the XLOCK and XUNLOCK defines so
they define to slightly different things instead of relying on an if()
statement. I also use it to seperate my signal delay fix away from the
multithreaded version.
As well, I'm experimenting with remving the XSync call from vsync.
AFAICT, the XSync call doesn't do anything for vsync other than simulate
a delay, which the retrace_count wait loop seems to provide fine.
Remember to apply it to the version without my previous patch or Elias's.
- Kitty Cat
--- aintunix.h 2003-02-07 05:29:06.000000000 -0800
+++ aintunix.h 2004-07-12 23:44:33.000000000 -0700
@@ -85,26 +85,46 @@
AL_FUNC(void, _xwin_handle_input, (void));
+#ifndef ALLEGRO_MULTITHREADED
+
+ AL_VAR(int, _xwin_missed_input);
+
#define XLOCK() \
do { \
- if (_unix_bg_man->multi_threaded) { \
- if (_xwin.display) \
- XLockDisplay(_xwin.display); \
- } \
_xwin.lock_count++; \
} while (0)
#define XUNLOCK() \
do { \
- if (_unix_bg_man->multi_threaded) { \
- if (_xwin.display) \
- XUnlockDisplay(_xwin.display); \
+ _xwin.lock_count--; \
+ if (_xwin.lock_count == 0) { \
+ while(_xwin_missed_input) { \
+ _xwin_handle_input(); \
+ --_xwin_missed_input; \
+ } \
} \
+ } while (0)
+
+#else
+
+ #define XLOCK() \
+ do { \
+ if (_xwin.display) \
+ XLockDisplay(_xwin.display); \
+ _xwin.lock_count++; \
+ } while (0)
+
+ #define XUNLOCK() \
+ do { \
+ if (_xwin.display) \
+ XUnlockDisplay(_xwin.display); \
_xwin.lock_count--; \
} while (0)
#endif
+#endif
+
#ifdef DIGI_OSS
/* So the setup program can read what we detected */
--- xwin.c 2004-07-11 03:33:10.000000000 -0700
+++ xwin.c 2004-07-12 22:47:38.000000000 -0700
@@ -139,6 +139,10 @@
NULL /* window close hook */
};
+#ifndef ALLEGRO_MULTITHREADED
+int _xwin_missed_input;
+#endif
+
void *allegro_icon = alex_xpm;
int _xwin_last_line = -1;
@@ -2092,13 +2096,13 @@
void _xwin_vsync(void)
{
- XLOCK();
+ int prev = retrace_count;
+
+/* XLOCK();
_xwin_private_vsync();
- XUNLOCK();
+ XUNLOCK();*/
if (_timer_installed) {
- int prev = retrace_count;
-
do {
} while (retrace_count == prev);
}
@@ -2434,7 +2438,12 @@
void _xwin_handle_input(void)
{
- if (_xwin.lock_count) return;
+#ifndef ALLEGRO_MULTITHREADED
+ if (_xwin.lock_count) {
+ ++_xwin_missed_input;
+ return;
+ }
+#endif
XLOCK();