linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2
@ 2016-06-06 14:41 Gustavo Padovan
  2016-06-06 14:41 ` [PATCH RESEND 02/14] drm/armada: use drm_crtc_send_vblank_event() Gustavo Padovan
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Mario Kleiner, Ben Skeggs, David Airlie,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_send_vblank_event() with the new helper function.

v2: add crtc to nouveau_page_flip_state (comment from Mario Kleiner)

Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/nouveau/nouveau_display.c | 19 ++++++++++---------
 drivers/gpu/drm/nouveau/nouveau_display.h |  3 ++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 7c77f96..9d72467 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -760,8 +760,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 
 	/* Initialize a page flip struct */
 	*s = (struct nouveau_page_flip_state)
-		{ { }, event, nouveau_crtc(crtc)->index,
-		  fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y,
+		{ { }, event, crtc, fb->bits_per_pixel, fb->pitches[0],
 		  new_bo->bo.offset };
 
 	/* Keep vblanks on during flip, for the target crtc of this flip */
@@ -842,17 +841,18 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
 	s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
 	if (s->event) {
 		if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
-			drm_arm_vblank_event(dev, s->crtc, s->event);
+			drm_arm_vblank_event(dev, drm_crtc_index(s->crtc),
+					     s->event);
 		} else {
-			drm_send_vblank_event(dev, s->crtc, s->event);
+			drm_crtc_send_vblank_event(s->crtc, s->event);
 
 			/* Give up ownership of vblank for page-flipped crtc */
-			drm_vblank_put(dev, s->crtc);
+			drm_vblank_put(dev, drm_crtc_index(s->crtc));
 		}
 	}
 	else {
 		/* Give up ownership of vblank for page-flipped crtc */
-		drm_vblank_put(dev, s->crtc);
+		drm_vblank_put(dev, drm_crtc_index(state->crtc));
 	}
 
 	list_del(&s->head);
@@ -873,9 +873,10 @@ nouveau_flip_complete(struct nvif_notify *notify)
 
 	if (!nouveau_finish_page_flip(chan, &state)) {
 		if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
-			nv_set_crtc_base(drm->dev, state.crtc, state.offset +
-					 state.y * state.pitch +
-					 state.x * state.bpp / 8);
+			nv_set_crtc_base(drm->dev, drm_crtc_index(state.crtc),
+					 state.offset + state.crtc->y *
+					 state.pitch + state.crtc->x *
+					 state.bpp / 8);
 		}
 	}
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 24273ba..0420ee8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -28,7 +28,8 @@ int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *,
 struct nouveau_page_flip_state {
 	struct list_head head;
 	struct drm_pending_vblank_event *event;
-	int crtc, bpp, pitch, x, y;
+	struct drm_crtc *crtc;
+	int bpp, pitch;
 	u64 offset;
 };
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RESEND 02/14] drm/armada: use drm_crtc_send_vblank_event()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH RESEND 03/14] drm/atmel: " Gustavo Padovan
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel; +Cc: Gustavo Padovan, Russell King, David Airlie, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_send_vblank_event() with the new helper function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/armada/armada_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 3130aa8..cdc4117 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -260,7 +260,7 @@ static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc,
 
 	if (fwork->event) {
 		spin_lock_irqsave(&dev->event_lock, flags);
-		drm_send_vblank_event(dev, dcrtc->num, fwork->event);
+		drm_crtc_send_vblank_event(&dcrtc->crtc, fwork->event);
 		spin_unlock_irqrestore(&dev->event_lock, flags);
 	}
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RESEND 03/14] drm/atmel: use drm_crtc_send_vblank_event()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
  2016-06-06 14:41 ` [PATCH RESEND 02/14] drm/armada: use drm_crtc_send_vblank_event() Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-07 11:08   ` Boris Brezillon
  2016-06-06 14:41 ` [PATCH RESEND 04/14] drm/qxl: " Gustavo Padovan
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel; +Cc: Gustavo Padovan, Boris Brezillon, David Airlie, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_send_vblank_event() with the new helper function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index cf23a75..6fca9c4 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -374,7 +374,7 @@ static void atmel_hlcdc_crtc_finish_page_flip(struct atmel_hlcdc_crtc *crtc)
 
 	spin_lock_irqsave(&dev->event_lock, flags);
 	if (crtc->event) {
-		drm_send_vblank_event(dev, crtc->id, crtc->event);
+		drm_crtc_send_vblank_event(&crtc->base, crtc->event);
 		drm_vblank_put(dev, crtc->id);
 		crtc->event = NULL;
 	}
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RESEND 04/14] drm/qxl: use drm_crtc_send_vblank_event()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
  2016-06-06 14:41 ` [PATCH RESEND 02/14] drm/armada: use drm_crtc_send_vblank_event() Gustavo Padovan
  2016-06-06 14:41 ` [PATCH RESEND 03/14] drm/atmel: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH RESEND 05/14] drm/udl: " Gustavo Padovan
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Dave Airlie, David Airlie, Daniel Vetter,
	Jonathon Jongsma, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_send_vblank_event() with the new helper function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/qxl/qxl_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 8b5d543..4c8cac98 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -256,7 +256,7 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
 
 	if (event) {
 		spin_lock_irqsave(&dev->event_lock, flags);
-		drm_send_vblank_event(dev, qcrtc->index, event);
+		drm_crtc_send_vblank_event(crtc, event);
 		spin_unlock_irqrestore(&dev->event_lock, flags);
 	}
 	drm_vblank_put(dev, qcrtc->index);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RESEND 05/14] drm/udl: use drm_crtc_send_vblank_event()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (2 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH RESEND 04/14] drm/qxl: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH RESEND 06/14] drm/virtio: " Gustavo Padovan
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Dave Airlie, David Airlie, Daniel Vetter,
	Alex Deucher, Boris Brezillon, Thierry Reding, Carlos Palminha,
	Ville Syrjälä,
	open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_send_vblank_event() with the new helper function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/udl/udl_modeset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
