[{"id":22724,"web_url":"https://patchwork.libcamera.org/comment/22724/","msgid":"<CAOgh=Fy8tBnpU9Guh1RCZEo=xi+LGLP6-JmfscUyTyk-+0iuWQ@mail.gmail.com>","date":"2022-04-15T11:18:44","subject":"Re: [libcamera-devel] [PATCH v3] cam: kms_sink: Remove limitation\n\tthat camera and display must match","submitter":{"id":101,"url":"https://patchwork.libcamera.org/api/people/101/","name":"Eric Curtin","email":"ecurtin@redhat.com"},"content":"Another friendly reminder this adds value. The existing use cases are\nunchanged (when identical capture and display resolutions are\ndisplayed it uses that), but in the cases before in which we would\nhave failed, we attempt to draw from 0,0.\n\nIt's happens to me quite frequently that displays and cameras don't\nmatch pixel for pixel.\n\nIs mise le meas/Regards,\n\nEric Curtin\n\n\nOn Tue, 29 Mar 2022 at 14:02, Eric Curtin <ecurtin@redhat.com> wrote:\n>\n> There is a limitation that requires input and output to be pixel\n> for pixel identical in terms of height and width. Remove this\n> limitation to enable more hardware that doesn't match. Just start\n> drawing from top right 0, 0 corner.\n>\n> Signed-off-by: Eric Curtin <ecurtin@redhat.com>\n> ---\n> Changes in v2:\n> - Tested and support drawing from negative pixel range\n>   kernel parameter (video=960x540@60) was useful here\n> Changes in v3:\n> - Much simplified version of the patch where we just attempt to\n>   draw from point 0, 0. Only in the case where we do not find a\n>   matching mode. Can expand to do centralization, scaling, etc.\n>   in further patches if needs be.\n> ---\n>  src/cam/kms_sink.cpp | 22 +++++++++++++---------\n>  1 file changed, 13 insertions(+), 9 deletions(-)\n>\n> diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp\n> index da579846..5847c4e1 100644\n> --- a/src/cam/kms_sink.cpp\n> +++ b/src/cam/kms_sink.cpp\n> @@ -119,17 +119,21 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config)\n>                                                       mode.vdisplay == cfg.size.height;\n>                                        });\n>         if (iter == modes.end()) {\n> -               std::cerr\n> -                       << \"No mode matching \" << cfg.size.toString()\n> -                       << std::endl;\n> -               return -EINVAL;\n> +                if (modes.empty()) {\n> +                       std::cerr << \"No modes\\n\";\n> +                       return -EINVAL;\n> +                }\n> +\n> +                mode_ = &modes[0];\n>         }\n> +        else {\n> +                mode_ = &*iter;\n> +        }\n>\n>         int ret = configurePipeline(cfg.pixelFormat);\n>         if (ret < 0)\n>                 return ret;\n>\n> -       mode_ = &*iter;\n>         size_ = cfg.size;\n>         stride_ = cfg.stride;\n>\n> @@ -297,12 +301,12 @@ bool KMSSink::processRequest(libcamera::Request *camRequest)\n>                 drmRequest->addProperty(plane_, \"CRTC_ID\", crtc_->id());\n>                 drmRequest->addProperty(plane_, \"SRC_X\", 0 << 16);\n>                 drmRequest->addProperty(plane_, \"SRC_Y\", 0 << 16);\n> -               drmRequest->addProperty(plane_, \"SRC_W\", mode_->hdisplay << 16);\n> -               drmRequest->addProperty(plane_, \"SRC_H\", mode_->vdisplay << 16);\n> +               drmRequest->addProperty(plane_, \"SRC_W\", size_.width << 16);\n> +               drmRequest->addProperty(plane_, \"SRC_H\", size_.height << 16);\n>                 drmRequest->addProperty(plane_, \"CRTC_X\", 0);\n>                 drmRequest->addProperty(plane_, \"CRTC_Y\", 0);\n> -               drmRequest->addProperty(plane_, \"CRTC_W\", mode_->hdisplay);\n> -               drmRequest->addProperty(plane_, \"CRTC_H\", mode_->vdisplay);\n> +               drmRequest->addProperty(plane_, \"CRTC_W\", size_.width);\n> +               drmRequest->addProperty(plane_, \"CRTC_H\", size_.height);\n>\n>                 flags |= DRM::AtomicRequest::FlagAllowModeset;\n>         }\n> --\n> 2.35.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 799CBC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Apr 2022 11:19:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BA2BC604B4;\n\tFri, 15 Apr 2022 13:19:07 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F02C260207\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Apr 2022 13:19:05 +0200 (CEST)","from mail-oo1-f70.google.com (mail-oo1-f70.google.com\n\t[209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\tus-mta-214-p6WK0n5sMOWEXAhYPBpFJQ-1; Fri, 15 Apr 2022 07:19:01 -0400","by mail-oo1-f70.google.com with SMTP id\n\th42-20020a4a942d000000b00321739192d0so4130973ooi.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Apr 2022 04:19:01 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650021547;\n\tbh=S81P1REMV/YK+8YXtgutTtF+Mkol0vmFw525uT0Uv5I=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=uxrS9MwkgEJYiSTsKZbK7EtmQF/hxrH1ZutZPaA4KM4SKqonKCj+H/s1Rb7La6DwZ\n\txrVFokmy3NrUMMdhFsYA6ppM9wUZZ3H56ZfzwSTi1rAXyMNB1S1cNJLcZjX9G3DMOd\n\tfHRBqERTo72MojdLfP2g0/qqYEJ1BGe4j12OavNE1iQTR/qpJgpLwqHR/h0c/SQBUe\n\tXaOpgL5VYxhzIsHStGNufjrEIb2bL/nvs5cZTE7aAvBsffnxeIwbEQ7CL+GS/PDtLv\n\ttN6WqX8r83EL2wkBa1JQUcsUUPR/uYME2Ep9ory2B8QZbTe0kV52GCvQ8hrxCfgKSA\n\tdkCveTdtuanzg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1650021544;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=8K5BnC+sVQeYwY1kuPitlVyREX3YMf96USScF0HXvqQ=;\n\tb=Wcjtz0BJaFQY+e3mf43G0Ny/lP306mPHv1DID/yFuSDxHUvYoXjxt5IhANZPSIsUqbly0p\n\t95bxUVV3MQH1L5DtiB6TuYBGXNkEzDVe92ctl34Mtvj+42qWwDNpDJoX7E1z2g3wllGzch\n\tUSEl6weHlre8ZMUJR51Bh43p/VsOezc="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"Wcjtz0BJ\"; \n\tdkim-atps=neutral","relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ecurtin@redhat.com"],"X-MC-Unique":"p6WK0n5sMOWEXAhYPBpFJQ-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=8K5BnC+sVQeYwY1kuPitlVyREX3YMf96USScF0HXvqQ=;\n\tb=MyUWd3pnSpdK46hHVbhzE6F5uqMVhkxPBG8sbDbbElgFAkQsn0XcEDVVDyYAFtioh7\n\tojHL+GGui+KES0wxCbbo0Czx8mpWKSi/T93bTr7SL4b5oUVAWg5eLsDwA7bOD4XYsd4O\n\taz+TPi9IKbMb3xJmgj26224rAkhFkyeQ8XlpGjXbimH03YZ6HVZYBQH+UOz+Kn+aS8PX\n\t8AtBAhlp9csVFA0BAjvuqDxFaTeyMBFuD+d6nRlyE9vj/klAGSWSlm7dxK041URlFcGU\n\tHWg/ye97YoLWsH4iq70aDOUrLbx8ro9+j4c21aohnAs9ohS9pZ/jWeXYT8O3j3SkDSgJ\n\tQmpg==","X-Gm-Message-State":"AOAM532BL6xTUUvqTWg+ke8blFGmvnatNwg8xlESiGB/3eEbQlmsZBcG\n\tD89w1fgoMIjVIsuJt59jI7P1+DgZL9ijedxkwVQ/SNd/vzCAbd57U3DXeaQLIM6L1KLBOYcJdga\n\t+mEcHIHxOhLyhzUeGsoJTutPN0s83TqQdv2LQ3UozI7LFPc5DtA==","X-Received":["by 2002:a05:6808:14c1:b0:2fa:72d6:5dfa with SMTP id\n\tf1-20020a05680814c100b002fa72d65dfamr1339056oiw.182.1650021540656; \n\tFri, 15 Apr 2022 04:19:00 -0700 (PDT)","by 2002:a05:6808:14c1:b0:2fa:72d6:5dfa with SMTP id\n\tf1-20020a05680814c100b002fa72d65dfamr1339049oiw.182.1650021540417;\n\tFri, 15 Apr 2022 04:19:00 -0700 (PDT)"],"X-Google-Smtp-Source":"ABdhPJz47yHxSXfNB4rf78bS2Cv/SUIj5L+6obwv0oovpVi6To88X80Vz+oZEVGijbStKyB+pg04kB2/yhtf5OQtdTk=","MIME-Version":"1.0","References":"<20220329130221.31972-1-ecurtin@redhat.com>","In-Reply-To":"<20220329130221.31972-1-ecurtin@redhat.com>","Date":"Fri, 15 Apr 2022 12:18:44 +0100","Message-ID":"<CAOgh=Fy8tBnpU9Guh1RCZEo=xi+LGLP6-JmfscUyTyk-+0iuWQ@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3] cam: kms_sink: Remove limitation\n\tthat camera and display must match","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Eric Curtin via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Eric Curtin <ecurtin@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22727,"web_url":"https://patchwork.libcamera.org/comment/22727/","msgid":"<YlmbaXllcAK0eatG@pendragon.ideasonboard.com>","date":"2022-04-15T16:20:57","subject":"Re: [libcamera-devel] [PATCH v3] cam: kms_sink: Remove limitation\n\tthat camera and display must match","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Eric,\n\nThank you for the patch.\n\nOn Tue, Mar 29, 2022 at 02:02:21PM +0100, Eric Curtin via libcamera-devel wrote:\n> There is a limitation that requires input and output to be pixel\n> for pixel identical in terms of height and width. Remove this\n> limitation to enable more hardware that doesn't match. Just start\n> drawing from top right 0, 0 corner.\n\nIsn't that the top-left corner ?\n\n> Signed-off-by: Eric Curtin <ecurtin@redhat.com>\n> ---\n> Changes in v2:\n> - Tested and support drawing from negative pixel range\n>   kernel parameter (video=960x540@60) was useful here\n> Changes in v3:\n> - Much simplified version of the patch where we just attempt to\n>   draw from point 0, 0. Only in the case where we do not find a\n>   matching mode. Can expand to do centralization, scaling, etc.\n>   in further patches if needs be.\n> ---\n>  src/cam/kms_sink.cpp | 22 +++++++++++++---------\n>  1 file changed, 13 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp\n> index da579846..5847c4e1 100644\n> --- a/src/cam/kms_sink.cpp\n> +++ b/src/cam/kms_sink.cpp\n> @@ -119,17 +119,21 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config)\n>  \t\t\t\t\t\t      mode.vdisplay == cfg.size.height;\n>  \t\t\t\t       });\n>  \tif (iter == modes.end()) {\n> -\t\tstd::cerr\n> -\t\t\t<< \"No mode matching \" << cfg.size.toString()\n> -\t\t\t<< std::endl;\n> -\t\treturn -EINVAL;\n> +                if (modes.empty()) {\n\nThere are spaces used for indentation.\n\n> +        \t\tstd::cerr << \"No modes\\n\";\n> +        \t\treturn -EINVAL;\n> +                }\n> +\n> +                mode_ = &modes[0];\n>  \t}\n> +        else {\n> +                mode_ = &*iter;\n> +        }\n>  \n>  \tint ret = configurePipeline(cfg.pixelFormat);\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>  \n> -\tmode_ = &*iter;\n>  \tsize_ = cfg.size;\n>  \tstride_ = cfg.stride;\n>  \n> @@ -297,12 +301,12 @@ bool KMSSink::processRequest(libcamera::Request *camRequest)\n>  \t\tdrmRequest->addProperty(plane_, \"CRTC_ID\", crtc_->id());\n>  \t\tdrmRequest->addProperty(plane_, \"SRC_X\", 0 << 16);\n>  \t\tdrmRequest->addProperty(plane_, \"SRC_Y\", 0 << 16);\n> -\t\tdrmRequest->addProperty(plane_, \"SRC_W\", mode_->hdisplay << 16);\n> -\t\tdrmRequest->addProperty(plane_, \"SRC_H\", mode_->vdisplay << 16);\n> +\t\tdrmRequest->addProperty(plane_, \"SRC_W\", size_.width << 16);\n> +\t\tdrmRequest->addProperty(plane_, \"SRC_H\", size_.height << 16);\n>  \t\tdrmRequest->addProperty(plane_, \"CRTC_X\", 0);\n>  \t\tdrmRequest->addProperty(plane_, \"CRTC_Y\", 0);\n> -\t\tdrmRequest->addProperty(plane_, \"CRTC_W\", mode_->hdisplay);\n> -\t\tdrmRequest->addProperty(plane_, \"CRTC_H\", mode_->vdisplay);\n> +\t\tdrmRequest->addProperty(plane_, \"CRTC_W\", size_.width);\n> +\t\tdrmRequest->addProperty(plane_, \"CRTC_H\", size_.height);\n\nNot all drivers will support this. That's fine, it's not a regression as\nthey wouldn't work anyway, but I'm annoyed that things will fail only\nwhen trying to display the first frame, and without a clear error\nmessage :-(\n\nIdeally we should try to probe the device to see what it supports (which\ncould include scaling) and then pick the best option in\nKMSSink::configure().\n\n>  \n>  \t\tflags |= DRM::AtomicRequest::FlagAllowModeset;\n>  \t}","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0AA1CC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Apr 2022 16:21:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 349DB604B4;\n\tFri, 15 Apr 2022 18:21:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C575F60207\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Apr 2022 18:21:08 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-64-137-nat.elisa-mobile.fi\n\t[85.76.64.137])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E096B482;\n\tFri, 15 Apr 2022 18:21:07 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650039670;\n\tbh=TMoYyQQG8lk9EeiZMgABrvdsGyFdGh29j4XNy+fn0Gw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=GSRcd+/XzBJ3D+qWdvFUS2ueMbTc/GAAa80DCsCYpVpk3tcWH4DcHnzeIKnTmHM0o\n\t+omE71MfiItf1aoaK8W62qi/r3MFVarT87OYrzacKwPlHHCO3G1B2BGy2T6s68P5Kg\n\tHiur3bDx+DMZYFNYM6jFDvQj5Re2dRi8YTvaYkumQuBF2kgFp/8u9rhQHUtOUpYIfw\n\tSUKqBTelvVLfhXJu1ZbRkJNwt/L7QDNjr1NteglcQS0AVwESF+2QCN2c/23P1OZ64H\n\tbvzEvepg09jmdwiDGe4gTQKTx4eO8v/8KETywF80zMdFeBhRVhKxgirXcndv98f2Uk\n\tn/lm2kwXL674g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1650039668;\n\tbh=TMoYyQQG8lk9EeiZMgABrvdsGyFdGh29j4XNy+fn0Gw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=L7ORrheYYPef7JW+xwawV+M/EbEmFoJigNqmtx0MoybIsCqgDdwl4Ytafjf7xkMdp\n\tgOE71LI5DfhCS24RzAPSdHAivNPzSOmy5x0Cak52cfpJ66gY09ZhpmYbhEgmZ0LUxb\n\tcT8NnAmBElHIfy1x3yxu8YcW3HV4twt+qWj1w1fY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"L7ORrheY\"; dkim-atps=neutral","Date":"Fri, 15 Apr 2022 19:20:57 +0300","To":"Eric Curtin <ecurtin@redhat.com>","Message-ID":"<YlmbaXllcAK0eatG@pendragon.ideasonboard.com>","References":"<20220329130221.31972-1-ecurtin@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220329130221.31972-1-ecurtin@redhat.com>","Subject":"Re: [libcamera-devel] [PATCH v3] cam: kms_sink: Remove limitation\n\tthat camera and display must match","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22739,"web_url":"https://patchwork.libcamera.org/comment/22739/","msgid":"<CAOgh=FyJ+QXobYJ_suSwmn6VAk_CMEz1nOhvhKjk=02UZ+GgPg@mail.gmail.com>","date":"2022-04-19T14:24:01","subject":"Re: [libcamera-devel] [PATCH v3] cam: kms_sink: Remove limitation\n\tthat camera and display must match","submitter":{"id":101,"url":"https://patchwork.libcamera.org/api/people/101/","name":"Eric Curtin","email":"ecurtin@redhat.com"},"content":"On Fri, 15 Apr 2022 at 17:21, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Eric,\n>\n> Thank you for the patch.\n>\n> On Tue, Mar 29, 2022 at 02:02:21PM +0100, Eric Curtin via libcamera-devel wrote:\n> > There is a limitation that requires input and output to be pixel\n> > for pixel identical in terms of height and width. Remove this\n> > limitation to enable more hardware that doesn't match. Just start\n> > drawing from top right 0, 0 corner.\n>\n> Isn't that the top-left corner ?\n\nYes sorry will change commit message.\n\n>\n> > Signed-off-by: Eric Curtin <ecurtin@redhat.com>\n> > ---\n> > Changes in v2:\n> > - Tested and support drawing from negative pixel range\n> >   kernel parameter (video=960x540@60) was useful here\n> > Changes in v3:\n> > - Much simplified version of the patch where we just attempt to\n> >   draw from point 0, 0. Only in the case where we do not find a\n> >   matching mode. Can expand to do centralization, scaling, etc.\n> >   in further patches if needs be.\n> > ---\n> >  src/cam/kms_sink.cpp | 22 +++++++++++++---------\n> >  1 file changed, 13 insertions(+), 9 deletions(-)\n> >\n> > diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp\n> > index da579846..5847c4e1 100644\n> > --- a/src/cam/kms_sink.cpp\n> > +++ b/src/cam/kms_sink.cpp\n> > @@ -119,17 +119,21 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config)\n> >                                                     mode.vdisplay == cfg.size.height;\n> >                                      });\n> >       if (iter == modes.end()) {\n> > -             std::cerr\n> > -                     << \"No mode matching \" << cfg.size.toString()\n> > -                     << std::endl;\n> > -             return -EINVAL;\n> > +                if (modes.empty()) {\n>\n> There are spaces used for indentation.\n\nWill change\n\n>\n> > +                     std::cerr << \"No modes\\n\";\n> > +                     return -EINVAL;\n> > +                }\n> > +\n> > +                mode_ = &modes[0];\n> >       }\n> > +        else {\n> > +                mode_ = &*iter;\n> > +        }\n> >\n> >       int ret = configurePipeline(cfg.pixelFormat);\n> >       if (ret < 0)\n> >               return ret;\n> >\n> > -     mode_ = &*iter;\n> >       size_ = cfg.size;\n> >       stride_ = cfg.stride;\n> >\n> > @@ -297,12 +301,12 @@ bool KMSSink::processRequest(libcamera::Request *camRequest)\n> >               drmRequest->addProperty(plane_, \"CRTC_ID\", crtc_->id());\n> >               drmRequest->addProperty(plane_, \"SRC_X\", 0 << 16);\n> >               drmRequest->addProperty(plane_, \"SRC_Y\", 0 << 16);\n> > -             drmRequest->addProperty(plane_, \"SRC_W\", mode_->hdisplay << 16);\n> > -             drmRequest->addProperty(plane_, \"SRC_H\", mode_->vdisplay << 16);\n> > +             drmRequest->addProperty(plane_, \"SRC_W\", size_.width << 16);\n> > +             drmRequest->addProperty(plane_, \"SRC_H\", size_.height << 16);\n> >               drmRequest->addProperty(plane_, \"CRTC_X\", 0);\n> >               drmRequest->addProperty(plane_, \"CRTC_Y\", 0);\n> > -             drmRequest->addProperty(plane_, \"CRTC_W\", mode_->hdisplay);\n> > -             drmRequest->addProperty(plane_, \"CRTC_H\", mode_->vdisplay);\n> > +             drmRequest->addProperty(plane_, \"CRTC_W\", size_.width);\n> > +             drmRequest->addProperty(plane_, \"CRTC_H\", size_.height);\n>\n> Not all drivers will support this. That's fine, it's not a regression as\n> they wouldn't work anyway, but I'm annoyed that things will fail only\n> when trying to display the first frame, and without a clear error\n> message :-(\n\nYeah I tried to focus on just making sure this isn't a regression,\nbecause for me, this helps me test this neat minimal KMS sink with no\ndependencies on things like SDL and/or Qt. If people want to extend\nafter this, with various probing etc., great! Actually SDL is probably\na good reference there if anyone wants to tackle that, they seem to\nhave it figured out.\n\n>\n> Ideally we should try to probe the device to see what it supports (which\n> could include scaling) and then pick the best option in\n> KMSSink::configure().\n\nCould I leave this to someone if they wanted to extend this? I was\ntrying to do the most minimal change to get this sink testable for\nnon-resolution identical devices. I need to see frames on the screen,\nthat's pretty much it, it's a testing tool for me.\n\nI have zero issue with people altering this in future if they want to\ndo more probing, etc.\n\n>\n> >\n> >               flags |= DRM::AtomicRequest::FlagAllowModeset;\n> >       }\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 30F68C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Apr 2022 14:24:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7CBB56563D;\n\tTue, 19 Apr 2022 16:24:30 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8317D6563C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Apr 2022 16:24:28 +0200 (CEST)","from mail-oa1-f69.google.com (mail-oa1-f69.google.com\n\t[209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\tus-mta-56-1M41SI0cNB-F8gU_hn6RTw-1; Tue, 19 Apr 2022 10:24:24 -0400","by mail-oa1-f69.google.com with SMTP id\n\t586e51a60fabf-e5f398321aso1463635fac.22\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Apr 2022 07:24:19 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650378270;\n\tbh=PkY0MT5oyCv+iwM9RgDd/Sxl9qPWt3e89YuTT3Ohv+k=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=ljd1C0GgkFrr47+OOGCaaP1khm/8ire8hLRRjVn2j6ItawAwyylp/Mz5QoSxS+bH3\n\t7rejAuGOpIaQRmW4BjQjGqUXdwXfnj0wmhxuhwltCf+YWS0DGAZhSC3WbEvwPmUkNR\n\tUaXTZc4eZW2/y/G1cBOa4+hlLnDCSmTQhW89hMqtJLVsNMGjWYnfZDxNx8mTQrwZkW\n\thgu4FCXSM6Hgs+VBVDzjaEqff11RjrEmpgS47kCv6czJQnMOQ7gQXLEohmbtkxrxQu\n\tLEABEz9i1gRFxr8v0IsLXOSozjLhO1x/uE4hP0INJ/sWLbhc2grHCgKMZNj+XeDWIl\n\t95htJacKb3Ijw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1650378267;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=FH0tzt4nkJfGt7IFhqv9jiy/6Q0GTpDPozjy+yEG9Dc=;\n\tb=i4HKZd0Fpchv2jJBxgMRPAIhY4PiLXdWv1CHH2nf1iF5WMlb8++vQku8C+h6tPkBA6PTe7\n\tt5mhqoJzN8Xt4rL2SNDSXpkTW2fXRYxy42DN+9f2e0yrrmMie1qTrTUde1cfAyjO6BiMbb\n\tk4oKo4nsN3AGlxihu98hMg7O7O5Ccjo="],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"i4HKZd0F\"; \n\tdkim-atps=neutral","relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ecurtin@redhat.com"],"X-MC-Unique":"1M41SI0cNB-F8gU_hn6RTw-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=FH0tzt4nkJfGt7IFhqv9jiy/6Q0GTpDPozjy+yEG9Dc=;\n\tb=mYAAY0dE3hfpXH0s9sP0c2BXA/2dWFyS0PF0zH524ou0SYyxXxrItZ0ys9se8Bot7Z\n\tRNQYQY2M4x6yKM9KgdkAzZDvjeUWMhwL0/8Pc879jGD1ViKqMUX52Z5CKOgkPJwFMnFN\n\t//6YMYanXVCJElrXV0wkjKjm7qqiTBlwcCch77StL2SRY5iBDf3cqUc6U0vMNI6yM1zw\n\tp96BBG1gE/7W0GhGdYRn4HYcPZeRH+0aXfib3ZOizqJgNsd1uS8tIyxyD0w+s5rdci1S\n\tt8xtrqSQ/pLqdyRRl9bWJtvXiKFLSwyz6JYzsOLFiOnQS2yRfRc/I0438od4sCjOGGkn\n\tyD4A==","X-Gm-Message-State":"AOAM532a05FdZHNxh+IET9WmXAiGG7lSFP7HMYVXDiXHJarimQ33Qszb\n\tLDQSiCvRRAWA6PDDiuX9BB0XTiBqA8boSlWp0Pfl1dki2QDaO7l3Bm7vBNGKZBU8OhY+a9kHLkg\n\tyBofrS30/1jIO7xGFOj2xeIT3pg9Bk4DTjsGaqS3UmdV2wIUgJg==","X-Received":["by 2002:a05:6808:30a5:b0:2da:4dd3:a02d with SMTP id\n\tbl37-20020a05680830a500b002da4dd3a02dmr9541869oib.251.1650378258185; \n\tTue, 19 Apr 2022 07:24:18 -0700 (PDT)","by 2002:a05:6808:30a5:b0:2da:4dd3:a02d with SMTP id\n\tbl37-20020a05680830a500b002da4dd3a02dmr9541858oib.251.1650378257793;\n\tTue, 19 Apr 2022 07:24:17 -0700 (PDT)"],"X-Google-Smtp-Source":"ABdhPJwg9Fq1O+/ddoDUaeAEA5UM3nrKSeRvxEOZgh2I9I5HeiY846bfN+uYsOvQp/gaWBX5Mst+XxRmPfW3i2YoH18=","MIME-Version":"1.0","References":"<20220329130221.31972-1-ecurtin@redhat.com>\n\t<YlmbaXllcAK0eatG@pendragon.ideasonboard.com>","In-Reply-To":"<YlmbaXllcAK0eatG@pendragon.ideasonboard.com>","Date":"Tue, 19 Apr 2022 15:24:01 +0100","Message-ID":"<CAOgh=FyJ+QXobYJ_suSwmn6VAk_CMEz1nOhvhKjk=02UZ+GgPg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3] cam: kms_sink: Remove limitation\n\tthat camera and display must match","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Eric Curtin via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Eric Curtin <ecurtin@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]