diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-06-17 02:34:29 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-06-09 22:51:47 +0300 |
commit | e0c8403c3c5670c290e0c6ec653b3abd151a9ced (patch) | |
tree | ba7515f914ae48f03abaaafdccb9912e9b6e8984 /kms++util/src | |
parent | 74d60e252839a03a2f179d82126d1e0db1b4184e (diff) |
utils: Add a dump_framebuffer() methodwriteback
Add a new method to write the contents of a framebuffer to a file
descriptor. This can be used to capture frames from writeback
connectors.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'kms++util/src')
-rw-r--r-- | kms++util/src/drawing.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp index 79e0d90..8d82ca4 100644 --- a/kms++util/src/drawing.cpp +++ b/kms++util/src/drawing.cpp @@ -1,5 +1,6 @@ #include <cmath> +#include <unistd.h> #include <kms++/kms++.h> #include <kms++util/kms++util.h> @@ -554,4 +555,10 @@ void draw_text(IFramebuffer& buf, uint32_t x, uint32_t y, const string& str, RGB draw_char(buf, (x + 8 * i), y, str[i], color); } +void dump_framebuffer(IFramebuffer& fb, int fd) +{ + for (unsigned int i = 0; i < fb.num_planes(); ++i) + ::write(fd, fb.map(i), fb.size(i)); +} + } // namespace kms |