From 34a3e4916fc076d4a687d96ac4ad4484ad046d6d Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 20 Oct 2017 11:32:18 +0300 Subject: Videomode: add to_string() --- kms++/src/videomode.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'kms++/src') diff --git a/kms++/src/videomode.cpp b/kms++/src/videomode.cpp index 4964a57..b8bd797 100644 --- a/kms++/src/videomode.cpp +++ b/kms++/src/videomode.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "helpers.h" @@ -87,6 +88,16 @@ void Videomode::set_vsync(SyncPolarity pol) } } +string Videomode::to_string() const +{ + std::stringstream ss; + ss << hdisplay << "x" << vdisplay; + if (interlace()) + ss << "i"; + ss << "@" << calculated_vrefresh(); + return ss.str(); +} + Videomode videomode_from_timings(uint32_t clock_khz, uint16_t hact, uint16_t hfp, uint16_t hsw, uint16_t hbp, uint16_t vact, uint16_t vfp, uint16_t vsw, uint16_t vbp) -- cgit v1.2.3