Re: [PATCH] media: venus: add support for selection rectangles

From: Stanimir Varbanov
Date: Thu Nov 01 2018 - 11:02:14 EST


Hi Malathi,

On 11/1/18 3:10 PM, mgottam@xxxxxxxxxxxxxx wrote:
> On 2018-10-16 15:11, Stanimir Varbanov wrote:
>> Hi Malathi,
>>
>> On 10/09/2018 10:53 AM, Malathi Gottam wrote:
>>> Handles target type crop by setting the new active rectangle
>>> to hardware. The new rectangle should be within YUV size.
>>>
>>> Signed-off-by: Malathi Gottam <mgottam@xxxxxxxxxxxxxx>
>>> ---
>>> Âdrivers/media/platform/qcom/venus/venc.c | 19 +++++++++++++++++--
>>> Â1 file changed, 17 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/venc.c
>>> b/drivers/media/platform/qcom/venus/venc.c
>>> index 3f50cd0..754c19a 100644
>>> --- a/drivers/media/platform/qcom/venus/venc.c
>>> +++ b/drivers/media/platform/qcom/venus/venc.c
>>> @@ -478,16 +478,31 @@ static int venc_g_fmt(struct file *file, void
>>> *fh, struct v4l2_format *f)
>>> Âvenc_s_selection(struct file *file, void *fh, struct v4l2_selection *s)
>>> Â{
>>> ÂÂÂÂ struct venus_inst *inst = to_inst(file);
>>> +ÂÂÂ int ret;
>>> +ÂÂÂ u32 buftype;
>>>
>>> ÂÂÂÂ if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
>>> ÂÂÂÂÂÂÂÂ return -EINVAL;
>>>
>>> ÂÂÂÂ switch (s->target) {
>>> ÂÂÂÂ case V4L2_SEL_TGT_CROP:
>>> -ÂÂÂÂÂÂÂ if (s->r.width != inst->out_width ||
>>> -ÂÂÂÂÂÂÂÂÂÂÂ s->r.height != inst->out_height ||
>>> +ÂÂÂÂÂÂÂ if (s->r.width > inst->out_width ||
>>> +ÂÂÂÂÂÂÂÂÂÂÂ s->r.height > inst->out_height ||
>>> ÂÂÂÂÂÂÂÂÂÂÂÂ s->r.top != 0 || s->r.left != 0)
>>> ÂÂÂÂÂÂÂÂÂÂÂÂ return -EINVAL;
>>> +ÂÂÂÂÂÂÂ if (s->r.width != inst->width ||
>>> +ÂÂÂÂÂÂÂÂÂÂÂ s->r.height != inst->height) {
>>> +ÂÂÂÂÂÂÂÂÂÂÂ buftype = HFI_BUFFER_OUTPUT;
>>> +ÂÂÂÂÂÂÂÂÂÂÂ ret = venus_helper_set_output_resolution(inst,
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ s->r.width,
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ s->r.height,
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ buftype);
>>
>> I'm afraid that set_output_resolution cannot be called at any time. Do
>> you think we can set it after start_session?
>
> Yes Stan, we can set output_resolution after the session has been
> initialization.
> As per the spec, this call s_selection is an optional step under
> Initialization
> procedure of encoder even before we request buffers.

What spec you are referring to? The spec for the encoders [1] or
something else.

>
> So I think setting output resolution in this api shouldn't cause any
> issue once
> we are confident on the instance state.

OK, but I want to test that on v1 and v3 as well (usually the behavior
differs between versions).

--
regards,
Stan

[1] https://patchwork.linuxtv.org/patch/52624/