Home | History | Annotate | Download | only in omap
      1 #pragma once
      2 
      3 #include <kms++/framebuffer.h>
      4 #include <kms++/pixelformats.h>
      5 
      6 struct omap_bo;
      7 
      8 namespace kms
      9 {
     10 class OmapCard;
     11 
     12 class OmapFramebuffer : public Framebuffer
     13 {
     14 public:
     15 	enum Flags
     16 	{
     17 		None = 0,
     18 		Tiled = 1 << 0,
     19 		MemContig = 1 << 1,
     20 		MemTiler = 1 << 2,
     21 		MemPin = 1 << 3,
     22 	};
     23 
     24 	OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, const std::string& fourcc, Flags flags = Flags::None);
     25 	OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format, Flags flags = Flags::None);
     26 	virtual ~OmapFramebuffer();
     27 
     28 	uint32_t width() const { return Framebuffer::width(); }
     29 	uint32_t height() const { return Framebuffer::height(); }
     30 
     31 	PixelFormat format() const { return m_format; }
     32 	unsigned num_planes() const { return m_num_planes; }
     33 
     34 	uint32_t handle(unsigned plane) const { return m_planes[plane].handle; }
     35 	uint32_t stride(unsigned plane) const { return m_planes[plane].stride; }
     36 	uint32_t size(unsigned plane) const { return m_planes[plane].size; }
     37 	uint32_t offset(unsigned plane) const { return m_planes[plane].offset; }
     38 	uint8_t* map(unsigned plane);
     39 	int prime_fd(unsigned plane);
     40 
     41 private:
     42 	OmapCard& m_omap_card;
     43 
     44 	struct FramebufferPlane {
     45 		struct omap_bo* omap_bo;
     46 		uint32_t handle;
     47 		int prime_fd;
     48 		uint32_t size;
     49 		uint32_t stride;
     50 		uint32_t offset;
     51 		uint8_t* map;
     52 	};
     53 
     54 	void Create(Flags buffer_flags);
     55 	void Destroy();
     56 
     57 	unsigned m_num_planes;
     58 	struct FramebufferPlane m_planes[3];
     59 
     60 	PixelFormat m_format;
     61 };
     62 }
     63