Skip to content

Commit a8e309c

Browse files
Yu Qiaoweirkhuangtao
authored andcommitted
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 <cerf.yu@rock-chips.com> Change-Id: If958e620633e17101495631acf3751a67953b19f
1 parent 80e9c72 commit a8e309c

1 file changed

Lines changed: 31 additions & 15 deletions

File tree

drivers/video/rockchip/rga2/rga2_reg_info.c

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,44 +1098,60 @@ void RGA_MSG_2_RGA2_MSG(struct rga_req *req_rga, struct rga2_req *req)
10981098
format_name_convert(&req->dst.format, req_rga->dst.format);
10991099
format_name_convert(&req->src1.format, req_rga->pat.format);
11001100

1101-
if(req_rga->rotate_mode == 1) {
1101+
switch (req_rga->rotate_mode & 0x0F) {
1102+
case 1:
11021103
if(req_rga->sina == 0 && req_rga->cosa == 65536) {
11031104
/* rotate 0 */
11041105
req->rotate_mode = 0;
1105-
}
1106-
else if (req_rga->sina == 65536 && req_rga->cosa == 0) {
1106+
} else if (req_rga->sina == 65536 && req_rga->cosa == 0) {
11071107
/* rotate 90 */
11081108
req->rotate_mode = 1;
11091109
req->dst.x_offset = req_rga->dst.x_offset - req_rga->dst.act_h + 1;
11101110
req->dst.act_w = req_rga->dst.act_h;
11111111
req->dst.act_h = req_rga->dst.act_w;
1112-
}
1113-
else if (req_rga->sina == 0 && req_rga->cosa == -65536) {
1112+
} else if (req_rga->sina == 0 && req_rga->cosa == -65536) {
11141113
/* rotate 180 */
11151114
req->rotate_mode = 2;
11161115
req->dst.x_offset = req_rga->dst.x_offset - req_rga->dst.act_w + 1;
11171116
req->dst.y_offset = req_rga->dst.y_offset - req_rga->dst.act_h + 1;
1118-
}
1119-
else if (req_rga->sina == -65536 && req_rga->cosa == 0) {
1117+
} else if (req_rga->sina == -65536 && req_rga->cosa == 0) {
11201118
/* totate 270 */
11211119
req->rotate_mode = 3;
11221120
req->dst.y_offset = req_rga->dst.y_offset - req_rga->dst.act_w + 1;
11231121
req->dst.act_w = req_rga->dst.act_h;
11241122
req->dst.act_h = req_rga->dst.act_w;
11251123
}
1126-
}
1127-
else if (req_rga->rotate_mode == 2)
1128-
{
1124+
break;
1125+
case 2:
11291126
//x_mirror
11301127
req->rotate_mode |= (1 << 4);
1131-
}
1132-
else if (req_rga->rotate_mode == 3)
1133-
{
1128+
break;
1129+
case 3:
11341130
//y_mirror
11351131
req->rotate_mode |= (2 << 4);
1136-
}
1137-
else {
1132+
break;
1133+
case 4:
1134+
//x_mirror+y_mirror
1135+
req->rotate_mode |= (3 << 4);
1136+
break;
1137+
default:
11381138
req->rotate_mode = 0;
1139+
break;
1140+
}
1141+
1142+
switch ((req_rga->rotate_mode & 0xF0) >> 4) {
1143+
case 2:
1144+
//x_mirror
1145+
req->rotate_mode |= (1 << 4);
1146+
break;
1147+
case 3:
1148+
//y_mirror
1149+
req->rotate_mode |= (2 << 4);
1150+
break;
1151+
case 4:
1152+
//x_mirror+y_mirror
1153+
req->rotate_mode |= (3 << 4);
1154+
break;
11391155
}
11401156

11411157
if((req->dst.act_w > 2048) && (req->src.act_h < req->dst.act_h))

0 commit comments

Comments
 (0)