Bladeren bron

Fixed building on Raspberry Pi

Sam Lantinga 2 jaren geleden
bovenliggende
commit
bf53183c8b

+ 5 - 2
cmake/sdlchecks.cmake

@@ -670,6 +670,7 @@ macro(CheckVivante)
         find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED)
         list(APPEND SDL_EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY})
       else()
+        list(APPEND SDL_PC_CFLAGS -DLINUX -DEGL_API_FB)
         list(APPEND SDL_EXTRA_LIBS EGL)
       endif(HAVE_VIVANTE_VDK)
     endif()
@@ -1095,7 +1096,9 @@ macro(CheckRPI)
       set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib")
     endif()
     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")
+    separate_arguments(VIDEO_RPI_LIBRARY_FLAGS)
 
     cmake_push_check_state()
     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)
       list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES})
       list(APPEND SDL_EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
-      target_compile_options(sdl-build-options INTERFACE ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS})
-      list(APPEND SDL_EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS})
+      target_compile_options(sdl-build-options INTERFACE ${VIDEO_RPI_INCLUDE_FLAGS})
+      list(APPEND SDL_EXTRA_LDFLAGS ${VIDEO_RPI_LIBRARY_FLAGS} ${VIDEO_RPI_LDFLAGS})
     endif()
   endif()
 endmacro()

+ 3 - 3
include/SDL3/SDL_egl.h

@@ -24,7 +24,7 @@
  *
  *  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__)
 #include <psp2/types.h>
@@ -33,7 +33,7 @@
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 
-#else /* !SDL_USE_SYSTEM_EGL_HEADERS */
+#else /* _MSC_VER */
 
 /* EGL headers for Visual Studio */
 
@@ -2349,4 +2349,4 @@ EGLAPI struct wl_buffer *EGLAPIENTRY eglCreateWaylandBufferFromImageWL (EGLDispl
 
 #endif /* __eglext_h_ */
 
-#endif /* SDL_USE_SYSTEM_EGL_HEADERS */
+#endif /* _MSC_VER */

+ 31 - 0
src/video/SDL_egl_c.h

@@ -31,6 +31,37 @@
 
 #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
 {
     void *opengl_dll_handle, *egl_dll_handle;

+ 0 - 5
src/video/raspberry/SDL_rpimouse.c

@@ -277,11 +277,6 @@ static int RPI_WarpMouseGlobalGraphically(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();
 
     if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {

+ 1 - 3
src/video/raspberry/SDL_rpivideo.h

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

+ 4 - 0
src/video/vivante/SDL_vivantevideo.h

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