summaryrefslogtreecommitdiff
path: root/libkms++/framebuffer.h
blob: cbf705d7c5d11f0b741eb14db85d276c22a491e2 (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
36
37
38
39
40
#pragma once

#include "drmobject.h"
#include "pixelformats.h"

namespace kms
{
class Framebuffer : public DrmObject
{
public:
	Framebuffer(Card& card, uint32_t id);
	virtual ~Framebuffer();

	uint32_t width() const { return m_width; }
	uint32_t height() const { return m_height; }
protected:
	Framebuffer(Card& card, uint32_t width, uint32_t height);

private:
	uint32_t m_width;
	uint32_t m_height;
};

class IMappedFramebuffer {
public:
	virtual ~IMappedFramebuffer() { }

	virtual uint32_t width() const = 0;
	virtual uint32_t height() const = 0;

	virtual PixelFormat format() const = 0;
	virtual unsigned num_planes() const = 0;

	virtual uint32_t stride(unsigned plane) const = 0;
	virtual uint32_t size(unsigned plane) const = 0;
	virtual uint32_t offset(unsigned plane) const = 0;
	virtual uint8_t* map(unsigned plane) = 0;
};

}