summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-02 01:56:07 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-07 19:18:08 +0300
commit78875938e950fb28c90e0ee387cf4c19be7e1d00 (patch)
treecfcca0b2e7adacc1ec24966e83fc5f23162abf01 /src
parent1b0bd492c2c1262215a242bdf83403df87d97c64 (diff)
libcamera: framebuffer: Move planes check to constructor
The FrameBuffer::planes() function checks that planes are correctly initialized with an offset. This can be done at construction time instead, as the planes are constant. The backtrace generated by the assertion will show where the faulty frame buffer is created instead of where it is used, easing debugging. As the runtime overhead is reduced, there's no real need to drop the assertion in the future anymore, it can be useful to ensure that the planes are correctly populated by the caller. Drop the comment that calls for removing the check. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/framebuffer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp
index c99f5b15..ad63a34a 100644
--- a/src/libcamera/framebuffer.cpp
+++ b/src/libcamera/framebuffer.cpp
@@ -199,6 +199,8 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)
: Extensible(std::make_unique<Private>()), planes_(planes),
cookie_(cookie)
{
+ for (const auto &plane : planes_)
+ ASSERT(plane.offset != Plane::kInvalidOffset);
}
/**