Fix cuvid without placebo

This commit is contained in:
jojo61 2019-12-17 10:22:22 +01:00
parent d2dedb40dd
commit 4334894515
1 changed files with 21 additions and 34 deletions

55
video.c
View File

@ -489,9 +489,9 @@ static int GlxVSyncEnabled = 1; ///< enable/disable v-sync
static GLXContext glxSharedContext; ///< shared gl context static GLXContext glxSharedContext; ///< shared gl context
static GLXContext glxContext; ///< our gl context static GLXContext glxContext; ///< our gl context
#ifdef USE_VIDEO_THREAD
static GLXContext glxThreadContext; ///< our gl context for the thread static GLXContext glxThreadContext; ///< our gl context for the thread
#endif
static XVisualInfo *GlxVisualInfo; ///< our gl visual static XVisualInfo *GlxVisualInfo; ///< our gl visual
static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContext context); static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContext context);
GLXContext OSDcontext; GLXContext OSDcontext;
@ -513,9 +513,8 @@ PFNEGLWAITSYNCKHRPROC eglWaitSyncKHR;
PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR; PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
PFNEGLDUPNATIVEFENCEFDANDROIDPROC eglDupNativeFenceFDANDROID; PFNEGLDUPNATIVEFENCEFDANDROIDPROC eglDupNativeFenceFDANDROID;
#ifdef USE_VIDEO_THREAD
static EGLContext eglThreadContext; ///< our gl context for the thread static EGLContext eglThreadContext; ///< our gl context for the thread
#endif
static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContext context); static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContext context);
EGLContext OSDcontext; EGLContext OSDcontext;
#endif #endif
@ -3963,7 +3962,7 @@ static void CuvidDisplayFrame(void)
glUseProgram(0); glUseProgram(0);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglThreadContext); // eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglThreadContext);
} }
#endif #endif
@ -5123,30 +5122,8 @@ void InitPlacebo()
/// ///
static void *VideoDisplayHandlerThread(void *dummy) static void *VideoDisplayHandlerThread(void *dummy)
{ {
#ifdef CUVID
CUcontext cuda_ctx;
#endif
EGLint contextAttrs[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
};
prctl(PR_SET_NAME, "cuvid video", 0, 0, 0);
if (EglEnabled) { prctl(PR_SET_NAME, "cuvid video", 0, 0, 0);
#ifdef CUVID
glxThreadContext = glXCreateContext(XlibDisplay, GlxVisualInfo, glxSharedContext, GL_TRUE);
GlxSetupWindow(VideoWindow, VideoWindowWidth, VideoWindowHeight, glxThreadContext);
#else
#if 0
eglThreadContext = eglCreateContext(eglDisplay, eglConfig, eglSharedContext, contextAttrs);
if (!eglThreadContext) {
EglCheck();
Fatal(_("video/egl: can't create thread egl context\n"));
return NULL;
}
#endif
#endif
}
sleep(2); sleep(2);
for (;;) { for (;;) {
// fix dead-lock with CuvidExit // fix dead-lock with CuvidExit
@ -5167,19 +5144,29 @@ static void *VideoHandlerThread(void *dummy)
EGL_CONTEXT_CLIENT_VERSION, 3, EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE EGL_NONE
}; };
prctl(PR_SET_NAME, "cuvid video display", 0, 0, 0); prctl(PR_SET_NAME, "cuvid video display", 0, 0, 0);
#ifdef PLACEBO #ifdef PLACEBO
InitPlacebo(); InitPlacebo();
pthread_cleanup_push(delete_placebo, NULL); pthread_cleanup_push(delete_placebo, NULL);
#else #else
eglThreadContext = eglCreateContext(eglDisplay, eglConfig, eglSharedContext, contextAttrs); #ifdef CUVID
if (!eglThreadContext) { if (EglEnabled) {
EglCheck(); glxThreadContext = glXCreateContext(XlibDisplay, GlxVisualInfo, glxSharedContext, GL_TRUE);
Fatal(_("video/egl: can't create thread egl context\n")); GlxSetupWindow(VideoWindow, VideoWindowWidth, VideoWindowHeight, glxThreadContext);
return NULL; }
} #endif
#ifdef VAAPI
eglThreadContext = eglCreateContext(eglDisplay, eglConfig, eglSharedContext, contextAttrs);
if (!eglThreadContext) {
EglCheck();
Fatal(_("video/egl: can't create thread egl context\n"));
return NULL;
}
eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglThreadContext); eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglThreadContext);
#endif
#endif #endif
for (;;) { for (;;) {