video/rockchip: rga2: Add format support

Add BGR565/BGRA5551/BGRA4444.

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I248c739d96afa2ec65a7092c7b584fb4730fb0f3
This commit is contained in:
Yu Qiaowei
2021-07-14 15:03:56 +08:00
committed by Tao Huang
parent 97e31ffa5d
commit 9310dee775
3 changed files with 22 additions and 38 deletions

View File

@@ -130,6 +130,7 @@ static void rga2_try_set_reg(void);
static const char *rga2_get_cmd_mode_str(u32 cmd)
{
switch (cmd) {
/* RGA1 */
case RGA_BLIT_SYNC:
return "RGA_BLIT_SYNC";
case RGA_BLIT_ASYNC:
@@ -140,6 +141,17 @@ static const char *rga2_get_cmd_mode_str(u32 cmd)
return "RGA_GET_RESULT";
case RGA_GET_VERSION:
return "RGA_GET_VERSION";
/* RGA2 */
case RGA2_BLIT_SYNC:
return "RGA2_BLIT_SYNC";
case RGA2_BLIT_ASYNC:
return "RGA2_BLIT_ASYNC";
case RGA2_FLUSH:
return "RGA2_FLUSH";
case RGA2_GET_RESULT:
return "RGA2_GET_RESULT";
case RGA2_GET_VERSION:
return "RGA2_GET_VERSION";
default:
return "UNF";
}

View File

@@ -181,14 +181,9 @@ static int rga2_buf_size_cal(unsigned long yrgb_addr, unsigned long uv_addr, uns
switch(format)
{
case RGA2_FORMAT_RGBA_8888 :
stride = (w * 4 + 3) & (~3);
size_yrgb = stride*h;
start = yrgb_addr >> PAGE_SHIFT;
end = yrgb_addr + size_yrgb;
end = (end + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
pageCount = end - start;
break;
case RGA2_FORMAT_RGBX_8888 :
case RGA2_FORMAT_BGRA_8888 :
case RGA2_FORMAT_BGRX_8888 :
stride = (w * 4 + 3) & (~3);
size_yrgb = stride*h;
start = yrgb_addr >> PAGE_SHIFT;
@@ -197,6 +192,7 @@ static int rga2_buf_size_cal(unsigned long yrgb_addr, unsigned long uv_addr, uns
pageCount = end - start;
break;
case RGA2_FORMAT_RGB_888 :
case RGA2_FORMAT_BGR_888 :
stride = (w * 3 + 3) & (~3);
size_yrgb = stride*h;
start = yrgb_addr >> PAGE_SHIFT;
@@ -204,32 +200,12 @@ static int rga2_buf_size_cal(unsigned long yrgb_addr, unsigned long uv_addr, uns
end = (end + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
pageCount = end - start;
break;
case RGA2_FORMAT_BGRA_8888 :
case RGA2_FORMAT_BGRX_8888 :
stride = (w * 4 + 3) & (~3);
size_yrgb = stride * h;
start = yrgb_addr >> PAGE_SHIFT;
end = yrgb_addr + size_yrgb;
end = (end + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
pageCount = end - start;
break;
case RGA2_FORMAT_RGB_565 :
stride = (w*2 + 3) & (~3);
size_yrgb = stride * h;
start = yrgb_addr >> PAGE_SHIFT;
end = yrgb_addr + size_yrgb;
end = (end + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
pageCount = end - start;
break;
case RGA2_FORMAT_RGBA_5551 :
stride = (w*2 + 3) & (~3);
size_yrgb = stride * h;
start = yrgb_addr >> PAGE_SHIFT;
end = yrgb_addr + size_yrgb;
end = (end + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
pageCount = end - start;
break;
case RGA2_FORMAT_RGBA_4444 :
case RGA2_FORMAT_BGR_565 :
case RGA2_FORMAT_BGRA_5551 :
case RGA2_FORMAT_BGRA_4444 :
stride = (w*2 + 3) & (~3);
size_yrgb = stride * h;
start = yrgb_addr >> PAGE_SHIFT;
@@ -237,14 +213,6 @@ static int rga2_buf_size_cal(unsigned long yrgb_addr, unsigned long uv_addr, uns
end = (end + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
pageCount = end - start;
break;
case RGA2_FORMAT_BGR_888 :
stride = (w*3 + 3) & (~3);
size_yrgb = stride * h;
start = yrgb_addr >> PAGE_SHIFT;
end = yrgb_addr + size_yrgb;
end = (end + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
pageCount = end - start;
break;
/* YUV FORMAT */
case RGA2_FORMAT_YCbCr_422_SP :

View File

@@ -1137,6 +1137,10 @@ static void format_name_convert(uint32_t *df, uint32_t sf)
case 0x21:*df = RGA2_FORMAT_YCrCb_420_SP_10B; break;
case 0x22:*df = RGA2_FORMAT_YCbCr_422_SP_10B; break;
case 0x23:*df = RGA2_FORMAT_YCrCb_422_SP_10B; break;
case 0x24:*df = RGA2_FORMAT_BGR_565; break;
case 0x25:*df = RGA2_FORMAT_BGRA_5551; break;
case 0x26:*df = RGA2_FORMAT_BGRA_4444; break;
}
}