mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
media: rockchip: isp: fix isp32 cmsk feature
Change-Id: I8706e04509b2c7e8a46fcf50be477f9c7e4e766a Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -966,10 +966,11 @@ static int rkisp_set_cmsk(struct rkisp_stream *stream, struct rkisp_cmsk_cfg *cf
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
unsigned long lock_flags = 0;
|
||||
u8 i, win_en = 0, mode = 0;
|
||||
u16 i, win_en = 0, mode = 0;
|
||||
u16 h_offs, v_offs, h_size, v_size;
|
||||
u32 width = dev->isp_sdev.out_crop.width;
|
||||
u32 height = dev->isp_sdev.out_crop.height;
|
||||
u32 align = (dev->isp_ver == ISP_V30) ? 8 : 2;
|
||||
bool warn = false;
|
||||
|
||||
if ((dev->isp_ver != ISP_V30 && dev->isp_ver != ISP_V32) ||
|
||||
@@ -994,27 +995,27 @@ static int rkisp_set_cmsk(struct rkisp_stream *stream, struct rkisp_cmsk_cfg *cf
|
||||
}
|
||||
h_offs = cfg->win[i].h_offs & ~0x1;
|
||||
v_offs = cfg->win[i].v_offs & ~0x1;
|
||||
h_size = cfg->win[i].h_size & ~0x7;
|
||||
v_size = cfg->win[i].v_size & ~0x7;
|
||||
h_size = ALIGN_DOWN(cfg->win[i].h_size, align);
|
||||
v_size = ALIGN_DOWN(cfg->win[i].v_size, align);
|
||||
if (h_offs != cfg->win[i].h_offs ||
|
||||
v_offs != cfg->win[i].v_offs ||
|
||||
h_size != cfg->win[i].h_size ||
|
||||
v_size != cfg->win[i].v_size)
|
||||
warn = true;
|
||||
if (h_offs + h_size > width) {
|
||||
h_size = (width - h_offs) & ~0x7;
|
||||
h_size = ALIGN_DOWN(width - h_offs, align);
|
||||
warn = true;
|
||||
}
|
||||
if (v_offs + v_size > height) {
|
||||
v_size = (height - v_offs) & ~0x7;
|
||||
v_size = ALIGN_DOWN(height - v_offs, align);
|
||||
warn = true;
|
||||
}
|
||||
if (warn) {
|
||||
warn = false;
|
||||
v4l2_warn(&dev->v4l2_dev,
|
||||
"%s cmsk offs 2 align, size 8 align and offs + size < resolution\n"
|
||||
"%s cmsk offs 2 align, size %d align and offs + size < resolution\n"
|
||||
"\t cmsk win%d result to offs:%d %d, size:%d %d\n",
|
||||
stream->vnode.vdev.name, i, h_offs, v_offs, h_size, v_size);
|
||||
stream->vnode.vdev.name, i, align, h_offs, v_offs, h_size, v_size);
|
||||
}
|
||||
dev->cmsk_cfg.win[i].h_offs = h_offs;
|
||||
dev->cmsk_cfg.win[i].v_offs = v_offs;
|
||||
|
||||
@@ -1312,6 +1312,8 @@ static void rkisp_config_cmsk_single(struct rkisp_device *dev,
|
||||
u32 mp_en = cfg->win[0].win_en;
|
||||
u32 sp_en = cfg->win[1].win_en;
|
||||
u32 bp_en = cfg->win[2].win_en;
|
||||
u32 win_max = (dev->isp_ver == ISP_V30) ?
|
||||
RKISP_CMSK_WIN_MAX_V30 : RKISP_CMSK_WIN_MAX;
|
||||
|
||||
if (mp_en) {
|
||||
ctrl |= ISP3X_SW_CMSK_EN_MP;
|
||||
@@ -1334,7 +1336,7 @@ static void rkisp_config_cmsk_single(struct rkisp_device *dev,
|
||||
rkisp_write(dev, ISP3X_CMSK_CTRL6, val, false);
|
||||
}
|
||||
|
||||
for (i = 0; i < RKISP_CMSK_WIN_MAX; i++) {
|
||||
for (i = 0; i < win_max; i++) {
|
||||
if (!(mp_en & BIT(i)) && !(sp_en & BIT(i)) && !(bp_en & BIT(i)))
|
||||
continue;
|
||||
|
||||
@@ -1376,8 +1378,10 @@ static void rkisp_config_cmsk_dual(struct rkisp_device *dev,
|
||||
u8 mp_en = cfg->win[0].win_en;
|
||||
u8 sp_en = cfg->win[1].win_en;
|
||||
u8 bp_en = cfg->win[2].win_en;
|
||||
u32 win_max = (dev->isp_ver == ISP_V30) ?
|
||||
RKISP_CMSK_WIN_MAX_V30 : RKISP_CMSK_WIN_MAX;
|
||||
|
||||
for (i = 0; i < RKISP_CMSK_WIN_MAX; i++) {
|
||||
for (i = 0; i < win_max; i++) {
|
||||
if (!(mp_en & BIT(i)) && !(sp_en & BIT(i)) && !(bp_en & BIT(i)))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -309,28 +309,33 @@ struct isp2x_mesh_head {
|
||||
u32 data_oft;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define RKISP_CMSK_WIN_MAX 8
|
||||
#define RKISP_CMSK_WIN_MAX 12
|
||||
#define RKISP_CMSK_WIN_MAX_V30 8
|
||||
#define RKISP_CMSK_MOSAIC_MODE 0
|
||||
#define RKISP_CMSK_COVER_MODE 1
|
||||
|
||||
/* struct rkisp_cmsk_win
|
||||
* Priacy Mask Window configture, support 8 windows, and
|
||||
* Priacy Mask Window configture, support windows
|
||||
* RKISP_CMSK_WIN_MAX_V30 for rk3588 support 8 windows, and
|
||||
* support for mainpath and selfpath output stream channel.
|
||||
*
|
||||
* RKISP_CMSK_WIN_MAX for rv1106 support 12 windows, and
|
||||
* support for mainpath selfpath and bypasspath output stream channel.
|
||||
*
|
||||
* mode: 0:mosaic mode, 1:cover mode
|
||||
* win_index: window index 0~7. windows overlap, priority win7 > win0.
|
||||
* win_index: window index 0~11. windows overlap, priority win11 > win0.
|
||||
* cover_color_y: cover mode effective, share for stream channel when same win_index.
|
||||
* cover_color_u: cover mode effective, share for stream channel when same win_index.
|
||||
* cover_color_v: cover mode effective, share for stream channel when same win_index.
|
||||
*
|
||||
* h_offs: window horizontal offset, share for stream channel when same win_index. 2 align.
|
||||
* v_offs: window vertical offset, share for stream channel when same win_index. 2 align.
|
||||
* h_size: window horizontal size, share for stream channel when same win_index. 8 align.
|
||||
* v_size: window vertical size, share for stream channel when same win_index. 8 align.
|
||||
* h_size: window horizontal size, share for stream channel when same win_index. 8 align for rk3588, 2 align for rv1106.
|
||||
* v_size: window vertical size, share for stream channel when same win_index. 8 align for rk3588, 2 align for rv1106.
|
||||
*/
|
||||
struct rkisp_cmsk_win {
|
||||
unsigned char mode;
|
||||
unsigned char win_en;
|
||||
unsigned short mode;
|
||||
unsigned short win_en;
|
||||
|
||||
unsigned char cover_color_y;
|
||||
unsigned char cover_color_u;
|
||||
|
||||
Reference in New Issue
Block a user