libcamera: v4l2_videodevice: Log buffer count on error
diff mbox series

Message ID 20250509125746.49898-1-s.pueschel@pengutronix.de
State New
Headers show
Series
  • libcamera: v4l2_videodevice: Log buffer count on error
Related show

Commit Message

Sven Püschel May 9, 2025, 12:57 p.m. UTC
Log the actual and requested buffer count in the v4l2 error,
when not the requested buffer count could was allocated by V4L2.

Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

---

Extracted from a [1], as it is independent of it.

[1] https://lists.libcamera.org/pipermail/libcamera-devel/2025-April/050024.html
---
 src/libcamera/v4l2_videodevice.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart May 9, 2025, 1:20 p.m. UTC | #1
Hi Sven,

Thank you for the patch.



On Fri, May 09, 2025 at 02:57:46PM +0200, Sven Püschel wrote:
> Log the actual and requested buffer count in the v4l2 error,
> when not the requested buffer count could was allocated by V4L2.

"was" or "could be", but not "could was". Unless you would prefer
otherwise, I'll rewrite this as

Log the actual and requested buffers count in case of a V4L2 buffers
allocation error, when the requested buffers count could not be
allocated.

> Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> 
> ---
> 
> Extracted from a [1], as it is independent of it.
> 
> [1] https://lists.libcamera.org/pipermail/libcamera-devel/2025-April/050024.html
> ---
>  src/libcamera/v4l2_videodevice.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index f5b3fa09..d6f8c3cd 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -1326,7 +1326,8 @@ int V4L2VideoDevice::requestBuffers(unsigned int count,
>  
>  	if (rb.count < count) {
>  		LOG(V4L2, Error)
> -			<< "Not enough buffers provided by V4L2VideoDevice";
> +			<< "Not enough buffers provided by V4L2VideoDevice. Wanted: "
> +			<< count << ", got: " << rb.count;

			<< "Not enough buffers provided by V4L2VideoDevice. Wanted "
			<< count << ", got " << rb.count;

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

If you're fine with those small changes, there's no need to submit a v2,
I'll handle it when applying the patch.

>  		requestBuffers(0, memoryType);
>  		return -ENOMEM;
>  	}
Sven Püschel May 9, 2025, 1:32 p.m. UTC | #2
Hi Laurent,

On 5/9/25 15:20, Laurent Pinchart wrote:
> Hi Sven,
>
> Thank you for the patch.
>
>
>
> On Fri, May 09, 2025 at 02:57:46PM +0200, Sven Püschel wrote:
>> Log the actual and requested buffer count in the v4l2 error,
>> when not the requested buffer count could was allocated by V4L2.
> "was" or "could be", but not "could was". Unless you would prefer
> otherwise, I'll rewrite this as
>
> Log the actual and requested buffers count in case of a V4L2 buffers
> allocation error, when the requested buffers count could not be
> allocated.
oh, thanks. Feel free to rewrite it like this
>> Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
>> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
>>
>> ---
>>
>> Extracted from a [1], as it is independent of it.
>>
>> [1] https://lists.libcamera.org/pipermail/libcamera-devel/2025-April/050024.html
>> ---
>>   src/libcamera/v4l2_videodevice.cpp | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
>> index f5b3fa09..d6f8c3cd 100644
>> --- a/src/libcamera/v4l2_videodevice.cpp
>> +++ b/src/libcamera/v4l2_videodevice.cpp
>> @@ -1326,7 +1326,8 @@ int V4L2VideoDevice::requestBuffers(unsigned int count,
>>   
>>   	if (rb.count < count) {
>>   		LOG(V4L2, Error)
>> -			<< "Not enough buffers provided by V4L2VideoDevice";
>> +			<< "Not enough buffers provided by V4L2VideoDevice. Wanted: "
>> +			<< count << ", got: " << rb.count;
> 			<< "Not enough buffers provided by V4L2VideoDevice. Wanted "
> 			<< count << ", got " << rb.count;
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> If you're fine with those small changes, there's no need to submit a v2,
> I'll handle it when applying the patch.
>
>>   		requestBuffers(0, memoryType);
>>   		return -ENOMEM;
>>   	}

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index f5b3fa09..d6f8c3cd 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1326,7 +1326,8 @@  int V4L2VideoDevice::requestBuffers(unsigned int count,
 
 	if (rb.count < count) {
 		LOG(V4L2, Error)
-			<< "Not enough buffers provided by V4L2VideoDevice";
+			<< "Not enough buffers provided by V4L2VideoDevice. Wanted: "
+			<< count << ", got: " << rb.count;
 		requestBuffers(0, memoryType);
 		return -ENOMEM;
 	}