Skip to contentSkip to conversation

some -pro patches for integration

PATCH In review Grazvydas Ignotas 5 participants 6 messages Jan 28, 2017 – Feb 1, 2017 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover some -pro patches for integration

I've taken several patches from amdgpu-pro libdrm that look useful to me and I think can be applied already. The only things I did was rebasing, fixing some typos and dropping Change-Id.

Alex Xie (3):
amdgpu: Free/uninit vamgr_32 in theoretically correct order
amdgpu: vamgr can be a struct instead of a pointer
amdgpu: vamgr_32 can be a struct instead of a pointer

 amdgpu/amdgpu_device.c   | 24 +++++++-----------------
 amdgpu/amdgpu_internal.h |  4 ++--
 amdgpu/amdgpu_vamgr.c    |  6 +++---
 3 files changed, 12 insertions(+), 22 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

PATCH 1/3 amdgpu: Free/uninit vamgr_32 in theoretically correct order

From: Alex Xie <[email protected]>

vamgr_32 is a region inside general VAM range. It is better to free and deinitialize it before general VAM range.

---
 amdgpu/amdgpu_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
amdgpu/amdgpu_device.c +2 -2
index f4ede03..cad7133 100644
@@ -131,10 +131,10 @@ static int amdgpu_get_auth(int fd, int *auth)
 
 static void amdgpu_device_free_internal(amdgpu_device_handle dev)
 {
-	amdgpu_vamgr_deinit(dev->vamgr);
-	free(dev->vamgr);
 	amdgpu_vamgr_deinit(dev->vamgr_32);
 	free(dev->vamgr_32);
+	amdgpu_vamgr_deinit(dev->vamgr);
+	free(dev->vamgr);
 	util_hash_table_destroy(dev->bo_flink_names);
 	util_hash_table_destroy(dev->bo_handles);
 	pthread_mutex_destroy(&dev->bo_table_mutex);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 2/3 amdgpu: vamgr_32 can be a struct instead of a pointer

In reply to a message not in the archive

From: Alex Xie <[email protected]>

vamgr_32 is an integral part of amdgpu_device. We don't need to calloc and free it. This can save CPU time, reduce heap fragmentation.

[Grazvydas Ignotas: rebase, correct a typo in commit message]
---
 amdgpu/amdgpu_device.c   | 8 ++------
 amdgpu/amdgpu_internal.h | 2 +-
 amdgpu/amdgpu_vamgr.c    | 4 ++--
 3 files changed, 5 insertions(+), 9 deletions(-)
amdgpu/amdgpu_device.c +2 -6
index cad7133..11714e4 100644
@@ -131,8 +131,7 @@ static int amdgpu_get_auth(int fd, int *auth)
 
 static void amdgpu_device_free_internal(amdgpu_device_handle dev)
 {
-	amdgpu_vamgr_deinit(dev->vamgr_32);
-	free(dev->vamgr_32);
+	amdgpu_vamgr_deinit(&dev->vamgr_32);
 	amdgpu_vamgr_deinit(dev->vamgr);
 	free(dev->vamgr);
 	util_hash_table_destroy(dev->bo_flink_names);
@@ -270,10 +269,7 @@ int amdgpu_device_initialize(int fd,
 	if (start > 0xffffffff)
 		goto free_va; /* shouldn't get here */
 
-	dev->vamgr_32 =  calloc(1, sizeof(struct amdgpu_bo_va_mgr));
-	if (dev->vamgr_32 == NULL)
-		goto free_va;
-	amdgpu_vamgr_init(dev->vamgr_32, start, max,
+	amdgpu_vamgr_init(&dev->vamgr_32, start, max,
 			  dev->dev_info.virtual_address_alignment);
 
 	*major_version = dev->major_version;
amdgpu/amdgpu_internal.h +1 -1
index 4f039b6..7e237ac 100644
@@ -87,7 +87,7 @@ struct amdgpu_device {
 	/** The global VA manager for the whole virtual address space */
 	struct amdgpu_bo_va_mgr *vamgr;
 	/** The VA manager for the 32bit address space */
-	struct amdgpu_bo_va_mgr *vamgr_32;
+	struct amdgpu_bo_va_mgr vamgr_32;
 };
 
 struct amdgpu_bo {
amdgpu/amdgpu_vamgr.c +2 -2
index 8a707cb..4dc4253 100644
@@ -236,7 +236,7 @@ int amdgpu_va_range_alloc(amdgpu_device_handle dev,
 	struct amdgpu_bo_va_mgr *vamgr;
 
 	if (flags & AMDGPU_VA_RANGE_32_BIT)
-		vamgr = dev->vamgr_32;
+		vamgr = &dev->vamgr_32;
 	else
 		vamgr = dev->vamgr;
 
@@ -249,7 +249,7 @@ int amdgpu_va_range_alloc(amdgpu_device_handle dev,
 	if (!(flags & AMDGPU_VA_RANGE_32_BIT) &&
 	    (*va_base_allocated == AMDGPU_INVALID_VA_ADDRESS)) {
 		/* fallback to 32bit address */
-		vamgr = dev->vamgr_32;
+		vamgr = &dev->vamgr_32;
 		*va_base_allocated = amdgpu_vamgr_find_va(vamgr, size,
 					va_base_alignment, va_base_required);
 	}
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#4 lore raw
In reply to a message not in the archive

This series is,

Quoted 9 lines · Grazvydas Ignotas

I've taken several patches from amdgpu-pro libdrm that look useful to me and I think can be applied already. The only things I did was rebasing, fixing some typos and dropping Change-Id.

Alex Xie (3):
amdgpu: Free/uninit vamgr_32 in theoretically correct order
amdgpu: vamgr can be a struct instead of a pointer
amdgpu: vamgr_32 can be a struct instead of a pointer

Quoted 5 lines
 amdgpu/amdgpu_device.c   | 24 +++++++-----------------
 amdgpu/amdgpu_internal.h |  4 ++--
 amdgpu/amdgpu_vamgr.c    |  6 +++---
 3 files changed, 12 insertions(+), 22 deletions(-)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#6 lore raw
In reply to a message not in the archive

Am 29.01.2017 um 23:51 schrieb Edward O'Callaghan:

Quoted 20 lines

This series is,

Quoted 9 lines · Grazvydas Ignotas

I've taken several patches from amdgpu-pro libdrm that look useful to me and I think can be applied already. The only things I did was rebasing, fixing some typos and dropping Change-Id.

Alex Xie (3):
amdgpu: Free/uninit vamgr_32 in theoretically correct order
amdgpu: vamgr can be a struct instead of a pointer
amdgpu: vamgr_32 can be a struct instead of a pointer

Quoted 5 lines
  amdgpu/amdgpu_device.c   | 24 +++++++-----------------
  amdgpu/amdgpu_internal.h |  4 ++--
  amdgpu/amdgpu_vamgr.c    |  6 +++---
  3 files changed, 12 insertions(+), 22 deletions(-)
Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#7 lore raw
In reply to a message not in the archive
Quoted 9 lines · Grazvydas Ignotas

I've taken several patches from amdgpu-pro libdrm that look useful to me and I think can be applied already. The only things I did was rebasing, fixing some typos and dropping Change-Id.

Alex Xie (3):
amdgpu: Free/uninit vamgr_32 in theoretically correct order
amdgpu: vamgr can be a struct instead of a pointer
amdgpu: vamgr_32 can be a struct instead of a pointer

Nice cleanups/fixes indeed.

Fwiw

Unless someone beats me to it I'll collect all the tags and push these over the weekend.
Emil
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx