mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/virtio: use new drm_crtc_send_vblank_event()
@ 2016-03-21 19:23 Gustavo Padovan
  2016-03-21 19:23 ` [PATCH 2/2] drm/virtio: send vblank event on plane atomic update Gustavo Padovan
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo Padovan @ 2016-03-21 19:23 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Gustavo Padovan, David Airlie, open list:VIRTIO GPU DRIVER,
	open list:VIRTIO GPU DRIVER, open list

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

Simplify code by using the new vblank crtc helpers.

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 429aa31..b70bb8b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -163,7 +163,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.0

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

* [PATCH 2/2] drm/virtio: send vblank event on plane atomic update
  2016-03-21 19:23 [PATCH 1/2] drm/virtio: use new drm_crtc_send_vblank_event() Gustavo Padovan
@ 2016-03-21 19:23 ` Gustavo Padovan
  2016-03-22 13:17   ` Daniel Stone
  2016-03-22 20:17   ` [PATCH v2] drm/virtio: send vblank event after crtc updates Gustavo Padovan
  0 siblings, 2 replies; 5+ messages in thread
From: Gustavo Padovan @ 2016-03-21 19:23 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Gustavo Padovan, David Airlie, open list:VIRTIO GPU DRIVER,
	open list:VIRTIO GPU DRIVER, open list

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

virtio_gpu was failing to send vblank events when using the atomic IOCTL
with the DRM_MODE_PAGE_FLIP_EVENT flag set. This patch fixes each and
enables atomic pageflips updates.

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

diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 70b44a2..20260ad 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -63,9 +63,11 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane,
 {
 	struct drm_device *dev = plane->dev;
 	struct virtio_gpu_device *vgdev = dev->dev_private;
-	struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(plane->crtc);
+	struct drm_crtc *crtc = plane->crtc;
+	struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
 	struct virtio_gpu_framebuffer *vgfb;
 	struct virtio_gpu_object *bo;
+	unsigned long flags;
 	uint32_t handle;
 
 	if (plane->state->fb) {
@@ -96,6 +98,11 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane,
 				      plane->state->crtc_y,
 				      plane->state->crtc_w,
 				      plane->state->crtc_h);
+
+	spin_lock_irqsave(&crtc->dev->event_lock, flags);
+	if (crtc->state->event)
+		drm_crtc_send_vblank_event(crtc, crtc->state->event);
+	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 }
 
 
-- 
2.5.0

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

