aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author浅倉麗子2020-07-12 01:41:30 -0400
committer浅倉麗子2020-07-12 01:41:30 -0400
commit8726dfe35fe4656dc665fb8699d8e7a83fed994a (patch)
tree2a49ce44f88114915b1a12a4479a7a9cd574e8e4
parentRemove all limitations on framebuffer dimension (diff)
downloadsharpscale-8726dfe35fe4656dc665fb8699d8e7a83fed994a.tar.gz
Scale shared FB to the scaled size of app FB
The paddr trick is from udcd-uvc: https://github.com/xerpi/vita-udcd-uvc/commit/eadc97ccf6f732e1151420dc97a1a2085a6b7488
-rw-r--r--main.c29
-rw-r--r--scedisplay.h3
2 files changed, 30 insertions, 2 deletions
diff --git a/main.c b/main.c
index a5a5b0e..d2009cc 100644
--- a/main.c
+++ b/main.c
@@ -129,6 +129,12 @@ static int *primary_head_idx = 0;
static int cur_head_idx = -1;
static int cur_fb_w = 0;
static int cur_fb_h = 0;
+static int cur_app_fb_scaled_w = 0;
+static int cur_app_fb_scaled_h = 0;
+static int cur_app_fb_src_x = 0;
+static int cur_app_fb_src_y = 0;
+static int cur_app_fb_dst_x = 0;
+static int cur_app_fb_dst_y = 0;
// mutex at SceDisplay_8100B1E4 is locked
static int prepare_set_fb_hook(
@@ -164,6 +170,17 @@ static int sceIftuSetInputFrameBuffer_hook(int plane, SceIftuPlaneState *state,
goto done;
}
+ if (plane == head_data[cur_head_idx].plane[1] && head_data[cur_head_idx].fb[0].paddr
+ && cur_app_fb_scaled_w && cur_app_fb_scaled_h) {
+ state->src_w = lroundf(65536.0 * ((float)cur_fb_w / (float)cur_app_fb_scaled_w));
+ state->src_h = lroundf(65536.0 * ((float)cur_fb_h / (float)cur_app_fb_scaled_h));
+ state->src_x = cur_app_fb_src_x;
+ state->src_y = cur_app_fb_src_y;
+ state->dst_x = cur_app_fb_dst_x;
+ state->dst_y = cur_app_fb_dst_y;
+ goto done;
+ }
+
int fb_w = cur_fb_w;
int fb_h = cur_fb_h;
int head_w = head_data[cur_head_idx].head_w;
@@ -219,6 +236,18 @@ static int sceIftuSetInputFrameBuffer_hook(int plane, SceIftuPlaneState *state,
}
bilinear = (!ss_config.bilinear && bilinear == 1) ? 0 : bilinear;
+ } else {
+ fb_w = lroundf((float)cur_fb_w / ((float)state->src_w / 65536.0));
+ fb_h = lroundf((float)cur_fb_h / ((float)state->src_h / 65536.0));
+ }
+
+ if (plane == head_data[cur_head_idx].plane[0]) {
+ cur_app_fb_scaled_w = fb_w;
+ cur_app_fb_scaled_h = fb_h;
+ cur_app_fb_src_x = state->src_x;
+ cur_app_fb_src_y = state->src_y;
+ cur_app_fb_dst_x = state->dst_x;
+ cur_app_fb_dst_y = state->dst_y;
}
cur_head_idx = -1;
diff --git a/scedisplay.h b/scedisplay.h
index dfc86a5..1663639 100644
--- a/scedisplay.h
+++ b/scedisplay.h
@@ -40,8 +40,7 @@ typedef struct {
int unk14;
int pulse_event_value;
int dsi_bus;
- int plane_idx0;
- int plane_idx1;
+ int plane[2];
int vic;
int head_w;
int head_h;