aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen2017-10-03 04:32:52 -0500
committerTomi Valkeinen2017-10-03 04:33:11 -0500
commitfab9bb700372008130e5026fa9fe5fd22ac6ec4e (patch)
tree1e83b437762697ab833bd8c22896b8733593ca5f
parent33f343d18d5d1886dd04314bded1781c3e46f7e7 (diff)
downloadexternal-libkmsxx-fab9bb700372008130e5026fa9fe5fd22ac6ec4e.tar.gz
external-libkmsxx-fab9bb700372008130e5026fa9fe5fd22ac6ec4e.tar.xz
external-libkmsxx-fab9bb700372008130e5026fa9fe5fd22ac6ec4e.zip
Rework framebuffer classes
Drop (I)MappedFramebuffer, as it doesn't really provide any value, and have most of the methods be present in IFramebuffer with default exception throwing implementation. This gives us simpler way to use the framebuffers, as almost always we can just use a pointer to IFramebuffer.
-rw-r--r--kms++/inc/kms++/dumbframebuffer.h4
-rw-r--r--kms++/inc/kms++/extframebuffer.h4
-rw-r--r--kms++/inc/kms++/framebuffer.h35
-rw-r--r--kms++/inc/kms++/kms++.h1
-rw-r--r--kms++/inc/kms++/mappedframebuffer.h23
-rw-r--r--kms++/inc/kms++/omap/omapframebuffer.h4
-rw-r--r--kms++/src/dumbframebuffer.cpp2
-rw-r--r--kms++/src/extframebuffer.cpp4
-rw-r--r--kms++/src/mappedframebuffer.cpp20
-rw-r--r--kms++/src/omap/omapframebuffer.cpp2
-rw-r--r--kms++util/inc/kms++util/cpuframebuffer.h2
-rw-r--r--kms++util/inc/kms++util/extcpuframebuffer.h2
-rw-r--r--kms++util/inc/kms++util/kms++util.h16
-rw-r--r--kms++util/src/colorbar.cpp8
-rw-r--r--kms++util/src/drawing.cpp12
-rw-r--r--kms++util/src/testpat.cpp8
-rw-r--r--py/pykms/pykmsbase.cpp10
-rw-r--r--py/pykms/pykmsomap.cpp2
-rw-r--r--py/pykms/pykmsutil.cpp10
-rw-r--r--utils/kmstest.cpp16
20 files changed, 71 insertions, 114 deletions
diff --git a/kms++/inc/kms++/dumbframebuffer.h b/kms++/inc/kms++/dumbframebuffer.h
index 15d25d1..fb99d0e 100644
--- a/kms++/inc/kms++/dumbframebuffer.h
+++ b/kms++/inc/kms++/dumbframebuffer.h
@@ -1,12 +1,12 @@
1#pragma once 1#pragma once
2 2
3#include "mappedframebuffer.h" 3#include "framebuffer.h"
4#include "pixelformats.h" 4#include "pixelformats.h"
5 5
6namespace kms 6namespace kms
7{ 7{
8 8
9class DumbFramebuffer : public MappedFramebuffer 9class DumbFramebuffer : public Framebuffer
10{ 10{
11public: 11public:
12 DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const std::string& fourcc); 12 DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const std::string& fourcc);
diff --git a/kms++/inc/kms++/extframebuffer.h b/kms++/inc/kms++/extframebuffer.h
index 1ec614f..5f0660c 100644
--- a/kms++/inc/kms++/extframebuffer.h
+++ b/kms++/inc/kms++/extframebuffer.h
@@ -1,12 +1,12 @@
1#pragma once 1#pragma once
2 2
3#include "mappedframebuffer.h" 3#include "framebuffer.h"
4#include "pixelformats.h" 4#include "pixelformats.h"
5 5
6namespace kms 6namespace kms
7{ 7{
8 8
9class ExtFramebuffer : public MappedFramebuffer 9class ExtFramebuffer : public Framebuffer
10{ 10{
11public: 11public:
12 ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format, 12 ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
diff --git a/kms++/inc/kms++/framebuffer.h b/kms++/inc/kms++/framebuffer.h
index faf2e71..3d43d08 100644
--- a/kms++/inc/kms++/framebuffer.h
+++ b/kms++/inc/kms++/framebuffer.h
@@ -5,7 +5,24 @@
5 5
6namespace kms 6namespace kms
7{ 7{
8class Framebuffer : public DrmObject 8class IFramebuffer {
9public:
10 virtual ~IFramebuffer() { }
11
12 virtual uint32_t width() const = 0;
13 virtual uint32_t height() const = 0;
14
15 virtual PixelFormat format() const { throw std::runtime_error("not implemented"); }
16 virtual unsigned num_planes() const { throw std::runtime_error("not implemented"); }
17
18 virtual uint32_t stride(unsigned plane) const { throw std::runtime_error("not implemented"); }
19 virtual uint32_t size(unsigned plane) const { throw std::runtime_error("not implemented"); }
20 virtual uint32_t offset(unsigned plane) const { throw std::runtime_error("not implemented"); }
21 virtual uint8_t* map(unsigned plane) { throw std::runtime_error("not implemented"); }
22 virtual int prime_fd(unsigned plane) { throw std::runtime_error("not implemented"); }
23};
24
25class Framebuffer : public DrmObject, public IFramebuffer
9{ 26{
10public: 27public:
11 Framebuffer(Card& card, uint32_t id); 28 Framebuffer(Card& card, uint32_t id);
@@ -23,20 +40,4 @@ private:
23 uint32_t m_height; 40 uint32_t m_height;
24}; 41};
25 42
26class IMappedFramebuffer {
27public:
28 virtual ~IMappedFramebuffer() { }
29
30 virtual uint32_t width() const = 0;
31 virtual uint32_t height() const = 0;
32
33 virtual PixelFormat format() const = 0;
34 virtual unsigned num_planes() const = 0;
35
36 virtual uint32_t stride(unsigned plane) const = 0;
37 virtual uint32_t size(unsigned plane) const = 0;
38 virtual uint32_t offset(unsigned plane) const = 0;
39 virtual uint8_t* map(unsigned plane) = 0;
40};
41
42} 43}
diff --git a/kms++/inc/kms++/kms++.h b/kms++/inc/kms++/kms++.h
index 6fc6977..3365ef7 100644
--- a/kms++/inc/kms++/kms++.h
+++ b/kms++/inc/kms++/kms++.h
@@ -8,7 +8,6 @@
8#include "framebuffer.h" 8#include "framebuffer.h"
9#include "dumbframebuffer.h" 9#include "dumbframebuffer.h"
10#include "extframebuffer.h" 10#include "extframebuffer.h"
11#include "mappedframebuffer.h"
12#include "plane.h" 11#include "plane.h"
13#include "property.h" 12#include "property.h"
14#include "blob.h" 13#include "blob.h"
diff --git a/kms++/inc/kms++/mappedframebuffer.h b/kms++/inc/kms++/mappedframebuffer.h
deleted file mode 100644
index 2905136..0000000
--- a/kms++/inc/kms++/mappedframebuffer.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#pragma once
2
3#include "framebuffer.h"
4
5namespace kms
6{
7
8class MappedFramebuffer : public Framebuffer, public IMappedFramebuffer
9{
10public:
11 virtual ~MappedFramebuffer() { }
12
13protected:
14 MappedFramebuffer(Card& card, uint32_t id);
15 MappedFramebuffer(Card& card, uint32_t width, uint32_t height);
16
17public:
18 virtual uint32_t width() const = 0;
19 virtual uint32_t height() const = 0;
20
21};
22
23}
diff --git a/kms++/inc/kms++/omap/omapframebuffer.h b/kms++/inc/kms++/omap/omapframebuffer.h
index d1152b5..70bf946 100644
--- a/kms++/inc/kms++/omap/omapframebuffer.h
+++ b/kms++/inc/kms++/omap/omapframebuffer.h
@@ -1,6 +1,6 @@
1#pragma once 1#pragma once
2 2
3#include <kms++/mappedframebuffer.h> 3#include <kms++/framebuffer.h>
4#include <kms++/pixelformats.h> 4#include <kms++/pixelformats.h>
5 5
6struct omap_bo; 6struct omap_bo;
@@ -9,7 +9,7 @@ namespace kms
9{ 9{
10class OmapCard; 10class OmapCard;
11 11
12class OmapFramebuffer : public MappedFramebuffer 12class OmapFramebuffer : public Framebuffer
13{ 13{
14public: 14public:
15 enum Flags 15 enum Flags
diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp
index 9de7ee1..b21e8ff 100644
--- a/kms++/src/dumbframebuffer.cpp
+++ b/kms++/src/dumbframebuffer.cpp
@@ -25,7 +25,7 @@ DumbFramebuffer::DumbFramebuffer(Card &card, uint32_t width, uint32_t height, co
25} 25}
26 26
27DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format) 27DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format)
28 :MappedFramebuffer(card, width, height), m_format(format) 28 :Framebuffer(card, width, height), m_format(format)
29{ 29{
30 Create(); 30 Create();
31} 31}
diff --git a/kms++/src/extframebuffer.cpp b/kms++/src/extframebuffer.cpp
index f50c36e..c1f562e 100644
--- a/kms++/src/extframebuffer.cpp
+++ b/kms++/src/extframebuffer.cpp
@@ -14,7 +14,7 @@ namespace kms
14 14
15ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format, 15ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
16 vector<uint32_t> handles, vector<uint32_t> pitches, vector<uint32_t> offsets) 16 vector<uint32_t> handles, vector<uint32_t> pitches, vector<uint32_t> offsets)
17 : MappedFramebuffer(card, width, height) 17 : Framebuffer(card, width, height)
18{ 18{
19 m_format = format; 19 m_format = format;
20 20
@@ -44,7 +44,7 @@ ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, Pixe
44 44
45ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format, 45ExtFramebuffer::ExtFramebuffer(Card& card, uint32_t width, uint32_t height, PixelFormat format,
46 vector<int> fds, vector<uint32_t> pitches, vector<uint32_t> offsets) 46 vector<int> fds, vector<uint32_t> pitches, vector<uint32_t> offsets)
47 : MappedFramebuffer(card, width, height) 47 : Framebuffer(card, width, height)
48{ 48{
49 int r; 49 int r;
50 50
diff --git a/kms++/src/mappedframebuffer.cpp b/kms++/src/mappedframebuffer.cpp
deleted file mode 100644
index 21e082f..0000000
--- a/kms++/src/mappedframebuffer.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
1#include <kms++/kms++.h>
2
3using namespace std;
4
5namespace kms
6{
7
8MappedFramebuffer::MappedFramebuffer(Card& card, uint32_t id)
9 : Framebuffer(card, id)
10{
11
12}
13
14MappedFramebuffer::MappedFramebuffer(Card& card, uint32_t width, uint32_t height)
15 : Framebuffer(card, width, height)
16{
17
18}
19
20}
diff --git a/kms++/src/omap/omapframebuffer.cpp b/kms++/src/omap/omapframebuffer.cpp
index b27ca22..f33a286 100644
--- a/kms++/src/omap/omapframebuffer.cpp
+++ b/kms++/src/omap/omapframebuffer.cpp
@@ -32,7 +32,7 @@ OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height
32} 32}
33 33
34OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format, Flags flags) 34OmapFramebuffer::OmapFramebuffer(OmapCard& card, uint32_t width, uint32_t height, PixelFormat format, Flags flags)
35 :MappedFramebuffer(card, width, height), m_omap_card(card), m_format(format) 35 :Framebuffer(card, width, height), m_omap_card(card), m_format(format)
36{ 36{
37 Create(flags); 37 Create(flags);
38} 38}
diff --git a/kms++util/inc/kms++util/cpuframebuffer.h b/kms++util/inc/kms++util/cpuframebuffer.h
index 1498528..4273e0d 100644
--- a/kms++util/inc/kms++util/cpuframebuffer.h
+++ b/kms++util/inc/kms++util/cpuframebuffer.h
@@ -5,7 +5,7 @@
5namespace kms 5namespace kms
6{ 6{
7 7
8class CPUFramebuffer : public IMappedFramebuffer { 8class CPUFramebuffer : public IFramebuffer {
9public: 9public:
10 CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format); 10 CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format);
11 11
diff --git a/kms++util/inc/kms++util/extcpuframebuffer.h b/kms++util/inc/kms++util/extcpuframebuffer.h
index 3652ec4..92ca43a 100644
--- a/kms++util/inc/kms++util/extcpuframebuffer.h
+++ b/kms++util/inc/kms++util/extcpuframebuffer.h
@@ -5,7 +5,7 @@
5namespace kms 5namespace kms
6{ 6{
7 7
8class ExtCPUFramebuffer : public IMappedFramebuffer 8class ExtCPUFramebuffer : public IFramebuffer
9{ 9{
10public: 10public:
11 ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format, 11 ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
diff --git a/kms++util/inc/kms++util/kms++util.h b/kms++util/inc/kms++util/kms++util.h
index d45497e..8e45b0d 100644
--- a/kms++util/inc/kms++util/kms++util.h
+++ b/kms++util/inc/kms++util/kms++util.h
@@ -15,18 +15,18 @@
15 15
16namespace kms 16namespace kms
17{ 17{
18class IMappedFramebuffer; 18class IFramebuffer;
19 19
20void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color); 20void draw_rgb_pixel(IFramebuffer& buf, unsigned x, unsigned y, RGB color);
21void draw_yuv422_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2); 21void draw_yuv422_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2);
22void draw_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, 22void draw_yuv420_macropixel(IFramebuffer& buf, unsigned x, unsigned y,
23 YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4); 23 YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4);
24void draw_rect(IMappedFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color); 24void draw_rect(IFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color);
25void draw_text(IMappedFramebuffer& buf, uint32_t x, uint32_t y, const std::string& str, RGB color); 25void draw_text(IFramebuffer& buf, uint32_t x, uint32_t y, const std::string& str, RGB color);
26 26
27void draw_color_bar(IMappedFramebuffer& buf, int old_xpos, int xpos, int width); 27void draw_color_bar(IFramebuffer& buf, int old_xpos, int xpos, int width);
28 28
29void draw_test_pattern(IMappedFramebuffer &fb, YUVType yuvt = YUVType::BT601_Lim); 29void draw_test_pattern(IFramebuffer &fb, YUVType yuvt = YUVType::BT601_Lim);
30} 30}
31 31
32#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 32#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
diff --git a/kms++util/src/colorbar.cpp b/kms++util/src/colorbar.cpp
index e2d257b..c08ed9d 100644
--- a/kms++util/src/colorbar.cpp
+++ b/kms++util/src/colorbar.cpp
@@ -35,7 +35,7 @@ static const uint16_t colors16[] = {
35 colors32[11].rgb565(), 35 colors32[11].rgb565(),
36}; 36};
37 37
38static void drm_draw_color_bar_rgb888(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) 38static void drm_draw_color_bar_rgb888(IFramebuffer& buf, int old_xpos, int xpos, int width)
39{ 39{
40 for (unsigned y = 0; y < buf.height(); ++y) { 40 for (unsigned y = 0; y < buf.height(); ++y) {
41 RGB bcol = colors32[y * ARRAY_SIZE(colors32) / buf.height()]; 41 RGB bcol = colors32[y * ARRAY_SIZE(colors32) / buf.height()];
@@ -51,7 +51,7 @@ static void drm_draw_color_bar_rgb888(IMappedFramebuffer& buf, int old_xpos, int
51 } 51 }
52} 52}
53 53
54static void drm_draw_color_bar_rgb565(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) 54static void drm_draw_color_bar_rgb565(IFramebuffer& buf, int old_xpos, int xpos, int width)
55{ 55{
56 static_assert(ARRAY_SIZE(colors32) == ARRAY_SIZE(colors16), "bad colors arrays"); 56 static_assert(ARRAY_SIZE(colors32) == ARRAY_SIZE(colors16), "bad colors arrays");
57 57
@@ -69,7 +69,7 @@ static void drm_draw_color_bar_rgb565(IMappedFramebuffer& buf, int old_xpos, int
69 } 69 }
70} 70}
71 71
72static void drm_draw_color_bar_semiplanar_yuv(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) 72static void drm_draw_color_bar_semiplanar_yuv(IFramebuffer& buf, int old_xpos, int xpos, int width)
73{ 73{
74 const uint8_t colors[] = { 74 const uint8_t colors[] = {
75 0xff, 75 0xff,
@@ -97,7 +97,7 @@ static void drm_draw_color_bar_semiplanar_yuv(IMappedFramebuffer& buf, int old_x
97 } 97 }
98} 98}
99 99
100void draw_color_bar(IMappedFramebuffer& buf, int old_xpos, int xpos, int width) 100void draw_color_bar(IFramebuffer& buf, int old_xpos, int xpos, int width)
101{ 101{
102 switch (buf.format()) { 102 switch (buf.format()) {
103 case PixelFormat::NV12: 103 case PixelFormat::NV12:
diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp
index ffb7feb..a187dc0 100644
--- a/kms++util/src/drawing.cpp
+++ b/kms++util/src/drawing.cpp
@@ -6,7 +6,7 @@ using namespace std;
6 6
7namespace kms 7namespace kms
8{ 8{
9void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color) 9void draw_rgb_pixel(IFramebuffer& buf, unsigned x, unsigned y, RGB color)
10{ 10{
11 switch (buf.format()) { 11 switch (buf.format()) {
12 case PixelFormat::XRGB8888: 12 case PixelFormat::XRGB8888:
@@ -56,7 +56,7 @@ void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color)
56 } 56 }
57} 57}
58 58
59void draw_yuv422_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2) 59void draw_yuv422_macropixel(IFramebuffer& buf, unsigned x, unsigned y, YUV yuv1, YUV yuv2)
60{ 60{
61 ASSERT((x & 1) == 0); 61 ASSERT((x & 1) == 0);
62 62
@@ -101,7 +101,7 @@ void draw_yuv422_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, YUV
101 } 101 }
102} 102}
103 103
104void draw_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y, 104void draw_yuv420_macropixel(IFramebuffer& buf, unsigned x, unsigned y,
105 YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4) 105 YUV yuv1, YUV yuv2, YUV yuv3, YUV yuv4)
106{ 106{
107 ASSERT((x & 1) == 0); 107 ASSERT((x & 1) == 0);
@@ -143,7 +143,7 @@ void draw_yuv420_macropixel(IMappedFramebuffer& buf, unsigned x, unsigned y,
143 } 143 }
144} 144}
145 145
146void draw_rect(IMappedFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) 146void draw_rect(IFramebuffer &fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color)
147{ 147{
148 unsigned i, j; 148 unsigned i, j;
149 YUV yuvcolor = color.yuv(); 149 YUV yuvcolor = color.yuv();
@@ -199,7 +199,7 @@ static bool get_char_pixel(char c, uint32_t x, uint32_t y)
199 return bit; 199 return bit;
200} 200}
201 201
202static void draw_char(IMappedFramebuffer& buf, uint32_t xpos, uint32_t ypos, char c, RGB color) 202static void draw_char(IFramebuffer& buf, uint32_t xpos, uint32_t ypos, char c, RGB color)
203{ 203{
204 unsigned x, y; 204 unsigned x, y;
205 YUV yuvcolor = color.yuv(); 205 YUV yuvcolor = color.yuv();
@@ -257,7 +257,7 @@ static void draw_char(IMappedFramebuffer& buf, uint32_t xpos, uint32_t ypos, cha
257 } 257 }
258} 258}
259 259
260void draw_text(IMappedFramebuffer& buf, uint32_t x, uint32_t y, const string& str, RGB color) 260void draw_text(IFramebuffer& buf, uint32_t x, uint32_t y, const string& str, RGB color)
261{ 261{
262 for(unsigned i = 0; i < str.size(); i++) 262 for(unsigned i = 0; i < str.size(); i++)
263 draw_char(buf, (x + 8 * i), y, str[i], color); 263 draw_char(buf, (x + 8 * i), y, str[i], color);
diff --git a/kms++util/src/testpat.cpp b/kms++util/src/testpat.cpp
index faacda3..cf43d00 100644
--- a/kms++util/src/testpat.cpp
+++ b/kms++util/src/testpat.cpp
@@ -13,7 +13,7 @@ using namespace std;
13namespace kms 13namespace kms
14{ 14{
15 15
16static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y) 16static RGB get_test_pattern_pixel(IFramebuffer& fb, unsigned x, unsigned y)
17{ 17{
18 const unsigned w = fb.width(); 18 const unsigned w = fb.width();
19 const unsigned h = fb.height(); 19 const unsigned h = fb.height();
@@ -97,7 +97,7 @@ static RGB get_test_pattern_pixel(IMappedFramebuffer& fb, unsigned x, unsigned y
97 } 97 }
98} 98}
99 99
100static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, unsigned end_y, YUVType yuvt) 100static void draw_test_pattern_part(IFramebuffer& fb, unsigned start_y, unsigned end_y, YUVType yuvt)
101{ 101{
102 unsigned x, y; 102 unsigned x, y;
103 unsigned w = fb.width(); 103 unsigned w = fb.width();
@@ -151,7 +151,7 @@ static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, uns
151 } 151 }
152} 152}
153 153
154static void draw_test_pattern_impl(IMappedFramebuffer& fb, YUVType yuvt) 154static void draw_test_pattern_impl(IFramebuffer& fb, YUVType yuvt)
155{ 155{
156 if (fb.height() < 20) { 156 if (fb.height() < 20) {
157 draw_test_pattern_part(fb, 0, fb.height(), yuvt); 157 draw_test_pattern_part(fb, 0, fb.height(), yuvt);
@@ -181,7 +181,7 @@ static void draw_test_pattern_impl(IMappedFramebuffer& fb, YUVType yuvt)
181 t.join(); 181 t.join();
182} 182}
183 183
184void draw_test_pattern(IMappedFramebuffer &fb, YUVType yuvt) 184void draw_test_pattern(IFramebuffer &fb, YUVType yuvt)
185{ 185{
186#ifdef DRAW_PERF_PRINT 186#ifdef DRAW_PERF_PRINT
187 Stopwatch sw; 187 Stopwatch sw;
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index e53fe54..258167a 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -102,12 +102,12 @@ void init_pykmsbase(py::module &m)
102 py::class_<Framebuffer>(m, "Framebuffer", py::base<DrmObject>()) 102 py::class_<Framebuffer>(m, "Framebuffer", py::base<DrmObject>())
103 ; 103 ;
104 104
105 py::class_<MappedFramebuffer>(m, "MappedFramebuffer", py::base<Framebuffer>()) 105 py::class_<Framebuffer>(m, "Framebuffer", py::base<Framebuffer>())
106 .def_property_readonly("width", &MappedFramebuffer::width) 106 .def_property_readonly("width", &Framebuffer::width)
107 .def_property_readonly("height", &MappedFramebuffer::height) 107 .def_property_readonly("height", &Framebuffer::height)
108 ; 108 ;
109 109
110 py::class_<DumbFramebuffer>(m, "DumbFramebuffer", py::base<MappedFramebuffer>()) 110 py::class_<DumbFramebuffer>(m, "DumbFramebuffer", py::base<Framebuffer>())
111 .def(py::init<Card&, uint32_t, uint32_t, const string&>(), 111 .def(py::init<Card&, uint32_t, uint32_t, const string&>(),
112 py::keep_alive<1, 2>()) // Keep Card alive until this is destructed 112 py::keep_alive<1, 2>()) // Keep Card alive until this is destructed
113 .def(py::init<Card&, uint32_t, uint32_t, PixelFormat>(), 113 .def(py::init<Card&, uint32_t, uint32_t, PixelFormat>(),
@@ -119,7 +119,7 @@ void init_pykmsbase(py::module &m)
119 .def("offset", &DumbFramebuffer::offset) 119 .def("offset", &DumbFramebuffer::offset)
120 ; 120 ;
121 121
122 py::class_<ExtFramebuffer>(m, "ExtFramebuffer", py::base<MappedFramebuffer>()) 122 py::class_<ExtFramebuffer>(m, "ExtFramebuffer", py::base<Framebuffer>())
123 .def(py::init<Card&, uint32_t, uint32_t, PixelFormat, vector<int>, vector<uint32_t>, vector<uint32_t>>(), 123 .def(py::init<Card&, uint32_t, uint32_t, PixelFormat, vector<int>, vector<uint32_t>, vector<uint32_t>>(),
124 py::keep_alive<1, 2>()) // Keep Card alive until this is destructed 124 py::keep_alive<1, 2>()) // Keep Card alive until this is destructed
125 ; 125 ;
diff --git a/py/pykms/pykmsomap.cpp b/py/pykms/pykmsomap.cpp
index 0c3a8ee..2662a18 100644
--- a/py/pykms/pykmsomap.cpp
+++ b/py/pykms/pykmsomap.cpp
@@ -14,7 +14,7 @@ void init_pykmsomap(py::module &m)
14 .def(py::init<>()) 14 .def(py::init<>())
15 ; 15 ;
16 16
17 py::class_<OmapFramebuffer> omapfb(m, "OmapFramebuffer", py::base<MappedFramebuffer>()); 17 py::class_<OmapFramebuffer> omapfb(m, "OmapFramebuffer", py::base<Framebuffer>());
18 18
19 // XXX we should use py::arithmetic() here to support or and and operators, but it's not supported in the pybind11 we use 19 // XXX we should use py::arithmetic() here to support or and and operators, but it's not supported in the pybind11 we use
20 py::enum_<OmapFramebuffer::Flags>(omapfb, "Flags") 20 py::enum_<OmapFramebuffer::Flags>(omapfb, "Flags")
diff --git a/py/pykms/pykmsutil.cpp b/py/pykms/pykmsutil.cpp
index a5a6041..10dee81 100644
--- a/py/pykms/pykmsutil.cpp
+++ b/py/pykms/pykmsutil.cpp
@@ -47,16 +47,16 @@ void init_pykmstest(py::module &m)
47 .value("BT709_Full", YUVType::BT709_Full) 47 .value("BT709_Full", YUVType::BT709_Full)
48 ; 48 ;
49 49
50 // Use lambdas to handle IMappedFramebuffer 50 // Use lambdas to handle IFramebuffer
51 m.def("draw_test_pattern", [](MappedFramebuffer& fb, YUVType yuvt) { draw_test_pattern(fb, yuvt); }, 51 m.def("draw_test_pattern", [](Framebuffer& fb, YUVType yuvt) { draw_test_pattern(fb, yuvt); },
52 py::arg("fb"), 52 py::arg("fb"),
53 py::arg("yuvt") = YUVType::BT601_Lim); 53 py::arg("yuvt") = YUVType::BT601_Lim);
54 m.def("draw_color_bar", [](MappedFramebuffer& fb, int old_xpos, int xpos, int width) { 54 m.def("draw_color_bar", [](Framebuffer& fb, int old_xpos, int xpos, int width) {
55 draw_color_bar(fb, old_xpos, xpos, width); 55 draw_color_bar(fb, old_xpos, xpos, width);
56 } ); 56 } );
57 m.def("draw_rect", [](MappedFramebuffer& fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) { 57 m.def("draw_rect", [](Framebuffer& fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) {
58 draw_rect(fb, x, y, w, h, color); 58 draw_rect(fb, x, y, w, h, color);
59 } ); 59 } );
60 m.def("draw_text", [](MappedFramebuffer& fb, uint32_t x, uint32_t y, const string& str, RGB color) { 60 m.def("draw_text", [](Framebuffer& fb, uint32_t x, uint32_t y, const string& str, RGB color) {
61 draw_text(fb, x, y, str, color); } ); 61 draw_text(fb, x, y, str, color); } );
62} 62}
diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp
index ba7d790..63b7d44 100644
--- a/utils/kmstest.cpp
+++ b/utils/kmstest.cpp
@@ -30,7 +30,7 @@ struct PlaneInfo
30 unsigned view_w; 30 unsigned view_w;
31 unsigned view_h; 31 unsigned view_h;
32 32
33 vector<MappedFramebuffer*> fbs; 33 vector<Framebuffer*> fbs;
34}; 34};
35 35
36struct OutputInfo 36struct OutputInfo
@@ -41,7 +41,7 @@ struct OutputInfo
41 Plane* primary_plane; 41 Plane* primary_plane;
42 Videomode mode; 42 Videomode mode;
43 bool user_set_crtc; 43 bool user_set_crtc;
44 vector<MappedFramebuffer*> fbs; 44 vector<Framebuffer*> fbs;
45 45
46 vector<PlaneInfo> planes; 46 vector<PlaneInfo> planes;
47}; 47};
@@ -288,9 +288,9 @@ static void parse_plane(Card& card, const string& plane_str, const OutputInfo& o
288 pinfo.y = output.mode.vdisplay / 2 - pinfo.h / 2; 288 pinfo.y = output.mode.vdisplay / 2 - pinfo.h / 2;
289} 289}
290 290
291static vector<MappedFramebuffer*> get_default_fb(Card& card, unsigned width, unsigned height) 291static vector<Framebuffer*> get_default_fb(Card& card, unsigned width, unsigned height)
292{ 292{
293 vector<MappedFramebuffer*> v; 293 vector<Framebuffer*> v;
294 294
295 for (unsigned i = 0; i < s_num_buffers; ++i) 295 for (unsigned i = 0; i < s_num_buffers; ++i)
296 v.push_back(new DumbFramebuffer(card, width, height, PixelFormat::XRGB8888)); 296 v.push_back(new DumbFramebuffer(card, width, height, PixelFormat::XRGB8888));
@@ -298,7 +298,7 @@ static vector<MappedFramebuffer*> get_default_fb(Card& card, unsigned width, uns
298 return v; 298 return v;
299} 299}
300 300
301static vector<MappedFramebuffer*> parse_fb(Card& card, const string& fb_str, unsigned def_w, unsigned def_h) 301static vector<Framebuffer*> parse_fb(Card& card, const string& fb_str, unsigned def_w, unsigned def_h)
302{ 302{
303 unsigned w = def_w; 303 unsigned w = def_w;
304 unsigned h = def_h; 304 unsigned h = def_h;
@@ -323,7 +323,7 @@ static vector<MappedFramebuffer*> parse_fb(Card& card, const string& fb_str, uns
323 format = FourCCToPixelFormat(sm[3]); 323 format = FourCCToPixelFormat(sm[3]);
324 } 324 }
325 325
326 vector<MappedFramebuffer*> v; 326 vector<Framebuffer*> v;
327 327
328 for (unsigned i = 0; i < s_num_buffers; ++i) 328 for (unsigned i = 0; i < s_num_buffers; ++i)
329 v.push_back(new DumbFramebuffer(card, w, h, format)); 329 v.push_back(new DumbFramebuffer(card, w, h, format));
@@ -883,12 +883,12 @@ private:
883 queue_next(); 883 queue_next();
884 } 884 }
885 885
886 static unsigned get_bar_pos(MappedFramebuffer* fb, unsigned frame_num) 886 static unsigned get_bar_pos(Framebuffer* fb, unsigned frame_num)
887 { 887 {
888 return (frame_num * bar_speed) % (fb->width() - bar_width + 1); 888 return (frame_num * bar_speed) % (fb->width() - bar_width + 1);
889 } 889 }
890 890
891 static void draw_bar(MappedFramebuffer* fb, unsigned frame_num) 891 static void draw_bar(Framebuffer* fb, unsigned frame_num)
892 { 892 {
893 int old_xpos = frame_num < s_num_buffers ? -1 : get_bar_pos(fb, frame_num - s_num_buffers); 893 int old_xpos = frame_num < s_num_buffers ? -1 : get_bar_pos(fb, frame_num - s_num_buffers);
894 int new_xpos = get_bar_pos(fb, frame_num); 894 int new_xpos = get_bar_pos(fb, frame_num);