From 58f4217468665a787218627b9a4d5621c594ba5d Mon Sep 17 00:00:00 2001 From: Haihua Hu Date: Mon, 7 Jun 2021 17:54:46 +0800 Subject: [PATCH] gl/viv-fb: fix gl plugin hang when run with viv-fb backend 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: b887db1efe816c0c28b60a6842fa9005a26c1502 glwindow: fix racy resize updates Take locks around resize handling and marshall all resizes to the windowing thread by default. Part-of: --- gst-libs/gst/gl/egl/gstglcontext_egl.c | 9 +++++++++ gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c | 14 +++++++++----- gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c index 459ee63b07..b0a5d6b1ae 100644 --- a/gst-libs/gst/gl/egl/gstglcontext_egl.c +++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c @@ -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 @@ -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 } diff --git a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c index 5a155dc7cb..41d7b1d4cf 100644 --- a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c +++ b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c @@ -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 diff --git a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h index f89874ac04..b8c4259cd8 100644 --- a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h +++ b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h @@ -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