2 #include <cstring>
3 #include <stdexcept>
4 #include <sys/mman.h>
5 #include <xf86drm.h>
6 #include <xf86drmMode.h>
8 #include "kms++.h"
10 using namespace std;
12 namespace kms
13 {
15 ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, uint32_t depth, uint32_t bpp, uint32_t stride, uint32_t handle)
16 :Framebuffer(card, width, height)
17 {
18 uint32_t id;
19 int r = drmModeAddFB(card.fd(), width, height, depth, bpp, stride, handle, &id);
20 if (r)
21 throw invalid_argument("fob");
22 m_id = id;
23 }
25 ExtFramebuffer::~ExtFramebuffer()
26 {
27 drmModeRmFB(card().fd(), id());
28 }
30 void ExtFramebuffer::print_short() const
31 {
32 printf("Framebuffer %d\n", id());
33 }
35 }