All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/mm: kill color_search_free/get_block
@ 2013-07-01 20:05 Daniel Vetter
  2013-07-01 20:05 ` [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block Daniel Vetter
  2013-07-01 20:18 ` [PATCH 1/2] drm/mm: kill color_search_free/get_block Chris Wilson
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Vetter @ 2013-07-01 20:05 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, David Herrmann

drm/i915 is the only user of the color allocation handling and
switched to insert_node a while ago. So we can ditch this.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 include/drm/drm_mm.h | 31 -------------------------------
 1 file changed, 31 deletions(-)

diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 88591ef..ab240f1 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -177,17 +177,6 @@ static inline struct drm_mm_node *drm_mm_get_block_range(
 	return drm_mm_get_block_range_generic(parent, size, alignment, 0,
 					      start, end, 0);
 }
-static inline struct drm_mm_node *drm_mm_get_color_block_range(
-						struct drm_mm_node *parent,
-						unsigned long size,
-						unsigned alignment,
-						unsigned long color,
-						unsigned long start,
-						unsigned long end)
-{
-	return drm_mm_get_block_range_generic(parent, size, alignment, color,
-					      start, end, 0);
-}
 static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
 						struct drm_mm_node *parent,
 						unsigned long size,
@@ -255,26 +244,6 @@ static inline  struct drm_mm_node *drm_mm_search_free_in_range(
 	return drm_mm_search_free_in_range_generic(mm, size, alignment, 0,
 						   start, end, best_match);
 }
-static inline struct drm_mm_node *drm_mm_search_free_color(const struct drm_mm *mm,
-							   unsigned long size,
-							   unsigned alignment,
-							   unsigned long color,
-							   bool best_match)
-{
-	return drm_mm_search_free_generic(mm,size, alignment, color, best_match);
-}
-static inline  struct drm_mm_node *drm_mm_search_free_in_range_color(
-						const struct drm_mm *mm,
-						unsigned long size,
-						unsigned alignment,
-						unsigned long color,
-						unsigned long start,
-						unsigned long end,
-						bool best_match)
-{
-	return drm_mm_search_free_in_range_generic(mm, size, alignment, color,
-						   start, end, best_match);
-}
 extern int drm_mm_init(struct drm_mm *mm,
 		       unsigned long start,
 		       unsigned long size);
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block
  2013-07-01 20:05 [PATCH 1/2] drm/mm: kill color_search_free/get_block Daniel Vetter
@ 2013-07-01 20:05 ` Daniel Vetter
  2013-07-01 20:16   ` Chris Wilson
  2013-07-01 20:21   ` David Herrmann
  2013-07-01 20:18 ` [PATCH 1/2] drm/mm: kill color_search_free/get_block Chris Wilson
  1 sibling, 2 replies; 9+ messages in thread
From: Daniel Vetter @ 2013-07-01 20:05 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, Intel Graphics Development, Ben Widawsky, David Herrmann

When converting to the preallocated drm_mm_node interfaces in

commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Dec 7 20:37:07 2012 +0000

    drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm

only the allocation side was converted, but not the freeing. Fix this
up.

Note that the only difference between put_block and remove_node is
that the former fills up the preallocation cache. Which we don't need
anyway and hence is just wasted space.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 4200c32..30fd694 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
 	/* Avoid an unnecessary call to unbind on rebind. */
 	obj->map_and_fenceable = true;
 
-	drm_mm_put_block(obj->gtt_space);
+	drm_mm_remove_node(obj->gtt_space);
 	obj->gtt_space = NULL;
 	obj->gtt_offset = 0;
 
@@ -3137,14 +3137,14 @@ search_free:
 	}
 	if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
 		i915_gem_object_unpin_pages(obj);
