summaryrefslogtreecommitdiff
path: root/kms++/atomicreq.cpp
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-11 21:46:24 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-06-11 21:46:24 +0300
commit9916712a62169606d845510028a3ea6f84bd442f (patch)
treeaca4e1bec39500812111c43a8ecee862edae0002 /kms++/atomicreq.cpp
parent736b295100ce441e800457bcbd08cb36db543ff2 (diff)
kms++: organize into subdirs
Diffstat (limited to 'kms++/atomicreq.cpp')
-rw-r--r--kms++/atomicreq.cpp94
1 files changed, 0 insertions, 94 deletions
diff --git a/kms++/atomicreq.cpp b/kms++/atomicreq.cpp
deleted file mode 100644
index 3aa2ff6..0000000
--- a/kms++/atomicreq.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <cassert>
-#include <stdexcept>
-
-#include <xf86drm.h>
-#include <xf86drmMode.h>
-
-#include "atomicreq.h"
-#include "property.h"
-#include "card.h"
-
-#ifndef DRM_CLIENT_CAP_ATOMIC
-
-#define DRM_MODE_ATOMIC_TEST_ONLY 0
-#define DRM_MODE_ATOMIC_NONBLOCK 0
-
-struct _drmModeAtomicReq;
-typedef struct _drmModeAtomicReq* drmModeAtomicReqPtr;
-
-static inline drmModeAtomicReqPtr drmModeAtomicAlloc() { return 0; }
-static inline void drmModeAtomicFree(drmModeAtomicReqPtr) { }
-static inline int drmModeAtomicAddProperty(drmModeAtomicReqPtr, uint32_t, uint32_t, uint64_t) { return 0; }
-static inline int drmModeAtomicCommit(int, drmModeAtomicReqPtr, int, void*) { return 0; }
-
-#endif // DRM_CLIENT_CAP_ATOMIC
-
-using namespace std;
-
-namespace kms
-{
-AtomicReq::AtomicReq(Card& card)
- : m_card(card)
-{
- assert(card.has_atomic());
- m_req = drmModeAtomicAlloc();
-}
-
-AtomicReq::~AtomicReq()
-{
- drmModeAtomicFree(m_req);
-}
-
-void AtomicReq::add(uint32_t ob_id, uint32_t prop_id, uint64_t value)
-{
- int r = drmModeAtomicAddProperty(m_req, ob_id, prop_id, value);
- if (r <= 0)
- throw std::invalid_argument("foo");
-}
-
-void AtomicReq::add(DrmObject *ob, Property *prop, uint64_t value)
-{
- add(ob->id(), prop->id(), value);
-}
-
-void AtomicReq::add(DrmObject* ob, const string& prop, uint64_t value)
-{
- add(ob, m_card.get_prop(prop), value);
-}
-
-void AtomicReq::add(DrmObject* ob, const map<string, uint64_t>& values)
-{
- for(const auto& kvp : values)
- add(ob, kvp.first, kvp.second);
-}
-
-int AtomicReq::test(bool allow_modeset)
-{
- uint32_t flags = DRM_MODE_ATOMIC_TEST_ONLY;
-
- if (allow_modeset)
- flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
-
- return drmModeAtomicCommit(m_card.fd(), m_req, flags, 0);
-}
-
-int AtomicReq::commit(void* data, bool allow_modeset)
-{
- uint32_t flags = DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
-
- if (allow_modeset)
- flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
-
- return drmModeAtomicCommit(m_card.fd(), m_req, flags, data);
-}
-
-int AtomicReq::commit_sync(bool allow_modeset)
-{
- uint32_t flags = 0;
-
- if (allow_modeset)
- flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
-
- return drmModeAtomicCommit(m_card.fd(), m_req, flags, 0);
-}
-}