Commit 88ff31fd authored by Jackson.lee's avatar Jackson.lee Committed by Hans Verkuil
Browse files

media: chips-media: wave5: Use helpers to calculate bytesperline and sizeimage.



Use v4l2-common helper functions to calculate bytesperline and sizeimage,
instead of calculating in a wave5 driver directly.

In case of raw(YUV) v4l2_pix_format, the wave5 driver updates
v4l2_pix_format_mplane struct through v4l2_fill_pixfmt_mp() function.

Encoder and Decoder need the same bytesperline and sizeimage values for
the same v4l2_pix_format. So, wave5_update_pix_fmt function is refactored
to support both together.

Signed-off-by: default avatarJackson.lee <jackson.lee@chipsnmedia.com>
Signed-off-by: default avatarNas Chung <nas.chung@chipsnmedia.com>
Reviewed-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: default avatarSebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 2092b383
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@

#include "wave5-helper.h"

#define DEFAULT_BS_SIZE(width, height) ((width) * (height) / 8 * 3)

const char *state_to_str(enum vpu_instance_state state)
{
	switch (state) {
@@ -217,3 +219,25 @@ void wave5_return_bufs(struct vb2_queue *q, u32 state)
		v4l2_m2m_buf_done(vbuf, state);
	}
}

void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp,
			  int pix_fmt_type,
			  unsigned int width,
			  unsigned int height,
			  const struct v4l2_frmsize_stepwise *frmsize)
{
	v4l2_apply_frmsize_constraints(&width, &height, frmsize);

	if (pix_fmt_type == VPU_FMT_TYPE_CODEC) {
		pix_mp->width = width;
		pix_mp->height = height;
		pix_mp->num_planes = 1;
		pix_mp->plane_fmt[0].bytesperline = 0;
		pix_mp->plane_fmt[0].sizeimage = max(DEFAULT_BS_SIZE(width, height),
						     pix_mp->plane_fmt[0].sizeimage);
	} else {
		v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, width, height);
	}
	pix_mp->flags = 0;
	pix_mp->field = V4L2_FIELD_NONE;
}
+5 −0
Original line number Diff line number Diff line
@@ -28,4 +28,9 @@ const struct vpu_format *wave5_find_vpu_fmt_by_idx(unsigned int idx,
						   const struct vpu_format fmt_list[MAX_FMTS]);
enum wave_std wave5_to_vpu_std(unsigned int v4l2_pix_fmt, enum vpu_instance_type type);
void wave5_return_bufs(struct vb2_queue *q, u32 state);
void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp,
			  int pix_fmt_type,
			  unsigned int width,
			  unsigned int height,
			  const struct v4l2_frmsize_stepwise *frmsize);
#endif
+106 −194
Original line number Diff line number Diff line
@@ -11,111 +11,92 @@
#define VPU_DEC_DEV_NAME "C&M Wave5 VPU decoder"
#define VPU_DEC_DRV_NAME "wave5-dec"

#define DEFAULT_SRC_SIZE(width, height) ({			\
	(width) * (height) / 8 * 3;					\
})
static const struct v4l2_frmsize_stepwise dec_hevc_frmsize = {
	.min_width = W5_MIN_DEC_PIC_8_WIDTH,
	.max_width = W5_MAX_DEC_PIC_WIDTH,
	.step_width = W5_DEC_CODEC_STEP_WIDTH,
	.min_height = W5_MIN_DEC_PIC_8_HEIGHT,
	.max_height = W5_MAX_DEC_PIC_HEIGHT,
	.step_height = W5_DEC_CODEC_STEP_HEIGHT,
};

static const struct v4l2_frmsize_stepwise dec_h264_frmsize = {
	.min_width = W5_MIN_DEC_PIC_32_WIDTH,
	.max_width = W5_MAX_DEC_PIC_WIDTH,
	.step_width = W5_DEC_CODEC_STEP_WIDTH,
	.min_height = W5_MIN_DEC_PIC_32_HEIGHT,
	.max_height = W5_MAX_DEC_PIC_HEIGHT,
	.step_height = W5_DEC_CODEC_STEP_HEIGHT,
};

static const struct v4l2_frmsize_stepwise dec_raw_frmsize = {
	.min_width = W5_MIN_DEC_PIC_8_WIDTH,
	.max_width = W5_MAX_DEC_PIC_WIDTH,
	.step_width = W5_DEC_RAW_STEP_WIDTH,
	.min_height = W5_MIN_DEC_PIC_8_HEIGHT,
	.max_height = W5_MAX_DEC_PIC_HEIGHT,
	.step_height = W5_DEC_RAW_STEP_HEIGHT,
};

