libcamera: framebuffer: Add offset to FrameBuffer::Plane
This adds offset to FrameBuffer::Plane. It enables representing frame buffers that store planes in the same dmabuf at different offsets, as for instance required by the V4L2 NV12 pixel format. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
committed by
Laurent Pinchart
parent
a000a1f6e3
commit
86a47fdcd9
@@ -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, 4, dataEnd);
|
||||
ret.length = readPOD<uint32_t>(dataBegin, 8, dataEnd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user