index b87afee..f92ea95 100644
--- a/drivers/gpu/drm/udl/udl_modeset.c
+++ b/drivers/gpu/drm/udl/udl_modeset.c
@@ -376,7 +376,7 @@ static int udl_crtc_page_flip(struct drm_crtc *crtc,
 
 	spin_lock_irqsave(&dev->event_lock, flags);
 	if (event)
-		drm_send_vblank_event(dev, 0, event);
+		drm_crtc_send_vblank_event(crtc, event);
 	spin_unlock_irqrestore(&dev->event_lock, flags);
 	crtc->primary->fb = fb;
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RESEND 06/14] drm/virtio: use drm_crtc_send_vblank_event()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (3 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH RESEND 05/14] drm/udl: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-07  8:39   ` Gerd Hoffmann
  2016-06-06 14:41 ` [PATCH 07/14] drm: remove legacy drm_send_vblank_event() Gustavo Padovan
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, David Airlie, Gerd Hoffmann,
	open list:VIRTIO GPU DRIVER, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_send_vblank_event() with the new helper function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index d4305da..ba5e11b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -156,7 +156,7 @@ static int virtio_gpu_page_flip(struct drm_crtc *crtc,
 
 	if (event) {
 		spin_lock_irqsave(&crtc->dev->event_lock, irqflags);
-		drm_send_vblank_event(crtc->dev, -1, event);
+		drm_crtc_send_vblank_event(crtc, event);
 		spin_unlock_irqrestore(&crtc->dev->event_lock, irqflags);
 	}
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 07/14] drm: remove legacy drm_send_vblank_event()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (4 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH RESEND 06/14] drm/virtio: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}() Gustavo Padovan
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel; +Cc: Gustavo Padovan, David Airlie, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

We don't have any user of this function anymore, let's remove it.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/drm_irq.c | 31 ++++++-------------------------
 include/drm/drmP.h        |  2 --
 2 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 0fac801..2a347f0 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1095,21 +1095,19 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
 EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
 
 /**
- * drm_send_vblank_event - helper to send vblank event after pageflip
- * @dev: DRM device
- * @pipe: CRTC index
+ * drm_crtc_send_vblank_event - helper to send vblank event after pageflip
+ * @crtc: the source CRTC of the vblank event
  * @e: the event to send
  *
  * Updates sequence # and timestamp on event, and sends it to userspace.
  * Caller must hold event lock.
- *
- * This is the legacy version of drm_crtc_send_vblank_event().
  */
