Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp742003pxf; Wed, 24 Mar 2021 15:02:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMx7r0a/voOr2/q2DsCfWsI/w5DJbetQS6xjc/pKF7L0GKtszk6f0g0wJhN0WHoBOm6/Oq X-Received: by 2002:a05:6402:518d:: with SMTP id q13mr5679962edd.313.1616623371242; Wed, 24 Mar 2021 15:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616623371; cv=none; d=google.com; s=arc-20160816; b=ZfU7SpeWQnJLZRAhgAvXIHUy77vqo4ma7shA++0K1T34dnIRSZWqhMOEzxmoRcW7jS fDmzXHw7xNmgYMRRbEnoZychn/SpE1XWJXH90ht07IyVgw32MTmcScx2A2B0GDFfrDOf eP2lIwUAKJ1w1o3BNugVjfgsREzM1CZ91Z3oMLoh9UYqMgVoKb7FCNUJ5ZVVbtOuH8Dg VHfQBAkNwOeTBwznQRaZsnd/4IqVZpRfD8THZoaGZ+NWfrZ1igvOxaiTSC5Aeyky6dQG +OnGK1no5P+ZxqcxC9lB9RhpinBwXeJ64apMNmbaVqL12FcpXDtAYggd3YC4G8vd9ly8 /ksA== 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=PBjcpQgIglZYIQCLYI/ABjzh4xZMbSaRaKT1WiivV+Y=; b=lg3TjEj4rWBXER4aYaLucZ8F8GhLXO6wyGpNtbyF9VnlIPK4hk3GTS7liJJg+BCvYb qgS7g3JnVASFtnfnSJddlOzOAAl+hDG/OXNmmTC9M5C6CPlnQiNZCGoGvs5ugLP0bi+v 8L7wg8TBfVlOxyIYvudK3e/NBDJmlIqmUtz9fg/yhRd8W6AcTrOsZDyRA4Qyw5VOcLDa nz0iOZ7YoIRmKsTIQeqvKLJXnAqBfTw5LHuo32ipthcO4IcaLbQNPF47cf1pJMilMg9I jqrX4AuBHYCIJhIu5y+tQN3/VF1YOTW+wxl7Y1dc1SGiOt08gMtKIxbNDGijviW1ZgSr dJJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P+Cj5trN; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk7si3027170ejb.461.2021.03.24.15.02.21; Wed, 24 Mar 2021 15:02:51 -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=@chromium.org header.s=google header.b=P+Cj5trN; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234973AbhCXDBg (ORCPT + 99 others); Tue, 23 Mar 2021 23:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234961AbhCXDBD (ORCPT ); Tue, 23 Mar 2021 23:01:03 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 623C6C061763 for ; Tue, 23 Mar 2021 20:01:02 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id l18so17714110edc.9 for ; Tue, 23 Mar 2021 20:01:02 -0700 (PDT) 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=PBjcpQgIglZYIQCLYI/ABjzh4xZMbSaRaKT1WiivV+Y=; b=P+Cj5trNRI+g0OmQ7t84I96iN9b9Xc6vphPi42LmTQYbZXpFuxaYlAE/p34MW97Ker GY+7qxE6jvn0R8H5lpa3DkiNdekJkuMU7n4hJ+Run6n8/EWdh1PxJVdfHdU0UNFWvlnf BvEUsJQ+8eDyNI+EEsY/6bDwocR274HobSDGU= 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=PBjcpQgIglZYIQCLYI/ABjzh4xZMbSaRaKT1WiivV+Y=; b=t+yOGS0peA8rz07lnnMQxgI3+z7YOVJsIkA1Xxyn6gXm+BvN0aPJlQjlMpqE11qg9i EHAMeer0iieQ/taluC/qHMUsxq+e4oXi1beBvDj2KPmtlr7UjepMryAbkNA8491DHepx 5BsY/1c4qW1U/npFdVtsbF+ThDkkbnxmi2cefvJn+kiU/hRhAI58WAqnRIq0PB5mt3aK OyWQC+uR0NEEHEunfzxXAU22O/1KftAPZbDtTa4hDzDOq9QobnPaAvzBOSeZoajgVHY9 yxssX8OdOkYqu1R7H1/9utm+urCtNvnP7phGPHLnRK/J+Htj1kHoKJHfML5J5jxkwG8m n+8Q== X-Gm-Message-State: AOAM532aE8b1JQS1d5zn3t+mMvWGMGAwaABPo7myO+GqBCjmj7aYU8Wk qkM9F5LErIrXR24k59vp0wy+kO7nc1vW6A== X-Received: by 2002:aa7:cf95:: with SMTP id z21mr1027457edx.76.1616554860697; Tue, 23 Mar 2021 20:01:00 -0700 (PDT) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com. [209.85.128.43]) by smtp.gmail.com with ESMTPSA id ld19sm260132ejb.102.2021.03.23.20.00.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Mar 2021 20:01:00 -0700 (PDT) Received: by mail-wm1-f43.google.com with SMTP id g20so12097003wmk.3 for ; Tue, 23 Mar 2021 20:00:59 -0700 (PDT) X-Received: by 2002:a1c:c282:: with SMTP id s124mr710113wmf.99.1616554859441; Tue, 23 Mar 2021 20:00:59 -0700 (PDT) MIME-Version: 1.0 References: <20210319055342.127308-1-senozhatsky@chromium.org> <20210319055342.127308-6-senozhatsky@chromium.org> In-Reply-To: From: Tomasz Figa Date: Wed, 24 Mar 2021 12:00:48 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCHv3 5/6] media: uvcvideo: add UVC 1.5 ROI control To: Sergey Senozhatsky Cc: Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Linux Media Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 11:52 AM Sergey Senozhatsky wrote: > > On (21/03/24 11:34), Tomasz Figa wrote: > > On Wed, Mar 24, 2021 at 11:31 AM Sergey Senozhatsky > > wrote: > [..] > > > > Adjusting the rectangle to something supported by the hardware is > > > > mentioned explicitly in the V4L2 API documentation and is what drivers > > > > have to implement. Returning an error on invalid value is not a > > > > correct behavior here (and similarly for many other operations, e.g. > > > > S_FMT). > > > > > > Well, in this particular case we are talking about user-space that wants > > > to set ROI rectangle that is knowingly violates device's GET_MAX and > > > overflows UVC ROI rectangle u16 value range. That's a clear bug in user-space. > > > Do we want to pretend that user-space does the correct thing and fixup > > > stuff behind the scenes? > > > > > > > That's how the API is defined. There is a valid use case for this - > > you don't need to run QUERY_CTRL if all you need is setting the > > biggest possible rectangle, just set it to (0, 0), (INT_MAX, INT_MAX). > > I guess in our case we need to talk about rectangle,auto-controls tuple > that we send to firmware > > rect { > (0, 0), (INT_MAX, INT_MAX) > } > auto-controls { > INT_MAX > } > > For ROI user-space also must provide valid auto-controls value, which > normally requires GET_MIN/GET_MAX discovery. > > v4l2 selection API mentions only rectangle adjustments and errnos like > -ERANGE also mention "It is not possible to adjust struct v4l2_rect r > rectangle to satisfy all constraints given in the flags argument". > > So in case when auto-controls is out of supported range (out of > GET_MIN, GET_MAX range) there is no way for us to tell user-space that > auto-controls is wrong. We probably need silently pick up the first > supported value, but not sure how well this will work out in the end. Shouldn't the autocontrol selection be done via a separate bitmask control rather than some custom flags in the selection API? Best regards, Tomasz