-		drm_mm_put_block(node);
+		drm_mm_remove_node(node);
 		return -EINVAL;
 	}
 
 	ret = i915_gem_gtt_prepare_object(obj);
 	if (ret) {
 		i915_gem_object_unpin_pages(obj);
-		drm_mm_put_block(node);
+		drm_mm_remove_node(node);
 		return ret;
 	}
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block
  2013-07-01 20:05 ` [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block Daniel Vetter
@ 2013-07-01 20:16   ` Chris Wilson
  2013-07-01 20:28     ` Daniel Vetter
  2013-07-01 20:21   ` David Herrmann
  1 sibling, 1 reply; 9+ messages in thread
From: Chris Wilson @ 2013-07-01 20:16 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development, Ben Widawsky, DRI Development

On Mon, Jul 01, 2013 at 10:05:54PM +0200, Daniel Vetter wrote:
> When converting to the preallocated drm_mm_node interfaces in
> 
> commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date:   Fri Dec 7 20:37:07 2012 +0000
> 
>     drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm
> 
> only the allocation side was converted, but not the freeing. Fix this
> up.
> 
> Note that the only difference between put_block and remove_node is
> that the former fills up the preallocation cache. Which we don't need
> anyway and hence is just wasted space.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ben Widawsky <ben@bwidawsk.net>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

You learn something new every day.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] drm/mm: kill color_search_free/get_block
  2013-07-01 20:05 [PATCH 1/2] drm/mm: kill color_search_free/get_block Daniel Vetter
  2013-07-01 20:05 ` [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block Daniel Vetter
@ 2013-07-01 20:18 ` Chris Wilson
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2013-07-01 20:18 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development, DRI Development

On Mon, Jul 01, 2013 at 10:05:53PM +0200, Daniel Vetter wrote:
> drm/i915 is the only user of the color allocation handling and
> switched to insert_node a while ago. So we can ditch this.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

If you build it, they will come. Lies!
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block
  2013-07-01 20:05 ` [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block Daniel Vetter
  2013-07-01 20:16   ` Chris Wilson
@ 2013-07-01 20:21   ` David Herrmann
  2013-07-01 20:39     ` Daniel Vetter
  1 sibling, 1 reply; 9+ messages in thread
From: David Herrmann @ 2013-07-01 20:21 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development, Ben Widawsky, DRI Development

Hi

On Mon, Jul 1, 2013 at 10:05 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> When converting to the preallocated drm_mm_node interfaces in
>
> commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date:   Fri Dec 7 20:37:07 2012 +0000
>
>     drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm
>
> only the allocation side was converted, but not the freeing. Fix this
> up.
>
> Note that the only difference between put_block and remove_node is
> that the former fills up the preallocation cache. Which we don't need
> anyway and hence is just wasted space.
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ben Widawsky <ben@bwidawsk.net>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 4200c32..30fd694 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
>         /* Avoid an unnecessary call to unbind on rebind. */
>         obj->map_and_fenceable = true;
>
> -       drm_mm_put_block(obj->gtt_space);
> +       drm_mm_remove_node(obj->gtt_space);

kfree(obj->gtt_space);

>         obj->gtt_space = NULL;
>         obj->gtt_offset = 0;
>
> @@ -3137,14 +3137,14 @@ search_free:
>         }
>         if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
>                 i915_gem_object_unpin_pages(obj);
> -               drm_mm_put_block(node);
> +               drm_mm_remove_node(node);

kfree(node);

>                 return -EINVAL;
>         }
>
>         ret = i915_gem_gtt_prepare_object(obj);
>         if (ret) {
>                 i915_gem_object_unpin_pages(obj);
> -               drm_mm_put_block(node);
> +               drm_mm_remove_node(node);

kfree(node);

drm_mm_remove_node() does unlink the node but not remove it. Btw., I
have these fixes in my series, too. I will push it later and write the
git-link to #dri-devel.

Cheers
David

>                 return ret;
>         }
>
> --
> 1.7.11.7
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block
  2013-07-01 20:16   ` Chris Wilson
@ 2013-07-01 20:28     ` Daniel Vetter
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2013-07-01 20:28 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, DRI Development,
	Intel Graphics Development, David Herrmann, Ben Widawsky

