Re: [PATCH v3 12/29] media: iris: implement s_fmt, g_fmt and try_fmt ioctls

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

 




On 9/24/2024 8:11 PM, Bryan O'Donoghue wrote:
> On 27/08/2024 11:05, Dikshita Agarwal via B4 Relay wrote:
>> From: Vedang Nagar <quic_vnagar@xxxxxxxxxxx>
>>
>> Implement s_fmt, g_fmt and try_fmt IOCTL ops in
>> the driver with necessary hooks.
>>
>> Signed-off-by: Vedang Nagar <quic_vnagar@xxxxxxxxxxx>
>> Signed-off-by: Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>
> 
>> +
>> +    src_q = v4l2_m2m_get_src_vq(m2m_ctx);
>> +    memset(pixmp->reserved, 0, sizeof(pixmp->reserved));
>> +    if (V4L2_TYPE_IS_OUTPUT(f->type)) {
>> +        if (f->fmt.pix_mp.pixelformat != V4L2_PIX_FMT_H264) {
>> +            f_inst = inst->fmt_src;
>> +            f->fmt.pix_mp.width = f_inst->fmt.pix_mp.width;
>> +            f->fmt.pix_mp.height = f_inst->fmt.pix_mp.height;
>> +            f->fmt.pix_mp.pixelformat = f_inst->fmt.pix_mp.pixelformat;
>> +        }
>> +    } else if (V4L2_TYPE_IS_CAPTURE(f->type)) {
>> +        if (f->fmt.pix_mp.pixelformat != V4L2_PIX_FMT_NV12) {
>> +            f_inst = inst->fmt_dst;
>> +            f->fmt.pix_mp.pixelformat = f_inst->fmt.pix_mp.pixelformat;
>> +            f->fmt.pix_mp.width = f_inst->fmt.pix_mp.width;
>> +            f->fmt.pix_mp.height = f_inst->fmt.pix_mp.height;
>> +        }
>> +        if (vb2_is_streaming(src_q)) {
>> +            f_inst = inst->fmt_src;
>> +            f->fmt.pix_mp.height = f_inst->fmt.pix_mp.height;
>> +            f->fmt.pix_mp.width = f_inst->fmt.pix_mp.width;
>> +        }
>> +    } else {
>> +        return -EINVAL;
>> +    }
>> +
> 
> <snip>
> 
>> +int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f)
>> +{
>> +    struct v4l2_format *fmt, *output_fmt;
>> +    struct vb2_queue *q;
>> +    u32 codec_align;
>> +
>> +    int ret = 0;
>> +
>> +    q = v4l2_m2m_get_vq(inst->m2m_ctx, f->type);
>> +    if (!q)
>> +        return -EINVAL;
>> +
>> +    iris_vdec_try_fmt(inst, f);
>> +
>> +    if (V4L2_TYPE_IS_OUTPUT(f->type)) {
> 
> <snip>
> 
>> +       
>> +    } else if (V4L2_TYPE_IS_CAPTURE(f->type)) {
> 
> <snip>
>> +    } else {
>> +        return -EINVAL;
>> +    }
> 
> I'd switch this instead of if/elsing.
> 
> A blanket comment for this series.
Sure, will revisit the whole driver code and convert if/else to switch
wherever possible/required.
> 
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux