diff mbox series

[RFC,5/7] drm/i915: Add flip_done_handler definition

Message ID 20200306113927.16904-6-karthik.b.s@intel.com (mailing list archive)
State New, archived
Headers show
Series Asynchronous flip implementation for i915 | expand

Commit Message

Karthik B S March 6, 2020, 11:39 a.m. UTC
Send the flip done event in the handler and disable the interrupt.

Signed-off-by: Karthik B S <karthik.b.s@intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Zanoni, Paulo R March 9, 2020, 11:19 p.m. UTC | #1
Em sex, 2020-03-06 às 17:09 +0530, Karthik B S escreveu:
> Send the flip done event in the handler and disable the interrupt.
> 
> Signed-off-by: Karthik B S <karthik.b.s@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 5955e737a45d..1feda9aecf4a 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1243,6 +1243,24 @@ display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
>  			     u32 crc4) {}
>  #endif
>  
> +static void flip_done_handler(struct drm_i915_private *dev_priv,
> +			      unsigned int pipe)

The compiler is going to complain that we added a static function with
no caller.

See my comment on commit 1: please squash this patch with the one that
makes use of the new function.

> +{
> +	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
> +	struct drm_crtc_state *crtc_state = crtc->base.state;
> +	struct drm_device *dev = &dev_priv->drm;
> +	unsigned long irqflags;
> +
> +	spin_lock_irqsave(&dev->event_lock, irqflags);
> +
> +	if (crtc_state->event->base.event->type == DRM_EVENT_FLIP_COMPLETE) {
> +		drm_crtc_send_vblank_event(&crtc->base, crtc_state->event);
> +		crtc_state->event = NULL;
> +	}
> +
> +	spin_unlock_irqrestore(&dev->event_lock, irqflags);
> +	icl_disable_flip_done(&crtc->base);
> +}
>  
>  static void hsw_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
>  				     enum pipe pipe)
Karthik B S March 10, 2020, 12:52 p.m. UTC | #2
> -----Original Message-----
> From: Zanoni, Paulo R <paulo.r.zanoni@intel.com>
> Sent: Tuesday, March 10, 2020 4:49 AM
> To: B S, Karthik <karthik.b.s@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: ville.syrjala@linux.intel.com; Kulkarni, Vandita
> <vandita.kulkarni@intel.com>; Shankar, Uma <uma.shankar@intel.com>
> Subject: Re: [RFC 5/7] drm/i915: Add flip_done_handler definition
> 
> Em sex, 2020-03-06 às 17:09 +0530, Karthik B S escreveu:
> > Send the flip done event in the handler and disable the interrupt.
> >
> > Signed-off-by: Karthik B S <karthik.b.s@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_irq.c | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c
> > b/drivers/gpu/drm/i915/i915_irq.c index 5955e737a45d..1feda9aecf4a
> > 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -1243,6 +1243,24 @@ display_pipe_crc_irq_handler(struct
> drm_i915_private *dev_priv,
> >  			     u32 crc4) {}
> >  #endif
> >
> > +static void flip_done_handler(struct drm_i915_private *dev_priv,
> > +			      unsigned int pipe)
> 
> The compiler is going to complain that we added a static function with no
> caller.
> 
> See my comment on commit 1: please squash this patch with the one that
> makes use of the new function.

Sure. Will restructure the patches as per your feedback. Thanks.
> 
> > +{
> > +	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
> > +	struct drm_crtc_state *crtc_state = crtc->base.state;
> > +	struct drm_device *dev = &dev_priv->drm;
> > +	unsigned long irqflags;
> > +
> > +	spin_lock_irqsave(&dev->event_lock, irqflags);
> > +
> > +	if (crtc_state->event->base.event->type ==
> DRM_EVENT_FLIP_COMPLETE) {
> > +		drm_crtc_send_vblank_event(&crtc->base, crtc_state-
> >event);
> > +		crtc_state->event = NULL;
> > +	}
> > +
> > +	spin_unlock_irqrestore(&dev->event_lock, irqflags);
> > +	icl_disable_flip_done(&crtc->base);
> > +}
> >
> >  static void hsw_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
> >  				     enum pipe pipe)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 5955e737a45d..1feda9aecf4a 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1243,6 +1243,24 @@  display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
 			     u32 crc4) {}
 #endif
 
+static void flip_done_handler(struct drm_i915_private *dev_priv,
+			      unsigned int pipe)
+{
+	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
+	struct drm_crtc_state *crtc_state = crtc->base.state;
+	struct drm_device *dev = &dev_priv->drm;
+	unsigned long irqflags;
+
+	spin_lock_irqsave(&dev->event_lock, irqflags);
+
+	if (crtc_state->event->base.event->type == DRM_EVENT_FLIP_COMPLETE) {
+		drm_crtc_send_vblank_event(&crtc->base, crtc_state->event);
+		crtc_state->event = NULL;
+	}
+
+	spin_unlock_irqrestore(&dev->event_lock, irqflags);
+	icl_disable_flip_done(&crtc->base);
+}
 
 static void hsw_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
 				     enum pipe pipe)