aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart2017-03-10 03:35:24 -0600
committerTomi Valkeinen2017-03-10 07:29:31 -0600
commit5b32d5a203bcd1a82b40f83da91f2cfab7a08349 (patch)
tree20235de3b05d1bd3434e677b748b2a3b6d71ae67
parent84e240f64014f1e27dc1b3769f5ea83046f683d0 (diff)
downloadexternal-libkmsxx-5b32d5a203bcd1a82b40f83da91f2cfab7a08349.tar.gz
external-libkmsxx-5b32d5a203bcd1a82b40f83da91f2cfab7a08349.tar.xz
external-libkmsxx-5b32d5a203bcd1a82b40f83da91f2cfab7a08349.zip
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;
54static bool s_cvt; 54static bool s_cvt;
55static bool s_cvt_v2; 55static bool s_cvt_v2;
56static bool s_cvt_vid_opt; 56static bool s_cvt_vid_opt;
57static unsigned s_max_flips;
57 58
58static set<Crtc*> s_used_crtcs; 59static set<Crtc*> s_used_crtcs;
59static set<Plane*> s_used_planes; 60static set<Plane*> s_used_planes;
@@ -359,7 +360,7 @@ static const char* usage_str =
359 " --dmt Search for the given mode from DMT tables\n" 360 " --dmt Search for the given mode from DMT tables\n"
360 " --cea Search for the given mode from CEA tables\n" 361 " --cea Search for the given mode from CEA tables\n"
361 " --cvt=CVT Create videomode with CVT. CVT is 'v1', 'v2' or 'v2o'\n" 362 " --cvt=CVT Create videomode with CVT. CVT is 'v1', 'v2' or 'v2o'\n"
362 " --flip Do page flipping for each output\n" 363 " --flip[=max] Do page flipping for each output with an optional maximum flips count\n"
363 " --sync Synchronize page flipping\n" 364 " --sync Synchronize page flipping\n"
364 "\n" 365 "\n"
365 "<connector>, <crtc> and <plane> can be given by index (<idx>) or id (<id>).\n" 366 "<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)
443 { 444 {
444 s_use_cea = true; 445 s_use_cea = true;
445 }), 446 }),
446 Option("|flip", []() 447 Option("|flip?", [&](string s)
447 { 448 {
448 s_flip_mode = true; 449 s_flip_mode = true;
449 s_num_buffers = 2; 450 s_num_buffers = 2;
451 if (!s.empty())
452 s_max_flips = stoi(s);
450 }), 453 }),
451 Option("|sync", []() 454 Option("|sync", []()
452 { 455 {
@@ -821,6 +824,8 @@ static void set_crtcs_n_planes(Card& card, const vector<OutputInfo>& outputs)
821 set_crtcs_n_planes_legacy(card, outputs); 824 set_crtcs_n_planes_legacy(card, outputs);
822} 825}
823 826
827static bool max_flips_reached;
828
824class FlipState : private PageFlipHandlerBase 829class FlipState : private PageFlipHandlerBase
825{ 830{
826public: 831public:
@@ -841,6 +846,8 @@ private:
841 void handle_page_flip(uint32_t frame, double time) 846 void handle_page_flip(uint32_t frame, double time)
842 { 847 {
843 m_frame_num++; 848 m_frame_num++;
849 if (s_max_flips && m_frame_num >= s_max_flips)
850 max_flips_reached = true;
844 851
845 auto now = std::chrono::steady_clock::now(); 852 auto now = std::chrono::steady_clock::now();
846 853
@@ -988,7 +995,7 @@ static void main_flip(Card& card, const vector<OutputInfo>& outputs)
988 for (unique_ptr<FlipState>& fs : flipstates) 995 for (unique_ptr<FlipState>& fs : flipstates)
989 fs->start_flipping(); 996 fs->start_flipping();
990 997
991 while (true) { 998 while (!max_flips_reached) {
992 int r; 999 int r;
993 1000
994 FD_SET(0, &fds); 1001 FD_SET(0, &fds);