Skip to contentSkip to conversation

drm/i915: grab a pages pin count for preallocate stolen

PATCH In review Daniel Vetter 3 participants 4 messages Dec 17, 2013 – Dec 18, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: grab a pages pin count for preallocate stolen

But only when we indeed set up a gtt mapping. We need this since the vma also holds a pages_pin_count, on top of the unconditional pages_pin_count we grab for all stolen objects (to avoid swap-out).

This should avoid a pages_pin_count underrun when cleaning up framebuffers objects taken over from the BIOS.

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -0
index d284d892ed94..fed87ec17211 100644
@@ -420,6 +420,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
 
 	list_add_tail(&obj->global_list, &dev_priv->mm.bound_list);
 	list_add_tail(&vma->mm_list, &ggtt->inactive_list);
+	i915_gem_object_pin_pages(obj);
 
 	return obj;
 
Signature · 1 line
1.8.4.3
#1 lore raw
Quoted 30 lines · Daniel Vetter

But only when we indeed set up a gtt mapping. We need this since the vma also holds a pages_pin_count, on top of the unconditional pages_pin_count we grab for all stolen objects (to avoid swap-out).

This should avoid a pages_pin_count underrun when cleaning up framebuffers objects taken over from the BIOS.

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gem_stolen.c +1 -0
index d284d892ed94..fed87ec17211 100644
@@ -420,6 +420,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
 
 	list_add_tail(&obj->global_list, &dev_priv->mm.bound_list);
 	list_add_tail(&vma->mm_list, &ggtt->inactive_list);
+	i915_gem_object_pin_pages(obj);
 
 	return obj;
 
Signature · 1 line
1.8.4.3

I'm missing why _i915_gem_object_create_stolen() isn't good enough for pinning the pages.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#2 lore raw
Quoted 2 lines · Ben Widawsky

I'm missing why _i915_gem_object_create_stolen() isn't good enough for pinning the pages.

Citing my commit message "... vma also holds a pages_pin_count". Which is on top of the general pages_pin_count we have for all stolen objects to avoid them getting swapped out.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by on v1 1/1
#3 lore raw
In reply to Daniel Vetter
Quoted 11 lines · Daniel Vetter

But only when we indeed set up a gtt mapping. We need this since the vma also holds a pages_pin_count, on top of the unconditional pages_pin_count we grab for all stolen objects (to avoid swap-out).

This should avoid a pages_pin_count underrun when cleaning up framebuffers objects taken over from the BIOS.

The bug is older than the introduction of vma.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre