Merge branch 'dev' of github.com:fewtarius/distribution into dev

This commit is contained in:
fewtarius 2022-11-25 01:33:57 +00:00
commit 1a8ebc7868
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A

View file

@ -1,6 +1,8 @@
--- moonlight-orig/cmake/FindRockchip.cmake 2022-05-26 15:41:01.746182723 -0700
+++ areascout-moonlight/cmake/FindRockchip.cmake 2022-05-26 15:39:28.741230073 -0700
@@ -8,7 +8,13 @@
diff --git a/cmake/FindRockchip.cmake b/cmake/FindRockchip.cmake
index 83764dd..1ad3f93 100644
--- a/cmake/FindRockchip.cmake
+++ b/cmake/FindRockchip.cmake
@@ -8,7 +8,13 @@ find_library(DRM_LIBRARY
NAMES libdrm.so
DOC "Path to libdrm Library"
PATHS /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/arm-linux-gnueabihf)
@ -15,28 +17,29 @@
find_path(ROCKCHIP_INCLUDE_DIR
NAMES rk_mpi.h
@@ -26,4 +32,4 @@
@@ -26,4 +32,4 @@ include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Rockchip DEFAULT_MSG ROCKCHIP_INCLUDE_DIR ROCKCHIP_LIBRARY)
set(ROCKCHIP_INCLUDE_DIRS ${ROCKCHIP_INCLUDE_DIR} ${DRM_INCLUDE_DIR})
-set(ROCKCHIP_LIBRARIES ${ROCKCHIP_LIBRARY} ${DRM_LIBRARY})
+set(ROCKCHIP_LIBRARIES ${ROCKCHIP_LIBRARY} ${DRM_LIBRARY} ${RGA_LIBRARY})
--- moonlight-orig/src/video/rk.c 2022-05-26 15:41:01.750182764 -0700
+++ areascout-moonlight/src/video/rk.c 2022-05-26 15:39:28.749230155 -0700
@@ -37,9 +37,11 @@
diff --git a/src/video/rk.c b/src/video/rk.c
index be355be..ad1e15e 100644
--- a/src/video/rk.c
+++ b/src/video/rk.c
@@ -38,8 +38,10 @@
#include <libdrm/drm_fourcc.h>
#include <rockchip/rk_mpi.h>
+#include <rga/RgaApi.h>
#define READ_BUF_SIZE 0x00100000
#define MAX_FRAMES 16
+#define MAX_DEST_BUFFERS 3
#define RK_H264 7
#define RK_H265 16777220
@@ -50,6 +52,8 @@
void *pkt_buf = NULL;
@@ -51,6 +53,8 @@ void *pkt_buf = NULL;
size_t pkt_buf_size = 0;
int fd;
int fb_id;
+int fb_id_rot[MAX_DEST_BUFFERS];
@ -44,7 +47,7 @@
uint32_t plane_id, crtc_id;
int frm_eos;
int crtc_width;
@@ -82,6 +86,7 @@
@@ -83,6 +87,7 @@ struct {
void *display_thread(void *param) {
@ -52,7 +55,7 @@
int ret;
while (!frm_eos) {
@@ -98,8 +103,9 @@
@@ -99,8 +104,9 @@ void *display_thread(void *param) {
return NULL;
}
}
@ -63,7 +66,7 @@
fb_id = 0;
ret = pthread_mutex_unlock(&mutex);
assert(!ret);
@@ -114,10 +120,13 @@
@@ -115,10 +121,13 @@ void *display_thread(void *param) {
void *frame_thread(void *param) {
@ -77,12 +80,13 @@
while (!frm_eos) {
@@ -141,7 +150,15 @@
@@ -142,7 +151,15 @@ void *frame_thread(void *param) {
RK_U32 ver_stride = mpp_frame_get_ver_stride(frame);
MppFrameFormat fmt = mpp_frame_get_fmt(frame);
assert((fmt == MPP_FMT_YUV420SP) || (fmt == MPP_FMT_YUV420SP_10BIT));
-
+ printf("Frame WxH=%dx%d WSxHs=%dx%d\n", frm_width, frm_height, hor_stride, ver_stride);
+
+#if 1
+ // position overlay, expand to full screen
+ fb_x = 0;
@ -93,7 +97,7 @@
// position overlay, scale to ratio
float crt_ratio = (float)crtc_width/crtc_height;
float frame_ratio = (float)frm_width/frm_height;
@@ -157,6 +174,47 @@
@@ -158,6 +175,47 @@ void *frame_thread(void *param) {
fb_x = 0;
fb_y = (crtc_height-fb_height)/2;
}
@ -141,7 +145,7 @@
// create new external frame group and allocate (commit flow) new DRM buffers and DRM FB
assert(!mpi_frm_grp);
@@ -224,6 +282,15 @@
@@ -225,6 +283,15 @@ void *frame_thread(void *param) {
// send DRM FB to display thread
ret = pthread_mutex_lock(&mutex);
assert(!ret);
@ -157,7 +161,7 @@
fb_id = frame_to_drm[i].fb_id;
ret = pthread_cond_signal(&cond);
assert(!ret);
@@ -363,6 +430,10 @@
@@ -361,6 +428,10 @@ int rk_setup(int videoFormat, int width, int height, int redrawRate, void* conte
// hide cursor by move in left lower corner
drmModeMoveCursor(fd, crtc_id, 0, crtc_height);
@ -167,8 +171,8 @@
+
// MPI SETUP
pkt_buf = malloc(READ_BUF_SIZE);
@@ -446,6 +517,8 @@
ensure_buf_size(&pkt_buf, &pkt_buf_size, INITIAL_DECODER_BUFFER_SIZE);
@@ -443,6 +514,8 @@ void rk_cleanup() {
mpp_destroy(mpi_ctx);
free(pkt_buf);