Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp517224imu; Fri, 9 Nov 2018 01:21:24 -0800 (PST) X-Google-Smtp-Source: AJdET5eKm5f9IVejvexOtKyiwNLjx9BCRcehqEpBYvLyt6na2vjLn0KzApOTs1858EaegJa10JkY X-Received: by 2002:a17:902:4025:: with SMTP id b34-v6mr8209569pld.318.1541755283950; Fri, 09 Nov 2018 01:21:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541755283; cv=none; d=google.com; s=arc-20160816; b=kgYNGs1TVf1v5e55s7lgTJSyAsE9/Y8r0sulHMlwbIjLlYgYKnPHm0L8D9WnyCq+v3 vyYCLP1wyCTf4pumKcVhO4KQXyHtxpslYFedgkEl55ALwOm6SWwIfjY7hQzxuw6ujdVf XQ1K6fzcA9/u37mxSR4m1xxguyQL73+lYMVif2ZW19h0Zf5FTYAP1DMxyfI9xMZL9/HR I/3dg15SjF7CKhX4tPaW2vWv8kMyqoxICFDFUjV0TSSHttsqelW7ybHhGVAW9FKH9UwF qi2M80omnRs6SNA2YV0A8ZZlSLYWzxPLJE5q5ildAqG/juDCybIhW30R0zpthJpWwXXn KoPQ== 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=of+33QqaPP5ZuO1w5zGwdEvLHhHBBKPBrbl1gkIh02w=; b=RaxskJnpJAIRlyxVLcA7qknPD+25DPffoKj8WshxVFymXC5pocom/Md08FVeFrMC1z saqf8NqkIUfpHk5FT+VS16W7kMDTAYGUzy+jfLMD3aDdVh4E2HhCp2g73RQ10tlmlvH3 29xAN9oxv2f/t2b/J9qb4+x7Pv7AOeBoCeIiF6dFON0nOwXuoeNOIrk3Gw4IyZPAHa42 18t8ihBT3Z0u7SCcY2FAjfVxVC+S4rRGJeuwL/yb5ksJ1nfHbW9Ik2WXamkz+sTNHSFM GB75kbYwFMxBbZiEXd0B8ze9bN+z7xOJ3oSqqRBdRMJ7bdMicFBnVWye12KZpFiVIO5E noNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=kC+iunRM; dkim=pass header.i=@codeaurora.org header.s=default header.b=V8VesBUG; 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 a70si6570246pge.421.2018.11.09.01.21.07; Fri, 09 Nov 2018 01:21:23 -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=kC+iunRM; dkim=pass header.i=@codeaurora.org header.s=default header.b=V8VesBUG; 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 S1728037AbeKITA0 (ORCPT + 99 others); Fri, 9 Nov 2018 14:00:26 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:42386 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbeKITAZ (ORCPT ); Fri, 9 Nov 2018 14:00:25 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8EE826029D; Fri, 9 Nov 2018 09:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541755244; bh=OksxZfYdCjBVLgwLtiec01Wupm7MciV95e+HQ93GTRk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kC+iunRMJ6TNendmvcpujFB7TcgKr+XCDRBYntD4bIWy4VBpvCC1qNKAXFgiwHz5C I3gz4T5owtoyT4LfJ+3XIolpD8zRhZH603GYHMlMiM6GNVeyGwx4f0udKU7pTV9PT/ 6II6PCKrorQNEM7O002ns97OG2akqPlWmA5lX8Js= 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 B69E76038E; Fri, 9 Nov 2018 09:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541755243; bh=OksxZfYdCjBVLgwLtiec01Wupm7MciV95e+HQ93GTRk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V8VesBUGyxWHMXyKmAU1SLTuZc4VEkcZ7SxLZ5pb5hmBaJcJIF/VAGHIvDo7EuEtw 5M7ISK+dTtt/CsJwtpe//Pi/q8GEraspAQj+hxObTjEgJqltbO7z/rOGHk0aSGTVlE 2FFOkxfabqkCh8px37XZqr+Dsyy+za2ExCzgxnXM= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 09 Nov 2018 09:20:43 +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 v2] media: venus: add support for selection rectangles In-Reply-To: References: <1541749141-6989-1-git-send-email-mgottam@codeaurora.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-09 07:56, Tomasz Figa wrote: > Hi Malathi, > > On Fri, Nov 9, 2018 at 4:39 PM 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 | 26 >> ++++++++++++++++++++++---- >> 1 file changed, 22 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/venus/venc.c >> b/drivers/media/platform/qcom/venus/venc.c >> index ce85962..d26c129 100644 >> --- a/drivers/media/platform/qcom/venus/venc.c >> +++ b/drivers/media/platform/qcom/venus/venc.c >> @@ -478,16 +478,34 @@ 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 || >> - s->r.top != 0 || s->r.left != 0) >> - return -EINVAL; >> + 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->width) >> + s->r.width = inst->width; >> + else >> + inst->width = s->r.width; >> + >> + if (s->r.height > inst->height) >> + s->r.height = inst->height; >> + else >> + inst->height = s->r.height; >> + > > From semantic point of view, it looks fine, but where is the rectangle > actually set to the hardware? > > Best regards, > Tomasz As this set selection call occurs before the hfi session initialization, for now we are holding these values in driver. As this call is followed by VIDIOC_REQBUFS(), as a part of this we have venc_init_session static int venc_init_session(struct venus_inst *inst) { int ret; ret = hfi_session_init(inst, inst->fmt_cap->pixfmt); if (ret) return ret; ret = venus_helper_set_input_resolution(inst, inst->width, inst->height); if (ret) goto deinit; ret = venus_helper_set_output_resolution(inst, inst->width, inst->height, HFI_BUFFER_OUTPUT); if (ret) goto deinit; ret = venus_helper_set_color_format(inst, inst->fmt_out->pixfmt); if (ret) goto deinit; ret = venc_set_properties(inst); From here we set these values to hardware.