Patch Detail
Show a patch.
GET /api/patches/13364/?format=api
{ "id": 13364, "url": "https://patchwork.libcamera.org/api/patches/13364/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13364/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210816043138.957984-7-hiroh@chromium.org>", "date": "2021-08-16T04:31:34", "name": "[libcamera-devel,RFC,06/10] qcam: main_window: Use offset mapping FrameBuffer", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "773ba9d619675c8aa51f98feaeb9ab18c0509c60", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13364/mbox/", "series": [ { "id": 2359, "url": "https://patchwork.libcamera.org/api/series/2359/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2359", "date": "2021-08-16T04:31:28", "name": "Add offset to FrameBuffer::Plane", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2359/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13364/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13364/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1309FBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 04:31:59 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C10F9688A2;\n\tMon, 16 Aug 2021 06:31:58 +0200 (CEST)", "from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com\n\t[IPv6:2607:f8b0:4864:20::1029])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE37A688E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 06:31:56 +0200 (CEST)", "by mail-pj1-x1029.google.com with SMTP id\n\tcp15-20020a17090afb8fb029017891959dcbso30406266pjb.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Aug 2021 21:31:56 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:6f5f:1479:a6ab:4229])\n\tby smtp.gmail.com with ESMTPSA id\n\tu10sm2767417pgj.48.2021.08.15.21.31.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 15 Aug 2021 21:31:54 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"kTaa8Zct\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Pu6I4Bte51NOKNhfGBLmMoWxaLd3FC64fN/DTIH0QsA=;\n\tb=kTaa8ZctmPKR/W9VWIgHqvSDzOpALbYFkTgGGcMv39etthYUAHsHpjA1fpMj07NHt0\n\t1GA04kOyJv29IamgSz3X2ab9oa0YmzW3U12lV6mdQm8cQqQH60rUARbLsJs03n+RLPaJ\n\tjyT+t4/9CtrhENkNoF7oSUwpzUxJpqnk8FqCc=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=Pu6I4Bte51NOKNhfGBLmMoWxaLd3FC64fN/DTIH0QsA=;\n\tb=UQCMtNr05jIvwXESJRvHEbrnGqcWuAWxwCsJ7awSIgIZpkQBsNkbFif291FbaP3dg0\n\tGItd7X1ozVttICDO2008gkK6aM5fpZHd4Bwg8t1JwzBQZBHDBD0L+0Lxd8E2LSV/y2ZR\n\tZQ9KBQzBRAsv6dT6zDzcSzFPERkfmX9ri4+iiqIwmXe9NHjhoG47is8PTHEH9uAOaTnI\n\t6aIVtV3RzHCg9r5c5cvuQKdx1b2UTzkIk7stWw9bT88+Cz9nDjbwvt7ma97B/Adq3twp\n\tyb7nl1hMD/G2HRMXa/IQSHMfaGOjSeoIWm/zaKvPX0QDlDjUhPnJxi9QRis7jcb6uMJR\n\tRaBQ==", "X-Gm-Message-State": "AOAM5317DYOg3vuF7XxyCGN0ZTSL5vywjGnyarc0oJN9lB61cAVAYooJ\n\tYK/mt0Pmvm+m2S1t7WctZrYkiKz1SF/e9Q==", "X-Google-Smtp-Source": "ABdhPJz2C1OXnaPOqwCP9lJ9my4yYnhkAZxHIdtFeIWkoKHIbfePJC5r4FZzWU8FBSj4JIuuNDvQ3g==", "X-Received": "by 2002:a63:e74b:: with SMTP id\n\tj11mr5175990pgk.322.1629088315251; \n\tSun, 15 Aug 2021 21:31:55 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 16 Aug 2021 13:31:34 +0900", "Message-Id": "<20210816043138.957984-7-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.33.0.rc1.237.g0d66db33f3-goog", "In-Reply-To": "<20210816043138.957984-1-hiroh@chromium.org>", "References": "<20210816043138.957984-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH 06/10] qcam: main_window: Use offset\n\tmapping FrameBuffer", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "FrameBuffer::Plane has offset info now. This uses the offset\nin mapping FrameBuffer in MainWindow.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/qcam/main_window.cpp | 15 ++++++++++-----\n src/qcam/main_window.h | 1 +\n 2 files changed, 11 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 39d034de..f815d281 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -10,6 +10,7 @@\n #include <iomanip>\n #include <string>\n #include <sys/mman.h>\n+#include <unistd.h>\n \n #include <QComboBox>\n #include <QCoreApplication>\n@@ -472,9 +473,11 @@ int MainWindow::startCapture()\n \t\tfor (const std::unique_ptr<FrameBuffer> &buffer : allocator_->buffers(stream)) {\n \t\t\t/* Map memory buffers and cache the mappings. */\n \t\t\tconst FrameBuffer::Plane &plane = buffer->planes().front();\n-\t\t\tvoid *memory = mmap(NULL, plane.length, PROT_READ, MAP_SHARED,\n+\t\t\tsize_t length = lseek(plane.fd.fd(), 0, SEEK_END);\n+\t\t\tvoid *memory = mmap(NULL, length, PROT_READ, MAP_SHARED,\n \t\t\t\t\t plane.fd.fd(), 0);\n-\t\t\tmappedBuffers_[buffer.get()] = { memory, plane.length };\n+\t\t\tmappedBuffers_[buffer.get()] = { memory, length };\n+\t\t\tplaneData_[buffer.get()] = { static_cast<uint8_t *>(memory) + plane.offset, plane.length };\n \n \t\t\t/* Store buffers on the free list. */\n \t\t\tfreeBuffers_[stream].enqueue(buffer.get());\n@@ -541,6 +544,7 @@ error:\n \t\tmunmap(buffer.memory, buffer.size);\n \t}\n \tmappedBuffers_.clear();\n+\tplaneData_.clear();\n \n \tfreeBuffers_.clear();\n \n@@ -577,6 +581,7 @@ void MainWindow::stopCapture()\n \t\tmunmap(buffer.memory, buffer.size);\n \t}\n \tmappedBuffers_.clear();\n+\tplaneData_.clear();\n \n \trequests_.clear();\n \tfreeQueue_.clear();\n@@ -673,10 +678,10 @@ void MainWindow::processRaw(FrameBuffer *buffer,\n \t\t\t\t\t\t\t\"DNG Files (*.dng)\");\n \n \tif (!filename.isEmpty()) {\n-\t\tconst MappedBuffer &mapped = mappedBuffers_[buffer];\n+\t\tvoid *memory = planeData_[buffer].memory;\n \t\tDNGWriter::write(filename.toStdString().c_str(), camera_.get(),\n \t\t\t\t rawStream_->configuration(), metadata, buffer,\n-\t\t\t\t mapped.memory);\n+\t\t\t\t memory);\n \t}\n #endif\n \n@@ -753,7 +758,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer)\n \t\t<< \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n \n \t/* Render the frame on the viewfinder. */\n-\tviewfinder_->render(buffer, &mappedBuffers_[buffer]);\n+\tviewfinder_->render(buffer, &planeData_[buffer]);\n }\n \n void MainWindow::queueRequest(FrameBuffer *buffer)\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 85d56ce4..d7ea994c 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -107,6 +107,7 @@ private:\n \n \tstd::unique_ptr<CameraConfiguration> config_;\n \tstd::map<FrameBuffer *, MappedBuffer> mappedBuffers_;\n+\tstd::map<FrameBuffer *, MappedBuffer> planeData_;\n \n \t/* Capture state, buffers queue and statistics */\n \tbool isCapturing_;\n", "prefixes": [ "libcamera-devel", "RFC", "06/10" ] }