summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-03-10 11:35:24 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-03-10 15:29:31 +0200
commit5b32d5a203bcd1a82b40f83da91f2cfab7a08349 (patch)
tree20235de3b05d1bd3434e677b748b2a3b6d71ae67
parent84e240f64014f1e27dc1b3769f5ea83046f683d0 (diff)
kmstest: Add optional argument to the flip option to limit the flips
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--utils/kmstest.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp
index cd0fc1a..32dcb69 100644
--- a/utils/kmstest.cpp
+++ b/utils/kmstest.cpp
@@ -54,6 +54,7 @@ static bool s_flip_sync;
static bool s_cvt;
static bool s_cvt_v2;
static bool s_cvt_vid_opt;
+static unsigned s_max_flips;
static set<Crtc*> s_used_crtcs;
static set<Plane*> s_used_planes;
@@ -359,7 +360,7 @@ static const char* usage_str =
" --dmt Search for the given mode from DMT tables\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 Do page flipping for each output\n"
+ " --flip[=max] Do page flipping for each output with an optional maximum flips count\n"
" --sync Synchronize page flipping\n"
"\n"
"<connector>, <crtc> and <plane> can be given by index (<idx>) or id (<id>).\n"
@@ -443,10 +444,12 @@ static vector<Arg> parse_cmdline(int argc, char **argv)
{
s_use_cea = true;
}),
- Option("|flip", []()
+ Option("|flip?", [&](string s)
{
s_flip_mode = true;
s_num_buffers = 2;
+ if (!s.empty())
+ s_max_flips = stoi(s);
}),
Option("|sync", []()
{
@@ -821,6 +824,8 @@ static void set_crtcs_n_planes(Card& card, const vector<OutputInfo>& outputs)
set_crtcs_n_planes_legacy(card, outputs);
}
+static bool max_flips_reached;
+
class FlipState : private PageFlipHandlerBase
{
public:
@@ -841,6 +846,8 @@ private:
void handle_page_flip(uint32_t frame, double time)
{
m_frame_num++;
+ if (s_max_flips && m_frame_num >= s_max_flips)
+ max_flips_reached = true;
auto now = std::chrono::steady_clock::now();
@@ -988,7 +995,7 @@ static void main_flip(Card& card, const vector<OutputInfo>& outputs)
for (unique_ptr<FlipState>& fs : flipstates)
fs->start_flipping();
- while (true) {
+ while (!max_flips_reached) {
int r;
FD_SET(0, &fds);