From: Matthew Waters Date: Mon, 25 Nov 2013 09:34:06 +0000 (+1100) Subject: [862/906] window: remove set_need_lock X-Git-Tag: 1.19.3~511^2~1989^2~1696 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2026f60879b805fb9f478f8a2416399e4d279aa9;p=platform%2Fupstream%2Fgstreamer.git [862/906] window: remove set_need_lock No-one is using it. The only code that did was the x11 one which doesn't need it anymore. --- diff --git a/gst-libs/gst/gl/android/gstglwindow_android_egl.c b/gst-libs/gst/gl/android/gstglwindow_android_egl.c index 5d5d0df..1f23b28 100644 --- a/gst-libs/gst/gl/android/gstglwindow_android_egl.c +++ b/gst-libs/gst/gl/android/gstglwindow_android_egl.c @@ -90,8 +90,6 @@ gst_gl_window_android_egl_new (void) window = g_object_new (GST_GL_TYPE_WINDOW_ANDROID_EGL, NULL); - gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE); - return window; } diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m index a94915e..280d614 100644 --- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m @@ -123,8 +123,6 @@ static void gst_gl_window_cocoa_init (GstGLWindowCocoa * window) { window->priv = GST_GL_WINDOW_COCOA_GET_PRIVATE (window); - - gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE); } /* Must be called in the gl thread */ diff --git a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c index 488c34b..dd2441e 100644 --- a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c +++ b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c @@ -91,8 +91,6 @@ gst_gl_window_dispmanx_egl_new (void) window = g_object_new (GST_GL_TYPE_WINDOW_DISPMANX_EGL, NULL); - gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE); - window->egldisplay = EGL_DEFAULT_DISPLAY; window->display = 0; diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index 903ee95..b9cd8e3 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -104,7 +104,6 @@ gst_gl_window_init (GstGLWindow * window) window->priv = GST_GL_WINDOW_GET_PRIVATE (window); g_mutex_init (&window->lock); - window->need_lock = TRUE; window->is_drawing = FALSE; g_weak_ref_init (&window->context_ref, NULL); @@ -209,9 +208,7 @@ gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle) window_class = GST_GL_WINDOW_GET_CLASS (window); g_return_if_fail (window_class->set_window_handle != NULL); - GST_GL_WINDOW_LOCK (window); window_class->set_window_handle (window, handle); - GST_GL_WINDOW_UNLOCK (window); } /** @@ -251,16 +248,12 @@ gst_gl_window_draw (GstGLWindow * window, guint width, guint height) window_class = GST_GL_WINDOW_GET_CLASS (window); g_return_if_fail (window_class->draw != NULL); - GST_GL_WINDOW_LOCK (window); - /* avoid to overload the drawer */ if (window->is_drawing) { - GST_GL_WINDOW_UNLOCK (window); return; } window_class->draw (window, width, height); - GST_GL_WINDOW_UNLOCK (window); } /** @@ -278,10 +271,8 @@ gst_gl_window_run (GstGLWindow * window) window_class = GST_GL_WINDOW_GET_CLASS (window); g_return_if_fail (window_class->run != NULL); - GST_GL_WINDOW_LOCK (window); window->priv->alive = TRUE; window_class->run (window); - GST_GL_WINDOW_UNLOCK (window); } /** @@ -308,8 +299,6 @@ gst_gl_window_quit (GstGLWindow * window) GST_INFO ("quit sent to gl window loop"); GST_GL_WINDOW_UNLOCK (window); - - GST_INFO ("quit received from gl window"); } typedef struct _GstGLSyncMessage @@ -381,9 +370,7 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback, window_class = GST_GL_WINDOW_GET_CLASS (window); g_return_if_fail (window_class->send_message != NULL); - GST_GL_WINDOW_LOCK (window); window_class->send_message (window, callback, data); - GST_GL_WINDOW_UNLOCK (window); } /** @@ -411,22 +398,6 @@ gst_gl_window_send_message_async (GstGLWindow * window, GstGLWindowCB callback, } /** - * gst_gl_window_set_need_lock: - * @window: a #GstGLWindow - * @need_lock: whether the @window needs to lock for concurrent access - * - * This API is intended only for subclasses of #GstGLWindow in order to ensure - * correct interaction with the underlying window system. - */ -void -gst_gl_window_set_need_lock (GstGLWindow * window, gboolean need_lock) -{ - g_return_if_fail (GST_GL_IS_WINDOW (window)); - - window->need_lock = need_lock; -} - -/** * gst_gl_window_set_draw_callback: * @window: a #GstGLWindow * @callback: (scope notified): function to invoke @@ -528,20 +499,13 @@ gst_gl_window_is_running (GstGLWindow * window) guintptr gst_gl_window_get_display (GstGLWindow * window) { - guintptr ret; GstGLWindowClass *window_class; g_return_val_if_fail (GST_GL_IS_WINDOW (window), 0); window_class = GST_GL_WINDOW_GET_CLASS (window); g_return_val_if_fail (window_class->get_display != NULL, 0); - GST_GL_WINDOW_LOCK (window); - - ret = window_class->get_display (window); - - GST_GL_WINDOW_UNLOCK (window); - - return ret; + return window_class->get_display (window); } /** @@ -553,20 +517,13 @@ gst_gl_window_get_display (GstGLWindow * window) guintptr gst_gl_window_get_window_handle (GstGLWindow * window) { - guintptr ret; GstGLWindowClass *window_class; g_return_val_if_fail (GST_GL_IS_WINDOW (window), 0); window_class = GST_GL_WINDOW_GET_CLASS (window); g_return_val_if_fail (window_class->get_window_handle != NULL, 0); - GST_GL_WINDOW_LOCK (window); - - ret = window_class->get_window_handle (window); - - GST_GL_WINDOW_UNLOCK (window); - - return ret; + return window_class->get_window_handle (window); } /** diff --git a/gst-libs/gst/gl/gstglwindow.h b/gst-libs/gst/gl/gstglwindow.h index fb8298b..255fdd3 100644 --- a/gst-libs/gst/gl/gstglwindow.h +++ b/gst-libs/gst/gl/gstglwindow.h @@ -37,18 +37,8 @@ G_BEGIN_DECLS #define GST_GL_IS_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW)) #define GST_GL_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW, GstGLWindowClass)) -#define GST_GL_WINDOW_LOCK(w) \ - do { \ - if (GST_GL_WINDOW(w)->need_lock) \ - g_mutex_lock (&GST_GL_WINDOW(w)->lock); \ - } while (0) - -#define GST_GL_WINDOW_UNLOCK(w) \ - do { \ - if (GST_GL_WINDOW(w)->need_lock) \ - g_mutex_unlock (&GST_GL_WINDOW(w)->lock); \ - } while (0) - +#define GST_GL_WINDOW_LOCK(w) g_mutex_lock(&GST_GL_WINDOW(w)->lock) +#define GST_GL_WINDOW_UNLOCK(w) g_mutex_unlock(&GST_GL_WINDOW(w)->lock) #define GST_GL_WINDOW_GET_LOCK(w) (&GST_GL_WINDOW(w)->lock) #define GST_GL_WINDOW_ERROR (gst_gl_window_error_quark ()) @@ -77,7 +67,6 @@ struct _GstGLWindow { GObject parent; GMutex lock; - gboolean need_lock; GWeakRef context_ref; @@ -148,7 +137,6 @@ GstGLWindow * gst_gl_window_new (GstGLDisplay *display); void gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify); void gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowResizeCB callback, gpointer data, GDestroyNotify destroy_notify); void gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify); -void gst_gl_window_set_need_lock (GstGLWindow *window, gboolean need_lock); void gst_gl_window_set_window_handle (GstGLWindow *window, guintptr handle); guintptr gst_gl_window_get_window_handle (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 acfb7e9..d5853b0 100644 --- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c +++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c @@ -298,8 +298,6 @@ gst_gl_window_wayland_egl_new (void) window = g_object_new (GST_GL_TYPE_WINDOW_WAYLAND_EGL, NULL); - gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE); - return window; } diff --git a/gst-libs/gst/gl/win32/gstglwindow_win32.c b/gst-libs/gst/gl/win32/gstglwindow_win32.c index f50bc3d..be1b4f6 100644 --- a/gst-libs/gst/gl/win32/gstglwindow_win32.c +++ b/gst-libs/gst/gl/win32/gstglwindow_win32.c @@ -88,8 +88,6 @@ static void gst_gl_window_win32_init (GstGLWindowWin32 * window) { window->priv = GST_GL_WINDOW_WIN32_GET_PRIVATE (window); - - gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE); } /* Must be called in the gl thread */ diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 355513b..e2ed2b4 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -175,8 +175,6 @@ gst_gl_window_x11_new (void) window = g_object_new (GST_GL_TYPE_WINDOW_X11, NULL); - gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE); - return window; } @@ -314,7 +312,7 @@ gst_gl_window_x11_close (GstGLWindow * window) GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window); XEvent event; - GST_GL_WINDOW_LOCK (window_x11); + g_mutex_lock (&window_x11->disp_send_lock); if (window_x11->device) { if (window_x11->internal_win_id) @@ -361,7 +359,7 @@ gst_gl_window_x11_close (GstGLWindow * window) window_x11->running = FALSE; - GST_GL_WINDOW_UNLOCK (window_x11); + g_mutex_unlock (&window_x11->disp_send_lock); } guintptr