File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -834,9 +834,24 @@ struct drm_mm_node *drm_mm_scan_color_evict(struct drm_mm_scan *scan)
834
834
if (!mm -> color_adjust )
835
835
return NULL ;
836
836
837
- hole = list_first_entry (& mm -> hole_stack , typeof (* hole ), hole_stack );
838
- hole_start = __drm_mm_hole_node_start (hole );
839
- hole_end = hole_start + hole -> hole_size ;
837
+ /*
838
+ * The hole found during scanning should ideally be the first element
839
+ * in the hole_stack list, but due to side-effects in the driver it
840
+ * may not be.
841
+ */
842
+ list_for_each_entry (hole , & mm -> hole_stack , hole_stack ) {
843
+ hole_start = __drm_mm_hole_node_start (hole );
844
+ hole_end = hole_start + hole -> hole_size ;
845
+
846
+ if (hole_start <= scan -> hit_start &&
847
+ hole_end >= scan -> hit_end )
848
+ break ;
849
+ }
850
+
851
+ /* We should only be called after we found the hole previously */
852
+ DRM_MM_BUG_ON (& hole -> hole_stack == & mm -> hole_stack );
853
+ if (unlikely (& hole -> hole_stack == & mm -> hole_stack ))
854
+ return NULL ;
840
855
841
856
DRM_MM_BUG_ON (hole_start > scan -> hit_start );
842
857
DRM_MM_BUG_ON (hole_end < scan -> hit_end );
You can’t perform that action at this time.
0 commit comments