Deprecate SDL2-rotated in favor of SDL2 + patches.
This commit is contained in:
parent
8d9928f104
commit
21bbd997ef
7 changed files with 0 additions and 584 deletions
|
@ -1,123 +0,0 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2018-present 5schatten (https://github.com/5schatten)
|
||||
# Copyright (C) 2022-present Fewtarius
|
||||
|
||||
PKG_NAME="SDL2-rotated"
|
||||
PKG_VERSION="$(get_pkg_version SDL2)"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="https://www.libsdl.org/"
|
||||
PKG_URL="https://www.libsdl.org/release/SDL2-${PKG_VERSION}.tar.gz"
|
||||
PKG_DEPENDS_TARGET="toolchain alsa-lib systemd dbus pulseaudio libdrm"
|
||||
PKG_LONGDESC="Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware."
|
||||
PKG_DEPENDS_HOST="toolchain:host distutilscross:host"
|
||||
PKG_PATCH_DIRS+="${DEVICE}"
|
||||
|
||||
if [ ! "${OPENGL}" = "no" ]; then
|
||||
PKG_DEPENDS_TARGET+=" ${OPENGL} glu"
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_OPENGL=ON \
|
||||
-DVIDEO_OPENGL=ON \
|
||||
-DVIDEO_KMSDRM=OFF"
|
||||
else
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_OPENGL=OFF \
|
||||
-DVIDEO_OPENGL=OFF \
|
||||
-DVIDEO_KMSDRM=OFF"
|
||||
fi
|
||||
|
||||
if [ "${OPENGLES_SUPPORT}" = "yes" ]; then
|
||||
PKG_DEPENDS_TARGET+=" ${OPENGLES}"
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_OPENGLES=ON \
|
||||
-DVIDEO_OPENGLES=ON \
|
||||
-DVIDEO_KMSDRM=ON"
|
||||
else
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_OPENGLES=OFF \
|
||||
-DVIDEO_OPENGLES=OFF \
|
||||
-DVIDEO_KMSDRM=OFF"
|
||||
fi
|
||||
|
||||
if [ "${VULKAN_SUPPORT}" = "yes" ]; then
|
||||
PKG_DEPENDS_TARGET+=" vulkan-loader vulkan-headers"
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_VULKAN=ON \
|
||||
-DVIDEO_OPENGL=OFF \
|
||||
-DVIDEO_VULKAN=ON"
|
||||
else
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_VULKAN=OFF \
|
||||
-DVIDEO_VULKAN=OFF"
|
||||
fi
|
||||
|
||||
if [ "${DISPLAYSERVER}" = "wl" ]
|
||||
then
|
||||
PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER}"
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_WAYLAND=ON \
|
||||
-DVIDEO_WAYLAND=ON \
|
||||
-DVIDEO_WAYLAND_QT_TOUCH=OFF \
|
||||
-DWAYLAND_SHARED=ON \
|
||||
-DVIDEO_X11=OFF \
|
||||
-DSDL_X11=OFF"
|
||||
else
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DVIDEO_WAYLAND=OFF \
|
||||
-DVIDEO_WAYLAND_QT_TOUCH=ON \
|
||||
-DWAYLAND_SHARED=OFF \
|
||||
-DVIDEO_X11=OFF \
|
||||
-DSDL_X11=OFF"
|
||||
fi
|
||||
|
||||
PKG_DEPENDS_TARGET+=" librga"
|
||||
pre_make_host() {
|
||||
sed -i "s| -lrga||g" ${PKG_BUILD}/CMakeLists.txt
|
||||
}
|
||||
pre_make_target() {
|
||||
if ! `grep -rnw "${PKG_BUILD}/CMakeLists.txt" -e '-lrga'`; then
|
||||
sed -i "s|--no-undefined|--no-undefined -lrga|" ${PKG_BUILD}/CMakeLists.txt
|
||||
fi
|
||||
}
|
||||
|
||||
pre_configure_target(){
|
||||
export LDFLAGS="${LDFLAGS} -ludev"
|
||||
PKG_CMAKE_OPTS_TARGET+="-DSDL_STATIC=OFF \
|
||||
-DLIBC=ON \
|
||||
-DGCC_ATOMICS=ON \
|
||||
-DALTIVEC=OFF \
|
||||
-DOSS=OFF \
|
||||
-DALSA=ON \
|
||||
-DALSA_SHARED=ON \
|
||||
-DJACK=OFF \
|
||||
-DJACK_SHARED=OFF \
|
||||
-DESD=OFF \
|
||||
-DESD_SHARED=OFF \
|
||||
-DARTS=OFF \
|
||||
-DARTS_SHARED=OFF \
|
||||
-DNAS=OFF \
|
||||
-DNAS_SHARED=OFF \
|
||||
-DLIBSAMPLERATE=OFF \
|
||||
-DLIBSAMPLERATE_SHARED=OFF \
|
||||
-DSNDIO=OFF \
|
||||
-DDISKAUDIO=OFF \
|
||||
-DDUMMYAUDIO=OFF \
|
||||
-DVIDEO_X11=OFF \
|
||||
-DVIDEO_MIR=OFF \
|
||||
-DMIR_SHARED=OFF \
|
||||
-DVIDEO_COCOA=OFF \
|
||||
-DVIDEO_DIRECTFB=OFF \
|
||||
-DVIDEO_VIVANTE=OFF \
|
||||
-DDIRECTFB_SHARED=OFF \
|
||||
-DFUSIONSOUND=OFF \
|
||||
-DFUSIONSOUND_SHARED=OFF \
|
||||
-DVIDEO_DUMMY=OFF \
|
||||
-DINPUT_TSLIB=ON \
|
||||
-DSDL_HIDAPI_JOYSTICK=ON \
|
||||
-DPTHREADS=ON \
|
||||
-DPTHREADS_SEM=ON \
|
||||
-DDIRECTX=OFF \
|
||||
-DSDL_DLOPEN=ON \
|
||||
-DCLOCK_GETTIME=OFF \
|
||||
-DRPATH=OFF \
|
||||
-DRENDER_D3D=OFF \
|
||||
-DPULSEAUDIO=ON"
|
||||
}
|
||||
|
||||
post_makeinstall_target() {
|
||||
sed -e "s:\(['=LI]\)/usr:\\1${SYSROOT_PREFIX}/usr:g" -i ${SYSROOT_PREFIX}/usr/bin/sdl2-config
|
||||
rm -rf ${INSTALL}/usr/bin
|
||||
mkdir ${INSTALL}/usr/lib/SDL2-rotated
|
||||
mv ${INSTALL}/usr/lib/libSDL* ${INSTALL}/usr/lib/SDL2-rotated
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
From 7c4b7b8f46a3d688fe34c30741e260fa08a70813 Mon Sep 17 00:00:00 2001
|
||||
From: Fewtarius <fewtarius@gmail.com>
|
||||
Date: Sun, 4 Apr 2021 09:42:49 -0400
|
||||
Subject: [PATCH] Split V and P/M
|
||||
|
||||
---
|
||||
.../packages/SDL2/patches/0003-no-cursor.patch | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
create mode 100644 projects/Rockchip/devices/RG351P/packages/SDL2/patches/0003-no-cursor.patch
|
||||
|
||||
diff --git a/projects/Rockchip/devices/RG351P/packages/SDL2/patches/0003-no-cursor.patch b/projects/Rockchip/devices/RG351P/packages/SDL2/patches/0003-no-cursor.patch
|
||||
new file mode 100644
|
||||
index 00000000..d912a67a
|
||||
--- /dev/null
|
||||
+++ b/projects/Rockchip/devices/RG351P/packages/SDL2/patches/0003-no-cursor.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
+diff -rupN SDL2-2.0.10.orig/src/events/SDL_mouse.c SDL2-2.0.10.new/src/events/SDL_mouse.c
|
||||
+--- SDL2-2.0.10.orig/src/events/SDL_mouse.c 2019-07-25 00:32:36.000000000 -0400
|
||||
++++ SDL2-2.0.10.new/src/events/SDL_mouse.c 2021-01-08 19:35:14.792357252 -0500
|
||||
+@@ -158,7 +158,7 @@ SDL_MouseInit(void)
|
||||
+
|
||||
+ mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */
|
||||
+
|
||||
+- mouse->cursor_shown = SDL_TRUE;
|
||||
++ mouse->cursor_shown = SDL_FALSE;
|
||||
+
|
||||
+ return (0);
|
||||
+ }
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
|
||||
index 87d693e8d..891d588c4 100644
|
||||
--- a/src/video/SDL_egl.c
|
||||
+++ b/src/video/SDL_egl.c
|
||||
@@ -1032,7 +1032,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- _this->egl_data->egl_swapinterval = 0;
|
||||
+ _this->egl_data->egl_swapinterval = 1;
|
||||
|
||||
if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) {
|
||||
/* Save the SDL error set by SDL_EGL_MakeCurrent */
|
||||
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
index 3d76284fd..72163286b 100644
|
||||
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
@@ -82,6 +82,7 @@ int KMSDRM_GLES_SetSwapInterval(_THIS, int interval) {
|
||||
return SDL_SetError("EGL not initialized");
|
||||
}
|
||||
|
||||
+ interval = 1;
|
||||
if (interval == 0 || interval == 1) {
|
||||
_this->egl_data->egl_swapinterval = interval;
|
||||
} else {
|
|
@ -1,59 +0,0 @@
|
|||
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
index fbc2c96..cedc739 100644
|
||||
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
@@ -609,6 +609,24 @@ void KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resource
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ // batocera - set resolution
|
||||
+ {
|
||||
+ FILE* fdDrmMode;
|
||||
+ int drmMode;
|
||||
+ if((fdDrmMode = fopen("/var/run/drmMode", "r")) != NULL) {
|
||||
+ if(fscanf(fdDrmMode, "%i", &drmMode) == 1) {
|
||||
+ if(drmMode>=0 && drmMode<connector->count_modes) {
|
||||
+ drmModeCrtc *pcrtc = KMSDRM_drmModeGetCrtc(viddata->drm_fd, encoder->crtc_id);
|
||||
+ if(pcrtc != NULL) {
|
||||
+ KMSDRM_drmModeSetCrtc(viddata->drm_fd, pcrtc->crtc_id, pcrtc->buffer_id, 0, 0, &connector->connector_id, 1, &connector->modes[drmMode]);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(fdDrmMode);
|
||||
+ }
|
||||
+ }
|
||||
+ //
|
||||
+
|
||||
/* Try to find a CRTC connected to this encoder */
|
||||
crtc = KMSDRM_drmModeGetCrtc(viddata->drm_fd, encoder->crtc_id);
|
||||
|
||||
@@ -1107,8 +1125,27 @@ KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||
SDL_DisplayMode mode;
|
||||
int i;
|
||||
|
||||
+ // batocera
|
||||
+ int wantedMode = 0;
|
||||
+ {
|
||||
+ FILE* fdDrmMode;
|
||||
+ int drmMode;
|
||||
+ if((fdDrmMode = fopen("/var/run/drmMode", "r")) != NULL) {
|
||||
+ if(fscanf(fdDrmMode, "%i", &drmMode) == 1) {
|
||||
+ if(drmMode>=0 && drmMode<conn->count_modes) {
|
||||
+ wantedMode = drmMode;
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(fdDrmMode);
|
||||
+ }
|
||||
+ }
|
||||
+ //
|
||||
+
|
||||
for (i = 0; i < conn->count_modes; i++) {
|
||||
- SDL_DisplayModeData *modedata = SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
||||
+ SDL_DisplayModeData *modedata;
|
||||
+ if(i != wantedMode) continue; // batocera
|
||||
+
|
||||
+ modedata = SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
||||
|
||||
if (modedata) {
|
||||
modedata->mode_index = i;
|
||||
|
|
@ -1,282 +0,0 @@
|
|||
diff -rupN SDL2.orig/CMakeLists.txt SDL2/CMakeLists.txt
|
||||
--- SDL2.orig/CMakeLists.txt 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/CMakeLists.txt 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -663,7 +663,7 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC)
|
||||
check_c_compiler_flag("" HAVE_NO_UNDEFINED)
|
||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||
if(HAVE_NO_UNDEFINED AND NOT (USE_CLANG AND WINDOWS))
|
||||
- list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,--no-undefined")
|
||||
+ list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,--no-undefined -lrga")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
diff -rupN SDL2.orig/Makefile.in SDL2/Makefile.in
|
||||
--- SDL2.orig/Makefile.in 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/Makefile.in 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -23,7 +23,7 @@ CXX = @CXX@
|
||||
INCLUDE = @INCLUDE@
|
||||
CFLAGS = @BUILD_CFLAGS@
|
||||
EXTRA_CFLAGS = @EXTRA_CFLAGS@
|
||||
-LDFLAGS = @BUILD_LDFLAGS@
|
||||
+LDFLAGS = @BUILD_LDFLAGS@ -lrga
|
||||
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
INSTALL = @INSTALL@
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmopengles.c SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmopengles.c 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c 2023-07-26 10:30:42.776858597 +0000
|
||||
@@ -29,11 +29,15 @@
|
||||
#include "SDL_kmsdrmopengles.h"
|
||||
#include "SDL_kmsdrmdyn.h"
|
||||
#include <errno.h>
|
||||
+#include<stdbool.h>
|
||||
|
||||
#ifndef EGL_PLATFORM_GBM_MESA
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
#endif
|
||||
|
||||
+extern rga_info_t src_info;
|
||||
+extern rga_info_t dst_info;
|
||||
+
|
||||
/* EGL implementation of SDL OpenGL support */
|
||||
|
||||
void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor)
|
||||
@@ -92,6 +96,7 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Wi
|
||||
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||
KMSDRM_FBInfo *fb_info;
|
||||
int ret = 0;
|
||||
+ struct gbm_bo* rga_buffer = NULL;
|
||||
|
||||
/* Always wait for the previous issued flip before issuing a new one,
|
||||
even if you do async flips. */
|
||||
@@ -135,7 +140,26 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Wi
|
||||
}
|
||||
|
||||
/* Get an actual usable fb for the next front buffer. */
|
||||
- fb_info = KMSDRM_FBFromBO(_this, windata->next_bo);
|
||||
+ if (src_info.fd) {
|
||||
+ close(src_info.fd);
|
||||
+ }
|
||||
+ src_info.fd = KMSDRM_gbm_bo_get_fd(windata->next_bo);
|
||||
+ dst_info.fd = viddata->rga_buffer_prime_fds[viddata->rga_buffer_index];
|
||||
+ if (c_RkRgaBlit(&src_info, &dst_info, NULL) < 0) {
|
||||
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO,
|
||||
+ "Failed to rga blit\n");
|
||||
+ }
|
||||
+
|
||||
+ rga_buffer = viddata->rga_buffers[viddata->rga_buffer_index];
|
||||
+ fb_info = KMSDRM_FBFromBO(_this, rga_buffer);
|
||||
+
|
||||
+ if (!fb_info) {
|
||||
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not get a framebuffer");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ viddata->rga_buffer_index = (viddata->rga_buffer_index + 1) % RGA_BUFFERS_MAX;
|
||||
+
|
||||
if (fb_info == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not get a framebuffer");
|
||||
return 0;
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmsym.h SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmsym.h 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -122,7 +122,7 @@ SDL_KMSDRM_SYM(struct gbm_surface *,gbm_
|
||||
SDL_KMSDRM_SYM(void,gbm_surface_destroy,(struct gbm_surface *surf))
|
||||
SDL_KMSDRM_SYM(struct gbm_bo *,gbm_surface_lock_front_buffer,(struct gbm_surface *surf))
|
||||
SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct gbm_bo *bo))
|
||||
-
|
||||
+SDL_KMSDRM_SYM(int,gbm_bo_get_fd,(struct gbm_bo *bo))
|
||||
|
||||
#undef SDL_KMSDRM_MODULE
|
||||
#undef SDL_KMSDRM_SYM
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.c SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.c 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c 2023-07-26 10:33:34.282693634 +0000
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "SDL_kmsdrmopengles.h"
|
||||
#include "SDL_kmsdrmmouse.h"
|
||||
#include "SDL_kmsdrmdyn.h"
|
||||
+#include <sys/ioctl.h>
|
||||
#include "SDL_kmsdrmvulkan.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
@@ -51,6 +52,7 @@
|
||||
#include <dirent.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
+#include<stdbool.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
static SDL_bool moderndri = SDL_FALSE;
|
||||
@@ -68,6 +70,9 @@ static char kmsdrm_dri_cardpath[32];
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
#endif
|
||||
|
||||
+rga_info_t src_info = {0};
|
||||
+rga_info_t dst_info = {0};
|
||||
+
|
||||
static int get_driindex(void)
|
||||
{
|
||||
int available = -ENOENT;
|
||||
@@ -330,6 +335,46 @@ static void KMSDRM_FBDestroyCallback(str
|
||||
SDL_free(fb_info);
|
||||
}
|
||||
|
||||
+static void
|
||||
+KMSDRM_InitRotateBuffer(_THIS, int frameWidth, int frameHeight)
|
||||
+{
|
||||
+ int l_frameHeight;
|
||||
+ SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||
+
|
||||
+ // initialize 2D raster graphic acceleration unit (RGA)
|
||||
+ c_RkRgaInit();
|
||||
+
|
||||
+ l_frameHeight = frameHeight;
|
||||
+ if(l_frameHeight % 32 != 0) {
|
||||
+ l_frameHeight = (frameHeight + 32) & (~31);
|
||||
+ }
|
||||
+
|
||||
+ // create buffers for RGA with adjusted stride
|
||||
+ for (int i = 0; i < RGA_BUFFERS_MAX; ++i)
|
||||
+ {
|
||||
+ viddata->rga_buffers[i] = KMSDRM_gbm_bo_create(viddata->gbm_dev,
|
||||
+ frameWidth, l_frameHeight,
|
||||
+ GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||
+ assert(viddata->rga_buffers[i]);
|
||||
+
|
||||
+ viddata->rga_buffer_prime_fds[i] = KMSDRM_gbm_bo_get_fd(viddata->rga_buffers[i]);
|
||||
+ }
|
||||
+ viddata->rga_buffer_index = 0;
|
||||
+
|
||||
+ // setup rotation
|
||||
+ src_info.fd = -1;
|
||||
+ src_info.mmuFlag = 1;
|
||||
+ src_info.rotation = HAL_TRANSFORM_ROT_270;
|
||||
+
|
||||
+ // swap width and height and adjust stride here because our source buffer is 480x854
|
||||
+ rga_set_rect(&src_info.rect, 0, 0, frameHeight, frameWidth, l_frameHeight, frameWidth, RK_FORMAT_BGRA_8888);
|
||||
+
|
||||
+ dst_info.fd = -1;
|
||||
+ dst_info.mmuFlag = 1;
|
||||
+
|
||||
+ rga_set_rect(&dst_info.rect, 0, 0, frameWidth, frameHeight, frameWidth, frameHeight, RK_FORMAT_BGRA_8888);
|
||||
+}
|
||||
+
|
||||
KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
|
||||
{
|
||||
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||
@@ -848,8 +893,8 @@ static void KMSDRM_AddDisplay(_THIS, drm
|
||||
modedata->mode_index = mode_index;
|
||||
|
||||
display.driverdata = dispdata;
|
||||
- display.desktop_mode.w = dispdata->mode.hdisplay;
|
||||
- display.desktop_mode.h = dispdata->mode.vdisplay;
|
||||
+ display.desktop_mode.w = dispdata->mode.vdisplay;
|
||||
+ display.desktop_mode.h = dispdata->mode.hdisplay;
|
||||
display.desktop_mode.refresh_rate = dispdata->mode.vrefresh;
|
||||
display.desktop_mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||
display.desktop_mode.driverdata = modedata;
|
||||
@@ -1124,7 +1169,8 @@ static void KMSDRM_DirtySurfaces(SDL_Win
|
||||
or SetWindowFullscreen, send a fake event for now since the actual
|
||||
recreation is deferred */
|
||||
KMSDRM_GetModeToSet(window, &mode);
|
||||
- SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, mode.hdisplay, mode.vdisplay);
|
||||
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, mode.vdisplay, mode.hdisplay);
|
||||
+
|
||||
}
|
||||
|
||||
/* This determines the size of the fb, which comes from the GBM surface
|
||||
@@ -1159,13 +1205,13 @@ int KMSDRM_CreateSurfaces(_THIS, SDL_Win
|
||||
mode that's set in sync with what SDL_video.c thinks is set */
|
||||
KMSDRM_GetModeToSet(window, &dispdata->mode);
|
||||
|
||||
- display->current_mode.w = dispdata->mode.hdisplay;
|
||||
- display->current_mode.h = dispdata->mode.vdisplay;
|
||||
+ display->current_mode.w = dispdata->mode.vdisplay;
|
||||
+ display->current_mode.h = dispdata->mode.hdisplay;
|
||||
display->current_mode.refresh_rate = dispdata->mode.vrefresh;
|
||||
display->current_mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||
|
||||
windata->gs = KMSDRM_gbm_surface_create(viddata->gbm_dev,
|
||||
- dispdata->mode.hdisplay, dispdata->mode.vdisplay,
|
||||
+ dispdata->mode.vdisplay, dispdata->mode.hdisplay,
|
||||
surface_fmt, surface_flags);
|
||||
|
||||
if (!windata->gs) {
|
||||
@@ -1189,7 +1235,7 @@ int KMSDRM_CreateSurfaces(_THIS, SDL_Win
|
||||
ret = SDL_EGL_MakeCurrent(_this, windata->egl_surface, egl_context);
|
||||
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
|
||||
- dispdata->mode.hdisplay, dispdata->mode.vdisplay);
|
||||
+ dispdata->mode.vdisplay, dispdata->mode.hdisplay);
|
||||
|
||||
windata->egl_surface_dirty = SDL_FALSE;
|
||||
|
||||
@@ -1272,8 +1318,8 @@ void KMSDRM_GetDisplayModes(_THIS, SDL_V
|
||||
modedata->mode_index = i;
|
||||
}
|
||||
|
||||
- mode.w = conn->modes[i].hdisplay;
|
||||
- mode.h = conn->modes[i].vdisplay;
|
||||
+ mode.w = conn->modes[i].vdisplay;
|
||||
+ mode.h = conn->modes[i].hdisplay;
|
||||
mode.refresh_rate = conn->modes[i].vrefresh;
|
||||
mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||
mode.driverdata = modedata;
|
||||
@@ -1386,6 +1432,13 @@ void KMSDRM_DestroyWindow(_THIS, SDL_Win
|
||||
/*********************************************************************/
|
||||
SDL_free(window->driverdata);
|
||||
window->driverdata = NULL;
|
||||
+ for (int i = 0; i < RGA_BUFFERS_MAX; ++i) {
|
||||
+ close(viddata->rga_buffer_prime_fds[i]);
|
||||
+ }
|
||||
+ if (src_info.fd) {
|
||||
+ close(src_info.fd);
|
||||
+ }
|
||||
+ c_RkRgaDeInit();
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
@@ -1404,6 +1457,7 @@ int KMSDRM_CreateWindow(_THIS, SDL_Windo
|
||||
NativeDisplayType egl_display;
|
||||
drmModeModeInfo *mode;
|
||||
int ret = 0;
|
||||
+ SDL_DisplayData *data;
|
||||
|
||||
/* Allocate window internal data */
|
||||
windata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
|
||||
@@ -1519,6 +1573,9 @@ int KMSDRM_CreateWindow(_THIS, SDL_Windo
|
||||
SDL_SetMouseFocus(window);
|
||||
SDL_SetKeyboardFocus(window);
|
||||
|
||||
+ data = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||
+ KMSDRM_InitRotateBuffer(_this, data->mode.hdisplay, data->mode.vdisplay);
|
||||
+
|
||||
/* Tell the app that the window has moved to top-left. */
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, 0, 0);
|
||||
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.h SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.h 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -32,6 +32,10 @@
|
||||
#include <xf86drmMode.h>
|
||||
#include <gbm.h>
|
||||
#include <EGL/egl.h>
|
||||
+#include <rga/RgaApi.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+#define RGA_BUFFERS_MAX (3)
|
||||
|
||||
typedef struct SDL_VideoData
|
||||
{
|
||||
@@ -53,6 +57,10 @@ typedef struct SDL_VideoData
|
||||
open 1 FD and create 1 gbm device. */
|
||||
SDL_bool gbm_init;
|
||||
|
||||
+ struct gbm_bo* rga_buffers[RGA_BUFFERS_MAX];
|
||||
+ int rga_buffer_prime_fds[RGA_BUFFERS_MAX];
|
||||
+ int rga_buffer_index;
|
||||
+
|
||||
} SDL_VideoData;
|
||||
|
||||
typedef struct SDL_DisplayModeData
|
|
@ -1,58 +0,0 @@
|
|||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmmouse.c SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmmouse.c 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c 2023-07-26 10:27:12.232726116 +0000
|
||||
@@ -150,6 +150,7 @@ static int KMSDRM_DumpCursorToBO(SDL_Vid
|
||||
uint8_t *src_row;
|
||||
|
||||
int i;
|
||||
+ int j;
|
||||
int ret;
|
||||
|
||||
if (curdata == NULL || !dispdata->cursor_bo) {
|
||||
@@ -170,8 +171,10 @@ static int KMSDRM_DumpCursorToBO(SDL_Vid
|
||||
|
||||
/* Copy from the cursor buffer to a buffer that we can dump to the GBM BO. */
|
||||
for (i = 0; i < curdata->h; i++) {
|
||||
- src_row = &((uint8_t *)curdata->buffer)[i * curdata->w * 4];
|
||||
- SDL_memcpy(ready_buffer + (i * bo_stride), src_row, (size_t)4 * curdata->w);
|
||||
+ for (j = 0; j < curdata->w; j++) {
|
||||
+ src_row = ((uint32_t*)curdata->buffer)[i * curdata->w + j];
|
||||
+ SDL_memcpy(ready_buffer + ((curdata->w - j + 1) * bo_stride) + i, &src_row, 4);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Dump the cursor buffer to our GBM BO. */
|
||||
@@ -370,6 +373,7 @@ static int KMSDRM_WarpMouseGlobal(int x,
|
||||
|
||||
SDL_Window *window = mouse->focus;
|
||||
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayForWindow(window)->driverdata;
|
||||
+ KMSDRM_CursorData *curdata = mouse->cur_cursor->driverdata;
|
||||
|
||||
/* Update internal mouse position. */
|
||||
SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
|
||||
@@ -378,7 +382,7 @@ static int KMSDRM_WarpMouseGlobal(int x,
|
||||
if (dispdata->cursor_bo) {
|
||||
int ret = 0;
|
||||
|
||||
- ret = KMSDRM_drmModeMoveCursor(dispdata->cursor_bo_drm_fd, dispdata->crtc->crtc_id, x, y);
|
||||
+ ret = KMSDRM_drmModeMoveCursor(dispdata->cursor_bo_drm_fd, dispdata->crtc->crtc_id, y, dispdata->mode.vdisplay + curdata->w - x);
|
||||
|
||||
if (ret) {
|
||||
SDL_SetError("drmModeMoveCursor() failed.");
|
||||
@@ -432,13 +436,14 @@ static void KMSDRM_MoveCursor(SDL_Cursor
|
||||
|
||||
SDL_Window *window = mouse->focus;
|
||||
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayForWindow(window)->driverdata;
|
||||
+ KMSDRM_CursorData *curdata = mouse->cur_cursor->driverdata;
|
||||
|
||||
if (!dispdata->cursor_bo) {
|
||||
SDL_SetError("Cursor not initialized properly.");
|
||||
return;
|
||||
}
|
||||
|
||||
- ret = KMSDRM_drmModeMoveCursor(dispdata->cursor_bo_drm_fd, dispdata->crtc->crtc_id, mouse->x, mouse->y);
|
||||
+ ret = KMSDRM_drmModeMoveCursor(dispdata->cursor_bo_drm_fd, dispdata->crtc->crtc_id, mouse->y, dispdata->mode.vdisplay - curdata->w - mouse->x);
|
||||
|
||||
if (ret) {
|
||||
SDL_SetError("drmModeMoveCursor() failed.");
|
||||
Binary files SDL2.orig/src/video/kmsdrm/.SDL_kmsdrmmouse.c.rej.swp and SDL2/src/video/kmsdrm/.SDL_kmsdrmmouse.c.rej.swp differ
|
|
@ -12,12 +12,6 @@ PKG_LONGDESC="Simple DirectMedia Layer is a cross-platform development library d
|
|||
PKG_DEPENDS_HOST="toolchain:host distutilscross:host"
|
||||
PKG_PATCH_DIRS+="${DEVICE}"
|
||||
|
||||
case ${ARCH} in
|
||||
arm|aarch64)
|
||||
PKG_DEPENDS_TARGET+=" SDL2-rotated"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! "${OPENGL}" = "no" ]; then
|
||||
PKG_DEPENDS_TARGET+=" ${OPENGL} glu"
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_OPENGL=ON \
|
||||
|
|
Loading…
Reference in a new issue