From c14fcf698b73cdd938fc4868595bd2962e263418 Mon Sep 17 00:00:00 2001 From: Wei Dun Date: Wed, 14 May 2025 18:20:55 +0800 Subject: [PATCH] media: rockchip: vpss: support ver_stride input config Signed-off-by: Wei Dun Change-Id: I7bda66e3f3b10ebec49476141f3e0225895df4c3 --- .../platform/rockchip/vpss/vpss_offline_v20.c | 20 +++++++++++++------ include/uapi/linux/rk-vpss-config.h | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/rockchip/vpss/vpss_offline_v20.c b/drivers/media/platform/rockchip/vpss/vpss_offline_v20.c index 7d80471542ca..e75883ad57b3 100644 --- a/drivers/media/platform/rockchip/vpss/vpss_offline_v20.c +++ b/drivers/media/platform/rockchip/vpss/vpss_offline_v20.c @@ -846,7 +846,9 @@ static int read_config(struct rkvpss_offline_dev *ofl, case V4L2_PIX_FMT_NV16: if (cfg->input.stride < ALIGN(cfg->input.width, 16)) cfg->input.stride = ALIGN(cfg->input.width, 16); - in_c_offs = cfg->input.stride * cfg->input.height; + in_c_offs = cfg->input.ver_stride ? + cfg->input.stride * cfg->input.ver_stride : + cfg->input.stride * cfg->input.height; in_size = cfg->input.stride * cfg->input.height * 2; in_ctrl |= RKVPSS_MI_RD_INPUT_422SP; unite_off = 8; @@ -854,7 +856,9 @@ static int read_config(struct rkvpss_offline_dev *ofl, case V4L2_PIX_FMT_NV12: if (cfg->input.stride < ALIGN(cfg->input.width, 16)) cfg->input.stride = ALIGN(cfg->input.width, 16); - in_c_offs = cfg->input.stride * cfg->input.height; + in_c_offs = cfg->input.ver_stride ? + cfg->input.stride * cfg->input.ver_stride : + cfg->input.stride * cfg->input.height; in_size = cfg->input.stride * cfg->input.height * 3 / 2; in_ctrl |= RKVPSS_MI_RD_INPUT_420SP; unite_off = 8; @@ -862,7 +866,9 @@ static int read_config(struct rkvpss_offline_dev *ofl, case V4L2_PIX_FMT_NV61: if (cfg->input.stride < ALIGN(cfg->input.width, 16)) cfg->input.stride = ALIGN(cfg->input.width, 16); - in_c_offs = cfg->input.stride * cfg->input.height; + in_c_offs = cfg->input.ver_stride ? + cfg->input.stride * cfg->input.ver_stride : + cfg->input.stride * cfg->input.height; in_size = cfg->input.stride * cfg->input.height * 2; in_ctrl |= RKVPSS_MI_RD_INPUT_422SP | RKVPSS_MI_RD_UV_SWAP; unite_off = 8; @@ -870,7 +876,9 @@ static int read_config(struct rkvpss_offline_dev *ofl, case V4L2_PIX_FMT_NV21: if (cfg->input.stride < ALIGN(cfg->input.width, 16)) cfg->input.stride = ALIGN(cfg->input.width, 16); - in_c_offs = cfg->input.stride * cfg->input.height; + in_c_offs = cfg->input.ver_stride ? + cfg->input.stride * cfg->input.ver_stride : + cfg->input.stride * cfg->input.height; in_size = cfg->input.stride * cfg->input.height * 3 / 2; in_ctrl |= RKVPSS_MI_RD_INPUT_420SP | RKVPSS_MI_RD_UV_SWAP; unite_off = 8; @@ -2274,9 +2282,9 @@ int rkvpss_prepare_run(struct rkvpss_offline_dev *ofl, t = ktime_get(); v4l2_info(&ofl->v4l2_dev, - "%s dev_id:%d seq:%d mirror:%d input:%dx%d buffd:%d format:%c%c%c%c stride:%d rotate:%d\n", + "%s dev_id:%d seq:%d mirror:%d input:%dx%d [%dx%d] buffd:%d format:%c%c%c%c stride:%d rotate:%d\n", __func__, cfg->dev_id, cfg->sequence, cfg->mirror, - cfg->input.width, cfg->input.height, cfg->input.buf_fd, + cfg->input.width, cfg->input.height, cfg->input.stride, cfg->input.ver_stride, cfg->input.buf_fd, cfg->input.format, cfg->input.format >> 8, cfg->input.format >> 16, cfg->input.format >> 24, cfg->input.stride, cfg->input.rotate); diff --git a/include/uapi/linux/rk-vpss-config.h b/include/uapi/linux/rk-vpss-config.h index 07af012e9aa1..8ff998d6705a 100644 --- a/include/uapi/linux/rk-vpss-config.h +++ b/include/uapi/linux/rk-vpss-config.h @@ -244,6 +244,7 @@ struct rkvpss_module_sel { * height: height of input image, range: 32~3504(rk3576) 32~3072(rv1126b) * stride: virtual width of input image, 16 align. auto calculate according to width and * format if 0. + * ver_stride: virtual height of input image. * format: V4L2_PIX_FMT_NV12/V4L2_PIX_FMT_NV16/V4L2_PIX_FMT_RGB565/V4L2_PIX_FMT_RGB24/ * V4L2_PIX_FMT_XBGR32/ * V4L2_PIX_FMT_NV61/V4L2_PIX_FMT_NV21/V4L2_PIX_FMT_RGB565X/V4L2_PIX_FMT_BGR24/ @@ -259,6 +260,7 @@ struct rkvpss_input_cfg { int width; int height; int stride; + int ver_stride; int format; int buf_fd; int rotate;