From patchwork Mon Feb 7 15:01:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Curtin X-Patchwork-Id: 15339 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 E56BCBDCBF for ; Mon, 7 Feb 2022 15:02:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 998D56105F; Mon, 7 Feb 2022 16:02:01 +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="H9otRWQH"; 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 9F95060E58 for ; Mon, 7 Feb 2022 16:01:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644246118; 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=srUK9hQeqGAK4NbQmvnHpEP72CHFXPrLkcdrFKRFfTU=; b=H9otRWQHRewln8hG4kyzA6cO5XXsd0cgUuWfs5+euw2CKq7Mch0AQm/Ws2SZPw1GlABVL1 tjeuoJ7Vfm4gl639qT31Sjqwuqj2ByZttdEzgaTqrblDHJMkF/EtnSexWD25HrG234vl9B U4pEgw+bD73eRbixsrYGV4SDZl00WW8= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-YhVKGFa9OhiN_t-a2kCgZQ-1; Mon, 07 Feb 2022 10:01:50 -0500 X-MC-Unique: YhVKGFa9OhiN_t-a2kCgZQ-1 Received: by mail-wr1-f71.google.com with SMTP id y10-20020adfc7ca000000b001e30ed3a496so1323671wrg.15 for ; Mon, 07 Feb 2022 07:01:50 -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=srUK9hQeqGAK4NbQmvnHpEP72CHFXPrLkcdrFKRFfTU=; b=guOdu/woQa+AYh+gKhaHw1AMrbWVS2sOaw858VA3YrwWN/UXYksPh4f1f7/Sil7Qib rrH5LKggDo1Mr/ZcUcTRmNlUulUKnaizQiOW3u41fitZukM2EY6Fv8oI/UzQ+qeWKSTy AQSWkC4czMZItmEcv13wfRl80OYPPyzYiJ4BMY5UMxaFWBSOQJ/3C9FqdFD4tz4gOEXO XaBfqEKCC1JQDsMZzYH/qBbS76ls33Vxq8J+gf2Ir1EWApA9QOPaDgpI1LjlSn5cqhyB PwduKqyrDZtGy0G67HHSC7lH5guarOOuxcVLu2nNBDsGbliEAp5oYIh8mxzxvE6W6eNQ L8aA== X-Gm-Message-State: AOAM532I6CwTwCms8omMEY53Soux9ZL0XZ5UqM9eWrqMsw/cut87auGc mjT1KTVqxoHid6Pj0J0v8CDkPmRrXvJ48ayLf1ug4vn2bwwfRfiVEnCumyEtwbTV0wpmWmCTmsv NbkBLo37xZQeI/MdDXzKD4bo6jYJqtJRb7psK8yCBgviwP7l3oVAs/Kw3qc6P1HaCVlR3ZCnBam CmBOCcd4mx X-Received: by 2002:a5d:64a9:: with SMTP id m9mr10069143wrp.661.1644246109204; Mon, 07 Feb 2022 07:01:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvueZhiCUNKSxEfKtg2ed+aHINaWyWBlQR8K48wfbrjjDSWWXUFnVH0/LvV6VsQ5tmtcsvoQ== X-Received: by 2002:a5d:64a9:: with SMTP id m9mr10069130wrp.661.1644246108999; Mon, 07 Feb 2022 07:01:48 -0800 (PST) Received: from p1.Home ([2001:8a0:6724:4500:a69c:e66f:828e:b340]) by smtp.gmail.com with ESMTPSA id f8sm12137173wry.12.2022.02.07.07.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 07:01:48 -0800 (PST) From: Eric Curtin To: libcamera-devel@lists.libcamera.org Date: Mon, 7 Feb 2022 15:01:36 +0000 Message-Id: <20220207150136.22584-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 v3] cam: kms-sink: 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 Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- Changes in v3: - Add "cam: kms_sink:" tag 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);