diff options
| author | Dom Cobley <popcornmix@gmail.com> | 2022-10-31 18:37:37 +0000 |
|---|---|---|
| committer | Dom Cobley <popcornmix@gmail.com> | 2022-11-01 16:36:59 +0000 |
| commit | b141ae7acc753481d050ebb16d20fc44000c55e7 (patch) | |
| tree | 11fb83368c80c055330131e7f94952abaaff75d2 | |
| parent | 0f3534d3be5750ff9cb03cb997a8efc91de07347 (diff) | |
kmsxx: Also report format of framebuffer
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
| -rw-r--r-- | kms++/inc/kms++/framebuffer.h | 2 | ||||
| -rw-r--r-- | kms++/src/framebuffer.cpp | 5 | ||||
| -rw-r--r-- | utils/kmsprint.cpp | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/kms++/inc/kms++/framebuffer.h b/kms++/inc/kms++/framebuffer.h index 1bd477c..fc50b02 100644 --- a/kms++/inc/kms++/framebuffer.h +++ b/kms++/inc/kms++/framebuffer.h @@ -40,6 +40,7 @@ public: uint32_t width() const override { return m_width; } uint32_t height() const override { return m_height; } + PixelFormat format() const override { return m_format; } void flush(uint32_t x, uint32_t y, uint32_t width, uint32_t height); void flush(); @@ -50,6 +51,7 @@ protected: private: uint32_t m_width; uint32_t m_height; + PixelFormat m_format; }; } // namespace kms diff --git a/kms++/src/framebuffer.cpp b/kms++/src/framebuffer.cpp index 72e1a73..3a76b73 100644 --- a/kms++/src/framebuffer.cpp +++ b/kms++/src/framebuffer.cpp @@ -20,13 +20,14 @@ Framebuffer::Framebuffer(Card& card, uint32_t width, uint32_t height) Framebuffer::Framebuffer(Card& card, uint32_t id) : DrmObject(card, id, DRM_MODE_OBJECT_FB) { - auto fb = drmModeGetFB(card.fd(), id); + auto fb = drmModeGetFB2(card.fd(), id); if (fb) { m_width = fb->width; m_height = fb->height; + m_format = (PixelFormat)fb->pixel_format; - drmModeFreeFB(fb); + drmModeFreeFB2(fb); } else { m_width = m_height = 0; } diff --git a/utils/kmsprint.cpp b/utils/kmsprint.cpp index 7469b47..017944b 100644 --- a/utils/kmsprint.cpp +++ b/utils/kmsprint.cpp @@ -120,8 +120,9 @@ static string format_plane(Plane& p) static string format_fb(Framebuffer& fb) { - return fmt::format("FB {} {}x{}", - fb.id(), fb.width(), fb.height()); + return fmt::format("FB {} {}x{} {}", + fb.id(), fb.width(), fb.height(), + PixelFormatToFourCC(fb.format())); } static string format_property(const Property* prop, uint64_t val) |
