From 0b97d73d8e712e12e7fdea55e59bc0a21bf50b4c Mon Sep 17 00:00:00 2001 From: Yu Qiaowei Date: Mon, 29 Jan 2024 15:32:09 +0800 Subject: [PATCH] video: rockchip: rga3: fix the wrong check of resolution in RGA3 rotating Change-Id: If135f3cbb80f30e0a7de18ce293b188318603fde Signed-off-by: Yu Qiaowei --- drivers/video/rockchip/rga3/rga3_reg_info.c | 53 +++++++++++++++++---- drivers/video/rockchip/rga3/rga_policy.c | 11 +---- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/drivers/video/rockchip/rga3/rga3_reg_info.c b/drivers/video/rockchip/rga3/rga3_reg_info.c index 0ea4e8b2f6dd..1de0632187c3 100644 --- a/drivers/video/rockchip/rga3/rga3_reg_info.c +++ b/drivers/video/rockchip/rga3/rga3_reg_info.c @@ -1755,10 +1755,50 @@ static int rga3_scale_check(const struct rga3_req *req) u32 win0_saw, win0_sah, win0_daw, win0_dah; u32 win1_saw, win1_sah, win1_daw, win1_dah; - win0_saw = req->win0.src_act_w; - win0_sah = req->win0.src_act_h; - win0_daw = req->win0.dst_act_w; - win0_dah = req->win0.dst_act_h; + if (req->rotate_mode & RGA3_ROT_BIT_ROT_90) { + if (req->win1.yrgb_addr != 0) { + /* ABB */ + if (req->win0.yrgb_addr == req->wr.yrgb_addr) { + /* win0 do not need rotate, but net equal to wr */ + win0_saw = req->win0.src_act_h; + win0_sah = req->win0.src_act_w; + win0_daw = req->win0.dst_act_h; + win0_dah = req->win0.dst_act_w; + + win1_saw = req->win1.dst_act_w; + win1_sah = req->win1.dst_act_h; + win1_daw = req->win1.dst_act_h; + win1_dah = req->win1.dst_act_w; + } else { + win0_saw = req->win0.src_act_w; + win0_sah = req->win0.src_act_h; + win0_daw = req->win0.dst_act_w; + win0_dah = req->win0.dst_act_h; + + win1_saw = req->win1.src_act_w; + win1_sah = req->win1.src_act_h; + win1_daw = req->win1.dst_act_w; + win1_dah = req->win1.dst_act_h; + } + } else { + win0_saw = req->win0.src_act_w; + win0_sah = req->win0.src_act_h; + win0_daw = req->win0.dst_act_h; + win0_dah = req->win0.dst_act_w; + } + } else { + win0_saw = req->win0.src_act_w; + win0_sah = req->win0.src_act_h; + win0_daw = req->win0.dst_act_w; + win0_dah = req->win0.dst_act_h; + + if (req->win1.yrgb_addr != 0) { + win1_saw = req->win1.src_act_w; + win1_sah = req->win1.src_act_h; + win1_daw = req->win1.dst_act_w; + win1_dah = req->win1.dst_act_h; + } + } if (((win0_saw >> 3) > win0_daw) || ((win0_sah >> 3) > win0_dah)) { pr_info("win0 unsupported to scaling less than 1/8 times. src[%d, %d], dst[%d, %d]\n", @@ -1772,11 +1812,6 @@ static int rga3_scale_check(const struct rga3_req *req) } if (req->win1.yrgb_addr != 0) { - win1_saw = req->win1.src_act_w; - win1_sah = req->win1.src_act_h; - win1_daw = req->win1.dst_act_w; - win1_dah = req->win1.dst_act_h; - if (((win1_saw >> 3) > win1_daw) || ((win1_sah >> 3) > win1_dah)) { pr_info("win1 unsupported to scaling less than 1/8 times. src[%d, %d], dst[%d, %d]\n", win1_saw, win1_sah, win1_daw, win1_dah); diff --git a/drivers/video/rockchip/rga3/rga_policy.c b/drivers/video/rockchip/rga3/rga_policy.c index 5aaeda5bbbf1..fe13808cb5d7 100644 --- a/drivers/video/rockchip/rga3/rga_policy.c +++ b/drivers/video/rockchip/rga3/rga_policy.c @@ -225,15 +225,8 @@ static bool rga_check_scale(const struct rga_hw_data *data, sw = src0->act_w; sh = src0->act_h; - - if ((rga_base->sina == 65536 && rga_base->cosa == 0) - || (rga_base->sina == -65536 && rga_base->cosa == 0)) { - dw = dst->act_h; - dh = dst->act_w; - } else { - dw = dst->act_w; - dh = dst->act_h; - } + dw = dst->act_w; + dh = dst->act_h; if (sw > dw) { if ((sw >> data->max_downscale_factor) > dw)