wave5 codec driver
Subsystems (2)
jackson.lee
maintainercover wave5 codec driver
The wave5 codec driver is a stateful encoder/decoder.
The following patches is for supporting yuv422 inpuy format, supporting runtime suspend/resume feature and extra things.
Change since v0:
=================
The DEFAULT_SRC_SIZE macro was defined using multiple lines, To make a simple define, tab and multiple lines has been removed, The macro is defined using one line.
jackson.lee (5):
wave5 : Support yuv422 input format for encoder.
wave5: Support to prepend sps/pps to IDR frame. wave5 : Support runtime suspend/resume.
wave5: Use the bitstream buffer size from host. wave5 : Fixed the wrong buffer size formula.
.../platform/chips-media/wave5/wave5-hw.c | 11 +- .../chips-media/wave5/wave5-vpu-dec.c | 86 +++++----- .../chips-media/wave5/wave5-vpu-enc.c | 157 +++++++++++++++--- .../platform/chips-media/wave5/wave5-vpu.c | 68 ++++++++ .../platform/chips-media/wave5/wave5-vpuapi.c | 7 + .../platform/chips-media/wave5/wave5-vpuapi.h | 1 + .../media/platform/chips-media/wave5/wave5.h | 3 + 7 files changed, 253 insertions(+), 80 deletions(-)
Signature · 1 line
2.43.0
jackson.lee
maintainerPATCH 1/5 wave5 : Support yuv422 input format for encoder.
Encoder supports the following formats.
YUV422P, NV16, NV61, NV16M, NV61M
--- .../chips-media/wave5/wave5-vpu-enc.c | 79 ++++++++++++++++++- 1 file changed, 76 insertions(+), 3 deletions(-)
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +76 -3
@@ -70,6 +70,41 @@ static const struct vpu_format enc_fmt_list[FMT_TYPES][MAX_FMTS] = { .max_height = W5_MAX_ENC_PIC_HEIGHT, .min_height = W5_MIN_ENC_PIC_HEIGHT, }, + { + .v4l2_pix_fmt = V4L2_PIX_FMT_YUV422P, + .max_width = W5_MAX_ENC_PIC_WIDTH, + .min_width = W5_MIN_ENC_PIC_WIDTH, + .max_height = W5_MAX_ENC_PIC_HEIGHT, + .min_height = W5_MIN_ENC_PIC_HEIGHT, + }, + { + .v4l2_pix_fmt = V4L2_PIX_FMT_NV16, + .max_width = W5_MAX_ENC_PIC_WIDTH, + .min_width = W5_MIN_ENC_PIC_WIDTH, + .max_height = W5_MAX_ENC_PIC_HEIGHT, + .min_height = W5_MIN_ENC_PIC_HEIGHT, + }, + { + .v4l2_pix_fmt = V4L2_PIX_FMT_NV61, + .max_width = W5_MAX_ENC_PIC_WIDTH, + .min_width = W5_MIN_ENC_PIC_WIDTH, + .max_height = W5_MAX_ENC_PIC_HEIGHT, + .min_height = W5_MIN_ENC_PIC_HEIGHT, + }, + { + .v4l2_pix_fmt = V4L2_PIX_FMT_NV16M, + .max_width = W5_MAX_ENC_PIC_WIDTH, + .min_width = W5_MIN_ENC_PIC_WIDTH, + .max_height = W5_MAX_ENC_PIC_HEIGHT, + .min_height = W5_MIN_ENC_PIC_HEIGHT, + }, + { + .v4l2_pix_fmt = V4L2_PIX_FMT_NV61M, + .max_width = W5_MAX_ENC_PIC_WIDTH, + .min_width = W5_MIN_ENC_PIC_WIDTH, + .max_height = W5_MAX_ENC_PIC_HEIGHT, + .min_height = W5_MIN_ENC_PIC_HEIGHT, + }, } };
@@ -136,6 +171,23 @@ static void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp, unsigned pix_mp->plane_fmt[1 ].bytesperline =round_up (width,32 ); pix_mp->plane_fmt[1 ].sizeimage =round_up (width,32 ) * height /2 ;break ; +case V4L2_PIX_FMT_YUV422P : +case V4L2_PIX_FMT_NV16 : +case V4L2_PIX_FMT_NV61 : + pix_mp->width = width; + pix_mp->height = height; + pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); + pix_mp->plane_fmt[0 ].sizeimage =round_up (width,32 ) * height *2 ; +break ; +case V4L2_PIX_FMT_NV16M : +case V4L2_PIX_FMT_NV61M : + pix_mp->width = width; + pix_mp->height = height; + pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); + pix_mp->plane_fmt[0 ].sizeimage =round_up (width,32 ) * height; + pix_mp->plane_fmt[1 ].bytesperline =round_up (width,32 ); + pix_mp->plane_fmt[1 ].sizeimage =round_up (width,32 ) * height; +break ;default : pix_mp->width = width; pix_mp->height = height;
@@ -155,11 +207,19 @@ static int start_encode(struct vpu_instance *inst, u32 *fail_res)struct enc_param pic_param;u32 stride =ALIGN (inst->dst_fmt.width,32 );u32 luma_size = (stride * inst->dst_fmt.height); -u32 chroma_size = ((stride /2 ) * (inst->dst_fmt.height /2 )); +u32 chroma_size;memset (&pic_param,0 ,sizeof (struct enc_param ));memset (&frame_buf,0 ,sizeof (struct frame_buffer )); +if (inst->src_fmt.pixelformat ==V4L2_PIX_FMT_YUV420 || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_YUV420M ) + chroma_size = ((stride /2 ) * (inst->dst_fmt.height /2 )); +else if (inst->src_fmt.pixelformat ==V4L2_PIX_FMT_YUV422P ) + chroma_size = ((stride) * (inst->dst_fmt.height /2 )); +else + chroma_size =0 ; + dst_buf =v4l2_m2m_next_dst_buf (m2m_ctx);if (!dst_buf) {dev_dbg (inst->dev->dev,"%s: No destination buffer found\n" , __func__);
@@ -550,11 +610,15 @@ static int wave5_vpu_enc_s_fmt_out(struct file *file, void *fh, struct v4l2_form }if (inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV12 || - inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV12M ) { + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV12M || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV16 || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV16M ) { inst->cbcr_interleave = true; inst->nv21 = false; }else if (inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV21 || - inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV21M ) { + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV21M || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV61 || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV61M ) { inst->cbcr_interleave = true; inst->nv21 = true; }else {
@@ -1132,6 +1196,15 @@ static void wave5_set_enc_openparam(struct enc_open_param *open_param,u32 num_ctu_row =ALIGN (inst->dst_fmt.height,64 ) /64 ;u32 num_mb_row =ALIGN (inst->dst_fmt.height,16 ) /16 ; +if (inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV16 || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV61 || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_YUV422P || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV16M || + inst->src_fmt.pixelformat ==V4L2_PIX_FMT_NV61M ) + open_param->src_format =FORMAT_422 ; +else + open_param->src_format =FORMAT_420 ; + open_param->wave_param.gop_preset_idx =PRESET_IDX_IPP_SINGLE ; open_param->wave_param.hvs_qp_scale =2 ; open_param->wave_param.hvs_max_delta_qp =10 ;
Signature · 1 line
2.43.0
jackson.lee
maintainerPATCH 2/5 wave5: Support to prepend sps/pps to IDR frame.
In reply to jackson.leeIndicates whether to generate SPS and PPS at every IDR. Setting it to 0 disables generating SPS and PPS at every IDR. Setting it to one enables generating SPS and PPS at every IDR.
--- drivers/media/platform/chips-media/wave5/wave5-hw.c | 6 ++++-- drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 7 +++++++ drivers/media/platform/chips-media/wave5/wave5-vpuapi.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-)
drivers/media/platform/chips-media/wave5/wave5-hw.c +4 -2
@@ -1602,11 +1602,13 @@ int wave5_vpu_enc_init_seq(struct vpu_instance *inst)if (inst->std ==W_AVC_ENC )vpu_write_reg (inst->dev,W5_CMD_ENC_SEQ_INTRA_PARAM , p_param->intra_qp | ((p_param->intra_period &0x7ff ) <<6 ) | - ((p_param->avc_idr_period &0x7ff ) <<17 )); + ((p_param->avc_idr_period &0x7ff ) <<17 ) | + (p_param->forced_idr_header_enable <<28 ));else if (inst->std ==W_HEVC_ENC )vpu_write_reg (inst->dev,W5_CMD_ENC_SEQ_INTRA_PARAM , p_param->decoding_refresh_type | (p_param->intra_qp <<3 ) | - (p_param->intra_period <<16 )); + (p_param->forced_idr_header_enable <<9 ) | + (p_param->intra_period <<16 )); reg_val = (p_param->rdo_skip <<2 ) | (p_param->lambda_scaling_enable << 3) |
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +7 -0
@@ -1125,6 +1125,9 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl *ctrl)case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE : inst->enc_param.entropy_coding_mode = ctrl->val;break ; +case V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR : + inst->enc_param.forced_idr_header_enable = ctrl->val; +break ;case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT :break ;default :
@@ -1292,6 +1295,7 @@ static void wave5_set_enc_openparam(struct enc_open_param *open_param,else open_param->wave_param.intra_refresh_arg = num_ctu_row; } + open_param->wave_param.forced_idr_header_enable = input.forced_idr_header_enable; }static int initialize_sequence (struct vpu_instance *inst)
@@ -1775,6 +1779,9 @@ static int wave5_vpu_open_enc(struct file *filp) 0, 1, 1, 0);v4l2_ctrl_new_std (v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,V4L2_CID_MIN_BUFFERS_FOR_OUTPUT ,1 ,32 ,1 ,1 ); +v4l2_ctrl_new_std (v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops, +V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR , +0 ,1 ,1 ,0 );if (v4l2_ctrl_hdl->error) { ret = -ENODEV ;
drivers/media/platform/chips-media/wave5/wave5-vpuapi.h +1 -0
@@ -566,6 +566,7 @@ struct enc_wave_param { u32 lambda_scaling_enable: 1; /* enable lambda scaling using custom GOP */ u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8 transform */ u32 mb_level_rc_enable: 1; /* enable MB-level rate control */ + u32 forced_idr_header_enable: 1; /* enable header encoding before IDR frame */ };struct enc_open_param {
Signature · 1 line
2.43.0
jackson.lee
maintainerPATCH 3/5 wave5 : Support runtime suspend/resume.
In reply to jackson.leeThere are two device run-time PM callbacks defined in 'struct dev_pm_ops' int (*runtime_suspend)(struct device *dev);
int (*runtime_resume)(struct device *dev);
--- .../platform/chips-media/wave5/wave5-hw.c | 5 +- .../chips-media/wave5/wave5-vpu-dec.c | 9 +++ .../chips-media/wave5/wave5-vpu-enc.c | 9 +++ .../platform/chips-media/wave5/wave5-vpu.c | 68 +++++++++++++++++++ .../platform/chips-media/wave5/wave5-vpuapi.c | 7 ++ .../media/platform/chips-media/wave5/wave5.h | 3 + 6 files changed, 99 insertions(+), 2 deletions(-)
drivers/media/platform/chips-media/wave5/wave5-hw.c +3 -2
@@ -503,6 +503,7 @@ int wave5_vpu_build_up_dec_param(struct vpu_instance *inst,/* This register must be reset explicitly */ vpu_write_reg (inst->dev,W5_CMD_EXT_ADDR ,0 );vpu_write_reg (inst->dev,W5_CMD_NUM_CQ_DEPTH_M1 , (COMMAND_QUEUE_DEPTH -1 )); +vpu_write_reg (inst->dev,W5_CMD_ERR_CONCEAL ,0 ); ret =send_firmware_command (inst,W5_CREATE_INSTANCE , true,NULL ,NULL );if (ret) {
@@ -1075,8 +1076,8 @@ int wave5_vpu_re_init(struct device *dev, u8 *fw, size_t size)return setup_wave5_properties (dev); } -static int wave5_vpu_sleep_wake (struct device *dev,bool i_sleep_wake,const uint16_t *code, -size_t size) +int wave5_vpu_sleep_wake (struct device *dev,bool i_sleep_wake,const uint16_t *code, +size_t size) {u32 reg_val;struct vpu_buf *common_vb;
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +9 -0
@@ -5,6 +5,7 @@* Copyright (C) 2021-2023 CHIPS&MEDIA INC */ +#include <linux/pm_runtime.h> #include "wave5-helper.h" #define VPU_DEC_DEV_NAME "C&M Wave5 VPU decoder"
@@ -1387,9 +1388,17 @@ static int wave5_vpu_dec_start_streaming(struct vb2_queue *q, unsigned int countif (q->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && inst->state ==VPU_INST_STATE_NONE ) {struct dec_open_param open_param; +int err =0 ;memset (&open_param,0 ,sizeof (struct dec_open_param )); + err =pm_runtime_resume_and_get (inst->dev->dev); +if (err) { +dev_err (inst->dev->dev,"decoder runtime resume failed %d\n" , err); + ret = -EINVAL ; + goto return_buffers; + } + ret =wave5_vpu_dec_allocate_ring_buffer (inst);if (ret) goto return_buffers;
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +9 -0
@@ -5,6 +5,7 @@* Copyright (C) 2021-2023 CHIPS&MEDIA INC */ +#include <linux/pm_runtime.h> #include "wave5-helper.h" #define VPU_ENC_DEV_NAME "C&M Wave5 VPU encoder"
@@ -1387,9 +1388,17 @@ static int wave5_vpu_enc_start_streaming(struct vb2_queue *q, unsigned int countif (inst->state ==VPU_INST_STATE_NONE && q->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ) {struct enc_open_param open_param; +int err =0 ;memset (&open_param,0 ,sizeof (struct enc_open_param )); + err =pm_runtime_resume_and_get (inst->dev->dev); +if (err) { +dev_err (inst->dev->dev,"encoder runtime resume failed %d\n" , err); + ret = -EINVAL ; + goto return_buffers; + } +wave5_set_enc_openparam (&open_param, inst); ret =wave5_vpu_enc_open (inst, &open_param);
drivers/media/platform/chips-media/wave5/wave5-vpu.c +68 -0
98 lines not on this page · raw message
drivers/media/platform/chips-media/wave5/wave5-vpuapi.c +7 -0
@@ -6,6 +6,7 @@*/ #include <linux/bug.h> +#include <linux/pm_runtime.h> #include "wave5-vpuapi.h" #include "wave5-regdefine.h" #include "wave5.h"
@@ -232,6 +233,9 @@ int wave5_vpu_dec_close(struct vpu_instance *inst, u32 *fail_res)wave5_vdi_free_dma_memory (vpu_dev, &p_dec_info->vb_task); +if (!pm_runtime_suspended (inst->dev->dev)) +pm_runtime_put_sync (inst->dev->dev); + unlock_and_return:mutex_unlock (&vpu_dev->hw_lock);
@@ -734,6 +738,9 @@ int wave5_vpu_enc_close(struct vpu_instance *inst, u32 *fail_res)wave5_vdi_free_dma_memory (vpu_dev, &p_enc_info->vb_task); +if (!pm_runtime_suspended (inst->dev->dev)) +pm_runtime_put_sync (inst->dev->dev); +mutex_unlock (&vpu_dev->hw_lock);return 0 ;
drivers/media/platform/chips-media/wave5/wave5.h +3 -0
@@ -56,6 +56,9 @@ int wave5_vpu_get_version(struct vpu_device *vpu_dev, u32 *revision);int wave5_vpu_init (struct device *dev,u8 *fw,size_t size); +int wave5_vpu_sleep_wake (struct device *dev,bool i_sleep_wake,const uint16_t *code, +size_t size); +int wave5_vpu_reset (struct device *dev,enum sw_reset_mode reset_mode);int wave5_vpu_build_up_dec_param (struct vpu_instance *inst,struct dec_open_param *param);
Signature · 1 line
2.43.0
jackson.lee
maintainerPATCH 4/5 wave5: Use the bitstream buffer size from host.
In reply to jackson.leeIn V4L2 spec, Host can set the bitstream buffer size. Allow the larger size between default size and input size.
--- drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +4 -1
@@ -11,6 +11,8 @@#define VPU_ENC_DEV_NAME "C&M Wave5 VPU encoder"#define VPU_ENC_DRV_NAME "wave5-enc" +#define DEFAULT_SRC_SIZE (width, height) ((width) * (height) / 8 * 3) +static const struct vpu_format enc_fmt_list[FMT_TYPES ][MAX_FMTS ] = { [VPU_FMT_TYPE_CODEC ] = { {
@@ -193,7 +195,8 @@ static void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp, unsigned pix_mp->width = width; pix_mp->height = height; pix_mp->plane_fmt[0 ].bytesperline =0 ; - pix_mp->plane_fmt[0 ].sizeimage = width * height /8 *3 ; + pix_mp->plane_fmt[0 ].sizeimage =max (DEFAULT_SRC_SIZE (width, height), + pix_mp->plane_fmt[0 ].sizeimage);break ; } }
Signature · 1 line
2.43.0
jackson.lee
maintainerPATCH 5/5 wave5 : Fixed the wrong buffer size formula.
In reply to jackson.leeS_FMT/G_FMT should report the buffer size based on aligned width and height. And, Host can set the real encoding size through s_selection and g_selection. So, Driver should use the conf_win information for encoding size instead of size of S_FMT/G_FMT.
--- .../chips-media/wave5/wave5-vpu-dec.c | 77 +++++++------------ .../chips-media/wave5/wave5-vpu-enc.c | 77 +++++++++++-------- 2 files changed, 72 insertions(+), 82 deletions(-)
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +28 -49
@@ -243,54 +243,54 @@ static void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp, unsignedcase V4L2_PIX_FMT_NV21 : pix_mp->width =round_up (width,32 ); pix_mp->height =round_up (height,16 ); - pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[0 ].sizeimage = width * height *3 /2 ; + pix_mp->plane_fmt[0 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[0 ].sizeimage = pix_mp->width * pix_mp->height *3 /2 ;break ;case V4L2_PIX_FMT_YUV422P :case V4L2_PIX_FMT_NV16 :case V4L2_PIX_FMT_NV61 : pix_mp->width =round_up (width,32 ); pix_mp->height =round_up (height,16 ); - pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[0 ].sizeimage = width * height *2 ; + pix_mp->plane_fmt[0 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[0 ].sizeimage = pix_mp->width * pix_mp->height *2 ;break ;case V4L2_PIX_FMT_YUV420M : pix_mp->width =round_up (width,32 ); pix_mp->height =round_up (height,16 ); - pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[0 ].sizeimage = width * height; - pix_mp->plane_fmt[1 ].bytesperline =round_up (width,32 ) /2 ; - pix_mp->plane_fmt[1 ].sizeimage = width * height /4 ; - pix_mp->plane_fmt[2 ].bytesperline =round_up (width,32 ) /2 ; - pix_mp->plane_fmt[2 ].sizeimage = width * height /4 ; + pix_mp->plane_fmt[0 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[0 ].sizeimage = pix_mp->width * pix_mp->height; + pix_mp->plane_fmt[1 ].bytesperline = pix_mp->width /2 ; + pix_mp->plane_fmt[1 ].sizeimage = pix_mp->width * pix_mp->height /4 ; + pix_mp->plane_fmt[2 ].bytesperline = pix_mp->width /2 ; + pix_mp->plane_fmt[2 ].sizeimage = pix_mp->width * pix_mp->height /4 ;break ;case V4L2_PIX_FMT_NV12M :case V4L2_PIX_FMT_NV21M : pix_mp->width =round_up (width,32 ); pix_mp->height =round_up (height,16 ); - pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[0 ].sizeimage = width * height; - pix_mp->plane_fmt[1 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[1 ].sizeimage = width * height /2 ; + pix_mp->plane_fmt[0 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[0 ].sizeimage = pix_mp->width * pix_mp->height; + pix_mp->plane_fmt[1 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[1 ].sizeimage = pix_mp->width * pix_mp->height /2 ;break ;case V4L2_PIX_FMT_YUV422M : pix_mp->width =round_up (width,32 ); pix_mp->height =round_up (height,16 ); - pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[0 ].sizeimage = width * height; - pix_mp->plane_fmt[1 ].bytesperline =round_up (width,32 ) /2 ; - pix_mp->plane_fmt[1 ].sizeimage = width * height /2 ; - pix_mp->plane_fmt[2 ].bytesperline =round_up (width,32 ) /2 ; - pix_mp->plane_fmt[2 ].sizeimage = width * height /2 ; + pix_mp->plane_fmt[0 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[0 ].sizeimage = pix_mp->width * pix_mp->height; + pix_mp->plane_fmt[1 ].bytesperline = pix_mp->width /2 ; + pix_mp->plane_fmt[1 ].sizeimage = pix_mp->width * pix_mp->height /2 ; + pix_mp->plane_fmt[2 ].bytesperline = pix_mp->width /2 ; + pix_mp->plane_fmt[2 ].sizeimage = pix_mp->width * pix_mp->height /2 ;break ;case V4L2_PIX_FMT_NV16M :case V4L2_PIX_FMT_NV61M : pix_mp->width =round_up (width,32 ); pix_mp->height =round_up (height,16 ); - pix_mp->plane_fmt[0 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[0 ].sizeimage = width * height; - pix_mp->plane_fmt[1 ].bytesperline =round_up (width,32 ); - pix_mp->plane_fmt[1 ].sizeimage = width * height; + pix_mp->plane_fmt[0 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[0 ].sizeimage = pix_mp->width * pix_mp->height; + pix_mp->plane_fmt[1 ].bytesperline = pix_mp->width; + pix_mp->plane_fmt[1 ].sizeimage = pix_mp->width * pix_mp->height;break ;default : pix_mp->width = width;
@@ -1003,6 +1003,7 @@ static int wave5_vpu_dec_queue_setup(struct vb2_queue *q, unsigned int *num_buffstruct vpu_instance *inst =vb2_get_drv_priv (q);struct v4l2_pix_format_mplane inst_format = (q->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ) ? inst->src_fmt : inst->dst_fmt; +unsigned int i;dev_dbg (inst->dev->dev,"%s: num_buffers: %u | num_planes: %u | type: %u\n" , __func__, *num_buffers, *num_planes, q->type);
@@ -1016,31 +1017,9 @@ static int wave5_vpu_dec_queue_setup(struct vb2_queue *q, unsigned int *num_buffif (*num_buffers < inst->fbc_buf_count) *num_buffers = inst->fbc_buf_count; -if (*num_planes ==1 ) { -if (inst->output_format ==FORMAT_422 ) - sizes[0 ] = inst_format.width * inst_format.height *2 ; -else - sizes[0 ] = inst_format.width * inst_format.height *3 /2 ; -dev_dbg (inst->dev->dev,"%s: size[0]: %u\n" , __func__, sizes[0 ]); - }else if (*num_planes ==2 ) { - sizes[0 ] = inst_format.width * inst_format.height; -if (inst->output_format ==FORMAT_422 ) - sizes[1 ] = inst_format.width * inst_format.height; -else - sizes[1 ] = inst_format.width * inst_format.height /2 ; -dev_dbg (inst->dev->dev,"%s: size[0]: %u | size[1]: %u\n" , - __func__, sizes[0 ], sizes[1 ]); - }else if (*num_planes ==3 ) { - sizes[0 ] = inst_format.width * inst_format.height; -if (inst->output_format ==FORMAT_422 ) { - sizes[1 ] = inst_format.width * inst_format.height /2 ; - sizes[2 ] = inst_format.width * inst_format.height /2 ; - }else { - sizes[1 ] = inst_format.width * inst_format.height /4 ; - sizes[2 ] = inst_format.width * inst_format.height /4 ; - } -dev_dbg (inst->dev->dev,"%s: size[0]: %u | size[1]: %u | size[2]: %u\n" , - __func__, sizes[0 ], sizes[1 ], sizes[2 ]); +for (i =0 ; i < *num_planes; i++) { + sizes[i] = inst_format.plane_fmt[i].sizeimage; +dev_dbg (inst->dev->dev,"%s: size[%u]: %u\n" , __func__, i, sizes[i]); } }
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +44 -33
130 lines not on this page · raw message
Signature · 1 line
2.43.0
Hey Jackson,
thanks for sending the patches!
I would advise to not send the next version of a patch series with multiple patches too quickly. So far the patches only got a single very minor review comment and others might already work on a deeper review and test. There is no hard rule but I would say give such a series at least a week or two to gather some review comments before sending the next version, as it is always a bit of hassle to adjust to a new version and you don't want to spam the mailing list.
Should you not receive any more review comments, then please go ahead and ping some relevant people (Hans Verkuil, people from Collabora that developed the patches, etc.) to review, either per mail or per IRC on the OFTC server on the channel #linux-media.
Greetings,
Sebastian
Quoted 31 lines · jackson.lee
The wave5 codec driver is a stateful encoder/decoder.
The following patches is for supporting yuv422 inpuy format, supporting runtime suspend/resume feature and extra things.Change since v0:
=================
TheDEFAULT_SRC_SIZEmacro was defined using multiple lines, To make a simple define, tab and multiple lines has been removed, The macro is defined using one line.jackson.lee (5):
wave5 : Support yuv422 input format for encoder.
wave5: Support to prepend sps/pps to IDR frame.
wave5 : Support runtime suspend/resume.
wave5: Use the bitstream buffer size from host.
wave5 : Fixed the wrong buffer size formula..../platform/chips-media/wave5/wave5-hw.c | 11 +- .../chips-media/wave5/wave5-vpu-dec.c | 86 +++++----- .../chips-media/wave5/wave5-vpu-enc.c | 157 +++++++++++++++--- .../platform/chips-media/wave5/wave5-vpu.c | 68 ++++++++ .../platform/chips-media/wave5/wave5-vpuapi.c | 7 + .../platform/chips-media/wave5/wave5-vpuapi.h | 1 + .../media/platform/chips-media/wave5/wave5.h | 3 + 7 files changed, 253 insertions(+), 80 deletions(-)Signature · 1 line
2.43.0
jackson.lee
maintainerHello Sebastian
Thanks for your advice.
Quoted 60 lines
-----Original Message-----
From: Sebastian Fricke <[email protected]>
Sent: Friday, February 2, 2024 5:16 PM
To: jackson.lee <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; lafley.kim <[email protected]>; b- [email protected]; [email protected]; Nas Chung <[email protected]>
Subject: Re: [PATCH v1 0/5] wave5 codec driverHey Jackson,
thanks for sending the patches!
I would advise to not send the next version of a patch series with multiple patches too quickly. So far the patches only got a single very minor review comment and others might already work on a deeper review and test. There is no hard rule but I would say give such a series at least a week or two to gather some review comments before sending the next version, as it is always a bit of hassle to adjust to a new version and you don't want to spam the mailing list.
Should you not receive any more review comments, then please go ahead and ping some relevant people (Hans Verkuil, people from Collabora that developed the patches, etc.) to review, either per mail or per IRC on the OFTC server on the channel #linux-media.Greetings,
SebastianQuoted 31 lines · jackson.lee
The wave5 codec driver is a stateful encoder/decoder.
The following patches is for supporting yuv422 inpuy format, supporting runtime suspend/resume feature and extra things.Change since v0:
=================
TheDEFAULT_SRC_SIZEmacro was defined using multiple lines, To make a simple define, tab and multiple lines has been removed, The macro is defined using one line.jackson.lee (5):
wave5 : Support yuv422 input format for encoder.
wave5: Support to prepend sps/pps to IDR frame.
wave5 : Support runtime suspend/resume.
wave5: Use the bitstream buffer size from host.
wave5 : Fixed the wrong buffer size formula..../platform/chips-media/wave5/wave5-hw.c | 11 +- .../chips-media/wave5/wave5-vpu-dec.c | 86 +++++----- .../chips-media/wave5/wave5-vpu-enc.c | 157 +++++++++++++++--- .../platform/chips-media/wave5/wave5-vpu.c | 68 ++++++++ .../platform/chips-media/wave5/wave5-vpuapi.c | 7 + .../platform/chips-media/wave5/wave5-vpuapi.h | 1 + .../media/platform/chips-media/wave5/wave5.h | 3 + 7 files changed, 253 insertions(+), 80 deletions(-)--
2.43.0