diff mbox

[09/15] drm/i915: export color_differs

Message ID 20170306235414.23407-10-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Matthew Auld March 6, 2017, 11:54 p.m. UTC
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_vma.c | 9 ++-------
 drivers/gpu/drm/i915/i915_vma.h | 6 ++++++
 2 files changed, 8 insertions(+), 7 deletions(-)

Comments

Mika Kuoppala March 7, 2017, 9:50 a.m. UTC | #1
Matthew Auld <matthew.auld@intel.com> writes:

> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_vma.c | 9 ++-------
>  drivers/gpu/drm/i915/i915_vma.h | 6 ++++++
>  2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 31e2327492ba..0d289cbc0123 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -373,11 +373,6 @@ void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
>  		vma->flags &= ~I915_VMA_CAN_FENCE;
>  }
>  
> -static bool color_differs(struct drm_mm_node *node, unsigned long color)
> -{
> -	return node->allocated && node->color != color;
> -}
> -
>  bool i915_gem_valid_gtt_space(struct i915_vma *vma, unsigned long cache_level)
>  {
>  	struct drm_mm_node *node = &vma->node;
> @@ -398,11 +393,11 @@ bool i915_gem_valid_gtt_space(struct i915_vma *vma, unsigned long cache_level)
>  	GEM_BUG_ON(list_empty(&node->node_list));
>  
>  	other = list_prev_entry(node, node_list);
> -	if (color_differs(other, cache_level) && !drm_mm_hole_follows(other))
> +	if (i915_color_differs(other, cache_level) && !drm_mm_hole_follows(other))
>  		return false;
>  
>  	other = list_next_entry(node, node_list);
> -	if (color_differs(other, cache_level) && !drm_mm_hole_follows(node))
> +	if (i915_color_differs(other, cache_level) && !drm_mm_hole_follows(node))
>  		return false;
>  
>  	return true;
> diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
> index 2e03f81dddbe..5492b03d6a77 100644
> --- a/drivers/gpu/drm/i915/i915_vma.h
> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -284,6 +284,12 @@ static inline void i915_vma_unpin(struct i915_vma *vma)
>  	__i915_vma_unpin(vma);
>  }
>  
> +static inline bool i915_color_differs(const struct drm_mm_node *node,
> +				      unsigned long color)

Consider i915_node_color_differs().
-Mika


> +{
> +	return node->allocated && node->color != color;
> +}
> +
>  /**
>   * i915_vma_pin_iomap - calls ioremap_wc to map the GGTT VMA via the aperture
>   * @vma: VMA to iomap
> -- 
> 2.9.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 31e2327492ba..0d289cbc0123 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -373,11 +373,6 @@  void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
 		vma->flags &= ~I915_VMA_CAN_FENCE;
 }
 
-static bool color_differs(struct drm_mm_node *node, unsigned long color)
-{
-	return node->allocated && node->color != color;
-}
-
 bool i915_gem_valid_gtt_space(struct i915_vma *vma, unsigned long cache_level)
 {
 	struct drm_mm_node *node = &vma->node;
@@ -398,11 +393,11 @@  bool i915_gem_valid_gtt_space(struct i915_vma *vma, unsigned long cache_level)
 	GEM_BUG_ON(list_empty(&node->node_list));
 
 	other = list_prev_entry(node, node_list);
-	if (color_differs(other, cache_level) && !drm_mm_hole_follows(other))
+	if (i915_color_differs(other, cache_level) && !drm_mm_hole_follows(other))
 		return false;
 
 	other = list_next_entry(node, node_list);
-	if (color_differs(other, cache_level) && !drm_mm_hole_follows(node))
+	if (i915_color_differs(other, cache_level) && !drm_mm_hole_follows(node))
 		return false;
 
 	return true;
diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
index 2e03f81dddbe..5492b03d6a77 100644
--- a/drivers/gpu/drm/i915/i915_vma.h
+++ b/drivers/gpu/drm/i915/i915_vma.h
@@ -284,6 +284,12 @@  static inline void i915_vma_unpin(struct i915_vma *vma)
 	__i915_vma_unpin(vma);
 }
 
+static inline bool i915_color_differs(const struct drm_mm_node *node,
+				      unsigned long color)
+{
+	return node->allocated && node->color != color;
+}
+
 /**
  * i915_vma_pin_iomap - calls ioremap_wc to map the GGTT VMA via the aperture
  * @vma: VMA to iomap