From 9e233836840d9708d32dc5a0b15df631ea274e7a Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 30 May 2016 13:51:49 +0300 Subject: [PATCH] AtomicReq: support 'allow_modeset' --- libkms++/atomicreq.cpp | 15 ++++++++++++--- libkms++/atomicreq.h | 6 +++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libkms++/atomicreq.cpp b/libkms++/atomicreq.cpp index 0d895da..3aa2ff6 100644 --- a/libkms++/atomicreq.cpp +++ b/libkms++/atomicreq.cpp @@ -62,24 +62,33 @@ void AtomicReq::add(DrmObject* ob, const map& values) add(ob, kvp.first, kvp.second); } -int AtomicReq::test() +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) +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() +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); } } diff --git a/libkms++/atomicreq.h b/libkms++/atomicreq.h index 77a9dde..6ebdbf8 100644 --- a/libkms++/atomicreq.h +++ b/libkms++/atomicreq.h @@ -24,9 +24,9 @@ public: void add(DrmObject *ob, const std::string& prop, uint64_t value); void add(DrmObject *ob, const std::map& values); - int test(); - int commit(void* data); - int commit_sync(); + int test(bool allow_modeset = false); + int commit(void* data, bool allow_modeset = false); + int commit_sync(bool allow_modeset = false); private: Card& m_card; -- 2.39.2