Show a patch.

GET /api/patches/21880/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 21880,
    "url": "https://patchwork.libcamera.org/api/patches/21880/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21880/",
    "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": "<20241113055524.3099340-3-chenghaoyang@chromium.org>",
    "date": "2024-11-13T05:54:33",
    "name": "[v2,2/2] debayer_cpu: Replace syncing DMABUFs with DmaSyncer",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "963cdfd18a9c60d16745516e6d503e41f2306482",
    "submitter": {
        "id": 117,
        "url": "https://patchwork.libcamera.org/api/people/117/?format=api",
        "name": "Cheng-Hao Yang",
        "email": "chenghaoyang@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21880/mbox/",
    "series": [
        {
            "id": 4787,
            "url": "https://patchwork.libcamera.org/api/series/4787/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4787",
            "date": "2024-11-13T05:54:31",
            "name": "Add DmaSyncer",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4787/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21880/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21880/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 082C9BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Nov 2024 05:55:39 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9680165802;\n\tWed, 13 Nov 2024 06:55:37 +0100 (CET)",
            "from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com\n\t[IPv6:2607:f8b0:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0426B618BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Nov 2024 06:55:34 +0100 (CET)",
            "by mail-pf1-x42a.google.com with SMTP id\n\td2e1a72fcca58-71ec997ad06so5442149b3a.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Nov 2024 21:55:33 -0800 (PST)",
            "from chenghaoyang-low.c.googlers.com.com\n\t(27.247.221.35.bc.googleusercontent.com. [35.221.247.27])\n\tby smtp.gmail.com with ESMTPSA id\n\td2e1a72fcca58-7240785ffb6sm12382544b3a.40.2024.11.12.21.55.30\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 12 Nov 2024 21:55:31 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"fV/VCFMe\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1731477332; x=1732082132;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=2qpvh1MLmOWWFrvIQL8+ff1gmj7Ko2p8Cr0m99uxuGc=;\n\tb=fV/VCFMeMk3mBGnNUzSFn7CyzKa77KfkFzVnGUUV3XDAPPYy0e04PwLh6C2rO8Ef9H\n\tkQHPVzbcPo6hr7Al+ERP1zSmi/DBfm9e0xrzEWf6FaPL2rR08I6WDHcp5MU+gFsb6jVk\n\tlzT2VXp8mC7xOqLSm+wRYtcrbR3pH283MxjR8=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1731477332; x=1732082132;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=2qpvh1MLmOWWFrvIQL8+ff1gmj7Ko2p8Cr0m99uxuGc=;\n\tb=Dc5YBZCRcV1AP9us4JpS0pqBmKjSr6DWGezOOtAUMeEkAC/tiU/ZnwD3kRFQ2ditwi\n\tAHJAstb53VANBn3nFXCHaXCjR8nM1seggWrC6w76/KrLnjCTMtSXPJJlh1CqkTP8qNch\n\tdS+hX6XAfcj+YFUmyaXHR8poKKAJLcOZwl8uvx78VbDlO1+Cn+oa13r5QpsBw++M++ts\n\tHetooAQG66Sj1LmAMmCsfV2jD9wAEEUYcG8BB5WMYawprSfSewGd+TlSyvZQmS6gOauO\n\tiUb/5UQllVmuZjjVGHwiHyUAPWKuuV7kwicPENAL4+j/256zEF5cAVrvuqJ0w9b68mPr\n\tvtOQ==",
        "X-Gm-Message-State": "AOJu0Yy4WWYnfH7ycjEthLZeJVq//A3GgxpVmW9QXUj1M+wzGwsabuGN\n\t4PuizquPK90+/5LWXe2nol1kz/1/sajs8GE6ATpdynaS+vTCpp95FSNp7HlTPt9zzsCJqEGq+yk\n\t=",
        "X-Google-Smtp-Source": "AGHT+IGy2eOAjFMPyTCrRPufR/K2eLS0XB9xQo9aTBtSpCJebEKLsmUo+tV5eXsnx1R6XekutJUevQ==",
        "X-Received": "by 2002:a05:6a20:3945:b0:1db:d8df:8c4e with SMTP id\n\tadf61e73a8af0-1dc5f8ed384mr6664276637.12.1731477332237; \n\tTue, 12 Nov 2024 21:55:32 -0800 (PST)",
        "From": "Harvey Yang <chenghaoyang@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Harvey Yang <chenghaoyang@chromium.org>,\n\tMilan Zamazal <mzamazal@redhat.com>",
        "Subject": "[PATCH v2 2/2] debayer_cpu: Replace syncing DMABUFs with DmaSyncer",
        "Date": "Wed, 13 Nov 2024 05:54:33 +0000",
        "Message-ID": "<20241113055524.3099340-3-chenghaoyang@chromium.org>",
        "X-Mailer": "git-send-email 2.47.0.277.g8800431eea-goog",
        "In-Reply-To": "<20241113055524.3099340-1-chenghaoyang@chromium.org>",
        "References": "<20241113055524.3099340-1-chenghaoyang@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "As there's an existing helper class DmaSyncer that makes synchronizing\nDMABUFs more easily, this patch removes the self-defined function and\nreuse DmaSyncer.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/libcamera/software_isp/debayer_cpu.cpp | 29 ++++++----------------\n 1 file changed, 8 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\nindex cf5ecdf7a..852e14f20 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -20,6 +20,7 @@\n #include <libcamera/formats.h>\n \n #include \"libcamera/internal/bayer_format.h\"\n+#include \"libcamera/internal/dma_buf_allocator.h\"\n #include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/mapped_framebuffer.h\"\n \n@@ -722,23 +723,6 @@ void DebayerCpu::process4(const uint8_t *src, uint8_t *dst)\n \n namespace {\n \n-void syncBufferForCPU(FrameBuffer *buffer, uint64_t syncFlags)\n-{\n-\tfor (const FrameBuffer::Plane &plane : buffer->planes()) {\n-\t\tconst int fd = plane.fd.get();\n-\t\tstruct dma_buf_sync sync = { syncFlags };\n-\t\tint ret;\n-\n-\t\tret = ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync);\n-\t\tif (ret < 0) {\n-\t\t\tret = errno;\n-\t\t\tLOG(Debayer, Error)\n-\t\t\t\t<< \"Syncing buffer FD \" << fd << \" with flags \"\n-\t\t\t\t<< syncFlags << \" failed: \" << strerror(ret);\n-\t\t}\n-\t}\n-}\n-\n inline int64_t timeDiff(timespec &after, timespec &before)\n {\n \treturn (after.tv_sec - before.tv_sec) * 1000000000LL +\n@@ -756,8 +740,12 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \t\tclock_gettime(CLOCK_MONOTONIC_RAW, &frameStartTime);\n \t}\n \n-\tsyncBufferForCPU(input, DMA_BUF_SYNC_START | DMA_BUF_SYNC_READ);\n-\tsyncBufferForCPU(output, DMA_BUF_SYNC_START | DMA_BUF_SYNC_WRITE);\n+\tstd::vector<DmaSyncer> dmaSyncers;\n+\tfor (const FrameBuffer::Plane &plane : input->planes())\n+\t\tdmaSyncers.emplace_back(plane.fd.get(), DmaBufAllocator::SyncType::Read);\n+\n+\tfor (const FrameBuffer::Plane &plane : output->planes())\n+\t\tdmaSyncers.emplace_back(plane.fd.get(), DmaBufAllocator::SyncType::Write);\n \n \tgreen_ = params.green;\n \tred_ = swapRedBlueGains_ ? params.blue : params.red;\n@@ -786,8 +774,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \n \tmetadata.planes()[0].bytesused = out.planes()[0].size();\n \n-\tsyncBufferForCPU(output, DMA_BUF_SYNC_END | DMA_BUF_SYNC_WRITE);\n-\tsyncBufferForCPU(input, DMA_BUF_SYNC_END | DMA_BUF_SYNC_READ);\n+\tdmaSyncers.clear();\n \n \t/* Measure before emitting signals */\n \tif (measuredFrames_ < DebayerCpu::kLastFrameToMeasure &&\n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}