From patchwork Mon Jun 26 21:17:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 18762 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 06BC8C3237 for ; Mon, 26 Jun 2023 21:17:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 754A0628BC; Mon, 26 Jun 2023 23:17:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1687814274; bh=hBisCnAt6484XqCTAbBRXAssOiOm/4Zrqm2iT09ki/g=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Azj93JZIH3408frQtiCAoeW/uE7bxHxkprIT1emL7iyB9Y/OOyPVcTKaYmGSC+In1 ot+gKJ3Pclx1MWWAQJ8X8O97ohAyvL/l0POIPKWxehCMtvn/b7QimIILT0TpPWJ2zY TRCRJ68ma8PO7/PNWxKYSgEpYtKo+Tjg56+yw9L7JRCSLpoHEBfWLwtWOO/ip9lBFH ioSSDqpumAm0vnRfrH4Ygad1BOhodZGlQKvmc0afHsDWPOPcaaVSE+boLencYT6a/L ppl2VP1ka3noNRpKM+EwtMGOZbCBV5DZIn97YmKeOMrAI3HF+qv9/v0yUpw/C/Y5nY 4AeJBrsfIp3rw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A9B80628BB for ; Mon, 26 Jun 2023 23:17:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nXqeufA9"; dkim-atps=neutral Received: from umang.jainideasonboard.com (85-160-54-103.reb.o2.cz [85.160.54.103]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5AC584AD; Mon, 26 Jun 2023 23:17:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1687814234; bh=hBisCnAt6484XqCTAbBRXAssOiOm/4Zrqm2iT09ki/g=; h=From:To:Cc:Subject:Date:From; b=nXqeufA9+7F10z0k41enl5sdwOry2AHr6bjDOhEYbj+GRe/fpG4Yl0RiUpi3JS7HS pcevg++fwFK7cpkhZBGC9xU+greudgE9e/OK7y0fxMXOCA3alQzCWRBdmPfvF1aV5Z H4R6OKfFIoNbyI33H6PDFj3UdGxv/p7fW0qId+Y8= To: libcamera-devel@lists.libcamera.org Date: Mon, 26 Jun 2023 23:17:47 +0200 Message-Id: <20230626211747.101412-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH] gstreamer: Drop libcamera_private dependency 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" Drop libcamera_private dependency entirely as to avoid libcamerasrc getting more dependent on it. In order to achieve that, one of the mutex locks in GstLibcameraSrcState needs to be replaced with GMutex. However doing so, this won't let us to use the clang's thread annotation macros in libcamera (which should be fine as libcamerasrc would move out of libcamera repo once matured). Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Nicolas Dufresne --- src/gstreamer/gstlibcamerasrc.cpp | 20 ++++++++------------ src/gstreamer/meson.build | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 11f15068..fda5610f 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -32,8 +32,6 @@ #include #include -#include - #include #include #include @@ -125,11 +123,9 @@ struct GstLibcameraSrcState { * be held while calling into other graph elements (e.g. when calling * gst_pad_query()). */ - Mutex lock_; - std::queue> queuedRequests_ - LIBCAMERA_TSA_GUARDED_BY(lock_); - std::queue> completedRequests_ - LIBCAMERA_TSA_GUARDED_BY(lock_); + GMutex lock_; + std::queue> queuedRequests_; + std::queue> completedRequests_; ControlList initControls_; guint group_id_; @@ -208,7 +204,7 @@ int GstLibcameraSrcState::queueRequest() cam_->queueRequest(wrap->request_.get()); { - MutexLocker locker(lock_); + GLibLocker locker(&lock_); queuedRequests_.push(std::move(wrap)); } @@ -224,7 +220,7 @@ GstLibcameraSrcState::requestCompleted(Request *request) std::unique_ptr wrap; { - MutexLocker locker(lock_); + GLibLocker locker(&lock_); wrap = std::move(queuedRequests_.front()); queuedRequests_.pop(); } @@ -251,7 +247,7 @@ GstLibcameraSrcState::requestCompleted(Request *request) } { - MutexLocker locker(lock_); + GLibLocker locker(&lock_); completedRequests_.push(std::move(wrap)); } @@ -265,7 +261,7 @@ int GstLibcameraSrcState::processRequest() int err = 0; { - MutexLocker locker(lock_); + GLibLocker locker(&lock_); if (!completedRequests_.empty()) { wrap = std::move(completedRequests_.front()); @@ -639,7 +635,7 @@ gst_libcamera_src_task_leave([[maybe_unused]] GstTask *task, state->cam_->stop(); { - MutexLocker locker(state->lock_); + GLibLocker locker(&state->lock_); state->completedRequests_ = {}; } diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build index eda246d7..77c79140 100644 --- a/src/gstreamer/meson.build +++ b/src/gstreamer/meson.build @@ -42,7 +42,7 @@ endif libcamera_gst = shared_library('gstlibcamera', libcamera_gst_sources, cpp_args : libcamera_gst_cpp_args, - dependencies : [libcamera_private, gstvideo_dep, gstallocator_dep], + dependencies : [libcamera_public, gstvideo_dep, gstallocator_dep], install: true, install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')), )