diff options
author | Kyle Repinski <repinski23@gmail.com> | 2016-03-02 14:06:21 -0600 |
---|---|---|
committer | Andreas Blaesius <skate4life@gmx.de> | 2017-01-17 00:00:19 +0100 |
commit | 41ee4ec65da1746184f25b591738589a260722fc (patch) | |
tree | 2b5537fa7881ac8b0674bd29580260d44d065d6b | |
parent | 91cd225e2f695d965b967390279666cf74f53a8b (diff) | |
download | hardware_ti_omap4-41ee4ec65da1746184f25b591738589a260722fc.zip hardware_ti_omap4-41ee4ec65da1746184f25b591738589a260722fc.tar.gz hardware_ti_omap4-41ee4ec65da1746184f25b591738589a260722fc.tar.bz2 |
libEGL_POWERVR: Add workaround for the eglChooseConfig+recordable issue.
Change-Id: I52375bf7c3a9cecc148c2d1d168169fd0546a9ce
-rw-r--r-- | libEGL_POWERVR/egl.c | 43 | ||||
-rw-r--r-- | libEGL_POWERVR/egl.h | 12 |
2 files changed, 55 insertions, 0 deletions
diff --git a/libEGL_POWERVR/egl.c b/libEGL_POWERVR/egl.c index b5ebeca..78ee97d 100644 --- a/libEGL_POWERVR/egl.c +++ b/libEGL_POWERVR/egl.c @@ -37,6 +37,49 @@ EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) { + /* When the following conditions are met... + * 1. EGL_PBUFFER_BIT is set in EGL_SURFACE_TYPE + * 2. EGL_OPENGL_ES2_BIT is set in EGL_RENDERABLE_TYPE + * ...EGL_RECORDABLE_ANDROID is forced to EGL_FALSE. + * Why this happens is unknown, but the end result is no configs get returned. + * Code meeting the above conditions seems to work fine without EGL_RECORDABLE_ANDROID, + * so in this shim we'll drop it on their behalf so they actually get an EGLConfig. + */ + bool renderable_type_es2 = false, surface_type_pbuffer = false; + int i, j, attriblist_length = 0, recordable_attrib_pos = -1; + + while( attrib_list[attriblist_length++] != EGL_NONE ) + { + if( attrib_list[attriblist_length-1] == EGL_SURFACE_TYPE && (attrib_list[attriblist_length] & EGL_PBUFFER_BIT) != 0 ) + { + surface_type_pbuffer = true; + } + else if( attrib_list[attriblist_length-1] == EGL_RENDERABLE_TYPE && (attrib_list[attriblist_length] & EGL_OPENGL_ES2_BIT) != 0 ) + { + renderable_type_es2 = true; + } + else if( attrib_list[attriblist_length-1] == EGL_RECORDABLE_ANDROID && attrib_list[attriblist_length] == EGL_TRUE ) + { + recordable_attrib_pos = attriblist_length - 1; + } + ++attriblist_length; + } + + if( recordable_attrib_pos != -1 && surface_type_pbuffer && renderable_type_es2 ) + { + EGLint override_attrib_list[attriblist_length-2]; + + for( i = 0, j = 0; i < attriblist_length; ++i ) + { + if( i != recordable_attrib_pos && i != recordable_attrib_pos + 1 ) + { + override_attrib_list[j++] = attrib_list[i]; + } + } + + return IMGeglChooseConfig(dpy, override_attrib_list, configs, config_size, num_config); + } + return IMGeglChooseConfig(dpy, attrib_list, configs, config_size, num_config); } diff --git a/libEGL_POWERVR/egl.h b/libEGL_POWERVR/egl.h index d4e91c5..b8f5fd3 100644 --- a/libEGL_POWERVR/egl.h +++ b/libEGL_POWERVR/egl.h @@ -2,12 +2,24 @@ #define __PVREGL_H__ #include <stdint.h> +#include <stdbool.h> #ifdef __cplusplus extern "C" { #endif +#define EGL_FALSE 0 +#define EGL_TRUE 1 + +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_NONE 0x3038 +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_RECORDABLE_ANDROID 0x3142 + +#define EGL_PBUFFER_BIT 0x0001 +#define EGL_OPENGL_ES2_BIT 0x0004 + typedef int32_t EGLint; typedef unsigned int EGLBoolean; typedef unsigned int EGLenum; |