[vlc-commits] egl/wayland: pull initial dimensions as parameters

Rémi Denis-Courmont git at videolan.org
Thu Jan 31 19:00:01 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 31 19:12:44 2019 +0200| [1cd330b067ca4695b6d196214b0a28981c22a188] | committer: Rémi Denis-Courmont

egl/wayland: pull initial dimensions as parameters

This pulls the initial EGL surface dimensions as parameters two level
up the call stack. So far, it makes no functional difference as the
values will be 1x1. This requires a nonfunctional adjustment to other
modules though.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1cd330b067ca4695b6d196214b0a28981c22a188
---

 modules/video_output/glx.c        |  3 ++-
 modules/video_output/opengl/egl.c | 17 ++++++++++-------
 modules/video_output/vgl.c        |  3 ++-
 modules/video_output/win32/wgl.c  |  5 +++--
 src/video_output/opengl.c         | 10 +++++++---
 5 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/modules/video_output/glx.c b/modules/video_output/glx.c
index 0ac758df6f..ab14cc0b93 100644
--- a/modules/video_output/glx.c
+++ b/modules/video_output/glx.c
@@ -113,7 +113,7 @@ static bool CheckGLXext (Display *dpy, unsigned snum, const char *ext)
     return false;
 }
 
-static int Open(vlc_gl_t *gl)
+static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
 {
     vlc_object_t *obj = VLC_OBJECT(gl);
 
@@ -245,6 +245,7 @@ static int Open(vlc_gl_t *gl)
         var_SetString(gl->surface, "gl", "glx");
     }
 
+    (void) width; (void) height;
     return VLC_SUCCESS;
 
 error:
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index b62c76ae1c..bd1b6941e4 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -205,7 +205,8 @@ static void Close(vlc_gl_t *gl)
 /**
  * Probe EGL display availability
  */
-static int Open(vlc_gl_t *gl, const struct gl_api *api)
+static int Open(vlc_gl_t *gl, const struct gl_api *api,
+                unsigned width, unsigned height)
 {
     vlc_object_t *obj = VLC_OBJECT(gl);
     vlc_gl_sys_t *sys = malloc(sizeof (*sys));
@@ -260,6 +261,7 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api)
             sys->display = eglGetDisplay(sys->x11);
 # endif
     }
+    (void) width; (void) height;
 
 #elif defined (USE_PLATFORM_WAYLAND)
     sys->window = NULL;
@@ -271,8 +273,7 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api)
     if (!CheckClientExt("EGL_EXT_platform_wayland"))
         goto error;
 
-    /* Resize() should be called with the proper size before Swap() */
-    window = wl_egl_window_create(wnd->handle.wl, 1, 1);
+    window = wl_egl_window_create(wnd->handle.wl, width, height);
     if (window == NULL)
         goto error;
     sys->window = window;
@@ -292,6 +293,7 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api)
   && !defined (__CYGWIN__) && !defined (__SCITECH_SNAP__)
     sys->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 # endif
+    (void) width; (void) height;
 
 #elif defined (USE_PLATFORM_ANDROID)
     if (wnd->type != VOUT_WINDOW_TYPE_ANDROID_NATIVE)
@@ -306,6 +308,7 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api)
 # if defined (__ANDROID__) || defined (ANDROID)
     sys->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 # endif
+    (void) width; (void) height;
 
 #endif
 
@@ -395,22 +398,22 @@ error:
     return VLC_EGENERIC;
 }
 
-static int OpenGLES2(vlc_gl_t *gl)
+static int OpenGLES2(vlc_gl_t *gl, unsigned width, unsigned height)
 {
     static const struct gl_api api = {
         "OpenGL_ES", EGL_OPENGL_ES_API, 3, EGL_OPENGL_ES2_BIT,
         { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE },
     };
-    return Open(gl, &api);
+    return Open(gl, &api, width, height);
 }
 
-static int OpenGL(vlc_gl_t *gl)
+static int OpenGL(vlc_gl_t *gl, unsigned width, unsigned height)
 {
     static const struct gl_api api = {
         "OpenGL", EGL_OPENGL_API, 4, EGL_OPENGL_BIT,
         { EGL_NONE },
     };
-    return Open(gl, &api);
+    return Open(gl, &api, width, height);
 }
 
 vlc_module_begin ()
diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c
index 9d844a93c7..293fed7de8 100644
--- a/modules/video_output/vgl.c
+++ b/modules/video_output/vgl.c
@@ -107,7 +107,7 @@ static void Close(vlc_gl_t *gl)
         }                                                          \
     } while( 0 )
 
-static int Open(vlc_gl_t *gl)
+static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
 {
     vout_display_sys_t * sys;
 
@@ -137,6 +137,7 @@ static int Open(vlc_gl_t *gl)
             return VLC_EGENERIC;
         }
 
+    (void) width; (void) height;
     return VLC_SUCCESS;
 }
 
diff --git a/modules/video_output/win32/wgl.c b/modules/video_output/win32/wgl.c
index 8025620a69..3bf8f1abfe 100644
--- a/modules/video_output/win32/wgl.c
+++ b/modules/video_output/win32/wgl.c
@@ -37,7 +37,7 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int Open(vlc_gl_t *);
+static int Open(vlc_gl_t *, unsigned width, unsigned height);
 static void Close(vlc_gl_t *);
 
 #define HW_GPU_AFFINITY_TEXT N_("GPU affinity")
@@ -157,7 +157,7 @@ static void DestroyGPUAffinityDC(vlc_gl_t *gl) {
     fncDeleteDCNV(sys->affinityHDC);
 }
 
-static int Open(vlc_gl_t *gl)
+static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
 {
     vout_display_sys_t *sys;
 
@@ -242,6 +242,7 @@ static int Open(vlc_gl_t *gl)
     if (sys->exts.GetExtensionsStringEXT || sys->exts.GetExtensionsStringARB)
         gl->wgl.getExtensionsString = GetExtensionsString;
 
+    (void) width; (void) height;
     return VLC_SUCCESS;
 
 error:
diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c
index ad5bc9cf36..e56dd2b624 100644
--- a/src/video_output/opengl.c
+++ b/src/video_output/opengl.c
@@ -39,10 +39,12 @@ struct vlc_gl_priv_t
 
 static int vlc_gl_start(void *func, va_list ap)
 {
-    int (*activate)(vlc_gl_t *) = func;
+    int (*activate)(vlc_gl_t *, unsigned, unsigned) = func;
     vlc_gl_t *gl = va_arg(ap, vlc_gl_t *);
+    unsigned width = va_arg(ap, unsigned);
+    unsigned height = va_arg(ap, unsigned);
 
-    return activate(gl);
+    return activate(gl, width, height);
 }
 
 static void vlc_gl_stop(void *func, va_list ap)
@@ -88,7 +90,9 @@ vlc_gl_t *vlc_gl_Create(struct vout_window_t *wnd, unsigned flags,
 
     vlc_gl_t *gl = &glpriv->gl;
     gl->surface = wnd;
-    gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start, gl);
+    /* Resize() should be called with the proper size before Swap() */
+    gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start, gl,
+                                 1u, 1u);
     if (gl->module == NULL)
     {
         vlc_object_release(gl);



More information about the vlc-commits mailing list