From d33cfef8bdaa07c6874e813a142a91b86fcde48a Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 12 Dec 2012 00:26:14 +0200 Subject: [PATCH 1/3] Don't restrict EGL color component sizes. This makes SGX530 work when using 16bpp framebuffer. --- gfx/context/xegl_ctx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/context/xegl_ctx.c b/gfx/context/xegl_ctx.c index 9662fbf718..84249e4825 100644 --- a/gfx/context/xegl_ctx.c +++ b/gfx/context/xegl_ctx.c @@ -177,9 +177,9 @@ static bool gfx_ctx_init(void) #define EGL_ATTRIBS_BASE \ EGL_SURFACE_TYPE, EGL_WINDOW_BIT, \ - EGL_RED_SIZE, 8, \ - EGL_GREEN_SIZE, 8, \ - EGL_BLUE_SIZE, 8, \ + EGL_RED_SIZE, 0, \ + EGL_GREEN_SIZE, 0, \ + EGL_BLUE_SIZE, 0, \ EGL_DEPTH_SIZE, 0, \ EGL_STENCIL_SIZE, 0 From ee112fc3754f3c9cf415d09422e011a8443db20d Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 12 Dec 2012 00:36:15 +0200 Subject: [PATCH 2/3] Manually define GL_BGRA_EXT if needed. It's missing in imgtec/SGX headers for some reason. --- gfx/gl_common.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 44cafbdfa8..8717544b5b 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -312,6 +312,10 @@ extern PFNGLACTIVETEXTUREPROC pglActiveTexture; #define RARCH_GL_FORMAT32 GL_UNSIGNED_INT_8_8_8_8_REV #define RARCH_GL_FORMAT16 GL_RGB5 #elif defined(HAVE_OPENGLES) +// Imgtec/SGX headers have this missing. +#ifndef GL_BGRA_EXT +#define GL_BGRA_EXT 0x80E1 +#endif #define RARCH_GL_INTERNAL_FORMAT32 GL_BGRA_EXT #define RARCH_GL_INTERNAL_FORMAT16 GL_RGB #define RARCH_GL_TEXTURE_TYPE32 GL_BGRA_EXT From 3576bcedd974bffaf6222c73827a0c9655b1a863 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 12 Dec 2012 02:34:01 +0200 Subject: [PATCH 3/3] Check for EGL/GLES/VG directly if pkgconfig is unavailable. This also allows to remove some videocore special cases. --- Makefile | 2 +- qb/config.libs.sh | 36 ++++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 3265be7760..c7ade66337 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ ifeq ($(HAVE_VG), 1) endif ifeq ($(HAVE_VIDEOCORE), 1) - LIBS += -lOpenVG -lGLESv2 -lEGL -lbcm_host -lvcos -lvchiq_arm + LIBS += -lbcm_host -lvcos -lvchiq_arm endif ifeq ($(HAVE_XVIDEO), 1) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index f4ffbd0287..4aa3dd6e76 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -17,11 +17,17 @@ check_lib VIDEOCORE -lbcm_host bcm_host_init "-lvcos -lvchiq_arm" if [ "$HAVE_VIDEOCORE" = 'yes' ]; then [ -d /opt/vc/include ] && add_include_dirs /opt/vc/include [ -d /opt/vc/include/interface/vcos/pthreads ] && add_include_dirs /opt/vc/include/interface/vcos/pthreads - HAVE_GLES='yes' - HAVE_VG='yes' - HAVE_EGL='yes' -else + HAVE_GLES='auto' + EXTRA_GL_LIBS="-lGLESv2 -lbcm_host -lvcos -lvchiq_arm" +fi + +if [ "$HAVE_EGL" != "no" ]; then check_pkgconf EGL egl + # some systems have EGL libs, but no pkgconfig + if [ "$HAVE_EGL" = "no" ]; then + HAVE_EGL=auto && check_lib EGL "-lEGL $EXTRA_GL_LIBS" + [ "$HAVE_EGL" = "yes" ] && EGL_LIBS=-lEGL + fi fi if [ "$LIBRETRO" ]; then @@ -149,17 +155,23 @@ fi check_pkgconf XML libxml-2.0 -# On videocore, these libraries will exist without proper pkg-config. -if [ "$HAVE_VIDEOCORE" != "yes" ] && [ "$HAVE_EGL" = "yes" ]; then - - if [ "$HAVE_XML" = "yes" ]; then - check_pkgconf GLES glesv2 - else +if [ "$HAVE_EGL" = "yes" ]; then + if [ "$HAVE_XML" != "yes" ]; then echo "Cannot find XML. GLES will not work." exit 1 fi - check_pkgconf VG vg -elif [ "$HAVE_VIDEOCORE" != "yes" ]; then + if [ "$HAVE_GLES" != "no" ]; then + HAVE_GLES=auto check_pkgconf GLES glesv2 + [ "$HAVE_GLES" = "no" ] && HAVE_GLES=auto check_lib GLES "-lGLESv2 $EXTRA_GL_LIBS" + fi + if [ "$HAVE_VG" != "no" ]; then + check_pkgconf VG vg + if [ "$HAVE_VG" = "no" ]; then + HAVE_VG=auto check_lib VG "-lOpenVG $EXTRA_GL_LIBS" + [ "$HAVE_VG" = "yes" ] && VG_LIBS=-lOpenVG + fi + fi +else HAVE_VG=no HAVE_GLES=no fi