summaryrefslogtreecommitdiff
path: root/kms++/src
diff options
context:
space:
mode:
Diffstat (limited to 'kms++/src')
-rw-r--r--kms++/src/framebuffer.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/kms++/src/framebuffer.cpp b/kms++/src/framebuffer.cpp
index a7f589c..39c4e16 100644
--- a/kms++/src/framebuffer.cpp
+++ b/kms++/src/framebuffer.cpp
@@ -23,14 +23,28 @@ Framebuffer::Framebuffer(Card& card, uint32_t id)
{
auto fb = drmModeGetFB(card.fd(), id);
- m_width = fb->width;
- m_height = fb->height;
+ if (fb) {
+ m_width = fb->width;
+ m_height = fb->height;
- drmModeFreeFB(fb);
+ drmModeFreeFB(fb);
+ } else {
+ m_width = m_height = 0;
+ }
card.m_framebuffers.push_back(this);
}
+void Framebuffer::flush()
+{
+ drmModeClip clip { };
+ clip.x1 = clip.y1 = 0;
+ clip.x2 = width();
+ clip.y2 = height();
+
+ drmModeDirtyFB(card().fd(), id(), &clip, 1);
+}
+
Framebuffer::~Framebuffer()
{
auto& fbs = card().m_framebuffers;