summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
};
}