diff mbox

[1/2] drm/i915: Use drm_crtc_vblank_wait_one_vblank instead the legacy one.

Message ID 1470259054-23444-1-git-send-email-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi Aug. 3, 2016, 9:17 p.m. UTC
No functional change.

This is the last user of legacy function so we will be able
to clean up drm_irq.c a bit.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jani Nikula Aug. 4, 2016, 7:38 a.m. UTC | #1
On Thu, 04 Aug 2016, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> No functional change.
>
> This is the last user of legacy function so we will be able
> to clean up drm_irq.c a bit.
>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_drv.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 50cdc89..37a3ae8 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1202,7 +1202,10 @@ intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state)
>  static inline void
>  intel_wait_for_vblank(struct drm_device *dev, int pipe)
>  {
> -	drm_wait_one_vblank(dev, pipe);
> +	struct drm_i915_private *dev_priv = to_i915(dev);
> +	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
> +
> +	drm_crtc_wait_one_vblank(crtc);

With these changes, in almost all intel_wait_for_vblank() call paths
we'll have crtc available, so we end up calling
intel_wait_for_vblank(intel_crtc->pipe), which will then be converted
back to drm_crtc via dev_priv->pipe_to_crtc_mapping[pipe], and again to
pipe using drm_crtc_index(crtc)...

I'm tempted to say we should *first* replace all intel_wait_for_vblank()
calls with drm_crtc_wait_one_vblank() where possible. After that, we
might just call
drm_crtc_wait_one_vblank(dev_priv->pipe_to_crtc_mapping[pipe])
everywhere else.

BR,
Jani.



>  }
>  static inline void
>  intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)
Ville Syrjala Aug. 4, 2016, 7:52 a.m. UTC | #2
On Thu, Aug 04, 2016 at 10:38:02AM +0300, Jani Nikula wrote:
> On Thu, 04 Aug 2016, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> > No functional change.
> >
> > This is the last user of legacy function so we will be able
> > to clean up drm_irq.c a bit.
> >
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_drv.h | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 50cdc89..37a3ae8 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1202,7 +1202,10 @@ intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state)
> >  static inline void
> >  intel_wait_for_vblank(struct drm_device *dev, int pipe)
> >  {
> > -	drm_wait_one_vblank(dev, pipe);
> > +	struct drm_i915_private *dev_priv = to_i915(dev);
> > +	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
> > +
> > +	drm_crtc_wait_one_vblank(crtc);
> 
> With these changes, in almost all intel_wait_for_vblank() call paths
> we'll have crtc available, so we end up calling
> intel_wait_for_vblank(intel_crtc->pipe), which will then be converted
> back to drm_crtc via dev_priv->pipe_to_crtc_mapping[pipe], and again to
> pipe using drm_crtc_index(crtc)...
> 
> I'm tempted to say we should *first* replace all intel_wait_for_vblank()
> calls with drm_crtc_wait_one_vblank() where possible. After that, we
> might just call
> drm_crtc_wait_one_vblank(dev_priv->pipe_to_crtc_mapping[pipe])
> everywhere else.

On a slight tangent, I'd like to see patches to 
s/dev_priv->pipe_to_crtc_mapping[pipe]/whatever_is_the_function_name(pipe)/
and make those functions return intel_crtc instead of drm_crtc.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 50cdc89..37a3ae8 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1202,7 +1202,10 @@  intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state)
 static inline void
 intel_wait_for_vblank(struct drm_device *dev, int pipe)
 {
-	drm_wait_one_vblank(dev, pipe);
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+
+	drm_crtc_wait_one_vblank(crtc);
 }
 static inline void
 intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)