SDL3 with Hardware Acceleration for ROCKCHIP platform (mali blob)

This commit is contained in:
avafinger 2022-12-25 21:44:40 -03:00 committed by Sam Lantinga
parent 074a2b0f30
commit 12e0e6d130
5 changed files with 26 additions and 4 deletions

View File

@ -430,6 +430,7 @@ dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Waylan
dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR;SDL_WAYLAND_SHARED" OFF)
dep_option(SDL_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "SDL_WAYLAND" OFF)
set_option(SDL_RPI "Use Raspberry Pi video driver" ${UNIX_SYS})
set_option(SDL_ROCKCHIP "Use ROCKCHIP Hardware Acceleration video driver" ${UNIX_SYS})
set_option(SDL_COCOA "Use Cocoa video driver" ${APPLE})
set_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(SDL_XINPUT "Use Xinput for Windows" ${WINDOWS})
@ -1388,6 +1389,8 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
if(SDL_VIDEO)
# Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
CheckRPI()
# Need to check for ROCKCHIP platform and get rid of "Can't window GBM/EGL surfaces on window creation."
CheckROCKCHIP()
CheckX11()
# Need to check for EGL first because KMSDRM and Wayland depends on it.
CheckEGL()

View File

@ -675,7 +675,7 @@ macro(CheckGLX)
check_c_source_compiles("
#include <GL/glx.h>
int main(int argc, char** argv) { return 0; }" HAVE_OPENGL_GLX)
if(HAVE_OPENGL_GLX)
if(HAVE_OPENGL_GLX AND NOT HAVE_ROCKCHIP)
set(SDL_VIDEO_OPENGL_GLX 1)
endif()
endif()
@ -1115,6 +1115,21 @@ macro(CheckRPI)
endif()
endmacro()
# Requires:
# - n/a
macro(CheckROCKCHIP)
if(SDL_ROCKCHIP)
pkg_check_modules(VIDEO_ROCKCHIP mali)
if (VIDEO_ROCKCHIP_FOUND)
set(HAVE_ROCKCHIP TRUE)
endif()
if(SDL_VIDEO AND HAVE_ROCKCHIP)
set(HAVE_SDL_VIDEO TRUE)
set(SDL_VIDEO_DRIVER_ROCKCHIP 1)
endif()
endif()
endmacro()
# Requires:
# - EGL
# - PkgCheckModules

View File

@ -393,6 +393,7 @@
#cmakedefine SDL_VIDEO_DRIVER_WINRT @SDL_VIDEO_DRIVER_WINRT@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
#cmakedefine SDL_VIDEO_DRIVER_ROCKCHIP @SDL_VIDEO_DRIVER_ROCKCHIP@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
#cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@

View File

@ -37,8 +37,9 @@
void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor)
{
/* if SDL was _also_ built with the Raspberry Pi driver (so we're
definitely a Pi device), default to GLES2. */
#if SDL_VIDEO_DRIVER_RPI
definitely a Pi device) or with the ROCKCHIP video driver
(it's a ROCKCHIP device), default to GLES2. */
#if defined(SDL_VIDEO_DRIVER_RPI) || defined(SDL_VIDEO_DRIVER_ROCKCHIP)
*mask = SDL_GL_CONTEXT_PROFILE_ES;
*major = 2;
*minor = 0;

View File

@ -302,7 +302,9 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void)
return device;
cleanup:
SDL_free(device);
if (device) {
SDL_free(device);
}
if (viddata) {
SDL_free(viddata);