summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-01-12 14:54:26 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-01-12 14:54:26 +0200
commit34c6166a36b8169f7f96c2b07eb0af6fff837ffe (patch)
treea73ca3ae18e6da1db2d29749c1542b36ca2ae7b2 /tests
parent7a5b08df7826a0c5070bc473eb51854e853c7220 (diff)
testpat: show video mode Hz
Diffstat (limited to 'tests')
-rw-r--r--tests/testpat.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/testpat.cpp b/tests/testpat.cpp
index 56ad7a5..37e19b1 100644
--- a/tests/testpat.cpp
+++ b/tests/testpat.cpp
@@ -476,24 +476,25 @@ static vector<OutputInfo> setups_to_outputs(Card& card, const vector<Arg>& outpu
static std::string videomode_to_string(const Videomode& mode)
{
- unsigned hfp, hsw, hbp;
- unsigned vfp, vsw, vbp;
+ unsigned hfp = mode.hsync_start - mode.hdisplay;
+ unsigned hsw = mode.hsync_end - mode.hsync_start;
+ unsigned hbp = mode.htotal - mode.hsync_end;
- hfp = mode.hsync_start - mode.hdisplay;
- hsw = mode.hsync_end - mode.hsync_start;
- hbp = mode.htotal - mode.hsync_end;
+ unsigned vfp = mode.vsync_start - mode.vdisplay;
+ unsigned vsw = mode.vsync_end - mode.vsync_start;
+ unsigned vbp = mode.vtotal - mode.vsync_end;
- vfp = mode.vsync_start - mode.vdisplay;
- vsw = mode.vsync_end - mode.vsync_start;
- vbp = mode.vtotal - mode.vsync_end;
+ float hz = (mode.clock * 1000.0) / (mode.htotal * mode.vtotal);
+ if (mode.flags & (1<<4)) // XXX interlace
+ hz *= 2;
char buf[256];
- sprintf(buf, "%.2f MHz %u/%u/%u/%u %u/%u/%u/%u %uHz",
+ sprintf(buf, "%.2f MHz %u/%u/%u/%u %u/%u/%u/%u %uHz (%.2fHz)",
mode.clock / 1000.0,
mode.hdisplay, hfp, hsw, hbp,
mode.vdisplay, vfp, vsw, vbp,
- mode.vrefresh);
+ mode.vrefresh, hz);
return std::string(buf);
}