summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2013-04-17 16:35:51 +0200
committerJohns <johns98@gmx.net>2013-04-17 16:35:51 +0200
commit7a5e696bc483d01d4d3059b290a912cf9134bb6e (patch)
tree8b38188ac77611dd1ecf0a6056542e177744d37b
parent8f99f80d44dc410dfbc1e026425e7debd7345e27 (diff)
downloadvdr-plugin-softhddevice-7a5e696bc483d01d4d3059b290a912cf9134bb6e.tar.gz
vdr-plugin-softhddevice-7a5e696bc483d01d4d3059b290a912cf9134bb6e.tar.bz2
Fix opengl and opengl threads bugs.
-rw-r--r--ChangeLog1
-rw-r--r--vdr-softhddevice-9999.ebuild4
-rw-r--r--video.c67
3 files changed, 55 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index a4ddb28..5400eb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
User johns
Date:
+ Fix opengl and opengl threads bugs.
Initial opengl support with va-api only.
Fix "broken driver" message if empty ring buffer.
Enable seamless audio track change.
diff --git a/vdr-softhddevice-9999.ebuild b/vdr-softhddevice-9999.ebuild
index 85871d9..2365a52 100644
--- a/vdr-softhddevice-9999.ebuild
+++ b/vdr-softhddevice-9999.ebuild
@@ -20,7 +20,7 @@ HOMEPAGE="http://projects.vdr-developer.org/projects/show/plg-softhddevice"
LICENSE="AGPL-3"
SLOT="0"
-IUSE="alsa oss vaapi vdpau yaepg xscreensaver debug"
+IUSE="alsa oss vaapi vdpau opengl yaepg xscreensaver debug"
RDEPEND=">=media-video/vdr-1.7
>=virtual/ffmpeg-0.7[vdpau?,vaapi?]
@@ -30,6 +30,7 @@ RDEPEND=">=media-video/vdr-1.7
alsa? ( media-libs/alsa-lib )
vdpau? ( x11-libs/libvdpau )
vaapi? ( x11-libs/libva )
+ opengl? ( virtual/opengl )
alsa? ( media-libs/alsa-lib )
yaepg? ( >=media-video/vdr-1.7[yaepg] )"
DEPEND="${RDEPEND}
@@ -44,6 +45,7 @@ src_compile() {
myconf+=" ALSA=$(usex alsa 1 0)"
myconf+=" OSS=$(usex oss 1 0)"
myconf+=" VDPAU=$(usex vdpau 1 0)"
+ myconf+=" OPENGL=$(usex opengl 1 0)"
myconf+=" VAAPI=$(usex vaapi 1 0)"
myconf+=" SCREENSAVER=$(usex xscreensaver 1 0)"
if has_version ">=media-video/ffmpeg-0.8" ; then
diff --git a/video.c b/video.c
index 0c86c9d..b742573 100644
--- a/video.c
+++ b/video.c
@@ -92,7 +92,9 @@
#include <xcb/xcb.h>
//#include <xcb/bigreq.h>
-//#include <xcb/glx.h>
+#ifdef xcb_USE_GLX
+#include <xcb/glx.h>
+#endif
//#include <xcb/randr.h>
#ifdef USE_SCREENSAVER
#include <xcb/screensaver.h>
@@ -2560,6 +2562,11 @@ static void VaapiSetup(VaapiDecoder * decoder,
//
// update OSD associate
//
+#ifdef USE_GLX
+ if (GlxEnabled) {
+ return;
+ }
+#endif
VaapiAssociate(decoder);
}
@@ -3366,6 +3373,12 @@ static void VaapiBlackSurface(VaapiDecoder * decoder)
uint32_t sync;
uint32_t put1;
+#ifdef USE_GLX
+ if (GlxEnabled) { // already done
+ return;
+ }
+#endif
+
// wait until we have osd subpicture
if (VaOsdSubpicture == VA_INVALID_ID) {
Warning(_("video/vaapi: no osd subpicture yet\n"));
@@ -4721,19 +4734,21 @@ static void VaapiDisplayFrame(void)
}
#ifdef USE_GLX
- //
- // add OSD
- //
- if (OsdShown) {
- GlxRenderTexture(OsdGlTextures[OsdIndex], 0, 0, VideoWindowWidth,
- VideoWindowHeight);
- // FIXME: toggle osd
+ if (GlxEnabled) {
+ //
+ // add OSD
+ //
+ if (OsdShown) {
+ GlxRenderTexture(OsdGlTextures[OsdIndex], 0, 0, VideoWindowWidth,
+ VideoWindowHeight);
+ // FIXME: toggle osd
+ }
+ //glFinish();
+ glXSwapBuffers(XlibDisplay, VideoWindow);
+ GlxCheck();
+ //glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
}
- //glFinish();
- glXSwapBuffers(XlibDisplay, VideoWindow);
- GlxCheck();
- glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
- glClear(GL_COLOR_BUFFER_BIT);
#endif
}
@@ -9369,7 +9384,9 @@ static void VideoEvent(void)
char buf[64];
uint32_t values[1];
+ VideoThreadLock();
XNextEvent(XlibDisplay, &event);
+ VideoThreadUnlock();
switch (event.type) {
case ClientMessage:
Debug(3, "video/event: ClientMessage\n");
@@ -9382,8 +9399,10 @@ static void VideoEvent(void)
case MapNotify:
Debug(3, "video/event: MapNotify\n");
// µwm workaround
+ VideoThreadLock();
xcb_change_window_attributes(Connection, VideoWindow,
XCB_CW_CURSOR, &VideoBlankCursor);
+ VideoThreadUnlock();
VideoBlankTick = 0;
break;
case Expose:
@@ -9401,13 +9420,17 @@ static void VideoEvent(void)
VideoSetFullscreen(-1);
break;
case KeyPress:
+ VideoThreadLock();
XLookupString(&event.xkey, buf, sizeof(buf), &keysym, NULL);
+ VideoThreadUnlock();
if (keysym == NoSymbol) {
Warning(_("video/event: No symbol for %d\n"),
event.xkey.keycode);
break;
}
+ VideoThreadLock();
keynam = XKeysymToString(keysym);
+ VideoThreadUnlock();
// check for key modifiers (Alt/Ctrl)
if (event.xkey.state & (Mod1Mask | ControlMask)) {
if (event.xkey.state & Mod1Mask) {
@@ -9427,8 +9450,10 @@ static void VideoEvent(void)
break;
case MotionNotify:
values[0] = XCB_NONE;
+ VideoThreadLock();
xcb_change_window_attributes(Connection, VideoWindow,
XCB_CW_CURSOR, values);
+ VideoThreadUnlock();
VideoBlankTick = GetMsTicks();
break;
default:
@@ -9450,11 +9475,19 @@ void VideoPollEvent(void)
// hide cursor, after xx ms
if (VideoBlankTick && VideoWindow != XCB_NONE
&& VideoBlankTick + 200 < GetMsTicks()) {
+ VideoThreadLock();
xcb_change_window_attributes(Connection, VideoWindow, XCB_CW_CURSOR,
&VideoBlankCursor);
+ VideoThreadUnlock();
VideoBlankTick = 0;
}
- while (XlibDisplay && XPending(XlibDisplay)) {
+ while (XlibDisplay) {
+ VideoThreadLock();
+ if (!XPending(XlibDisplay)) {
+ VideoThreadUnlock();
+ break;
+ }
+ VideoThreadUnlock();
VideoEvent();
}
}
@@ -10901,7 +10934,7 @@ void VideoInit(const char *display_name)
// FIXME: we need to retry connection
return;
}
-#ifdef USE_GLX_doesn_t_help_still_crash
+#ifdef USE_GLX_not_needed_done_with_locks
if (!XInitThreads()) {
Error(_("video: Can't initialize X11 thread support on '%s'\n"),
display_name);
@@ -10918,7 +10951,9 @@ void VideoInit(const char *display_name)
}
// prefetch extensions
//xcb_prefetch_extension_data(Connection, &xcb_big_requests_id);
- //xcb_prefetch_extension_data(Connection, &xcb_glx_id);
+#ifdef xcb_USE_GLX
+ xcb_prefetch_extension_data(Connection, &xcb_glx_id);
+#endif
//xcb_prefetch_extension_data(Connection, &xcb_randr_id);
#ifdef USE_SCREENSAVER
xcb_prefetch_extension_data(Connection, &xcb_screensaver_id);