summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-27 16:31:09 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-27 17:24:14 +0300
commita5db43b30b0e2a58b13548ef27a9b754d04ba492 (patch)
tree1d366489d4e2dd09b163662792d6529c0a93f7c1
parentd17cb8f0e0a71f7f3b1dbd88ccc1349b3723dc1c (diff)
Add Videomode::to_blob()
-rw-r--r--libkms++/blob.h1
-rw-r--r--libkms++/videomode.cpp19
-rw-r--r--libkms++/videomode.h5
3 files changed, 25 insertions, 0 deletions
diff --git a/libkms++/blob.h b/libkms++/blob.h
index c6c230c..fd872f1 100644
--- a/libkms++/blob.h
+++ b/libkms++/blob.h
@@ -1,6 +1,7 @@
#pragma once
#include "drmobject.h"
+#include <vector>
namespace kms
{
diff --git a/libkms++/videomode.cpp b/libkms++/videomode.cpp
new file mode 100644
index 0000000..5c98c00
--- /dev/null
+++ b/libkms++/videomode.cpp
@@ -0,0 +1,19 @@
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+
+#include "videomode.h"
+#include "helpers.h"
+
+using namespace std;
+
+namespace kms
+{
+
+unique_ptr<Blob> Videomode::to_blob(Card& card) const
+{
+ drmModeModeInfo drm_mode = video_mode_to_drm_mode(*this);
+
+ return unique_ptr<Blob>(new Blob(card, &drm_mode, sizeof(drm_mode)));
+}
+
+}
diff --git a/libkms++/videomode.h b/libkms++/videomode.h
index 8bcdc8a..382c1cd 100644
--- a/libkms++/videomode.h
+++ b/libkms++/videomode.h
@@ -2,6 +2,9 @@
#include <string>
#include <cstdint>
+#include <memory>
+
+#include "blob.h"
namespace kms
{
@@ -18,6 +21,8 @@ struct Videomode
uint32_t flags; // DRM_MODE_FLAG_*
uint32_t type; // DRM_MODE_TYPE_*
+
+ std::unique_ptr<Blob> to_blob(Card& card) const;
};
}