* Re: [PATCH 2/2] drm/virtio: send vblank event on plane atomic update
  2016-03-21 19:23 ` [PATCH 2/2] drm/virtio: send vblank event on plane atomic update Gustavo Padovan
@ 2016-03-22 13:17   ` Daniel Stone
  2016-03-22 20:17   ` [PATCH v2] drm/virtio: send vblank event after crtc updates Gustavo Padovan
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Stone @ 2016-03-22 13:17 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: Gerd Hoffmann, David Airlie, open list:VIRTIO GPU DRIVER,
	open list:VIRTIO GPU DRIVER, open list

Hi,

On 21 March 2016 at 19:23, Gustavo Padovan <gustavo@padovan.org> wrote:
> @@ -96,6 +98,11 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane,
>                                       plane->state->crtc_y,
>                                       plane->state->crtc_w,
>                                       plane->state->crtc_h);
> +
> +       spin_lock_irqsave(&crtc->dev->event_lock, flags);
> +       if (crtc->state->event)
> +               drm_crtc_send_vblank_event(crtc, crtc->state->event);
> +       spin_unlock_irqrestore(&crtc->dev->event_lock, flags);

This seems like the wrong place to do it, in that it will generate one
flip event per plane, rather than one per CRTC. So this should
probably be done in the overall atomic_commit hook I think.

Also, without some kind of delay, this means that we'll generate
flip-complete events immediately, which will cause compositors like
Weston to render infinitely fast. It's probably worth looking at what
happened when this came up with Bochs - I'm not sure if we fake a 16ms
delay, or refuse to do async modesets, or what.

Cheers,
Daniel

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

* [PATCH v2] drm/virtio: send vblank event after crtc updates
  2016-03-21 19:23 ` [PATCH 2/2] drm/virtio: send vblank event on plane atomic update Gustavo Padovan
  2016-03-22 13:17   ` Daniel Stone
@ 2016-03-22 20:17   ` Gustavo Padovan
  2016-04-05 18:21     ` Gustavo Padovan
  1 sibling, 1 reply; 5+ messages in thread
From: Gustavo Padovan @ 2016-03-22 20:17 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Gustavo Padovan, David Airlie, open list:VIRTIO GPU DRIVER,
	open list:VIRTIO GPU DRIVER, open list

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

virtio_gpu was failing to send vblank events when using the atomic IOCTL
with the DRM_MODE_PAGE_FLIP_EVENT flag set. This patch fixes each and
enables atomic pageflips updates.

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

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index b70bb8b..4f372e0 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -274,12 +274,24 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
 	return 0;
 }
 
+static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
+					 struct drm_crtc_state *old_state)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&crtc->dev->event_lock, flags);
+	if (crtc->state->event)
+		drm_crtc_send_vblank_event(crtc, crtc->state->event);
+	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
+}
+
 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
 	.enable        = virtio_gpu_crtc_enable,
 	.disable       = virtio_gpu_crtc_disable,
 	.mode_fixup    = virtio_gpu_crtc_mode_fixup,
 	.mode_set_nofb = virtio_gpu_crtc_mode_set_nofb,
 	.atomic_check  = virtio_gpu_crtc_atomic_check,
+	.atomic_flush  = virtio_gpu_crtc_atomic_flush,
 };
 
 static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
-- 
2.5.0

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

* Re: [PATCH v2] drm/virtio: send vblank event after crtc updates
  2016-03-22 20:17   ` [PATCH v2] drm/virtio: send vblank event after crtc updates Gustavo Padovan
@ 2016-04-05 18:21     ` Gustavo Padovan
  0 siblings, 0 replies; 5+ messages in thread
From: Gustavo Padovan @ 2016-04-05 18:21 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Gustavo Padovan, David Airlie, open list:VIRTIO GPU DRIVER,
	open list:VIRTIO GPU DRIVER, open list

Hi,

Any comment on this?

	Gustavo

2016-03-22 Gustavo Padovan <gustavo@padovan.org>:

> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> virtio_gpu was failing to send vblank events when using the atomic IOCTL
> with the DRM_MODE_PAGE_FLIP_EVENT flag set. This patch fixes each and
> enables atomic pageflips updates.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
>  drivers/gpu/drm/virtio/virtgpu_display.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
> index b70bb8b..4f372e0 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -274,12 +274,24 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
>  	return 0;
>  }
>  
> +static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
> +					 struct drm_crtc_state *old_state)
> +{
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&crtc->dev->event_lock, flags);
> +	if (crtc->state->event)
> +		drm_crtc_send_vblank_event(crtc, crtc->state->event);
> +	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
> +}
> +
>  static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
>  	.enable        = virtio_gpu_crtc_enable,
>  	.disable       = virtio_gpu_crtc_disable,
>  	.mode_fixup    = virtio_gpu_crtc_mode_fixup,
>  	.mode_set_nofb = virtio_gpu_crtc_mode_set_nofb,
>  	.atomic_check  = virtio_gpu_crtc_atomic_check,
> +	.atomic_flush  = virtio_gpu_crtc_atomic_flush,
>  };
>  
>  static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
> -- 
> 2.5.0
> 

	Gustavo

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

end of thread, other threads:[~2016-04-05 18:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-21 19:23 [PATCH 1/2] drm/virtio: use new drm_crtc_send_vblank_event() Gustavo Padovan
2016-03-21 19:23 ` [PATCH 2/2] drm/virtio: send vblank event on plane atomic update Gustavo Padovan
2016-03-22 13:17   ` Daniel Stone
2016-03-22 20:17   ` [PATCH v2] drm/virtio: send vblank event after crtc updates Gustavo Padovan
2016-04-05 18:21     ` Gustavo Padovan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®