Fixed building on Raspberry Pi

This commit is contained in:
Sam Lantinga
2023-01-13 14:20:57 -08:00
parent 0ed4589ed2
commit bf53183c8b
6 changed files with 44 additions and 13 deletions

View File

@@ -670,6 +670,7 @@ macro(CheckVivante)
find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED) find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED)
list(APPEND SDL_EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY}) list(APPEND SDL_EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY})
else() else()
list(APPEND SDL_PC_CFLAGS -DLINUX -DEGL_API_FB)
list(APPEND SDL_EXTRA_LIBS EGL) list(APPEND SDL_EXTRA_LIBS EGL)
endif(HAVE_VIVANTE_VDK) endif(HAVE_VIVANTE_VDK)
endif() endif()
@@ -1095,7 +1096,9 @@ macro(CheckRPI)
set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib") set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib")
endif() endif()
listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I") listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
separate_arguments(VIDEO_RPI_INCLUDE_FLAGS)
listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L") listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
separate_arguments(VIDEO_RPI_LIBRARY_FLAGS)
cmake_push_check_state() cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
@@ -1115,8 +1118,8 @@ macro(CheckRPI)
file(GLOB VIDEO_RPI_SOURCES ${SDL3_SOURCE_DIR}/src/video/raspberry/*.c) file(GLOB VIDEO_RPI_SOURCES ${SDL3_SOURCE_DIR}/src/video/raspberry/*.c)
list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES}) list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES})
list(APPEND SDL_EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) list(APPEND SDL_EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
target_compile_options(sdl-build-options INTERFACE ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}) target_compile_options(sdl-build-options INTERFACE ${VIDEO_RPI_INCLUDE_FLAGS})
list(APPEND SDL_EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS}) list(APPEND SDL_EXTRA_LDFLAGS ${VIDEO_RPI_LIBRARY_FLAGS} ${VIDEO_RPI_LDFLAGS})
endif() endif()
endif() endif()
endmacro() endmacro()

View File

@@ -24,7 +24,7 @@
* *
* This is a simple file to encapsulate the EGL API headers. * This is a simple file to encapsulate the EGL API headers.
*/ */
#ifdef SDL_USE_SYSTEM_EGL_HEADERS #if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#if defined(__vita__) || defined(__psp2__) #if defined(__vita__) || defined(__psp2__)
#include <psp2/types.h> #include <psp2/types.h>
@@ -33,7 +33,7 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#else /* !SDL_USE_SYSTEM_EGL_HEADERS */ #else /* _MSC_VER */
/* EGL headers for Visual Studio */ /* EGL headers for Visual Studio */
@@ -2349,4 +2349,4 @@ EGLAPI struct wl_buffer *EGLAPIENTRY eglCreateWaylandBufferFromImageWL (EGLDispl
#endif /* __eglext_h_ */ #endif /* __eglext_h_ */
#endif /* SDL_USE_SYSTEM_EGL_HEADERS */ #endif /* _MSC_VER */

View File

@@ -31,6 +31,37 @@
#define SDL_EGL_MAX_DEVICES 8 #define SDL_EGL_MAX_DEVICES 8
/* For systems that don't define these */
typedef intptr_t EGLAttrib;
typedef void *EGLDeviceEXT;
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDISPLAYPROC) (EGLNativeDisplayType display_id);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLTERMINATEPROC) (EGLDisplay dpy);
typedef __eglMustCastToProperFunctionPointerType (EGLAPIENTRYP PFNEGLGETPROCADDRESSPROC) (const char *procname);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLContext (EGLAPIENTRYP PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx);
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERSURFACEPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval);
typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITNATIVEPROC) (EGLint engine);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITGLPROC) (void);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDAPIPROC) (EGLenum api);
typedef EGLint (EGLAPIENTRYP PFNEGLGETERRORPROC) (void);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
typedef struct SDL_EGL_VideoData typedef struct SDL_EGL_VideoData
{ {
void *opengl_dll_handle, *egl_dll_handle; void *opengl_dll_handle, *egl_dll_handle;

View File

@@ -277,11 +277,6 @@ static int RPI_WarpMouseGlobalGraphically(float x, float y)
static int RPI_WarpMouseGlobal(float x, float y) static int RPI_WarpMouseGlobal(float x, float y)
{ {
RPI_CursorData *curdata;
DISPMANX_UPDATE_HANDLE_T update;
int ret;
VC_RECT_T dst_rect;
VC_RECT_T src_rect;
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) { if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {

View File

@@ -26,9 +26,7 @@
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include <bcm_host.h> #include <bcm_host.h>
#include "GLES/gl.h" #include <SDL3/SDL_egl.h>
#include "EGL/egl.h"
#include "EGL/eglext.h"
typedef struct SDL_VideoData typedef struct SDL_VideoData
{ {

View File

@@ -25,6 +25,10 @@
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
/* Set up definitions for Vivante EGL */
#define LINUX
#define EGL_API_FB
#include <SDL3/SDL_egl.h> #include <SDL3/SDL_egl.h>
#if SDL_VIDEO_DRIVER_VIVANTE_VDK #if SDL_VIDEO_DRIVER_VIVANTE_VDK