summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2016-04-25 16:41:36 -0400
committerRobert Foss <robert.foss@collabora.com>2016-04-26 13:28:48 -0400
commit0f5d2b5aaa1f0d3958a67aaabe91965ee0f06116 (patch)
treea3e4ce782e2a4611a5d24bb700ef6778f79dfc0b
parentbcc981e9ed84c678533299d7eff17d2c81e4d5de (diff)
downloadlinux-vc4_ebusy_on_pending_update.tar.gz
linux-vc4_ebusy_on_pending_update.tar.xz
drm/vc4: Return -EBUSY on concurrent pageflips.vc4_ebusy_on_pending_update
As per the docs, atomic_commit should return -EBUSY "if an asycnhronous update is requested and there is an earlier update pending". Signed-off-by: Robert Foss <robert.foss@collabora.com>
-rw-r--r--drivers/gpu/drm/vc4/vc4_crtc.c5
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.h1
-rw-r--r--drivers/gpu/drm/vc4/vc4_kms.c20
3 files changed, 24 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 355ee4b..36b1558 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -802,3 +802,8 @@ struct platform_driver vc4_crtc_driver = {
.of_match_table = vc4_crtc_dt_match,
},
};
+
+bool vc4_crtc_has_pending_event(struct drm_crtc *crtc)
+{
+ return to_vc4_crtc(crtc)->event;
+}
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index fa2ad15..54c1fb5 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -414,6 +414,7 @@ extern struct platform_driver vc4_crtc_driver;
int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id);
void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id);
int vc4_crtc_debugfs_regs(struct seq_file *m, void *arg);
+bool vc4_crtc_has_pending_event(struct drm_crtc *crtc);
/* vc4_debugfs.c */
int vc4_debugfs_init(struct drm_minor *minor);
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 4718ae5..dc157a1e 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -107,10 +107,26 @@ static int vc4_atomic_commit(struct drm_device *dev,
bool async)
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
- int ret;
- int i;
uint64_t wait_seqno = 0;
struct vc4_commit *c;
+ struct drm_crtc_state *crtc_state;
+ struct drm_crtc *crtc;
+ unsigned long flags;
+ int i, ret;
+
+ if (async) {
+ for_each_crtc_in_state(state, crtc, crtc_state, i) {
+
+ spin_lock_irqsave(&dev->event_lock, flags);
+
+ if (crtc->state->event ||
+ vc4_crtc_has_pending_event(crtc)) {
+ spin_unlock_irqrestore(&dev->event_lock, flags);
+ return -EBUSY;
+ }
+ spin_unlock_irqrestore(&dev->event_lock, flags);
+ }
+ }
c = commit_init(state);
if (!c)