video/rockchip: rga: Fixup dst offset calculation method

Change-Id: Ib849bcd2055fa0e11aa0b2caef3138fb2055f1d3
Signed-off-by: Putin Lee <putin.li@rock-chips.com>
This commit is contained in:
Putin Lee 2017-11-30 14:44:35 +08:00 committed by Tao Huang
parent dcbce81779
commit 1dd341f123

View File

@ -703,11 +703,26 @@ s32 RGA_set_dst(u8 *base, const struct rga_req *msg)
*bRGA_DST_UV_MST = 0;
*bRGA_YUV_OUT_CFG = 0;
if (msg->rotate_mode == 1) {
if (msg->sina == 65536 && msg->cosa == 0) {
/* rotate 90 */
x_off = msg->dst.x_offset - msg->dst.act_h + 1;
} else if (msg->sina == 0 && msg->cosa == -65536) {
/* rotate 180 */
x_off = msg->dst.x_offset - msg->dst.act_w + 1;
y_off = msg->dst.y_offset - msg->dst.act_h + 1;
} else if (msg->sina == -65536 && msg->cosa == 0) {
/* totate 270 */
y_off = msg->dst.y_offset - msg->dst.act_w + 1;
}
}
switch(msg->dst.format)
{
case RK_FORMAT_YCbCr_422_SP :
*bRGA_PRESCL_CB_MST = (u32)msg->dst.uv_addr + ((y_off) * stride) + ((x_off) * pw);
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr;
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr + (y_off * stride) + x_off;
*bRGA_YUV_OUT_CFG |= (((msg->yuv2rgb_mode >> 4) & 3) << 4) | (0 << 3) | (0 << 1) | 1;
break;
case RK_FORMAT_YCbCr_422_P :
@ -716,7 +731,7 @@ s32 RGA_set_dst(u8 *base, const struct rga_req *msg)
break;
case RK_FORMAT_YCbCr_420_SP :
*bRGA_PRESCL_CB_MST = (u32)msg->dst.uv_addr + ((y_off>>1) * stride) + ((x_off) * pw);
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr;
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr + ((y_off>>1) * stride) + x_off;
*bRGA_YUV_OUT_CFG |= (((msg->yuv2rgb_mode >> 4) & 3) << 4) | (0 << 3) | (1 << 1) | 1;
break;
case RK_FORMAT_YCbCr_420_P :
@ -725,7 +740,7 @@ s32 RGA_set_dst(u8 *base, const struct rga_req *msg)
break;
case RK_FORMAT_YCrCb_422_SP :
*bRGA_PRESCL_CB_MST = (u32)msg->dst.uv_addr + ((y_off) * stride) + ((x_off) * pw);
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr;
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr + (y_off * stride) + x_off;
*bRGA_YUV_OUT_CFG |= (((msg->yuv2rgb_mode >> 4) & 3) << 4) | (1 << 3) | (0 << 1) | 1;
break;
case RK_FORMAT_YCrCb_422_P :
@ -734,7 +749,7 @@ s32 RGA_set_dst(u8 *base, const struct rga_req *msg)
break;
case RK_FORMAT_YCrCb_420_SP :
*bRGA_PRESCL_CB_MST = (u32)msg->dst.uv_addr + ((y_off>>1) * stride) + ((x_off) * pw);
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr;
*bRGA_DST_UV_MST = (u32)msg->dst.uv_addr + ((y_off>>1) * stride) + x_off;
*bRGA_YUV_OUT_CFG |= (((msg->yuv2rgb_mode >> 4) & 3) << 4) | (1 << 3) | (1 << 1) | 1;
break;
case RK_FORMAT_YCrCb_420_P :