From 95280b2287605ef29c69cb80fca830219451dcc9 Mon Sep 17 00:00:00 2001 From: Yu Qiaowei Date: Thu, 5 Nov 2020 14:54:57 +0800 Subject: [PATCH] video/rockchip: rga2: Update to support rotation mode. 1. Add x mirror + y mirror mode. 2. Support rotation and mirror configuration at the same time. Signed-off-by: Yu Qiaowei Change-Id: If958e620633e17101495631acf3751a67953b19f --- drivers/video/rockchip/rga2/rga2_reg_info.c | 46 ++++++++++++++------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/drivers/video/rockchip/rga2/rga2_reg_info.c b/drivers/video/rockchip/rga2/rga2_reg_info.c index 9e25a97317fa..2537f49fc1b8 100644 --- a/drivers/video/rockchip/rga2/rga2_reg_info.c +++ b/drivers/video/rockchip/rga2/rga2_reg_info.c @@ -1093,44 +1093,60 @@ void RGA_MSG_2_RGA2_MSG(struct rga_req *req_rga, struct rga2_req *req) format_name_convert(&req->dst.format, req_rga->dst.format); format_name_convert(&req->src1.format, req_rga->pat.format); - if(req_rga->rotate_mode == 1) { + switch (req_rga->rotate_mode & 0x0F) { + case 1: if(req_rga->sina == 0 && req_rga->cosa == 65536) { /* rotate 0 */ req->rotate_mode = 0; - } - else if (req_rga->sina == 65536 && req_rga->cosa == 0) { + } else if (req_rga->sina == 65536 && req_rga->cosa == 0) { /* rotate 90 */ req->rotate_mode = 1; req->dst.x_offset = req_rga->dst.x_offset - req_rga->dst.act_h + 1; req->dst.act_w = req_rga->dst.act_h; req->dst.act_h = req_rga->dst.act_w; - } - else if (req_rga->sina == 0 && req_rga->cosa == -65536) { + } else if (req_rga->sina == 0 && req_rga->cosa == -65536) { /* rotate 180 */ req->rotate_mode = 2; req->dst.x_offset = req_rga->dst.x_offset - req_rga->dst.act_w + 1; req->dst.y_offset = req_rga->dst.y_offset - req_rga->dst.act_h + 1; - } - else if (req_rga->sina == -65536 && req_rga->cosa == 0) { + } else if (req_rga->sina == -65536 && req_rga->cosa == 0) { /* totate 270 */ req->rotate_mode = 3; req->dst.y_offset = req_rga->dst.y_offset - req_rga->dst.act_w + 1; req->dst.act_w = req_rga->dst.act_h; req->dst.act_h = req_rga->dst.act_w; } - } - else if (req_rga->rotate_mode == 2) - { + break; + case 2: //x_mirror req->rotate_mode |= (1 << 4); - } - else if (req_rga->rotate_mode == 3) - { + break; + case 3: //y_mirror req->rotate_mode |= (2 << 4); - } - else { + break; + case 4: + //x_mirror+y_mirror + req->rotate_mode |= (3 << 4); + break; + default: req->rotate_mode = 0; + break; + } + + switch ((req_rga->rotate_mode & 0xF0) >> 4) { + case 2: + //x_mirror + req->rotate_mode |= (1 << 4); + break; + case 3: + //y_mirror + req->rotate_mode |= (2 << 4); + break; + case 4: + //x_mirror+y_mirror + req->rotate_mode |= (3 << 4); + break; } if((req->dst.act_w > 2048) && (req->src.act_h < req->dst.act_h))