[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: don't call vlc_window_ReportSize from QML context
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Wed Jun 22 09:53:48 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
721a085d by Pierre Lamot at 2022-06-22T09:39:06+00:00
qt: don't call vlc_window_ReportSize from QML context
QML will have an OpenGL context enabled, and the vout display may mess with it
while resizing
fix regression from d0836b1088bb00760f37f270fb4116b195d3ae93
- - - - -
e30bc095 by Pierre Lamot at 2022-06-22T09:39:06+00:00
glx: restore previous context during resizes
also perform x11 resize when the makeCurrent fails
Co-authored-by: Jeffrey Knockel <jeff at jeffreyknockel.com>
- - - - -
88067fb5 by Pierre Lamot at 2022-06-22T09:39:06+00:00
egl: restore previous context during resizes
also perform x11 resize when the makeCurrent fails
Co-authored-by: Jeffrey Knockel <jeff at jeffreyknockel.com>
- - - - -
3 changed files:
- modules/gui/qt/maininterface/videosurface.cpp
- modules/video_output/glx.c
- modules/video_output/opengl/egl.c
Changes:
=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -275,7 +275,7 @@ QSGNode*VideoSurface::updatePaintNode(QSGNode* oldNode, QQuickItem::UpdatePaintN
connect(this, &VideoSurface::mouseReleased, m_provider, &VideoSurfaceProvider::onMouseReleased);
connect(this, &VideoSurface::mouseWheeled, m_provider, &VideoSurfaceProvider::onMouseWheeled);
connect(this, &VideoSurface::keyPressed, m_provider, &VideoSurfaceProvider::onKeyPressed);
- connect(this, &VideoSurface::surfaceSizeChanged, m_provider, &VideoSurfaceProvider::onSurfaceSizeChanged);
+ connect(this, &VideoSurface::surfaceSizeChanged, m_provider, &VideoSurfaceProvider::onSurfaceSizeChanged, Qt::QueuedConnection);
connect(this, &VideoSurface::surfacePositionChanged, m_provider, &VideoSurfaceProvider::surfacePositionChanged);
connect(m_provider, &VideoSurfaceProvider::hasVideoEmbedChanged, this, &VideoSurface::onProviderVideoChanged);
=====================================
modules/video_output/glx.c
=====================================
@@ -67,16 +67,27 @@ static void Resize (vlc_gl_t *gl, unsigned width, unsigned height)
{
vlc_gl_sys_t *sys = gl->sys;
- if (MakeCurrent(gl) == VLC_SUCCESS) {
+ Display* old_display = glXGetCurrentDisplay();
+ GLXContext old_ctx = glXGetCurrentContext();
+ GLXDrawable old_draw = glXGetCurrentDrawable();
+ GLXDrawable old_read = glXGetCurrentReadDrawable();
+
+ Bool made_current = glXMakeContextCurrent (sys->display, sys->win, sys->win, sys->ctx);
+ if (made_current)
glXWaitGL();
- unsigned long init_serial = LastKnownRequestProcessed(sys->display);
- unsigned long resize_serial = NextRequest(sys->display);
- XResizeWindow(sys->display, sys->x11_win, width, height);
+ unsigned long init_serial = LastKnownRequestProcessed(sys->display);
+ unsigned long resize_serial = NextRequest(sys->display);
+ XResizeWindow(sys->display, sys->x11_win, width, height);
+ if (made_current)
+ {
glXWaitX();
- if (LastKnownRequestProcessed(sys->display) - init_serial < resize_serial - init_serial)
- XSync(sys->display, False);
- ReleaseCurrent(gl);
+ if (old_display)
+ glXMakeContextCurrent(old_display, old_draw, old_read, old_ctx);
+ else
+ glXMakeContextCurrent(sys->display, None, None, NULL);
}
+ if (LastKnownRequestProcessed(sys->display) - init_serial < resize_serial - init_serial)
+ XSync(sys->display, False);
}
static void SwapBuffers (vlc_gl_t *gl)
=====================================
modules/video_output/opengl/egl.c
=====================================
@@ -201,17 +201,30 @@ static void Resize (vlc_gl_t *gl, unsigned width, unsigned height)
vlc_gl_sys_t *sys = gl->sys;
EGLint val;
- if (MakeCurrent(gl) == VLC_SUCCESS) {
+ EGLDisplay old_display = eglGetCurrentDisplay();
+ EGLSurface old_draw = eglGetCurrentSurface(EGL_DRAW);
+ EGLSurface old_read = eglGetCurrentSurface(EGL_READ);
+ EGLContext old_ctx = eglGetCurrentContext();
+
+ bool made_current = eglMakeCurrent(sys->display, sys->surface, sys->surface, sys->context);
+ if (made_current)
eglWaitClient();
- unsigned long init_serial = LastKnownRequestProcessed(sys->x11);
- unsigned long resize_serial = NextRequest(sys->x11);
- XResizeWindow(sys->x11, sys->x11_win, width, height);
+
+ unsigned long init_serial = LastKnownRequestProcessed(sys->x11);
+ unsigned long resize_serial = NextRequest(sys->x11);
+ XResizeWindow(sys->x11, sys->x11_win, width, height);
+
+ if (made_current)
+ {
eglQuerySurface(sys->display, sys->surface, EGL_HEIGHT, &val); /* force Mesa to see new size in time for next draw */
eglWaitNative(EGL_CORE_NATIVE_ENGINE);
- if (LastKnownRequestProcessed(sys->x11) - init_serial < resize_serial - init_serial)
- XSync(sys->x11, False);
- ReleaseCurrent(gl);
+ if (old_display != EGL_NO_DISPLAY)
+ eglMakeCurrent(old_display, old_draw, old_read, old_ctx);
+ else
+ eglMakeCurrent(sys->display, NULL, NULL, NULL);
}
+ if (LastKnownRequestProcessed(sys->x11) - init_serial < resize_serial - init_serial)
+ XSync(sys->x11, False);
}
static void DestroySurface(vlc_gl_t *gl)
@@ -338,16 +351,29 @@ static void Resize (vlc_gl_t *gl, unsigned width, unsigned height)
vlc_gl_sys_t *sys = gl->sys;
EGLint val;
- if (MakeCurrent(gl) == VLC_SUCCESS) {
+ EGLDisplay old_display = eglGetCurrentDisplay();
+ EGLSurface old_draw = eglGetCurrentSurface(EGL_DRAW);
+ EGLSurface old_read = eglGetCurrentSurface(EGL_READ);
+ EGLContext old_ctx = eglGetCurrentContext();
+
+ bool made_current = eglMakeCurrent(sys->display, sys->surface, sys->surface, sys->context);
+ if (made_current)
eglWaitClient();
- uint16_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
- const uint32_t values[] = { width, height };
- xcb_void_cookie_t cookie = xcb_configure_window_checked(sys->conn, sys->xcb_win, mask, values);
+
+ uint16_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ const uint32_t values[] = { width, height };
+ xcb_void_cookie_t cookie = xcb_configure_window_checked(sys->conn, sys->xcb_win, mask, values);
+
+ if (made_current)
+ {
eglQuerySurface(sys->display, sys->surface, EGL_HEIGHT, &val); /* force Mesa to see new size in time for next draw */
eglWaitNative(EGL_CORE_NATIVE_ENGINE);
- free(xcb_request_check(sys->conn, cookie));
- ReleaseCurrent(gl);
+ if (old_display != EGL_NO_DISPLAY)
+ eglMakeCurrent(old_display, old_draw, old_read, old_ctx);
+ else
+ eglMakeCurrent(sys->display, NULL, NULL, NULL);
}
+ free(xcb_request_check(sys->conn, cookie));
}
static void DestroySurface(vlc_gl_t *gl)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/73a248c0592c0793709303bc451eb26d2e2c9408...88067fb5bf078dc6af0908f5e80f4f53b1f5a3da
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/73a248c0592c0793709303bc451eb26d2e2c9408...88067fb5bf078dc6af0908f5e80f4f53b1f5a3da
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list