summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2017-12-23 19:25:35 +0300
committerDmitry Osipenko <digetx@gmail.com>2017-12-26 20:49:18 +0300
commitcd7b8656e81bfa8bf9f101f013863ebd206b8bf9 (patch)
treec94f31dc2267308e82a855a3387454633db2644c
parent92ca3fb4547319b9f79dd2f9a1e6276d2f066142 (diff)
Detect X11 threading presence
-rw-r--r--src/presentation_queue.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/presentation_queue.c b/src/presentation_queue.c
index 184d095..7181e1a 100644
--- a/src/presentation_queue.c
+++ b/src/presentation_queue.c
@@ -312,11 +312,7 @@ VdpStatus vdp_presentation_queue_create(
pthread_attr_destroy(&thread_attrs);
- /*
- * XXX: Unfortunately this doesn't work with MPlayer. Any player that
- * doesn't invoke XInitThreads() may crash.
- */
- if (0) {
+ if (_Xglobal_lock) {
pthread_attr_init(&thread_attrs);
pthread_attr_setdetachstate(&thread_attrs, PTHREAD_CREATE_JOINABLE);
@@ -360,7 +356,7 @@ VdpStatus vdp_presentation_queue_destroy(
pthread_mutex_unlock(&pq->lock);
- if (0) {
+ if (_Xglobal_lock) {
pthread_join(pq->x11_thread, NULL);
}
pthread_join(pq->disp_thread, NULL);
@@ -461,7 +457,7 @@ VdpStatus vdp_presentation_queue_display(
surf->idle_hack = false;
/* XXX: X11 app won't survive threading without XInitThreads() */
- if (earliest_presentation_time == 0) {
+ if (earliest_presentation_time == 0 || !_Xglobal_lock) {
XvPutImage(dev->display, dev->xv_port,
pqt->drawable, pqt->gc,
surf->xv_img,