Linux SNPS ARC Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 13/26] drm/arc: Nuke event_list
       [not found] <1464546923-13439-1-git-send-email-daniel.vetter@ffwll.ch>
@ 2016-05-29 18:35 ` Daniel Vetter
  2016-05-29 18:35 ` [PATCH 14/26] drm/arc: Actually bother with handling atomic events Daniel Vetter
  2016-05-29 18:35 ` [PATCH 15/26] drm/arc: Implement nonblocking commit correctly Daniel Vetter
  2 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2016-05-29 18:35 UTC (permalink / raw)
  To: linux-snps-arc

This is just used for cleanup in preclose, and with the reworked event
handling code this is now done properly by the core.

Nuke it!

But it also shows that arc totally fails at sending out drm events for
flips. Next patch will hack that up.

Cc: Carlos Palminha <palminha at synopsys.com>
Cc: Alexey Brodkin <abrodkin at synopsys.com>
Cc: linux-snps-arc at lists.infradead.org
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/arc/arcpgu.h      |  1 -
 drivers/gpu/drm/arc/arcpgu_crtc.c |  4 ----
 drivers/gpu/drm/arc/arcpgu_drv.c  | 19 -------------------
 3 files changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
index 86574b698a78..8c01a25d279a 100644
--- a/drivers/gpu/drm/arc/arcpgu.h
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -22,7 +22,6 @@ struct arcpgu_drm_private {
 	struct clk		*clk;
 	struct drm_fbdev_cma	*fbdev;
 	struct drm_framebuffer	*fb;
-	struct list_head	event_list;
 	struct drm_crtc		crtc;
 	struct drm_plane	*plane;
 };
diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index 92f8beff8e60..d5ca0c280e68 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -155,10 +155,6 @@ static void arc_pgu_crtc_atomic_begin(struct drm_crtc *crtc,
 		event->pipe = drm_crtc_index(crtc);
 
 		WARN_ON(drm_crtc_vblank_get(crtc) != 0);
-
-		spin_lock_irqsave(&crtc->dev->event_lock, flags);
-		list_add_tail(&event->base.link, &arcpgu->event_list);
-		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 	}
 }
 
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index bc53ebb83f75..d407fd79a400 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -81,22 +81,6 @@ static const struct file_operations arcpgu_drm_ops = {
 	.mmap = arcpgu_gem_mmap,
 };
 
-static void arcpgu_preclose(struct drm_device *drm, struct drm_file *file)
-{
-	struct arcpgu_drm_private *arcpgu = drm->dev_private;
-	struct drm_pending_vblank_event *e, *t;
-	unsigned long flags;
-
-	spin_lock_irqsave(&drm->event_lock, flags);
-	list_for_each_entry_safe(e, t, &arcpgu->event_list, base.link) {
-		if (e->base.file_priv != file)
-			continue;
-		list_del(&e->base.link);
-		e->base.destroy(&e->base);
-	}
-	spin_unlock_irqrestore(&drm->event_lock, flags);
-}
-
 static void arcpgu_lastclose(struct drm_device *drm)
 {
 	struct arcpgu_drm_private *arcpgu = drm->dev_private;
@@ -122,8 +106,6 @@ static int arcpgu_load(struct drm_device *drm)
 	if (IS_ERR(arcpgu->clk))
 		return PTR_ERR(arcpgu->clk);
 
-	INIT_LIST_HEAD(&arcpgu->event_list);
-
 	arcpgu_setup_mode_config(drm);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -192,7 +174,6 @@ int arcpgu_unload(struct drm_device *drm)
 static struct drm_driver arcpgu_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
 			   DRIVER_ATOMIC,
-	.preclose = arcpgu_preclose,
 	.lastclose = arcpgu_lastclose,
 	.name = "drm-arcpgu",
 	.desc = "ARC PGU Controller",
-- 
2.8.1

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

* [PATCH 14/26] drm/arc: Actually bother with handling atomic events.
       [not found] <1464546923-13439-1-git-send-email-daniel.vetter@ffwll.ch>
  2016-05-29 18:35 ` [PATCH 13/26] drm/arc: Nuke event_list Daniel Vetter
@ 2016-05-29 18:35 ` Daniel Vetter
  2016-05-29 18:35 ` [PATCH 15/26] drm/arc: Implement nonblocking commit correctly Daniel Vetter
  2 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2016-05-29 18:35 UTC (permalink / raw)
  To: linux-snps-arc

The drm core has a nice ready-made helper for exactly the simple case
where it should fire on the next vblank.

Note that arming the vblank event in _begin is probably too early, and
might easily result in the vblank firing too early, before the new set
of planes are actually disabled. But that's kinda a minor issue
compared to just outright hanging userspace.