On Mon, Jul 01, 2013 at 09:16:56PM +0100, Chris Wilson wrote:
> On Mon, Jul 01, 2013 at 10:05:54PM +0200, Daniel Vetter wrote:
> > When converting to the preallocated drm_mm_node interfaces in
> > 
> > commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d
> > Author: Chris Wilson <chris@chris-wilson.co.uk>
> > Date:   Fri Dec 7 20:37:07 2012 +0000
> > 
> >     drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm
> > 
> > only the allocation side was converted, but not the freeing. Fix this
> > up.
> > 
> > Note that the only difference between put_block and remove_node is
> > that the former fills up the preallocation cache. Which we don't need
> > anyway and hence is just wasted space.
> > 
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Ben Widawsky <ben@bwidawsk.net>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> You learn something new every day.
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

The lack of kfree in this patch might be a problem ...

/me tries again
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block
  2013-07-01 20:21   ` David Herrmann
@ 2013-07-01 20:39     ` Daniel Vetter
  2013-07-01 20:46       ` Ben Widawsky
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2013-07-01 20:39 UTC (permalink / raw)
  To: David Herrmann
  Cc: Daniel Vetter, Intel Graphics Development, Ben Widawsky, DRI Development

On Mon, Jul 01, 2013 at 10:21:57PM +0200, David Herrmann wrote:
> Hi
> 
> On Mon, Jul 1, 2013 at 10:05 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > When converting to the preallocated drm_mm_node interfaces in
> >
> > commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d
> > Author: Chris Wilson <chris@chris-wilson.co.uk>
> > Date:   Fri Dec 7 20:37:07 2012 +0000
> >
> >     drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm
> >
> > only the allocation side was converted, but not the freeing. Fix this
> > up.
> >
> > Note that the only difference between put_block and remove_node is
> > that the former fills up the preallocation cache. Which we don't need
> > anyway and hence is just wasted space.
> >
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Ben Widawsky <ben@bwidawsk.net>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 4200c32..30fd694 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
> >         /* Avoid an unnecessary call to unbind on rebind. */
> >         obj->map_and_fenceable = true;
> >
> > -       drm_mm_put_block(obj->gtt_space);
> > +       drm_mm_remove_node(obj->gtt_space);
> 
> kfree(obj->gtt_space);
> 
> >         obj->gtt_space = NULL;
> >         obj->gtt_offset = 0;
> >
> > @@ -3137,14 +3137,14 @@ search_free:
> >         }
> >         if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
> >                 i915_gem_object_unpin_pages(obj);
> > -               drm_mm_put_block(node);
> > +               drm_mm_remove_node(node);
> 
> kfree(node);
> 
> >                 return -EINVAL;
> >         }
> >
> >         ret = i915_gem_gtt_prepare_object(obj);
> >         if (ret) {
> >                 i915_gem_object_unpin_pages(obj);
> > -               drm_mm_put_block(node);
> > +               drm_mm_remove_node(node);
> 
> kfree(node);

Yeah, I fail ...

> drm_mm_remove_node() does unlink the node but not remove it. Btw., I
> have these fixes in my series, too. I will push it later and write the
> git-link to #dri-devel.

We have patches in-flight to convert over to embedded drm_mm_nodes anyway,
so I guess that part will solve itself automatically.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block
  2013-07-01 20:39     ` Daniel Vetter
@ 2013-07-01 20:46       ` Ben Widawsky
  2013-07-01 20:49         ` Daniel Vetter
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Widawsky @ 2013-07-01 20:46 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
	David Herrmann

