From: Matthew Waters Date: Sun, 3 Nov 2019 13:38:18 +0000 (+1100) Subject: gl/gbm: ensure we call the resize callback before attempting to draw X-Git-Tag: accepted/tizen/unified/20220217.153506~2^2~10^2~9^2~16^2~1^2~42^2~1^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dceaa4dd4baca2b9ebd92017269060e5345408f9;p=platform%2Fupstream%2Fgstreamer.git gl/gbm: ensure we call the resize callback before attempting to draw Without this, sinks will not be notified about size changes or even the initial size and would render at 0x0. --- diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 15074f8..bd2bb8c 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -2244,9 +2244,13 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink) gst_gl_context_clear_shader (gl_sink->context); gl->BindTexture (gl_target, 0); - if (!gst_gl_window_controls_viewport (window)) + if (!gst_gl_window_controls_viewport (window)) { gl->Viewport (gl_sink->display_rect.x, gl_sink->display_rect.y, gl_sink->display_rect.w, gl_sink->display_rect.h); + GST_DEBUG_OBJECT (gl_sink, "GL output area now %u,%u %ux%u", + gl_sink->display_rect.x, gl_sink->display_rect.y, + gl_sink->display_rect.w, gl_sink->display_rect.h); + } sample = gst_sample_new (gl_sink->stored_buffer[0], gl_sink->out_caps, &GST_BASE_SINK (gl_sink)->segment, NULL); diff --git a/gst-libs/gst/gl/gbm/gstglwindow_gbm_egl.c b/gst-libs/gst/gl/gbm/gstglwindow_gbm_egl.c index 6f4a844..7067b20 100644 --- a/gst-libs/gst/gl/gbm/gstglwindow_gbm_egl.c +++ b/gst-libs/gst/gl/gbm/gstglwindow_gbm_egl.c @@ -51,7 +51,6 @@ static void gst_gl_window_gbm_egl_draw (GstGLWindow * window); static gboolean gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl); - static void gst_gl_window_gbm_egl_class_init (GstGLWindowGBMEGLClass * klass) { @@ -239,6 +238,13 @@ draw_cb (gpointer data) } } + if (window->queue_resize) { + guint width, height; + + gst_gl_window_get_surface_dimensions (window, &width, &height); + gst_gl_window_resize (window, width, height); + } + /* Do the actual drawing */ if (window->draw) window->draw (window->draw_data); @@ -361,8 +367,10 @@ gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl) GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); gst_gl_window_resize (window, hdisplay, vdisplay); + gst_gl_window_queue_resize (window); - GST_DEBUG ("Successfully created GBM surface"); + GST_DEBUG ("Successfully created GBM surface %ix%i from info %p", hdisplay, + vdisplay, drm_mode_info); cleanup: @@ -370,7 +378,6 @@ cleanup: return ret; } - /* Must be called in the gl thread */ GstGLWindowGBMEGL * gst_gl_window_gbm_egl_new (GstGLDisplay * display)