[{"id":32123,"web_url":"https://patchwork.libcamera.org/comment/32123/","msgid":"<87ttccft7k.fsf@redhat.com>","date":"2024-11-12T13:59:59","subject":"Re: [PATCH 1/2] DmaBufAllocator: Add Dma Buffer synchronization\n\tfunction & helper class","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Harvey,\n\nthank you for the patch.\n\nHarvey Yang <chenghaoyang@chromium.org> writes:\n\n> To synchronize CPU access with mmap and hardware access on DMA buffers,\n> using `DMA_BUF_IOCTL_SYNC` is required. This patch adds a function and\n> a helper class to allow users to sync buffers more easily.\n>\n> Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>\n> ---\n>  .../libcamera/internal/dma_buf_allocator.h    | 33 +++++++\n>  src/libcamera/dma_buf_allocator.cpp           | 88 +++++++++++++++++++\n>  2 files changed, 121 insertions(+)\n>\n> diff --git a/include/libcamera/internal/dma_buf_allocator.h b/include/libcamera/internal/dma_buf_allocator.h\n> index d2a0a0d19..2b9b99678 100644\n> --- a/include/libcamera/internal/dma_buf_allocator.h\n> +++ b/include/libcamera/internal/dma_buf_allocator.h\n> @@ -23,6 +23,19 @@ public:\n>  \n>  \tusing DmaBufAllocatorFlags = Flags<DmaBufAllocatorFlag>;\n>  \n> +\tenum class SyncStep {\n> +\t\tStart = 0,\n> +\t\tEnd\n> +\t};\n> +\n> +\tenum class SyncType {\n> +\t\tRead = 0,\n> +\t\tWrite,\n> +\t\tReadWrite,\n> +\t};\n> +\n> +\tstatic void sync(int fd, SyncStep step, SyncType type);\n> +\n>  \tDmaBufAllocator(DmaBufAllocatorFlags flags = DmaBufAllocatorFlag::CmaHeap);\n>  \t~DmaBufAllocator();\n>  \tbool isValid() const { return providerHandle_.isValid(); }\n> @@ -35,6 +48,26 @@ private:\n>  \tDmaBufAllocatorFlag type_;\n>  };\n>  \n> +class DmaSyncer final\n> +{\n> +public:\n> +\texplicit DmaSyncer(int fd,\n> +\t\t\t   DmaBufAllocator::SyncType type = DmaBufAllocator::SyncType::ReadWrite)\n> +\t\t: fd_(fd), type_(type)\n> +\t{\n> +\t\tDmaBufAllocator::sync(fd_, DmaBufAllocator::SyncStep::Start, type_);\n> +\t}\n> +\n> +\t~DmaSyncer()\n> +\t{\n> +\t\tDmaBufAllocator::sync(fd_, DmaBufAllocator::SyncStep::End, type_);\n> +\t}\n> +\n> +private:\n> +\tint fd_;\n> +\tDmaBufAllocator::SyncType type_;\n> +};\n> +\n>  LIBCAMERA_FLAGS_ENABLE_OPERATORS(DmaBufAllocator::DmaBufAllocatorFlag)\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp\n> index be6efb89f..3ae98c168 100644\n> --- a/src/libcamera/dma_buf_allocator.cpp\n> +++ b/src/libcamera/dma_buf_allocator.cpp\n> @@ -78,6 +78,79 @@ LOG_DEFINE_CATEGORY(DmaBufAllocator)\n>   * \\brief A bitwise combination of DmaBufAllocator::DmaBufAllocatorFlag values\n>   */\n>  \n> +/**\n> + * \\enum DmaBufAllocator::SyncStep\n> + * \\brief Either start or end of the synchronization\n> + * \\var DmaBufAllocator::Start\n> + * \\brief Indicates the start of a map access session\n> + * \\var DmaBufAllocator::End\n> + * \\brief Indicates the end of a map access session\n> + */\n> +\n> +/**\n> + * \\enum DmaBufAllocator::SyncType\n> + * \\brief Read and/or write access via the CPU map\n> + * \\var DmaBufAllocator::Read\n> + * \\brief Indicates that the mapped dma-buf will be read by the client via the\n> + * CPU map\n> + * \\var DmaBufAllocator::Write\n> + * \\brief Indicates that the mapped dm-buf will be written by the client via the\n> + * CPU map\n> + * \\var DmaBufAllocator::ReadWrite\n> + * \\brief Indicates that the mapped dma-buf will be rad andd written by the\n\ns/rad andd/read and/\n\n> + * client via the CPU map\n> + */\n> +\n> +/**\n> + * \\brief Synchronize CPU access and hardware access\n> + * \\param[in] fd The dma-buf's file descriptor to be synchronized\n> + * \\param[in] step Either start or end of the synchronization\n> + * \\param[in] type Read and/or write access during CPU mmap\n> + *\n> + * The client is expected to call this function with\n> + * DmaBufAllocator::SyncStep::Start and DmaBufAllocator::SyncStep::End at the\n> + * start and end of buffer access respectively.\n> + */\n> +void DmaBufAllocator::sync(int fd, DmaBufAllocator::SyncStep step, DmaBufAllocator::SyncType type)\n> +{\n> +\tuint64_t flags = 0;\n> +\tswitch (step) {\n> +\tcase DmaBufAllocator::SyncStep::Start:\n> +\t\tflags = DMA_BUF_SYNC_START;\n> +\t\tbreak;\n> +\tcase DmaBufAllocator::SyncStep::End:\n> +\t\tflags = DMA_BUF_SYNC_END;\n> +\t\tbreak;\n> +\t}\n> +\n> +\tswitch (type) {\n> +\tcase DmaBufAllocator::SyncType::Read:\n> +\t\tflags = flags | DMA_BUF_SYNC_READ;\n> +\t\tbreak;\n> +\tcase DmaBufAllocator::SyncType::Write:\n> +\t\tflags = flags | DMA_BUF_SYNC_WRITE;\n> +\t\tbreak;\n> +\tcase DmaBufAllocator::SyncType::ReadWrite:\n> +\t\tflags = flags | DMA_BUF_SYNC_RW;\n> +\t\tbreak;\n> +\t}\n> +\n> +\tstruct dma_buf_sync sync = {\n> +\t\t.flags = flags\n> +\t};\n> +\n> +\tint ret;\n> +\tdo {\n> +\t\tret = ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync);\n> +\t} while (!ret && (errno == EINTR || errno == EAGAIN));\n\nShouldn't it be `ret' rather than `!ret'?\n\n> +\n> +\tif (ret) {\n> +\t\tLOG(DmaBufAllocator, Error) << \"Unable to sync dma fd: \" << fd\n> +\t\t\t\t\t    << \", step: \" << static_cast<int>(step)\n> +\t\t\t\t\t    << \", type: \" << static_cast<int>(type);\n\nWouldn't it be useful to log errno?\n\n> +\t}\n> +}\n> +\n>  /**\n>   * \\brief Construct a DmaBufAllocator of a given type\n>   * \\param[in] type The type(s) of the dma-buf providers to allocate from\n> @@ -205,4 +278,19 @@ UniqueFD DmaBufAllocator::alloc(const char *name, std::size_t size)\n>  \t\treturn allocFromHeap(name, size);\n>  }\n>  \n> +/**\n> + * \\class DmaSyncer\n> + * \\brief Helper class for dma-buf's synchronization\n> + *\n> + * This class wraps a userspace dma-buf's synchronization process with an\n> + * object's lifetime.\n> + */\n> +\n> +/**\n> + * \\fn DmaSyncer::DmaSyncer(int fd, DmaBufAllocator::SyncType type = DmaBufAllocator::SyncType::ReadWrite)\n> + * \\brief Construct a DmaSyncer with a dma-buf's fd and the access type\n> + * \\param[in] fd The dma-buf's file descriptor to synchronize\n> + * \\param[in] type Read and/or write access via the CPU map\n> + */\n> +\n>  } /* namespace libcamera */","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 38E80BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Nov 2024 14:00:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 18435657F2;\n\tTue, 12 Nov 2024 15:00:06 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A3D5F657B0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Nov 2024 15:00:04 +0100 (CET)","from mail-wm1-f69.google.com (mail-wm1-f69.google.com\n\t[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-611--7TrOHs5NIGzgS_K1BxZuQ-1; Tue, 12 Nov 2024 09:00:02 -0500","by mail-wm1-f69.google.com with SMTP id\n\t5b1f17b1804b1-432d04b3d40so3501725e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Nov 2024 06:00:02 -0800 (PST)","from nuthatch (nat-pool-brq-t.redhat.com. [213.175.37.10])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-432aa73886bsm244183845e9.39.2024.11.12.05.59.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 12 Nov 2024 05:59:59 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"hXFrZSrM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1731420003;\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=0koWkqRpgsBF+GRUxJZ/3xqO/2BKgFEs/J+A+WinK7o=;\n\tb=hXFrZSrMUfApFk4aMHzHffUZqMwDBNzoVtnjQRYx9K53Vp2X3XVuITg58QBhSnOGWNlvgI\n\tCGc2ESu0sSx7nmutHs8xvHaYYQvpF1JqG+twGdrhFxg2YmU5TvomYEn9EnBjPBxotRNzR0\n\tNT5Jyi1d0h3QcBu8NuzrrA9gZins2Vc=","X-MC-Unique":"-7TrOHs5NIGzgS_K1BxZuQ-1","X-Mimecast-MFC-AGG-ID":"-7TrOHs5NIGzgS_K1BxZuQ","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1731420001; x=1732024801;\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=0koWkqRpgsBF+GRUxJZ/3xqO/2BKgFEs/J+A+WinK7o=;\n\tb=nSVvycrTFn5MR/pvYbBXFnm2CwNEOsNGgYCcLpbred7uFr20bDNnnIJJyT9Lq1aQPA\n\tcGK9CBXTYxM7qYgZZcClXIPJfy7flc0bIf3uzW6Y08c7knzOXomMQrxKNhuXZN1F6qmI\n\tmrqOxRdbXdxdkp42Kfga7nmiZ+BHNsdfdSPiw4DJv3VwtfalUemc7pnPYB/T+G6raUUX\n\tKZLNXH9pSBngbMj7hlMQgDeLCLMw3CHF6TWj/eFL0u3RTpftpzbrTAYatOlmfEXWZd0J\n\tE09a70pfHimbT5yVM/tVs6bW7mMmuVSW8URSOQN3gfRy2dteHarPA7L/SLlLVw3ycIRh\n\ttl3w==","X-Gm-Message-State":"AOJu0YyYzZa/28pAuk89CpK6hU0OV9yfj4kmOBhPpKAFvH0T8LYLI2S1\n\tqhd08nWLztb1l5JREoIjL2t9VT8uBwVjjlP7s+/VVngK/e+gGZ1WIAdACTLwENc2YERqjodzeWG\n\tzPuBFs4ZM1YEwTEGLKMl189MKj/B2lckS2H9r0geFOSwZ+5LpcJUGwlBEcilVd+1W77JBQK8=","X-Received":["by 2002:a05:600c:3c9d:b0:430:4db0:3fef with SMTP id\n\t5b1f17b1804b1-432cce77f66mr21248985e9.15.1731420001083; \n\tTue, 12 Nov 2024 06:00:01 -0800 (PST)","by 2002:a05:600c:3c9d:b0:430:4db0:3fef with SMTP id\n\t5b1f17b1804b1-432cce77f66mr21248655e9.15.1731420000625; \n\tTue, 12 Nov 2024 06:00:00 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IHZUgpietp8++L59oPkL5NsVdHOsis+NM5A3DnVhXHho3wipxRJPJZJ8TIW+KubKaUh3LsTuw==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Harvey Yang <chenghaoyang@chromium.org>","Cc":"libcamera-devel@lists.libcamera.org,  Han-Lin Chen\n\t<hanlinchen@chromium.org>","Subject":"Re: [PATCH 1/2] DmaBufAllocator: Add Dma Buffer synchronization\n\tfunction & helper class","In-Reply-To":"<20241112100051.4071443-2-chenghaoyang@chromium.org> (Harvey\n\tYang's message of \"Tue, 12 Nov 2024 09:56:54 +0000\")","References":"<20241112100051.4071443-1-chenghaoyang@chromium.org>\n\t<20241112100051.4071443-2-chenghaoyang@chromium.org>","Date":"Tue, 12 Nov 2024 14:59:59 +0100","Message-ID":"<87ttccft7k.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"OOzvfMEcjRwIcnGPJtYXUkRg4VAh-b9c9gKIA4pcrGY_1731420001","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>"}},{"id":32130,"web_url":"https://patchwork.libcamera.org/comment/32130/","msgid":"<CAEB1ahvMjQOArhMR4hX6ks_a-K_WmyFz2MGO+BFwgVf6HOTx5Q@mail.gmail.com>","date":"2024-11-13T05:55:43","subject":"Re: [PATCH 1/2] DmaBufAllocator: Add Dma Buffer synchronization\n\tfunction & helper class","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"content":"Hi Milan,\n\nOn Tue, Nov 12, 2024 at 10:00 PM Milan Zamazal <mzamazal@redhat.com> wrote:\n>\n> Hi Harvey,\n>\n> thank you for the patch.\n>\n> Harvey Yang <chenghaoyang@chromium.org> writes:\n>\n> > To synchronize CPU access with mmap and hardware access on DMA buffers,\n> > using `DMA_BUF_IOCTL_SYNC` is required. This patch adds a function and\n> > a helper class to allow users to sync buffers more easily.\n> >\n> > Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n> > Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n> > Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>\n> > ---\n> >  .../libcamera/internal/dma_buf_allocator.h    | 33 +++++++\n> >  src/libcamera/dma_buf_allocator.cpp           | 88 +++++++++++++++++++\n> >  2 files changed, 121 insertions(+)\n> >\n> > diff --git a/include/libcamera/internal/dma_buf_allocator.h b/include/libcamera/internal/dma_buf_allocator.h\n> > index d2a0a0d19..2b9b99678 100644\n> > --- a/include/libcamera/internal/dma_buf_allocator.h\n> > +++ b/include/libcamera/internal/dma_buf_allocator.h\n> > @@ -23,6 +23,19 @@ public:\n> >\n> >       using DmaBufAllocatorFlags = Flags<DmaBufAllocatorFlag>;\n> >\n> > +     enum class SyncStep {\n> > +             Start = 0,\n> > +             End\n> > +     };\n> > +\n> > +     enum class SyncType {\n> > +             Read = 0,\n> > +             Write,\n> > +             ReadWrite,\n> > +     };\n> > +\n> > +     static void sync(int fd, SyncStep step, SyncType type);\n> > +\n> >       DmaBufAllocator(DmaBufAllocatorFlags flags = DmaBufAllocatorFlag::CmaHeap);\n> >       ~DmaBufAllocator();\n> >       bool isValid() const { return providerHandle_.isValid(); }\n> > @@ -35,6 +48,26 @@ private:\n> >       DmaBufAllocatorFlag type_;\n> >  };\n> >\n> > +class DmaSyncer final\n> > +{\n> > +public:\n> > +     explicit DmaSyncer(int fd,\n> > +                        DmaBufAllocator::SyncType type = DmaBufAllocator::SyncType::ReadWrite)\n> > +             : fd_(fd), type_(type)\n> > +     {\n> > +             DmaBufAllocator::sync(fd_, DmaBufAllocator::SyncStep::Start, type_);\n> > +     }\n> > +\n> > +     ~DmaSyncer()\n> > +     {\n> > +             DmaBufAllocator::sync(fd_, DmaBufAllocator::SyncStep::End, type_);\n> > +     }\n> > +\n> > +private:\n> > +     int fd_;\n> > +     DmaBufAllocator::SyncType type_;\n> > +};\n> > +\n> >  LIBCAMERA_FLAGS_ENABLE_OPERATORS(DmaBufAllocator::DmaBufAllocatorFlag)\n> >\n> >  } /* namespace libcamera */\n> > diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp\n> > index be6efb89f..3ae98c168 100644\n> > --- a/src/libcamera/dma_buf_allocator.cpp\n> > +++ b/src/libcamera/dma_buf_allocator.cpp\n> > @@ -78,6 +78,79 @@ LOG_DEFINE_CATEGORY(DmaBufAllocator)\n> >   * \\brief A bitwise combination of DmaBufAllocator::DmaBufAllocatorFlag values\n> >   */\n> >\n> > +/**\n> > + * \\enum DmaBufAllocator::SyncStep\n> > + * \\brief Either start or end of the synchronization\n> > + * \\var DmaBufAllocator::Start\n> > + * \\brief Indicates the start of a map access session\n> > + * \\var DmaBufAllocator::End\n> > + * \\brief Indicates the end of a map access session\n> > + */\n> > +\n> > +/**\n> > + * \\enum DmaBufAllocator::SyncType\n> > + * \\brief Read and/or write access via the CPU map\n> > + * \\var DmaBufAllocator::Read\n> > + * \\brief Indicates that the mapped dma-buf will be read by the client via the\n> > + * CPU map\n> > + * \\var DmaBufAllocator::Write\n> > + * \\brief Indicates that the mapped dm-buf will be written by the client via the\n> > + * CPU map\n> > + * \\var DmaBufAllocator::ReadWrite\n> > + * \\brief Indicates that the mapped dma-buf will be rad andd written by the\n>\n> s/rad andd/read and/\n\nDone\n\n>\n> > + * client via the CPU map\n> > + */\n> > +\n> > +/**\n> > + * \\brief Synchronize CPU access and hardware access\n> > + * \\param[in] fd The dma-buf's file descriptor to be synchronized\n> > + * \\param[in] step Either start or end of the synchronization\n> > + * \\param[in] type Read and/or write access during CPU mmap\n> > + *\n> > + * The client is expected to call this function with\n> > + * DmaBufAllocator::SyncStep::Start and DmaBufAllocator::SyncStep::End at the\n> > + * start and end of buffer access respectively.\n> > + */\n> > +void DmaBufAllocator::sync(int fd, DmaBufAllocator::SyncStep step, DmaBufAllocator::SyncType type)\n> > +{\n> > +     uint64_t flags = 0;\n> > +     switch (step) {\n> > +     case DmaBufAllocator::SyncStep::Start:\n> > +             flags = DMA_BUF_SYNC_START;\n> > +             break;\n> > +     case DmaBufAllocator::SyncStep::End:\n> > +             flags = DMA_BUF_SYNC_END;\n> > +             break;\n> > +     }\n> > +\n> > +     switch (type) {\n> > +     case DmaBufAllocator::SyncType::Read:\n> > +             flags = flags | DMA_BUF_SYNC_READ;\n> > +             break;\n> > +     case DmaBufAllocator::SyncType::Write:\n> > +             flags = flags | DMA_BUF_SYNC_WRITE;\n> > +             break;\n> > +     case DmaBufAllocator::SyncType::ReadWrite:\n> > +             flags = flags | DMA_BUF_SYNC_RW;\n> > +             break;\n> > +     }\n> > +\n> > +     struct dma_buf_sync sync = {\n> > +             .flags = flags\n> > +     };\n> > +\n> > +     int ret;\n> > +     do {\n> > +             ret = ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync);\n> > +     } while (!ret && (errno == EINTR || errno == EAGAIN));\n>\n> Shouldn't it be `ret' rather than `!ret'?\n\nAh right! Thanks for the catch!\n\n>\n> > +\n> > +     if (ret) {\n> > +             LOG(DmaBufAllocator, Error) << \"Unable to sync dma fd: \" << fd\n> > +                                         << \", step: \" << static_cast<int>(step)\n> > +                                         << \", type: \" << static_cast<int>(type);\n>\n> Wouldn't it be useful to log errno?\n\nDone\n\nBR,\nHarvey\n\n\n>\n> > +     }\n> > +}\n> > +\n> >  /**\n> >   * \\brief Construct a DmaBufAllocator of a given type\n> >   * \\param[in] type The type(s) of the dma-buf providers to allocate from\n> > @@ -205,4 +278,19 @@ UniqueFD DmaBufAllocator::alloc(const char *name, std::size_t size)\n> >               return allocFromHeap(name, size);\n> >  }\n> >\n> > +/**\n> > + * \\class DmaSyncer\n> > + * \\brief Helper class for dma-buf's synchronization\n> > + *\n> > + * This class wraps a userspace dma-buf's synchronization process with an\n> > + * object's lifetime.\n> > + */\n> > +\n> > +/**\n> > + * \\fn DmaSyncer::DmaSyncer(int fd, DmaBufAllocator::SyncType type = DmaBufAllocator::SyncType::ReadWrite)\n> > + * \\brief Construct a DmaSyncer with a dma-buf's fd and the access type\n> > + * \\param[in] fd The dma-buf's file descriptor to synchronize\n> > + * \\param[in] type Read and/or write access via the CPU map\n> > + */\n> > +\n> >  } /* namespace libcamera */\n>","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 27359BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Nov 2024 05:55:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C782065804;\n\tWed, 13 Nov 2024 06:55:56 +0100 (CET)","from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com\n\t[IPv6:2a00:1450:4864:20::22f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E83765800\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Nov 2024 06:55:55 +0100 (CET)","by mail-lj1-x22f.google.com with SMTP id\n\t38308e7fff4ca-2fb5014e2daso57881171fa.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Nov 2024 21:55:55 -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=\"LLaqZBlQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1731477355; x=1732082155;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=xv1PmM6bLR5IZmoeysphvIVaMS6pnwdf+ZFs4E0tWUI=;\n\tb=LLaqZBlQakTyLhBma9Hac3TbeIBE+pXb3glIeatJY3OKe1cUyj+T9RvNxcSbuma6Er\n\tqt4os2U7GCCnVuPCpVOlEek+HDWYK3DOTy9000NzrPw/u2cxhMynxmbKUtlrKEPCfRgO\n\tgIkp7LpIslNFR6XSTuchDV3asq/of0LlH4uCE=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1731477355; x=1732082155;\n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=xv1PmM6bLR5IZmoeysphvIVaMS6pnwdf+ZFs4E0tWUI=;\n\tb=WUto320/GEraB0Fd42bJNTVW33oxYbP0fcMv21r7zfKYtbIT8v57d5JYD/BQPgNET8\n\t2lkNeDZ81qbJWFyAJhOL34ET6r4WNdWbRuOHyB2Jo++v5RXtrdxit26Oqq37ui3RZwxf\n\tQF4mw9PN+zWnZokguaYN29bltuNhJB2HYCDaB7fTuWkF966ZYAImSrphIZemzLln3QgD\n\tjsEI40Pm10WJH7eKNp89Zw8JJNZk/Ektn2BGi/OFM3OS+qsXQ2x4QYo/Qj3BP1sgjlRB\n\tI5wjOXLpK8NxL0h/i5/HfMWDjEJqaI/UnL4tyxVIR7BwuM0TSrHoWEhOdRFTyRg9EOfa\n\tXIHw==","X-Gm-Message-State":"AOJu0YwZ4CfVZQ0BVFQTf8lAWYap4TkaMXVxHloaB3uvbx4vMysaZG+Z\n\tsg6ltygMKbABZkyUvN/+/fOBRC8s/p3jNo5K+yddlLOpDBcrhGQhEZ6ejg0InYZy1IEhkH5gJnd\n\tntKINxq/NT4v21qot2Mg8Zj1RjEd/4PEv+z2o","X-Google-Smtp-Source":"AGHT+IGZzekav+Uz2o+g6OgjWd6kMCeVqSWO8iTvWk7S9nNOq2p+LYsh67Cn2llxaykyOUV4zq1qYlogpyBUsRZfjaA=","X-Received":"by 2002:a05:651c:19a9:b0:2fb:58fa:bb01 with SMTP id\n\t38308e7fff4ca-2ff201bc616mr79026541fa.17.1731477354461;\n\tTue, 12 Nov 2024 21:55:54 -0800 (PST)","MIME-Version":"1.0","References":"<20241112100051.4071443-1-chenghaoyang@chromium.org>\n\t<20241112100051.4071443-2-chenghaoyang@chromium.org>\n\t<87ttccft7k.fsf@redhat.com>","In-Reply-To":"<87ttccft7k.fsf@redhat.com>","From":"Cheng-Hao Yang <chenghaoyang@chromium.org>","Date":"Wed, 13 Nov 2024 13:55:43 +0800","Message-ID":"<CAEB1ahvMjQOArhMR4hX6ks_a-K_WmyFz2MGO+BFwgVf6HOTx5Q@mail.gmail.com>","Subject":"Re: [PATCH 1/2] DmaBufAllocator: Add Dma Buffer synchronization\n\tfunction & helper class","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tHan-Lin Chen <hanlinchen@chromium.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","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>"}}]