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");
23 set_id(id);
24 }
26 ExtFramebuffer::~ExtFramebuffer()
27 {
28 drmModeRmFB(card().fd(), id());
29 }
31 void ExtFramebuffer::print_short() const
32 {
33 printf("Framebuffer %d\n", id());
34 }
36 }