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

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Yannick Fertré <yannick.fertre@st.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200123135943.24140-14-tzimmermann@suse.de
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_drv.h

index f197dce545761ae92eb5d2b1ba642c7218bcc9aa..b177d5052c5e05956765a9b5ff387f5adf9dfd99 100644 (file)
@@ -1281,6 +1281,8 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
        .atomic_destroy_state = dpu_crtc_destroy_state,
        .late_register = dpu_crtc_late_register,
        .early_unregister = dpu_crtc_early_unregister,
+       .enable_vblank  = msm_crtc_enable_vblank,
+       .disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
index f34dca5d453286274f9658298d52f7af553cf972..c9239b07fe4f9cda81e590c5935454c634c9f0d1 100644 (file)
@@ -481,6 +481,8 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
        .reset = drm_atomic_helper_crtc_reset,
        .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
        .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+       .enable_vblank  = msm_crtc_enable_vblank,
+       .disable_vblank = msm_crtc_disable_vblank,
 };
 
 static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
index 4decf19847a898b8a8183d094ddf1a5272c0a657..b3d0a0fe76b9134d0bfacd586442257892c38a4f 100644 (file)
@@ -471,6 +471,17 @@ static bool mdp5_crtc_get_scanout_position(struct drm_crtc *crtc,
        return true;
 }
 
+static u32 mdp5_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+       struct drm_encoder *encoder;
+
+       encoder = get_encoder_from_crtc(crtc);
+       if (!encoder)
+               return 0;
+
+       return mdp5_encoder_get_framecount(encoder);
+}
+
 static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
                                     struct drm_crtc_state *old_state)
 {
@@ -1120,6 +1131,10 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = {
        .cursor_set = mdp5_crtc_cursor_set,
        .cursor_move = mdp5_crtc_cursor_move,
        .atomic_print_state = mdp5_crtc_atomic_print_state,
+       .get_vblank_counter = mdp5_crtc_get_vblank_counter,
+       .enable_vblank  = msm_crtc_enable_vblank,
+       .disable_vblank = msm_crtc_disable_vblank,
+       .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
 };
 
 static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
index 8b72ac44ce55b4f41e7061588b5022d2c274dd19..6650f478b226a931200cd355383158c4f7bc92f1 100644 (file)
@@ -583,38 +583,6 @@ static int get_clk(struct platform_device *pdev, struct clk **clkp,
        return 0;
 }
 
-static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
-{
-       struct drm_device *dev = crtc->dev;
-       struct drm_encoder *encoder;
-
-       drm_for_each_encoder(encoder, dev)
-               if (encoder->crtc == crtc)
-                       return encoder;
-
-       return NULL;
-}
-
-static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
-{
-       struct msm_drm_private *priv = dev->dev_private;
-       struct drm_crtc *crtc;
-       struct drm_encoder *encoder;
-
-       if (pipe >= priv->num_crtcs)
-               return 0;
-
-       crtc = priv->crtcs[pipe];
-       if (!crtc)
-               return 0;
-
-       encoder = get_encoder_from_crtc(crtc);
-       if (!encoder)
-               return 0;
-
-       return mdp5_encoder_get_framecount(encoder);
-}
-
 struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 {
        struct msm_drm_private *priv = dev->dev_private;
@@ -702,8 +670,6 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
        dev->mode_config.max_width = 0xffff;
        dev->mode_config.max_height = 0xffff;
 
-       dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
-       dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
        dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
        dev->vblank_disable_immediate = true;
 
index c84f0a8b3f2cebf76f99a70c01e4377fde610d0e..c5e044136fe5493252e88498b5c63b71ef982191 100644 (file)
@@ -660,8 +660,10 @@ static void msm_irq_uninstall(struct drm_device *dev)
        kms->funcs->irq_uninstall(kms);
 }
 
-static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
+int msm_crtc_enable_vblank(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        struct msm_drm_private *priv = dev->dev_private;
        struct msm_kms *kms = priv->kms;
        if (!kms)
@@ -670,8 +672,10 @@ static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
        return vblank_ctrl_queue_work(priv, pipe, true);
 }
 
-static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
+void msm_crtc_disable_vblank(struct drm_crtc *crtc)
 {
+       struct drm_device *dev = crtc->dev;
+       unsigned int pipe = crtc->index;
        struct msm_drm_private *priv = dev->dev_private;
        struct msm_kms *kms = priv->kms;
        if (!kms)
@@ -996,8 +1000,6 @@ static struct drm_driver msm_driver = {
        .irq_preinstall     = msm_irq_preinstall,
        .irq_postinstall    = msm_irq_postinstall,
        .irq_uninstall      = msm_irq_uninstall,
-       .enable_vblank      = msm_enable_vblank,
-       .disable_vblank     = msm_disable_vblank,
        .gem_free_object_unlocked = msm_gem_free_object,
        .gem_vm_ops         = &vm_ops,
        .dumb_create        = msm_gem_dumb_create,
index 71547e756e2914a0152853ac967e7dfc357786db..108625cd553dfd3a4dc2f85ef1e848e2e5f1fa5a 100644 (file)
@@ -232,6 +232,9 @@ struct drm_atomic_state *msm_atomic_state_alloc(struct drm_device *dev);
 void msm_atomic_state_clear(struct drm_atomic_state *state);
 void msm_atomic_state_free(struct drm_atomic_state *state);
 
+int msm_crtc_enable_vblank(struct drm_crtc *crtc);
+void msm_crtc_disable_vblank(struct drm_crtc *crtc);
+
 int msm_gem_init_vma(struct msm_gem_address_space *aspace,
                struct msm_gem_vma *vma, int npages);
 void msm_gem_purge_vma(struct msm_gem_address_space *aspace,