Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp575258imu; Fri, 9 Nov 2018 02:32:43 -0800 (PST) X-Google-Smtp-Source: AJdET5fwF3uRIe3ycjkeTK4W1/1hESRItHGgEP+bwkeu5dfNeDtsFZ/163yQKkejxMuVZg2WklM0 X-Received: by 2002:a63:6984:: with SMTP id e126mr7072414pgc.143.1541759563730; Fri, 09 Nov 2018 02:32:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541759563; cv=none; d=google.com; s=arc-20160816; b=bpf17rIpuBwmYH2h7joIL8ZqaT//GtK5LYIFovizR8C01OMJkuOB5vYPvC/hu+YRnc jb0f923WXiaY0zE1JHsu9XUhNDt932I3uu1pPT5qnU3YZA3Ms7S3ZbYleRZ3EcgMGs0E ZK8OiJK3QmxgW8jiULYb5/RrBjeqldyMYMYDm0I2G3JEFj34g0BsDL4HzGcJIOqEmjow FKypTKeQni7EQOKOdDWG8Y1WHBFYaz3kILQqJ94ldbu3kpPAWJWfBz1QJQ1HhHxJ3WXD E21GswhfBqVW8rznAKsjHo7Q7fnxl1/iDJImSqHHcTB1gQYuLmujdFFV9HGcVA4TvW3P Hvyg== 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=ZFF4LJwGLa4raDTcemTqAiKKZx5qIFbJw1bPd62m7+E=; b=bzdKQGv3NvpQW16QP0M0F7CAPiTyEKGJ4zpJNgx6l/QGqNEkC5vovgic/S5bSXrA9t tsTasCn9Fu6RpNnzZBnusJaZeUPLq7tyHairQZKCWwCNU1+Qd+QRNXTsKtXoYNw0HHcY nLkODbJzdPkcD7Jd6sD1esFVx/SGWaH5zhQETlYrmFn8bSYC8SXlPDBNJAxXuSSMtwh1 LQYDgc0YTfz/g3d9svKBqfLY4xRQ1uYwzdvMJMWD8rdVnYXCg6g9Ou1SPyJ12nSHnsdR 6lzO3w6MzzldXCYGtHEjlDWLkEAIXGHBiGsL123i5Bs9Z0KBl1nttJo1gLXoTRSO5Fv0 +8gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WSQ27YoG; 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 q17-v6si6868177pgd.438.2018.11.09.02.32.23; Fri, 09 Nov 2018 02:32:43 -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=WSQ27YoG; 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 S1727752AbeKIULv (ORCPT + 99 others); Fri, 9 Nov 2018 15:11:51 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:44548 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727596AbeKIULv (ORCPT ); Fri, 9 Nov 2018 15:11:51 -0500 Received: by mail-yw1-f66.google.com with SMTP id k6-v6so1402817ywa.11 for ; Fri, 09 Nov 2018 02:31: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=ZFF4LJwGLa4raDTcemTqAiKKZx5qIFbJw1bPd62m7+E=; b=WSQ27YoGBbStVQxtoEUtlgpQbtyMp3iQWr8HU25ZXF+S9Ec6ptQL29Z30Z84B88v+0 k6+tQ/VDnisReBSKDG1RaQ1hz0+G3xuDJC6KwNYW+QmhoX4Ep9hUl/7xVmR+HBDkQk15 evFWnVU8GnSepX6DxUm9X0gXyKrgxwe8MLMHY= 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=ZFF4LJwGLa4raDTcemTqAiKKZx5qIFbJw1bPd62m7+E=; b=qM2jT8rxkj6wBxha2yOPzMEEj0BQU28CR1RZ5pB+QnvdkXfWeCW+qF2hUIwVCHe48m BCDqvYmswEmAz0Ymm8hzLLA5SHLjn6zzDzVmGCS5K+l/dOSlWueS2h5C7TgB25yNZEd2 fpWm6Dg7pOFZlOjexeyK8dUdJ26BCLLwc2XovYeOVsIcHxWDNFUm4iWp92HVxN+1Cu/R 4ogS/DoXIl7CF3W8EZFv3Ce66Zul4Buz6g8xdGclvSrQOVBcmHl7Wr0rCROtUKmSR+7k ShbdM1ZbKyBwiIzIsUxQhaTyjE2tXwMrIcm8Lp4dh0wIOEurT0FAEk/glKuK+VpfMK0e gt4w== X-Gm-Message-State: AGRZ1gJ6CZ3vK4N38fB7wDOlgpq3m6YVgayRQzovuLqs1T+NlZCGBMHl 1PssADMDpDLvH6l0oBgdOiLfZAaJPIW2nw== X-Received: by 2002:a81:3802:: with SMTP id f2-v6mr7418499ywa.81.1541759511512; Fri, 09 Nov 2018 02:31:51 -0800 (PST) Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com. [209.85.219.170]) by smtp.gmail.com with ESMTPSA id s83-v6sm3292545yws.33.2018.11.09.02.31.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Nov 2018 02:31:50 -0800 (PST) Received: by mail-yb1-f170.google.com with SMTP id g192-v6so856312ybf.3 for ; Fri, 09 Nov 2018 02:31:49 -0800 (PST) X-Received: by 2002:a25:d64d:: with SMTP id n74-v6mr7966551ybg.204.1541759509040; Fri, 09 Nov 2018 02:31:49 -0800 (PST) MIME-Version: 1.0 References: <1541749141-6989-1-git-send-email-mgottam@codeaurora.org> In-Reply-To: From: Tomasz Figa Date: Fri, 9 Nov 2018 19:31:35 +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 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; > >> > >> 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? > 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. Okay, thanks for the explanation. In this case, we must return -EBUSY if selection is attempted to be set after the session is initialized. Best regards, Tomasz