]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blob - kms++/dumbframebuffer.h
rename libkms to kms++
[android/external-libkmsxx.git] / kms++ / dumbframebuffer.h
1 #pragma once
3 #include "framebuffer.h"
4 #include "pixelformats.h"
6 namespace kms
7 {
8 class DumbFramebuffer : public Framebuffer, public IMappedFramebuffer
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         uint32_t width() const { return Framebuffer::width(); }
16         uint32_t height() const { return Framebuffer::height(); }
18         PixelFormat format() const { return m_format; }
19         unsigned num_planes() const { return m_num_planes; }
21         uint32_t handle(unsigned plane) const { return m_planes[plane].handle; }
22         uint32_t stride(unsigned plane) const { return m_planes[plane].stride; }
23         uint32_t size(unsigned plane) const { return m_planes[plane].size; }
24         uint32_t offset(unsigned plane) const { return m_planes[plane].offset; }
25         uint8_t* map(unsigned plane);
26         int prime_fd(unsigned plane);
28 private:
29         struct FramebufferPlane {
30                 uint32_t handle;
31                 int prime_fd;
32                 uint32_t size;
33                 uint32_t stride;
34                 uint32_t offset;
35                 uint8_t *map;
36         };
38         void Create();
39         void Destroy();
41         unsigned m_num_planes;
42         struct FramebufferPlane m_planes[4];
44         PixelFormat m_format;
45 };
46 }