aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorTomi Valkeinen2017-10-03 04:32:52 -0500
committerTomi Valkeinen2017-10-03 04:33:11 -0500
commitfab9bb700372008130e5026fa9fe5fd22ac6ec4e (patch)
tree1e83b437762697ab833bd8c22896b8733593ca5f /utils
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.
Diffstat (limited to 'utils')
-rw-r--r--utils/kmstest.cpp16
1 files changed, 8 insertions, 8 deletions
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);