From 562399a71a7e80553639ca111dd75bb419637401 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Thu, 24 Apr 2014 14:50:57 +0100 Subject: [PATCH] gl/rpi: change dispmanx attributes of existing element instead of creating a new one I was lucky that: e1 = vc_dispmanx_element_add () eglCreateWindowSurface (e1) vc_dispmanx_element_remove (e1) e2 = vc_dispmanx_element_add () resulted in having e2 equal to e1. And also having the egl surface that does not allocate its buffers before the first draw. --- .../gst/gl/dispmanx/gstglwindow_dispmanx_egl.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c index e9cd57f6bc..62b1aba951 100644 --- a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c +++ b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c @@ -263,18 +263,20 @@ window_resize (GstGLWindowDispmanxEGL * window_egl, guint width, guint height) dispman_update = vc_dispmanx_update_start (0); if (window_egl->native.element) { - vc_dispmanx_element_remove (dispman_update, window_egl->native.element); + vc_dispmanx_element_change_attributes (dispman_update, + window_egl->native.element, 0x00000110, 0, 0, &dst_rect, &src_rect, 0, + 0); + } else { + window_egl->native.element = vc_dispmanx_element_add (dispman_update, + window_egl->display, 0, &dst_rect, 0, &src_rect, + DISPMANX_PROTECTION_NONE, &alpha, 0, 0); } - window_egl->native.element = vc_dispmanx_element_add (dispman_update, - window_egl->display, 0, &dst_rect, 0, &src_rect, - DISPMANX_PROTECTION_NONE, &alpha, 0, 0); - vc_dispmanx_update_submit_sync (dispman_update); if (GST_GL_WINDOW (window_egl)->resize) - GST_GL_WINDOW (window_egl)-> - resize (GST_GL_WINDOW (window_egl)->resize_data, width, height); + GST_GL_WINDOW (window_egl)->resize (GST_GL_WINDOW (window_egl)-> + resize_data, width, height); } window_egl->native.width = width;