diff mbox

[27/29] drm/i915: Allocate overlay registers from stolen memory

Message ID 1344696088-24760-28-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Aug. 11, 2012, 2:41 p.m. UTC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_overlay.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Daniel Vetter Aug. 20, 2012, 9:17 p.m. UTC | #1
On Sat, Aug 11, 2012 at 03:41:26PM +0100, Chris Wilson wrote:
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Since most of the overlay-supporting hw uses physical mem for the overlay
I think this isn't much worth it: The additional frobbery in
attach/detach_phys object is likely more work than we'll anything we'll
ever gain from using stolen mem here. Especially since we'll use stolen
mem already for the rings.
-Daniel
> ---
>  drivers/gpu/drm/i915/intel_overlay.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
> index 7a98459..6982191 100644
> --- a/drivers/gpu/drm/i915/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/intel_overlay.c
> @@ -1424,8 +1424,10 @@ void intel_setup_overlay(struct drm_device *dev)
>  
>  	overlay->dev = dev;
>  
> -	reg_bo = i915_gem_alloc_object(dev, PAGE_SIZE);
> -	if (!reg_bo)
> +	reg_bo = i915_gem_object_create_stolen(dev, PAGE_SIZE);
> +	if (reg_bo == NULL)
> +		reg_bo = i915_gem_alloc_object(dev, PAGE_SIZE);
> +	if (reg_bo == NULL)
>  		goto out_free;
>  	overlay->reg_bo = reg_bo;
>  
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Aug. 22, 2012, 3:45 p.m. UTC | #2
On Mon, 20 Aug 2012 23:17:06 +0200, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Sat, Aug 11, 2012 at 03:41:26PM +0100, Chris Wilson wrote:
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Since most of the overlay-supporting hw uses physical mem for the overlay
> I think this isn't much worth it: The additional frobbery in
> attach/detach_phys object is likely more work than we'll anything we'll
> ever gain from using stolen mem here. Especially since we'll use stolen
> mem already for the rings.

In a straw poll of the machines on my desk, non-physical machines outnumber the physical overlay machines. :-p

However, hooking up the physical to use stolen is also a good idea. Too
bad, I haven't found a way to detect the base of stolen memory on gen2
devices without arch specific internals. It worked nicely right up until
I tried to build i915.ko as a module.
-Chris
Daniel Vetter Aug. 22, 2012, 4:26 p.m. UTC | #3
On Wed, Aug 22, 2012 at 04:45:45PM +0100, Chris Wilson wrote:
> On Mon, 20 Aug 2012 23:17:06 +0200, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Sat, Aug 11, 2012 at 03:41:26PM +0100, Chris Wilson wrote:
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > 
> > Since most of the overlay-supporting hw uses physical mem for the overlay
> > I think this isn't much worth it: The additional frobbery in
> > attach/detach_phys object is likely more work than we'll anything we'll
> > ever gain from using stolen mem here. Especially since we'll use stolen
> > mem already for the rings.
> 
> In a straw poll of the machines on my desk, non-physical machines outnumber the physical overlay machines. :-p
> 
> However, hooking up the physical to use stolen is also a good idea. Too
> bad, I haven't found a way to detect the base of stolen memory on gen2
> devices without arch specific internals. It worked nicely right up until
> I tried to build i915.ko as a module.

Hm, can't we make a case to EXPORT_GPL that memmap?
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 7a98459..6982191 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -1424,8 +1424,10 @@  void intel_setup_overlay(struct drm_device *dev)
 
 	overlay->dev = dev;
 
-	reg_bo = i915_gem_alloc_object(dev, PAGE_SIZE);
-	if (!reg_bo)
+	reg_bo = i915_gem_object_create_stolen(dev, PAGE_SIZE);
+	if (reg_bo == NULL)
+		reg_bo = i915_gem_alloc_object(dev, PAGE_SIZE);
+	if (reg_bo == NULL)
 		goto out_free;
 	overlay->reg_bo = reg_bo;