• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 #include "drmobject.h"
4 #include "pixelformats.h"
5 
6 namespace kms
7 {
8 class IFramebuffer {
9 public:
~IFramebuffer()10 	virtual ~IFramebuffer() { }
11 
12 	virtual uint32_t width() const = 0;
13 	virtual uint32_t height() const = 0;
14 
format()15 	virtual PixelFormat format() const { throw std::runtime_error("not implemented"); }
num_planes()16 	virtual unsigned num_planes() const { throw std::runtime_error("not implemented"); }
17 
stride(unsigned plane)18 	virtual uint32_t stride(unsigned plane) const { throw std::runtime_error("not implemented"); }
size(unsigned plane)19 	virtual uint32_t size(unsigned plane) const { throw std::runtime_error("not implemented"); }
offset(unsigned plane)20 	virtual uint32_t offset(unsigned plane) const { throw std::runtime_error("not implemented"); }
map(unsigned plane)21 	virtual uint8_t* map(unsigned plane) { throw std::runtime_error("not implemented"); }
prime_fd(unsigned plane)22 	virtual int prime_fd(unsigned plane) { throw std::runtime_error("not implemented"); }
23 };
24 
25 class Framebuffer : public DrmObject, public IFramebuffer
26 {
27 public:
28 	Framebuffer(Card& card, uint32_t id);
29 	virtual ~Framebuffer();
30 
width()31 	uint32_t width() const { return m_width; }
height()32 	uint32_t height() const { return m_height; }
33 
34 	void flush();
35 protected:
36 	Framebuffer(Card& card, uint32_t width, uint32_t height);
37 
38 private:
39 	uint32_t m_width;
40 	uint32_t m_height;
41 };
42 
43 }
44