[MPlayer-dev-eng] [PATCH] OpenGLES on ARM

Laurent laurent.aml at gmail.com
Fri May 8 00:13:50 CEST 2015


On Thu, May 7, 2015 at 2:06 PM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On Wed, May 06, 2015 at 05:19:16PM -0400, Laurent wrote:
>> Hi,
>>
>> Here is a simple patch to make mplayer -vo gl:backend=3 work on
>> ARM-GNU/Linux, at least on my platform (amlogic S805).
>
> Thanks, committed.
> Though to be honest this was a really horrible quick hack.
> I was hoping that most real platforms would at least provide
> a symlink in a reasonable location like /usr/lib...

On this Ubuntu, other apps (glmark2-es2, chrome) works as well without
the symlink. I would not be surprised they check the architecture
specific paths as well.

> I think this is basically solved in GLESv3 as then you can just
> query all functions through EGL I think, but in GLESv2 some genius
> decided that you can only query extensions through that API.
> I guess your device does not support GLESv3 though?

Right, no GLESv3. The GPU is a Mali 450:
http://www.arm.com/products/multimedia/mali-cost-efficient-graphics/mali-450-mp.php

> Or any other great idea that doesn't involve traversing the whole
> directory tree (though I admit that might be less horrible than it
> sounds).

I have no idea how to do this better.
However, some additional error detection could help figure out the lib
has not been found.
When GLES support is not compiled in MPlayer, it is still possible to
use gl:backend=3, but IIRC the VO init fails for no apparent reason.
An error message telling the requested VO is not available would be
nice (eg attached untested patch... not the best, as warnings would be
ok when the backend is explicitely defined but less appropriate during
autodetection).
When GLES is compiled in but the lib is not found, there is a crash
when the first (null-pointer) GL function is called (it was
glCreateProgram within new_gpu_program()).
Not sure where would be the best place to catch this issue.

Thanks,

-- Laurent
-------------- next part --------------
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index f8b1161..1a1bc29 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -2699,8 +2699,8 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
   ctx->fullscreen = dummy_fullscreen;
   ctx->type = type;
   switch (ctx->type) {
-#ifdef CONFIG_GL_WIN32
   case GLTYPE_W32:
+#ifdef CONFIG_GL_WIN32
     ctx->setGlWindow = setGlWindow_w32;
     ctx->releaseGlContext = releaseGlContext_w32;
     ctx->swapGlBuffers = swapGlBuffers_w32;
@@ -2710,9 +2710,12 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
     ctx->fullscreen = vo_w32_fullscreen;
     ctx->ontop = vo_w32_ontop;
     return vo_w32_init();
+#else
+    mp_msg(MSGT_VO, MSGL_WARN, "[gl] Win32/WGL backend not available.\n");
+    break;
 #endif
-#ifdef CONFIG_GL_X11
   case GLTYPE_X11:
+#ifdef CONFIG_GL_X11
     ctx->setGlWindow = setGlWindow_x11;
     ctx->releaseGlContext = releaseGlContext_x11;
     ctx->swapGlBuffers = swapGlBuffers_x11;
@@ -2722,25 +2725,34 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
     ctx->fullscreen = vo_x11_fullscreen;
     ctx->ontop = vo_x11_ontop;
     return vo_init();
+#else
+    mp_msg(MSGT_VO, MSGL_WARN, "[gl] X11/GLX backend not available.\n");
+    break;
 #endif
-#ifdef CONFIG_GL_SDL
   case GLTYPE_SDL:
+#ifdef CONFIG_GL_SDL
     SDL_Init(SDL_INIT_VIDEO);
     ctx->setGlWindow = setGlWindow_sdl;
     ctx->swapGlBuffers = swapGlBuffers_sdl;
     ctx->check_events = sdl_check_events;
     ctx->fullscreen = vo_sdl_fullscreen;
     return vo_sdl_init();
+#else
+    mp_msg(MSGT_VO, MSGL_WARN, "[gl] SDL backend not available.\n");
+    break;
 #endif
-#ifdef CONFIG_GL_EGL_ANDROID
   case GLTYPE_EGL_ANDROID:
+#ifdef CONFIG_GL_EGL_ANDROID
     ctx->setGlWindow = setGlWindow_egl;
     ctx->releaseGlContext = releaseGlContext_egl;
     ctx->swapGlBuffers = swapGlBuffers_egl;
     return 1;
+#else
+    mp_msg(MSGT_VO, MSGL_WARN, "[gl] Android backend not available.\n");
+    break;
 #endif
-#ifdef CONFIG_GL_EGL_X11
   case GLTYPE_EGL_X11:
+#ifdef CONFIG_GL_EGL_X11
     ctx->setGlWindow = setGlWindow_egl;
     ctx->releaseGlContext = releaseGlContext_egl;
     ctx->swapGlBuffers = swapGlBuffers_egl;
@@ -2750,19 +2762,24 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
     ctx->fullscreen = vo_x11_fullscreen;
     ctx->ontop = vo_x11_ontop;
     return vo_init();
+#else
+    mp_msg(MSGT_VO, MSGL_WARN, "[gl] X11/EGL backend not available.\n");
+    break;
 #endif
-#ifdef CONFIG_GL_OSX
   case GLTYPE_OSX:
+#ifdef CONFIG_GL_OSX
     ctx->swapGlBuffers = vo_osx_swap_buffers;
     ctx->update_xinerama_info = vo_osx_update_xinerama_info;
     ctx->check_events = vo_osx_check_events;
     ctx->fullscreen = vo_osx_fullscreen;
     ctx->ontop = vo_osx_ontop;
     return vo_osx_init();
+#else
+    mp_msg(MSGT_VO, MSGL_WARN, "[gl] OSX/Cocoa backend not available.\n");
+    break;
 #endif
-  default:
-    return 0;
   }
+  return 0;
 }
 


More information about the MPlayer-dev-eng mailing list