[libcamera-devel] libcamera: v4l2_videodevice: Don't move planes to construct FrameBuffer
diff mbox series

Message ID 20210923115558.31107-1-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] libcamera: v4l2_videodevice: Don't move planes to construct FrameBuffer
Related show

Commit Message

Laurent Pinchart Sept. 23, 2021, 11:55 a.m. UTC
The FrameBuffer class has no constructor that takes an rvalue reference
to planes. The std::move() is thus misleading as a copy will still take
place. Drop it to clarify the code, no functional change is introduced.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/v4l2_videodevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 2cc4303b172a76ac5b431c4fb4df8a083f7d3fcf

Comments

Jacopo Mondi Sept. 23, 2021, 12:06 p.m. UTC | #1
Hi Laurent,

On Thu, Sep 23, 2021 at 02:55:58PM +0300, Laurent Pinchart wrote:
> The FrameBuffer class has no constructor that takes an rvalue reference
> to planes. The std::move() is thus misleading as a copy will still take
> place. Drop it to clarify the code, no functional change is introduced.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Indeed!
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> ---
>  src/libcamera/v4l2_videodevice.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 9b3ee88757be..ba5f88cd41ed 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -1376,7 +1376,7 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
>  		}
>  	}
>
> -	return std::make_unique<FrameBuffer>(std::move(planes));
> +	return std::make_unique<FrameBuffer>(planes);
>  }
>
>  FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index,
>
> base-commit: 2cc4303b172a76ac5b431c4fb4df8a083f7d3fcf
> --
> Regards,
>
> Laurent Pinchart
>
Umang Jain Sept. 23, 2021, 12:46 p.m. UTC | #2
Hi Laurent,

Thank you for the patch.

On 9/23/21 5:25 PM, Laurent Pinchart wrote:
> The FrameBuffer class has no constructor that takes an rvalue reference
> to planes. The std::move() is thus misleading as a copy will still take
> place. Drop it to clarify the code, no functional change is introduced.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>   src/libcamera/v4l2_videodevice.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 9b3ee88757be..ba5f88cd41ed 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -1376,7 +1376,7 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
>   		}
>   	}
>   
> -	return std::make_unique<FrameBuffer>(std::move(planes));
> +	return std::make_unique<FrameBuffer>(planes);


Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>   }
>   
>   FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index,
>
> base-commit: 2cc4303b172a76ac5b431c4fb4df8a083f7d3fcf
Paul Elder Sept. 24, 2021, 5:40 a.m. UTC | #3
Hi Laurent,

On Thu, Sep 23, 2021 at 02:55:58PM +0300, Laurent Pinchart wrote:
> The FrameBuffer class has no constructor that takes an rvalue reference
> to planes. The std::move() is thus misleading as a copy will still take
> place. Drop it to clarify the code, no functional change is introduced.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/v4l2_videodevice.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 9b3ee88757be..ba5f88cd41ed 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -1376,7 +1376,7 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
>  		}
>  	}
>  
> -	return std::make_unique<FrameBuffer>(std::move(planes));
> +	return std::make_unique<FrameBuffer>(planes);
>  }
>  
>  FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index,
> 
> base-commit: 2cc4303b172a76ac5b431c4fb4df8a083f7d3fcf
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 9b3ee88757be..ba5f88cd41ed 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1376,7 +1376,7 @@  std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
 		}
 	}
 
-	return std::make_unique<FrameBuffer>(std::move(planes));
+	return std::make_unique<FrameBuffer>(planes);
 }
 
 FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index,