Re: [PATCH v2 17/34] media: iris: implement vb2_ops queue setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18.12.2023 12:32, Dikshita Agarwal wrote:
> Implement queue_setup vb2_ops.
> Calculate the buffer count and buffer size as par video
> hardware requirement and updates to client.
> Also, allocate the video driver buffers for output and
> capture plane.
> 
> Signed-off-by: Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>
> ---
[...]

> +static int input_min_count(struct iris_inst *inst)
> +{
> +	return MIN_BUFFERS;
> +}
Why is this a function?

> +
> +static int output_min_count(struct iris_inst *inst)
> +{
> +	int output_min_count;
> +
> +	switch (inst->codec) {
> +	case H264:
> +	case HEVC:
> +		output_min_count = 4;
> +		break;
> +	case VP9:
> +		output_min_count = 9;
> +		break;
> +	default:
> +		output_min_count = 4;
> +		break;
> +	}

switch (inst->codec) {
case VP9:
	return 9;
case H264:
case HEVC:
default:
	return 4;
}

> +
> +	return output_min_count;
> +}
> +
> +int iris_get_buf_min_count(struct iris_inst *inst,
> +			   enum iris_buffer_type buffer_type)
> +{
> +	switch (buffer_type) {
> +	case BUF_INPUT:
> +		return input_min_count(inst);
> +	case BUF_OUTPUT:
> +		return output_min_count(inst);
> +	default:
> +		return 0;
> +	}
> +}
> +
> +static u32 input_buffer_size(struct iris_inst *inst)
> +{
> +	u32 base_res_mbs = NUM_MBS_4k;
> +	u32 frame_size, num_mbs;
> +	struct v4l2_format *f;
> +	u32 div_factor = 1;
> +	u32 codec;
> +
> +	f = inst->fmt_src;
> +	codec = f->fmt.pix_mp.pixelformat;
> +
> +	num_mbs = get_mbpf(inst);
> +	if (num_mbs > NUM_MBS_4k) {
> +		div_factor = 4;
> +		base_res_mbs = inst->cap[MBPF].value;
> +	} else {
> +		base_res_mbs = NUM_MBS_4k;
> +		if (codec == V4L2_PIX_FMT_VP9)
> +			div_factor = 1;
> +		else
> +			div_factor = 2;
> +	}
> +
> +	frame_size = base_res_mbs * MB_IN_PIXEL * 3 / 2 / div_factor;
that's a bit magic..

> +
> +	 /* multiply by 10/8 (1.25) to get size for 10 bit case */
misaligned


Konrad




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux