Patch Detail
Show a patch.
GET /api/1.1/patches/13449/?format=api
{ "id": 13449, "url": "https://patchwork.libcamera.org/api/1.1/patches/13449/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13449/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210823131221.1034059-7-hiroh@chromium.org>", "date": "2021-08-23T13:12:17", "name": "[libcamera-devel,RFC,v2,06/10] qcam: main_window: Use offset mapping FrameBuffer", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e70d33f785f910480ae8342bbbeb995ae7e1c568", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13449/mbox/", "series": [ { "id": 2386, "url": "https://patchwork.libcamera.org/api/1.1/series/2386/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2386", "date": "2021-08-23T13:12:11", "name": "Add offset to FrameBuffer::Plane", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2386/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13449/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13449/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 13496BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Aug 2021 13:12:47 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB6966891A;\n\tMon, 23 Aug 2021 15:12:46 +0200 (CEST)", "from mail-pf1-x433.google.com (mail-pf1-x433.google.com\n\t[IPv6:2607:f8b0:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A000568918\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Aug 2021 15:12:45 +0200 (CEST)", "by mail-pf1-x433.google.com with SMTP id y11so15319164pfl.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Aug 2021 06:12:45 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:184e:5d20:8fcb:dfcd])\n\tby smtp.gmail.com with ESMTPSA id\n\tj4sm18596891pgi.6.2021.08.23.06.12.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Aug 2021 06:12:43 -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=\"g7cclLPo\"; 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=D+2/XZSMz8xxue+lGeQLRASpDn2Szc61kzLG/Z4POt0=;\n\tb=g7cclLPomXzVGrExzEjHWx1TWn+SSW2Aq0BeN5atqtSsg0r2v53IDzOn9JAt4fFSrh\n\t9+WaU+Y509G98IV2RHZKtzsiXlH3wwUBoecxo3vAYIhH5xY9oVcOGbGell8GmliwJgac\n\taSNb+wzPbJY9ETxRT6NP7Jze/B59KKDacz6Hg=", "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=D+2/XZSMz8xxue+lGeQLRASpDn2Szc61kzLG/Z4POt0=;\n\tb=KZ8Vni+iq0syU9JgiRtCJNc11gzcb9bc4MkNtxdXyzxLCOQATGWYmHlg24eq8rKNL1\n\tu41rKp9q29EKaZgcXQI7c2EpcTa7uIHIAmbV9lmD+own9lplYTIiUsXY2xEPZ9jQh2Q+\n\tEXqXYfMG5GPrzrEs/SuuI2F/Cy2L0TKloCqBvrpIMovzANqSCRydcsv2QvflDwO+OBJR\n\tDx8UgFbY0oAflRxtafSLTa7CwWfY0WC+ccC8y7a3qba9naiVACdtr/4P22+ezw0xpO6b\n\tl1J2C23frKWXb8wnHiBDYQvM/gj/HDYE9ing3fmb76JyCzdJrJxg9AGqg6bpr3HBbc8S\n\tZTtA==", "X-Gm-Message-State": "AOAM530M9CY89ks6yXTATXUzuIAcTKhovwQsxqBZU+MwazXO4sobvddo\n\tlpZwkWg4FVV6a/g+oeB3GN8SF04f0SXwVg==", "X-Google-Smtp-Source": "ABdhPJzidXNiHBtPAz92qAvlFjUqwSUnNF05NP/tQcpLJmeWg6+pr45t+CurtCdzjZ2+0TV49k6EQg==", "X-Received": "by 2002:a63:4a18:: with SMTP id\n\tx24mr28136404pga.209.1629724363520; \n\tMon, 23 Aug 2021 06:12:43 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 23 Aug 2021 22:12:17 +0900", "Message-Id": "<20210823131221.1034059-7-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.33.0.rc2.250.ged5fa647cd-goog", "In-Reply-To": "<20210823131221.1034059-1-hiroh@chromium.org>", "References": "<20210823131221.1034059-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH v2 06/10] qcam: main_window: Use\n\toffset mapping 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/main_window.cpp | 16 +++++++++++-----\n src/qcam/main_window.h | 1 +\n 2 files changed, 12 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 39d034de..7fdec4a8 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,12 @@ 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,\n+\t\t\t\t\t\t plane.length };\n \n \t\t\t/* Store buffers on the free list. */\n \t\t\tfreeBuffers_[stream].enqueue(buffer.get());\n@@ -541,6 +545,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 +582,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 +679,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].data();\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 +759,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+\t// HACK HACK HACK viewfinder_->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..f35cce36 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 *, Span<uint8_t>> planeData_;\n \n \t/* Capture state, buffers queue and statistics */\n \tbool isCapturing_;\n", "prefixes": [ "libcamera-devel", "RFC", "v2", "06/10" ] }