Skip to contentSkip to conversation

support PRT and replace interface

PATCH In review Junwei Zhang 4 participants 15 messages Mar 16, 2017 – Mar 17, 2017 9 messages not in the archive DRM drivers

lore
Share & tools
lore
#0 lore raw

cover support PRT and replace interface

* add PRT flag and new VA op
* fix flag setting for current VA op function
* Why don't we set flag for current VA op function?
* [RFC] implement new VA fun to support NULL bo

Junwei Zhang (4):
amdgpu: add new VA operations CLEAR and REPLACE
amdgpu: set va flag with input parameter
amdgpu: add PRT page attribute
amdgpu: add a new bo va function to support NULL bo

 amdgpu/amdgpu.h          |  7 +++++++
 amdgpu/amdgpu_bo.c       | 42 ++++++++++++++++++++++++++++++++++++++++--
 include/drm/amdgpu_drm.h |  4 ++++
 3 files changed, 51 insertions(+), 2 deletions(-)
Signature · 6 lines
1.9.1

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

PATCH 1/4 amdgpu: add new VA operations CLEAR and REPLACE

In reply to a message not in the archive
---
 include/drm/amdgpu_drm.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/amdgpu_drm.h +2 -0
index 69a7340..34f8282 100644
@@ -410,6 +410,8 @@ struct drm_amdgpu_gem_op {
 
 #define AMDGPU_VA_OP_MAP			1
 #define AMDGPU_VA_OP_UNMAP			2
+#define AMDGPU_VA_OP_CLEAR			3
+#define AMDGPU_VA_OP_REPLACE			4
 
 /* Delay the page table update till the next CS */
 #define AMDGPU_VM_DELAY_UPDATE		(1 << 0)
Signature · 6 lines
1.9.1

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

PATCH 2/4 amdgpu: set va flag with input parameter

In reply to a message not in the archive
---
 amdgpu/amdgpu_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
amdgpu/amdgpu_bo.c +1 -1
index 6189e5a..800b77a 100644
@@ -941,7 +941,7 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,
 	memset(&va, 0, sizeof(va));
 	va.handle = bo->handle;
 	va.operation = ops;
-	va.flags = AMDGPU_VM_PAGE_READABLE |
+	va.flags = flags | AMDGPU_VM_PAGE_READABLE |
 		   AMDGPU_VM_PAGE_WRITEABLE |
 		   AMDGPU_VM_PAGE_EXECUTABLE;
 	va.va_address = addr;
Signature · 6 lines
1.9.1

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

PATCH 3/4 amdgpu: add PRT page attribute

In reply to a message not in the archive
---
 include/drm/amdgpu_drm.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/amdgpu_drm.h +2 -0
index 34f8282..a73b40a 100644
@@ -423,6 +423,8 @@ struct drm_amdgpu_gem_op {
 #define AMDGPU_VM_PAGE_WRITEABLE	(1 << 2)
 /* executable mapping, new for VI */
 #define AMDGPU_VM_PAGE_EXECUTABLE	(1 << 3)
+/* partially resident texture */
+#define AMDGPU_VM_PAGE_PRT		(1 << 4)
 
 struct drm_amdgpu_gem_va {
 	/** GEM object handle */
Signature · 6 lines
1.9.1

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

PATCH 4/4 amdgpu: add a new bo va function to support NULL bo

In reply to a message not in the archive
---
 amdgpu/amdgpu.h    |  7 +++++++
 amdgpu/amdgpu_bo.c | 40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 1 deletion(-)
amdgpu/amdgpu.h +7 -0
index 84ab688..a9fddd6 100644
@@ -1429,6 +1429,13 @@ int amdgpu_bo_va_op(amdgpu_bo_handle bo,
 		    uint64_t flags,
 		    uint32_t ops);
 
+int amdgpu_bo_va_op2(amdgpu_device_handle dev,
+		     amdgpu_bo_handle bo,
+		     uint64_t offset,
+		     uint64_t size,
+		     uint64_t addr,
+		     uint64_t flags,
+		     uint32_t ops);
 /**
  *  VA mapping/unmapping for the buffer object
  *
amdgpu/amdgpu_bo.c +39 -1
index 800b77a..421e440 100644
@@ -924,13 +924,51 @@ int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
 	return r;
 }
 
-int amdgpu_bo_va_op(amdgpu_bo_handle bo,
+int amdgpu_bo_va_op2(amdgpu_device_handle dev,
+		     amdgpu_bo_handle bo,
 		     uint64_t offset,
 		     uint64_t size,
 		     uint64_t addr,
 		     uint64_t flags,
 		     uint32_t ops)
 {
+	struct drm_amdgpu_gem_va va;
+	int r;
+
+	if (ops != AMDGPU_VA_OP_MAP && ops != AMDGPU_VA_OP_UNMAP &&
+			ops != AMDGPU_VA_OP_REPLACE &&
+			ops != AMDGPU_VA_OP_CLEAR)
+		return -EINVAL;
+
+	memset(&va, 0, sizeof(va));
+	if (bo)
+		va.handle = bo->handle;
+	else
+		va.handle = NULL;
+	if (flags & AMDGPU_VM_PAGE_PRT)
+		flags &= AMDGPU_VM_PAGE_PRT;
+	else
+		flags |= AMDGPU_VM_PAGE_READABLE | AMDGPU_VM_PAGE_WRITEABLE |
+			AMDGPU_VM_PAGE_EXECUTABLE;
+
+	va.operation = ops;
+	va.flags = flags;
+	va.va_address = addr;
+	va.offset_in_bo = offset;
+	va.map_size = ALIGN(size, getpagesize());
+
+	r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_VA, &va, sizeof(va));
+
+	return r;
+}
+
+int amdgpu_bo_va_op(amdgpu_bo_handle bo,
+		    uint64_t offset,
+		    uint64_t size,
+		    uint64_t addr,
+		    uint64_t flags,
+		    uint32_t ops)
+{
 	amdgpu_device_handle dev = bo->dev;
 	struct drm_amdgpu_gem_va va;
 	int r;
Signature · 6 lines
1.9.1

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

Nicolai already proposed patches for PRT support in libdrm (except the CLEAR/REPLACE addition).

They look a bit cleaner and where posted first, I think we should use them instead.

Christian.

Am 16.03.2017 um 04:56 schrieb Junwei Zhang:

Quoted 11 lines

* add PRT flag and new VA op
* fix flag setting for current VA op function
* Why don't we set flag for current VA op function?
* [RFC] implement new VA fun to support NULL bo

Junwei Zhang (4):
amdgpu: add new VA operations CLEAR and REPLACE
amdgpu: set va flag with input parameter
amdgpu: add PRT page attribute
amdgpu: add a new bo va function to support NULL bo

Quoted 5 lines
  amdgpu/amdgpu.h          |  7 +++++++
  amdgpu/amdgpu_bo.c       | 42 ++++++++++++++++++++++++++++++++++++++++--
  include/drm/amdgpu_drm.h |  4 ++++
  3 files changed, 51 insertions(+), 2 deletions(-)

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

#16 lore raw
In reply to a message not in the archive

Hi Christian,

Thanks for your info.
Sorry to miss them...

Actually this a serial of messed function patch, I should send them separately next time.

If we support PRT with bo=NULL, we may need a new VA op. So please take a look at patch 4:
* [PATCH 4/4] amdgpu: add a new bo va function to support NULL bo

I also have a question about current VA op func, why we didn't use the input flags? So I prepare the patch 2 to use the input flags:
* [PATCH 2/4] amdgpu: set va flag with input parameter

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 26 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, March 16, 2017 17:00
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 0/4] [libdrm] support PRT and replace interface

Nicolai already proposed patches for PRT support in libdrm (except the CLEAR/REPLACE addition).

They look a bit cleaner and where posted first, I think we should use them instead.

Christian.

Am 16.03.2017 um 04:56 schrieb Junwei Zhang:

Quoted 11 lines

* add PRT flag and new VA op
* fix flag setting for current VA op function
* Why don't we set flag for current VA op function?
* [RFC] implement new VA fun to support NULL bo

Junwei Zhang (4):
amdgpu: add new VA operations CLEAR and REPLACE
amdgpu: set va flag with input parameter
amdgpu: add PRT page attribute
amdgpu: add a new bo va function to support NULL bo

Quoted 6 lines
Quoted 2 lines
  amdgpu/amdgpu.h          |  7 +++++++
  amdgpu/amdgpu_bo.c       | 42

++++++++++++++++++++++++++++++++++++++++--

Quoted 3 lines
  include/drm/amdgpu_drm.h |  4 ++++
  3 files changed, 51 insertions(+), 2 deletions(-)

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

#18 lore raw
In reply to a message not in the archive

Am 16.03.2017 um 10:14 schrieb Zhang, Jerry:

Quoted 5 lines

Hi Christian,

Thanks for your info.
Sorry to miss them...

Quoted 7 lines

Actually this a serial of messed function patch, I should send them separately next time.

If we support PRT with bo=NULL, we may need a new VA op. So please take a look at patch 4:
* [PATCH 4/4] amdgpu: add a new bo va function to support NULL bo

I also have a question about current VA op func, why we didn't use the input flags?

I have no idea.

Quoted 2 lines

So I prepare the patch 2 to use the input flags:
* [PATCH 2/4] amdgpu: set va flag with input parameter

Nicolai handled both issues by creating a new function where the BO is optional and the flags taken into account.

Please take a look at his patches, they are on the mailing list.

Christian.

Quoted 42 lines

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 32 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, March 16, 2017 17:00
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 0/4] [libdrm] support PRT and replace interface

Nicolai already proposed patches for PRT support in libdrm (except the CLEAR/REPLACE addition).

They look a bit cleaner and where posted first, I think we should use them instead.

Christian.

Am 16.03.2017 um 04:56 schrieb Junwei Zhang:

Quoted 5 lines

* add PRT flag and new VA op
* fix flag setting for current VA op function
* Why don't we set flag for current VA op function?
* [RFC] implement new VA fun to support NULL bo

Quoted 8 lines

Junwei Zhang (4):
amdgpu: add new VA operations CLEAR and REPLACE
amdgpu: set va flag with input parameter
amdgpu: add PRT page attribute
amdgpu: add a new bo va function to support NULL bo

   amdgpu/amdgpu.h          |  7 +++++++
   amdgpu/amdgpu_bo.c       | 42

++++++++++++++++++++++++++++++++++++++++--

Quoted 3 lines
   include/drm/amdgpu_drm.h |  4 ++++
   3 files changed, 51 insertions(+), 2 deletions(-)

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

#20 lore raw
In reply to a message not in the archive
Quoted 9 lines · Christian König

Am 16.03.2017 um 10:14 schrieb Zhang, Jerry:

Quoted 3 lines

So I prepare the patch 2 to use the input flags:
* [PATCH 2/4] amdgpu: set va flag with input parameter

Nicolai handled both issues by creating a new function where the BO is optional and the flags taken into account.

Please take a look at his patches, they are on the mailing list.

Or on Patchwork:

https://patchwork.freedesktop.org/project/amd-xorg-ddx/patches/?submitter=15673

Speaking of Patchwork, it's accumulating a lot of stale patches. Everybody submitting patches, please at least periodically go through your patches and change their state as appropriate.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#23 lore raw
In reply to a message not in the archive

Hi Christian,

Thanks for your info.
I missed them completely :(

the va op raw func looks similar as my va op2.
I will re-use them in hybrid libdrm and provide for UMD development.

Regards,
Jerry(Junwei Zhang)

________________________________________
From: Christian König <[email protected]>
Sent: Thursday, March 16, 2017 5:28:21 PM
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 0/4] [libdrm] support PRT and replace interface

Am 16.03.2017 um 10:14 schrieb Zhang, Jerry:

Quoted 5 lines

Hi Christian,

Thanks for your info.
Sorry to miss them...

Quoted 7 lines

Actually this a serial of messed function patch, I should send them separately next time.

If we support PRT with bo=NULL, we may need a new VA op. So please take a look at patch 4:
* [PATCH 4/4] amdgpu: add a new bo va function to support NULL bo

I also have a question about current VA op func, why we didn't use the input flags?

I have no idea.

Quoted 2 lines

So I prepare the patch 2 to use the input flags:
* [PATCH 2/4] amdgpu: set va flag with input parameter

Nicolai handled both issues by creating a new function where the BO is optional and the flags taken into account.

Please take a look at his patches, they are on the mailing list.

Christian.

Quoted 42 lines

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 32 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, March 16, 2017 17:00
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 0/4] [libdrm] support PRT and replace interface

Nicolai already proposed patches for PRT support in libdrm (except the CLEAR/REPLACE addition).

They look a bit cleaner and where posted first, I think we should use them instead.

Christian.

Am 16.03.2017 um 04:56 schrieb Junwei Zhang:

Quoted 5 lines

* add PRT flag and new VA op
* fix flag setting for current VA op function
* Why don't we set flag for current VA op function?
* [RFC] implement new VA fun to support NULL bo

Quoted 8 lines

Junwei Zhang (4):
amdgpu: add new VA operations CLEAR and REPLACE
amdgpu: set va flag with input parameter
amdgpu: add PRT page attribute
amdgpu: add a new bo va function to support NULL bo

   amdgpu/amdgpu.h          |  7 +++++++
   amdgpu/amdgpu_bo.c       | 42

++++++++++++++++++++++++++++++++++++++++--

Quoted 3 lines
   include/drm/amdgpu_drm.h |  4 ++++
   3 files changed, 51 insertions(+), 2 deletions(-)

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

#22 lore raw
In reply to a message not in the archive

Hi Michel,

that's really help me :)
thanks.

Regards,
Jerry(Junwei Zhang)

________________________________________
From: Michel Dänzer <[email protected]>
Sent: Thursday, March 16, 2017 5:42:53 PM
To: Christian König; Zhang, Jerry
Cc: [email protected]
Subject: Re: [PATCH 0/4] [libdrm] support PRT and replace interface

Quoted 9 lines · Christian König

Am 16.03.2017 um 10:14 schrieb Zhang, Jerry:

Quoted 3 lines

So I prepare the patch 2 to use the input flags:
* [PATCH 2/4] amdgpu: set va flag with input parameter

Nicolai handled both issues by creating a new function where the BO is optional and the flags taken into account.

Please take a look at his patches, they are on the mailing list.

Or on Patchwork:

https://patchwork.freedesktop.org/project/amd-xorg-ddx/patches/?submitter=15673

Speaking of Patchwork, it's accumulating a lot of stale patches. Everybody submitting patches, please at least periodically go through your patches and change their state as appropriate.

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw

Re: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

In reply to a message not in the archive

Hi Christian,

May I get a RB for this patch?

Regards,
Jerry(Junwei Zhang)

________________________________________
From: amd-gfx <[email protected]> on behalf of Junwei Zhang <[email protected]>
Sent: Thursday, March 16, 2017 11:56
To: [email protected]
Cc: Zhang, Jerry
Subject: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

---
 include/drm/amdgpu_drm.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/amdgpu_drm.h +2 -0
index 69a7340..34f8282 100644
@@ -410,6 +410,8 @@ struct drm_amdgpu_gem_op {
 
 #define AMDGPU_VA_OP_MAP                       1
 #define AMDGPU_VA_OP_UNMAP                     2
+#define AMDGPU_VA_OP_CLEAR                     3
+#define AMDGPU_VA_OP_REPLACE                   4
 
 /* Delay the page table update till the next CS */
 #define AMDGPU_VM_DELAY_UPDATE         (1 << 0)

--
1.9.1

_______________________________________________
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

#6 lore raw

Re: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

In reply to a message not in the archive

Hi Jerry,

fell free to use this patch internally, but the upstream copy of include/drm/amdgpu_drm.h should be updated when the kernel change land.

Emil usually points out how to do this correctly whenever we try to add changes manually.

Christian.

Am 16.03.2017 um 15:05 schrieb Zhang, Jerry:

Quoted 35 lines

Hi Christian,

May I get a RB for this patch?

Regards,
Jerry(Junwei Zhang)

________________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Junwei Zhang <[email protected]>
Sent: Thursday, March 16, 2017 11:56
To: [email protected]
Cc: Zhang, Jerry
Subject: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

---
 include/drm/amdgpu_drm.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/amdgpu_drm.h +2 -1
index 69a7340..34f8282 100644
@@ -410,6 +410,8 @@ struct drm_amdgpu_gem_op {
 
 #define AMDGPU_VA_OP_MAP                       1
 #define AMDGPU_VA_OP_UNMAP                     2
+#define AMDGPU_VA_OP_CLEAR                     3
+#define AMDGPU_VA_OP_REPLACE                   4
 
 /* Delay the page table update till the next CS */
 #define AMDGPU_VM_DELAY_UPDATE         (1 << 0)
--

1.9.1

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

#8 lore raw

RE: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

In reply to a message not in the archive

Hi Christian,

Thanks for your reminder.
I always keep it in mind.

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

From: Koenig, Christian
Sent: Thursday, March 16, 2017 22:21
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

Hi Jerry,

fell free to use this patch internally, but the upstream copy of include/drm/amdgpu_drm.h should be updated when the kernel change land.

Emil usually points out how to do this correctly whenever we try to add changes manually.

Christian.

Am 16.03.2017 um 15:05 schrieb Zhang, Jerry:
Hi Christian,

May I get a RB for this patch?

Regards,
Jerry(Junwei Zhang)

________________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org><mailto:[email protected]> on behalf of Junwei Zhang <[email protected]><mailto:[email protected]>
Sent: Thursday, March 16, 2017 11:56
To: [email protected]<mailto:[email protected]>
Cc: Zhang, Jerry
Subject: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

---
 include/drm/amdgpu_drm.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/amdgpu_drm.h +2 -0
index 69a7340..34f8282 100644
@@ -410,6 +410,8 @@ struct drm_amdgpu_gem_op {
 
 #define AMDGPU_VA_OP_MAP                       1
 #define AMDGPU_VA_OP_UNMAP                     2
+#define AMDGPU_VA_OP_CLEAR                     3
+#define AMDGPU_VA_OP_REPLACE                   4
 
 /* Delay the page table update till the next CS */
 #define AMDGPU_VM_DELAY_UPDATE         (1 << 0)

--
1.9.1

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

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

#10 lore raw

Re: [PATCH 1/4] amdgpu: add new VA operations CLEAR and REPLACE

In reply to a message not in the archive
Quoted 4 lines · Jerry

Thanks for your reminder.

I always keep it in mind.

[...]

Quoted 7 lines

*From:*Koenig, Christian

Quoted 5 lines

fell free to use this patch internally, but the upstream copy of include/drm/amdgpu_drm.h should be updated when the kernel change land.

Emil usually points out how to do this correctly whenever we try to add changes manually.

See include/drm/README in the libdrm tree.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx