[{"id":35573,"web_url":"https://patchwork.libcamera.org/comment/35573/","msgid":"<85v7mal2je.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-08-26T11:56:21","subject":"Re: [PATCH v2 10/37] libcamera: software_isp: Move DMA Sync code to\n\tDebayer base class","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:\n\n> We can reuse the DMA Sync code in the GPUISP. Move the code we need to\n> the base class.\n>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>  src/libcamera/software_isp/debayer.cpp     | 13 +++++++++++++\n>  src/libcamera/software_isp/debayer.h       |  2 ++\n>  src/libcamera/software_isp/debayer_cpu.cpp |  6 +-----\n>  3 files changed, 16 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n> index fc2438c0d0161a36da2769d95836f282836b143d..75e4bffab0f082bdf6e5bdf3030b9f49d4877524 100644\n> --- a/src/libcamera/software_isp/debayer.cpp\n> +++ b/src/libcamera/software_isp/debayer.cpp\n> @@ -214,4 +214,17 @@ void Debayer::setParams(DebayerParams &params)\n>  \tgammaLut_ = params.gammaLut;\n>  }\n>  \n> +/**\n> + * \\fn void Debayer::dmaSyncBegin(DebayerParams &params)\n> + * \\brief Common CPU/GPU Dma Sync Buffer begin\n\nThe description could be probably improved.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> + */\n> +void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output)\n> +{\n> +\tfor (const FrameBuffer::Plane &plane : input->planes())\n> +\t\tdmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Read);\n> +\n> +\tfor (const FrameBuffer::Plane &plane : output->planes())\n> +\t\tdmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write);\n> +}\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\n> index 5f692bcbdeec1447c596ebbdc984585948a34880..0af66b556bbf8993a66042a3a76cd50582209bce 100644\n> --- a/src/libcamera/software_isp/debayer.h\n> +++ b/src/libcamera/software_isp/debayer.h\n> @@ -20,6 +20,7 @@\n>  #include <libcamera/geometry.h>\n>  #include <libcamera/stream.h>\n>  \n> +#include \"libcamera/internal/dma_buf_allocator.h\"\n>  #include \"libcamera/internal/software_isp/benchmark.h\"\n>  #include \"libcamera/internal/software_isp/debayer_params.h\"\n>  \n> @@ -85,6 +86,7 @@ private:\n>  \n>  protected:\n>  \tvoid setParams(DebayerParams &params);\n> +\tvoid dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output);\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\n> index 6ed17e9fc144bc7c3472d999b1e9c23236020963..9fce2a143ac9585eadcea41744d680bc9589c507 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.cpp\n> +++ b/src/libcamera/software_isp/debayer_cpu.cpp\n> @@ -22,7 +22,6 @@\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> @@ -740,11 +739,8 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n>  \tbench_.startFrame();\n>  \n>  \tstd::vector<DmaSyncer> dmaSyncers;\n> -\tfor (const FrameBuffer::Plane &plane : input->planes())\n> -\t\tdmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Read);\n>  \n> -\tfor (const FrameBuffer::Plane &plane : output->planes())\n> -\t\tdmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write);\n> +\tdmaSyncBegin(dmaSyncers, input, output);\n>  \n>  \tsetParams(params);","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 260BFBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Aug 2025 11:56:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 36589692D1;\n\tTue, 26 Aug 2025 13:56:29 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 22B17692D1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Aug 2025 13:56:27 +0200 (CEST)","from mail-qv1-f69.google.com (mail-qv1-f69.google.com\n\t[209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-680-MefAU0m8NxeZGuD-SiZtag-1; Tue, 26 Aug 2025 07:56:25 -0400","by mail-qv1-f69.google.com with SMTP id\n\t6a1803df08f44-70d903d04dbso106599886d6.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Aug 2025 04:56:24 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb ([85.93.96.130])\n\tby smtp.gmail.com with ESMTPSA id\n\t6a1803df08f44-70da7170bfesm64266826d6.23.2025.08.26.04.56.22\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Aug 2025 04:56:23 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"U2HryTJ9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1756209386;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=Z2x9Gu5GczyeXtQOepNXpEWSXoGhYEdUCcmgkd1cT/s=;\n\tb=U2HryTJ9QW2WZkZNyMm4q5zetjN77sturamrfKbWa8KEiJxaSuRGbj0R5goxGI30wPdIJl\n\tZQUkKVuvk9IYpjWSBV/c1pDtS7F5hnIQVHd84mnXyXjl5GtohStGKSyh/t1ogBoWV3+u52\n\tw5VfIHc0SlxRwh5xGng8uyry1xaXwSs=","X-MC-Unique":"MefAU0m8NxeZGuD-SiZtag-1","X-Mimecast-MFC-AGG-ID":"MefAU0m8NxeZGuD-SiZtag_1756209384","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1756209384; x=1756814184;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Z2x9Gu5GczyeXtQOepNXpEWSXoGhYEdUCcmgkd1cT/s=;\n\tb=ON0fC6XBHuLNOl4WFvu/Ox7f6LI6kG7HOWxfQTWR612f0dig/3qXa0xHaB5dC0/1zz\n\thI34bAr2sgCcrLmeJzzUU+BKahb2CSMtvyrIGUBbBtNb4E4hSD/ul/b32KrQP64C9r/i\n\tmIH2xxvCV75rBC5613YHhSSWNH56t+Rxk7YbsUB5E7toLC9IWS8YdkgASo2MGrmuTR2l\n\tfpZqiBgefppcK0kBjULKLw1hgdYtqUw3zGj8nbxRl+YRDfDZYdyUVHOaVK+IFC0vB1rA\n\toTH6mnOWh5bwbk4KurnKakh3359AdtzTNyNxo+jRyXq2u3ZVNRRfIF3ow4/3PKdo5w9T\n\t/yCA==","X-Gm-Message-State":"AOJu0YxGKItugR5GPmuqtWOaF22fjQQxl9h9GIEhAlAWy9srgpo8NunR\n\tAq/Fm3kXKxKopZDmXc3LinygJ9BQvp/Wd+AVASDbkfT2KyI1l9prY5Y0KAblsBo52npNMCBYusX\n\toFj3QGto6NoQvBWOK+xWa6qNIC70zxk22ej8OeNoML0BceA8AZoNZShfhfpSujddzZyWTfBXBH7\n\t5yxEqAxloKh6NtZEI6/Op+vogFxJ1wk8jHir5Q7Irr+cU2NejpKBS6IDg0IuI=","X-Gm-Gg":"ASbGncvoORCGQVWPKN40fl9vjea8hf3Vx7MGdqR71k00xs03XOtd6dKd1lNgAXvhshR\n\t3Cynws09hzHV/MOBkDvSwy1WFIdLFCy7eH2OyDN4i19NZOW8y0Fl4rvDhP9nvqrDbVrLYeob6OJ\n\tIbv5TiqtMfRiOj5XrXwOm7JPT0omdJbJcTTQP9RzlyRpPOfcCiXGSuLpxTWD+y+A9lXbhTNfhQx\n\tPacRjc28qDUBcxL7IkfBmbL/zj+RFP1nzsniTwNB5atFe4tgUAoccWYspAV8eebViWB4tPbE7ky\n\tDut2AEHRopEEZm1vAa4Rv03ucL2Ytnle5PsB1ElJueebn4zdi9DH0W2wrZHyEP4Y","X-Received":["by 2002:a05:6214:dcb:b0:70d:aea4:66c2 with SMTP id\n\t6a1803df08f44-70daea46c14mr139182036d6.45.1756209384219; \n\tTue, 26 Aug 2025 04:56:24 -0700 (PDT)","by 2002:a05:6214:dcb:b0:70d:aea4:66c2 with SMTP id\n\t6a1803df08f44-70daea46c14mr139181786d6.45.1756209383749; \n\tTue, 26 Aug 2025 04:56:23 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IFFyVGXdxvvwqrtilL56GixTs1ksiP1T11hva9KGOkc2wzli/gTtSQKKDM58y1e7OTnIqf1Ww==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 10/37] libcamera: software_isp: Move DMA Sync code to\n\tDebayer base class","In-Reply-To":"<20250824-b4-v0-5-2-gpuisp-v2-a-v2-10-96f4576c814e@linaro.org>\n\t(Bryan O'Donoghue's message of \"Sun, 24 Aug 2025 01:48:22 +0100\")","References":"<20250824-b4-v0-5-2-gpuisp-v2-a-v2-0-96f4576c814e@linaro.org>\n\t<20250824-b4-v0-5-2-gpuisp-v2-a-v2-10-96f4576c814e@linaro.org>","Date":"Tue, 26 Aug 2025 13:56:21 +0200","Message-ID":"<85v7mal2je.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"R5x6IH3hM4ux7Yxgp9aBRg6g7UnMjPBUTSh70vQP-Wo_1756209384","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]