Skip to content

Commit

Permalink
gl/viv-fb: fix gl plugin hang when run with viv-fb backend
Browse files Browse the repository at this point in the history
below commit change the window resize thread and cause viv-fb backend
hang, need move resize code after window->open is called. Otherwise,
the resize message will send to a thread that not start running and
window resize call will waiting forever.

Commit:        b887db1
glwindow: fix racy resize updates

Take locks around resize handling and marshall all resizes to the
windowing thread by default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1195>
  • Loading branch information
Haihua Hu committed Jun 11, 2021
1 parent 025a14e commit 58f4217
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
9 changes: 9 additions & 0 deletions gst-libs/gst/gl/egl/gstglcontext_egl.c
Expand Up @@ -53,6 +53,9 @@
#if GST_GL_HAVE_WINDOW_GBM
#include "../gbm/gstglwindow_gbm_egl.h"
#endif
#if GST_GL_HAVE_WINDOW_VIV_FB
#include "../viv-fb/gstglwindow_viv_fb_egl.h"
#endif

#define GST_CAT_DEFAULT gst_gl_context_debug

Expand Down Expand Up @@ -1080,6 +1083,12 @@ gst_gl_context_egl_create_context (GstGLContext * context,
gst_gl_window_gbm_egl_create_window ((GstGLWindowGBMEGL *)
context->window);
}
#endif
#if GST_GL_HAVE_WINDOW_VIV_FB
if (GST_IS_GL_WINDOW_VIV_FB_EGL (context->window)) {
gst_gl_window_viv_fb_egl_create_window ((GstGLWindowVivFBEGL *)
context->window);
}
#endif
}

Expand Down
14 changes: 9 additions & 5 deletions gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
Expand Up @@ -130,21 +130,25 @@ gst_gl_window_viv_fb_egl_open (GstGLWindow * window, GError ** error)
return FALSE;
}

return GST_GL_WINDOW_CLASS (parent_class)->open (window, error);
}

void
gst_gl_window_viv_fb_egl_create_window (GstGLWindowVivFBEGL * window_egl)
{
fbGetWindowGeometry (window_egl->win_id, NULL, NULL,
&window_egl->window_width, &window_egl->window_height);
window_egl->render_rectangle.x = 0;
window_egl->render_rectangle.y = 0;
window_egl->render_rectangle.w = window_egl->window_width;
window_egl->render_rectangle.h = window_egl->window_height;
gst_gl_window_resize (window, window_egl->window_width,
gst_gl_window_resize (GST_GL_WINDOW (window_egl), window_egl->window_width,
window_egl->window_height);

GST_DEBUG
("Opened Vivante FB display successfully, resolution is (%dx%d), display %p, window %p.",
window_egl->window_width, window_egl->window_height, (gpointer) display,
("create viv-fb window, resolution is (%dx%d), window %p.",
window_egl->window_width, window_egl->window_height,
(gpointer) window_egl->win_id);

return GST_GL_WINDOW_CLASS (parent_class)->open (window, error);
}

static guintptr
Expand Down
1 change: 1 addition & 0 deletions gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h
Expand Up @@ -59,6 +59,7 @@ struct _GstGLWindowVivFBEGLClass {
GType gst_gl_window_viv_fb_egl_get_type (void);

GstGLWindowVivFBEGL * gst_gl_window_viv_fb_egl_new (GstGLDisplay * display);
void gst_gl_window_viv_fb_egl_create_window (GstGLWindowVivFBEGL * window_egl);

G_END_DECLS

Expand Down

0 comments on commit 58f4217

Please sign in to comment.