-void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe,
-			   struct drm_pending_vblank_event *e)
+void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
+				struct drm_pending_vblank_event *e)
 {
+	struct drm_device *dev = crtc->dev;
+	unsigned int seq, pipe = drm_crtc_index(crtc);
 	struct timeval now;
-	unsigned int seq;
 
 	if (dev->num_crtcs > 0) {
 		seq = drm_vblank_count_and_time(dev, pipe, &now);
@@ -1121,23 +1119,6 @@ void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe,
 	e->pipe = pipe;
 	send_vblank_event(dev, e, seq, &now);
 }
-EXPORT_SYMBOL(drm_send_vblank_event);
-
-/**
- * drm_crtc_send_vblank_event - helper to send vblank event after pageflip
- * @crtc: the source CRTC of the vblank event
- * @e: the event to send
- *
- * Updates sequence # and timestamp on event, and sends it to userspace.
- * Caller must hold event lock.
- *
- * This is the native KMS version of drm_send_vblank_event().
- */
-void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
-				struct drm_pending_vblank_event *e)
-{
-	drm_send_vblank_event(crtc->dev, drm_crtc_index(crtc), e);
-}
 EXPORT_SYMBOL(drm_crtc_send_vblank_event);
 
 /**
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 84f1a8e..16f7461 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -972,8 +972,6 @@ extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
 				     struct timeval *vblanktime);
 extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
 					  struct timeval *vblanktime);
-extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe,
-				  struct drm_pending_vblank_event *e);
 extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
 				       struct drm_pending_vblank_event *e);
 extern void drm_arm_vblank_event(struct drm_device *dev, unsigned int pipe,
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (5 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 07/14] drm: remove legacy drm_send_vblank_event() Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 15:26   ` Alex Deucher
  2016-06-07  3:43   ` Michel Dänzer
  2016-06-06 14:41 ` [PATCH 09/14] drm/armada: " Gustavo Padovan
                   ` (6 subsequent siblings)
  13 siblings, 2 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Alex Deucher, Christian König,
	David Airlie, Michel Dänzer, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      | 2 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index b0832da..0b5f3ac 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -240,7 +240,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 
 	work->base = base;
 
-	r = drm_vblank_get(crtc->dev, amdgpu_crtc->crtc_id);
+	r = drm_crtc_vblank_get(crtc);
 	if (r) {
 		DRM_ERROR("failed to get vblank before flip\n");
 		goto pflip_cleanup;
@@ -268,7 +268,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 	return 0;
 
 vblank_cleanup:
-	drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
+	drm_crtc_vblank_put(&amdgpu_crtc->base);
 
 pflip_cleanup:
 	if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 8227344..7e57447 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -3372,7 +3372,7 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
 
 	spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
 
-	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+	drm_crtc_vblank_put(&amdgpu_crtc->base);
 	schedule_work(&works->unpin_work);
 
 	return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index c11b600..6c51d9c 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -3433,7 +3433,7 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
 
 	spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
 
-	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+	drm_crtc_vblank_put(&amdgpu_crtc->base);
 	schedule_work(&works->unpin_work);
 
 	return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 3fb65e4..41d9bc5 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -3376,7 +3376,7 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
 
 	spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
 
-	drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
+	drm_crtc_vblank_put(&amdgpu_crtc->base);
 	schedule_work(&works->unpin_work);
 
 	return 0;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 09/14] drm/armada: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (6 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}() Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH 10/14] drm/atmel: " Gustavo Padovan
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel; +Cc: Gustavo Padovan, Russell King, David Airlie, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/armada/armada_crtc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index cdc4117..34405e4 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -199,7 +199,7 @@ static void armada_drm_plane_work_run(struct armada_crtc *dcrtc,
 	/* Handle any pending frame work. */
 	if (work) {
 		work->fn(dcrtc, plane, work);
-		drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
+		drm_crtc_vblank_put(&dcrtc->crtc);
 	}
 
 	wake_up(&plane->frame_wait);
@@ -210,7 +210,7 @@ int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
 {
 	int ret;
 
-	ret = drm_vblank_get(dcrtc->crtc.dev, dcrtc->num);
+	ret = drm_crtc_vblank_get(&dcrtc->crtc);
 	if (ret) {
 		DRM_ERROR("failed to acquire vblank counter\n");
 		return ret;
@@ -218,7 +218,7 @@ int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
 
 	ret = cmpxchg(&plane->work, NULL, work) ? -EBUSY : 0;
 	if (ret)
-		drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
+		drm_crtc_vblank_put(&dcrtc->crtc);
 
 	return ret;
 }
@@ -234,7 +234,7 @@ struct armada_plane_work *armada_drm_plane_work_cancel(
 	struct armada_plane_work *work = xchg(&plane->work, NULL);
 
 	if (work)
-		drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
+		drm_crtc_vblank_put(&dcrtc->crtc);
 
 	return work;
 }
@@ -592,9 +592,9 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
 
 	if (interlaced ^ dcrtc->interlaced) {
 		if (adj->flags & DRM_MODE_FLAG_INTERLACE)
-			drm_vblank_get(dcrtc->crtc.dev, dcrtc->num);
+			drm_crtc_vblank_get(&dcrtc->crtc);
 		else
-			drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
+			drm_crtc_vblank_put(&dcrtc->crtc);
 		dcrtc->interlaced = interlaced;
 	}
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 10/14] drm/atmel: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (7 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 09/14] drm/armada: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-07 11:07   ` Boris Brezillon
  2016-06-06 14:41 ` [PATCH 11/14] drm/nouveau: " Gustavo Padovan
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel; +Cc: Gustavo Padovan, Boris Brezillon, David Airlie, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index 6fca9c4..461b39c 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -375,7 +375,7 @@ static void atmel_hlcdc_crtc_finish_page_flip(struct atmel_hlcdc_crtc *crtc)
 	spin_lock_irqsave(&dev->event_lock, flags);
 	if (crtc->event) {
 		drm_crtc_send_vblank_event(&crtc->base, crtc->event);
-		drm_vblank_put(dev, crtc->id);
+		drm_crtc_vblank_put(&crtc->base);
 		crtc->event = NULL;
 	}
 	spin_unlock_irqrestore(&dev->event_lock, flags);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 11/14] drm/nouveau: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (8 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 10/14] drm/atmel: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH 12/14] drm/qxl: " Gustavo Padovan
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Ben Skeggs, David Airlie,
	open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/nouveau/nouveau_display.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 9d72467..7898459f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -764,7 +764,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 		  new_bo->bo.offset };
 
 	/* Keep vblanks on during flip, for the target crtc of this flip */
