Add Videomode::to_blob()
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 27 May 2016 13:31:09 +0000 (16:31 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 27 May 2016 14:24:14 +0000 (17:24 +0300)
libkms++/blob.h
libkms++/videomode.cpp [new file with mode: 0644]
libkms++/videomode.h

index c6c230c171e5bce6d51392ce36ba8e8245e3e85d..fd872f167f322b275bd630e1b471943b6cde675e 100644 (file)
@@ -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 (file)
index 0000000..5c98c00
--- /dev/null
@@ -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)));
+}
+
+}
index 8bcdc8a3646b4d5171aa438cb0d415d71e5a2562..382c1cd98caa93848c6442c4931c19b9335ca16a 100644 (file)
@@ -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;
 };
 
 }