v2: Be more robust and either arm, when the CRTC is on, or just send
the event out right away.

Cc: Carlos Palminha <palminha at synopsys.com>
Cc: Alexey Brodkin <abrodkin at synopsys.com>
Cc: linux-snps-arc at lists.infradead.org
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/arc/arcpgu_crtc.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c
index d5ca0c280e68..c9f183b11df9 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -145,16 +145,17 @@ static int arc_pgu_crtc_atomic_check(struct drm_crtc *crtc,
 static void arc_pgu_crtc_atomic_begin(struct drm_crtc *crtc,
 				      struct drm_crtc_state *state)
 {
-	struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
-	unsigned long flags;
-
-	if (crtc->state->event) {
-		struct drm_pending_vblank_event *event = crtc->state->event;
+	struct drm_pending_vblank_event *event = crtc->state->event;
 
+	if (event) {
 		crtc->state->event = NULL;
-		event->pipe = drm_crtc_index(crtc);
 
-		WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+		spin_lock_irq(&crtc->dev->event_lock);
+		if (drm_crtc_vblank_get(crtc) == 0)
+			drm_crtc_arm_vblank_event(crtc, event);
+		else
+			drm_crtc_send_vblank_event(crtc, event);
+		spin_unlock_irq(&crtc->dev->event_lock);
 	}
 }
 
-- 
2.8.1

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

* [PATCH 15/26] drm/arc: Implement nonblocking commit correctly
       [not found] <1464546923-13439-1-git-send-email-daniel.vetter@ffwll.ch>
  2016-05-29 18:35 ` [PATCH 13/26] drm/arc: Nuke event_list Daniel Vetter
  2016-05-29 18:35 ` [PATCH 14/26] drm/arc: Actually bother with handling atomic events Daniel Vetter
@ 2016-05-29 18:35 ` Daniel Vetter
  2016-05-30  8:15   ` [Intel-gfx] " Maarten Lankhorst
  2 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2016-05-29 18:35 UTC (permalink / raw)
  To: linux-snps-arc

Committing with block it is not.

Thanks to the fixed up vblank event handling we can just use the
helper support for nonblocking commits now.

Cc: Carlos Palminha <palminha at synopsys.com>
Cc: Alexey Brodkin <abrodkin at synopsys.com>
Cc: linux-snps-arc at lists.infradead.org
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index d407fd79a400..a92e533531c3 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -32,17 +32,11 @@ static void arcpgu_fb_output_poll_changed(struct drm_device *dev)
 		drm_fbdev_cma_hotplug_event(arcpgu->fbdev);
 }
 
-static int arcpgu_atomic_commit(struct drm_device *dev,
-				    struct drm_atomic_state *state, bool async)
-{
-	return drm_atomic_helper_commit(dev, state, false);
-}
-
 static struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = {
 	.fb_create  = drm_fb_cma_create,
 	.output_poll_changed = arcpgu_fb_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
-	.atomic_commit = arcpgu_atomic_commit,
+	.atomic_commit = drm_atomic_helper_commit,
 };
 
 static void arcpgu_setup_mode_config(struct drm_device *drm)
-- 
2.8.1

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

* [Intel-gfx] [PATCH 15/26] drm/arc: Implement nonblocking commit correctly
  2016-05-29 18:35 ` [PATCH 15/26] drm/arc: Implement nonblocking commit correctly Daniel Vetter
@ 2016-05-30  8:15   ` Maarten Lankhorst
  2016-05-30  9:24     ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Maarten Lankhorst @ 2016-05-30  8:15 UTC (permalink / raw)
  To: linux-snps-arc

Op 29-05-16 om 20:35 schreef Daniel Vetter:
> Committing with block it is not.
>
> Thanks to the fixed up vblank event handling we can just use the
> helper support for nonblocking commits now.
>
> Cc: Carlos Palminha <palminha at synopsys.com>
> Cc: Alexey Brodkin <abrodkin at synopsys.com>
> Cc: linux-snps-arc at lists.infradead.org
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
This breaks page flip on arc, it uses drm_atomic_helper_page_flip.

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

* [Intel-gfx] [PATCH 15/26] drm/arc: Implement nonblocking commit correctly
  2016-05-30  8:15   ` [Intel-gfx] " Maarten Lankhorst
@ 2016-05-30  9:24     ` Daniel Vetter
  2016-05-30  9:36       ` Maarten Lankhorst
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2016-05-30  9:24 UTC (permalink / raw)
  To: linux-snps-arc

On Mon, May 30, 2016@10:15:14AM +0200, Maarten Lankhorst wrote:
> Op 29-05-16 om 20:35 schreef Daniel Vetter:
> > Committing with block it is not.
> >
> > Thanks to the fixed up vblank event handling we can just use the
> > helper support for nonblocking commits now.
> >
> > Cc: Carlos Palminha <palminha at synopsys.com>
> > Cc: Alexey Brodkin <abrodkin at synopsys.com>
> > Cc: linux-snps-arc at lists.infradead.org
> > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> This breaks page flip on arc, it uses drm_atomic_helper_page_flip.

How exactly does this break page_flip? Note that the commit to implement
generic nonblocking commit in drm_atomic_helper_commit is _before_ this
patch in the series.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* [Intel-gfx] [PATCH 15/26] drm/arc: Implement nonblocking commit correctly
  2016-05-30  9:24     ` Daniel Vetter
@ 2016-05-30  9:36       ` Maarten Lankhorst
  2016-05-30 15:10         ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Maarten Lankhorst @ 2016-05-30  9:36 UTC (permalink / raw)
  To: linux-snps-arc

Op 30-05-16 om 11:24 schreef Daniel Vetter:
> On Mon, May 30, 2016@10:15:14AM +0200, Maarten Lankhorst wrote:
>> Op 29-05-16 om 20:35 schreef Daniel Vetter:
>>> Committing with block it is not.
>>>
>>> Thanks to the fixed up vblank event handling we can just use the
>>> helper support for nonblocking commits now.
>>>
>>> Cc: Carlos Palminha <palminha at synopsys.com>
>>> Cc: Alexey Brodkin <abrodkin at synopsys.com>
>>> Cc: linux-snps-arc at lists.infradead.org
>>> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
>> This breaks page flip on arc, it uses drm_atomic_helper_page_flip.
> How exactly does this break page_flip? Note that the commit to implement
> generic nonblocking commit in drm_atomic_helper_commit is _before_ this
> patch in the series.
> -Daniel

This is patch 15/16, I found this in patch 21/26:

@@ -1147,8 +1206,11 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 {
 	int ret;
 
-	if (nonblock)
-		return -EBUSY;

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

* [Intel-gfx] [PATCH 15/26] drm/arc: Implement nonblocking commit correctly
  2016-05-30  9:36       ` Maarten Lankhorst
@ 2016-05-30 15:10         ` Daniel Vetter
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2016-05-30 15:10 UTC (permalink / raw)
  To: linux-snps-arc

On Mon, May 30, 2016@11:36:06AM +0200, Maarten Lankhorst wrote:
> Op 30-05-16 om 11:24 schreef Daniel Vetter:
> > On Mon, May 30, 2016@10:15:14AM +0200, Maarten Lankhorst wrote:
> >> Op 29-05-16 om 20:35 schreef Daniel Vetter:
> >>> Committing with block it is not.
> >>>
> >>> Thanks to the fixed up vblank event handling we can just use the
> >>> helper support for nonblocking commits now.
> >>>
> >>> Cc: Carlos Palminha <palminha at synopsys.com>
> >>> Cc: Alexey Brodkin <abrodkin at synopsys.com>
> >>> Cc: linux-snps-arc at lists.infradead.org
> >>> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> >> This breaks page flip on arc, it uses drm_atomic_helper_page_flip.
> > How exactly does this break page_flip? Note that the commit to implement
> > generic nonblocking commit in drm_atomic_helper_commit is _before_ this
> > patch in the series.
> > -Daniel
> 
> This is patch 15/16, I found this in patch 21/26:
> 
> @@ -1147,8 +1206,11 @@ int drm_atomic_helper_commit(struct drm_device *dev,
>  {
>  	int ret;
>  
> -	if (nonblock)
> -		return -EBUSY;

Oh right, I mixed things up. Most of the prep work is for drm event
handling. We need to do that _before_ the non-blocking commit lands for
the drivers that just directly reuse drm_atomic_helper_commit, since the
nonblocking helpers will time out when drm events don't work.

But this one indeed should only happen after that commit. I'll reorder.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2016-05-30 15:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1464546923-13439-1-git-send-email-daniel.vetter@ffwll.ch>
2016-05-29 18:35 ` [PATCH 13/26] drm/arc: Nuke event_list Daniel Vetter
2016-05-29 18:35 ` [PATCH 14/26] drm/arc: Actually bother with handling atomic events Daniel Vetter
2016-05-29 18:35 ` [PATCH 15/26] drm/arc: Implement nonblocking commit correctly Daniel Vetter
2016-05-30  8:15   ` [Intel-gfx] " Maarten Lankhorst
2016-05-30  9:24     ` Daniel Vetter
2016-05-30  9:36       ` Maarten Lankhorst
2016-05-30 15:10         ` Daniel Vetter

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