Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state

The drm_atomic_get_private_obj_state() function tries to find if a
private_obj had already been allocated and was part of the given
drm_atomic_state. If one is found, it returns the existing state
pointer.

At the point in time where drm_atomic_get_private_obj_state() can be
called (ie, during atomic_check), the existing state is the new state
and we can thus replace the hand-crafted logic by a call to
drm_atomic_get_new_private_obj_state().

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/20250930-drm-no-more-existing-state-v5-38-eeb9e1287907@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>

+4 -4
+4 -4
drivers/gpu/drm/drm_atomic.c
··· 831 831 drm_atomic_get_private_obj_state(struct drm_atomic_state *state, 832 832 struct drm_private_obj *obj) 833 833 { 834 - int index, num_objs, i, ret; 834 + int index, num_objs, ret; 835 835 size_t size; 836 836 struct __drm_private_objs_state *arr; 837 837 struct drm_private_state *obj_state; 838 838 839 - for (i = 0; i < state->num_private_objs; i++) 840 - if (obj == state->private_objs[i].ptr) 841 - return state->private_objs[i].state; 839 + obj_state = drm_atomic_get_new_private_obj_state(state, obj); 840 + if (obj_state) 841 + return obj_state; 842 842 843 843 ret = drm_modeset_lock(&obj->lock, state->acquire_ctx); 844 844 if (ret)