From patchwork Mon Jun 13 06:03:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16204 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 EDCF4BD161 for ; Mon, 13 Jun 2022 06:04:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8952765639; Mon, 13 Jun 2022 08:04:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655100243; bh=I1/n3GkDGO5FHN+zYKCrKE3Vnc46aAt+/rUZhkTu/so=; 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=zJqIeJfJqox1LGEOkBFlu70gwLu5iewZ6gOnOnhoaDn9R+oM/gGn9R15hudaAexoz 4nwtOnSS6hy7LdQpDP/mgzx1bi0M4tp+aKrXQoeNbNCqXkt/1rEpAvDbP41Gru1ySm mUnpywZ4jDgfZJkjpauqMlPQuUNHQax10q+BxoG8H9c4bDZQ+ofMrLkfYUQ7+hzbZ7 SZOM/yOVab1wezSQPA8vs2ugJbOaShYRfhrKBMJQNPv48KkvR5auDBQj9zJI7dtLg8 nYRMNGnPNaIXeeCPEvqy0FWm+7tQ35pgqBanvhZVhAGTnEGgNtOCUnAXOSTss1ht3W 4YfbPr+PhnYdQ== Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AE417600F0 for ; Mon, 13 Jun 2022 08:04:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="e8F4caBM"; dkim-atps=neutral Received: by mail-pf1-x430.google.com with SMTP id w21so4921199pfc.0 for ; Sun, 12 Jun 2022 23:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NnK+9RyOaqMX10qXFF7tBZgLxoOzFpkS6kLy2BPVVO4=; b=e8F4caBMf5c1EGh7cnYUXt85h9SnpPH4e2bFT5ae0RdB79MVI54tsgZNARdIa5ZZFe Jk/9Qg3F5R26RylXHNreuUmA6CcNLEaZ4gqoVD6/dEgPzlw/jZNFy68L31STjpT8P6uY XzZsIb0abEHDeDDeRteD7BvGMN1XMvGbzM00rZmIMMuQOtYEj9b4U20iMWaWwo8UkQE/ aXeA6zuT99XBW6lU+V5k+pcfr/z0Ny8jMKMpa7tCsRZsy+JkrJyWuhyF4rSAQbGQrmsH BF8oAdVr7VAeR5HKcbs6X/v2K27e+LEfEAYmeCISQeY/hsWlmlG+9HxIasMJKZ+lR6EM qxFg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=NnK+9RyOaqMX10qXFF7tBZgLxoOzFpkS6kLy2BPVVO4=; b=hq+hMbFEfoQqyLy18SnPfKJHvOsfC9u1ZzLdrEUkSq3TODNX/+3083MEWtsZFlQG5Z PxgjBFzlV9XhkDWESxpmMxZIEsezE/ZDvikRMbhFXf0ICutFag3uTxQvSBUsFy2Ogqao NNK2vveT3Y4+Y9HYUdyEE26o5Wu4/tcYOhv4MCtTMkeg3bUDXZH4+zNhAQJCs8NOS4PU BOrZAqDN7nDUD4p4aHEUp21D6A9jOJVGIolu/iMTKuc3nWP5GI30nAeXDb8z+E7DPR2g ZRZqgD6EgmaC4JWY5l4M4z958lMAgopES4fkH8noLT9IDa7+YuIzqgs00Mn6bqYz5ozA Rb/Q== X-Gm-Message-State: AOAM532D/DXgMCJbr2yXzEwu994ciTXl2F9ypMnnkhndIr1ooiG2an6o 1vSs/OEOoUhjSbwUkn2mW++FU/FRPD8= X-Google-Smtp-Source: ABdhPJw+XasmsP2H6rmpjndndFPR9THK9bP/bBaGRqT0nICL8ltMr0/7mHA5sz64sDiUB08huh7oaw== X-Received: by 2002:a05:6a00:338e:b0:51b:c452:4210 with SMTP id cm14-20020a056a00338e00b0051bc4524210mr57607177pfb.69.1655100240146; Sun, 12 Jun 2022 23:04:00 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d6be:8959:67fc:32d7:74a0]) by smtp.gmail.com with ESMTPSA id x14-20020a170902a38e00b00161478027f5sm4087908pla.150.2022.06.12.23.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 23:03:59 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 13 Jun 2022 11:33:43 +0530 Message-Id: <20220613060345.229191-2-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220613060345.229191-1-utkarsh02t@gmail.com> References: <20220613060345.229191-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] qcam: Queue requests only through MainWindow::queueRequest() 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: Utkarsh Tiwari via libcamera-devel From: Utkarsh Tiwari Reply-To: Utkarsh Tiwari Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Currently whenever we want to queue a request we use the camera directly Centralize all the queuing to a single function Signed-off-by: Utkarsh Tiwari --- src/qcam/main_window.cpp | 14 +++++++++----- src/qcam/main_window.h | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index dd0e51f5..5ac31d9a 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -119,14 +119,14 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) if (renderType == "qt") { ViewFinderQt *viewfinder = new ViewFinderQt(this); connect(viewfinder, &ViewFinderQt::renderComplete, - this, &MainWindow::queueRequest); + this, &MainWindow::refillRequest); viewfinder_ = viewfinder; setCentralWidget(viewfinder); #ifndef QT_NO_OPENGL } else if (renderType == "gles") { ViewFinderGL *viewfinder = new ViewFinderGL(this); connect(viewfinder, &ViewFinderGL::renderComplete, - this, &MainWindow::queueRequest); + this, &MainWindow::refillRequest); viewfinder_ = viewfinder; setCentralWidget(viewfinder); #endif @@ -521,7 +521,7 @@ int MainWindow::startCapture() /* Queue all requests. */ for (std::unique_ptr &request : requests_) { - ret = camera_->queueRequest(request.get()); + ret = queueRequest(request.get()); if (ret < 0) { qWarning() << "Can't queue request"; goto error_disconnect; @@ -755,7 +755,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) viewfinder_->render(buffer, mappedBuffers_[buffer].get()); } -void MainWindow::queueRequest(FrameBuffer *buffer) +void MainWindow::refillRequest(FrameBuffer *buffer) { Request *request; { @@ -784,6 +784,10 @@ void MainWindow::queueRequest(FrameBuffer *buffer) qWarning() << "No free buffer available for RAW capture"; } } + queueRequest(request); +} - camera_->queueRequest(request); +int MainWindow::queueRequest(Request *request) +{ + return camera_->queueRequest(request); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 3fbe872c..251b8335 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -66,7 +66,7 @@ private Q_SLOTS: void processRaw(libcamera::FrameBuffer *buffer, const libcamera::ControlList &metadata); - void queueRequest(libcamera::FrameBuffer *buffer); + void refillRequest(libcamera::FrameBuffer *buffer); private: int createToolbars(); @@ -80,6 +80,7 @@ private: void addCamera(std::shared_ptr camera); void removeCamera(std::shared_ptr camera); + int queueRequest(libcamera::Request* request); void requestComplete(libcamera::Request *request); void processCapture(); void processHotplug(HotplugEvent *e);