summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/videomode.h2
-rw-r--r--kms++/src/videomode.cpp11
2 files changed, 13 insertions, 0 deletions
diff --git a/kms++/inc/kms++/videomode.h b/kms++/inc/kms++/videomode.h
index 39e5639..d7f5258 100644
--- a/kms++/inc/kms++/videomode.h
+++ b/kms++/inc/kms++/videomode.h
@@ -48,6 +48,8 @@ struct Videomode
void set_interlace(bool ilace);
void set_hsync(SyncPolarity pol);
void set_vsync(SyncPolarity pol);
+
+ std::string to_string() const;
};
struct Videomode videomode_from_timings(uint32_t clock_khz,
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 <xf86drm.h>
#include <xf86drmMode.h>
#include <math.h>
+#include <sstream>
#include <kms++/kms++.h>
#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)