diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-12-22 03:36:32 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-12-28 05:50:42 -0500 |
commit | 268c6498fba2f6555d215408ae4de3ca1a08fb77 (patch) | |
tree | d2e3ed7fef057aa6fc28b7f4a20cc03f4a9a29ca | |
parent | 2c4b389518fbe552188928aadcd3815d5116a05c (diff) |
drm: Fix application of color vs range restriction when scanning drm_mm
The range restriction should be applied after the color adjustment, or
else we may inadvertently apply the color adjustment to the restricted
hole (and not against its neighbours).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-30-chris@chris-wilson.co.uk
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index c68f79149b9a..1b5613bcb35e 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -772,6 +772,7 @@ bool drm_mm_scan_add_block(struct drm_mm_scan *scan, | |||
772 | struct drm_mm *mm = scan->mm; | 772 | struct drm_mm *mm = scan->mm; |
773 | struct drm_mm_node *hole; | 773 | struct drm_mm_node *hole; |
774 | u64 hole_start, hole_end; | 774 | u64 hole_start, hole_end; |
775 | u64 col_start, col_end; | ||
775 | u64 adj_start, adj_end; | 776 | u64 adj_start, adj_end; |
776 | 777 | ||
777 | DRM_MM_BUG_ON(node->mm != mm); | 778 | DRM_MM_BUG_ON(node->mm != mm); |
@@ -789,14 +790,16 @@ bool drm_mm_scan_add_block(struct drm_mm_scan *scan, | |||
789 | node->node_list.next = &scan->prev_scanned_node->node_list; | 790 | node->node_list.next = &scan->prev_scanned_node->node_list; |
790 | scan->prev_scanned_node = node; | 791 | scan->prev_scanned_node = node; |
791 | 792 | ||
792 | hole_start = drm_mm_hole_node_start(hole); | 793 | hole_start = __drm_mm_hole_node_start(hole); |
793 | hole_end = drm_mm_hole_node_end(hole); | 794 | hole_end = __drm_mm_hole_node_end(hole); |
794 | |||
795 | adj_start = max(hole_start, scan->range_start); | ||
796 | adj_end = min(hole_end, scan->range_end); | ||
797 | 795 | ||
796 | col_start = hole_start; | ||
797 | col_end = hole_end; | ||
798 | if (mm->color_adjust) | 798 | if (mm->color_adjust) |
799 | mm->color_adjust(hole, scan->color, &adj_start, &adj_end); | 799 | mm->color_adjust(hole, scan->color, &col_start, &col_end); |
800 | |||
801 | adj_start = max(col_start, scan->range_start); | ||
802 | adj_end = min(col_end, scan->range_end); | ||
800 | 803 | ||
801 | if (check_free_hole(adj_start, adj_end, | 804 | if (check_free_hole(adj_start, adj_end, |
802 | scan->size, scan->alignment)) { | 805 | scan->size, scan->alignment)) { |