Maxime Ripard
351f950db4
drm/atomic: Pass the full state to CRTC atomic enable/disable
If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.
In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.
virtual report
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
...>
}
@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@
drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
{
<...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
...>
}
@@
identifier crtc, old_state;
@@
struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)
@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}
@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@
void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@
void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@
void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>
}
@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@
void func(struct drm_crtc *crtc,
- struct drm_crtc_state *old_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_old_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_old_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
2020-10-09 09:55:59 +02:00
..
2020-09-11 15:01:36 +02:00
2020-10-07 14:10:18 +02:00
2020-07-15 12:45:39 -04:00
2019-07-15 18:11:30 +02:00
2020-09-14 22:36:44 +03:00
2020-01-31 16:00:21 +01:00
2020-07-15 14:02:29 +02:00
2019-02-20 11:53:48 +02:00
2019-05-27 18:05:44 +02:00
2020-02-26 13:31:41 +02:00
2020-07-15 14:02:34 +02:00
2019-10-31 15:03:10 -07:00
2020-05-26 13:32:03 +02:00
2019-11-29 21:29:17 +02:00
2020-08-11 14:06:04 +02:00
2019-01-24 13:20:42 +01:00
2020-02-13 13:08:13 +01:00
2019-01-17 10:56:54 +01:00
2020-03-18 17:32:20 +01:00
2020-09-03 16:25:06 +02:00
2020-06-15 23:08:31 -05:00
2020-09-24 11:12:55 +03:00
2020-08-31 19:10:08 -04:00
2020-09-25 09:21:48 +02:00
2019-03-05 13:24:34 -05:00
2020-06-30 13:31:15 +02:00
2019-01-09 22:35:35 +01:00
2020-03-18 18:38:27 +02:00
2020-01-09 17:33:41 +01:00
2020-04-08 22:42:39 +01:00
2020-04-22 10:41:35 +10:00
2020-05-26 13:33:08 +02:00
2020-01-07 13:16:08 +02:00
2020-04-01 14:11:22 +02:00
2020-06-10 09:01:49 +02:00
2020-03-18 11:22:05 +01:00
2020-06-10 10:16:43 +02:00
2019-10-17 13:59:16 +02:00
2020-09-24 16:16:50 +02:00
2020-09-25 09:21:48 +02:00
2020-09-02 10:48:11 +03:00
2019-06-21 19:13:10 +02:00
2019-05-30 11:26:37 -07:00
2020-04-22 10:41:35 +10:00
2020-03-26 16:09:48 +01:00
2020-06-24 09:17:34 +02:00
2019-11-07 15:00:16 +02:00
2020-09-17 13:39:44 +02:00
2020-09-23 17:54:03 +02:00
2020-09-01 13:38:34 +03:00
2020-10-09 09:55:59 +02:00
2019-02-07 21:48:34 +01:00
2020-08-17 13:41:50 -04:00
2020-01-09 10:40:58 +10:00
2020-08-16 17:12:18 +02:00
2018-10-15 16:16:12 -05:00
2019-10-10 15:49:34 +02:00
2020-09-29 12:41:21 +02:00
2020-03-26 14:49:13 +01:00
2019-01-24 13:20:42 +01:00
2020-07-15 14:03:02 +02:00
2019-11-04 17:58:46 +01:00
2019-11-06 13:00:21 -05:00
2020-03-02 09:22:35 +01:00
2019-04-01 12:05:53 +02:00
2019-08-06 13:16:54 +05:30
2019-11-07 21:22:15 +00:00
2019-03-07 12:00:30 -06:00
2020-07-16 18:16:31 -04:00
2020-07-16 18:16:31 -04:00
2019-04-24 16:20:23 -05:00
2020-04-07 17:39:46 +02:00
2019-06-05 17:37:06 +02:00
2020-09-08 16:40:13 +10:00
2019-07-11 16:31:14 -07:00
2019-08-30 14:08:26 +05:30
2020-02-27 08:35:09 +02:00
2020-08-17 16:15:50 -04:00
2019-01-02 11:37:47 +02:00
2019-12-18 16:09:12 -05:00