-	drm_vblank_get(dev, nouveau_crtc(crtc)->index);
+	drm_crtc_vblank_get(crtc);
 
 	/* Emit a page flip */
 	if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
@@ -809,7 +809,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 	return 0;
 
 fail_unreserve:
-	drm_vblank_put(dev, nouveau_crtc(crtc)->index);
+	drm_crtc_vblank_put(crtc);
 	ttm_bo_unreserve(&old_bo->bo);
 fail_unpin:
 	mutex_unlock(&cli->mutex);
@@ -847,12 +847,12 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
 			drm_crtc_send_vblank_event(s->crtc, s->event);
 
 			/* Give up ownership of vblank for page-flipped crtc */
-			drm_vblank_put(dev, drm_crtc_index(s->crtc));
+			drm_crtc_vblank_put(s->crtc);
 		}
 	}
 	else {
 		/* Give up ownership of vblank for page-flipped crtc */
-		drm_vblank_put(dev, drm_crtc_index(state->crtc));
+		drm_crtc_vblank_put(state->crtc);
 	}
 
 	list_del(&s->head);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 12/14] drm/qxl: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (9 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 11/14] drm/nouveau: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH 13/14] drm/radeon: " Gustavo Padovan
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Dave Airlie, David Airlie, Daniel Vetter,
	Jonathon Jongsma, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/qxl/qxl_display.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 4c8cac98..d1e465a 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -221,7 +221,6 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
 {
 	struct drm_device *dev = crtc->dev;
 	struct qxl_device *qdev = dev->dev_private;
-	struct qxl_crtc *qcrtc = to_qxl_crtc(crtc);
 	struct qxl_framebuffer *qfb_src = to_qxl_framebuffer(fb);
 	struct qxl_framebuffer *qfb_old = to_qxl_framebuffer(crtc->primary->fb);
 	struct qxl_bo *bo_old = gem_to_qxl_bo(qfb_old->obj);
@@ -252,14 +251,14 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
 	qxl_draw_dirty_fb(qdev, qfb_src, bo, 0, 0,
 			  &norect, one_clip_rect, inc);
 
-	drm_vblank_get(dev, qcrtc->index);
+	drm_crtc_vblank_get(crtc);
 
 	if (event) {
 		spin_lock_irqsave(&dev->event_lock, flags);
 		drm_crtc_send_vblank_event(crtc, event);
 		spin_unlock_irqrestore(&dev->event_lock, flags);
 	}
-	drm_vblank_put(dev, qcrtc->index);
+	drm_crtc_vblank_put(crtc);
 
 	ret = qxl_bo_reserve(bo, false);
 	if (!ret) {
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 13/14] drm/radeon: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (10 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 12/14] drm/qxl: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 14:41 ` [PATCH 14/14] drm/shmobile: " Gustavo Padovan
  2016-06-06 16:02 ` [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Daniel Vetter
  13 siblings, 0 replies; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Alex Deucher, Christian König,
	David Airlie, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/radeon/radeon_display.c |  6 +++---
 drivers/gpu/drm/radeon/radeon_pm.c      | 13 +++++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 6a41b49..2fb18f1 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -381,7 +381,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
 
 	spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);
 
-	drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id);
+	drm_crtc_vblank_put(&radeon_crtc->base);
 	radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id);
 	queue_work(radeon_crtc->flip_queue, &work->unpin_work);
 }
@@ -598,7 +598,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
 	}
 	work->base = base;
 
