From patchwork Wed Nov 2 13:56:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 17746 X-Patchwork-Delegate: umang.jain@ideasonboard.com 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 E7155C3285 for ; Wed, 2 Nov 2022 13:56:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 51B8463075; Wed, 2 Nov 2022 14:56:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1667397388; bh=5J5VroM+40BTYAyivO//Zbssg3S73q4p/fVwcAjZERY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=SlNIPIbW8lc/jOfMtMv4j1Yrt1vXB5E5XTxk2uSDmRQklYX2sx3DkbKkDp6gpLeGZ 01KYPAoVw9W/nrfFYf3+N9CfzySMWMyG2oedMvtbwnqeXmMR4eRoxtcex480RHAdDr H37NiklstmsWZLUl2kxpfV98ZOXwoY0ItB1v90aKxDteq/+Hw0SK8zxNW2UJ637eME v4JldW0e80/eFalh4jiddilD268qP+VM9PQnxpu2i3Sk4aHlGsJ9QP4826dGq735A/ +0VIXSE0kLbIz6VOn1yPIBPkDGc/e0Ij9EyKFY7lkFcGykb2Sz0w6aeE9OsSw5Y6nF dh36v2bAOD70Q== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 06E7F63075 for ; Wed, 2 Nov 2022 14:56:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="UJk5+QOc"; dkim-atps=neutral Received: from umang.jainideasonboard.com (unknown [103.251.226.107]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 488ED1226; Wed, 2 Nov 2022 14:56:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1667397386; bh=5J5VroM+40BTYAyivO//Zbssg3S73q4p/fVwcAjZERY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJk5+QOcoZuQSxaMwIH9s9a+wXGnkKAnqcja/q8A9+oBJHLf7uAewqQ3U4Wi5XnPM AOYIcGtr9eK1chD66le7XBkqtKGg0FeMzglGEkQ0eGGDPuZwous3mk+c4F81iXbICX eQD7ZJ1VX+WN8H/RbW30K38nL6dh3ySAdnUonvq8= To: libcamera-devel@lists.libcamera.org Date: Wed, 2 Nov 2022 19:26:13 +0530 Message-Id: <20221102135614.657444-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221102135614.657444-1-umang.jain@ideasonboard.com> References: <20221102135614.657444-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 1/2] gstreamer: Do not expose the caps before configuring the camera 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: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Rishikesh Donadkar Configure the camera before exposing the caps valid controls values (and bounds) are available. These control values might be of interest to be exposed on the capabilites, which otherwise, would not be available if the camera is configured after the update caps event. For instance, the FrameDurationLimits are computed by RPi's IPA in its configure(). Hence, we need to Camera::configure() to happen in order to know the FrameDurationLimits, that can be exposed in the caps. This ties into the framerate support for libcamerasrc which will happen in a follow-up commit. Signed-off-by: Rishikesh Donadkar Signed-off-by: Umang Jain Tested-by: Umang Jain Reviewed-by: Umang Jain --- src/gstreamer/gstlibcamerasrc.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 16d70fea..60032236 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -515,6 +515,16 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, goto done; } + ret = state->cam_->configure(state->config_.get()); + if (ret) { + GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS, + ("Failed to configure camera: %s", g_strerror(-ret)), + ("Camera::configure() failed with error code %i", ret)); + gst_task_stop(task); + flow_ret = GST_FLOW_NOT_NEGOTIATED; + goto done; + } + /* * Regardless if it has been modified, create clean caps and push the * caps event. Downstream will decide if the caps are acceptable. @@ -535,15 +545,6 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, gst_pad_push_event(srcpad, gst_event_new_segment(&segment)); } - ret = state->cam_->configure(state->config_.get()); - if (ret) { - GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS, - ("Failed to configure camera: %s", g_strerror(-ret)), - ("Camera::configure() failed with error code %i", ret)); - gst_task_stop(task); - return; - } - self->allocator = gst_libcamera_allocator_new(state->cam_, state->config_.get()); if (!self->allocator) { GST_ELEMENT_ERROR(self, RESOURCE, NO_SPACE_LEFT,