static const struct vpu_format dec_fmt_list[FMT_TYPES][MAX_FMTS] = {
	[VPU_FMT_TYPE_CODEC] = {
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_HEVC,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_hevc_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_H264,
			.max_width = 8192,
			.min_width = 32,
			.max_height = 4320,
			.min_height = 32,
			.v4l2_frmsize = &dec_h264_frmsize,
		},
	},
	[VPU_FMT_TYPE_RAW] = {
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_YUV420,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV12,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV21,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_YUV422P,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV16,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV61,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_YUV420M,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV12M,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV21M,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_YUV422M,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV16M,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
		{
			.v4l2_pix_fmt = V4L2_PIX_FMT_NV61M,
			.max_width = 8192,
			.min_width = 8,
			.max_height = 4320,
			.min_height = 8,
			.v4l2_frmsize = &dec_raw_frmsize,
		},
	}
};
@@ -234,74 +215,6 @@ static void wave5_handle_src_buffer(struct vpu_instance *inst, dma_addr_t rd_ptr
	inst->remaining_consumed_bytes = consumed_bytes;
}

static void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp, unsigned int width,
				 unsigned int height)
{
	switch (pix_mp->pixelformat) {
	case V4L2_PIX_FMT_YUV420:
	case V4L2_PIX_FMT_NV12:
	case 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;
		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;
		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;
		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;
		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;
		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;
		break;
	default:
		pix_mp->width = width;
		pix_mp->height = height;
		pix_mp->plane_fmt[0].bytesperline = 0;
		pix_mp->plane_fmt[0].sizeimage = max(DEFAULT_SRC_SIZE(width, height),
						     pix_mp->plane_fmt[0].sizeimage);
		break;
	}
}

static int start_decode(struct vpu_instance *inst, u32 *fail_res)
{
	struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx;
@@ -389,6 +302,8 @@ static int handle_dynamic_resolution_change(struct vpu_instance *inst)
	}

	if (p_dec_info->initial_info_obtained) {
		const struct vpu_format *vpu_fmt;

		inst->conf_win.left = initial_info->pic_crop_rect.left;
		inst->conf_win.top = initial_info->pic_crop_rect.top;
		inst->conf_win.width = initial_info->pic_width -
@@ -396,10 +311,27 @@ static int handle_dynamic_resolution_change(struct vpu_instance *inst)
		inst->conf_win.height = initial_info->pic_height -
			initial_info->pic_crop_rect.top - initial_info->pic_crop_rect.bottom;

		wave5_update_pix_fmt(&inst->src_fmt, initial_info->pic_width,
				     initial_info->pic_height);
		wave5_update_pix_fmt(&inst->dst_fmt, initial_info->pic_width,
				     initial_info->pic_height);
		vpu_fmt = wave5_find_vpu_fmt(inst->src_fmt.pixelformat,
					     dec_fmt_list[VPU_FMT_TYPE_CODEC]);
		if (!vpu_fmt)
			return -EINVAL;

		wave5_update_pix_fmt(&inst->src_fmt,
				     VPU_FMT_TYPE_CODEC,
				     initial_info->pic_width,
				     initial_info->pic_height,
				     vpu_fmt->v4l2_frmsize);

		vpu_fmt = wave5_find_vpu_fmt(inst->dst_fmt.pixelformat,
					     dec_fmt_list[VPU_FMT_TYPE_RAW]);
		if (!vpu_fmt)
			return -EINVAL;

		wave5_update_pix_fmt(&inst->dst_fmt,
				     VPU_FMT_TYPE_RAW,
				     initial_info->pic_width,
				     initial_info->pic_height,
				     vpu_fmt->v4l2_frmsize);
	}

	v4l2_event_queue_fh(fh, &vpu_event_src_ch);
