public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: [PATCH] drm/i915: Send vblank event when requested in atomic commit.
Date: Tue, 21 Jul 2015 14:05:49 +0200	[thread overview]
Message-ID: <55AE359D.7070506@linux.intel.com> (raw)

This is probably slightly wrong, but better than not sending events.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 82da2c54bd2e..10bb66ec493a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11456,8 +11456,14 @@ retry:
 			drm_atomic_set_fb_for_plane(plane_state, fb);
 
 			ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
-			if (!ret)
-				ret = drm_atomic_commit(state);
+		}
+
+		if (!ret) {
+			struct drm_crtc_state *crtc_state =
+			    drm_atomic_get_existing_crtc_state(state, crtc);
+
+			crtc_state->event = event;
+			ret = drm_atomic_commit(state);
 		}
 
 		if (ret == -EDEADLK) {
@@ -11468,12 +11474,6 @@ retry:
 
 		if (ret)
 			drm_atomic_state_free(state);
-
-		if (ret == 0 && event) {
-			spin_lock_irq(&dev->event_lock);
-			drm_send_vblank_event(dev, pipe, event);
-			spin_unlock_irq(&dev->event_lock);
-		}
 	}
 	return ret;
 }
@@ -13089,6 +13089,14 @@ static int intel_atomic_commit(struct drm_device *dev,
 	drm_atomic_helper_wait_for_vblanks(dev, state);
 	drm_atomic_helper_cleanup_planes(dev, state);
 
+	for_each_crtc_in_state(state, crtc, crtc_state, i)
+		if (crtc->state->event) {
+			spin_lock_irq(&dev->event_lock);
+			drm_crtc_send_vblank_event(dev, crtc, crtc->state->event);
+			crtc->state->event = NULL;
+			spin_unlock_irq(&dev->event_lock);
+		}
+
 	if (any_ms)
 		intel_modeset_check_state(dev, state);
 

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2015-07-21 12:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 12:05 Maarten Lankhorst [this message]
2015-07-21 12:26 ` [PATCH] drm/i915: Send vblank event when requested in atomic commit Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55AE359D.7070506@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox