summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2020-05-15 11:08:03 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2020-05-15 11:13:30 +0300
commit36f42004d8f084775efd92a559996ecaeefb0cda (patch)
tree559c511227dd744f9fd83896618b568c58882156 /kms++
parent4091a630137400dfac389215a7ec8c43b191ec5f (diff)
kmstest: allow enabling output without anything connected
Allow kmstest to enable an output without anything connected, if the user gives a videomode. DRM framework allows this, and is needed for testing. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/videomode.h2
-rw-r--r--kms++/src/connector.cpp3
-rw-r--r--kms++/src/videomode.cpp5
3 files changed, 9 insertions, 1 deletions
diff --git a/kms++/inc/kms++/videomode.h b/kms++/inc/kms++/videomode.h
index 74aa8f1..3aacd57 100644
--- a/kms++/inc/kms++/videomode.h
+++ b/kms++/inc/kms++/videomode.h
@@ -52,6 +52,8 @@ struct Videomode
std::string to_string_short() const;
std::string to_string_long() const;
std::string to_string_long_padded() const;
+
+ bool valid() const;
};
struct Videomode videomode_from_timings(uint32_t clock_khz,
diff --git a/kms++/src/connector.cpp b/kms++/src/connector.cpp
index 72f8777..a408619 100644
--- a/kms++/src/connector.cpp
+++ b/kms++/src/connector.cpp
@@ -120,7 +120,8 @@ void Connector::restore_mode()
Videomode Connector::get_default_mode() const
{
if (m_priv->drm_connector->count_modes == 0)
- throw invalid_argument("no modes available\n");
+ return Videomode();
+
drmModeModeInfo drmmode = m_priv->drm_connector->modes[0];
return drm_mode_to_video_mode(drmmode);
diff --git a/kms++/src/videomode.cpp b/kms++/src/videomode.cpp
index b53f0c0..066896f 100644
--- a/kms++/src/videomode.cpp
+++ b/kms++/src/videomode.cpp
@@ -12,6 +12,11 @@ using namespace std;
namespace kms
{
+bool Videomode::valid() const
+{
+ return !!clock;
+}
+
unique_ptr<Blob> Videomode::to_blob(Card& card) const
{
drmModeModeInfo drm_mode = video_mode_to_drm_mode(*this);