Home | History | Annotate | Download | only in kms++
      1 #pragma once
      2 
      3 #include "drmobject.h"
      4 #include "pixelformats.h"
      5 
      6 namespace kms
      7 {
      8 class IFramebuffer {
      9 public:
     10 	virtual ~IFramebuffer() { }
     11 
     12 	virtual uint32_t width() const = 0;
     13 	virtual uint32_t height() const = 0;
     14 
     15 	virtual PixelFormat format() const { throw std::runtime_error("not implemented"); }
     16 	virtual unsigned num_planes() const { throw std::runtime_error("not implemented"); }
     17 
     18 	virtual uint32_t stride(unsigned plane) const { throw std::runtime_error("not implemented"); }
     19 	virtual uint32_t size(unsigned plane) const { throw std::runtime_error("not implemented"); }
     20 	virtual uint32_t offset(unsigned plane) const { throw std::runtime_error("not implemented"); }
     21 	virtual uint8_t* map(unsigned plane) { throw std::runtime_error("not implemented"); }
     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 
     31 	uint32_t width() const { return m_width; }
     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