{"id":15326,"url":"https://patchwork.libcamera.org/api/patches/15326/?format=json","web_url":"https://patchwork.libcamera.org/patch/15326/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220204111254.22884-1-ecurtin@redhat.com>","date":"2022-02-04T11:12:54","name":"[libcamera-devel] Remove limitation that camera and display must match","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1a29ad3cead83861026c95acf3108b30e5130b55","submitter":{"id":101,"url":"https://patchwork.libcamera.org/api/people/101/?format=json","name":"Eric Curtin","email":"ecurtin@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15326/mbox/","series":[{"id":2915,"url":"https://patchwork.libcamera.org/api/series/2915/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2915","date":"2022-02-04T11:12:54","name":"[libcamera-devel] Remove limitation that camera and display must match","version":1,"mbox":"https://patchwork.libcamera.org/series/2915/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15326/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15326/checks/","tags":{},"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 9D168BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  4 Feb 2022 11:13:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F500609F3;\n\tFri,  4 Feb 2022 12:13:09 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 16CB86020C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Feb 2022 12:13:06 +0100 (CET)","from mail-wm1-f70.google.com (mail-wm1-f70.google.com\n\t[209.85.128.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-625-EjPoU4F-MminSVz70XDXDg-1; Fri, 04 Feb 2022 06:13:05 -0500","by mail-wm1-f70.google.com with SMTP id\n\tn7-20020a1c7207000000b0034ec3d8ce0aso2235939wmc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 04 Feb 2022 03:13:04 -0800 (PST)","from p1.Home ([2001:8a0:6724:4500:1e3a:8e9c:379e:f6ba])\n\tby smtp.gmail.com with ESMTPSA id\n\tf13sm1747113wri.44.2022.02.04.03.13.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 04 Feb 2022 03:13:02 -0800 (PST)"],"Authentication-Results":["lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"WEVZN71j\"; dkim-atps=neutral","relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ecurtin@redhat.com"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1643973185;\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\tcontent-transfer-encoding:content-transfer-encoding;\n\tbh=Rby2O3MQprBTZmRTZX6NzdWcuJPIQ1oJKVI9BXV82xg=;\n\tb=WEVZN71jrVVM/fa8sUv02UZ7v6VvxhLu/MMJziV4GZ5ppgEHrx6Ok7uLxM1lymxwbbAWbr\n\tTgyCYY9ZuSzGJPAc/MUYl/k0D8mXJehTNf3KSPghlstesdBRdTWQquDntUZg8sjy3A7qnG\n\tsfVWGsZCGFBHIeFDYt4k7MRJJMGnH6c=","X-MC-Unique":"EjPoU4F-MminSVz70XDXDg-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:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=Rby2O3MQprBTZmRTZX6NzdWcuJPIQ1oJKVI9BXV82xg=;\n\tb=a6aoc1DabilHlcw21TtVo8mKaIeX5ixyref3gx1G0yQ7o0ZHIy0NXQRaYv5OtVaK68\n\tr2xFc6zA+LUksZyflqowArbBnUvvVnlSbtUL8V6XwVYkRJjnkgi0Z+Tl2iB2G5BJ2hCb\n\tgkbJ8QKmmNWXRVtPI15jpmHhinYpg000qSef5DVaOX+2G31dTWM5w0OSEKHAj1/twREw\n\tk6zcZfbpIeRP2fd5vpT/cfYWML0/fBBUS7HpzsQO7rNGD1TaLr8gVCtNqqmEbVFnuq7e\n\tojs2F1zC94ws3F2wXMKB/hvHmupJ+yocnGnwsCFe4etRrnBDOYlXO/N8EQXlLHYLkYCU\n\tRW+Q==","X-Gm-Message-State":"AOAM530J9WGpvxd5lNBiezLuMqgPHvQ2X7caLw4qW86PyJYJEB2PAsX6\n\tIclukeTwTUOhqiVinmyekH7SA/0yfYJJPZldsiDK8U0YXi8qZLyHcxXRunoynRMzPjNUbsyqiH8\n\tJ01lIWglsOWCTyivEFHMioUQrP7+z6RmJDyd+/shTgDdGnbZVYec0dBifwG67Pe3nZ05We0aJ38\n\tjRbP5feWPO","X-Received":["by 2002:a5d:5846:: with SMTP id i6mr2044287wrf.4.1643973183621; \n\tFri, 04 Feb 2022 03:13:03 -0800 (PST)","by 2002:a5d:5846:: with SMTP id i6mr2044268wrf.4.1643973183365; \n\tFri, 04 Feb 2022 03:13:03 -0800 (PST)"],"X-Google-Smtp-Source":"ABdhPJz7mZODr7Zkk4ECnkXycpPZh0r5arLB9YjpuI6fu7WFALLpk8awRVmQvkmv6s8+XSeaRXc9zg==","From":"Eric Curtin <ecurtin@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  4 Feb 2022 11:12:54 +0000","Message-Id":"<20220204111254.22884-1-ecurtin@redhat.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain; charset=\"US-ASCII\"","Subject":"[libcamera-devel] [PATCH] Remove limitation that camera and display\n\tmust 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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"There is a limitation that requires input and output\nto be pixel for pixel identical in terms of height\nand width. Remove this limitation to enable more\nhardware that doesn't match. Centralize the image.\n\nSigned-off-by: Eric Curtin <ecurtin@redhat.com>\n---\n src/cam/kms_sink.cpp | 27 +++++++++------------------\n src/cam/kms_sink.h   |  2 ++\n 2 files changed, 11 insertions(+), 18 deletions(-)","diff":"diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp\nindex 973cd370..159b9355 100644\n--- a/src/cam/kms_sink.cpp\n+++ b/src/cam/kms_sink.cpp\n@@ -113,24 +113,15 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config)\n \tconst libcamera::StreamConfiguration &cfg = config.at(0);\n \n \tconst std::vector<DRM::Mode> &modes = connector_->modes();\n-\tconst auto iter = std::find_if(modes.begin(), modes.end(),\n-\t\t\t\t       [&](const DRM::Mode &mode) {\n-\t\t\t\t\t       return mode.hdisplay == cfg.size.width &&\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-\t}\n \n \tint ret = configurePipeline(cfg.pixelFormat);\n \tif (ret < 0)\n \t\treturn ret;\n \n-\tmode_ = &*iter;\n+\tmode_ = &modes[0];\n \tsize_ = cfg.size;\n+\tx_ = (mode_->hdisplay - size_.width) / 2;\n+\ty_ = (mode_->vdisplay - size_.height) / 2;\n \tstride_ = cfg.stride;\n \n \treturn 0;\n@@ -297,12 +288,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_, \"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_, \"SRC_W\", size_.width << 16);\n+\t\tdrmRequest->addProperty(plane_, \"SRC_H\", size_.height << 16);\n+\t\tdrmRequest->addProperty(plane_, \"CRTC_X\", x_);\n+\t\tdrmRequest->addProperty(plane_, \"CRTC_Y\", y_);\n+\t\tdrmRequest->addProperty(plane_, \"CRTC_W\", size_.width);\n+\t\tdrmRequest->addProperty(plane_, \"CRTC_H\", size_.height);\n \n \t\tflags |= DRM::AtomicRequest::FlagAllowModeset;\n \t}\ndiff --git a/src/cam/kms_sink.h b/src/cam/kms_sink.h\nindex 4a0a872c..1b08e887 100644\n--- a/src/cam/kms_sink.h\n+++ b/src/cam/kms_sink.h\n@@ -61,6 +61,8 @@ private:\n \tlibcamera::PixelFormat format_;\n \tlibcamera::Size size_;\n \tunsigned int stride_;\n+\tunsigned int x_;  // Where to start drawing camera output\n+\tunsigned int y_;  // Where to start drawing camera output\n \n \tstd::map<libcamera::FrameBuffer *, std::unique_ptr<DRM::FrameBuffer>> buffers_;\n \n","prefixes":["libcamera-devel"]}