Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp439271imu; Thu, 8 Nov 2018 23:39:12 -0800 (PST) X-Google-Smtp-Source: AJdET5cfW5Su4AKPkRgx3xvAHpeHqIxavfEotKADpYjedk+S99MzXK6EkwDV3UtrSujBKCVvH7RG X-Received: by 2002:a17:902:d696:: with SMTP id v22-v6mr7692618ply.261.1541749152381; Thu, 08 Nov 2018 23:39:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541749152; cv=none; d=google.com; s=arc-20160816; b=n13hR14wIPxrk8W63a/ueY38HERHUFDaZ6TwMbjXzQEeTE2J8uzxAGuEQEYiPBhh2m sOTDOlwJLV/CXQj8j6515zfBC//pIZ46qkOUEJTylLOLuNJAHKyzXHf/0sC3T4DxQgE1 jrerNFuNgpS100HFJJIwqj/GmZiK9RroOSVyvyiFV5AS/vvVzBHcmfTtCC6acNypjYeW Zf8Ttzgnnzrr2egUGuWT+69xW5WlaenUUtnFyI6SjQJSh8p0uMecxjYbAFgeTkzaAczu ZEWRrUlnEIj/CvY8n8HfeX1KOW8IvM8jHyvBRHtCCIzFk8HvV1RNzzribUSLL6ZSgK3n OSHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=uFK0lv5wk4ZIniFPdb0wos8KKh44b4c84A49QFlpCVo=; b=T6/NGlofX/AKNuIaN7QhxCgO+J5/B2IGMcxuwIw7KnTWp9zvQwwkHB5DyqO9+bg87f f6X6l6bYHz0ArKaZgyQtzZ2NF5UWOFk3O1UgVpwlogpLTR8nqUOyLykiHEafiA8riUI7 Xv0b3v65NyuIFOgTcM69NAcc20CG7u0aEKOocVgm5/Vbq8bf9v/6df6u8J3RduCVLUO3 FWwK16CuDSyzwLgZV6kp+XMeMlizuLt8OXNkOzKEYn4ZnOQAWPqRuXlvScVQLXqURd5E AR6xFi2WPmDWmf0GsFcRIIe+qIhLtRJc7vlyE9LVzbzDLm8AVc/IZfpQs9zkXDSXe7IQ 1ULg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=l3YVCiH9; dkim=pass header.i=@codeaurora.org header.s=default header.b=l3YVCiH9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si6599486plp.128.2018.11.08.23.38.56; Thu, 08 Nov 2018 23:39:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=l3YVCiH9; dkim=pass header.i=@codeaurora.org header.s=default header.b=l3YVCiH9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728192AbeKIRRt (ORCPT + 99 others); Fri, 9 Nov 2018 12:17:49 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:49258 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727789AbeKIRRt (ORCPT ); Fri, 9 Nov 2018 12:17:49 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E0FB06076A; Fri, 9 Nov 2018 07:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541749108; bh=ABXPg95O802jNFGglS72EGnbG4FSLXoLy67LX2f7GaQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l3YVCiH9cKBGfuBfuzHXgqdowTd9mpDZ2Ht++3UtRX6S9cxdpBWs9wNcSXDPERp22 1qOE7PC50vPxDrGNusJ94WcJAha2pHu7t7wOR7Aqbv2G3nBmRPvYofyAdQAYtF/An3 uO8m7cVJZvT5LXAOOHkXEKqmp/74NwpTlDhDTZCg= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 06A9260271; Fri, 9 Nov 2018 07:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541749108; bh=ABXPg95O802jNFGglS72EGnbG4FSLXoLy67LX2f7GaQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l3YVCiH9cKBGfuBfuzHXgqdowTd9mpDZ2Ht++3UtRX6S9cxdpBWs9wNcSXDPERp22 1qOE7PC50vPxDrGNusJ94WcJAha2pHu7t7wOR7Aqbv2G3nBmRPvYofyAdQAYtF/An3 uO8m7cVJZvT5LXAOOHkXEKqmp/74NwpTlDhDTZCg= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 09 Nov 2018 07:38:27 +0000 From: mgottam@codeaurora.org To: Tomasz Figa Cc: Stanimir Varbanov , Hans Verkuil , Mauro Carvalho Chehab , Linux Media Mailing List , Linux Kernel Mailing List , linux-arm-msm , Alexandre Courbot , vgarodia@codeaurora.org Subject: Re: [PATCH] media: venus: add support for selection rectangles In-Reply-To: References: <1539071603-1588-1-git-send-email-mgottam@codeaurora.org> <0e0f689e-f6e3-73a6-e145-deb2ef7cafc8@linaro.org> <5037ca4b0dd0de80750e35ca889d4225@codeaurora.org> <4ccc50dc-c819-ca49-11d2-415053c02c0a@linaro.org> Message-ID: X-Sender: mgottam@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-11-02 03:16, Tomasz Figa wrote: > On Fri, Nov 2, 2018 at 12:02 AM Stanimir Varbanov > wrote: >> >> Hi Malathi, >> >> On 11/1/18 3:10 PM, mgottam@codeaurora.org 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 >> >>> --- >> >>> 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; > > Note that returning -EINVAL is not what VIDIOC_S_SELECTION should do > here. > > As per the general V4L2 spec [1], VIDIOC_S_SELECTION is expected to > adjust the crop rectangle "as close as possible to the requested one". > In this case that would likely mean something like this: > > if (s->r.left != 0) { > s->r.width += s->r.left; > s->r.left = 0; > } > > if (s->r.top != 0) { > s->r.height += s->r.top; > s->r.top = 0; > } > > if (s->r.width > inst->out_width) > s->r.width = inst->out_width; > > if (s->r.height > inst->out_height) > s->r.height = inst->out_height; > > [1] > https://www.kernel.org/doc/html/latest/media/uapi/v4l/vidioc-g-selection.html > Yes Tomasz, I overlooked the spec that we cannot return EINVAL in this case. I will make the necessary changes and update the new patch. >> >>> + 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. Setting this output resolution here I feel it as a repetition as we have this width and height set to firmware as a part of VIDIOC_REQBUFS(). So updating the selection rectangle would be sufficient in this case. >> >> What spec you are referring to? The spec for the encoders [1] or >> something else. > > For our convenience, Hans was nice enough to host a compiled version > at: > https://hverkuil.home.xs4all.nl/request-api/uapi/v4l/dev-encoder.html > > Best regards, > Tomasz