mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
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.
This commit is contained in:
parent
166f979761
commit
a32cd0e55e
2 changed files with 15 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue