linux/drivers/gpu/drm/virtio
Maxime Ripard 7c11b99a8e
drm/atomic: Pass the full state to planes atomic_check
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.

The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.

Let's convert all the remaining helpers to provide a consistent
interface, starting with the planes atomic_check.

The conversion was done using the coccinelle script below plus some
manual changes for vmwgfx, built tested on all the drivers.

@@
identifier plane, plane_state;
symbol state;
@@

 struct drm_plane_helper_funcs {
 	...
	int (*atomic_check)(struct drm_plane *plane,
-			    struct drm_plane_state *plane_state);
+			    struct drm_atomic_state *state);
	...
}

@ plane_atomic_func @
identifier helpers;
identifier func;
@@

static const struct drm_plane_helper_funcs helpers = {
	...,
 	.atomic_check = func,
	...,
};

@@
struct drm_plane_helper_funcs *FUNCS;
identifier f;
identifier dev;
identifier plane, plane_state, state;
@@

 f(struct drm_device *dev, struct drm_atomic_state *state)
 {
 	<+...
-	FUNCS->atomic_check(plane, plane_state)
+	FUNCS->atomic_check(plane, state)
 	...+>
 }

@ ignores_new_state @
identifier plane_atomic_func.func;
identifier plane, new_plane_state;
@@

 func(struct drm_plane *plane, struct drm_plane_state *new_plane_state)
 {
	... when != new_plane_state
 }

@ adds_new_state depends on plane_atomic_func && !ignores_new_state @
identifier plane_atomic_func.func;
identifier plane, new_plane_state;
@@

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

@ depends on plane_atomic_func @
identifier plane_atomic_func.func;
identifier plane, new_plane_state;
@@

 func(struct drm_plane *plane,
-     struct drm_plane_state *new_plane_state
+     struct drm_atomic_state *state
     )
 { ... }

@ include depends on adds_new_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_new_state @
@@

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

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://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-4-maxime@cerno.tech
2021-02-24 20:27:00 +01:00
..
Kconfig drivers: gpu: drm: virtio: fix dependency of DRM_VIRTIO_GPU on VIRTIO 2020-12-22 13:43:29 +01:00
Makefile drm/virtio: implement blob resources: implement vram object 2020-09-29 11:23:33 +02:00
virtgpu_debugfs.c drm/virtio: virtio_{blah} --> virtio_gpu_{blah} 2020-12-02 11:48:14 +01:00
virtgpu_display.c drm: Use state helper instead of CRTC state pointer 2020-11-10 12:41:06 +01:00
virtgpu_drv.c drm/virtgpu: Remove references to struct drm_device.pdev 2021-01-06 15:44:04 +01:00
virtgpu_drv.h drm/virtio: consider dma-fence context when signaling 2020-12-02 11:48:14 +01:00
virtgpu_fence.c drm/virtio: consider dma-fence context when signaling 2020-12-02 11:48:14 +01:00
virtgpu_gem.c drm/virtio: make sure context is created in gem open 2021-01-11 08:49:48 +01:00
virtgpu_ioctl.c drm/virtio: suffix create blob call with _ioctl like any ioctl 2020-11-20 10:44:41 +01:00
virtgpu_kms.c drm/virtio: fix an error code in virtio_gpu_init() 2021-02-03 14:52:44 +01:00
virtgpu_object.c drm/shmem-helper: Use cached mappings by default 2020-11-24 09:10:21 +01:00
virtgpu_plane.c drm/atomic: Pass the full state to planes atomic_check 2021-02-24 20:27:00 +01:00
virtgpu_prime.c drm/virtio: Make virtgpu_dmabuf_ops with static keyword 2020-11-16 08:53:23 +01:00
virtgpu_trace.h
virtgpu_trace_points.c
virtgpu_vq.c drm/virtio: Fix a double free in virtio_gpu_cmd_map() 2020-11-06 08:50:30 +01:00
virtgpu_vram.c drm/virtio: fix prime export for vram objects 2021-01-11 08:49:48 +01:00