[libcamera-devel] libcamera: v4l2_videodevice: Return correct format for metadata

Message ID 20200416220558.32136-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 35269f04578082675778ef7ce6eab2fb4d559d9a
Headers show
Series
  • [libcamera-devel] libcamera: v4l2_videodevice: Return correct format for metadata
Related show

Commit Message

Laurent Pinchart April 16, 2020, 10:05 p.m. UTC
When setting format on a metadata video device, the returned format
isn't updated with the actual set format due to a typo. Fix it.

Fixes: 629e9301c518 ("libcamera: v4l2_device: Add META support in g/s_fmt")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/v4l2_videodevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Niklas Söderlund April 17, 2020, 12:07 a.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2020-04-17 01:05:58 +0300, Laurent Pinchart wrote:
> When setting format on a metadata video device, the returned format
> isn't updated with the actual set format due to a typo. Fix it.
> 
> Fixes: 629e9301c518 ("libcamera: v4l2_device: Add META support in g/s_fmt")
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  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 439a9c90dbf7..a959cfe65c43 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -848,7 +848,7 @@ int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format)
>  	 */
>  	format->size.width = 0;
>  	format->size.height = 0;
> -	format->fourcc = format->fourcc;
> +	format->fourcc = V4L2PixelFormat(pix->dataformat);
>  	format->planesCount = 1;
>  	format->planes[0].bpl = pix->buffersize;
>  	format->planes[0].size = pix->buffersize;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Kieran Bingham April 17, 2020, 8:31 a.m. UTC | #2
Hi Laurent,

On 16/04/2020 23:05, Laurent Pinchart wrote:
> When setting format on a metadata video device, the returned format
> isn't updated with the actual set format due to a typo. Fix it.

Did you hit this? Or identify it from the coverity scan?

This is Coverity ID: 279098, if it's worth adding that to the commit
message.

> Fixes: 629e9301c518 ("libcamera: v4l2_device: Add META support in g/s_fmt")
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@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 439a9c90dbf7..a959cfe65c43 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -848,7 +848,7 @@ int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format)
>  	 */
>  	format->size.width = 0;
>  	format->size.height = 0;
> -	format->fourcc = format->fourcc;
> +	format->fourcc = V4L2PixelFormat(pix->dataformat);
>  	format->planesCount = 1;
>  	format->planes[0].bpl = pix->buffersize;
>  	format->planes[0].size = pix->buffersize;
Laurent Pinchart April 17, 2020, 11:13 a.m. UTC | #3
Hi Kieran,

On Fri, Apr 17, 2020 at 09:31:34AM +0100, Kieran Bingham wrote:
> On 16/04/2020 23:05, Laurent Pinchart wrote:
> > When setting format on a metadata video device, the returned format
> > isn't updated with the actual set format due to a typo. Fix it.
> 
> Did you hit this? Or identify it from the coverity scan?
> 
> This is Coverity ID: 279098, if it's worth adding that to the commit
> message.

What would you think of using a Reported-by tag for this ?

Reported-by: Coverity DefectId=279098
Reported-by: Coverity CID=279098
Reported-by: Coverity Scan CID=279098

Any preference ? CID is used in the e-mail reports, no idea what the web
UI uses as it still refuses to show me any data :-)

> > Fixes: 629e9301c518 ("libcamera: v4l2_device: Add META support in g/s_fmt")
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@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 439a9c90dbf7..a959cfe65c43 100644
> > --- a/src/libcamera/v4l2_videodevice.cpp
> > +++ b/src/libcamera/v4l2_videodevice.cpp
> > @@ -848,7 +848,7 @@ int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format)
> >  	 */
> >  	format->size.width = 0;
> >  	format->size.height = 0;
> > -	format->fourcc = format->fourcc;
> > +	format->fourcc = V4L2PixelFormat(pix->dataformat);
> >  	format->planesCount = 1;
> >  	format->planes[0].bpl = pix->buffersize;
> >  	format->planes[0].size = pix->buffersize;
Kieran Bingham April 17, 2020, 12:20 p.m. UTC | #4
Hi Laurent,

On 17/04/2020 12:13, Laurent Pinchart wrote:
> Hi Kieran,
> 
> On Fri, Apr 17, 2020 at 09:31:34AM +0100, Kieran Bingham wrote:
>> On 16/04/2020 23:05, Laurent Pinchart wrote:
>>> When setting format on a metadata video device, the returned format
>>> isn't updated with the actual set format due to a typo. Fix it.
>>
>> Did you hit this? Or identify it from the coverity scan?
>>
>> This is Coverity ID: 279098, if it's worth adding that to the commit
>> message.
> 
> What would you think of using a Reported-by tag for this ?
> 
> Reported-by: Coverity DefectId=279098
> Reported-by: Coverity CID=279098
> Reported-by: Coverity Scan CID=279098
> 
> Any preference ? CID is used in the e-mail reports, no idea what the web
> UI uses as it still refuses to show me any data :-)

The web interface uses CID too, but as I expect that to represent
"Coverity ID", Coverity CID becomes Coverity Coverity ID...

But as CID is referenced everywhere, and people are already used to
referencing "PIN numbers" ...

I'm happy with either of:

Reported-by: Coverity CID=279098
or
Reported-by: Coverity ID=279098

Dealers choice...

--
Kieran


>>> Fixes: 629e9301c518 ("libcamera: v4l2_device: Add META support in g/s_fmt")
>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>
>> Reviewed-by: Kieran Bingham <kieran.bingham@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 439a9c90dbf7..a959cfe65c43 100644
>>> --- a/src/libcamera/v4l2_videodevice.cpp
>>> +++ b/src/libcamera/v4l2_videodevice.cpp
>>> @@ -848,7 +848,7 @@ int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format)
>>>  	 */
>>>  	format->size.width = 0;
>>>  	format->size.height = 0;
>>> -	format->fourcc = format->fourcc;
>>> +	format->fourcc = V4L2PixelFormat(pix->dataformat);
>>>  	format->planesCount = 1;
>>>  	format->planes[0].bpl = pix->buffersize;
>>>  	format->planes[0].size = pix->buffersize;
>

Patch

diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 439a9c90dbf7..a959cfe65c43 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -848,7 +848,7 @@  int V4L2VideoDevice::setFormatMeta(V4L2DeviceFormat *format)
 	 */
 	format->size.width = 0;
 	format->size.height = 0;
-	format->fourcc = format->fourcc;
+	format->fourcc = V4L2PixelFormat(pix->dataformat);
 	format->planesCount = 1;
 	format->planes[0].bpl = pix->buffersize;
 	format->planes[0].size = pix->buffersize;