{"id":13362,"url":"https://patchwork.libcamera.org/api/1.1/patches/13362/?format=json","web_url":"https://patchwork.libcamera.org/patch/13362/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","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-5-hiroh@chromium.org>","date":"2021-08-16T04:31:32","name":"[libcamera-devel,RFC,04/10] cam: file_sink: Use offset in mapping FrameBuffer","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"3b6c0ec389e014f9999618ed876f2b6730fdda78","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13362/mbox/","series":[{"id":2359,"url":"https://patchwork.libcamera.org/api/1.1/series/2359/?format=json","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/13362/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13362/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 82D29BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 04:31:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4B838688C4;\n\tMon, 16 Aug 2021 06:31:56 +0200 (CEST)","from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 74AC56888C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 06:31:53 +0200 (CEST)","by mail-pl1-x629.google.com with SMTP id q2so19363503plr.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Aug 2021 21:31:53 -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.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 15 Aug 2021 21:31:51 -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=\"kFho54l7\"; 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=73f5QDjSVO9zhfCjdBruDhBrJUzuMAxKbVfRDfFAGRI=;\n\tb=kFho54l72yWrhKew1OD+0Z+4mRuQLh8R2xWj1e/yTH4AxvzYMKp0Wtete7ZgRNT7QI\n\tCMBV/XDux2r0KnofVii3NV1uqJGSbpgYNOfqyARaL0vgRgiXlbGevrZE4s/8Q0t0qx4h\n\tUykzEY2jf3gl+KLuY3UBfqYy2ZKVRtBy38mVk=","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=73f5QDjSVO9zhfCjdBruDhBrJUzuMAxKbVfRDfFAGRI=;\n\tb=mCPOPpxEDl2IsIdNdZGROUMTOZG6EaXcjt+fEmx1h1GrAwVzo+7yEAcctyy8R/1JDT\n\tU5oQZWm6T9FboJNSKGnsPeUbgj3FtuaaiPBZYJgfB+yycOWFJieOiKM2VInknqSuQh+A\n\thkk7mka0+1sM3kZ7AqIT8Bi2W7qi+0ntgOGeZgD5J4AK+GW3iTiWNQdPEjfX7wg3ewQe\n\t+scvkPJ994Hpnl1BnEeH2l2KX1/UyFB1gFbXw8BgUKS5U0S8uJpoYt3EmH60JjAqb8Jc\n\txAi3GcK1h+1TA6P575HST0zXOQIKrUTc6nvFtvHBgH0LEvgy4GpiM5Sh3PEk1UX2b/hR\n\tFJPg==","X-Gm-Message-State":"AOAM532NbYQaxQ9B5TOHSPx+fS0iRtxThTZv1x9ZGevZ+NtzCDzO0NAQ\n\t1MtBNti2dGa5rwjVLY3QhxdHcap//dxlXw==","X-Google-Smtp-Source":"ABdhPJwdDf18lvQ/3rVXL44IRX8OsSbO8Zq5bEzGFqjLDr6Thp+s0LVoMbzEy8XL4ZVKSlT0p7Z7qQ==","X-Received":"by 2002:a65:5a0d:: with SMTP id\n\ty13mr14047046pgs.22.1629088311783; \n\tSun, 15 Aug 2021 21:31:51 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 16 Aug 2021 13:31:32 +0900","Message-Id":"<20210816043138.957984-5-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 04/10] cam: file_sink: Use offset in\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":"This fixes the way of mapping FrameBuffer in FrameSink by\nusing offset.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/cam/file_sink.cpp | 5 ++++-\n src/cam/file_sink.h   | 1 +\n 2 files changed, 5 insertions(+), 1 deletion(-)","diff":"diff --git a/src/cam/file_sink.cpp b/src/cam/file_sink.cpp\nindex 2d30694a..92b2d53d 100644\n--- a/src/cam/file_sink.cpp\n+++ b/src/cam/file_sink.cpp\n@@ -51,12 +51,15 @@ int FileSink::configure(const libcamera::CameraConfiguration &config)\n \n void FileSink::mapBuffer(FrameBuffer *buffer)\n {\n+\t/* \\todo use MappedFrameBuffer. */\n \tfor (const FrameBuffer::Plane &plane : buffer->planes()) {\n \t\tvoid *memory = mmap(NULL, plane.length, PROT_READ, MAP_SHARED,\n \t\t\t\t    plane.fd.fd(), 0);\n \n \t\tmappedBuffers_[plane.fd.fd()] =\n \t\t\tstd::make_pair(memory, plane.length);\n+\t\tplaneData_[plane.fd.fd()] =\n+\t\t\tstatic_cast<unsigned int *>(memory) + plane.offset;\n \t}\n }\n \n@@ -102,7 +105,7 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer)\n \t\tconst FrameBuffer::Plane &plane = buffer->planes()[i];\n \t\tconst FrameMetadata::Plane &meta = buffer->metadata().planes[i];\n \n-\t\tvoid *data = mappedBuffers_[plane.fd.fd()].first;\n+\t\tvoid *data = planeData_[plane.fd.fd()];\n \t\tunsigned int length = std::min(meta.bytesused, plane.length);\n \n \t\tif (meta.bytesused > plane.length)\ndiff --git a/src/cam/file_sink.h b/src/cam/file_sink.h\nindex c3eb230a..d236d6d8 100644\n--- a/src/cam/file_sink.h\n+++ b/src/cam/file_sink.h\n@@ -33,6 +33,7 @@ private:\n \tstd::map<const libcamera::Stream *, std::string> streamNames_;\n \tstd::string pattern_;\n \tstd::map<int, std::pair<void *, unsigned int>> mappedBuffers_;\n+\tstd::map<int, void *> planeData_;\n };\n \n #endif /* __CAM_FILE_SINK_H__ */\n","prefixes":["libcamera-devel","RFC","04/10"]}