[Intel-gfx] [RFC 4/7] drm: add wanted_seq to drm_vblank_wait_item

Paulo Zanoni przanoni at gmail.com
Wed Nov 19 20:47:12 CET 2014


From: Paulo Zanoni <paulo.r.zanoni at intel.com>

Store the wanted sequence in the wait_item instead of storing it in
the event structure that is eventually going to be sent to user space.
The plan is to make Kernel vblank wait items not have the user space
event, so we need to store the wanted sequence number somewhere.

It is not a problem that we're not filling e->event.sequence inside
drm_queue_vblank_event: we set the value again inside
send_vblank_event().

Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
 drivers/gpu/drm/drm_irq.c | 8 ++++----
 include/drm/drmP.h        | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 7dcbbdb..a82e5ca 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1173,7 +1173,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc)
 			continue;
 		DRM_DEBUG("Sending premature vblank event on disable: \
 			  wanted %d, current %d\n",
-			  e->event.sequence, seq);
+			  e->item.wanted_seq, seq);
 		list_del(&e->base.link);
 		drm_vblank_put(dev, e->item.pipe);
 		drm_wait_vblank_callback(dev, e, seq, &now, true);
@@ -1469,7 +1469,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
 	trace_drm_vblank_event_queued(current->pid, pipe,
 				      vblwait->request.sequence);
 
-	e->event.sequence = vblwait->request.sequence;
+	e->item.wanted_seq = vblwait->request.sequence;
 	if ((seq - vblwait->request.sequence) <= (1 << 23)) {
 		drm_vblank_put(dev, pipe);
 		drm_wait_vblank_callback(dev, e, seq, &now, false);
@@ -1646,11 +1646,11 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc)
 	list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) {
 		if (e->item.pipe != crtc)
 			continue;
-		if ((seq - e->event.sequence) > (1<<23))
+		if ((seq - e->item.wanted_seq) > (1<<23))
 			continue;
 
 		DRM_DEBUG("vblank event on %d, current %d\n",
-			  e->event.sequence, seq);
+			  e->item.wanted_seq, seq);
 
 		list_del(&e->base.link);
 		drm_vblank_put(dev, e->item.pipe);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b8bc55a..dcec05b 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -667,6 +667,7 @@ typedef void (*drm_vblank_callback_t)(struct drm_device *dev,
 
 struct drm_vblank_wait_item {
 	int pipe;
+	unsigned int wanted_seq;
 
 	drm_vblank_callback_t callback;
 	bool callback_from_work;
-- 
2.1.1




More information about the Intel-gfx mailing list