Skip to content

Commit 9801a7e

Browse files
jamwandliviu
authored andcommitted
drm: Add drm_atomic_get_old/new_private_obj_state
This pair of functions return the old/new private object state for the given private_obj, or NULL if the private_obj is not part of the global atomic state. Reviewed-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> Signed-off-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
1 parent 7c13e5c commit 9801a7e

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

‎drivers/gpu/drm/drm_atomic.c‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,50 @@ drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
797797
}
798798
EXPORT_SYMBOL(drm_atomic_get_private_obj_state);
799799

800+
/**
801+
* drm_atomic_get_old_private_obj_state
802+
* @state: global atomic state object
803+
* @obj: private_obj to grab
804+
*
805+
* This function returns the old private object state for the given private_obj,
806+
* or NULL if the private_obj is not part of the global atomic state.
807+
*/
808+
struct drm_private_state *
809+
drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state,
810+
struct drm_private_obj *obj)
811+
{
812+
int i;
813+
814+
for (i = 0; i < state->num_private_objs; i++)
815+
if (obj == state->private_objs[i].ptr)
816+
return state->private_objs[i].old_state;
817+
818+
return NULL;
819+
}
820+
EXPORT_SYMBOL(drm_atomic_get_old_private_obj_state);
821+
822+
/**
823+
* drm_atomic_get_new_private_obj_state
824+
* @state: global atomic state object
825+
* @obj: private_obj to grab
826+
*
827+
* This function returns the new private object state for the given private_obj,
828+
* or NULL if the private_obj is not part of the global atomic state.
829+
*/
830+
struct drm_private_state *
831+
drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state,
832+
struct drm_private_obj *obj)
833+
{
834+
int i;
835+
836+
for (i = 0; i < state->num_private_objs; i++)
837+
if (obj == state->private_objs[i].ptr)
838+
return state->private_objs[i].new_state;
839+
840+
return NULL;
841+
}
842+
EXPORT_SYMBOL(drm_atomic_get_new_private_obj_state);
843+
800844
/**
801845
* drm_atomic_get_connector_state - get connector state
802846
* @state: global atomic state object
@@ -1236,4 +1280,3 @@ int drm_atomic_debugfs_init(struct drm_minor *minor)
12361280
minor->debugfs_root, minor);
12371281
}
12381282
#endif
1239-

‎include/drm/drm_atomic.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ void drm_atomic_private_obj_fini(struct drm_private_obj *obj);
452452
struct drm_private_state * __must_check
453453
drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
454454
struct drm_private_obj *obj);
455+
struct drm_private_state *
456+
drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state,
457+
struct drm_private_obj *obj);
458+
struct drm_private_state *
459+
drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state,
460+
struct drm_private_obj *obj);
455461

456462
/**
457463
* drm_atomic_get_existing_crtc_state - get crtc state, if it exists

0 commit comments

Comments
 (0)