This introduced a possible regression where the EGL display connection
could be leaked when a foreign native display (x11, wayland, etc) could
create a non-foreign EGL display that would never be destroyed.
The underlying problem needed to be solved in a different way. See
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/640
for more details.
This reverts commit
2e686b0dad9700b10d91da5e91f34849fa7d32ae.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/758>
static void gst_gl_display_egl_finalize (GObject * object);
static guintptr gst_gl_display_egl_get_handle (GstGLDisplay * display);
static void gst_gl_display_egl_finalize (GObject * object);
static guintptr gst_gl_display_egl_get_handle (GstGLDisplay * display);
-static gboolean gst_gl_display_egl_get_foreign_display (GstGLDisplay * display);
static void
init_debug (void)
static void
init_debug (void)
{
GST_GL_DISPLAY_CLASS (klass)->get_handle =
GST_DEBUG_FUNCPTR (gst_gl_display_egl_get_handle);
{
GST_GL_DISPLAY_CLASS (klass)->get_handle =
GST_DEBUG_FUNCPTR (gst_gl_display_egl_get_handle);
- GST_GL_DISPLAY_CLASS (klass)->get_foreign_display =
- GST_DEBUG_FUNCPTR (gst_gl_display_egl_get_foreign_display);
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_egl_finalize;
}
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_egl_finalize;
}
GstGLDisplayEGL *ret;
GstGLDisplayType display_type;
guintptr native_display;
GstGLDisplayEGL *ret;
GstGLDisplayType display_type;
guintptr native_display;
- gboolean foreign_display;
g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
display_type = gst_gl_display_get_handle_type (display);
native_display = gst_gl_display_get_handle (display);
display_type = gst_gl_display_get_handle_type (display);
native_display = gst_gl_display_get_handle (display);
- foreign_display = gst_gl_display_get_foreign_display (display);
g_return_val_if_fail (native_display != 0, NULL);
g_return_val_if_fail (display_type != GST_GL_DISPLAY_TYPE_NONE, NULL);
g_return_val_if_fail (native_display != 0, NULL);
g_return_val_if_fail (display_type != GST_GL_DISPLAY_TYPE_NONE, NULL);
ret->display =
gst_gl_display_egl_get_from_native (display_type, native_display);
ret->display =
gst_gl_display_egl_get_from_native (display_type, native_display);
- ret->foreign_display = foreign_display;
if (!ret->display) {
GST_WARNING_OBJECT (ret, "failed to get EGLDisplay from native display");
gst_object_unref (ret);
return NULL;
}
if (!ret->display) {
GST_WARNING_OBJECT (ret, "failed to get EGLDisplay from native display");
gst_object_unref (ret);
return NULL;
}
g_object_set_data_full (G_OBJECT (display), GST_GL_DISPLAY_EGL_NAME,
gst_object_ref (ret), (GDestroyNotify) gst_object_unref);
g_object_set_data_full (G_OBJECT (display), GST_GL_DISPLAY_EGL_NAME,
gst_object_ref (ret), (GDestroyNotify) gst_object_unref);
{
return (guintptr) GST_GL_DISPLAY_EGL (display)->display;
}
{
return (guintptr) GST_GL_DISPLAY_EGL (display)->display;
}
-
-static gboolean
-gst_gl_display_egl_get_foreign_display (GstGLDisplay * display)
-{
- return GST_GL_DISPLAY_EGL (display)->foreign_display;
-}
static void gst_gl_display_dispose (GObject * object);
static void gst_gl_display_finalize (GObject * object);
static guintptr gst_gl_display_default_get_handle (GstGLDisplay * display);
static void gst_gl_display_dispose (GObject * object);
static void gst_gl_display_finalize (GObject * object);
static guintptr gst_gl_display_default_get_handle (GstGLDisplay * display);
-static gboolean gst_gl_display_default_get_foreign_display (GstGLDisplay *
- display);
static GstGLWindow *gst_gl_display_default_create_window (GstGLDisplay *
display);
static GstGLWindow *gst_gl_display_default_create_window (GstGLDisplay *
display);
GST_TYPE_GL_CONTEXT);
klass->get_handle = gst_gl_display_default_get_handle;
GST_TYPE_GL_CONTEXT);
klass->get_handle = gst_gl_display_default_get_handle;
- klass->get_foreign_display = gst_gl_display_default_get_foreign_display;
klass->create_window = gst_gl_display_default_create_window;
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_finalize;
klass->create_window = gst_gl_display_default_create_window;
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_finalize;
- * gst_gl_display_get_foreign_display:
- * @display: a #GstGLDisplay
- *
- * Returns: whether the context belongs to a foreign display
- *
- * Since: 1.18
- */
-gboolean
-gst_gl_display_get_foreign_display (GstGLDisplay * display)
-{
- GstGLDisplayClass *klass;
-
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), FALSE);
- klass = GST_GL_DISPLAY_GET_CLASS (display);
- g_return_val_if_fail (klass->get_foreign_display != NULL, 0);
-
- return klass->get_foreign_display (display);
-}
-
-static gboolean
-gst_gl_display_default_get_foreign_display (GstGLDisplay * display)
-{
- return FALSE;
-}
-
-/**
* gst_gl_display_filter_gl_api:
* @display: a #GstGLDisplay
* @gl_api: a #GstGLAPI to filter with
* gst_gl_display_filter_gl_api:
* @display: a #GstGLDisplay
* @gl_api: a #GstGLAPI to filter with
guintptr (*get_handle) (GstGLDisplay * display);
GstGLWindow * (*create_window) (GstGLDisplay * display);
guintptr (*get_handle) (GstGLDisplay * display);
GstGLWindow * (*create_window) (GstGLDisplay * display);
- gboolean (*get_foreign_display) (GstGLDisplay * display);
- gpointer _padding[GST_PADDING-1];
+ gpointer _padding[GST_PADDING];
GST_GL_API
GstGLDisplayType gst_gl_display_get_handle_type (GstGLDisplay * display);
GST_GL_API
GST_GL_API
GstGLDisplayType gst_gl_display_get_handle_type (GstGLDisplay * display);
GST_GL_API
-gboolean gst_gl_display_get_foreign_display (GstGLDisplay * display);
-GST_GL_API
void gst_gl_display_filter_gl_api (GstGLDisplay * display,
GstGLAPI gl_api);
GST_GL_API
void gst_gl_display_filter_gl_api (GstGLDisplay * display,
GstGLAPI gl_api);
GST_GL_API
static void gst_gl_display_wayland_finalize (GObject * object);
static guintptr gst_gl_display_wayland_get_handle (GstGLDisplay * display);
static void gst_gl_display_wayland_finalize (GObject * object);
static guintptr gst_gl_display_wayland_get_handle (GstGLDisplay * display);
-static gboolean gst_gl_display_wayland_get_foreign_display (GstGLDisplay *
- display);
static void
gst_gl_display_wayland_class_init (GstGLDisplayWaylandClass * klass)
{
GST_GL_DISPLAY_CLASS (klass)->get_handle =
GST_DEBUG_FUNCPTR (gst_gl_display_wayland_get_handle);
static void
gst_gl_display_wayland_class_init (GstGLDisplayWaylandClass * klass)
{
GST_GL_DISPLAY_CLASS (klass)->get_handle =
GST_DEBUG_FUNCPTR (gst_gl_display_wayland_get_handle);
- GST_GL_DISPLAY_CLASS (klass)->get_foreign_display =
- GST_DEBUG_FUNCPTR (gst_gl_display_wayland_get_foreign_display);
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_wayland_finalize;
}
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_wayland_finalize;
}
{
return (guintptr) GST_GL_DISPLAY_WAYLAND (display)->display;
}
{
return (guintptr) GST_GL_DISPLAY_WAYLAND (display)->display;
}
-
-static gboolean
-gst_gl_display_wayland_get_foreign_display (GstGLDisplay * display)
-{
- return GST_GL_DISPLAY_WAYLAND (display)->foreign_display;
-}
static void gst_gl_display_x11_finalize (GObject * object);
static guintptr gst_gl_display_x11_get_handle (GstGLDisplay * display);
static void gst_gl_display_x11_finalize (GObject * object);
static guintptr gst_gl_display_x11_get_handle (GstGLDisplay * display);
-static gboolean gst_gl_display_x11_get_foreign_display (GstGLDisplay * display);
G_GNUC_INTERNAL
gboolean gst_gl_display_x11_handle_event (GstGLDisplayX11 * display_x11);
G_GNUC_INTERNAL
gboolean gst_gl_display_x11_handle_event (GstGLDisplayX11 * display_x11);
{
GST_GL_DISPLAY_CLASS (klass)->get_handle =
GST_DEBUG_FUNCPTR (gst_gl_display_x11_get_handle);
{
GST_GL_DISPLAY_CLASS (klass)->get_handle =
GST_DEBUG_FUNCPTR (gst_gl_display_x11_get_handle);
- GST_GL_DISPLAY_CLASS (klass)->get_foreign_display =
- GST_DEBUG_FUNCPTR (gst_gl_display_x11_get_foreign_display);
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_x11_finalize;
}
G_OBJECT_CLASS (klass)->finalize = gst_gl_display_x11_finalize;
}
return (guintptr) GST_GL_DISPLAY_X11 (display)->display;
}
return (guintptr) GST_GL_DISPLAY_X11 (display)->display;
}
-static gboolean
-gst_gl_display_x11_get_foreign_display (GstGLDisplay * display)
-{
- return GST_GL_DISPLAY_X11 (display)->foreign_display;
-}
-
static int
_compare_xcb_window (GstGLWindowX11 * window_x11, xcb_window_t * window_id)
{
static int
_compare_xcb_window (GstGLWindowX11 * window_x11, xcb_window_t * window_id)
{