@@ -55,6 +55,7 @@ public:
SharedFD fd;
unsigned int offset = kInvalidOffset;
unsigned int length;
+ unsigned int stride;
};
FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
@@ -255,7 +255,8 @@ DmaBufAllocator::createBuffer(std::string name,
return nullptr;
for (auto planeSize : planeSizes) {
- planes.emplace_back(FrameBuffer::Plane{ fd, offset, planeSize });
+ /* \todo Invalid stride information. Consider adding strides as input. */
+ planes.emplace_back(FrameBuffer::Plane{ fd, offset, planeSize, 0 });
offset += planeSize;
}
@@ -282,6 +282,11 @@ FrameBuffer::Private::~Private()
* \brief The plane length in bytes
*/
+/**
+ * \var FrameBuffer::Plane::stride
+ * \brief The plane stride in bytes
+ */
+
namespace {
ino_t fileDescriptorInode(const SharedFD &fd)
@@ -572,6 +572,7 @@ SharedFD IPADataSerializer<SharedFD>::deserialize(const std::vector<uint8_t> &da
* 4 byte - SharedFD
* 4 bytes - uint32_t Offset
* 4 bytes - uint32_t Length
+ * 4 bytes - uint32_t Stride
*/
template<>
std::tuple<std::vector<uint8_t>, std::vector<SharedFD>>
@@ -590,6 +591,7 @@ IPADataSerializer<FrameBuffer::Plane>::serialize(const FrameBuffer::Plane &data,
appendPOD<uint32_t>(dataVec, data.offset);
appendPOD<uint32_t>(dataVec, data.length);
+ appendPOD<uint32_t>(dataVec, data.stride);
return { dataVec, fdsVec };
}
@@ -608,6 +610,7 @@ IPADataSerializer<FrameBuffer::Plane>::deserialize(std::vector<uint8_t>::const_i
fdsBegin, fdsBegin + 1);
ret.offset = readPOD<uint32_t>(dataBegin, 4, dataEnd);
ret.length = readPOD<uint32_t>(dataBegin, 8, dataEnd);
+ ret.stride = readPOD<uint32_t>(dataBegin, 12, dataEnd);
return ret;
}
Some platforms, like mtkisp7, need the stride information in a FrameBuffer. This patch adds the member variable in FrameBuffer::Plane, and appends the member variable in IPA (de)serializer. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> --- include/libcamera/framebuffer.h | 1 + src/libcamera/dma_buf_allocator.cpp | 3 ++- src/libcamera/framebuffer.cpp | 5 +++++ src/libcamera/ipa_data_serializer.cpp | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-)