]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: Convert to CRTC VBLANK callbacks
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 23 Jan 2020 13:59:26 +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 amdgpu over.

v2:
* don't wrap existing functions; change signature instead

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200123135943.24140-6-tzimmermann@suse.de
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 81a531b652aaca3eca6fea7115362971d8865e6f..9aff914608b82033ef8990243f20b20e449e8eb2 100644 (file)
@@ -1194,9 +1194,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
 int amdgpu_device_ip_suspend(struct amdgpu_device *adev);
 int amdgpu_device_suspend(struct drm_device *dev, bool fbcon);
 int amdgpu_device_resume(struct drm_device *dev, bool fbcon);
-u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
-int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
-void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
+u32 amdgpu_get_vblank_counter_kms(struct drm_crtc *crtc);
+int amdgpu_enable_vblank_kms(struct drm_crtc *crtc);
+void amdgpu_disable_vblank_kms(struct drm_crtc *crtc);
 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd,
                             unsigned long arg);
 
index a1e769d4417dee8ddaaaac46b6f016d38d220a6d..ad9c9546a64f17f6375d7e28db360d42b854c299 100644 (file)
@@ -99,7 +99,7 @@ static void amdgpu_display_flip_work_func(struct work_struct *__work)
             & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK)) ==
            (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
            (int)(work->target_vblank -
-                 amdgpu_get_vblank_counter_kms(adev->ddev, amdgpu_crtc->crtc_id)) > 0) {
+                 amdgpu_get_vblank_counter_kms(crtc)) > 0) {
                schedule_delayed_work(&work->flip_work, usecs_to_jiffies(1000));
                return;
        }
@@ -219,7 +219,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
        if (!adev->enable_virtual_display)
                work->base = amdgpu_bo_gpu_offset(new_abo);
        work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
-               amdgpu_get_vblank_counter_kms(dev, work->crtc_id);
+               amdgpu_get_vblank_counter_kms(crtc);
 
        /* we borrow the event spin lock for protecting flip_wrok */
        spin_lock_irqsave(&crtc->dev->event_lock, flags);
