[Intel-gfx] [PATCH 2/4] drm/i915: Switch to per-crtc vblank vfuncs

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 19 17:30:51 UTC 2019


Quoting Ville Syrjala (2019-06-19 18:08:40)
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Switch from the driver-wide vblank vfuncs to the per-crtc ones so that
> we don't have so many platform specific vfuncs in the driver struct.
> 
> We still need to do something about the rest fo the irq vfuncs...
> 
> v2: s/INTEL_GEN>=3/IS_GEN3/
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 104 ++++++++++++++++---
>  drivers/gpu/drm/i915/i915_irq.c              |  93 +++++++----------
>  drivers/gpu/drm/i915/i915_irq.h              |  14 +++
>  3 files changed, 143 insertions(+), 68 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 5f30f348b0c0..e55bd75528c1 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -13567,7 +13567,7 @@ u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc)
>         if (!vblank->max_vblank_count)
>                 return (u32)drm_crtc_accurate_vblank_count(&crtc->base);
>  
> -       return dev->driver->get_vblank_counter(dev, crtc->pipe);
> +       return crtc->base.funcs->get_vblank_counter(&crtc->base);
>  }
>  
>  static void intel_update_crtc(struct drm_crtc *crtc,
> @@ -14105,18 +14105,6 @@ static int intel_atomic_commit(struct drm_device *dev,
>         return 0;
>  }
>  
> -static const struct drm_crtc_funcs intel_crtc_funcs = {
> -       .gamma_set = drm_atomic_helper_legacy_gamma_set,
> -       .set_config = drm_atomic_helper_set_config,
> -       .destroy = intel_crtc_destroy,
> -       .page_flip = drm_atomic_helper_page_flip,
> -       .atomic_duplicate_state = intel_crtc_duplicate_state,
> -       .atomic_destroy_state = intel_crtc_destroy_state,
> -       .set_crc_source = intel_crtc_set_crc_source,
> -       .verify_crc_source = intel_crtc_verify_crc_source,
> -       .get_crc_sources = intel_crtc_get_crc_sources,
> -};
> -
>  struct wait_rps_boost {
>         struct wait_queue_entry wait;
>  
> @@ -14910,8 +14898,76 @@ static void intel_crtc_init_scalers(struct intel_crtc *crtc,
>         scaler_state->scaler_id = -1;
>  }
>  
> +#define INTEL_CRTC_FUNCS \
> +       .gamma_set = drm_atomic_helper_legacy_gamma_set, \
> +       .set_config = drm_atomic_helper_set_config, \
> +       .destroy = intel_crtc_destroy, \
> +       .page_flip = drm_atomic_helper_page_flip, \
> +       .atomic_duplicate_state = intel_crtc_duplicate_state, \
> +       .atomic_destroy_state = intel_crtc_destroy_state, \
> +       .set_crc_source = intel_crtc_set_crc_source, \
> +       .verify_crc_source = intel_crtc_verify_crc_source, \
> +       .get_crc_sources = intel_crtc_get_crc_sources
> +
> +static const struct drm_crtc_funcs bdw_crtc_funcs = {
> +       INTEL_CRTC_FUNCS,
> +
> +       .get_vblank_counter = g4x_get_vblank_counter,
> +       .enable_vblank = bdw_enable_vblank,
> +       .disable_vblank = bdw_disable_vblank,

Used if (INTEL_GEN(dev_priv) >= 8) && !GMCH
Used to be gen8_enable_vblank and used for all gen8+ && !GMCH.

> +};
> +
> +static const struct drm_crtc_funcs ilk_crtc_funcs = {
> +       INTEL_CRTC_FUNCS,
> +
> +       .get_vblank_counter = g4x_get_vblank_counter,
> +       .enable_vblank = ilk_enable_vblank,
> +       .disable_vblank = ilk_disable_vblank,

Ilk/Ironlake only.

> +};
> +
> +static const struct drm_crtc_funcs g4x_crtc_funcs = {
> +       INTEL_CRTC_FUNCS,
> +
> +       .get_vblank_counter = g4x_get_vblank_counter,
> +       .enable_vblank = i965_enable_vblank,
> +       .disable_vblank = i965_disable_vblank,

g4x/vlv/chv, checks out same as before/after

> +};
> +
> +static const struct drm_crtc_funcs i965_crtc_funcs = {
> +       INTEL_CRTC_FUNCS,
> +
> +       .get_vblank_counter = i915_get_vblank_counter,
> +       .enable_vblank = i965_enable_vblank,
> +       .disable_vblank = i965_disable_vblank,

The rest of gen4

> +};
> +
> +static const struct drm_crtc_funcs i945gm_crtc_funcs = {
> +       INTEL_CRTC_FUNCS,
> +
> +       .get_vblank_counter = i915_get_vblank_counter,
> +       .enable_vblank = i945gm_enable_vblank,
> +       .disable_vblank = i945gm_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs i915_crtc_funcs = {
> +       INTEL_CRTC_FUNCS,
> +
> +       .get_vblank_counter = i915_get_vblank_counter,
> +       .enable_vblank = i8xx_enable_vblank,
> +       .disable_vblank = i8xx_disable_vblank,
> +};
> +
> +static const struct drm_crtc_funcs i8xx_crtc_funcs = {
> +       INTEL_CRTC_FUNCS,
> +
> +       /* no hw vblank counter */
> +       .enable_vblank = i8xx_enable_vblank,
> +       .disable_vblank = i8xx_disable_vblank,

And the look all consistent.

I'm convinced that this is all the same per-platform functions as
before.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list