[libcamera-devel] [RFC PATCH v2 02/10] libcamera: ipa_data_serializer: Modify (de)serialization for offset

paul.elder at ideasonboard.com paul.elder at ideasonboard.com
Wed Aug 25 04:22:52 CEST 2021


Hi Hiro,

On Tue, Aug 24, 2021 at 01:15:14AM +0300, Laurent Pinchart wrote:
> Hi Hiro,
> 
> Thank you for the patch.
> 
> On Mon, Aug 23, 2021 at 10:12:13PM +0900, Hirokazu Honda wrote:
> > The offset variable is added to FrameBuffer::Plane. This modifies
> > the serialization and deserialization code for the offset variable.
> > 
> > Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> > ---
> >  src/libcamera/ipa_data_serializer.cpp | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp
> > index 5b183c70..8d1ae4d2 100644
> > --- a/src/libcamera/ipa_data_serializer.cpp
> > +++ b/src/libcamera/ipa_data_serializer.cpp
> > @@ -569,6 +569,7 @@ FileDescriptor IPADataSerializer<FileDescriptor>::deserialize(const std::vector<
> >   * FrameBuffer::Plane is serialized as:
> >   *
> >   * 4 byte  - FileDescriptor
> > + * 4 bytes - uint32_t Offset
> >   * 4 bytes - uint32_t Length
> >   */
> >  template<>
> > @@ -586,6 +587,7 @@ IPADataSerializer<FrameBuffer::Plane>::serialize(const FrameBuffer::Plane &data,
> >  	dataVec.insert(dataVec.end(), fdBuf.begin(), fdBuf.end());
> >  	fdsVec.insert(fdsVec.end(), fdFds.begin(), fdFds.end());
> >  
> > +	appendPOD<uint32_t>(dataVec, data.offset);
> >  	appendPOD<uint32_t>(dataVec, data.length);
> >  
> >  	return { dataVec, fdsVec };
> > @@ -603,7 +605,8 @@ IPADataSerializer<FrameBuffer::Plane>::deserialize(std::vector<uint8_t>::const_i
> >  
> >  	ret.fd = IPADataSerializer<FileDescriptor>::deserialize(dataBegin, dataBegin + 4,
> >  								fdsBegin, fdsBegin + 1);
> > -	ret.length = readPOD<uint32_t>(dataBegin, 4, dataEnd);
> > +	ret.offset = readPOD<uint32_t>(dataBegin, 1, dataEnd);
> > +	ret.length = readPOD<uint32_t>(dataBegin, 5, dataEnd);
> 
> This should be
> 
> 	ret.offset = readPOD<uint32_t>(dataBegin, 4, dataEnd);
> 	ret.length = readPOD<uint32_t>(dataBegin, 8, dataEnd);

Sorry about that, I pushed a change to FileDescriptor's serializer in
between your v1 and v2 :S

Also this needs to be squashed into 1/10, otherwise serialization (and
therefore isolation) will be broken between 1/10 and 2/10.


Paul

> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
> >  
> >  	return ret;
> >  }


More information about the libcamera-devel mailing list