index 0749285dd1c7f575d54801da081282c4a037d4a0..9baa1ddf8693ee7f21ba47b52b16941bd8c4165f 100644 (file)
@@ -1377,10 +1377,6 @@ static struct drm_driver kms_driver = {
        .postclose = amdgpu_driver_postclose_kms,
        .lastclose = amdgpu_driver_lastclose_kms,
        .unload = amdgpu_driver_unload_kms,
-       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
-       .enable_vblank = amdgpu_enable_vblank_kms,
-       .disable_vblank = amdgpu_disable_vblank_kms,
-       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
        .irq_handler = amdgpu_irq_handler,
        .ioctls = amdgpu_ioctls_kms,
        .gem_free_object_unlocked = amdgpu_gem_object_free,
index 60591dbc2097ecbbb8611e791b950cdd82b3596a..98c196de27a454566045492bfdafe6b294089450 100644 (file)
@@ -1110,14 +1110,15 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
 /**
  * amdgpu_get_vblank_counter_kms - get frame count
  *
- * @dev: drm dev pointer
- * @pipe: crtc to get the frame count from
+ * @crtc: crtc to get the frame count from
  *
  * Gets the frame count on the requested crtc (all asics).
  * Returns frame count on success, -EINVAL on failure.
  */
-u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
+u32 amdgpu_get_vblank_counter_kms(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        struct amdgpu_device *adev = dev->dev_private;
        int vpos, hpos, stat;
        u32 count;
@@ -1177,14 +1178,15 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 /**
  * amdgpu_enable_vblank_kms - enable vblank interrupt
  *
- * @dev: drm dev pointer
- * @pipe: crtc to enable vblank interrupt for
+ * @crtc: crtc to enable vblank interrupt for
  *
  * Enable the interrupt on the requested crtc (all asics).
  * Returns 0 on success, -EINVAL on failure.
  */
-int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
+int amdgpu_enable_vblank_kms(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        struct amdgpu_device *adev = dev->dev_private;
        int idx = amdgpu_display_crtc_idx_to_irq_type(adev, pipe);
 
@@ -1194,13 +1196,14 @@ int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe)
 /**
  * amdgpu_disable_vblank_kms - disable vblank interrupt
  *
- * @dev: drm dev pointer
- * @pipe: crtc to disable vblank interrupt for
+ * @crtc: crtc to disable vblank interrupt for
  *
  * Disable the interrupt on the requested crtc (all asics).
  */
-void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)
+void amdgpu_disable_vblank_kms(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        struct amdgpu_device *adev = dev->dev_private;
        int idx = amdgpu_display_crtc_idx_to_irq_type(adev, pipe);
 
index bdc1e0f036d413f603f86138ea14759dc02b9558..2512e7ebfedf2ef00be981a5528b5981dba555ec 100644 (file)
@@ -2494,6 +2494,10 @@ static const struct drm_crtc_funcs dce_v10_0_crtc_funcs = {
        .set_config = amdgpu_display_crtc_set_config,
        .destroy = dce_v10_0_crtc_destroy,
        .page_flip_target = amdgpu_display_crtc_page_flip_target,
+       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
+       .enable_vblank = amdgpu_enable_vblank_kms,
+       .disable_vblank = amdgpu_disable_vblank_kms,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
index 0319da5f7bf9b6fd2031bfff53f2cb7ce73a6abf..0dde22db9848690f1e50c3be0e819ed03151aece 100644 (file)
@@ -2573,6 +2573,10 @@ static const struct drm_crtc_funcs dce_v11_0_crtc_funcs = {
        .set_config = amdgpu_display_crtc_set_config,
        .destroy = dce_v11_0_crtc_destroy,
        .page_flip_target = amdgpu_display_crtc_page_flip_target,
+       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
+       .enable_vblank = amdgpu_enable_vblank_kms,
+       .disable_vblank = amdgpu_disable_vblank_kms,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
index 78642c3b14fcac97360a902e0b28794b42d877d0..84219534bd38c6ac3f73749b977605c7b161b593 100644 (file)
@@ -2388,6 +2388,10 @@ static const struct drm_crtc_funcs dce_v6_0_crtc_funcs = {
        .set_config = amdgpu_display_crtc_set_config,
        .destroy = dce_v6_0_crtc_destroy,
        .page_flip_target = amdgpu_display_crtc_page_flip_target,
+       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
+       .enable_vblank = amdgpu_enable_vblank_kms,
+       .disable_vblank = amdgpu_disable_vblank_kms,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static void dce_v6_0_crtc_dpms(struct drm_crtc *crtc, int mode)
index 1e8d4975435aa15cf67db612daf43c157c737096..3a640702d7d193ad44bb216fe7ace2b0507df236 100644 (file)
@@ -2395,6 +2395,10 @@ static const struct drm_crtc_funcs dce_v8_0_crtc_funcs = {
        .set_config = amdgpu_display_crtc_set_config,
        .destroy = dce_v8_0_crtc_destroy,
        .page_flip_target = amdgpu_display_crtc_page_flip_target,
+       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
+       .enable_vblank = amdgpu_enable_vblank_kms,
+       .disable_vblank = amdgpu_disable_vblank_kms,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
index 4b2f915aba47305af44f3e1a1f5d3b1aa6b43f45..5707e4ad1a62cc95d5e68de0c9e7fe9dc030d6d9 100644 (file)
@@ -123,6 +123,10 @@ static const struct drm_crtc_funcs dce_virtual_crtc_funcs = {
        .set_config = amdgpu_display_crtc_set_config,
        .destroy = dce_virtual_crtc_destroy,
        .page_flip_target = amdgpu_display_crtc_page_flip_target,
+       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
+       .enable_vblank = amdgpu_enable_vblank_kms,
+       .disable_vblank = amdgpu_disable_vblank_kms,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static void dce_virtual_crtc_dpms(struct drm_crtc *crtc, int mode)
index 39c5cf242c1b88c31a9c087656a939d25b61d28b..ea55f4160c802f070602f00395e31bc47612d5a5 100644 (file)
@@ -377,8 +377,8 @@ static void dm_pflip_high_irq(void *interrupt_params)
         * of pageflip completion, so last_flip_vblank is the forbidden count
         * for queueing new pageflips if vsync + VRR is enabled.
         */
-       amdgpu_crtc->last_flip_vblank = amdgpu_get_vblank_counter_kms(adev->ddev,
-                                                       amdgpu_crtc->crtc_id);
+       amdgpu_crtc->last_flip_vblank =
+               amdgpu_get_vblank_counter_kms(&amdgpu_crtc->base);
 
        amdgpu_crtc->pflip_status = AMDGPU_FLIP_NONE;
        spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
@@ -4214,8 +4214,10 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
        .set_crc_source = amdgpu_dm_crtc_set_crc_source,
        .verify_crc_source = amdgpu_dm_crtc_verify_crc_source,
        .get_crc_sources = amdgpu_dm_crtc_get_crc_sources,
+       .get_vblank_counter = amdgpu_get_vblank_counter_kms,
        .enable_vblank = dm_enable_vblank,
        .disable_vblank = dm_disable_vblank,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static enum drm_connector_status
@@ -6360,7 +6362,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                         * clients using the GLX_OML_sync_control extension or
                         * DRI3/Present extension with defined target_msc.
                         */
-                       last_flip_vblank = amdgpu_get_vblank_counter_kms(dm->ddev, acrtc_attach->crtc_id);
+                       last_flip_vblank = amdgpu_get_vblank_counter_kms(pcrtc);
                }
                else {
                        /* For variable refresh rate mode only:
@@ -6389,7 +6391,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                         & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK)) ==
                        (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
                        (int)(target_vblank -
-                         amdgpu_get_vblank_counter_kms(dm->ddev, acrtc_attach->crtc_id)) > 0)) {
+                         amdgpu_get_vblank_counter_kms(pcrtc)) > 0)) {
                        usleep_range(1000, 1100);
                }