summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/kmstest.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp
index e412f90..d649938 100644
--- a/utils/kmstest.cpp
+++ b/utils/kmstest.cpp
@@ -10,6 +10,7 @@
#include <kms++/kms++.h>
#include <kms++/modedb.h>
#include <kms++/mode_cvt.h>
+#include <kms++/omap/omapkms++.h>
#include <kms++util/kms++util.h>
@@ -49,6 +50,7 @@ struct OutputInfo
static bool s_use_dmt;
static bool s_use_cea;
static unsigned s_num_buffers = 1;
+static bool s_cached_buffers;
static bool s_flip_mode;
static bool s_flip_sync;
static bool s_cvt;
@@ -82,7 +84,7 @@ static void get_connector(ResourceManager& resman, OutputInfo& output, const str
output.mode = output.connector->get_default_mode();
}
-static void get_default_crtc(Card& card, OutputInfo& output)
+static void get_default_crtc(OmapCard& card, OutputInfo& output)
{
Crtc* crtc = output.connector->get_current_crtc();
@@ -103,7 +105,7 @@ static void get_default_crtc(Card& card, OutputInfo& output)
EXIT("Could not find available crtc");
}
-static void parse_crtc(Card& card, const string& crtc_str, OutputInfo& output)
+static void parse_crtc(OmapCard& card, const string& crtc_str, OutputInfo& output)
{
// @12:1920x1200i@60
// @12:33000000,800/210/30/16/-,480/22/13/10/-,i
@@ -228,7 +230,7 @@ static void parse_crtc(Card& card, const string& crtc_str, OutputInfo& output)
}
}
-static void parse_plane(Card& card, const string& plane_str, const OutputInfo& output, PlaneInfo& pinfo)
+static void parse_plane(OmapCard& card, const string& plane_str, const OutputInfo& output, PlaneInfo& pinfo)
{
// 3:400,400-400x400
const regex plane_re("(?:(@?)(\\d+):)?" // 3:
@@ -288,17 +290,17 @@ static void parse_plane(Card& card, const string& plane_str, const OutputInfo& o
pinfo.y = output.mode.vdisplay / 2 - pinfo.h / 2;
}
-static vector<MappedFramebuffer*> get_default_fb(Card& card, unsigned width, unsigned height)
+static vector<MappedFramebuffer*> get_default_fb(OmapCard& card, unsigned width, unsigned height)
{
vector<MappedFramebuffer*> v;
for (unsigned i = 0; i < s_num_buffers; ++i)
- v.push_back(new DumbFramebuffer(card, width, height, PixelFormat::XRGB8888));
+ v.push_back(new OmapFramebuffer(card, width, height, PixelFormat::XRGB8888, s_cached_buffers));
return v;
}
-static vector<MappedFramebuffer*> parse_fb(Card& card, const string& fb_str, unsigned def_w, unsigned def_h)
+static vector<MappedFramebuffer*> parse_fb(OmapCard& card, const string& fb_str, unsigned def_w, unsigned def_h)
{
unsigned w = def_w;
unsigned h = def_h;
@@ -326,7 +328,7 @@ static vector<MappedFramebuffer*> parse_fb(Card& card, const string& fb_str, uns
vector<MappedFramebuffer*> v;
for (unsigned i = 0; i < s_num_buffers; ++i)
- v.push_back(new DumbFramebuffer(card, w, h, format));
+ v.push_back(new OmapFramebuffer(card, w, h, format, s_cached_buffers));
return v;
}
@@ -358,6 +360,7 @@ static const char* usage_str =
" -f, --fb=FB FB is [<w>x<h>][-][<4cc>]\n"
" -v, --view=VIEW VIEW is <x>,<y>-<w>x<h>\n"
" --dmt Search for the given mode from DMT tables\n"
+ " --cached Map framebuffers cached\n"
" --cea Search for the given mode from CEA tables\n"
" --cvt=CVT Create videomode with CVT. CVT is 'v1', 'v2' or 'v2o'\n"
" --flip[=max] Do page flipping for each output with an optional maximum flips count\n"
@@ -468,6 +471,10 @@ static vector<Arg> parse_cmdline(int argc, char **argv)
exit(-1);
}
}),
+ Option("|cached", []()
+ {
+ s_cached_buffers = true;
+ }),
Option("h|help", [&]()
{
usage();
@@ -485,7 +492,7 @@ static vector<Arg> parse_cmdline(int argc, char **argv)
return args;
}
-static vector<OutputInfo> setups_to_outputs(Card& card, ResourceManager& resman, const vector<Arg>& output_args)
+static vector<OutputInfo> setups_to_outputs(OmapCard& card, ResourceManager& resman, const vector<Arg>& output_args)
{
vector<OutputInfo> outputs;
@@ -683,7 +690,7 @@ static void draw_test_patterns(const vector<OutputInfo>& outputs)
}
}
-static void set_crtcs_n_planes_legacy(Card& card, const vector<OutputInfo>& outputs)
+static void set_crtcs_n_planes_legacy(OmapCard& card, const vector<OutputInfo>& outputs)
{
// Disable unused crtcs
for (Crtc* crtc : card.get_crtcs()) {
@@ -717,7 +724,7 @@ static void set_crtcs_n_planes_legacy(Card& card, const vector<OutputInfo>& outp
}
}
-static void set_crtcs_n_planes_atomic(Card& card, const vector<OutputInfo>& outputs)
+static void set_crtcs_n_planes_atomic(OmapCard& card, const vector<OutputInfo>& outputs)
{
int r;
@@ -818,7 +825,7 @@ static void set_crtcs_n_planes_atomic(Card& card, const vector<OutputInfo>& outp
EXIT("Atomic commit failed: %d\n", r);
}
-static void set_crtcs_n_planes(Card& card, const vector<OutputInfo>& outputs)
+static void set_crtcs_n_planes(OmapCard& card, const vector<OutputInfo>& outputs)
{
if (card.has_atomic())
set_crtcs_n_planes_atomic(card, outputs);
@@ -831,7 +838,7 @@ static bool max_flips_reached;
class FlipState : private PageFlipHandlerBase
{
public:
- FlipState(Card& card, const string& name, vector<const OutputInfo*> outputs)
+ FlipState(OmapCard& card, const string& name, vector<const OutputInfo*> outputs)
: m_card(card), m_name(name), m_outputs(outputs)
{
}
@@ -953,7 +960,7 @@ private:
}
}
- Card& m_card;
+ OmapCard& m_card;
string m_name;
vector<const OutputInfo*> m_outputs;
unsigned m_frame_num;
@@ -966,7 +973,7 @@ private:
static const unsigned bar_speed = 8;
};
-static void main_flip(Card& card, const vector<OutputInfo>& outputs)
+static void main_flip(OmapCard& card, const vector<OutputInfo>& outputs)
{
fd_set fds;
@@ -1020,7 +1027,7 @@ int main(int argc, char **argv)
{
vector<Arg> output_args = parse_cmdline(argc, argv);
- Card card(s_device_path);
+ OmapCard card(s_device_path);
if (!card.has_atomic() && s_flip_sync)
EXIT("Synchronized flipping requires atomic modesetting");