Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3817261imu; Mon, 12 Nov 2018 00:36:32 -0800 (PST) X-Google-Smtp-Source: AJdET5fI4qZyf167hA41uuxjhN1/QK2LjRdxrP5tosfVwohbP6plU2ITYfb3m4R4WcKlNrqQywWM X-Received: by 2002:a17:902:8689:: with SMTP id g9-v6mr73075plo.44.1542011792274; Mon, 12 Nov 2018 00:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542011792; cv=none; d=google.com; s=arc-20160816; b=XZ2nz1/HLLWysrxvhG5/2AFyF2vZvOXs89xkPtzf7XH2qBS3BDVxrM6JEmiK/pONY4 c/FRqneDV3MGH2+Y6G/YQ3vqGg//dj/fp3rINA5gSpx/YX8UHTJLfUsWu8gbOv8hWrSi snx6ubuKgkITVjzxRJFI8sNCv9IHjF+07/jpSOHbN0fBY+EnndVuLRa/reA/nHDeax1G MiKmAim/sHlrxC0c4nO1dk7oMkZjPUhmvzqVwKhXKbq12vCN1It0xs2dxhaxVhsoxEHK Iype+or/ycb/EA5fuQvItylYVz3YlA9CBTbZNZSJZvv6yZdNuY+13GWTUOx+w0uMur6Z TD8A== 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=gXyBZnjux6qw85Gu5V+pcDhp0sZwdQ7an3DixOIjaVw=; b=N+6ve0C7FFapD2yTyy3C6bHlOHsOFXN/a1OcT6CvRW5xCD5PikgykhgoBL9td6WN2d 6YKGzBGnu1n558ebDGqnJfO9gRfVzPz3UIfZ6L2uIwG+XncnqhdGzqfoHmsg21KQKrIv 0X6m+6LrBUir76Sp3tAfJczqPiq79Z2RMriLVXv+vsETwOQnTiCRxDoqzd/wGZijozpj t9gMvIdLImDPiQZnT23xk94bCKvuBLyIEAq3IMSyvjZ2ZctvKzuwEgNg6SG3RCyoGkmS 1spcIvW7wa6Ast2U9eWQAgAarUbArDRwxmJ1mzNfxZdm716GiXsrAOx9Fx83d5Y5oqp7 ojQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RqZEQD4A; 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 c85-v6si17805633pfe.60.2018.11.12.00.36.16; Mon, 12 Nov 2018 00:36:32 -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=RqZEQD4A; 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 S1728451AbeKLS2B (ORCPT + 99 others); Mon, 12 Nov 2018 13:28:01 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:42393 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726433AbeKLS2B (ORCPT ); Mon, 12 Nov 2018 13:28:01 -0500 Received: by mail-oi1-f194.google.com with SMTP id x63-v6so6479258oix.9 for ; Mon, 12 Nov 2018 00:35:52 -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=gXyBZnjux6qw85Gu5V+pcDhp0sZwdQ7an3DixOIjaVw=; b=RqZEQD4AqvUCSMmNYOny3L0fxL5niilcOjyjHxvPMciKv9FEUekYoOW0E5FKeXEYu4 6qrxsP6hlNtAtVlE1YDkIvhq22aH2TwqRZk/K+NUEvi1OQEFqYodCOyNgZe2HOGy0rxB MlkqPNclrP8GLWKXm3seIrpR9zIVnW5+ei+sQ= 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=gXyBZnjux6qw85Gu5V+pcDhp0sZwdQ7an3DixOIjaVw=; b=XIBNkYrfVVCRCDaRARW18QOAQh9WsDlRZXG/oXYnqCCPwSastvhLC07pyi1047s82Z AbVFLTBiEHVJYhssA4c3lAtEZLZQUVb6e241WrxXGeG0A8d4Q21VUzpUKDgeTSE2J/rp qr+OcygIOxRwn2q95UYS7vawUMhm7qPJgyjIgxje+sLDfG3uCG2d0orKeVb+yknZxlq5 m1KCLYSR6HbAvzCm9LEQRtz8H+O6uzpVdL3d2INlaT93d4MWhWO7iRLjx/wLKjNjqiF8 xGTl74vWc+vTUzO4ABS5ia4pQvXAWmr6opRZEgjcBiholaKgCmZ903mzqXOFiNvcibDw CVkw== X-Gm-Message-State: AGRZ1gKOu6y7HTbPbLpgEtqyD9UJxRrlx5LipdkTePMLWP3TUTIKQZ7J Cbz9D0oAV4l3eY5FFQd7KAgWreasnq6lbg== X-Received: by 2002:aca:4dd4:: with SMTP id a203-v6mr34031oib.168.1542011751836; Mon, 12 Nov 2018 00:35:51 -0800 (PST) Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com. [209.85.210.45]) by smtp.gmail.com with ESMTPSA id n64-v6sm6012701oib.17.2018.11.12.00.35.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 00:35:50 -0800 (PST) Received: by mail-ot1-f45.google.com with SMTP id w25so6497811otm.13 for ; Mon, 12 Nov 2018 00:35:50 -0800 (PST) X-Received: by 2002:a9d:6287:: with SMTP id x7mr32672otk.304.1542011749888; Mon, 12 Nov 2018 00:35:49 -0800 (PST) MIME-Version: 1.0 References: <1541749141-6989-1-git-send-email-mgottam@codeaurora.org> In-Reply-To: From: Alexandre Courbot Date: Mon, 12 Nov 2018 17:35:37 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] media: venus: add support for selection rectangles To: Tomasz Figa Cc: mgottam@codeaurora.org, Stanimir Varbanov , Hans Verkuil , Mauro Carvalho Chehab , Linux Media Mailing List , LKML , linux-arm-msm@vger.kernel.org, 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 On Fri, Nov 9, 2018 at 7:31 PM Tomasz Figa wrote: > > Hi Malathi, > > On Fri, Nov 9, 2018 at 6:20 PM wrote: > > > > 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; Looks like these two variables are not used anymore? > > >> > > >> 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); > > Something sounds not right here. Shouldn't one of the width/height be > the OUPUT format and the other the selection CROP target rectangle? Yeah, I don't see where the stride of the input (from HFI perspective) buffer is set, so unless I missed something that would not capture the correct part of the buffer. Also doesn't Venus support non-zero left and top parameters for the selection rectangle?