linux-stable/drivers/gpu/drm/qxl
Maxime Ripard e05162c017
drm: Store new plane state in a variable for atomic_update and disable
In order to store the new plane state in a subsequent helper, let's move
the plane->state dereferences into a variable.

This was done using the following coccinelle script, plus some hand
changes for vmwgfx:

@ plane_atomic_func @
identifier helpers;
identifier func;
@@

(
 static const struct drm_plane_helper_funcs helpers = {
 	...,
 	.atomic_disable = func,
	...,
 };
|
 static const struct drm_plane_helper_funcs helpers = {
 	...,
 	.atomic_update = func,
	...,
 };
)

@ has_new_state_old_state @
identifier plane_atomic_func.func;
identifier plane;
identifier new_state;
symbol old_state;
@@

 func(struct drm_plane *plane, struct drm_plane_state *old_state)
 {
 	...
 	struct drm_plane_state *new_state = plane->state;
	...
 }

@ depends on !has_new_state_old_state @
identifier plane_atomic_func.func;
identifier plane;
symbol old_state;
@@

 func(struct drm_plane *plane, struct drm_plane_state *old_state)
 {
+	struct drm_plane_state *new_state = plane->state;
 	<+...
-	plane->state
+	new_state
	...+>
 }

@ has_new_state_state @
identifier plane_atomic_func.func;
identifier plane;
identifier new_state;
symbol state;
@@

 func(struct drm_plane *plane, struct drm_plane_state *state)
 {
 	...
 	struct drm_plane_state *new_state = plane->state;
	...
 }

@ depends on !has_new_state_state @
identifier plane_atomic_func.func;
identifier plane;
symbol state;
@@

 func(struct drm_plane *plane, struct drm_plane_state *state)
 {
+	struct drm_plane_state *new_plane_state = plane->state;
 	<+...
-	plane->state
+	new_plane_state
	...+>
 }

@ has_new_state_old_s @
identifier plane_atomic_func.func;
identifier plane;
identifier new_state;
symbol old_s;
@@

 func(struct drm_plane *plane, struct drm_plane_state *old_s)
 {
 	...
 	struct drm_plane_state *new_state = plane->state;
	...
 }

@ depends on !has_new_state_old_s @
identifier plane_atomic_func.func;
identifier plane;
symbol old_s;
@@

 func(struct drm_plane *plane, struct drm_plane_state *old_s)
 {
+	struct drm_plane_state *new_s = plane->state;
 	<+...
-	plane->state
+	new_s
	...+>
 }

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/r/20210219120032.260676-1-maxime@cerno.tech
2021-02-24 20:27:09 +01:00
..
Kconfig drm/qxl: Fix randbuild error 2019-10-17 14:31:50 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
qxl_cmd.c drm/qxl: use ttm bo priorities 2021-02-19 09:13:25 +01:00
qxl_debugfs.c drm/qxl: switch over to the new pin interface 2020-09-24 16:16:50 +02:00
qxl_dev.h drm/qxl: use flexible-array member instead of zero-length array 2020-12-22 13:43:29 +01:00
qxl_display.c drm: Store new plane state in a variable for atomic_update and disable 2021-02-24 20:27:09 +01:00
qxl_draw.c drm/qxl: rename qxl_bo_kmap -> qxl_bo_vmap_locked 2021-02-19 09:13:25 +01:00
qxl_drv.c Revert "drm/qxl: do not run release if qxl failed to init" 2021-02-05 08:52:15 +01:00
qxl_drv.h drm/qxl: properly free qxl releases 2021-02-05 08:52:45 +01:00
qxl_dumb.c drm/qxl: allocate dumb buffers in ram 2021-02-05 09:02:40 +01:00
qxl_gem.c drm/qxl: use ttm bo priorities 2021-02-19 09:13:25 +01:00
qxl_image.c drm/qxl: rename qxl_bo_kmap -> qxl_bo_vmap_locked 2021-02-19 09:13:25 +01:00
qxl_ioctl.c drm/qxl: Remove references to struct drm_device.pdev 2021-01-06 15:43:14 +01:00
qxl_irq.c drm/qxl: properly free qxl releases 2021-02-05 08:52:45 +01:00
qxl_kms.c drm/qxl: properly handle device init failures 2021-02-19 09:13:25 +01:00
qxl_object.c drm/qxl: add lock asserts to qxl_bo_vmap_locked + qxl_bo_vunmap_locked 2021-02-19 09:13:25 +01:00
qxl_object.h drm/qxl: add qxl_bo_vmap/qxl_bo_vunmap 2021-02-19 09:13:25 +01:00
qxl_prime.c drm/qxl: fix prime vmap 2021-02-19 09:13:25 +01:00
qxl_release.c drm/qxl: fix lockdep issue in qxl_alloc_release_reserved 2021-02-19 09:13:25 +01:00
qxl_ttm.c drm/ttm: device naming cleanup 2021-01-21 14:51:45 +01:00