diff mbox series

[6/7] drm/i915: don't allocate the ring in stolen if we lack aperture

Message ID 20191029095856.25431-6-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/7] drm/i915: define i915_ggtt_has_aperture | expand

Commit Message

Matthew Auld Oct. 29, 2019, 9:58 a.m. UTC
Since we have no way access it from the CPU. For such cases just
fallback to internal objects.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_ring.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Chris Wilson Oct. 29, 2019, 10:08 a.m. UTC | #1
Quoting Matthew Auld (2019-10-29 09:58:55)
> Since we have no way access it from the CPU. For such cases just
> fallback to internal objects.
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Daniele Ceraolo Spurio Oct. 29, 2019, 9:46 p.m. UTC | #2
On 10/29/19 2:58 AM, Matthew Auld wrote:
> Since we have no way access it from the CPU. For such cases just
> fallback to internal objects.
> 

Since the problem is not limited to rings but it applies to all stolen 
objects, wouldn't it be better to just skip the stolen initialization or 
return an error from i915_gem_object_create_stolen()?

Daniele

> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_ring.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c
> index fa01c1407760..ece20504d240 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ring.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ring.c
> @@ -108,7 +108,9 @@ static struct i915_vma *create_ring_vma(struct i915_ggtt *ggtt, int size)
>   	struct drm_i915_gem_object *obj;
>   	struct i915_vma *vma;
>   
> -	obj = i915_gem_object_create_stolen(i915, size);
> +	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 (IS_ERR(obj))
>
Chris Wilson Oct. 29, 2019, 9:51 p.m. UTC | #3
Quoting Daniele Ceraolo Spurio (2019-10-29 21:46:46)
> 
> 
> On 10/29/19 2:58 AM, Matthew Auld wrote:
> > Since we have no way access it from the CPU. For such cases just
> > fallback to internal objects.
> > 
> 
> Since the problem is not limited to rings but it applies to all stolen 
> objects, wouldn't it be better to just skip the stolen initialization or 
> return an error from i915_gem_object_create_stolen()?

Not all stolen objects are accessed on the CPU, the problem expressed
here is not universal.
-Chris
Daniele Ceraolo Spurio Oct. 29, 2019, 9:59 p.m. UTC | #4
On 10/29/19 2:51 PM, Chris Wilson wrote:
> Quoting Daniele Ceraolo Spurio (2019-10-29 21:46:46)
>>
>>
>> On 10/29/19 2:58 AM, Matthew Auld wrote:
>>> Since we have no way access it from the CPU. For such cases just
>>> fallback to internal objects.
>>>
>>
>> Since the problem is not limited to rings but it applies to all stolen
>> objects, wouldn't it be better to just skip the stolen initialization or
>> return an error from i915_gem_object_create_stolen()?
> 
> Not all stolen objects are accessed on the CPU, the problem expressed
> here is not universal.
> -Chris
> 

ok, please ignore my comment then.

Daniele
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 fa01c1407760..ece20504d240 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring.c
@@ -108,7 +108,9 @@  static struct i915_vma *create_ring_vma(struct i915_ggtt *ggtt, int size)
 	struct drm_i915_gem_object *obj;
 	struct i915_vma *vma;
 
-	obj = i915_gem_object_create_stolen(i915, size);
+	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 (IS_ERR(obj))