From e9864e2e3ee64c5369238b2423a1d75480a3c6d0 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Sat, 26 Sep 2015 19:19:50 +1000 Subject: [PATCH] glwindow: remove unused draw_unlocked function The functionality is provided by draw anyway and is leftover from X11's specific threading requirements that no longer apply. --- .../gst/gl/android/gstglwindow_android_egl.c | 2 - gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m | 1 - gst-libs/gst/gl/eagl/gstglwindow_eagl.m | 1 - gst-libs/gst/gl/gstglwindow.c | 24 --------- gst-libs/gst/gl/gstglwindow.h | 3 -- .../gst/gl/wayland/gstglwindow_wayland_egl.c | 2 - gst-libs/gst/gl/win32/gstglwindow_win32.c | 1 - gst-libs/gst/gl/x11/gstglwindow_x11.c | 52 +++++++------------ 8 files changed, 20 insertions(+), 66 deletions(-) diff --git a/gst-libs/gst/gl/android/gstglwindow_android_egl.c b/gst-libs/gst/gl/android/gstglwindow_android_egl.c index 983775613d..798a80036a 100644 --- a/gst-libs/gst/gl/android/gstglwindow_android_egl.c +++ b/gst-libs/gst/gl/android/gstglwindow_android_egl.c @@ -57,8 +57,6 @@ gst_gl_window_android_egl_class_init (GstGLWindowAndroidEGLClass * klass) GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_window_handle); window_class->set_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_set_window_handle); - window_class->draw_unlocked = - GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_draw); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_draw); } diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m index 9c37e6c538..0d027c5a1a 100644 --- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m @@ -106,7 +106,6 @@ gst_gl_window_cocoa_class_init (GstGLWindowCocoaClass * klass) GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_get_window_handle); window_class->set_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_set_window_handle); - window_class->draw_unlocked = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_draw); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_draw); window_class->set_preferred_size = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_set_preferred_size); diff --git a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m index dfd889fa82..eb9d4f7f4a 100644 --- a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m +++ b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m @@ -69,7 +69,6 @@ gst_gl_window_eagl_class_init (GstGLWindowEaglClass * klass) GST_DEBUG_FUNCPTR (gst_gl_window_eagl_get_window_handle); window_class->set_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_set_window_handle); - window_class->draw_unlocked = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_draw); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_draw); window_class->set_preferred_size = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_set_preferred_size); diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index 4f27cd000a..8e049cab1d 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -209,7 +209,6 @@ gst_gl_window_class_init (GstGLWindowClass * klass) klass->close = GST_DEBUG_FUNCPTR (gst_gl_window_default_close); klass->run = GST_DEBUG_FUNCPTR (gst_gl_window_default_run); klass->quit = GST_DEBUG_FUNCPTR (gst_gl_window_default_quit); - klass->draw_unlocked = GST_DEBUG_FUNCPTR (gst_gl_window_default_draw); klass->draw = GST_DEBUG_FUNCPTR (gst_gl_window_default_draw); klass->send_message = GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message); klass->send_message_async = @@ -462,29 +461,6 @@ gst_gl_window_default_draw (GstGLWindow * window) gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window); } - -/** - * gst_gl_window_draw_unlocked: - * @window: a #GstGLWindow - * - * Redraw the window contents. Implementations should invoke the draw callback. - * - * Since: 1.4 - */ -void -gst_gl_window_draw_unlocked (GstGLWindow * window) -{ - GstGLWindowClass *window_class; - - g_return_if_fail (GST_GL_IS_WINDOW (window)); - window_class = GST_GL_WINDOW_GET_CLASS (window); - g_return_if_fail (window_class->draw_unlocked != NULL); - - window_class->draw_unlocked (window); - - window->queue_resize = FALSE; -} - /** * gst_gl_window_draw: * @window: a #GstGLWindow diff --git a/gst-libs/gst/gl/gstglwindow.h b/gst-libs/gst/gl/gstglwindow.h index e4781c7b99..a45ac5e46d 100644 --- a/gst-libs/gst/gl/gstglwindow.h +++ b/gst-libs/gst/gl/gstglwindow.h @@ -108,7 +108,6 @@ struct _GstGLWindow { * @set_window_handle: Set a window to render into * @get_window_handle: Gets the current window that this #GstGLWindow is * rendering into - * @draw_unlocked: redraw the window with the specified dimensions * @draw: redraw the window with the specified dimensions * @run: run the mainloop * @quit: send a quit to the mainloop @@ -131,7 +130,6 @@ struct _GstGLWindowClass { guintptr (*get_display) (GstGLWindow *window); void (*set_window_handle) (GstGLWindow *window, guintptr id); guintptr (*get_window_handle) (GstGLWindow *window); - void (*draw_unlocked) (GstGLWindow *window); void (*draw) (GstGLWindow *window); void (*run) (GstGLWindow *window); void (*quit) (GstGLWindow *window); @@ -216,7 +214,6 @@ void gst_gl_window_send_mouse_event (GstGLWindow * window, /* surfaces/rendering */ void gst_gl_window_queue_resize (GstGLWindow *window); -void gst_gl_window_draw_unlocked (GstGLWindow *window); void gst_gl_window_draw (GstGLWindow *window); void gst_gl_window_show (GstGLWindow *window); void gst_gl_window_set_preferred_size (GstGLWindow * window, diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c index b34ad4239b..6e1f0c5b89 100644 --- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c +++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c @@ -334,8 +334,6 @@ gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass) GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_window_handle); window_class->set_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_set_window_handle); - window_class->draw_unlocked = - GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_draw); window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_show); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_draw); window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_close); diff --git a/gst-libs/gst/gl/win32/gstglwindow_win32.c b/gst-libs/gst/gl/win32/gstglwindow_win32.c index a2ed3e6772..1ff18bbad8 100644 --- a/gst-libs/gst/gl/win32/gstglwindow_win32.c +++ b/gst-libs/gst/gl/win32/gstglwindow_win32.c @@ -74,7 +74,6 @@ gst_gl_window_win32_class_init (GstGLWindowWin32Class * klass) window_class->set_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_win32_set_window_handle); - window_class->draw_unlocked = GST_DEBUG_FUNCPTR (gst_gl_window_win32_draw); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_win32_draw); window_class->get_display = GST_DEBUG_FUNCPTR (gst_gl_window_win32_get_display); diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 29c2aead4d..f9fc4da80f 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -74,7 +74,6 @@ guintptr gst_gl_window_x11_get_window_handle (GstGLWindow * window); static void gst_gl_window_x11_set_preferred_size (GstGLWindow * window, gint width, gint height); void gst_gl_window_x11_show (GstGLWindow * window); -void gst_gl_window_x11_draw_unlocked (GstGLWindow * window); void gst_gl_window_x11_draw (GstGLWindow * window); gboolean gst_gl_window_x11_create_context (GstGLWindow * window, GstGLAPI gl_api, guintptr external_gl_context, GError ** error); @@ -104,8 +103,6 @@ gst_gl_window_x11_class_init (GstGLWindowX11Class * klass) GST_DEBUG_FUNCPTR (gst_gl_window_x11_set_window_handle); window_class->get_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_x11_get_window_handle); - window_class->draw_unlocked = - GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw_unlocked); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw); window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_x11_open); window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_x11_close); @@ -387,39 +384,13 @@ gst_gl_window_x11_show (GstGLWindow * window) gst_gl_window_send_message (window, (GstGLWindowCB) _show_window, window); } -/* Called in the gl thread */ -void -gst_gl_window_x11_draw_unlocked (GstGLWindow * window) -{ - GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window); - - if (gst_gl_window_is_running (GST_GL_WINDOW (window_x11)) - && window_x11->allow_extra_expose_events) { - if (window->queue_resize) { - guint width, height; - - gst_gl_window_get_surface_dimensions (window, &width, &height); - gst_gl_window_resize (window, width, height); - } - - if (window->draw) { - GstGLContext *context = gst_gl_window_get_context (window); - GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context); - - window->draw (window->draw_data); - context_class->swap_buffers (context); - - gst_object_unref (context); - } - } -} - static void draw_cb (gpointer data) { GstGLWindowX11 *window_x11 = data; + GstGLWindow *window = GST_GL_WINDOW (window_x11); - if (gst_gl_window_is_running (GST_GL_WINDOW (window_x11))) { + if (gst_gl_window_is_running (window)) { XWindowAttributes attr; XGetWindowAttributes (window_x11->device, window_x11->internal_win_id, @@ -443,7 +414,24 @@ draw_cb (gpointer data) } } - gst_gl_window_x11_draw_unlocked (GST_GL_WINDOW (window_x11)); + if (window_x11->allow_extra_expose_events) { + if (window->queue_resize) { + guint width, height; + + gst_gl_window_get_surface_dimensions (window, &width, &height); + gst_gl_window_resize (window, width, height); + } + + if (window->draw) { + GstGLContext *context = gst_gl_window_get_context (window); + GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context); + + window->draw (window->draw_data); + context_class->swap_buffers (context); + + gst_object_unref (context); + } + } } }