AtomicReq: add add_display() helper
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Sun, 14 Aug 2016 08:10:34 +0000 (11:10 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 15 Aug 2016 11:42:55 +0000 (14:42 +0300)
kms++/inc/kms++/atomicreq.h
kms++/src/atomicreq.cpp

index a9f779d8565682c7d136d6ae394d6a3fc6aa4f3d..a678b549ea35b2b4980a2f2b9f2e350e32b573eb 100644 (file)
@@ -24,6 +24,9 @@ public:
        void add(DrmPropObject *ob, const std::string& prop, uint64_t value);
        void add(DrmPropObject *ob, const std::map<std::string, uint64_t>& values);
 
+       void add_display(Connector* conn, Crtc* crtc, Blob* videomode,
+                        Plane* primary, Framebuffer* fb);
+
        int test(bool allow_modeset = false);
        int commit(void* data, bool allow_modeset = false);
        int commit_sync(bool allow_modeset = false);
index f2809afefeea14383fd26c64ec4628ec3c988538..28128f238729cb559e532163ca560d0c10ced8cd 100644 (file)
@@ -60,6 +60,31 @@ void AtomicReq::add(kms::DrmPropObject* ob, const map<string, uint64_t>& values)
                add(ob, kvp.first, kvp.second);
 }
 
+void AtomicReq::add_display(Connector* conn, Crtc* crtc, Blob* videomode, Plane* primary, Framebuffer* fb)
+{
+       add(conn, {
+                   { "CRTC_ID", crtc->id() },
+           });
+
+       add(crtc, {
+                   { "ACTIVE", 1 },
+                   { "MODE_ID", videomode->id() },
+           });
+
+       add(primary, {
+                   { "FB_ID", fb->id() },
+                   { "CRTC_ID", crtc->id() },
+                   { "SRC_X", 0 << 16 },
+                   { "SRC_Y", 0 << 16 },
+                   { "SRC_W", fb->width() << 16 },
+                   { "SRC_H", fb->height() << 16 },
+                   { "CRTC_X", 0 },
+                   { "CRTC_Y", 0 },
+                   { "CRTC_W", fb->width() },
+                   { "CRTC_H", fb->height() },
+           });
+}
+
 int AtomicReq::test(bool allow_modeset)
 {
        uint32_t flags = DRM_MODE_ATOMIC_TEST_ONLY;