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 PixelFormat format() const { return m_format; }
16 unsigned num_planes() const { return m_num_planes; }
18 uint32_t handle(unsigned plane) const { return m_planes[plane].handle; }
19 uint32_t stride(unsigned plane) const { return m_planes[plane].stride; }
20 uint32_t size(unsigned plane) const { return m_planes[plane].size; }
21 uint32_t offset(unsigned plane) const { return m_planes[plane].offset; }
22 uint8_t* map(unsigned plane);
23 int prime_fd(unsigned plane);
25 private:
26 struct FramebufferPlane {
27 uint32_t handle;
28 int prime_fd;
29 uint32_t size;
30 uint32_t stride;
31 uint32_t offset;
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 }