Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp451456imu; Thu, 8 Nov 2018 23:57:20 -0800 (PST) X-Google-Smtp-Source: AJdET5fFLPmcoR/SKWNuqRad+8cVpx8jBg4GjcuGXjlOg5WDPre+oZYkWfIHVxMcJ9Fy4ximfaDy X-Received: by 2002:a62:31c2:: with SMTP id x185-v6mr7984425pfx.39.1541750239985; Thu, 08 Nov 2018 23:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541750239; cv=none; d=google.com; s=arc-20160816; b=wIHKs8suYvifH1YiQHHBuAsLIG/O7Mu6Dx0lkuS9Lgurnaogq4SVpI/wawULwq8TFG +358qP8OkhVDuvOKMtnNn/wDk8lwOY4lB9kpyr//q2kMU8bs3l2w+y4IY2XEruu0jw7H 7Qvn5NVOkLbI5ErBfrRd0X3gH3us0ieF3+nluPrZSuiILNJyhEoC8SSaSbNwBl2qA6rC 8vKjhv6gS/ZqHjOW1qKqnrwAYfAAcEWd9c83QAoHGDNlkADStbegF//VW/EdcYNYTWES qc50bln0WF/Rn13TWO5brO/G8+wvlvyZ0iiJsqTWQTVUNa96gGISz6G9+5Ivfu6Fl89W hwaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LEPp+EwU9LiR+ySjrZWVA5o0UEDKTJdJ7RvMc4OtLpI=; b=PYSXujhpSG6dOpuDzh29hevau3BhrpDXzLZnZ10r3I6wqEaxjf6qdAPXVWsUbp8K3s MwQaeHCiKekw1KNk55xOtf0pI7TAjQTYi63NqGpTUErsqe40UXtiQFmSO44Duegz+AfJ 9jyeBSXSkwe5DWXDAZFpIvZ8i4qKKlOYrQ6eaeowwOBVjGa9EyzWlJRRzSi0HcD+METT xqvOrF0FkMu7O2JVoWF4PlnTapsKp0sug4UjSM81Wy7OQBM4wWucE9MSyVdDLYQCdJ72 anZlfkIEgQZgiY0LI107TEdeQ8k5kWbe+8SzLdgRPcmFRZFHgqonZGzxoP4qpd8D6oSx 24NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="DC638u/n"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69si6087619pgc.164.2018.11.08.23.57.03; Thu, 08 Nov 2018 23:57:19 -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=@chromium.org header.s=google header.b="DC638u/n"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728260AbeKIRgA (ORCPT + 99 others); Fri, 9 Nov 2018 12:36:00 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:43857 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727864AbeKIRgA (ORCPT ); Fri, 9 Nov 2018 12:36:00 -0500 Received: by mail-yw1-f67.google.com with SMTP id j75-v6so1276371ywj.10 for ; Thu, 08 Nov 2018 23:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LEPp+EwU9LiR+ySjrZWVA5o0UEDKTJdJ7RvMc4OtLpI=; b=DC638u/nz2Oouwn+qJMXqycF4jVSOEnNnm2sNTK6K+aGBXbIqL0ng1JeDKvp6z/ZCT joljSAlL5K4Lf/R1oY79XY1GEGJZsgCMtz0FEdeMM1ailLWDSgCSyMSdcSMeBA+LdR1q lWLI/GFLxeLZslngYfP7I7glYT688HyIylYig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LEPp+EwU9LiR+ySjrZWVA5o0UEDKTJdJ7RvMc4OtLpI=; b=SOWm3g60FP97BlB8+14sAyNcnmGoTvZj8x5e14WlwLCTdPO52QYeKCLaYe0oMBOzjx a6dF/grqHa+lUh3RKEI9/7AwnRgbfYX9kV0VQCGTuNHY42viD/SzUM0B3BdV7CkInnkr Ssxwob+D/2CKvsZmyvX6yj9wRA3QIr5DS8BZ069QBWv8STgE+dDnets3il0+Lp/cLWu8 Zr/f6qV+dl/fhLzW5S9QIpjdMYprsRoR0K3MBtkv1KIdhJ5H/vv3i6I+CBUIewB6IfKM 2eMs3loEFaLIYo5LjbBjfEv8bB23vIx3oPfGRYBSnizATgLknb+y97q5bRRcw8E6Bp0/ t19Q== X-Gm-Message-State: AGRZ1gKan/XRHH2EhSxaaKdmkwIuwt3G41oyQVMIis3uAil6e8a1GKki jVPyxY8N3bPhv2lawepi2Q2PakEHE9E= X-Received: by 2002:a81:4d86:: with SMTP id a128-v6mr7147071ywb.434.1541750195988; Thu, 08 Nov 2018 23:56:35 -0800 (PST) Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com. [209.85.219.179]) by smtp.gmail.com with ESMTPSA id 203-v6sm1858021ywz.87.2018.11.08.23.56.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 23:56:35 -0800 (PST) Received: by mail-yb1-f179.google.com with SMTP id i17-v6so673125ybp.13 for ; Thu, 08 Nov 2018 23:56:34 -0800 (PST) X-Received: by 2002:a25:b3c9:: with SMTP id x9-v6mr7577418ybf.508.1541750193497; Thu, 08 Nov 2018 23:56:33 -0800 (PST) MIME-Version: 1.0 References: <1541749141-6989-1-git-send-email-mgottam@codeaurora.org> In-Reply-To: <1541749141-6989-1-git-send-email-mgottam@codeaurora.org> From: Tomasz Figa Date: Fri, 9 Nov 2018 16:56:21 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] media: venus: add support for selection rectangles To: mgottam@codeaurora.org Cc: Stanimir Varbanov , Hans Verkuil , Mauro Carvalho Chehab , Linux Media Mailing List , Linux Kernel Mailing List , linux-arm-msm , Alexandre Courbot , vgarodia@codeaurora.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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