[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb2a921c-5c8e-44c8-af1d-78d877977b62@linaro.org>
Date: Tue, 19 Dec 2023 12:56:57 +0100
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: Dikshita Agarwal <quic_dikshita@...cinc.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
stanimir.k.varbanov@...il.com, quic_vgarodia@...cinc.com, agross@...nel.org,
andersson@...nel.org, mchehab@...nel.org, bryan.odonoghue@...aro.org
Cc: linux-arm-msm@...r.kernel.org, quic_abhinavk@...cinc.com
Subject: Re: [PATCH v2 17/34] media: iris: implement vb2_ops queue setup
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@...cinc.com>
> ---
[...]
> +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
Powered by blists - more mailing lists