-	r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id);
+	r = drm_crtc_vblank_get(crtc);
 	if (r) {
 		DRM_ERROR("failed to get vblank before flip\n");
 		goto pflip_cleanup;
@@ -625,7 +625,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
 	return 0;
 
 vblank_cleanup:
-	drm_vblank_put(crtc->dev, radeon_crtc->crtc_id);
+	drm_crtc_vblank_put(&radeon_crtc->base);
 
 pflip_cleanup:
 	if (unlikely(radeon_bo_reserve(new_rbo, false) != 0)) {
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 38226d9..4b65425 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -246,6 +246,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
 
 static void radeon_pm_set_clocks(struct radeon_device *rdev)
 {
+	struct drm_crtc *crtc;
 	int i, r;
 
 	/* no need to take locks, etc. if nothing's going to change */
@@ -274,26 +275,30 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
 	radeon_unmap_vram_bos(rdev);
 
 	if (rdev->irq.installed) {
-		for (i = 0; i < rdev->num_crtc; i++) {
+		i = 0;
+		drm_for_each_crtc(crtc, rdev->ddev) {
 			if (rdev->pm.active_crtcs & (1 << i)) {
 				/* This can fail if a modeset is in progress */
-				if (drm_vblank_get(rdev->ddev, i) == 0)
+				if (drm_crtc_vblank_get(crtc) == 0)
 					rdev->pm.req_vblank |= (1 << i);
 				else
 					DRM_DEBUG_DRIVER("crtc %d no vblank, can glitch\n",
 							 i);
 			}
+			i++;
 		}
 	}
 
 	radeon_set_power_state(rdev);
 
 	if (rdev->irq.installed) {
-		for (i = 0; i < rdev->num_crtc; i++) {
+		i = 0;
+		drm_for_each_crtc(crtc, rdev->ddev) {
 			if (rdev->pm.req_vblank & (1 << i)) {
 				rdev->pm.req_vblank &= ~(1 << i);
-				drm_vblank_put(rdev->ddev, i);
+				drm_crtc_vblank_put(crtc);
 			}
+			i++;
 		}
 	}
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 14/14] drm/shmobile: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (11 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 13/14] drm/radeon: " Gustavo Padovan
@ 2016-06-06 14:41 ` Gustavo Padovan
  2016-06-06 18:25   ` Laurent Pinchart
  2016-06-06 16:02 ` [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Daniel Vetter
  13 siblings, 1 reply; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 14:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Gustavo Padovan, Laurent Pinchart, David Airlie,
	open list:DRM DRIVERS FOR RENESAS, open list

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Replace the legacy drm_vblank_{get,put}() with the new helper functions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 1e154fc..6547b1d 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -441,7 +441,7 @@ void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc)
 	scrtc->event = NULL;
 	if (event) {
 		drm_crtc_send_vblank_event(&scrtc->crtc, event);
-		drm_vblank_put(dev, 0);
+		drm_crtc_vblank_put(&scrtc->crtc);
 	}
 	spin_unlock_irqrestore(&dev->event_lock, flags);
 }
@@ -467,7 +467,7 @@ static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc,
 
 	if (event) {
 		event->pipe = 0;
-		drm_vblank_get(dev, 0);
+		drm_crtc_vblank_get(&scrtc->crtc);
 		spin_lock_irqsave(&dev->event_lock, flags);
 		scrtc->event = event;
 		spin_unlock_irqrestore(&dev->event_lock, flags);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 ` [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}() Gustavo Padovan
@ 2016-06-06 15:26   ` Alex Deucher
  2016-06-06 15:35     ` Gustavo Padovan
  2016-06-07  3:43   ` Michel Dänzer
  1 sibling, 1 reply; 23+ messages in thread
From: Alex Deucher @ 2016-06-06 15:26 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: Maling list - DRI developers, Michel Dänzer, open list,
	Alex Deucher, Gustavo Padovan, Christian König

On Mon, Jun 6, 2016 at 10:41 AM, Gustavo Padovan <gustavo@padovan.org> wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Replace the legacy drm_vblank_{get,put}() with the new helper functions.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

This and the radeon patch are:

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Should I pick this up, or are you planning to upstream this as a big batch?

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 ++--
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      | 2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      | 2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index b0832da..0b5f3ac 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -240,7 +240,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
>
>         work->base = base;
>
> -       r = drm_vblank_get(crtc->dev, amdgpu_crtc->crtc_id);
> +       r = drm_crtc_vblank_get(crtc);
>         if (r) {
>                 DRM_ERROR("failed to get vblank before flip\n");
>                 goto pflip_cleanup;
> @@ -268,7 +268,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
>         return 0;
>
>  vblank_cleanup:
> -       drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
> +       drm_crtc_vblank_put(&amdgpu_crtc->base);
>
>  pflip_cleanup:
>         if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 8227344..7e57447 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -3372,7 +3372,7 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
>
>         spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
>
> -       drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
> +       drm_crtc_vblank_put(&amdgpu_crtc->base);
>         schedule_work(&works->unpin_work);
>
>         return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index c11b600..6c51d9c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -3433,7 +3433,7 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
>
>         spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
>
> -       drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
> +       drm_crtc_vblank_put(&amdgpu_crtc->base);
>         schedule_work(&works->unpin_work);
>
>         return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 3fb65e4..41d9bc5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -3376,7 +3376,7 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
>
>         spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
>
> -       drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
> +       drm_crtc_vblank_put(&amdgpu_crtc->base);
>         schedule_work(&works->unpin_work);
>
>         return 0;
> --
> 2.5.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}()
  2016-06-06 15:26   ` Alex Deucher
@ 2016-06-06 15:35     ` Gustavo Padovan
  2016-06-06 16:06       ` Daniel Vetter
  0 siblings, 1 reply; 23+ messages in thread
From: Gustavo Padovan @ 2016-06-06 15:35 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Maling list - DRI developers, Michel Dänzer, open list,
	Alex Deucher, Gustavo Padovan, Christian König

2016-06-06 Alex Deucher <alexdeucher@gmail.com>:

> On Mon, Jun 6, 2016 at 10:41 AM, Gustavo Padovan <gustavo@padovan.org> wrote:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >
> > Replace the legacy drm_vblank_{get,put}() with the new helper functions.
> >
> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> This and the radeon patch are:
> 
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> 
> Should I pick this up, or are you planning to upstream this as a big batch?

I would like to upstream as a big batch via drm-misc. If I get acks on
everything it would be possible to remove drm_vblank_get,put for 4.8.

	Gustavo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2
  2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
                   ` (12 preceding siblings ...)
  2016-06-06 14:41 ` [PATCH 14/14] drm/shmobile: " Gustavo Padovan
@ 2016-06-06 16:02 ` Daniel Vetter
  13 siblings, 0 replies; 23+ messages in thread
From: Daniel Vetter @ 2016-06-06 16:02 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: dri-devel, open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
	open list, Ben Skeggs, Gustavo Padovan

On Mon, Jun 06, 2016 at 11:41:32AM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Replace the legacy drm_send_vblank_event() with the new helper function.
> 
> v2: add crtc to nouveau_page_flip_state (comment from Mario Kleiner)
> 
> Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Forgot to squash this into the main nouveau patch as fixup?
-Daniel

> ---
>  drivers/gpu/drm/nouveau/nouveau_display.c | 19 ++++++++++---------
>  drivers/gpu/drm/nouveau/nouveau_display.h |  3 ++-
>  2 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 7c77f96..9d72467 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -760,8 +760,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
>  
>  	/* Initialize a page flip struct */
>  	*s = (struct nouveau_page_flip_state)
> -		{ { }, event, nouveau_crtc(crtc)->index,
> -		  fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y,
> +		{ { }, event, crtc, fb->bits_per_pixel, fb->pitches[0],
>  		  new_bo->bo.offset };
>  
>  	/* Keep vblanks on during flip, for the target crtc of this flip */
> @@ -842,17 +841,18 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
>  	s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
>  	if (s->event) {
>  		if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
> -			drm_arm_vblank_event(dev, s->crtc, s->event);
> +			drm_arm_vblank_event(dev, drm_crtc_index(s->crtc),
> +					     s->event);
>  		} else {
> -			drm_send_vblank_event(dev, s->crtc, s->event);
> +			drm_crtc_send_vblank_event(s->crtc, s->event);
>  
>  			/* Give up ownership of vblank for page-flipped crtc */
> -			drm_vblank_put(dev, s->crtc);
> +			drm_vblank_put(dev, drm_crtc_index(s->crtc));
>  		}
>  	}
>  	else {
>  		/* Give up ownership of vblank for page-flipped crtc */
> -		drm_vblank_put(dev, s->crtc);
> +		drm_vblank_put(dev, drm_crtc_index(state->crtc));
>  	}
>  
>  	list_del(&s->head);
> @@ -873,9 +873,10 @@ nouveau_flip_complete(struct nvif_notify *notify)
>  
>  	if (!nouveau_finish_page_flip(chan, &state)) {
>  		if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
> -			nv_set_crtc_base(drm->dev, state.crtc, state.offset +
> -					 state.y * state.pitch +
> -					 state.x * state.bpp / 8);
> +			nv_set_crtc_base(drm->dev, drm_crtc_index(state.crtc),
> +					 state.offset + state.crtc->y *
> +					 state.pitch + state.crtc->x *
> +					 state.bpp / 8);
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
> index 24273ba..0420ee8 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.h
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.h
> @@ -28,7 +28,8 @@ int nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *,
>  struct nouveau_page_flip_state {
>  	struct list_head head;
>  	struct drm_pending_vblank_event *event;
> -	int crtc, bpp, pitch, x, y;
> +	struct drm_crtc *crtc;
> +	int bpp, pitch;
>  	u64 offset;
>  };
>  
> -- 
> 2.5.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}()
  2016-06-06 15:35     ` Gustavo Padovan
@ 2016-06-06 16:06       ` Daniel Vetter
  0 siblings, 0 replies; 23+ messages in thread
From: Daniel Vetter @ 2016-06-06 16:06 UTC (permalink / raw)
  To: Gustavo Padovan, Alex Deucher, Maling list - DRI developers,
	Michel Dänzer, open list, Alex Deucher, Gustavo Padovan,
	Christian König

On Mon, Jun 06, 2016 at 12:35:26PM -0300, Gustavo Padovan wrote:
> 2016-06-06 Alex Deucher <alexdeucher@gmail.com>:
> 
> > On Mon, Jun 6, 2016 at 10:41 AM, Gustavo Padovan <gustavo@padovan.org> wrote:
> > > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > >
> > > Replace the legacy drm_vblank_{get,put}() with the new helper functions.
> > >
> > > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > 
> > This and the radeon patch are:
> > 
> > Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> > 
> > Should I pick this up, or are you planning to upstream this as a big batch?
> 
> I would like to upstream as a big batch via drm-misc. If I get acks on
> everything it would be possible to remove drm_vblank_get,put for 4.8.

Ok, I vacuumed them all up except for the 2 nouveau patches and the core
patch to remove drm_send_vblank_event. Btw drm_arm_vblank_event probably
deserves the same treatment (and would get rid of drm_crtc_index from
nouveau).
-Daniel

> 
> 	Gustavo
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 14/14] drm/shmobile: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 ` [PATCH 14/14] drm/shmobile: " Gustavo Padovan
@ 2016-06-06 18:25   ` Laurent Pinchart
  0 siblings, 0 replies; 23+ messages in thread
From: Laurent Pinchart @ 2016-06-06 18:25 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: dri-devel, Gustavo Padovan, David Airlie,
	open list:DRM DRIVERS FOR RENESAS, open list

Hi Gustavo,

Thank you for the patch.

On Monday 06 Jun 2016 11:41:45 Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Replace the legacy drm_vblank_{get,put}() with the new helper functions.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c index 1e154fc..6547b1d 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -441,7 +441,7 @@ void shmob_drm_crtc_finish_page_flip(struct
> shmob_drm_crtc *scrtc) scrtc->event = NULL;
>  	if (event) {
>  		drm_crtc_send_vblank_event(&scrtc->crtc, event);
> -		drm_vblank_put(dev, 0);
> +		drm_crtc_vblank_put(&scrtc->crtc);
>  	}
>  	spin_unlock_irqrestore(&dev->event_lock, flags);
>  }
> @@ -467,7 +467,7 @@ static int shmob_drm_crtc_page_flip(struct drm_crtc
> *crtc,
> 
>  	if (event) {
>  		event->pipe = 0;
> -		drm_vblank_get(dev, 0);
> +		drm_crtc_vblank_get(&scrtc->crtc);
>  		spin_lock_irqsave(&dev->event_lock, flags);
>  		scrtc->event = event;
>  		spin_unlock_irqrestore(&dev->event_lock, flags);

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 ` [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}() Gustavo Padovan
  2016-06-06 15:26   ` Alex Deucher
@ 2016-06-07  3:43   ` Michel Dänzer
  1 sibling, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2016-06-07  3:43 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: dri-devel, open list, Alex Deucher, Gustavo Padovan,
	Christian König

On 06.06.2016 23:41, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Replace the legacy drm_vblank_{get,put}() with the new helper functions.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

[...]

> @@ -268,7 +268,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
>  	return 0;
>  
>  vblank_cleanup:
> -	drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
> +	drm_crtc_vblank_put(&amdgpu_crtc->base);

Can just use crtc here instead of &amdgpu_crtc->base. Same for the
radeon patch.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RESEND 06/14] drm/virtio: use drm_crtc_send_vblank_event()
  2016-06-06 14:41 ` [PATCH RESEND 06/14] drm/virtio: " Gustavo Padovan
@ 2016-06-07  8:39   ` Gerd Hoffmann
  0 siblings, 0 replies; 23+ messages in thread
From: Gerd Hoffmann @ 2016-06-07  8:39 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: dri-devel, Gustavo Padovan, David Airlie,
	open list:VIRTIO GPU DRIVER, open list

On Mo, 2016-06-06 at 11:41 -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Replace the legacy drm_send_vblank_event() with the new helper function.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
>  drivers/gpu/drm/virtio/virtgpu_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
> index d4305da..ba5e11b 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -156,7 +156,7 @@ static int virtio_gpu_page_flip(struct drm_crtc *crtc,
>  
>  	if (event) {
>  		spin_lock_irqsave(&crtc->dev->event_lock, irqflags);
> -		drm_send_vblank_event(crtc->dev, -1, event);
> +		drm_crtc_send_vblank_event(crtc, event);
>  		spin_unlock_irqrestore(&crtc->dev->event_lock, irqflags);
>  	}

Daniel Vetter has a series in flight which drops the whole
virtio_gpu_page_flip function in favor of drm_atomic_helper_page_flip.

https://lists.freedesktop.org/archives/dri-devel/2016-May/108699.html

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 10/14] drm/atmel: use drm_crtc_vblank_{get,put}()
  2016-06-06 14:41 ` [PATCH 10/14] drm/atmel: " Gustavo Padovan
@ 2016-06-07 11:07   ` Boris Brezillon
  0 siblings, 0 replies; 23+ messages in thread
From: Boris Brezillon @ 2016-06-07 11:07 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: dri-devel, Gustavo Padovan, David Airlie, open list

On Mon,  6 Jun 2016 11:41:41 -0300
Gustavo Padovan <gustavo@padovan.org> wrote:

> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Replace the legacy drm_vblank_{get,put}() with the new helper functions.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index 6fca9c4..461b39c 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -375,7 +375,7 @@ static void atmel_hlcdc_crtc_finish_page_flip(struct atmel_hlcdc_crtc *crtc)
>  	spin_lock_irqsave(&dev->event_lock, flags);
>  	if (crtc->event) {
>  		drm_crtc_send_vblank_event(&crtc->base, crtc->event);
> -		drm_vblank_put(dev, crtc->id);
> +		drm_crtc_vblank_put(&crtc->base);
>  		crtc->event = NULL;
>  	}
>  	spin_unlock_irqrestore(&dev->event_lock, flags);



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RESEND 03/14] drm/atmel: use drm_crtc_send_vblank_event()
  2016-06-06 14:41 ` [PATCH RESEND 03/14] drm/atmel: " Gustavo Padovan
@ 2016-06-07 11:08   ` Boris Brezillon
  0 siblings, 0 replies; 23+ messages in thread
From: Boris Brezillon @ 2016-06-07 11:08 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: dri-devel, Gustavo Padovan, David Airlie, open list

On Mon,  6 Jun 2016 11:41:34 -0300
Gustavo Padovan <gustavo@padovan.org> wrote:

> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Replace the legacy drm_send_vblank_event() with the new helper function.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index cf23a75..6fca9c4 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -374,7 +374,7 @@ static void atmel_hlcdc_crtc_finish_page_flip(struct atmel_hlcdc_crtc *crtc)
>  
>  	spin_lock_irqsave(&dev->event_lock, flags);
>  	if (crtc->event) {
> -		drm_send_vblank_event(dev, crtc->id, crtc->event);
> +		drm_crtc_send_vblank_event(&crtc->base, crtc->event);
>  		drm_vblank_put(dev, crtc->id);
>  		crtc->event = NULL;
>  	}



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-06-07 11:08 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 14:41 [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Gustavo Padovan
2016-06-06 14:41 ` [PATCH RESEND 02/14] drm/armada: use drm_crtc_send_vblank_event() Gustavo Padovan
2016-06-06 14:41 ` [PATCH RESEND 03/14] drm/atmel: " Gustavo Padovan
2016-06-07 11:08   ` Boris Brezillon
2016-06-06 14:41 ` [PATCH RESEND 04/14] drm/qxl: " Gustavo Padovan
2016-06-06 14:41 ` [PATCH RESEND 05/14] drm/udl: " Gustavo Padovan
2016-06-06 14:41 ` [PATCH RESEND 06/14] drm/virtio: " Gustavo Padovan
2016-06-07  8:39   ` Gerd Hoffmann
2016-06-06 14:41 ` [PATCH 07/14] drm: remove legacy drm_send_vblank_event() Gustavo Padovan
2016-06-06 14:41 ` [PATCH 08/14] drm/amdgpu: use drm_crtc_vblank_{get,put}() Gustavo Padovan
2016-06-06 15:26   ` Alex Deucher
2016-06-06 15:35     ` Gustavo Padovan
2016-06-06 16:06       ` Daniel Vetter
2016-06-07  3:43   ` Michel Dänzer
2016-06-06 14:41 ` [PATCH 09/14] drm/armada: " Gustavo Padovan
2016-06-06 14:41 ` [PATCH 10/14] drm/atmel: " Gustavo Padovan
2016-06-07 11:07   ` Boris Brezillon
2016-06-06 14:41 ` [PATCH 11/14] drm/nouveau: " Gustavo Padovan
2016-06-06 14:41 ` [PATCH 12/14] drm/qxl: " Gustavo Padovan
2016-06-06 14:41 ` [PATCH 13/14] drm/radeon: " Gustavo Padovan
2016-06-06 14:41 ` [PATCH 14/14] drm/shmobile: " Gustavo Padovan
2016-06-06 18:25   ` Laurent Pinchart
2016-06-06 16:02 ` [PATCH 01/14] drm/nouveau: use drm_crtc_send_vblank_event() v2 Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).