diff options
Diffstat (limited to 'libkms++')
-rw-r--r-- | libkms++/decls.h | 1 | ||||
-rw-r--r-- | libkms++/extframebuffer.cpp | 35 | ||||
-rw-r--r-- | libkms++/extframebuffer.h | 21 | ||||
-rw-r--r-- | libkms++/kms++.h | 1 |
4 files changed, 58 insertions, 0 deletions
diff --git a/libkms++/decls.h b/libkms++/decls.h index 1415f1f..f9753f2 100644 --- a/libkms++/decls.h +++ b/libkms++/decls.h @@ -9,6 +9,7 @@ class Crtc; class Encoder; class Framebuffer; class DumbFramebuffer; +class ExtFramebuffer; class DrmObject; class Plane; class Property; diff --git a/libkms++/extframebuffer.cpp b/libkms++/extframebuffer.cpp new file mode 100644 index 0000000..de9d737 --- /dev/null +++ b/libkms++/extframebuffer.cpp @@ -0,0 +1,35 @@ + +#include <cstring> +#include <stdexcept> +#include <sys/mman.h> +#include <xf86drm.h> +#include <xf86drmMode.h> + +#include "kms++.h" + +using namespace std; + +namespace kms +{ + +ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, uint32_t depth, uint32_t bpp, uint32_t stride, uint32_t handle) + :Framebuffer(card, width, height) +{ + uint32_t id; + int r = drmModeAddFB(card.fd(), width, height, depth, bpp, stride, handle, &id); + if (r) + throw invalid_argument("fob"); + m_id = id; +} + +ExtFramebuffer::~ExtFramebuffer() +{ + drmModeRmFB(card().fd(), id()); +} + +void ExtFramebuffer::print_short() const +{ + printf("Framebuffer %d\n", id()); +} + +} diff --git a/libkms++/extframebuffer.h b/libkms++/extframebuffer.h new file mode 100644 index 0000000..cc0863a --- /dev/null +++ b/libkms++/extframebuffer.h @@ -0,0 +1,21 @@ +#pragma once + +#include "framebuffer.h" + +namespace kms +{ + +class ExtFramebuffer : public Framebuffer +{ +public: + ExtFramebuffer(Card& card, uint32_t width, uint32_t height, uint32_t depth, uint32_t bpp, uint32_t stride, uint32_t handle); + virtual ~ExtFramebuffer(); + + void print_short() const; + +private: + uint32_t m_pitch; + uint32_t m_bpp; + uint32_t m_depth; +}; +} diff --git a/libkms++/kms++.h b/libkms++/kms++.h index c446a9e..c518a47 100644 --- a/libkms++/kms++.h +++ b/libkms++/kms++.h @@ -7,6 +7,7 @@ #include "encoder.h" #include "framebuffer.h" #include "dumbframebuffer.h" +#include "extframebuffer.h" #include "plane.h" #include "property.h" #include "pipeline.h" |