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

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-12-tzimmermann@suse.de
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/radeon/radeon_drv.c
drivers/gpu/drm/radeon/radeon_kms.c

index 7187158b9963fe53a99a2d3311dda6288b6b7e74..91dda212566177e149e788cbe53b63542a390032 100644 (file)
 #include "atom.h"
 #include "radeon.h"
 
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
+int radeon_enable_vblank_kms(struct drm_crtc *crtc);
+void radeon_disable_vblank_kms(struct drm_crtc *crtc);
+
 static void avivo_crtc_load_lut(struct drm_crtc *crtc)
 {
        struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@@ -458,7 +462,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
                (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
                (!ASIC_IS_AVIVO(rdev) ||
                ((int) (work->target_vblank -
-               dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
+               crtc->funcs->get_vblank_counter(crtc)) > 0)))
                usleep_range(1000, 2000);
 
        /* We borrow the event spin lock for protecting flip_status */
@@ -574,7 +578,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
        }
        work->base = base;
        work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) +
-               dev->driver->get_vblank_counter(dev, work->crtc_id);
+               crtc->funcs->get_vblank_counter(crtc);
 
        /* We borrow the event spin lock for protecting flip_work */
        spin_lock_irqsave(&crtc->dev->event_lock, flags);
@@ -666,6 +670,10 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = {
        .set_config = radeon_crtc_set_config,
        .destroy = radeon_crtc_destroy,
        .page_flip_target = radeon_crtc_page_flip_target,
+       .get_vblank_counter = radeon_get_vblank_counter_kms,
+       .enable_vblank = radeon_enable_vblank_kms,
+       .disable_vblank = radeon_disable_vblank_kms,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static void radeon_crtc_init(struct drm_device *dev, int index)
index 1f597f166bff02f786c072c1be417a0bc66c7af6..49ce2e7d5f9ec18521be15dfd28f7da50dfea2b9 100644 (file)
@@ -119,9 +119,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 int radeon_suspend_kms(struct drm_device *dev, bool suspend,
                       bool fbcon, bool freeze);
 int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
-u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
-int radeon_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
-void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);
 void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
 int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
 void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
@@ -571,10 +568,6 @@ static struct drm_driver kms_driver = {
        .postclose = radeon_driver_postclose_kms,
        .lastclose = radeon_driver_lastclose_kms,
        .unload = radeon_driver_unload_kms,
-       .get_vblank_counter = radeon_get_vblank_counter_kms,
-       .enable_vblank = radeon_enable_vblank_kms,
-       .disable_vblank = radeon_disable_vblank_kms,
-       .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
        .irq_preinstall = radeon_driver_irq_preinstall_kms,
        .irq_postinstall = radeon_driver_irq_postinstall_kms,
        .irq_uninstall = radeon_driver_irq_uninstall_kms,
index d24f23a8165602a547608777a3cc004e7cc9cc22..cab891f86dc073229a7880b747e8a8c95e465c4a 100644 (file)
@@ -739,14 +739,15 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
 /**
  * radeon_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 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
+u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        int vpos, hpos, stat;
        u32 count;
        struct radeon_device *rdev = dev->dev_private;
@@ -808,25 +809,26 @@ u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe)
 /**
  * radeon_enable_vblank_kms - enable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to enable vblank interrupt for
  *
  * Enable the interrupt on the requested crtc (all asics).
  * Returns 0 on success, -EINVAL on failure.
  */
-int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
+int radeon_enable_vblank_kms(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        struct radeon_device *rdev = dev->dev_private;
        unsigned long irqflags;
        int r;
 
-       if (crtc < 0 || crtc >= rdev->num_crtc) {
-               DRM_ERROR("Invalid crtc %d\n", crtc);
+       if (pipe < 0 || pipe >= rdev->num_crtc) {
+               DRM_ERROR("Invalid crtc %d\n", pipe);
                return -EINVAL;
        }
 
        spin_lock_irqsave(&rdev->irq.lock, irqflags);
-       rdev->irq.crtc_vblank_int[crtc] = true;
+       rdev->irq.crtc_vblank_int[pipe] = true;
        r = radeon_irq_set(rdev);
        spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
        return r;
@@ -835,23 +837,24 @@ int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
 /**
  * radeon_disable_vblank_kms - disable vblank interrupt
  *
- * @dev: drm dev pointer
  * @crtc: crtc to disable vblank interrupt for
  *
  * Disable the interrupt on the requested crtc (all asics).
  */
-void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
+void radeon_disable_vblank_kms(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        struct radeon_device *rdev = dev->dev_private;
        unsigned long irqflags;
 
-       if (crtc < 0 || crtc >= rdev->num_crtc) {
-               DRM_ERROR("Invalid crtc %d\n", crtc);
+       if (pipe < 0 || pipe >= rdev->num_crtc) {
+               DRM_ERROR("Invalid crtc %d\n", pipe);
                return;
        }
 
        spin_lock_irqsave(&rdev->irq.lock, irqflags);
-       rdev->irq.crtc_vblank_int[crtc] = false;
+       rdev->irq.crtc_vblank_int[pipe] = false;
        radeon_irq_set(rdev);
        spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }