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

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>

authored by

james qian wang (Arm Technology China) and committed by
Liviu Dudau
9801a7ea 7c13e5cc

+50 -1
+44 -1
drivers/gpu/drm/drm_atomic.c
··· 798 798 EXPORT_SYMBOL(drm_atomic_get_private_obj_state); 799 799 800 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 + 844 + /** 801 845 * drm_atomic_get_connector_state - get connector state 802 846 * @state: global atomic state object 803 847 * @connector: connector to get state object for ··· 1280 1236 minor->debugfs_root, minor); 1281 1237 } 1282 1238 #endif 1283 -
+6
include/drm/drm_atomic.h
··· 452 452 struct drm_private_state * __must_check 453 453 drm_atomic_get_private_obj_state(struct drm_atomic_state *state, 454 454 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); 455 461 456 462 /** 457 463 * drm_atomic_get_existing_crtc_state - get crtc state, if it exists