mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
more OSD and DETA fixes
This commit is contained in:
parent
1aa7c1a998
commit
4f889f991d
47
video.c
47
video.c
@ -1017,7 +1017,7 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContex
|
|||||||
|
|
||||||
// set glx context
|
// set glx context
|
||||||
if (!glXMakeCurrent(XlibDisplay, window, context)) {
|
if (!glXMakeCurrent(XlibDisplay, window, context)) {
|
||||||
Error(_("video/glx: can't make glx context current\n"));
|
Fatal(_("video/glx: can't make glx context current\n"));
|
||||||
GlxEnabled = 0;
|
GlxEnabled = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1314,9 +1314,6 @@ static void GlxExit(void)
|
|||||||
}
|
}
|
||||||
if (GlxThreadContext) {
|
if (GlxThreadContext) {
|
||||||
glXDestroyContext(XlibDisplay, GlxThreadContext);
|
glXDestroyContext(XlibDisplay, GlxThreadContext);
|
||||||
}
|
|
||||||
if (OSDcontext) {
|
|
||||||
glXDestroyContext(XlibDisplay, OSDcontext);
|
|
||||||
}
|
}
|
||||||
// FIXME: must free GlxVisualInfo
|
// FIXME: must free GlxVisualInfo
|
||||||
}
|
}
|
||||||
@ -1753,7 +1750,10 @@ static void CuvidDestroySurfaces(CuvidDecoder * decoder)
|
|||||||
CUdeviceptr d;
|
CUdeviceptr d;
|
||||||
|
|
||||||
Debug(3, "video/cuvid: %s\n", __FUNCTION__);
|
Debug(3, "video/cuvid: %s\n", __FUNCTION__);
|
||||||
|
|
||||||
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
|
||||||
|
GlxCheck();
|
||||||
|
|
||||||
glDeleteBuffers(1,(GLuint *)&vao_buffer);
|
glDeleteBuffers(1,(GLuint *)&vao_buffer);
|
||||||
|
|
||||||
if (decoder->cuda_ctx) {
|
if (decoder->cuda_ctx) {
|
||||||
@ -1968,8 +1968,7 @@ static void CuvidDelHwDecoder(CuvidDecoder * decoder)
|
|||||||
{
|
{
|
||||||
int i,n;
|
int i,n;
|
||||||
Debug(3,"cuvid del hw decoder cuda_ctx %p\n",decoder->cuda_ctx);
|
Debug(3,"cuvid del hw decoder cuda_ctx %p\n",decoder->cuda_ctx);
|
||||||
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
|
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
if (decoder->SurfaceFreeN || decoder->SurfaceUsedN) {
|
if (decoder->SurfaceFreeN || decoder->SurfaceUsedN) {
|
||||||
CuvidDestroySurfaces(decoder);
|
CuvidDestroySurfaces(decoder);
|
||||||
@ -2065,7 +2064,8 @@ createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned i
|
|||||||
|
|
||||||
int n,i;
|
int n,i;
|
||||||
CUcontext dummy;
|
CUcontext dummy;
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
// glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
||||||
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
|
|
||||||
glGenBuffers(1,&vao_buffer);
|
glGenBuffers(1,&vao_buffer);
|
||||||
@ -3101,8 +3101,8 @@ static void CuvidDisplayFrame(void)
|
|||||||
int filled;
|
int filled;
|
||||||
CuvidDecoder *decoder;
|
CuvidDecoder *decoder;
|
||||||
|
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
// glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
||||||
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
|
||||||
glXWaitVideoSyncSGI (2, (Count + 1) % 2, &Count); // wait for previous frame to swap
|
glXWaitVideoSyncSGI (2, (Count + 1) % 2, &Count); // wait for previous frame to swap
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
//
|
//
|
||||||
@ -3147,8 +3147,8 @@ static void CuvidDisplayFrame(void)
|
|||||||
GlxRenderTexture(OSDtexture, 0,0, VideoWindowWidth, VideoWindowHeight);
|
GlxRenderTexture(OSDtexture, 0,0, VideoWindowWidth, VideoWindowHeight);
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
#endif
|
#endif
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
// glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
||||||
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
glXGetVideoSyncSGI (&Count); // get current frame
|
glXGetVideoSyncSGI (&Count); // get current frame
|
||||||
@ -5594,21 +5594,18 @@ void VideoExit(void)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef USE_VIDEO_THREAD
|
#ifdef USE_VIDEO_THREAD
|
||||||
VideoThreadExit();
|
VideoThreadExit(); // destroy all mutexes
|
||||||
// CUVID cleanup hangs in XLockDisplay every 100 exits
|
|
||||||
// XUnlockDisplay(XlibDisplay);
|
|
||||||
// xcb_flush(Connection);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_GLX
|
#ifdef USE_GLX
|
||||||
if (GlxEnabled) {
|
if (GlxEnabled) {
|
||||||
GlxExit();
|
GlxExit(); // delete all contexts
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//
|
//
|
||||||
// FIXME: cleanup.
|
// FIXME: cleanup.
|
||||||
//
|
//
|
||||||
//RandrExit();
|
//RandrExit();
|
||||||
pthread_mutex_lock(&OSDMutex);
|
|
||||||
//
|
//
|
||||||
// X11/xcb cleanup
|
// X11/xcb cleanup
|
||||||
//
|
//
|
||||||
@ -5635,32 +5632,35 @@ void VideoExit(void)
|
|||||||
}
|
}
|
||||||
XlibDisplay = NULL;
|
XlibDisplay = NULL;
|
||||||
Connection = 0;
|
Connection = 0;
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GlxInitopengl() {
|
int GlxInitopengl() {
|
||||||
|
|
||||||
while (GlxSharedContext == NULL) {
|
while (GlxSharedContext == NULL || GlxContext == NULL) {
|
||||||
sleep(1); // wait until Init from video thread is ready
|
sleep(1); // wait until Init from video thread is ready
|
||||||
// printf("GlxConext %p\n",GlxSharedContext);
|
// printf("GlxConext %p\n",GlxSharedContext);
|
||||||
}
|
}
|
||||||
glXMakeCurrent(XlibDisplay, None, NULL);
|
|
||||||
OSDcontext = glXCreateContext(XlibDisplay, GlxVisualInfo, GlxSharedContext,GL_TRUE);
|
OSDcontext = glXCreateContext(XlibDisplay, GlxVisualInfo, GlxSharedContext,GL_TRUE);
|
||||||
if (!OSDcontext) {
|
if (!OSDcontext) {
|
||||||
Debug(3,"video/osd: can't create glx context\n");
|
Debug(3,"video/osd: can't create glx context\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Debug(3,"Create OSD GLX context\n");
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, OSDcontext);
|
glXMakeCurrent(XlibDisplay, VideoWindow, OSDcontext);
|
||||||
|
#if 0
|
||||||
glViewport(0, 0, VideoWindowWidth, VideoWindowHeight);
|
glViewport(0, 0, VideoWindowWidth, VideoWindowHeight);
|
||||||
glDepthRange(-1.0, 1.0);
|
glDepthRange(-1.0, 1.0);
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
glClearDepth(1.0);
|
glClearDepth(1.0);
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
if (glewInit())
|
|
||||||
Fatal(_("glewinit failed\n"));
|
// if (glewInit())
|
||||||
|
// Fatal(_("glewinit failed\n"));
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
@ -5671,6 +5671,7 @@ int GlxInitopengl() {
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST); // setup 2d drawing
|
glDisable(GL_DEPTH_TEST); // setup 2d drawing
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user