Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rochchip rga #877

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/emulators/libretro/retrorun/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2021-2024 Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2024 ROCKNIX (https://github.com/ROCKNIX)

PKG_NAME="retrorun"
PKG_VERSION="95ac0bf3a921beefee8b3bbf2faf89eef18f9b3a"
PKG_LICENSE="GPLv2"
PKG_SITE="https://github.com/navy1978/retrorun"
PKG_URL="${PKG_SITE}/archive/${PKG_VERSION}.zip"
PKG_DEPENDS_TARGET="toolchain librga libdrm"
PKG_TOOLCHAIN="make"

pre_configure_target() {
PKG_MAKE_OPTS_TARGET=" config=release ARCH="
}

makeinstall_target() {
mkdir -p $INSTALL/usr/bin
cp retrorun $INSTALL/usr/bin
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--- retrorun-95ac0bf3a921beefee8b3bbf2faf89eef18f9b3a/src/go2/input.cpp.orig 2024-04-11 22:22:16.000000000 +0000
+++ retrorun-95ac0bf3a921beefee8b3bbf2faf89eef18f9b3a/src/go2/input.cpp 2024-11-25 20:43:30.141283197 +0000
@@ -34,16 +34,15 @@
#include <dirent.h>
#include <stdbool.h>
#include <pthread.h>
+#include <glob.h>

-#include <libevdev-1.0/libevdev/libevdev.h>
+#include <libevdev/libevdev.h>
#include <linux/limits.h>

#define BATTERY_BUFFER_SIZE (128)
#define BRIGHTNESS_BUFFER_SIZE (128)
// joypad
-static const char *EVDEV_NAME = "/dev/input/by-path/platform-odroidgo2-joypad-event-joystick";
-static const char *EVDEV_NAME_2 = "/dev/input/by-path/platform-odroidgo3-joypad-event-joystick";
-static const char* EVDEV_NAME_3 = "/dev/input/by-path/platform-singleadc-joypad-event-joystick";
+static const char *EVDEV_WILDCARD = "/dev/input/by-path/platform-*-joypad-event-joystick";
// battery
static const char *BATTERY_STATUS_NAME = "/sys/class/power_supply/battery/status";
static const char *BATTERY_CAPACITY_NAME = "/sys/class/power_supply/battery/capacity";
@@ -431,6 +430,7 @@
{

int rc = 1;
+ glob_t globbuf;

go2_input_t *result = (go2_input_t *)malloc(sizeof(*result));
if (!result)
@@ -443,18 +443,12 @@

result->device = device;

- result->fd = open(EVDEV_NAME, O_RDONLY);
- if (result->fd < 0)
- {
- if (isRG503()){
- result->fd = open(EVDEV_NAME_3, O_RDONLY);
- }else{
- result->fd = open(EVDEV_NAME_2, O_RDONLY);
- }
- if (result->fd < 0)
- {
- printf("Joystick: No gamepad found.\n");
- }
+ rc = glob(EVDEV_WILDCARD, 0, NULL, &globbuf);
+ if (rc != 0) {
+ printf("Joystick: Failed to find device %s %d\n", EVDEV_WILDCARD, rc);
+ result->fd = -1;
+ } else {
+ result->fd = open(*globbuf.gl_pathv, O_RDONLY);
}

if (result->fd > -1)
@@ -663,4 +657,4 @@
go2_thumb_t go2_input_state_thumbstick_get(go2_input_state_t *state, go2_input_thumbstick_t thumbstick)
{
return state->thumbs[thumbstick];
-}
\ No newline at end of file
+}
14 changes: 10 additions & 4 deletions packages/graphics/librga/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX)

PKG_NAME="librga"
PKG_VERSION="ccfec13d6c48e3f0c7f24810b3dac162c40cdda8"
PKG_ARCH="arm aarch64"
PKG_VERSION="v2.2.0-1-b5fb3a6"
PKG_LICENSE="Apache-2.0"
PKG_DEPENDS_TARGET="toolchain libdrm"
PKG_SITE="https://github.com/varphone/rockchip-linux-rga"
PKG_URL="${PKG_SITE}.git"
PKG_SITE="https://github.com/tsukumijima/librga-rockchip"
PKG_URL="${PKG_SITE}/archive/refs/tags/${PKG_VERSION}.tar.gz"
PKG_LONGDESC="RGA is an independent 2D hardware acceleration userspace driver"
PKG_TOOLCHAIN="meson"

PKG_MESON_OPTS_TARGET="-Dlibdrm=true" # for samples add "-Dlibrga_demo=true"

post_unpack() {
grep -rl '#define LOCAL_FILE_PATH' ${PKG_BUILD}/samples | xargs -n1 sed -i 's|#define LOCAL_FILE_PATH .*$|#define LOCAL_FILE_PATH "/storage/rga"|'
sed -i '/utils\/3rdparty\/libdrm/d' ${PKG_BUILD}/meson.build
}
4 changes: 4 additions & 0 deletions packages/virtual/emulators/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ case "${DEVICE}" in
;;
esac

if [ "${PROJECT}" = "Rockchip" ]; then
PKG_DEPENDS_TARGET+=" retrorun"
fi

PKG_DEPENDS_TARGET+=" ${PKG_EMUS} ${EMUS_32BIT} ${PKG_RETROARCH} ${LIBRETRO_CORES}"

install_script() {
Expand Down
3 changes: 2 additions & 1 deletion projects/Rockchip/devices/RK3326/options
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@
# for a list of additional drivers see packages/linux-drivers
# Space separated list is supported,
# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2"
ADDITIONAL_DRIVERS="RTL8812AU RTL8814AU RTL8821AU RTL8821CU RTL88x2BU RTL8723DS RTL8851BU mali-bifrost"
USB_WIFI_DRIVERS="RTL8812AU RTL8814AU RTL8821AU RTL8821CU RTL88x2BU RTL8851BU"
ADDITIONAL_DRIVERS="rockchip-video mali-bifrost RTL8723DS ${USB_WIFI_DRIVERS}"
3 changes: 2 additions & 1 deletion projects/Rockchip/devices/RK3566/options
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@
# for a list of additional drivers see packages/linux-drivers
# Space separated list is supported,
# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2"
ADDITIONAL_DRIVERS="RTL8723DS RTL8812AU RTL8814AU RTL8821AU RTL8821CU RTL88x2BU RTL8851BU mali-bifrost"
USB_WIFI_DRIVERS="RTL8812AU RTL8814AU RTL8821AU RTL8821CU RTL88x2BU RTL8851BU"
ADDITIONAL_DRIVERS="rockchip-video mali-bifrost RTL8723DS ${WIFI_DRIVERS}"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rga3
24 changes: 24 additions & 0 deletions projects/Rockchip/packages/rockchip-video/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024 ROCKNIX (https://github.com/ROCKNIX)

PKG_NAME="rockchip-video"
PKG_VERSION="e0c1904afad0e8d7fa019385c871c0b86263407f"
PKG_LICENSE="GPLv2"
PKG_SITE="https://github.com/stolen/rockchip-video-drivers"
PKG_URL="${PKG_SITE}/archive/${PKG_VERSION}.tar.gz"
PKG_LONGDESC="Drivers for Rockchip video IPs"
PKG_TOOLCHAIN="manual"
PKG_IS_KERNEL_PKG="yes"

pre_make_target() {
unset LDFLAGS
}

make_target() {
kernel_make -C $(kernel_path) M=${PKG_BUILD} CONFIG_ROCKCHIP_MULTI_RGA=m
}

makeinstall_target() {
mkdir -p ${INSTALL}/$(get_full_module_dir)/${PKG_NAME}
cp */*.ko ${INSTALL}/$(get_full_module_dir)/${PKG_NAME}
}
49 changes: 49 additions & 0 deletions projects/Rockchip/patches/linux/mainline/0007-enable-rga.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
--- linux-6.11.9/arch/arm64/boot/dts/rockchip/px30.dtsi.orig 2024-11-24 15:53:22.339818315 +0000
+++ linux-6.11.9/arch/arm64/boot/dts/rockchip/px30.dtsi 2024-11-24 15:53:33.975479057 +0000
@@ -1261,6 +1261,16 @@
status = "disabled";
};

+ rga: rga@ff480000 {
+ compatible = "rockchip,rga2";
+ reg = <0x0 0xff480000 0x0 0x1000>;
+ interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA_CORE>;
+ clock-names = "aclk_rga", "hclk_rga", "clk_rga";
+ power-domains = <&power PX30_PD_VO>;
+ status = "disabled";
+ };
+
isp: isp@ff4a0000 {
compatible = "rockchip,px30-cif-isp"; /*rk3326-rkisp1*/
reg = <0x0 0xff4a0000 0x0 0x8000>;
--- linux-6.11.9/arch/arm64/boot/dts/rockchip/rk3326-odroid-go.dtsi.orig 2024-11-24 15:53:16.940975748 +0000
+++ linux-6.11.9/arch/arm64/boot/dts/rockchip/rk3326-odroid-go.dtsi 2024-11-24 15:53:33.975479057 +0000
@@ -508,6 +508,10 @@
status = "okay";
};

+&rga {
+ status = "okay";
+};
+
&pinctrl {
btns {
btn_pins: btn-pins {
--- linux-6.11.9/arch/arm64/boot/dts/rockchip/rk356x.dtsi.orig 2024-11-24 11:09:49.343558761 +0000
+++ linux-6.11.9/arch/arm64/boot/dts/rockchip/rk356x.dtsi 2024-11-24 11:16:44.718012471 +0000
@@ -685,11 +685,11 @@
};

rga: rga@fdeb0000 {
- compatible = "rockchip,rk3568-rga", "rockchip,rk3288-rga";
- reg = <0x0 0xfdeb0000 0x0 0x180>;
+ compatible = "rockchip,rga2";
+ reg = <0x0 0xfdeb0000 0x0 0x1000>;
interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru CLK_RGA_CORE>;
- clock-names = "aclk", "hclk", "sclk";
+ clock-names = "aclk_rga", "hclk_rga", "sclk_rga";
resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>;
reset-names = "core", "axi", "ahb";
power-domains = <&power RK3568_PD_RGA>;