1 #pragma once
3 #include <kms++/mappedframebuffer.h>
4 #include <kms++/pixelformats.h>
6 struct omap_bo;
8 namespace kms
9 {
10 class OmapCard;
12 class OmapFramebuffer : public MappedFramebuffer
13 {
14 public:
15 OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format);
16 virtual ~OmapFramebuffer();
18 uint32_t width() const { return Framebuffer::width(); }
19 uint32_t height() const { return Framebuffer::height(); }
21 PixelFormat format() const { return m_format; }
22 unsigned num_planes() const { return m_num_planes; }
24 uint32_t handle(unsigned plane) const { return m_planes[plane].handle; }
25 uint32_t stride(unsigned plane) const { return m_planes[plane].stride; }
26 uint32_t size(unsigned plane) const { return m_planes[plane].size; }
27 uint32_t offset(unsigned plane) const { return m_planes[plane].offset; }
28 uint8_t* map(unsigned plane);
29 int prime_fd(unsigned plane);
31 private:
32 OmapCard& m_omap_card;
34 struct FramebufferPlane {
35 struct omap_bo* omap_bo;
36 uint32_t handle;
37 int prime_fd;
38 uint32_t size;
39 uint32_t stride;
40 uint32_t offset;
41 uint8_t* map;
42 };
44 void Create();
45 void Destroy();
47 unsigned m_num_planes;
48 struct FramebufferPlane m_planes[3];
50 PixelFormat m_format;
51 };
52 }