[libcamera-devel] libcamera: framebuffer: Turn the cookie into a 64-bit integer
diff mbox series

Message ID 20220630095521.23723-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit d5b0cec83940b7965bc215383c247da25304ebca
Headers show
Series
  • [libcamera-devel] libcamera: framebuffer: Turn the cookie into a 64-bit integer
Related show

Commit Message

Laurent Pinchart June 30, 2022, 9:55 a.m. UTC
To allow associating pointers with FrameBuffer instances, turn the
cookie into a 64-bit integer. This matches the Request cookie with is
also a uint64_t.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/framebuffer.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


base-commit: 3fa79cc688b540e27f954f156b5ad4bb172ba222

Comments

Kieran Bingham June 30, 2022, 10:59 a.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2022-06-30 10:55:21)
> To allow associating pointers with FrameBuffer instances, turn the

uintptr_t to be explicit?

Either way, 


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

> cookie into a 64-bit integer. This matches the Request cookie with is
> also a uint64_t.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/libcamera/framebuffer.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h
> index 3b1118d1f06b..36b91d11ed79 100644
> --- a/include/libcamera/framebuffer.h
> +++ b/include/libcamera/framebuffer.h
> @@ -66,8 +66,8 @@ public:
>         Request *request() const;
>         const FrameMetadata &metadata() const { return metadata_; }
>  
> -       unsigned int cookie() const { return cookie_; }
> -       void setCookie(unsigned int cookie) { cookie_ = cookie; }
> +       uint64_t cookie() const { return cookie_; }
> +       void setCookie(uint64_t cookie) { cookie_ = cookie; }
>  
>         std::unique_ptr<Fence> releaseFence();
>  
> @@ -80,7 +80,7 @@ private:
>  
>         FrameMetadata metadata_;
>  
> -       unsigned int cookie_;
> +       uint64_t cookie_;
>  };
>  
>  } /* namespace libcamera */
> 
> base-commit: 3fa79cc688b540e27f954f156b5ad4bb172ba222
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart June 30, 2022, 11:03 a.m. UTC | #2
On Thu, Jun 30, 2022 at 11:59:43AM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart via libcamera-devel (2022-06-30 10:55:21)
> > To allow associating pointers with FrameBuffer instances, turn the
> 
> uintptr_t to be explicit?

I've considered it, but the uintptr_t size depends on the architecture,
uint64_t would be more portable here as applications won't need to care
about the exact size if they need to store a non-pointer integer larger
than 32 bits.

Beside, we may drop the cookie completely :-) This patch was more of a
drive-by fix to make the API consistent.

> Either way, 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > cookie into a 64-bit integer. This matches the Request cookie with is
> > also a uint64_t.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  include/libcamera/framebuffer.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h
> > index 3b1118d1f06b..36b91d11ed79 100644
> > --- a/include/libcamera/framebuffer.h
> > +++ b/include/libcamera/framebuffer.h
> > @@ -66,8 +66,8 @@ public:
> >         Request *request() const;
> >         const FrameMetadata &metadata() const { return metadata_; }
> >  
> > -       unsigned int cookie() const { return cookie_; }
> > -       void setCookie(unsigned int cookie) { cookie_ = cookie; }
> > +       uint64_t cookie() const { return cookie_; }
> > +       void setCookie(uint64_t cookie) { cookie_ = cookie; }
> >  
> >         std::unique_ptr<Fence> releaseFence();
> >  
> > @@ -80,7 +80,7 @@ private:
> >  
> >         FrameMetadata metadata_;
> >  
> > -       unsigned int cookie_;
> > +       uint64_t cookie_;
> >  };
> >  
> >  } /* namespace libcamera */
> > 
> > base-commit: 3fa79cc688b540e27f954f156b5ad4bb172ba222
Umang Jain June 30, 2022, 11:14 a.m. UTC | #3
Hello,

On 6/30/22 16:33, Laurent Pinchart via libcamera-devel wrote:
> On Thu, Jun 30, 2022 at 11:59:43AM +0100, Kieran Bingham wrote:
>> Quoting Laurent Pinchart via libcamera-devel (2022-06-30 10:55:21)
>>> To allow associating pointers with FrameBuffer instances, turn the
>> uintptr_t to be explicit?
> I've considered it, but the uintptr_t size depends on the architecture,
> uint64_t would be more portable here as applications won't need to care
> about the exact size if they need to store a non-pointer integer larger
> than 32 bits.
>
> Beside, we may drop the cookie completely :-) This patch was more of a
> drive-by fix to make the API consistent.
>
>> Either way,
>>
>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


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

>>
>>> cookie into a 64-bit integer. This matches the Request cookie with is
>>> also a uint64_t.
>>>
>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>> ---
>>>   include/libcamera/framebuffer.h | 6 +++---
>>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h
>>> index 3b1118d1f06b..36b91d11ed79 100644
>>> --- a/include/libcamera/framebuffer.h
>>> +++ b/include/libcamera/framebuffer.h
>>> @@ -66,8 +66,8 @@ public:
>>>          Request *request() const;
>>>          const FrameMetadata &metadata() const { return metadata_; }
>>>   
>>> -       unsigned int cookie() const { return cookie_; }
>>> -       void setCookie(unsigned int cookie) { cookie_ = cookie; }
>>> +       uint64_t cookie() const { return cookie_; }
>>> +       void setCookie(uint64_t cookie) { cookie_ = cookie; }
>>>   
>>>          std::unique_ptr<Fence> releaseFence();
>>>   
>>> @@ -80,7 +80,7 @@ private:
>>>   
>>>          FrameMetadata metadata_;
>>>   
>>> -       unsigned int cookie_;
>>> +       uint64_t cookie_;
>>>   };
>>>   
>>>   } /* namespace libcamera */
>>>
>>> base-commit: 3fa79cc688b540e27f954f156b5ad4bb172ba222

Patch
diff mbox series

diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h
index 3b1118d1f06b..36b91d11ed79 100644
--- a/include/libcamera/framebuffer.h
+++ b/include/libcamera/framebuffer.h
@@ -66,8 +66,8 @@  public:
 	Request *request() const;
 	const FrameMetadata &metadata() const { return metadata_; }
 
-	unsigned int cookie() const { return cookie_; }
-	void setCookie(unsigned int cookie) { cookie_ = cookie; }
+	uint64_t cookie() const { return cookie_; }
+	void setCookie(uint64_t cookie) { cookie_ = cookie; }
 
 	std::unique_ptr<Fence> releaseFence();
 
@@ -80,7 +80,7 @@  private:
 
 	FrameMetadata metadata_;
 
-	unsigned int cookie_;
+	uint64_t cookie_;
 };
 
 } /* namespace libcamera */