diff mbox series

[RFC,093/162] drm/i915/lmem: allocate cmd ring in lmem

Message ID 20201127120718.454037-94-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series DG1 + LMEM enabling | expand

Commit Message

Matthew Auld Nov. 27, 2020, 12:06 p.m. UTC
From: Michel Thierry <michel.thierry@intel.com>

Signed-off-by: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_ring.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Chris Wilson Nov. 27, 2020, 1:27 p.m. UTC | #1
Quoting Matthew Auld (2020-11-27 12:06:09)
> From: Michel Thierry <michel.thierry@intel.com>
> 
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_ring.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c
> index d636c6ed88b7..aa75e644f3f2 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ring.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ring.c
> @@ -4,6 +4,7 @@
>   * Copyright © 2019 Intel Corporation
>   */
>  
> +#include "gem/i915_gem_lmem.h"
>  #include "gem/i915_gem_object.h"
>  #include "i915_drv.h"
>  #include "i915_vma.h"
> @@ -111,10 +112,16 @@ static struct i915_vma *create_ring_vma(struct i915_ggtt *ggtt, int size)
>         struct i915_vma *vma;
>  
>         obj = ERR_PTR(-ENODEV);
> -       if (i915_ggtt_has_aperture(ggtt))
> -               obj = i915_gem_object_create_stolen(i915, size);
> -       if (IS_ERR(obj))
> -               obj = i915_gem_object_create_internal(i915, size);
> +       if (HAS_LMEM(i915)) {
> +               obj = i915_gem_object_create_lmem(i915, size,
> +                                                 I915_BO_ALLOC_CONTIGUOUS |
> +                                                 I915_BO_ALLOC_VOLATILE);

Just create, and keep trying when !lmem returns an error.

Why contiguous, it's vmapped anyway?

> +       } else {
> +               if (i915_ggtt_has_aperture(ggtt))
> +                       obj = i915_gem_object_create_stolen(i915, size);
> +               if (IS_ERR(obj))
> +                       obj = i915_gem_object_create_internal(i915, size);
> +       }
>         if (IS_ERR(obj))
>                 return ERR_CAST(obj);
>  
> -- 
> 2.26.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c
index d636c6ed88b7..aa75e644f3f2 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring.c
@@ -4,6 +4,7 @@ 
  * Copyright © 2019 Intel Corporation
  */
 
+#include "gem/i915_gem_lmem.h"
 #include "gem/i915_gem_object.h"
 #include "i915_drv.h"
 #include "i915_vma.h"
@@ -111,10 +112,16 @@  static struct i915_vma *create_ring_vma(struct i915_ggtt *ggtt, int size)
 	struct i915_vma *vma;
 
 	obj = ERR_PTR(-ENODEV);
-	if (i915_ggtt_has_aperture(ggtt))
-		obj = i915_gem_object_create_stolen(i915, size);
-	if (IS_ERR(obj))
-		obj = i915_gem_object_create_internal(i915, size);
+	if (HAS_LMEM(i915)) {
+		obj = i915_gem_object_create_lmem(i915, size,
+						  I915_BO_ALLOC_CONTIGUOUS |
+						  I915_BO_ALLOC_VOLATILE);
+	} else {
+		if (i915_ggtt_has_aperture(ggtt))
+			obj = i915_gem_object_create_stolen(i915, size);
+		if (IS_ERR(obj))
+			obj = i915_gem_object_create_internal(i915, size);
+	}
 	if (IS_ERR(obj))
 		return ERR_CAST(obj);