From patchwork Thu Dec 2 10:23:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 14985 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 523B8BDB13 for ; Thu, 2 Dec 2021 10:26:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B08F160826; Thu, 2 Dec 2021 11:26:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="jTjXUQt/"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D94646059E for ; Thu, 2 Dec 2021 11:26:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638440762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XZOwqcIPfeDU7ICWE6sm+ma+IOGlpY6wRGKiGDl+mGQ=; b=jTjXUQt/mFokOlwT/h27VeQU9aCQXLoz8Q4iX2NpRvnNosvAgxEotRPbcB8jvZhQR7u3Q1 VOt0DZHZtliNwtdtDT5AAudlBA1LIuv4xUmKm5GDAqhqlC8db8F/5CDcB/B9tQLY/dWdcs 7PTmHd36fvOynvvMglxoWuWCteKtBbE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-bktdAfDLO6qaSvqcSWJIKA-1; Thu, 02 Dec 2021 05:26:01 -0500 X-MC-Unique: bktdAfDLO6qaSvqcSWJIKA-1 Received: by mail-wm1-f72.google.com with SMTP id 138-20020a1c0090000000b00338bb803204so13768538wma.1 for ; Thu, 02 Dec 2021 02:26:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XZOwqcIPfeDU7ICWE6sm+ma+IOGlpY6wRGKiGDl+mGQ=; b=PUWgGiHti8BlclFaBNfRyHUBABiFDYF8u5E3ONqFhhJm/P+Ycx/hWZOqwf+psxLtH5 aQNB1mblHoRiIqWuL1UC7Fy/zubZUI8U1KfDtOa1RS1FWEiMyQB5fdwDiXaRWwwrz//h pHdrCJj0ULjPGc/YwuD5P4Emt2Lg67owKK/hYAtnd3rdK/Gfq1px9FTOo54TNkD/lk1q RAFsu6dTJoZ+Bx5IzSv+tMHg2NLl7Mc77zIm6dygpiyKZ0yymd/TPvKQysojoF+XYIfT KGY5ktuOg6PRn7i0EZwlc35LCuMJNQ4h2kXV+3lcl10eoNaIZ2yz3zV6jfc9QNLKKSaQ dwLw== X-Gm-Message-State: AOAM531VS1mU1PaX0H7X4GtuCN4cq425+nJoVZANM+qmngwkeu9OcJCR KOVCt1hRJ7jMEHRfS/NFR6Yq0GSLcg0mTKSZ3nIgmeSaikzE24WqYMiE2iPR+XucU7fQLZWLrL3 aTBlNlo30o5sR1ymkQjMENV0gQvFNcYtizYueoXVgSuLRBA8lknJOvfCgueXlpV/xxFEwFlkDyw PlLTNkyYJr X-Received: by 2002:a5d:6151:: with SMTP id y17mr13651807wrt.275.1638440760492; Thu, 02 Dec 2021 02:26:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTh8lcwRX1Lpmyx4gQUN/JLtjbajPOTY1jnH9F3fdMCFftmU1atKsGhPg1SHuUXlvkS7inTw== X-Received: by 2002:a5d:6151:: with SMTP id y17mr13651775wrt.275.1638440760229; Thu, 02 Dec 2021 02:26:00 -0800 (PST) Received: from curtine-ThinkPad-P1-Gen-3.Home (86-40-122-19-dynamic.agg7.rlc.lmk-mlw.eircom.net. [86.40.122.19]) by smtp.gmail.com with ESMTPSA id r11sm2174292wrw.5.2021.12.02.02.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 02:25:59 -0800 (PST) From: Eric Curtin 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ecurtin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [PATCH] cam: kms_sink: Once you have found a valid crtc break out of loops X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Once we have found a suitable plane and CRTC to auto-select, break out of all loops, not just the inner-most loop. Fixes: 1de0f90dd432 ("cam: kms_sink: Print display pipelineconfiguration") Signed-off-by: Eric Curtin Reviewed-by: Kieran Bingham --- src/cam/kms_sink.cpp | 27 ++++++++++++++++----------- src/cam/kms_sink.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp index d30fba78..44a0f07b 100644 --- a/src/cam/kms_sink.cpp +++ b/src/cam/kms_sink.cpp @@ -136,12 +136,12 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config) return 0; } -int KMSSink::configurePipeline(const libcamera::PixelFormat &format) +const DRM::Crtc *KMSSink::findCrtc(const libcamera::PixelFormat &format) { /* - * If the requested format has an alpha channel, also consider the X - * variant. - */ + * If the requested format has an alpha channel, also consider the X + * variant. + */ libcamera::PixelFormat xFormat; switch (format) { @@ -160,10 +160,10 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format) } /* - * Find a CRTC and plane suitable for the request format and the - * connector at the end of the pipeline. Restrict the search to primary - * planes for now. - */ + * Find a CRTC and plane suitable for the request format and the + * connector at the end of the pipeline. Restrict the search to primary + * planes for now. + */ for (const DRM::Encoder *encoder : connector_->encoders()) { for (const DRM::Crtc *crtc : encoder->possibleCrtcs()) { for (const DRM::Plane *plane : crtc->planes()) { @@ -174,20 +174,25 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format) crtc_ = crtc; plane_ = plane; format_ = format; - break; + return crtc; } if (plane->supportsFormat(xFormat)) { crtc_ = crtc; plane_ = plane; format_ = xFormat; - break; + return crtc; } } } } - if (!crtc_) { + return nullptr; +} + +int KMSSink::configurePipeline(const libcamera::PixelFormat &format) +{ + if (!findCrtc(format)) { std::cerr << "Unable to find display pipeline for format " << format.toString() << std::endl; diff --git a/src/cam/kms_sink.h b/src/cam/kms_sink.h index 1e4290ad..a8a29399 100644 --- a/src/cam/kms_sink.h +++ b/src/cam/kms_sink.h @@ -47,6 +47,7 @@ private: libcamera::Request *camRequest_; }; + const DRM::Crtc *findCrtc(const libcamera::PixelFormat &format); int configurePipeline(const libcamera::PixelFormat &format); void requestComplete(DRM::AtomicRequest *request);