Merge pull request #1789 from fewtarius/dev
Fix HDMI output on Powkiddy x55
This commit is contained in:
commit
c8bac9249c
15 changed files with 342 additions and 17 deletions
123
packages/graphics/SDL2-rotated/package.mk
Normal file
123
packages/graphics/SDL2-rotated/package.mk
Normal file
|
@ -0,0 +1,123 @@
|
|||
# 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
|
||||
}
|
31
packages/graphics/SDL2-rotated/patches/0001-no-cursor.patch
Normal file
31
packages/graphics/SDL2-rotated/patches/0001-no-cursor.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
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
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
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 {
|
|
@ -0,0 +1,59 @@
|
|||
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;
|
||||
|
|
@ -12,6 +12,12 @@ 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 \
|
||||
|
@ -61,20 +67,6 @@ else
|
|||
-DSDL_X11=OFF"
|
||||
fi
|
||||
|
||||
case ${DEVICE} in
|
||||
RK3566-X55)
|
||||
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
|
||||
}
|
||||
;;
|
||||
esac
|
||||
|
||||
pre_configure_target(){
|
||||
export LDFLAGS="${LDFLAGS} -ludev"
|
||||
PKG_CMAKE_OPTS_TARGET+="-DSDL_STATIC=OFF \
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
|
||||
index d8210d5fa..4e932f9c7 100644
|
||||
--- a/src/events/SDL_touch.c
|
||||
+++ b/src/events/SDL_touch.c
|
||||
@@ -35,6 +35,7 @@ static SDL_Touch **SDL_touchDevices = NULL;
|
||||
#define SYNTHESIZE_TOUCH_TO_MOUSE 1
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
+static SDL_bool cursor_init = SDL_FALSE;
|
||||
static SDL_bool finger_touching = SDL_FALSE;
|
||||
static SDL_FingerID track_fingerid;
|
||||
static SDL_TouchID track_touchid;
|
||||
@@ -261,6 +262,11 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (!window) {
|
||||
+ // Fallback to the main application window.
|
||||
+ window = SDL_GetWindowFromID(1);
|
||||
+ }
|
||||
+
|
||||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
@@ -275,6 +281,13 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
|
||||
if (id != SDL_MOUSE_TOUCHID) {
|
||||
if (window) {
|
||||
+ if (cursor_init == SDL_FALSE) {
|
||||
+ // TODO - Initialization hack to reset cursor position to <0, 0>
|
||||
+ SDL_SendMouseMotion(window, 0, SDL_TRUE, -window->w, -window->h);
|
||||
+ mouse->x = 0; mouse->y = 0;
|
||||
+ x = 0.0f; y = 0.0f;
|
||||
+ cursor_init = SDL_TRUE;
|
||||
+ }
|
||||
if (down) {
|
||||
if (finger_touching == SDL_FALSE) {
|
||||
int pos_x = (int)(x * (float)window->w);
|
||||
@@ -283,12 +296,12 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
- SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
- SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
} else {
|
||||
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
|
||||
- SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,6 +396,11 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (!window) {
|
||||
+ // Fallback to the main application window.
|
||||
+ window = SDL_GetWindowFromID(1);
|
||||
+ }
|
||||
+
|
||||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
@@ -398,7 +416,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
- SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
}
|
||||
}
|
||||
}
|
0
packages/hardware/quirks/devices/Powkiddy x55/005-game-configs
Normal file → Executable file
0
packages/hardware/quirks/devices/Powkiddy x55/005-game-configs
Normal file → Executable file
18
packages/hardware/quirks/devices/Powkiddy x55/006-hdmi
Executable file
18
packages/hardware/quirks/devices/Powkiddy x55/006-hdmi
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
cat <<EOF >/storage/.config/profile.d/006-hdmi
|
||||
HDMI=\$(modetest 2>/dev/null | awk '/HDMI-/ {print \$3}')
|
||||
ROTATED=\$(</sys/devices/virtual/graphics/fbcon/rotate)
|
||||
if [ ! "\${HDMI}" = "connected" ] && \
|
||||
[ "\${ROTATED}" = "3" ]
|
||||
then
|
||||
SDL=\$(readlink -f /usr/lib/SDL2-rotated/libSDL2.so 2>/dev/null)
|
||||
export LD_PRELOAD="\${SDL}"
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod 0755 /storage/.config/profile.d/006-hdmi
|
|
@ -3,7 +3,7 @@
|
|||
# Copyright (C) 2020-present Fewtarius
|
||||
|
||||
PKG_NAME="emulationstation"
|
||||
PKG_VERSION="ef52409"
|
||||
PKG_VERSION="86efa99"
|
||||
PKG_GIT_CLONE_BRANCH="main"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
|
|
|
@ -44,3 +44,5 @@ then
|
|||
systemctl import-environment LANGUAGE
|
||||
fi
|
||||
|
||||
systemctl import-environment LD_PRELOAD
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
WINDOWMANAGER="no"
|
||||
|
||||
# kernel serial console
|
||||
EXTRA_CMDLINE="quiet rootwait console=ttyUSB0,1500000 fbcon=rotate:3 console=tty0 ssh consoleblank=0 systemd.show_status=0 loglevel=0 panic=20 video=HDMI-A-1:1280x720@60"
|
||||
EXTRA_CMDLINE="quiet rootwait console=ttyUSB0,1500000 fbcon=rotate:3 console=tty0 ssh consoleblank=0 systemd.show_status=0 loglevel=0 panic=20"
|
||||
|
||||
# additional packages to install
|
||||
# ADDITIONAL_PACKAGES=""
|
||||
|
|
|
@ -32,7 +32,7 @@ case ${DEVICE} in
|
|||
;;
|
||||
*X55)
|
||||
PKG_URL="${PKG_SITE}/rk3566-x55-kernel.git"
|
||||
PKG_VERSION="cd572b258"
|
||||
PKG_VERSION="a514c4665"
|
||||
GET_HANDLER_SUPPORT="git"
|
||||
PKG_GIT_CLONE_BRANCH="main"
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue