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

drm: Add a new helper to validate damage during atomic_check

This helper function makes sure that damage from plane state is
discarded for full modeset.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

authored by

Deepak Rawat and committed by
Thomas Hellstrom
d9778b40 d3b21767

+40
+3
drivers/gpu/drm/drm_atomic_helper.c
··· 32 32 #include <drm/drm_crtc_helper.h> 33 33 #include <drm/drm_atomic_helper.h> 34 34 #include <drm/drm_writeback.h> 35 + #include <drm/drm_damage_helper.h> 35 36 #include <linux/dma-fence.h> 36 37 37 38 #include "drm_crtc_helper_internal.h" ··· 862 861 funcs = plane->helper_private; 863 862 864 863 drm_atomic_helper_plane_changed(state, old_plane_state, new_plane_state, plane); 864 + 865 + drm_atomic_helper_check_plane_damage(state, new_plane_state); 865 866 866 867 if (!funcs || !funcs->atomic_check) 867 868 continue;
+35
drivers/gpu/drm/drm_damage_helper.c
··· 29 29 * 30 30 **************************************************************************/ 31 31 32 + #include <drm/drm_atomic.h> 32 33 #include <drm/drm_damage_helper.h> 33 34 34 35 /** ··· 82 81 0); 83 82 } 84 83 EXPORT_SYMBOL(drm_plane_enable_fb_damage_clips); 84 + 85 + /** 86 + * drm_atomic_helper_check_plane_damage - Verify plane damage on atomic_check. 87 + * @state: The driver state object. 88 + * @plane_state: Plane state for which to verify damage. 89 + * 90 + * This helper function makes sure that damage from plane state is discarded 91 + * for full modeset. If there are more reasons a driver would want to do a full 92 + * plane update rather than processing individual damage regions, then those 93 + * cases should be taken care of here. 94 + * 95 + * Note that &drm_plane_state.fb_damage_clips == NULL in plane state means that 96 + * full plane update should happen. It also ensure helper iterator will return 97 + * &drm_plane_state.src as damage. 98 + */ 99 + void drm_atomic_helper_check_plane_damage(struct drm_atomic_state *state, 100 + struct drm_plane_state *plane_state) 101 + { 102 + struct drm_crtc_state *crtc_state; 103 + 104 + if (plane_state->crtc) { 105 + crtc_state = drm_atomic_get_new_crtc_state(state, 106 + plane_state->crtc); 107 + 108 + if (WARN_ON(!crtc_state)) 109 + return; 110 + 111 + if (drm_atomic_crtc_needs_modeset(crtc_state)) { 112 + drm_property_blob_put(plane_state->fb_damage_clips); 113 + plane_state->fb_damage_clips = NULL; 114 + } 115 + } 116 + } 117 + EXPORT_SYMBOL(drm_atomic_helper_check_plane_damage);
+2
include/drm/drm_damage_helper.h
··· 35 35 #include <drm/drm_atomic_helper.h> 36 36 37 37 void drm_plane_enable_fb_damage_clips(struct drm_plane *plane); 38 + void drm_atomic_helper_check_plane_damage(struct drm_atomic_state *state, 39 + struct drm_plane_state *plane_state); 38 40 39 41 #endif