hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/drivers/gpu/drm/sti/sti_crtc.c
....@@ -8,11 +8,13 @@
88
99 #include <linux/clk.h>
1010
11
-#include <drm/drmP.h>
1211 #include <drm/drm_atomic.h>
1312 #include <drm/drm_atomic_helper.h>
14
-#include <drm/drm_crtc_helper.h>
13
+#include <drm/drm_device.h>
1514 #include <drm/drm_plane_helper.h>
15
+#include <drm/drm_print.h>
16
+#include <drm/drm_probe_helper.h>
17
+#include <drm/drm_vblank.h>
1618
1719 #include "sti_compositor.h"
1820 #include "sti_crtc.h"
....@@ -40,6 +42,8 @@
4042 DRM_DEBUG_DRIVER("\n");
4143
4244 mixer->status = STI_MIXER_DISABLING;
45
+
46
+ drm_crtc_wait_one_vblank(crtc);
4347 }
4448
4549 static int
....@@ -51,18 +55,10 @@
5155 struct clk *compo_clk, *pix_clk;
5256 int rate = mode->clock * 1000;
5357
54
- DRM_DEBUG_KMS("CRTC:%d (%s) mode:%d (%s)\n",
55
- crtc->base.id, sti_mixer_to_str(mixer),
56
- mode->base.id, mode->name);
58
+ DRM_DEBUG_KMS("CRTC:%d (%s) mode: (%s)\n",
59
+ crtc->base.id, sti_mixer_to_str(mixer), mode->name);
5760
58
- DRM_DEBUG_KMS("%d %d %d %d %d %d %d %d %d %d 0x%x 0x%x\n",
59
- mode->vrefresh, mode->clock,
60
- mode->hdisplay,
61
- mode->hsync_start, mode->hsync_end,
62
- mode->htotal,
63
- mode->vdisplay,
64
- mode->vsync_start, mode->vsync_end,
65
- mode->vtotal, mode->type, mode->flags);
61
+ DRM_DEBUG_KMS(DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
6662
6763 if (mixer->id == STI_MIXER_MAIN) {
6864 compo_clk = compo->clk_compo_main;
....@@ -250,10 +246,8 @@
250246 struct sti_compositor *compo;
251247 struct drm_crtc *crtc = data;
252248 struct sti_mixer *mixer;
253
- struct sti_private *priv;
254249 unsigned int pipe;
255250
256
- priv = crtc->dev->dev_private;
257251 pipe = drm_crtc_index(crtc);
258252 compo = container_of(nb, struct sti_compositor, vtg_vblank_nb[pipe]);
259253 mixer = compo->mixer[pipe];
....@@ -285,12 +279,13 @@
285279 return 0;
286280 }
287281
288
-int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
282
+static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
289283 {
284
+ struct drm_device *dev = crtc->dev;
285
+ unsigned int pipe = crtc->index;
290286 struct sti_private *dev_priv = dev->dev_private;
291287 struct sti_compositor *compo = dev_priv->compo;
292288 struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
293
- struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
294289 struct sti_vtg *vtg = compo->vtg[pipe];
295290
296291 DRM_DEBUG_DRIVER("\n");
....@@ -303,8 +298,10 @@
303298 return 0;
304299 }
305300
306
-void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
301
+static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
307302 {
303
+ struct drm_device *drm_dev = crtc->dev;
304
+ unsigned int pipe = crtc->index;
308305 struct sti_private *priv = drm_dev->dev_private;
309306 struct sti_compositor *compo = priv->compo;
310307 struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
....@@ -322,7 +319,7 @@
322319 struct sti_compositor *compo = dev_get_drvdata(mixer->dev);
323320
324321 if (drm_crtc_index(crtc) == 0)
325
- return sti_compositor_debugfs_init(compo, crtc->dev->primary);
322
+ sti_compositor_debugfs_init(compo, crtc->dev->primary);
326323
327324 return 0;
328325 }
....@@ -336,6 +333,8 @@
336333 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
337334 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
338335 .late_register = sti_crtc_late_register,
336
+ .enable_vblank = sti_crtc_enable_vblank,
337
+ .disable_vblank = sti_crtc_disable_vblank,
339338 };
340339
341340 bool sti_crtc_is_main(struct drm_crtc *crtc)