1 #pragma once
3 #include "framebuffer.h"
4 #include "pixelformats.h"
6 namespace kms
7 {
8 class DumbFramebuffer : public Framebuffer
9 {
10 public:
11 DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const std::string& fourcc);
12 DumbFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format);
13 virtual ~DumbFramebuffer();
15 void print_short() const;
17 PixelFormat format() const { return m_format; }
18 unsigned num_planes() const { return m_num_planes; }
20 uint32_t handle(unsigned plane) const { return m_planes[plane].handle; }
21 uint8_t* map(unsigned plane) const { return m_planes[plane].map; }
22 uint32_t stride(unsigned plane) const { return m_planes[plane].stride; }
23 uint32_t size(unsigned plane) const { return m_planes[plane].size; }
25 void clear();
27 private:
28 struct FramebufferPlane {
29 uint32_t handle;
30 uint32_t size;
31 uint32_t stride;
32 uint8_t *map;
33 };
35 void Create();
36 void Destroy();
38 unsigned m_num_planes;
39 struct FramebufferPlane m_planes[4];
41 PixelFormat m_format;
42 };
43 }