mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Fix opengl and opengl threads bugs.
This commit is contained in:
parent
8f99f80d44
commit
7a5e696bc4
@ -1,6 +1,7 @@
|
|||||||
User johns
|
User johns
|
||||||
Date:
|
Date:
|
||||||
|
|
||||||
|
Fix opengl and opengl threads bugs.
|
||||||
Initial opengl support with va-api only.
|
Initial opengl support with va-api only.
|
||||||
Fix "broken driver" message if empty ring buffer.
|
Fix "broken driver" message if empty ring buffer.
|
||||||
Enable seamless audio track change.
|
Enable seamless audio track change.
|
||||||
|
@ -20,7 +20,7 @@ HOMEPAGE="http://projects.vdr-developer.org/projects/show/plg-softhddevice"
|
|||||||
|
|
||||||
LICENSE="AGPL-3"
|
LICENSE="AGPL-3"
|
||||||
SLOT="0"
|
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
|
RDEPEND=">=media-video/vdr-1.7
|
||||||
>=virtual/ffmpeg-0.7[vdpau?,vaapi?]
|
>=virtual/ffmpeg-0.7[vdpau?,vaapi?]
|
||||||
@ -30,6 +30,7 @@ RDEPEND=">=media-video/vdr-1.7
|
|||||||
alsa? ( media-libs/alsa-lib )
|
alsa? ( media-libs/alsa-lib )
|
||||||
vdpau? ( x11-libs/libvdpau )
|
vdpau? ( x11-libs/libvdpau )
|
||||||
vaapi? ( x11-libs/libva )
|
vaapi? ( x11-libs/libva )
|
||||||
|
opengl? ( virtual/opengl )
|
||||||
alsa? ( media-libs/alsa-lib )
|
alsa? ( media-libs/alsa-lib )
|
||||||
yaepg? ( >=media-video/vdr-1.7[yaepg] )"
|
yaepg? ( >=media-video/vdr-1.7[yaepg] )"
|
||||||
DEPEND="${RDEPEND}
|
DEPEND="${RDEPEND}
|
||||||
@ -44,6 +45,7 @@ src_compile() {
|
|||||||
myconf+=" ALSA=$(usex alsa 1 0)"
|
myconf+=" ALSA=$(usex alsa 1 0)"
|
||||||
myconf+=" OSS=$(usex oss 1 0)"
|
myconf+=" OSS=$(usex oss 1 0)"
|
||||||
myconf+=" VDPAU=$(usex vdpau 1 0)"
|
myconf+=" VDPAU=$(usex vdpau 1 0)"
|
||||||
|
myconf+=" OPENGL=$(usex opengl 1 0)"
|
||||||
myconf+=" VAAPI=$(usex vaapi 1 0)"
|
myconf+=" VAAPI=$(usex vaapi 1 0)"
|
||||||
myconf+=" SCREENSAVER=$(usex xscreensaver 1 0)"
|
myconf+=" SCREENSAVER=$(usex xscreensaver 1 0)"
|
||||||
if has_version ">=media-video/ffmpeg-0.8" ; then
|
if has_version ">=media-video/ffmpeg-0.8" ; then
|
||||||
|
45
video.c
45
video.c
@ -92,7 +92,9 @@
|
|||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
//#include <xcb/bigreq.h>
|
//#include <xcb/bigreq.h>
|
||||||
//#include <xcb/glx.h>
|
#ifdef xcb_USE_GLX
|
||||||
|
#include <xcb/glx.h>
|
||||||
|
#endif
|
||||||
//#include <xcb/randr.h>
|
//#include <xcb/randr.h>
|
||||||
#ifdef USE_SCREENSAVER
|
#ifdef USE_SCREENSAVER
|
||||||
#include <xcb/screensaver.h>
|
#include <xcb/screensaver.h>
|
||||||
@ -2560,6 +2562,11 @@ static void VaapiSetup(VaapiDecoder * decoder,
|
|||||||
//
|
//
|
||||||
// update OSD associate
|
// update OSD associate
|
||||||
//
|
//
|
||||||
|
#ifdef USE_GLX
|
||||||
|
if (GlxEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
VaapiAssociate(decoder);
|
VaapiAssociate(decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3366,6 +3373,12 @@ static void VaapiBlackSurface(VaapiDecoder * decoder)
|
|||||||
uint32_t sync;
|
uint32_t sync;
|
||||||
uint32_t put1;
|
uint32_t put1;
|
||||||
|
|
||||||
|
#ifdef USE_GLX
|
||||||
|
if (GlxEnabled) { // already done
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// wait until we have osd subpicture
|
// wait until we have osd subpicture
|
||||||
if (VaOsdSubpicture == VA_INVALID_ID) {
|
if (VaOsdSubpicture == VA_INVALID_ID) {
|
||||||
Warning(_("video/vaapi: no osd subpicture yet\n"));
|
Warning(_("video/vaapi: no osd subpicture yet\n"));
|
||||||
@ -4721,6 +4734,7 @@ static void VaapiDisplayFrame(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_GLX
|
#ifdef USE_GLX
|
||||||
|
if (GlxEnabled) {
|
||||||
//
|
//
|
||||||
// add OSD
|
// add OSD
|
||||||
//
|
//
|
||||||
@ -4732,8 +4746,9 @@ static void VaapiDisplayFrame(void)
|
|||||||
//glFinish();
|
//glFinish();
|
||||||
glXSwapBuffers(XlibDisplay, VideoWindow);
|
glXSwapBuffers(XlibDisplay, VideoWindow);
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
|
//glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9369,7 +9384,9 @@ static void VideoEvent(void)
|
|||||||
char buf[64];
|
char buf[64];
|
||||||
uint32_t values[1];
|
uint32_t values[1];
|
||||||
|
|
||||||
|
VideoThreadLock();
|
||||||
XNextEvent(XlibDisplay, &event);
|
XNextEvent(XlibDisplay, &event);
|
||||||
|
VideoThreadUnlock();
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
Debug(3, "video/event: ClientMessage\n");
|
Debug(3, "video/event: ClientMessage\n");
|
||||||
@ -9382,8 +9399,10 @@ static void VideoEvent(void)
|
|||||||
case MapNotify:
|
case MapNotify:
|
||||||
Debug(3, "video/event: MapNotify\n");
|
Debug(3, "video/event: MapNotify\n");
|
||||||
// µwm workaround
|
// µwm workaround
|
||||||
|
VideoThreadLock();
|
||||||
xcb_change_window_attributes(Connection, VideoWindow,
|
xcb_change_window_attributes(Connection, VideoWindow,
|
||||||
XCB_CW_CURSOR, &VideoBlankCursor);
|
XCB_CW_CURSOR, &VideoBlankCursor);
|
||||||
|
VideoThreadUnlock();
|
||||||
VideoBlankTick = 0;
|
VideoBlankTick = 0;
|
||||||
break;
|
break;
|
||||||
case Expose:
|
case Expose:
|
||||||
@ -9401,13 +9420,17 @@ static void VideoEvent(void)
|
|||||||
VideoSetFullscreen(-1);
|
VideoSetFullscreen(-1);
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
|
VideoThreadLock();
|
||||||
XLookupString(&event.xkey, buf, sizeof(buf), &keysym, NULL);
|
XLookupString(&event.xkey, buf, sizeof(buf), &keysym, NULL);
|
||||||
|
VideoThreadUnlock();
|
||||||
if (keysym == NoSymbol) {
|
if (keysym == NoSymbol) {
|
||||||
Warning(_("video/event: No symbol for %d\n"),
|
Warning(_("video/event: No symbol for %d\n"),
|
||||||
event.xkey.keycode);
|
event.xkey.keycode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
VideoThreadLock();
|
||||||
keynam = XKeysymToString(keysym);
|
keynam = XKeysymToString(keysym);
|
||||||
|
VideoThreadUnlock();
|
||||||
// check for key modifiers (Alt/Ctrl)
|
// check for key modifiers (Alt/Ctrl)
|
||||||
if (event.xkey.state & (Mod1Mask | ControlMask)) {
|
if (event.xkey.state & (Mod1Mask | ControlMask)) {
|
||||||
if (event.xkey.state & Mod1Mask) {
|
if (event.xkey.state & Mod1Mask) {
|
||||||
@ -9427,8 +9450,10 @@ static void VideoEvent(void)
|
|||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
values[0] = XCB_NONE;
|
values[0] = XCB_NONE;
|
||||||
|
VideoThreadLock();
|
||||||
xcb_change_window_attributes(Connection, VideoWindow,
|
xcb_change_window_attributes(Connection, VideoWindow,
|
||||||
XCB_CW_CURSOR, values);
|
XCB_CW_CURSOR, values);
|
||||||
|
VideoThreadUnlock();
|
||||||
VideoBlankTick = GetMsTicks();
|
VideoBlankTick = GetMsTicks();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -9450,11 +9475,19 @@ void VideoPollEvent(void)
|
|||||||
// hide cursor, after xx ms
|
// hide cursor, after xx ms
|
||||||
if (VideoBlankTick && VideoWindow != XCB_NONE
|
if (VideoBlankTick && VideoWindow != XCB_NONE
|
||||||
&& VideoBlankTick + 200 < GetMsTicks()) {
|
&& VideoBlankTick + 200 < GetMsTicks()) {
|
||||||
|
VideoThreadLock();
|
||||||
xcb_change_window_attributes(Connection, VideoWindow, XCB_CW_CURSOR,
|
xcb_change_window_attributes(Connection, VideoWindow, XCB_CW_CURSOR,
|
||||||
&VideoBlankCursor);
|
&VideoBlankCursor);
|
||||||
|
VideoThreadUnlock();
|
||||||
VideoBlankTick = 0;
|
VideoBlankTick = 0;
|
||||||
}
|
}
|
||||||
while (XlibDisplay && XPending(XlibDisplay)) {
|
while (XlibDisplay) {
|
||||||
|
VideoThreadLock();
|
||||||
|
if (!XPending(XlibDisplay)) {
|
||||||
|
VideoThreadUnlock();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
VideoThreadUnlock();
|
||||||
VideoEvent();
|
VideoEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10901,7 +10934,7 @@ void VideoInit(const char *display_name)
|
|||||||
// FIXME: we need to retry connection
|
// FIXME: we need to retry connection
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef USE_GLX_doesn_t_help_still_crash
|
#ifdef USE_GLX_not_needed_done_with_locks
|
||||||
if (!XInitThreads()) {
|
if (!XInitThreads()) {
|
||||||
Error(_("video: Can't initialize X11 thread support on '%s'\n"),
|
Error(_("video: Can't initialize X11 thread support on '%s'\n"),
|
||||||
display_name);
|
display_name);
|
||||||
@ -10918,7 +10951,9 @@ void VideoInit(const char *display_name)
|
|||||||
}
|
}
|
||||||
// prefetch extensions
|
// prefetch extensions
|
||||||
//xcb_prefetch_extension_data(Connection, &xcb_big_requests_id);
|
//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);
|
//xcb_prefetch_extension_data(Connection, &xcb_randr_id);
|
||||||
#ifdef USE_SCREENSAVER
|
#ifdef USE_SCREENSAVER
|
||||||
xcb_prefetch_extension_data(Connection, &xcb_screensaver_id);
|
xcb_prefetch_extension_data(Connection, &xcb_screensaver_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user