[Intel-gfx] [PATCH 18/22] drm/i915: Use dev_priv consistently through the intel_frontbuffer interface
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Thu Jul 28 09:36:29 UTC 2016
On ke, 2016-07-27 at 12:14 +0100, Chris Wilson wrote:
> Rather than a mismash of struct drm_device *dev and struct
> drm_i915_private *dev_priv being used freely within a function, be
> consistent and only pass along dev_priv.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Mechanical,
Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 10 ++++----
> drivers/gpu/drm/i915/intel_dp.c | 14 +++++-------
> drivers/gpu/drm/i915/intel_drv.h | 21 +++++++++--------
> drivers/gpu/drm/i915/intel_frontbuffer.c | 39 ++++++++++++--------------------
> drivers/gpu/drm/i915/intel_overlay.c | 3 +--
> drivers/gpu/drm/i915/intel_psr.c | 26 +++++++++------------
> 6 files changed, 49 insertions(+), 64 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 1c70f68328b4..9f15ced6fc7c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4565,12 +4565,11 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state)
> struct drm_atomic_state *old_state = old_crtc_state->base.state;
> struct intel_crtc_state *pipe_config =
> to_intel_crtc_state(crtc->base.state);
> - struct drm_device *dev = crtc->base.dev;
> struct drm_plane *primary = crtc->base.primary;
> struct drm_plane_state *old_pri_state =
> drm_atomic_get_existing_plane_state(old_state, primary);
>
> - intel_frontbuffer_flip(dev, pipe_config->fb_bits);
> + intel_frontbuffer_flip(to_i915(crtc->base.dev), pipe_config->fb_bits);
>
> crtc->wm.cxsr_allowed = true;
>
> @@ -4693,7 +4692,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned plane_mask
> * to compute the mask of flip planes precisely. For the time being
> * consider this a flip to a NULL plane.
> */
> - intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_ALL_MASK(pipe));
> + intel_frontbuffer_flip(to_i915(dev), INTEL_FRONTBUFFER_ALL_MASK(pipe));
> }
>
> static void ironlake_crtc_enable(struct drm_crtc *crtc)
> @@ -10959,7 +10958,8 @@ static void intel_unpin_work_fn(struct work_struct *__work)
>
> i915_gem_request_put(work->flip_queued_req);
>
> - intel_frontbuffer_flip_complete(dev, to_intel_plane(primary)->frontbuffer_bit);
> + intel_frontbuffer_flip_complete(to_i915(dev),
> + to_intel_plane(primary)->frontbuffer_bit);
> intel_fbc_post_update(crtc);
> drm_framebuffer_unreference(work->old_fb);
>
> @@ -11734,7 +11734,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> to_intel_plane(primary)->frontbuffer_bit);
> mutex_unlock(&dev->struct_mutex);
>
> - intel_frontbuffer_flip_prepare(dev,
> + intel_frontbuffer_flip_prepare(to_i915(dev),
> to_intel_plane(primary)->frontbuffer_bit);
>
> trace_i915_flip_request(intel_crtc->plane, obj);
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 21b04c3eda41..2fd90d153fe7 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5186,7 +5186,7 @@ unlock:
>
> /**
> * intel_edp_drrs_invalidate - Disable Idleness DRRS
> - * @dev: DRM device
> + * @dev_priv: i915 device
> * @frontbuffer_bits: frontbuffer plane tracking bits
> *
> * This function gets called everytime rendering on the given planes start.
> @@ -5194,10 +5194,9 @@ unlock:
> *
> * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
> */
> -void intel_edp_drrs_invalidate(struct drm_device *dev,
> - unsigned frontbuffer_bits)
> +void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
> + unsigned frontbuffer_bits)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> struct drm_crtc *crtc;
> enum pipe pipe;
>
> @@ -5229,7 +5228,7 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
>
> /**
> * intel_edp_drrs_flush - Restart Idleness DRRS
> - * @dev: DRM device
> + * @dev_priv: i915 device
> * @frontbuffer_bits: frontbuffer plane tracking bits
> *
> * This function gets called every time rendering on the given planes has
> @@ -5239,10 +5238,9 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
> *
> * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
> */
> -void intel_edp_drrs_flush(struct drm_device *dev,
> - unsigned frontbuffer_bits)
> +void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
> + unsigned frontbuffer_bits)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> struct drm_crtc *crtc;
> enum pipe pipe;
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 5294039cf238..6f447d485db1 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1135,11 +1135,11 @@ void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
> uint32_t ddi_signal_levels(struct intel_dp *intel_dp);
>
> /* intel_frontbuffer.c */
> -void intel_frontbuffer_flip_prepare(struct drm_device *dev,
> +void intel_frontbuffer_flip_prepare(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits);
> -void intel_frontbuffer_flip_complete(struct drm_device *dev,
> +void intel_frontbuffer_flip_complete(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits);
> -void intel_frontbuffer_flip(struct drm_device *dev,
> +void intel_frontbuffer_flip(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits);
> unsigned int intel_fb_align_height(struct drm_device *dev,
> unsigned int height,
> @@ -1413,11 +1413,12 @@ uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);
> void intel_plane_destroy(struct drm_plane *plane);
> void intel_edp_drrs_enable(struct intel_dp *intel_dp);
> void intel_edp_drrs_disable(struct intel_dp *intel_dp);
> -void intel_edp_drrs_invalidate(struct drm_device *dev,
> - unsigned frontbuffer_bits);
> -void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits);
> +void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
> + unsigned frontbuffer_bits);
> +void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
> + unsigned frontbuffer_bits);
> bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
> - struct intel_digital_port *port);
> + struct intel_digital_port *port);
>
> void
> intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
> @@ -1590,13 +1591,13 @@ static inline void intel_backlight_device_unregister(struct intel_connector *con
> /* intel_psr.c */
> void intel_psr_enable(struct intel_dp *intel_dp);
> void intel_psr_disable(struct intel_dp *intel_dp);
> -void intel_psr_invalidate(struct drm_device *dev,
> +void intel_psr_invalidate(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits);
> -void intel_psr_flush(struct drm_device *dev,
> +void intel_psr_flush(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits,
> enum fb_op_origin origin);
> void intel_psr_init(struct drm_device *dev);
> -void intel_psr_single_frame_update(struct drm_device *dev,
> +void intel_psr_single_frame_update(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits);
>
> /* intel_runtime_pm.c */
> diff --git a/drivers/gpu/drm/i915/intel_frontbuffer.c b/drivers/gpu/drm/i915/intel_frontbuffer.c
> index 636324da21c2..42f718bb584c 100644
> --- a/drivers/gpu/drm/i915/intel_frontbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_frontbuffer.c
> @@ -80,8 +80,7 @@ void __intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
> enum fb_op_origin origin,
> unsigned int frontbuffer_bits)
> {
> - struct drm_device *dev = obj->base.dev;
> - struct drm_i915_private *dev_priv = to_i915(dev);
> + struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
>
> if (origin == ORIGIN_CS) {
> spin_lock(&dev_priv->fb_tracking.lock);
> @@ -90,8 +89,8 @@ void __intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
> spin_unlock(&dev_priv->fb_tracking.lock);
> }
>
> - intel_psr_invalidate(dev, frontbuffer_bits);
> - intel_edp_drrs_invalidate(dev, frontbuffer_bits);
> + intel_psr_invalidate(dev_priv, frontbuffer_bits);
> + intel_edp_drrs_invalidate(dev_priv, frontbuffer_bits);
> intel_fbc_invalidate(dev_priv, frontbuffer_bits, origin);
> }
>
> @@ -107,12 +106,10 @@ void __intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
> *
> * Can be called without any locks held.
> */
> -static void intel_frontbuffer_flush(struct drm_device *dev,
> +static void intel_frontbuffer_flush(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits,
> enum fb_op_origin origin)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> -
> /* Delay flushing when rings are still busy.*/
> spin_lock(&dev_priv->fb_tracking.lock);
> frontbuffer_bits &= ~dev_priv->fb_tracking.busy_bits;
> @@ -121,8 +118,8 @@ static void intel_frontbuffer_flush(struct drm_device *dev,
> if (frontbuffer_bits == 0)
> return;
>
> - intel_edp_drrs_flush(dev, frontbuffer_bits);
> - intel_psr_flush(dev, frontbuffer_bits, origin);
> + intel_edp_drrs_flush(dev_priv, frontbuffer_bits);
> + intel_psr_flush(dev_priv, frontbuffer_bits, origin);
> intel_fbc_flush(dev_priv, frontbuffer_bits, origin);
> }
>
> @@ -141,8 +138,7 @@ void __intel_fb_obj_flush(struct drm_i915_gem_object *obj,
> enum fb_op_origin origin,
> unsigned int frontbuffer_bits)
> {
> - struct drm_device *dev = obj->base.dev;
> - struct drm_i915_private *dev_priv = to_i915(dev);
> + struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
>
> if (retire) {
> spin_lock(&dev_priv->fb_tracking.lock);
> @@ -153,7 +149,7 @@ void __intel_fb_obj_flush(struct drm_i915_gem_object *obj,
> }
>
> if (frontbuffer_bits)
> - intel_frontbuffer_flush(dev, frontbuffer_bits, origin);
> + intel_frontbuffer_flush(dev_priv, frontbuffer_bits, origin);
> }
>
> /**
> @@ -168,18 +164,16 @@ void __intel_fb_obj_flush(struct drm_i915_gem_object *obj,
> *
> * Can be called without any locks held.
> */
> -void intel_frontbuffer_flip_prepare(struct drm_device *dev,
> +void intel_frontbuffer_flip_prepare(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> -
> spin_lock(&dev_priv->fb_tracking.lock);
> dev_priv->fb_tracking.flip_bits |= frontbuffer_bits;
> /* Remove stale busy bits due to the old buffer. */
> dev_priv->fb_tracking.busy_bits &= ~frontbuffer_bits;
> spin_unlock(&dev_priv->fb_tracking.lock);
>
> - intel_psr_single_frame_update(dev, frontbuffer_bits);
> + intel_psr_single_frame_update(dev_priv, frontbuffer_bits);
> }
>
> /**
> @@ -192,11 +186,9 @@ void intel_frontbuffer_flip_prepare(struct drm_device *dev,
> *
> * Can be called without any locks held.
> */
> -void intel_frontbuffer_flip_complete(struct drm_device *dev,
> +void intel_frontbuffer_flip_complete(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> -
> spin_lock(&dev_priv->fb_tracking.lock);
> /* Mask any cancelled flips. */
> frontbuffer_bits &= dev_priv->fb_tracking.flip_bits;
> @@ -204,7 +196,8 @@ void intel_frontbuffer_flip_complete(struct drm_device *dev,
> spin_unlock(&dev_priv->fb_tracking.lock);
>
> if (frontbuffer_bits)
> - intel_frontbuffer_flush(dev, frontbuffer_bits, ORIGIN_FLIP);
> + intel_frontbuffer_flush(dev_priv,
> + frontbuffer_bits, ORIGIN_FLIP);
> }
>
> /**
> @@ -218,15 +211,13 @@ void intel_frontbuffer_flip_complete(struct drm_device *dev,
> *
> * Can be called without any locks held.
> */
> -void intel_frontbuffer_flip(struct drm_device *dev,
> +void intel_frontbuffer_flip(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> -
> spin_lock(&dev_priv->fb_tracking.lock);
> /* Remove stale busy bits due to the old buffer. */
> dev_priv->fb_tracking.busy_bits &= ~frontbuffer_bits;
> spin_unlock(&dev_priv->fb_tracking.lock);
>
> - intel_frontbuffer_flush(dev, frontbuffer_bits, ORIGIN_FLIP);
> + intel_frontbuffer_flush(dev_priv, frontbuffer_bits, ORIGIN_FLIP);
> }
> diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
> index 217fefc49bf9..ad08df49ed48 100644
> --- a/drivers/gpu/drm/i915/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/intel_overlay.c
> @@ -839,8 +839,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
> overlay->old_vid_bo = overlay->vid_bo;
> overlay->vid_bo = new_bo;
>
> - intel_frontbuffer_flip(&dev_priv->drm,
> - INTEL_FRONTBUFFER_OVERLAY(pipe));
> + intel_frontbuffer_flip(dev_priv, INTEL_FRONTBUFFER_OVERLAY(pipe));
>
> return 0;
>
> diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
> index 68bd0bb34817..adf2ce0f38c0 100644
> --- a/drivers/gpu/drm/i915/intel_psr.c
> +++ b/drivers/gpu/drm/i915/intel_psr.c
> @@ -628,9 +628,8 @@ unlock:
> mutex_unlock(&dev_priv->psr.lock);
> }
>
> -static void intel_psr_exit(struct drm_device *dev)
> +static void intel_psr_exit(struct drm_i915_private *dev_priv)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> struct intel_dp *intel_dp = dev_priv->psr.enabled;
> struct drm_crtc *crtc = dp_to_dig_port(intel_dp)->base.base.crtc;
> enum pipe pipe = to_intel_crtc(crtc)->pipe;
> @@ -639,7 +638,7 @@ static void intel_psr_exit(struct drm_device *dev)
> if (!dev_priv->psr.active)
> return;
>
> - if (HAS_DDI(dev)) {
> + if (HAS_DDI(dev_priv)) {
> val = I915_READ(EDP_PSR_CTL);
>
> WARN_ON(!(val & EDP_PSR_ENABLE));
> @@ -674,7 +673,7 @@ static void intel_psr_exit(struct drm_device *dev)
>
> /**
> * intel_psr_single_frame_update - Single Frame Update
> - * @dev: DRM device
> + * @dev_priv: i915 device
> * @frontbuffer_bits: frontbuffer plane tracking bits
> *
> * Some platforms support a single frame update feature that is used to
> @@ -682,10 +681,9 @@ static void intel_psr_exit(struct drm_device *dev)
> * So far it is only implemented for Valleyview and Cherryview because
> * hardware requires this to be done before a page flip.
> */
> -void intel_psr_single_frame_update(struct drm_device *dev,
> +void intel_psr_single_frame_update(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> struct drm_crtc *crtc;
> enum pipe pipe;
> u32 val;
> @@ -694,7 +692,7 @@ void intel_psr_single_frame_update(struct drm_device *dev,
> * Single frame update is already supported on BDW+ but it requires
> * many W/A and it isn't really needed.
> */
> - if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev))
> + if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
> return;
>
> mutex_lock(&dev_priv->psr.lock);
> @@ -720,7 +718,7 @@ void intel_psr_single_frame_update(struct drm_device *dev,
>
> /**
> * intel_psr_invalidate - Invalidade PSR
> - * @dev: DRM device
> + * @dev_priv: i915 device
> * @frontbuffer_bits: frontbuffer plane tracking bits
> *
> * Since the hardware frontbuffer tracking has gaps we need to integrate
> @@ -730,10 +728,9 @@ void intel_psr_single_frame_update(struct drm_device *dev,
> *
> * Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits."
> */
> -void intel_psr_invalidate(struct drm_device *dev,
> +void intel_psr_invalidate(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> struct drm_crtc *crtc;
> enum pipe pipe;
>
> @@ -750,14 +747,14 @@ void intel_psr_invalidate(struct drm_device *dev,
> dev_priv->psr.busy_frontbuffer_bits |= frontbuffer_bits;
>
> if (frontbuffer_bits)
> - intel_psr_exit(dev);
> + intel_psr_exit(dev_priv);
>
> mutex_unlock(&dev_priv->psr.lock);
> }
>
> /**
> * intel_psr_flush - Flush PSR
> - * @dev: DRM device
> + * @dev_priv: i915 device
> * @frontbuffer_bits: frontbuffer plane tracking bits
> * @origin: which operation caused the flush
> *
> @@ -768,10 +765,9 @@ void intel_psr_invalidate(struct drm_device *dev,
> *
> * Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits.
> */
> -void intel_psr_flush(struct drm_device *dev,
> +void intel_psr_flush(struct drm_i915_private *dev_priv,
> unsigned frontbuffer_bits, enum fb_op_origin origin)
> {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> struct drm_crtc *crtc;
> enum pipe pipe;
>
> @@ -789,7 +785,7 @@ void intel_psr_flush(struct drm_device *dev,
>
> /* By definition flush = invalidate + flush */
> if (frontbuffer_bits)
> - intel_psr_exit(dev);
> + intel_psr_exit(dev_priv);
>
> if (!dev_priv->psr.active && !dev_priv->psr.busy_frontbuffer_bits)
> if (!work_busy(&dev_priv->psr.work.work))
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list