From patchwork Fri Feb 4 10:46:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 15325 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 EC2A0BDCBF for ; Fri, 4 Feb 2022 10:47:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 21394609F6; Fri, 4 Feb 2022 11:47:29 +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="dq0qShnK"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9541C609B5 for ; Fri, 4 Feb 2022 11:47:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643971646; 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=uc94Euv4wk8nRDSVEEprjNykxpD6FL0LwmTxxj3k63A=; b=dq0qShnKgYzjXT39RqZqL4W9aVJqg15t3QMw1tdfxvV9oU8C256tQ+9qymtmkjKE0mDSrK NYoL4seOoNYWx8XjGldtxnGIRBJz20A1IHDCwxqouL9tOG4NOjpLsxrblg0YRDW9DrQazj PSoZH6xx3b7QIroFYM10vD9q6n4/vME= 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-441-N7iG7x71MPqjBCYIS2kRxA-1; Fri, 04 Feb 2022 05:47:25 -0500 X-MC-Unique: N7iG7x71MPqjBCYIS2kRxA-1 Received: by mail-wm1-f72.google.com with SMTP id o3-20020a1c4d03000000b003539520b248so2222601wmh.3 for ; Fri, 04 Feb 2022 02:47:24 -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=uc94Euv4wk8nRDSVEEprjNykxpD6FL0LwmTxxj3k63A=; b=WBC6UoYkYs2u4r/5UWGn31Uy1Nffm+tAdXg84vJFmG7te1h0hUHB0iwxxlZu3HM5fG hcCgpJrtOAuAJ/EuMfhb7ehqHmKd/LHbGyU1g7GUn/KDTW32AAtiW0sYGLftl825JSqv pR7InBeESuX+eSL/j1TMSSVStad3xZL2E6bdn5ctrKHLMoYdoe9S7EtllZ0G/MAt4Chh cA4TUnoBNChSgjF97VXghJQ8EPl22qKlaE6+3uAhUM2S7yvrL1/VFUzkN49EKzXnBGET fc3zJJ6pPSStkWOvplhDX3onMIX/xBLa9HzqhDYJoLKW13s1RkZ05nY/kUMztk8AO8tW mYeg== X-Gm-Message-State: AOAM532BNlWAI+ZtlxtvCTmAWGsDfWaqcmHrnvV7864V9pWQNv+UWkbq ero0h/Mm325+WIRO98JNOnc1A+i6CxmnKPc5kxsjum125zF8e8E2Ov2WKZHHN7OCYMojyssMoxa KVVKHlD5kEcQKBtsHWaHa2fqbA7qnCfhLYK2VND2wxC8kRmdzrNpT0+jvnCd3jQFaGRtDj+tIGn GgV4Ux2zUW X-Received: by 2002:a05:6000:16c2:: with SMTP id h2mr1904794wrf.642.1643971643720; Fri, 04 Feb 2022 02:47:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzozmSdMBYCq1Kxcz3YfGgoLNMLve3DGK8wSSCrG124wB+6NxatAPzog7v73SuWS23JyBw+cg== X-Received: by 2002:a05:6000:16c2:: with SMTP id h2mr1904780wrf.642.1643971643514; Fri, 04 Feb 2022 02:47:23 -0800 (PST) Received: from p1.Home ([2001:8a0:6724:4500:1e3a:8e9c:379e:f6ba]) by smtp.gmail.com with ESMTPSA id n8sm10678656wmq.42.2022.02.04.02.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 02:47:23 -0800 (PST) From: Eric Curtin To: libcamera-devel@lists.libcamera.org Date: Fri, 4 Feb 2022 10:46:35 +0000 Message-Id: <20220204104635.21063-1-ecurtin@redhat.com> X-Mailer: git-send-email 2.34.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 v2] Once we have found a suitable pipeline to select, return 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" The break only breaks out of the innermost loop which is not the most optimal. It also breaks cam on my machines. Fixes: 1de0f90dd432 ("cam: kms_sink: Print display pipelineconfiguration") Signed-off-by: Eric Curtin --- Changes in v2: - Change function name to selectPipeline - Return int rather than pointer - Formatting - Mention in commit message that it fixes a bug on my machine also src/cam/kms_sink.cpp | 18 ++++++++++++------ src/cam/kms_sink.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp index d30fba78..973cd370 100644 --- a/src/cam/kms_sink.cpp +++ b/src/cam/kms_sink.cpp @@ -136,7 +136,7 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config) return 0; } -int KMSSink::configurePipeline(const libcamera::PixelFormat &format) +int KMSSink::selectPipeline(const libcamera::PixelFormat &format) { /* * If the requested format has an alpha channel, also consider the X @@ -174,25 +174,31 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format) crtc_ = crtc; plane_ = plane; format_ = format; - break; + return 0; } if (plane->supportsFormat(xFormat)) { crtc_ = crtc; plane_ = plane; format_ = xFormat; - break; + return 0; } } } } - if (!crtc_) { + return -EPIPE; +} + +int KMSSink::configurePipeline(const libcamera::PixelFormat &format) +{ + const int ret = selectPipeline(format); + if (ret) { std::cerr << "Unable to find display pipeline for format " << format.toString() << std::endl; - return -EPIPE; + return ret; } std::cout @@ -200,7 +206,7 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format) << ", connector " << connector_->name() << " (" << connector_->id() << ")" << std::endl; - return 0; + return ret; } int KMSSink::start() diff --git a/src/cam/kms_sink.h b/src/cam/kms_sink.h index 1e4290ad..4a0a872c 100644 --- a/src/cam/kms_sink.h +++ b/src/cam/kms_sink.h @@ -47,6 +47,7 @@ private: libcamera::Request *camRequest_; }; + int selectPipeline(const libcamera::PixelFormat &format); int configurePipeline(const libcamera::PixelFormat &format); void requestComplete(DRM::AtomicRequest *request);