Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp740799pxf; Wed, 24 Mar 2021 15:01:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz889VBVJDJwKnglMGPmCimcz2QxijxLcVkAsev2K4Eak5D6xzQInZeImceSoCGuB8LnZwE X-Received: by 2002:aa7:da14:: with SMTP id r20mr5631215eds.181.1616623271148; Wed, 24 Mar 2021 15:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616623271; cv=none; d=google.com; s=arc-20160816; b=JhRcXnt+NkrMExUlxabc6XmZSKA6fx3wEfhVFDRCoS2QpSFmxwmeDkjqYbTz2pHYC1 W231wcM6I4kdipuqie2wiK2mdALypYJx81ZcWoc+oLcAggGI5KO3vPBxL+oOqvWdpOLX rNlk/pYY08/y0kD+MkAjKrOG4V8ckht3Lj96syB+pHXMXkKo5WpMVBtVF145Ypy59WVO IuZ/4i0Cqc6aoCjkYQqN9ybvG+MnY89gKUSc43tX2Ce2/Mj717AB53SmcWBhZVmDaN4n vZIGRo13uuEoIxOegzP4yQUcXDyOjwxxm7XPi8NVg+mOjHPWT3ejxYK1VgaL3TpBL+GW eYgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q38Iz9nD2bCIrCpcl0zHhO9fOMzo7G/bLx3hekBFuE0=; b=tFzD/+7LNkyUv8nGiHP68qI73MG3BYlJYh+ln4AaJnfLwMPmETca7EHFVCA9XAM3lU M5NE8OJz+6ylE3Y73j7wMXf1dfYXc8Iw9aLuJj6E4i+TNu8TKVOhQcCdyJd/5kjyXjHN LQgrAcznChHlDnDe7b2c2iY7r88RN335vL7ywYZCKK24ZS7HnCKe1aXf8ErsoRWMim1M GTNUvEtyIJ5HKaYSOEmvus1U93LO0EWPGyaTMYFGF+S1XB1BooEMho8TKIFciFxSJSV6 dBRc2scaid3pJHjHd95gkSz2XzIVIRc3STqeikM4L/hz8FmFUNz6XkLufaAuitHcD/j/ nFNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZGhjdMBw; 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 m13si2561438edc.258.2021.03.24.15.00.47; Wed, 24 Mar 2021 15:01:11 -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=ZGhjdMBw; 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 S234951AbhCXCxG (ORCPT + 99 others); Tue, 23 Mar 2021 22:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231876AbhCXCwj (ORCPT ); Tue, 23 Mar 2021 22:52:39 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2B5BC061763 for ; Tue, 23 Mar 2021 19:52:39 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id v23so7150146ple.9 for ; Tue, 23 Mar 2021 19:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Q38Iz9nD2bCIrCpcl0zHhO9fOMzo7G/bLx3hekBFuE0=; b=ZGhjdMBw/RUDU67zkYUaHgPaNMXQntRmqXEhlFGhJIlwLHt+daBea026teMvWJ/mXn re/voxwWR3VAdXvCzIG+8Fyi0lPnJWr1mBrCCHfq4J8kNxfO0/FKuX86UMYnXJe8N30h usRlzMQP0CWWKZmeuJBbORhYWblGnHXq0ye3U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Q38Iz9nD2bCIrCpcl0zHhO9fOMzo7G/bLx3hekBFuE0=; b=PcEdfmcxnqno3clIL0N70VSHUnyrsQUruNPNQavCyp3CmYVXUcEe9ys7hurKG/lMwI ec7b9/RsqbxVEm70177PYQlyK3VJg50sMfSryYD1oN2p7j80qOYEWdVP4Q6ecYMDhLQD fvFP8ThhkKgWGFDOJnaNlakyiHOLe9HPE4SnNaXk5YeopL2LU6WG9AMUxtRIEYMJnfNo YxirfFBu2MDRnKrAhQXbBgmy3VWxTG6bBj8rlt2tt3IFZNQCeJL03RMlIiypSzei4Dyg l1ugKVctCk+ZVnYKh1UcYdvfY4x7A6Qdg0dSMCJb+Pw/Z2x7rOjccjfF2INV9SRGyXiz yfnw== X-Gm-Message-State: AOAM530tuh7UTUXEwIT/4oy/Q6PsokghGVaHGXkvBVFVk6BfhWTIjS4W 5VqdMltShgfVkI7aVvKpsA94CQ== X-Received: by 2002:a17:90a:ec15:: with SMTP id l21mr1092181pjy.164.1616554359115; Tue, 23 Mar 2021 19:52:39 -0700 (PDT) Received: from google.com ([2409:10:2e40:5100:bcf2:e05a:a993:9494]) by smtp.gmail.com with ESMTPSA id c24sm478696pjv.18.2021.03.23.19.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 19:52:38 -0700 (PDT) Date: Wed, 24 Mar 2021 11:52:33 +0900 From: Sergey Senozhatsky To: Tomasz Figa Cc: Sergey Senozhatsky , Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Linux Media Mailing List , Linux Kernel Mailing List Subject: Re: [PATCHv3 5/6] media: uvcvideo: add UVC 1.5 ROI control Message-ID: References: <20210319055342.127308-1-senozhatsky@chromium.org> <20210319055342.127308-6-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.