[v2,5/5] libcamera: software_isp: Allow using dma-buffers from /dev/udmabuf
diff mbox series

Message ID 20240530171600.259495-6-hdegoede@redhat.com
State Accepted
Headers show
Series
  • libcamera: dma_buffer_allocator: Add support for using udmabuf to alloc dma-buffers
Related show

Commit Message

Hans de Goede May 30, 2024, 5:16 p.m. UTC
Allow the DmaBufAllocator used by the software ISP to use memfd() +
/dev/udmabuf for the software ISP destination buffers.

This is useful on Linux distributions where normal users are not allowed
to access /dev/dma_heap/* while they are allowed to access /dev/udmabuf.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/libcamera/software_isp/software_isp.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kieran Bingham May 30, 2024, 10:36 p.m. UTC | #1
Quoting Hans de Goede (2024-05-30 18:16:00)
> Allow the DmaBufAllocator used by the software ISP to use memfd() +
> /dev/udmabuf for the software ISP destination buffers.
> 
> This is useful on Linux distributions where normal users are not allowed
> to access /dev/dma_heap/* while they are allowed to access /dev/udmabuf.
> 

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  src/libcamera/software_isp/software_isp.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
> index b5eab670..8535db90 100644
> --- a/src/libcamera/software_isp/software_isp.cpp
> +++ b/src/libcamera/software_isp/software_isp.cpp
> @@ -66,7 +66,8 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor)
>         : debayerParams_{ DebayerParams::kGain10, DebayerParams::kGain10,
>                           DebayerParams::kGain10, 0.5f, 0 },
>           dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |
> -                  DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap)
> +                  DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |
> +                  DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)
>  {
>         if (!dmaHeap_.isValid()) {
>                 LOG(SoftwareIsp, Error) << "Failed to create DmaBufAllocator object";
> -- 
> 2.45.1
>
Laurent Pinchart June 1, 2024, 1:55 p.m. UTC | #2
Hi Hans,

Thank you for the patch.

On Thu, May 30, 2024 at 07:16:00PM +0200, Hans de Goede wrote:
> Allow the DmaBufAllocator used by the software ISP to use memfd() +
> /dev/udmabuf for the software ISP destination buffers.
> 
> This is useful on Linux distributions where normal users are not allowed
> to access /dev/dma_heap/* while they are allowed to access /dev/udmabuf.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/software_isp/software_isp.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
> index b5eab670..8535db90 100644
> --- a/src/libcamera/software_isp/software_isp.cpp
> +++ b/src/libcamera/software_isp/software_isp.cpp
> @@ -66,7 +66,8 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor)
>  	: debayerParams_{ DebayerParams::kGain10, DebayerParams::kGain10,
>  			  DebayerParams::kGain10, 0.5f, 0 },
>  	  dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |
> -		   DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap)
> +		   DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |
> +		   DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)
>  {
>  	if (!dmaHeap_.isValid()) {
>  		LOG(SoftwareIsp, Error) << "Failed to create DmaBufAllocator object";

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
index b5eab670..8535db90 100644
--- a/src/libcamera/software_isp/software_isp.cpp
+++ b/src/libcamera/software_isp/software_isp.cpp
@@ -66,7 +66,8 @@  SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor)
 	: debayerParams_{ DebayerParams::kGain10, DebayerParams::kGain10,
 			  DebayerParams::kGain10, 0.5f, 0 },
 	  dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |
-		   DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap)
+		   DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |
+		   DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)
 {
 	if (!dmaHeap_.isValid()) {
 		LOG(SoftwareIsp, Error) << "Failed to create DmaBufAllocator object";