Allow using straight OpenGL API in KMS.

This commit is contained in:
Themaister 2012-09-18 12:16:27 +02:00
parent bbcf7e5d86
commit 1d2d09905b
3 changed files with 75 additions and 49 deletions

101
Makefile
View File

@ -82,9 +82,11 @@ endif
ifeq ($(HAVE_OSS), 1)
OBJ += audio/oss.o
endif
ifeq ($(HAVE_OSS_BSD), 1)
OBJ += audio/oss.o
endif
ifeq ($(HAVE_OSS_LIB), 1)
LIBS += -lossaudio
endif
@ -94,24 +96,28 @@ ifeq ($(HAVE_ALSA), 1)
LIBS += $(ALSA_LIBS)
DEFINES += $(ALSA_CFLAGS)
endif
ifeq ($(HAVE_ROAR), 1)
OBJ += audio/roar.o
LIBS += $(ROAR_LIBS)
DEFINES += $(ROAR_CFLAGS)
endif
ifeq ($(HAVE_AL), 1)
OBJ += audio/openal.o
ifeq ($(OSX),1)
LIBS += -framework OpenAL
else
LIBS += -lopenal
endif
ifeq ($(OSX),1)
LIBS += -framework OpenAL
else
LIBS += -lopenal
endif
endif
ifeq ($(HAVE_JACK),1)
OBJ += audio/jack.o
LIBS += $(JACK_LIBS)
DEFINES += $(JACK_CFLAGS)
endif
ifeq ($(HAVE_PULSE), 1)
OBJ += audio/pulse.o
LIBS += $(PULSE_LIBS)
@ -129,43 +135,46 @@ ifeq ($(HAVE_SDL), 1)
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
LIBS += $(SDL_LIBS)
ifeq ($(SCALER_NO_SIMD), 1)
DEFINES += -DSCALER_NO_SIMD
endif
ifeq ($(SCALER_PERF), 1)
DEFINES += -DSCALER_PERF
endif
ifeq ($(SCALER_NO_SIMD), 1)
DEFINES += -DSCALER_NO_SIMD
endif
ifeq ($(HAVE_X11), 1)
LIBS += $(X11_LIBS)
DEFINES += $(X11_CFLAGS)
endif
ifeq ($(SCALER_PERF), 1)
DEFINES += -DSCALER_PERF
endif
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/gl.o gfx/fonts/freetype.o gfx/math/matrix.o
ifeq ($(HAVE_X11), 1)
LIBS += $(X11_LIBS)
DEFINES += $(X11_CFLAGS)
endif
ifeq ($(OSX),1)
LIBS += -framework OpenGL
else
ifeq ($(HAVE_GLES), 1)
LIBS += -lGLESv2 -lEGL
DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2
else
LIBS += -lGL
OBJ += gfx/context/sdl_ctx.o
endif
endif
endif
endif
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/gl.o gfx/fonts/freetype.o gfx/math/matrix.o
ifeq ($(HAVE_KMS), 1)
OBJ += gfx/context/drm_egl_ctx.o
DEFINES += $(GBM_CFLAGS) $(DRM_CFLAGS)
LIBS += $(GBM_LIBS) $(DRM_LIBS)
else
ifeq ($(HAVE_GLES), 1)
OBJ += gfx/context/xegl_ctx.o
endif
ifeq ($(OSX), 1)
LIBS += -framework OpenGL
else
ifeq ($(HAVE_KMS), 1)
OBJ += gfx/context/drm_egl_ctx.o
DEFINES += $(GBM_CFLAGS) $(DRM_CFLAGS) $(EGL_CFLAGS)
LIBS += $(GBM_LIBS) $(DRM_LIBS) $(EGL_LIBS)
else ifeq ($(HAVE_GLES), 1)
OBJ += gfx/context/xegl_ctx.o
DEFINES += $(EGL_CFLAGS)
LIBS += $(EGL_LIBS)
else
LIBS += -lGL
OBJ += gfx/context/sdl_ctx.o
endif
ifeq ($(HAVE_GLES), 1)
LIBS += -lGLESv2
DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2
else
LIBS += -lGL
endif
endif
endif
endif
ifeq ($(HAVE_RPI), 1)
@ -189,9 +198,9 @@ ifeq ($(HAVE_XML), 1)
LIBS += $(XML_LIBS)
DEFINES += $(XML_CFLAGS)
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/shader_glsl.o
endif
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/shader_glsl.o
endif
endif
ifeq ($(HAVE_XML), 1)
@ -262,11 +271,11 @@ CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) -g -I. -pedantic
ifeq ($(CXX_BUILD), 1)
CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
else
ifneq ($(findstring icc,$(CC)),)
CFLAGS += -std=c99 -D_GNU_SOURCE
else
CFLAGS += -std=gnu99
endif
ifneq ($(findstring icc,$(CC)),)
CFLAGS += -std=c99 -D_GNU_SOURCE
else
CFLAGS += -std=gnu99
endif
endif
ifeq ($(NOUNUSED), yes)

View File

@ -22,6 +22,10 @@
#include "../gl_common.h"
#include "../gfx_common.h"
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include <errno.h>
#include <signal.h>
#include <stdint.h>
@ -321,7 +325,11 @@ bool gfx_ctx_init(void)
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_ALPHA_SIZE, 0,
#ifdef HAVE_OPENGLES2
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#else
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
#endif
EGL_NONE
};
@ -336,8 +344,15 @@ bool gfx_ctx_init(void)
if (!eglInitialize(g_egl_dpy, &major, &minor))
goto error;
#ifdef HAVE_OPENGLES2
RARCH_LOG("[KMS/EGL]: Using OpenGL ES API.\n");
if (!eglBindAPI(EGL_OPENGL_ES_API))
goto error;
#else
RARCH_LOG("[KMS/EGL]: Using OpenGL API.\n");
if (!eglBindAPI(EGL_OPENGL_API))
goto error;
#endif
EGLint n;
if (!eglChooseConfig(g_egl_dpy, config_attribs, &g_config, 1, &n) || n != 1)

View File

@ -134,10 +134,12 @@ if [ "$HAVE_KMS" = "yes" ]; then
if [ "$HAVE_GBM" = "yes" ] && [ "$HAVE_DRM" = "yes" ]; then
HAVE_KMS=yes
HAVE_GLES=yes
fi
fi
check_lib GLES -lEGL eglCreateContext
[ "$HAVE_GLES" = "yes" ] && HAVE_EGL=yes
check_pkgconf EGL egl
check_pkgconf GLES glesv2
check_pkgconf FREETYPE freetype2
check_pkgconf X11 x11
@ -156,6 +158,6 @@ check_pkgconf PYTHON python3
add_define_make OS "$OS"
# Creates config.mk and config.h.
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL GLES KMS GBM DRM DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE LIBPNG DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO PBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 SINC FIXED_POINT BSV_MOVIE RPI"
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL GLES EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE LIBPNG DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO PBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 SINC FIXED_POINT BSV_MOVIE RPI"
create_config_make config.mk $VARS
create_config_header config.h $VARS