OpenCloudOS-Kernel/drivers/gpu/drm/tegra
Maxime Ripard 253f28b623
drm: Use state helper instead of CRTC state pointer
Many drivers reference the crtc->pointer in order to get the current CRTC
state in their atomic_begin or atomic_flush hooks, which would be the new
CRTC state in the global atomic state since _swap_state happened when those
hooks are run.

Use the drm_atomic_get_new_crtc_state helper to get that state to make it
more obvious.

This was made using the coccinelle script below:

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_crtc_helper_funcs helpers = {
	...,
	.atomic_begin = func,
	...,
};
|
static struct drm_crtc_helper_funcs helpers = {
	...,
	.atomic_flush = func,
	...,
};
)

@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@

  func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
  ...
- struct tegra_dc_state *crtc_state = e;
+ struct tegra_dc_state *dc_state = e;
  <+...
-       crtc_state
+	dc_state
  ...+>
  }

@@
identifier crtc_atomic_func.func;
identifier crtc, state;
symbol crtc_state;
expression e;
@@

  func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
  ...
- struct mtk_crtc_state *crtc_state = e;
+ struct mtk_crtc_state *mtk_crtc_state = e;
  <+...
-       crtc_state
+	mtk_crtc_state
  ...+>
  }

@ replaces_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@

  func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
  ...
- struct drm_crtc_state *crtc_state = crtc->state;
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
  ...
 }

@@
identifier crtc_atomic_func.func;
identifier crtc, state, crtc_state;
@@

  func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
  struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
  ...
- crtc->state
+ crtc_state
  ...
 }

@ adds_new_state @
identifier crtc_atomic_func.func;
identifier crtc, state;
@@

  func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
  ...
- crtc->state
+ crtc_state
  ...
 }

@ include depends on adds_new_state || replaces_new_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && (adds_new_state || replaces_new_state) @
@@

+ #include <drm/drm_atomic.h>
  #include <drm/...>

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "James (Qian) Wang" <james.qian.wang@arm.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Mihail Atanassov <mihail.atanassov@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105164518.392891-1-maxime@cerno.tech
2020-11-10 12:41:06 +01:00
..
Kconfig drm/tegra: Unconditionally select IOMMU_IOVA 2019-11-01 10:49:29 +01:00
Makefile drm/tegra: Move drm_dp_link helpers to Tegra DRM 2019-10-23 18:22:10 +02:00
dc.c drm: Use state helper instead of CRTC state pointer 2020-11-10 12:41:06 +01:00
dc.h drm/tegra: plane: Support horizontal reflection 2020-07-17 16:06:17 +02:00
dp.c drm/tegra: sor: Add DisplayPort support 2019-10-28 11:18:54 +01:00
dp.h drm/tegra: dp: Add DisplayPort link training helper 2019-10-28 11:18:53 +01:00
dpaux.c drm/tegra: Clean up GPIO includes 2020-04-17 17:16:22 +02:00
dpaux.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
drm.c drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
drm.h drm/tegra: output: Support DRM bridges 2020-09-17 12:30:11 +02:00
dsi.c drm next for 5.10-rc1 2020-10-15 10:46:16 -07:00
dsi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
falcon.c drm/tegra: falcon: Clarify address usage 2019-10-29 15:04:36 +01:00
falcon.h drm/tegra: falcon: Clarify address usage 2019-10-29 15:04:36 +01:00
fb.c drm/tegra: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:35 +01:00
gem.c Merge drm/drm-next into drm-misc-next 2020-11-02 11:17:54 +01:00
gem.h drm/tegra: gem: Rename paddr -> iova 2019-10-28 11:18:38 +01:00
gr2d.c drm/tegra: gr2d: Add tiled PATBASE address register 2020-07-17 16:06:16 +02:00
gr2d.h drm/tegra: gr2d: Add tiled PATBASE address register 2020-07-17 16:06:16 +02:00
gr3d.c drm/tegra: gr3d: Assert reset before power-gating 2020-07-17 16:06:15 +02:00
gr3d.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hda.c drm/tegra: hda: Extract HDA format parsing code 2019-01-16 13:10:20 +01:00
hda.h drm/tegra: hda: Extract HDA format parsing code 2019-01-16 13:10:20 +01:00
hdmi.c drm/tegra: Clean up GPIO includes 2020-04-17 17:16:22 +02:00
hdmi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hub.c drm/tegra: hub: Register child devices 2020-06-16 13:46:19 +02:00
hub.h drm/tegra: Do not implement runtime PM 2020-01-10 16:37:43 +01:00
mipi-phy.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mipi-phy.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
output.c drm/tegra: Changes for v5.10-rc1 2020-09-23 08:37:12 +10:00
plane.c drm: tegra: fix common struct sg_table related issues 2020-09-10 08:18:35 +02:00
plane.h drm/tegra: plane: Support horizontal reflection 2020-07-17 16:06:17 +02:00
rgb.c drm/tegra: output: rgb: Wrap directly-connected panel into DRM bridge 2020-09-17 12:31:18 +02:00
sor.c drm/tegra: Properly reference count the DDC I2C adapter 2020-09-17 12:27:11 +02:00
sor.h drm/tegra: sor: Add DisplayPort support 2019-10-28 11:18:54 +01:00
trace.c
trace.h
vic.c gpu: host1x: Rename "parent" to "host" 2020-01-10 16:37:38 +01:00
vic.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00