summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kmscube/cube-gbm.cpp52
1 files changed, 19 insertions, 33 deletions
diff --git a/kmscube/cube-gbm.cpp b/kmscube/cube-gbm.cpp
index 07413ab..980352c 100644
--- a/kmscube/cube-gbm.cpp
+++ b/kmscube/cube-gbm.cpp
@@ -219,19 +219,17 @@ public:
ret = m_crtc->set_mode(m_connector, *fb, m_mode);
FAIL_IF(ret, "failed to set mode");
- if (m_crtc->card().has_atomic()) {
- Plane* root_plane = 0;
- for (Plane* p : m_crtc->get_possible_planes()) {
- if (p->crtc_id() == m_crtc->id()) {
- root_plane = p;
- break;
- }
+ Plane* root_plane = 0;
+ for (Plane* p : m_crtc->get_possible_planes()) {
+ if (p->crtc_id() == m_crtc->id()) {
+ root_plane = p;
+ break;
}
+ }
- FAIL_IF(!root_plane, "No primary plane for crtc %d", m_crtc->id());
+ FAIL_IF(!root_plane, "No primary plane for crtc %d", m_crtc->id());
- m_root_plane = root_plane;
- }
+ m_root_plane = root_plane;
if (m_plane) {
ret = m_crtc->set_plane(m_plane, *planefb,
@@ -287,33 +285,19 @@ private:
planefb = m_surface2->lock_next();
}
- if (m_crtc->card().has_atomic()) {
- int r;
-
- AtomicReq req(m_crtc->card());
-
- req.add(m_root_plane, "FB_ID", fb->id());
- if (m_plane)
- req.add(m_plane, "FB_ID", planefb->id());
+ int r;
- r = req.test();
- FAIL_IF(r, "atomic test failed");
+ AtomicReq req(m_crtc->card());
- r = req.commit(this);
- FAIL_IF(r, "atomic commit failed");
- } else {
- int ret;
+ req.add(m_root_plane, "FB_ID", fb->id());
+ if (m_plane)
+ req.add(m_plane, "FB_ID", planefb->id());
- ret = m_crtc->page_flip(*fb, this);
- FAIL_IF(ret, "failed to queue page flip");
+ r = req.test();
+ FAIL_IF(r, "atomic test failed");
- if (m_plane) {
- ret = m_crtc->set_plane(m_plane, *planefb,
- 0, 0, planefb->width(), planefb->height(),
- 0, 0, planefb->width(), planefb->height());
- FAIL_IF(ret, "failed to set plane");
- }
- }
+ r = req.commit(this);
+ FAIL_IF(r, "atomic commit failed");
s_flip_pending++;
}
@@ -340,6 +324,8 @@ void main_gbm()
{
Card card;
+ FAIL_IF(!card.has_atomic(), "No atomic modesetting");
+
GbmDevice gdev(card);
EglState egl(gdev.handle());