@@ -548,12 +480,12 @@ static int wave5_vpu_dec_enum_framesizes(struct file *f, void *fh, struct v4l2_f
	}

	fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
	fsize->stepwise.min_width = vpu_fmt->min_width;
	fsize->stepwise.max_width = vpu_fmt->max_width;
	fsize->stepwise.step_width = 1;
	fsize->stepwise.min_height = vpu_fmt->min_height;
	fsize->stepwise.max_height = vpu_fmt->max_height;
	fsize->stepwise.step_height = 1;
	fsize->stepwise.min_width = vpu_fmt->v4l2_frmsize->min_width;
	fsize->stepwise.max_width = vpu_fmt->v4l2_frmsize->max_width;
	fsize->stepwise.step_width = W5_DEC_CODEC_STEP_WIDTH;
	fsize->stepwise.min_height = vpu_fmt->v4l2_frmsize->min_height;
	fsize->stepwise.max_height = vpu_fmt->v4l2_frmsize->max_height;
	fsize->stepwise.step_height = W5_DEC_CODEC_STEP_HEIGHT;

	return 0;
}
@@ -576,6 +508,7 @@ static int wave5_vpu_dec_try_fmt_cap(struct file *file, void *fh, struct v4l2_fo
{
	struct vpu_instance *inst = wave5_to_vpu_inst(fh);
	struct dec_info *p_dec_info = &inst->codec_info->dec_info;
	const struct v4l2_frmsize_stepwise *frmsize;
	const struct vpu_format *vpu_fmt;
	int width, height;

@@ -589,14 +522,12 @@ static int wave5_vpu_dec_try_fmt_cap(struct file *file, void *fh, struct v4l2_fo
		width = inst->dst_fmt.width;
		height = inst->dst_fmt.height;
		f->fmt.pix_mp.pixelformat = inst->dst_fmt.pixelformat;
		f->fmt.pix_mp.num_planes = inst->dst_fmt.num_planes;
		frmsize = &dec_raw_frmsize;
	} else {
		const struct v4l2_format_info *info = v4l2_format_info(vpu_fmt->v4l2_pix_fmt);

		width = clamp(f->fmt.pix_mp.width, vpu_fmt->min_width, vpu_fmt->max_width);
		height = clamp(f->fmt.pix_mp.height, vpu_fmt->min_height, vpu_fmt->max_height);
		width = f->fmt.pix_mp.width;
		height = f->fmt.pix_mp.height;
		f->fmt.pix_mp.pixelformat = vpu_fmt->v4l2_pix_fmt;
		f->fmt.pix_mp.num_planes = info->mem_planes;
		frmsize = vpu_fmt->v4l2_frmsize;
	}

	if (p_dec_info->initial_info_obtained) {
@@ -604,9 +535,8 @@ static int wave5_vpu_dec_try_fmt_cap(struct file *file, void *fh, struct v4l2_fo
		height = inst->dst_fmt.height;
	}

	wave5_update_pix_fmt(&f->fmt.pix_mp, width, height);
	f->fmt.pix_mp.flags = 0;
	f->fmt.pix_mp.field = V4L2_FIELD_NONE;
	wave5_update_pix_fmt(&f->fmt.pix_mp, VPU_FMT_TYPE_RAW,
			     width, height, frmsize);
	f->fmt.pix_mp.colorspace = inst->colorspace;
	f->fmt.pix_mp.ycbcr_enc = inst->ycbcr_enc;
	f->fmt.pix_mp.quantization = inst->quantization;
@@ -718,7 +648,9 @@ static int wave5_vpu_dec_enum_fmt_out(struct file *file, void *fh, struct v4l2_f
static int wave5_vpu_dec_try_fmt_out(struct file *file, void *fh, struct v4l2_format *f)
{
	struct vpu_instance *inst = wave5_to_vpu_inst(fh);
	const struct v4l2_frmsize_stepwise *frmsize;
	const struct vpu_format *vpu_fmt;
	int width, height;

	dev_dbg(inst->dev->dev,
		"%s: fourcc: %u width: %u height: %u num_planes: %u colorspace: %u field: %u\n",
@@ -727,20 +659,19 @@ static int wave5_vpu_dec_try_fmt_out(struct file *file, void *fh, struct v4l2_fo

	vpu_fmt = wave5_find_vpu_fmt(f->fmt.pix_mp.pixelformat, dec_fmt_list[VPU_FMT_TYPE_CODEC]);
	if (!vpu_fmt) {
		width = inst->src_fmt.width;
		height = inst->src_fmt.height;
		f->fmt.pix_mp.pixelformat = inst->src_fmt.pixelformat;
		f->fmt.pix_mp.num_planes = inst->src_fmt.num_planes;
		wave5_update_pix_fmt(&f->fmt.pix_mp, inst->src_fmt.width, inst->src_fmt.height);
		frmsize = &dec_hevc_frmsize;
	} else {
		int width = clamp(f->fmt.pix_mp.width, vpu_fmt->min_width, vpu_fmt->max_width);
		int height = clamp(f->fmt.pix_mp.height, vpu_fmt->min_height, vpu_fmt->max_height);

		width = f->fmt.pix_mp.width;
		height = f->fmt.pix_mp.height;
		f->fmt.pix_mp.pixelformat = vpu_fmt->v4l2_pix_fmt;
		f->fmt.pix_mp.num_planes = 1;
		wave5_update_pix_fmt(&f->fmt.pix_mp, width, height);
		frmsize = vpu_fmt->v4l2_frmsize;
	}

	f->fmt.pix_mp.flags = 0;
	f->fmt.pix_mp.field = V4L2_FIELD_NONE;
	wave5_update_pix_fmt(&f->fmt.pix_mp, VPU_FMT_TYPE_CODEC,
			     width, height, frmsize);

	return 0;
}
@@ -748,6 +679,7 @@ static int wave5_vpu_dec_try_fmt_out(struct file *file, void *fh, struct v4l2_fo
static int wave5_vpu_dec_s_fmt_out(struct file *file, void *fh, struct v4l2_format *f)
{
	struct vpu_instance *inst = wave5_to_vpu_inst(fh);
	const struct vpu_format *vpu_fmt;
	int i, ret;

	dev_dbg(inst->dev->dev,
@@ -782,7 +714,13 @@ static int wave5_vpu_dec_s_fmt_out(struct file *file, void *fh, struct v4l2_form
	inst->quantization = f->fmt.pix_mp.quantization;
	inst->xfer_func = f->fmt.pix_mp.xfer_func;

	wave5_update_pix_fmt(&inst->dst_fmt, f->fmt.pix_mp.width, f->fmt.pix_mp.height);
	vpu_fmt = wave5_find_vpu_fmt(inst->dst_fmt.pixelformat, dec_fmt_list[VPU_FMT_TYPE_RAW]);
	if (!vpu_fmt)
		return -EINVAL;

	wave5_update_pix_fmt(&inst->dst_fmt, VPU_FMT_TYPE_RAW,
			     f->fmt.pix_mp.width, f->fmt.pix_mp.height,
			     vpu_fmt->v4l2_frmsize);

	return 0;
}
@@ -1005,6 +943,7 @@ static int wave5_vpu_dec_queue_setup(struct vb2_queue *q, unsigned int *num_buff
	struct 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);
@@ -1018,31 +957,9 @@ static int wave5_vpu_dec_queue_setup(struct vb2_queue *q, unsigned int *num_buff
		if (*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]);
		}
	}

@@ -1568,20 +1485,15 @@ static const struct vb2_ops wave5_vpu_dec_vb2_ops = {
static void wave5_set_default_format(struct v4l2_pix_format_mplane *src_fmt,
				     struct v4l2_pix_format_mplane *dst_fmt)
{
	unsigned int dst_pix_fmt = dec_fmt_list[VPU_FMT_TYPE_RAW][0].v4l2_pix_fmt;
	const struct v4l2_format_info *dst_fmt_info = v4l2_format_info(dst_pix_fmt);

	src_fmt->pixelformat = dec_fmt_list[VPU_FMT_TYPE_CODEC][0].v4l2_pix_fmt;
	src_fmt->field = V4L2_FIELD_NONE;
	src_fmt->flags = 0;
	src_fmt->num_planes = 1;
	wave5_update_pix_fmt(src_fmt, 720, 480);

	dst_fmt->pixelformat = dst_pix_fmt;
	dst_fmt->field = V4L2_FIELD_NONE;
	dst_fmt->flags = 0;
	dst_fmt->num_planes = dst_fmt_info->mem_planes;
	wave5_update_pix_fmt(dst_fmt, 736, 480);
	wave5_update_pix_fmt(src_fmt, VPU_FMT_TYPE_CODEC,
			     W5_DEF_DEC_PIC_WIDTH, W5_DEF_DEC_PIC_HEIGHT,
			     &dec_hevc_frmsize);

	dst_fmt->pixelformat = dec_fmt_list[VPU_FMT_TYPE_RAW][0].v4l2_pix_fmt;
	wave5_update_pix_fmt(dst_fmt, VPU_FMT_TYPE_RAW,
			     W5_DEF_DEC_PIC_WIDTH, W5_DEF_DEC_PIC_HEIGHT,
			     &dec_raw_frmsize);
}

static int wave5_vpu_dec_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
+80 −117

File changed.

Preview size limit exceeded, changes collapsed.

+1 −4
Original line number Diff line number Diff line
@@ -38,10 +38,7 @@ enum vpu_fmt_type {

struct vpu_format {
	unsigned int v4l2_pix_fmt;
	unsigned int max_width;
	unsigned int min_width;
	unsigned int max_height;
	unsigned int min_height;
	const struct v4l2_frmsize_stepwise *v4l2_frmsize;
};

static inline struct vpu_instance *wave5_to_vpu_inst(struct v4l2_fh *vfh)
Loading