From patchwork Wed Oct 16 13:46:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 21643 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 09D57C32FA for ; Wed, 16 Oct 2024 13:46:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 69C0E65383; Wed, 16 Oct 2024 15:46:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BRHoowAy"; dkim-atps=neutral Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 029B76537E for ; Wed, 16 Oct 2024 15:46:46 +0200 (CEST) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20c70abba48so45517555ad.0 for ; Wed, 16 Oct 2024 06:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729086405; x=1729691205; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=p0G47O65SSLbRRBP/mR58lRpYG7Q1ot291VzY8fu42s=; b=BRHoowAyXcvWPRmFpWMjAgoEuVZ8IQZUqd+/ANYit3aV1pHJ5VcR7jiLLHFBmcG+o2 GzsB5L6AR0b+hDGhYblHDfz/9mizAkhsjG7ofyqWPX1ny/kZZ+H0keNX8YrO+zHizHHH 4/SrFp22uoxzVkUx/PH3cf3TUDznfazGjSwbY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729086405; x=1729691205; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=p0G47O65SSLbRRBP/mR58lRpYG7Q1ot291VzY8fu42s=; b=wNSOkRynGCm+YasZYIQwNLUkEWK9ugt830tm88cV2hgKeaqsk8tbXpyGTdSAE8g6kv /HBe/FJ4Do9CvzSEma8Z/8SAm/7emxdOP8MIS44WnwDqJhOI7tDeF9vmyycJo1SivGqK 6zY4R7mIsi2FNOLnAkZ2OzUT/kf/59O3Ra+COu+c9uCgMDCEqCygjvLbOqlIjYtLgQ4R 6oneAylNvB+qlu3Sn/KwU/mJlspiI7S/fukzkn1SakKkqB7esSNEhZN8eKMMsmSf81Xz GdDQ9npRi0FXQTwEvP64QF0gmiUtS68dzMg+fRv7IPpcTK9TOiqrlxw0A88HLrTpL2i9 iaxw== X-Gm-Message-State: AOJu0YyL3P6sNQ3c0gdpSyVQGD57R5F2m2jn1174iRTEwEp/0LdSqvBR xRiPZMD9f25cz8A/3NNoPjdcKvvyvzSpRzN/Gh12MKWoeiGt0wUJTk3jK0kGb28dUMLcN4nftmY = X-Google-Smtp-Source: AGHT+IEnF+bOIE+bPf7R4oQNR65PTDe1qeN78gkFamG61bE19ug022mB19Y94ujmc31nq7GIGOgEpQ== X-Received: by 2002:a17:902:f686:b0:20c:e4c3:27a3 with SMTP id d9443c01a7336-20ce4c32957mr134439105ad.43.1729086404977; Wed, 16 Oct 2024 06:46:44 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (199.211.81.34.bc.googleusercontent.com. [34.81.211.199]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20d1805b0basm28812385ad.256.2024.10.16.06.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 06:46:44 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Han-Lin Chen , Yudhistira Erlandinata , Harvey Yang Subject: [PATCH] libcamera: v4l2: Support changing poller thread for V4L2VideoDevice Date: Wed, 16 Oct 2024 13:46:33 +0000 Message-ID: <20241016134640.3648224-1-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog MIME-Version: 1.0 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" From: Han-Lin Chen Signed-off-by: Han-Lin Chen Co-developed-by: Yudhistira Erlandinata Signed-off-by: Yudhistira Erlandinata Co-developed-by: Harvey Yang Signed-off-by: Harvey Yang --- include/libcamera/internal/v4l2_videodevice.h | 2 ++ src/libcamera/v4l2_videodevice.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index f021c2a01..f8d017b01 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -232,6 +232,8 @@ public: V4L2PixelFormat toV4L2PixelFormat(const PixelFormat &pixelFormat) const; + void changePollerThread(Thread *thread); + protected: std::string logPrefix() const override; diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 14eba0561..fc6b88ec1 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -2120,6 +2120,19 @@ V4L2PixelFormat V4L2VideoDevice::toV4L2PixelFormat(const PixelFormat &pixelForma return {}; } +/** + * \brief Move the event notifier and timer to \a thread + * \param[in] thread The thread to poll on + */ +void V4L2VideoDevice::changePollerThread(Thread *thread) +{ + if (!isOpen()) + return; + + fdBufferNotifier_->moveToThread(thread); + watchdog_.moveToThread(thread); +} + /** * \class V4L2M2MDevice * \brief Memory-to-Memory video device