summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/framebuffer.h4
-rw-r--r--kms++/src/framebuffer.cpp7
2 files changed, 10 insertions, 1 deletions
diff --git a/kms++/inc/kms++/framebuffer.h b/kms++/inc/kms++/framebuffer.h
index fc50b02..2594c11 100644
--- a/kms++/inc/kms++/framebuffer.h
+++ b/kms++/inc/kms++/framebuffer.h
@@ -1,5 +1,7 @@
#pragma once
+#include <stdexcept>
+
#include "drmobject.h"
#include "pixelformats.h"
@@ -40,6 +42,7 @@ public:
uint32_t width() const override { return m_width; }
uint32_t height() const override { return m_height; }
+ uint32_t fourcc() const { return m_fourcc; }
PixelFormat format() const override { return m_format; }
void flush(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
@@ -51,6 +54,7 @@ protected:
private:
uint32_t m_width;
uint32_t m_height;
+ uint32_t m_fourcc;
PixelFormat m_format;
};
diff --git a/kms++/src/framebuffer.cpp b/kms++/src/framebuffer.cpp
index 773cf4b..3d251ce 100644
--- a/kms++/src/framebuffer.cpp
+++ b/kms++/src/framebuffer.cpp
@@ -25,7 +25,12 @@ Framebuffer::Framebuffer(Card& card, uint32_t id)
if (fb) {
m_width = fb->width;
m_height = fb->height;
- m_format = fourcc_to_pixel_format(fb->pixel_format);
+ m_fourcc = fb->pixel_format;
+ try {
+ m_format = fourcc_to_pixel_format(m_fourcc);
+ } catch (const invalid_argument& e) {
+ m_format = PixelFormat::Undefined;
+ }
drmModeFreeFB2(fb);
} else {