Commit 97a1f01b authored by Maxime Ripard's avatar Maxime Ripard

drm/atomic: Add atomic_print_state to private objects

A number of drivers (amdgpu, komeda, vc4, etc.) leverage the
drm_private_state structure, but we don't have any infrastructure to
provide debugging like we do for the other components state. Let's add
an atomic_print_state hook to be consistent.
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220328124304.2309418-3-maxime@cerno.tech
parent 018ad18f
...@@ -789,6 +789,8 @@ drm_atomic_private_obj_init(struct drm_device *dev, ...@@ -789,6 +789,8 @@ drm_atomic_private_obj_init(struct drm_device *dev,
obj->state = state; obj->state = state;
obj->funcs = funcs; obj->funcs = funcs;
list_add_tail(&obj->head, &dev->mode_config.privobj_list); list_add_tail(&obj->head, &dev->mode_config.privobj_list);
state->obj = obj;
} }
EXPORT_SYMBOL(drm_atomic_private_obj_init); EXPORT_SYMBOL(drm_atomic_private_obj_init);
...@@ -1636,6 +1638,15 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, ...@@ -1636,6 +1638,15 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
} }
EXPORT_SYMBOL(__drm_atomic_helper_set_config); EXPORT_SYMBOL(__drm_atomic_helper_set_config);
static void drm_atomic_private_obj_print_state(struct drm_printer *p,
const struct drm_private_state *state)
{
struct drm_private_obj *obj = state->obj;
if (obj->funcs->atomic_print_state)
obj->funcs->atomic_print_state(p, state);
}
/** /**
* drm_atomic_print_new_state - prints drm atomic state * drm_atomic_print_new_state - prints drm atomic state
* @state: atomic configuration to check * @state: atomic configuration to check
...@@ -1656,6 +1667,8 @@ void drm_atomic_print_new_state(const struct drm_atomic_state *state, ...@@ -1656,6 +1667,8 @@ void drm_atomic_print_new_state(const struct drm_atomic_state *state,
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
struct drm_private_obj *obj;
struct drm_private_state *obj_state;
int i; int i;
if (!p) { if (!p) {
...@@ -1673,6 +1686,9 @@ void drm_atomic_print_new_state(const struct drm_atomic_state *state, ...@@ -1673,6 +1686,9 @@ void drm_atomic_print_new_state(const struct drm_atomic_state *state,
for_each_new_connector_in_state(state, connector, connector_state, i) for_each_new_connector_in_state(state, connector, connector_state, i)
drm_atomic_connector_print_state(p, connector_state); drm_atomic_connector_print_state(p, connector_state);
for_each_new_private_obj_in_state(state, obj, obj_state, i)
drm_atomic_private_obj_print_state(p, obj_state);
} }
EXPORT_SYMBOL(drm_atomic_print_new_state); EXPORT_SYMBOL(drm_atomic_print_new_state);
......
...@@ -227,6 +227,18 @@ struct drm_private_state_funcs { ...@@ -227,6 +227,18 @@ struct drm_private_state_funcs {
*/ */
void (*atomic_destroy_state)(struct drm_private_obj *obj, void (*atomic_destroy_state)(struct drm_private_obj *obj,
struct drm_private_state *state); struct drm_private_state *state);
/**
* @atomic_print_state:
*
* If driver subclasses &struct drm_private_state, it should implement
* this optional hook for printing additional driver specific state.
*
* Do not call this directly, use drm_atomic_private_obj_print_state()
* instead.
*/
void (*atomic_print_state)(struct drm_printer *p,
const struct drm_private_state *state);
}; };
/** /**
...@@ -311,14 +323,21 @@ struct drm_private_obj { ...@@ -311,14 +323,21 @@ struct drm_private_obj {
/** /**
* struct drm_private_state - base struct for driver private object state * struct drm_private_state - base struct for driver private object state
* @state: backpointer to global drm_atomic_state
* *
* Currently only contains a backpointer to the overall atomic update, but in * Currently only contains a backpointer to the overall atomic update,
* the future also might hold synchronization information similar to e.g. * and the relevant private object but in the future also might hold
* &drm_crtc.commit. * synchronization information similar to e.g. &drm_crtc.commit.
*/ */
struct drm_private_state { struct drm_private_state {
/**
* @state: backpointer to global drm_atomic_state
*/
struct drm_atomic_state *state; struct drm_atomic_state *state;
/**
* @obj: backpointer to the private object
*/
struct drm_private_obj *obj;
}; };
struct __drm_private_objs_state { struct __drm_private_objs_state {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment