{"id":14985,"url":"https://patchwork.libcamera.org/api/1.1/patches/14985/?format=json","web_url":"https://patchwork.libcamera.org/patch/14985/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20211202102355.178664-1-ecurtin@redhat.com>","date":"2021-12-02T10:23:55","name":"[libcamera-devel] cam: kms_sink: Once you have found a valid crtc break out of loops","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d8e20febe92835fa12bcdafb7cc6e3354816b77d","submitter":{"id":101,"url":"https://patchwork.libcamera.org/api/1.1/people/101/?format=json","name":"Eric Curtin","email":"ecurtin@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14985/mbox/","series":[{"id":2801,"url":"https://patchwork.libcamera.org/api/1.1/series/2801/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2801","date":"2021-12-02T10:23:55","name":"[libcamera-devel] cam: kms_sink: Once you have found a valid crtc break out of loops","version":1,"mbox":"https://patchwork.libcamera.org/series/2801/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14985/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14985/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 523B8BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Dec 2021 10:26:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B08F160826;\n\tThu,  2 Dec 2021 11:26:05 +0100 (CET)","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 D94646059E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Dec 2021 11:26:03 +0100 (CET)","from mail-wm1-f72.google.com (mail-wm1-f72.google.com\n\t[209.85.128.72]) 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-312-bktdAfDLO6qaSvqcSWJIKA-1; Thu, 02 Dec 2021 05:26:01 -0500","by mail-wm1-f72.google.com with SMTP id\n\t138-20020a1c0090000000b00338bb803204so13768538wma.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 02 Dec 2021 02:26:01 -0800 (PST)","from curtine-ThinkPad-P1-Gen-3.Home\n\t(86-40-122-19-dynamic.agg7.rlc.lmk-mlw.eircom.net. [86.40.122.19])\n\tby smtp.gmail.com with ESMTPSA id\n\tr11sm2174292wrw.5.2021.12.02.02.25.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 02 Dec 2021 02:25:59 -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=\"jTjXUQt/\"; 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=1638440762;\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=XZOwqcIPfeDU7ICWE6sm+ma+IOGlpY6wRGKiGDl+mGQ=;\n\tb=jTjXUQt/mFokOlwT/h27VeQU9aCQXLoz8Q4iX2NpRvnNosvAgxEotRPbcB8jvZhQR7u3Q1\n\tVOt0DZHZtliNwtdtDT5AAudlBA1LIuv4xUmKm5GDAqhqlC8db8F/5CDcB/B9tQLY/dWdcs\n\t7PTmHd36fvOynvvMglxoWuWCteKtBbE=","X-MC-Unique":"bktdAfDLO6qaSvqcSWJIKA-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=XZOwqcIPfeDU7ICWE6sm+ma+IOGlpY6wRGKiGDl+mGQ=;\n\tb=PUWgGiHti8BlclFaBNfRyHUBABiFDYF8u5E3ONqFhhJm/P+Ycx/hWZOqwf+psxLtH5\n\taQNB1mblHoRiIqWuL1UC7Fy/zubZUI8U1KfDtOa1RS1FWEiMyQB5fdwDiXaRWwwrz//h\n\tpHdrCJj0ULjPGc/YwuD5P4Emt2Lg67owKK/hYAtnd3rdK/Gfq1px9FTOo54TNkD/lk1q\n\tRAFsu6dTJoZ+Bx5IzSv+tMHg2NLl7Mc77zIm6dygpiyKZ0yymd/TPvKQysojoF+XYIfT\n\tKGY5ktuOg6PRn7i0EZwlc35LCuMJNQ4h2kXV+3lcl10eoNaIZ2yz3zV6jfc9QNLKKSaQ\n\tdwLw==","X-Gm-Message-State":"AOAM531VS1mU1PaX0H7X4GtuCN4cq425+nJoVZANM+qmngwkeu9OcJCR\n\tKOVCt1hRJ7jMEHRfS/NFR6Yq0GSLcg0mTKSZ3nIgmeSaikzE24WqYMiE2iPR+XucU7fQLZWLrL3\n\taTBlNlo30o5sR1ymkQjMENV0gQvFNcYtizYueoXVgSuLRBA8lknJOvfCgueXlpV/xxFEwFlkDyw\n\tPlLTNkyYJr","X-Received":["by 2002:a5d:6151:: with SMTP id\n\ty17mr13651807wrt.275.1638440760492; \n\tThu, 02 Dec 2021 02:26:00 -0800 (PST)","by 2002:a5d:6151:: with SMTP id\n\ty17mr13651775wrt.275.1638440760229; \n\tThu, 02 Dec 2021 02:26:00 -0800 (PST)"],"X-Google-Smtp-Source":"ABdhPJwTh8lcwRX1Lpmyx4gQUN/JLtjbajPOTY1jnH9F3fdMCFftmU1atKsGhPg1SHuUXlvkS7inTw==","From":"Eric Curtin <ecurtin@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  2 Dec 2021 10:23:55 +0000","Message-Id":"<20211202102355.178664-1-ecurtin@redhat.com>","X-Mailer":"git-send-email 2.33.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] cam: kms_sink: Once you have found a\n\tvalid crtc break out of loops","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":"Once we have found a suitable plane and CRTC to auto-select, break out\nof all loops, not just the inner-most loop.\n\nFixes: 1de0f90dd432 (\"cam: kms_sink: Print display pipelineconfiguration\")\nSigned-off-by: Eric Curtin <ecurtin@redhat.com>\n---\n src/cam/kms_sink.cpp | 27 ++++++++++++++++-----------\n src/cam/kms_sink.h   |  1 +\n 2 files changed, 17 insertions(+), 11 deletions(-)","diff":"diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp\nindex d30fba78..44a0f07b 100644\n--- a/src/cam/kms_sink.cpp\n+++ b/src/cam/kms_sink.cpp\n@@ -136,12 +136,12 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config)\n \treturn 0;\n }\n \n-int KMSSink::configurePipeline(const libcamera::PixelFormat &format)\n+const DRM::Crtc *KMSSink::findCrtc(const libcamera::PixelFormat &format)\n {\n \t/*\n-\t * If the requested format has an alpha channel, also consider the X\n-\t * variant.\n-\t */\n+         * If the requested format has an alpha channel, also consider the X\n+         * variant.\n+         */\n \tlibcamera::PixelFormat xFormat;\n \n \tswitch (format) {\n@@ -160,10 +160,10 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format)\n \t}\n \n \t/*\n-\t * Find a CRTC and plane suitable for the request format and the\n-\t * connector at the end of the pipeline. Restrict the search to primary\n-\t * planes for now.\n-\t */\n+         * Find a CRTC and plane suitable for the request format and the\n+         * connector at the end of the pipeline. Restrict the search to primary\n+         * planes for now.\n+         */\n \tfor (const DRM::Encoder *encoder : connector_->encoders()) {\n \t\tfor (const DRM::Crtc *crtc : encoder->possibleCrtcs()) {\n \t\t\tfor (const DRM::Plane *plane : crtc->planes()) {\n@@ -174,20 +174,25 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format)\n \t\t\t\t\tcrtc_ = crtc;\n \t\t\t\t\tplane_ = plane;\n \t\t\t\t\tformat_ = format;\n-\t\t\t\t\tbreak;\n+\t\t\t\t\treturn crtc;\n \t\t\t\t}\n \n \t\t\t\tif (plane->supportsFormat(xFormat)) {\n \t\t\t\t\tcrtc_ = crtc;\n \t\t\t\t\tplane_ = plane;\n \t\t\t\t\tformat_ = xFormat;\n-\t\t\t\t\tbreak;\n+\t\t\t\t\treturn crtc;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t}\n \n-\tif (!crtc_) {\n+\treturn nullptr;\n+}\n+\n+int KMSSink::configurePipeline(const libcamera::PixelFormat &format)\n+{\n+\tif (!findCrtc(format)) {\n \t\tstd::cerr\n \t\t\t<< \"Unable to find display pipeline for format \"\n \t\t\t<< format.toString() << std::endl;\ndiff --git a/src/cam/kms_sink.h b/src/cam/kms_sink.h\nindex 1e4290ad..a8a29399 100644\n--- a/src/cam/kms_sink.h\n+++ b/src/cam/kms_sink.h\n@@ -47,6 +47,7 @@ private:\n \t\tlibcamera::Request *camRequest_;\n \t};\n \n+\tconst DRM::Crtc *findCrtc(const libcamera::PixelFormat &format);\n \tint configurePipeline(const libcamera::PixelFormat &format);\n \tvoid requestComplete(DRM::AtomicRequest *request);\n \n","prefixes":["libcamera-devel"]}