summaryrefslogtreecommitdiff
path: root/libkms++/framebuffer.cpp
blob: bc1fd510f99e09f95f667af98b229451f2a27e6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <cstring>
#include <stdexcept>
#include <sys/mman.h>
#include <xf86drm.h>
#include <xf86drmMode.h>

#include "kms++.h"

using namespace std;

namespace kms
{

Framebuffer::Framebuffer(Card& card, int width, int height)
	: DrmObject(card, DRM_MODE_OBJECT_FB), m_width(width), m_height(height)
{
}

Framebuffer::Framebuffer(Card& card, uint32_t id)
	: DrmObject(card, id, DRM_MODE_OBJECT_FB)
{
	auto fb = drmModeGetFB(card.fd(), id);

	m_width = fb->width;
	m_height = fb->height;

	drmModeFreeFB(fb);
}

void Framebuffer::print_short() const
{
	printf("Framebuffer %d\n", id());
}

}