]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Convert to CRTC VBLANK callbacks
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 23 Jan 2020 13:59:28 +0000 (14:59 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Thu, 13 Feb 2020 12:08:13 +0000 (13:08 +0100)
VBLANK callbacks in struct drm_driver are deprecated in favor of their
equivalents in struct drm_crtc_funcs. Convert i915 over.

The callback struct drm_driver.get_scanout_position() is deprecated
in favor of struct drm_crtc_helper_funcs.get_scanout_position().
i915 doesn't use CRTC helpers. Instead pass i915's implementation of
get_scanout_position() to DRM core's
drm_crtc_vblank_helper_get_vblank_timestamp_internal().

v3:
* rename dcrtc to _crtc
* use intel_ prefix for i915_crtc_get_vblank_timestamp()
* update for drm_crtc_vblank_helper_get_vblank_timestamp_internal()
v2:
* use DRM's implementation of get_vblank_timestamp()
* simplify function names

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200123135943.24140-8-tzimmermann@suse.de
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_irq.h

index 1860da0a493e321582a3843b308e916244695d94..fbd56248efa80957c49bd250b5c2ceda90815f99 100644 (file)
@@ -15939,6 +15939,7 @@ static const struct drm_crtc_funcs bdw_crtc_funcs = {
        .get_vblank_counter = g4x_get_vblank_counter,
        .enable_vblank = bdw_enable_vblank,
        .disable_vblank = bdw_disable_vblank,
+       .get_vblank_timestamp = intel_crtc_get_vblank_timestamp,
 };
 
 static const struct drm_crtc_funcs ilk_crtc_funcs = {
@@ -15947,6 +15948,7 @@ static const struct drm_crtc_funcs ilk_crtc_funcs = {
        .get_vblank_counter = g4x_get_vblank_counter,
        .enable_vblank = ilk_enable_vblank,
        .disable_vblank = ilk_disable_vblank,
+       .get_vblank_timestamp = intel_crtc_get_vblank_timestamp,
 };
 
 static const struct drm_crtc_funcs g4x_crtc_funcs = {
@@ -15955,6 +15957,7 @@ static const struct drm_crtc_funcs g4x_crtc_funcs = {
        .get_vblank_counter = g4x_get_vblank_counter,
        .enable_vblank = i965_enable_vblank,
        .disable_vblank = i965_disable_vblank,
+       .get_vblank_timestamp = intel_crtc_get_vblank_timestamp,
 };
 
 static const struct drm_crtc_funcs i965_crtc_funcs = {
@@ -15963,6 +15966,7 @@ static const struct drm_crtc_funcs i965_crtc_funcs = {
        .get_vblank_counter = i915_get_vblank_counter,
        .enable_vblank = i965_enable_vblank,
        .disable_vblank = i965_disable_vblank,
+       .get_vblank_timestamp = intel_crtc_get_vblank_timestamp,
 };
 
 static const struct drm_crtc_funcs i915gm_crtc_funcs = {
@@ -15971,6 +15975,7 @@ static const struct drm_crtc_funcs i915gm_crtc_funcs = {
        .get_vblank_counter = i915_get_vblank_counter,
        .enable_vblank = i915gm_enable_vblank,
        .disable_vblank = i915gm_disable_vblank,
+       .get_vblank_timestamp = intel_crtc_get_vblank_timestamp,
 };
 
 static const struct drm_crtc_funcs i915_crtc_funcs = {
@@ -15979,6 +15984,7 @@ static const struct drm_crtc_funcs i915_crtc_funcs = {
        .get_vblank_counter = i915_get_vblank_counter,
        .enable_vblank = i8xx_enable_vblank,
        .disable_vblank = i8xx_disable_vblank,
+       .get_vblank_timestamp = intel_crtc_get_vblank_timestamp,
 };
 
 static const struct drm_crtc_funcs i8xx_crtc_funcs = {
@@ -15987,6 +15993,7 @@ static const struct drm_crtc_funcs i8xx_crtc_funcs = {
        /* no hw vblank counter */
        .enable_vblank = i8xx_enable_vblank,
        .disable_vblank = i8xx_disable_vblank,
+       .get_vblank_timestamp = intel_crtc_get_vblank_timestamp,
 };
 
 static struct intel_crtc *intel_crtc_alloc(void)
index b790896ed809bbedee0c8ddd80653edec81e27f7..3bfc777a7a3410faa7c3a3470a30486074374075 100644 (file)
@@ -2760,9 +2760,6 @@ static struct drm_driver driver = {
        .gem_prime_export = i915_gem_prime_export,
        .gem_prime_import = i915_gem_prime_import,
 
-       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
-       .get_scanout_position = i915_get_crtc_scanoutpos,
-
        .dumb_create = i915_gem_dumb_create,
        .dumb_map_offset = i915_gem_dumb_mmap_offset,
 
index 42b79f577500e00ebe5bf5f25695dec24924dccb..bb16a7a16c493eba223d42ef8eafb8532996270b 100644 (file)
@@ -762,13 +762,15 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
        return (position + crtc->scanline_offset) % vtotal;
 }
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
-                             bool in_vblank_irq, int *vpos, int *hpos,
-                             ktime_t *stime, ktime_t *etime,
-                             const struct drm_display_mode *mode)
+static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
+                                    bool in_vblank_irq,
+                                    int *vpos, int *hpos,
+                                    ktime_t *stime, ktime_t *etime,
+                                    const struct drm_display_mode *mode)
 {
+       struct drm_device *dev = _crtc->dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
-       struct intel_crtc *crtc = to_intel_crtc(drm_crtc_from_index(dev, index));
+       struct intel_crtc *crtc = to_intel_crtc(_crtc);
        enum pipe pipe = crtc->pipe;
        int position;
        int vbl_start, vbl_end, hsync_start, htotal, vtotal;
@@ -879,6 +881,14 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
        return true;
 }
 
+bool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error,
+                                    ktime_t *vblank_time, bool in_vblank_irq)
+{
+       return drm_crtc_vblank_helper_get_vblank_timestamp_internal(
+               crtc, max_error, vblank_time, in_vblank_irq,
+               i915_get_crtc_scanoutpos, NULL);
+}
+
 int intel_get_crtc_scanline(struct intel_crtc *crtc)
 {
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
index 812c47a9c2d6b87ada7e04c13f33e0666c440152..25f25cd9581813286fd0adf7da346e15573e89f3 100644 (file)
@@ -101,10 +101,8 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
 void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,
                                     u8 pipe_mask);
 
-bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
-                             bool in_vblank_irq, int *vpos, int *hpos,
-                             ktime_t *stime, ktime_t *etime,
-                             const struct drm_display_mode *mode);
+bool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error,
+                                    ktime_t *vblank_time, bool in_vblank_irq);
 
 u32 i915_get_vblank_counter(struct drm_crtc *crtc);
 u32 g4x_get_vblank_counter(struct drm_crtc *crtc);