Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4464715pxf; Tue, 16 Mar 2021 14:20:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ftSany61pyvEVBM7KD39e7/QqDQeXnWhUBN07EelDMI+6agUqk6mSig66xWTG/fyULy+ X-Received: by 2002:a17:906:1712:: with SMTP id c18mr32374413eje.417.1615929631188; Tue, 16 Mar 2021 14:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615929631; cv=none; d=google.com; s=arc-20160816; b=B/n1cN9bSS7NMjJ3ELpu7zzaLtKmZPjn2ucSTjTW9Sn2yENh7vWbDbCCjgoYll9t08 SrIzh7BbKHcGs7cQKMDINdmhnl2dfd7Cs0ufhMUZTtIcIgOeOvFXxWxB6u+pyhxzQCXs oQuHkbs+UkgmR7dk++ConYss9JdXj4mmAhbl3cbKc3t05g4TU+CN+WoLDLwJjTjrS3NU qloVgZnRrHcw5eqoKKLX1uHa/Oal78yQDlee/gKzOsev1liyrR0AwMeZG1tZEuBBevwv JUNaPOmnj4FWgluiQifn9MSQdsnmW4wc6qisRqMp57Zt7rwFUbKKlpRHOGow0/Rxv4bQ taJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/EY3L/mBI9A92qs+kcJfia7iM4nIgXa7Eq9egkGrSYQ=; b=P8pAwUiZXWJfMShGkJF5oboVOHtSURFEjtfAwDeJcGvzmw4Lum2wNOZy4q0GLo1v7s nIRyoZ8DWA2t/qWMmSgeDHMg2wIjqFTPlxv6ll/7hYvtfZE5v0a5OLMscxZRMxtTNZEQ wKskXSBlFp6+BibPKImM0I2Hk+8wCY/WEVwmUl0CVcJew8qZ2S9zLr304imgGu/Uddh8 fdsAtCrP9dkcCEry7/xx8EHvUzekJPhB2ZbLja2vQ5saG3bKcnasVFOH0IFEuCxD4CVU D1ONiIGxxDthEjCEGhxRSD84/5fcXop4bTjDCYBIP8mmi6KNH9ZN9jYKzE6gPIjsQFYS TZ7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ShxQSv1Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r18si14609751edw.69.2021.03.16.14.20.08; Tue, 16 Mar 2021 14:20:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ShxQSv1Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239991AbhCPSUu (ORCPT + 99 others); Tue, 16 Mar 2021 14:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239933AbhCPSUQ (ORCPT ); Tue, 16 Mar 2021 14:20:16 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ED9DC06174A; Tue, 16 Mar 2021 11:20:16 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id r20so21761927ljk.4; Tue, 16 Mar 2021 11:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/EY3L/mBI9A92qs+kcJfia7iM4nIgXa7Eq9egkGrSYQ=; b=ShxQSv1YnF0cA0m72VVBXuOJkv4rMoe/cZcEB2scB3iPD98yKUVaIFHsUQHsvMb+9F Ulv48BWA6vPHbW9Gy3pbWeEv/BRfws287bbrFenYgrmBnhJ0IkXxBBUDQmm44yeNF2fG XFk3UqwpJ2JQbH8wL/kiWkqOPddwzcDUhFPc5v9TpIuseArS9Uz3MSKY6vTsajrWy2V3 QqYUB6LvpyCN2+RIrKOhikeIs3dJYUYxqiQgo+o+IPXvMhCgCbOZQDLu/f+RS2pcocdI mQLAzxCO2uhxuFKSaBUpxzWFAdlDp/BRIZb7cUfzpl1HrrxTOITSs09rJEjTUZQz30om h7Nw== 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=/EY3L/mBI9A92qs+kcJfia7iM4nIgXa7Eq9egkGrSYQ=; b=UdTvLa6eHFBFIYEy9mUkXL4hCFkAgLEa3gRBY1Dk1TFoo6f2ngEpqRA+tLh3MOovZ5 yBD1Fufcif3TVWdBzzc/JKfbA3IgShGddmHnZO8dfemGYwKM81/mv5oPAKxk1XF0iSL8 zvbT6Z0EQcZfASXN5jzXw9LmEO3w4j0UTPVsuGFFE4H2JetIIz4McbTWLjCPgFaGgAdi y8DIp1+NFLDTY96z+emw5clAmG0eV7eZycQJAH1+Dw944FtgxhqPf7G6iFhQS1384IIm 9JCabJ9ahYkZvaBajt7zTluf/2r17BU9krHufVFtNe3DqyRVkFTQ76XJ2NTWAY0TTJMk AxOA== X-Gm-Message-State: AOAM531HJK5MTWYPb1SBw6bkL1A5XAQPh9FUdQqAx8vu5IblZBlVyHGw pzfJmmoXzwFh6N93F/GLhmvgUsc6F0fkyqFO0Lg= X-Received: by 2002:a2e:7409:: with SMTP id p9mr3392483ljc.165.1615918814407; Tue, 16 Mar 2021 11:20:14 -0700 (PDT) MIME-Version: 1.0 References: <20210208051749.1785246-1-sergey.senozhatsky@gmail.com> <20210208051749.1785246-2-sergey.senozhatsky@gmail.com> In-Reply-To: <20210208051749.1785246-2-sergey.senozhatsky@gmail.com> From: Ricardo Ribalda Delgado Date: Tue, 16 Mar 2021 19:19:57 +0100 Message-ID: Subject: Re: [PATCHv2 1/3] media: v4l UAPI docs: document ROI selection targets To: Sergey Senozhatsky Cc: Laurent Pinchart , Tomasz Figa , Mauro Carvalho Chehab , linux-media , LKML , Sergey Senozhatsky Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sergey Thanks for the patch! On Mon, Feb 8, 2021 at 6:21 AM Sergey Senozhatsky wrote: > > From: Sergey Senozhatsky > > Document new v4l2-selection target which will be used for the > Region of Interest v4l2 control. > > Signed-off-by: Sergey Senozhatsky > --- > .../media/v4l/selection-api-configuration.rst | 23 +++++++++++++++++++ > .../media/v4l/v4l2-selection-targets.rst | 21 +++++++++++++++++ > include/uapi/linux/v4l2-common.h | 8 +++++++ > 3 files changed, 52 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/selection-api-configuration.rst b/Documentation/userspace-api/media/v4l/selection-api-configuration.rst > index fee49bf1a1c0..9f69d71803f6 100644 > --- a/Documentation/userspace-api/media/v4l/selection-api-configuration.rst > +++ b/Documentation/userspace-api/media/v4l/selection-api-configuration.rst > @@ -135,3 +135,26 @@ and the height of rectangles obtained using ``V4L2_SEL_TGT_CROP`` and > ``V4L2_SEL_TGT_COMPOSE`` targets. If these are not equal then the > scaling is applied. The application can compute the scaling ratios using > these values. > + > +Configuration of Region of Interest (ROI) > +========================================= > + > +The range of coordinates of the top left corner, width and height of > +areas that can be ROI is given by the ``V4L2_SEL_TGT_ROI_BOUNDS`` target. > +It is recommended for the driver developers to put the top/left corner > +at position ``(0,0)``. The rectangle's coordinates are in global sensor > +coordinates. The units are in pixels and independent of the field of view. > +They are not impacted by any cropping or scaling that is currently being > +used. Can we also mention binning here? > + > +The top left corner, width and height of the Region of Interest area > +currently being employed by the device is given by the > +``V4L2_SEL_TGT_ROI_CURRENT`` target. It uses the same coordinate system > +as ``V4L2_SEL_TGT_ROI_BOUNDS``. Why do we need current? Cant we just read back V4L2_SEL_TGT_ROI ? > + > +In order to change active ROI top left, width and height coordinates > +use ``V4L2_SEL_TGT_ROI`` target. > + > +Each capture device has a default ROI rectangle, given by the > +``V4L2_SEL_TGT_ROI_DEFAULT`` target. Drivers shall set the ROI rectangle > +to the default when the driver is first loaded, but not later. > diff --git a/Documentation/userspace-api/media/v4l/v4l2-selection-targets.rst b/Documentation/userspace-api/media/v4l/v4l2-selection-targets.rst > index e877ebbdb32e..cb3809418fa6 100644 > --- a/Documentation/userspace-api/media/v4l/v4l2-selection-targets.rst > +++ b/Documentation/userspace-api/media/v4l/v4l2-selection-targets.rst > @@ -69,3 +69,24 @@ of the two interfaces they are used. > modified by hardware. > - Yes > - No > + * - ``V4L2_SEL_TGT_ROI_CURRENT`` > + - 0x0200 > + - Current Region of Interest rectangle. > + - Yes > + - No > + * - ``V4L2_SEL_TGT_ROI_DEFAULT`` > + - 0x0201 > + - Suggested Region of Interest rectangle. > + - Yes > + - No > + * - ``V4L2_SEL_TGT_ROI_BOUNDS`` > + - 0x0202 > + - Bounds of the Region of Interest rectangle. All valid ROI rectangles fit > + inside the ROI bounds rectangle. > + - Yes > + - No > + * - ``V4L2_SEL_TGT_ROI`` > + - 0x0203 > + - Sets the new Region of Interest rectangle. > + - Yes > + - No As mentioned before I think we should not have TGT_ROI_CURRENT and TGT_ROI > diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h > index 7d21c1634b4d..d0c108fba638 100644 > --- a/include/uapi/linux/v4l2-common.h > +++ b/include/uapi/linux/v4l2-common.h > @@ -78,6 +78,14 @@ > #define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 > /* Current composing area plus all padding pixels */ > #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 > +/* Current Region of Interest area */ > +#define V4L2_SEL_TGT_ROI_CURRENT 0x0200 > +/* Default Region of Interest area */ > +#define V4L2_SEL_TGT_ROI_DEFAULT 0x0201 > +/* Region of Interest bounds */ > +#define V4L2_SEL_TGT_ROI_BOUNDS 0x0202 > +/* Set Region of Interest area */ > +#define V4L2_SEL_TGT_ROI 0x0203 Nit: Maybe it could be a good idea to split doc and code. This way the backports/fixes are easier. > > /* Selection flags */ > #define V4L2_SEL_FLAG_GE (1 << 0) > -- > 2.30.0 > -- Ricardo Ribalda