On Mon, Jul 01, 2013 at 10:39:03PM +0200, Daniel Vetter wrote:
> On Mon, Jul 01, 2013 at 10:21:57PM +0200, David Herrmann wrote:
> > Hi
> > 
> > On Mon, Jul 1, 2013 at 10:05 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > > When converting to the preallocated drm_mm_node interfaces in
> > >
> > > commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d
> > > Author: Chris Wilson <chris@chris-wilson.co.uk>
> > > Date:   Fri Dec 7 20:37:07 2012 +0000
> > >
> > >     drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm
> > >
> > > only the allocation side was converted, but not the freeing. Fix this
> > > up.
> > >
> > > Note that the only difference between put_block and remove_node is
> > > that the former fills up the preallocation cache. Which we don't need
> > > anyway and hence is just wasted space.
> > >
> > > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Ben Widawsky <ben@bwidawsk.net>
> > > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > ---
> > >  drivers/gpu/drm/i915/i915_gem.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > > index 4200c32..30fd694 100644
> > > --- a/drivers/gpu/drm/i915/i915_gem.c
> > > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > > @@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
> > >         /* Avoid an unnecessary call to unbind on rebind. */
> > >         obj->map_and_fenceable = true;
> > >
> > > -       drm_mm_put_block(obj->gtt_space);
> > > +       drm_mm_remove_node(obj->gtt_space);
> > 
> > kfree(obj->gtt_space);
> > 
> > >         obj->gtt_space = NULL;
> > >         obj->gtt_offset = 0;
> > >
> > > @@ -3137,14 +3137,14 @@ search_free:
> > >         }
> > >         if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
> > >                 i915_gem_object_unpin_pages(obj);
> > > -               drm_mm_put_block(node);
> > > +               drm_mm_remove_node(node);
> > 
> > kfree(node);
> > 
> > >                 return -EINVAL;
> > >         }
> > >
> > >         ret = i915_gem_gtt_prepare_object(obj);
> > >         if (ret) {
> > >                 i915_gem_object_unpin_pages(obj);
> > > -               drm_mm_put_block(node);
> > > +               drm_mm_remove_node(node);
> > 
> > kfree(node);
> 
> Yeah, I fail ...
> 
> > drm_mm_remove_node() does unlink the node but not remove it. Btw., I
> > have these fixes in my series, too. I will push it later and write the
> > git-link to #dri-devel.
> 
> We have patches in-flight to convert over to embedded drm_mm_nodes anyway,
> so I guess that part will solve itself automatically.
> -Daniel

I'm planning to get this out ASAP. I'm a bit confused now though what I
actually need to send.

-- 
Ben Widawsky, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block
  2013-07-01 20:46       ` Ben Widawsky
@ 2013-07-01 20:49         ` Daniel Vetter
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2013-07-01 20:49 UTC (permalink / raw)
  To: Ben Widawsky; +Cc: Intel Graphics Development, DRI Development, David Herrmann

On Mon, Jul 1, 2013 at 10:46 PM, Ben Widawsky <ben@bwidawsk.net> wrote:
>> > drm_mm_remove_node() does unlink the node but not remove it. Btw., I
>> > have these fixes in my series, too. I will push it later and write the
>> > git-link to #dri-devel.
>>
>> We have patches in-flight to convert over to embedded drm_mm_nodes anyway,
>> so I guess that part will solve itself automatically.
>
> I'm planning to get this out ASAP. I'm a bit confused now though what I
> actually need to send.

I think for now just the top-down allocator + the create_node stuff
for stolen memory. I guess the conversion to embed the gtt_space
drm_mm_node will take a bit longer.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-07-01 20:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-01 20:05 [PATCH 1/2] drm/mm: kill color_search_free/get_block Daniel Vetter
2013-07-01 20:05 ` [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block Daniel Vetter
2013-07-01 20:16   ` Chris Wilson
2013-07-01 20:28     ` Daniel Vetter
2013-07-01 20:21   ` David Herrmann
2013-07-01 20:39     ` Daniel Vetter
2013-07-01 20:46       ` Ben Widawsky
2013-07-01 20:49         ` Daniel Vetter
2013-07-01 20:18 ` [PATCH 1/2] drm/mm: kill color_search_free/get_block Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.