nouveau: add nouveau_resource_destroy
PATCH 1/4 nouveau: add nouveau_resource_destroy
From: Marcin Slusarz <[email protected]>
Subject: [libdrm PATCH] nouveau: add nouveau_resource_destroy
--- nouveau/nouveau_resource.c | 9 +++++++++ nouveau/nouveau_resource.h | 3 +++ 2 files changed, 12 insertions(+), 0 deletions(-)
nouveau/nouveau_resource.c +9 -0
@@ -41,6 +41,15 @@ nouveau_resource_init(struct nouveau_resource **heap,return 0 ; } +void +nouveau_resource_destroy (struct nouveau_resource **heap) +{ +if (!*heap) +return ; +free (*heap); + *heap =NULL ; +} +int nouveau_resource_alloc (struct nouveau_resource *heap,unsigned size,void *priv,struct nouveau_resource **res)
nouveau/nouveau_resource.h +3 -0
@@ -38,6 +38,9 @@ int nouveau_resource_init(struct nouveau_resource **heap, unsigned start, unsigned size); +void +nouveau_resource_destroy (struct nouveau_resource **heap); +int nouveau_resource_alloc (struct nouveau_resource *heap,unsigned size,void *priv,struct nouveau_resource **);
Signature · 1 line
1.6.6.rc3
A message that is not in the archive (sent off-list or not yet received): [email protected]
Is everyone ok with this api addition (naming ok?)?
Quoted 50 lines · Marcin Slusarz
From: Marcin Slusarz <[email protected]>
Subject: [libdrm PATCH] nouveau: addnouveau_resource_destroy---
nouveau/nouveau_resource.c | 9 +++++++++
nouveau/nouveau_resource.h | 3 +++2 files changed, 12 insertions(+), 0 deletions(-)nouveau/nouveau_resource.c +9
-0@@ -41,6 +41,15 @@ nouveau_resource_init(struct nouveau_resource **heap, return 0; } +void +nouveau_resource_destroy (struct nouveau_resource **heap) +{ + if (!*heap) + return; + free(*heap); + *heap = NULL; +} +int
nouveau_resource_alloc(structnouveau_resource*heap, unsigned size, void *priv, structnouveau_resource**res)nouveau/nouveau_resource.h +3
-0@@ -38,6 +38,9 @@ int nouveau_resource_init(struct nouveau_resource **heap, unsigned start, unsigned size); +void +nouveau_resource_destroy (struct nouveau_resource **heap); +int
nouveau_resource_alloc(structnouveau_resource*heap, unsigned size, void *priv, structnouveau_resource**);
--
1.6.6.rc3_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc1001141502l78f40a00n1074cdd4bf00a815-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 1 line · Maarten Maathuis
Is everyone ok with this api addition (naming ok?)?
I guess they are...
... Or is there any issue with this patch I'm not aware of?
Marcin
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Marcin Slusarz
Quoted 2 lines · Maarten Maathuis
Is everyone ok with this api addition (naming ok?)?
I guess they are...
... Or is there any issue with this patch I'm not aware of?
Marcin
In principle I guess we could also make nouveau_resource_free FREE the resource if (!next && !prev && !in_use), but I prefer the extra function.
Also, resource_destroy could iterate through all resources still linked with it and FREE them too, but that would probably not be necessary since all alloc'd ones should already have been released (but would produce a deserved segfault otherwise, if they're still used).
If no one speaks in favour of changing anything though, let's push this as is (?) ...
Christoph
Quoted 5 lines
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau