summaryrefslogtreecommitdiff
path: root/kms++util/src/drawing.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-06-17 02:34:29 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2026-05-11 15:55:24 +0300
commitcf7eadd88eeeae3a21305272499676a2df67bb94 (patch)
tree0683b10d4a98f934bcab7ec1177223d29457a408 /kms++util/src/drawing.cpp
parent73a82c3afb9af0a392d9d572ed2f6cd1e091a487 (diff)
utils: Add a dump_framebuffer() method
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/drawing.cpp')
-rw-r--r--kms++util/src/drawing.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp
index df02485..80ff797 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>
@@ -621,4 +622,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