Skip to contentSkip to conversation

nouveau: add coherent BO attribute

PATCH Superseded Alexandre Courbot 6 participants 12 messages Mar 13, 2015 – May 21, 2015 8 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: add coherent BO attribute

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

---
 include/drm/nouveau_drm.h | 1 +
 nouveau/abi16.c           | 3 +++
 nouveau/nouveau.h         | 1 +
 3 files changed, 5 insertions(+)
include/drm/nouveau_drm.h +1 -0
index b18cad02419b..87aefc5e9d2f 100644
@@ -96,6 +96,7 @@ struct drm_nouveau_setparam {
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
 #define NOUVEAU_GEM_DOMAIN_MAPPABLE  (1 << 3)
+#define NOUVEAU_GEM_DOMAIN_COHERENT  (1 << 4)
 
 #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
 #define NOUVEAU_GEM_TILE_16BPP       0x00000001
nouveau/abi16.c +3 -0
index ae13821bc0cc..d2d1d0d1942d 100644
@@ -195,6 +195,9 @@ abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment,
 	if (bo->flags & NOUVEAU_BO_MAP)
 		info->domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE;
 
+	if (bo->flags & NOUVEAU_BO_COHERENT)
+		info->domain |= NOUVEAU_GEM_DOMAIN_COHERENT;
+
 	if (!(bo->flags & NOUVEAU_BO_CONTIG))
 		info->tile_flags = NOUVEAU_GEM_TILE_NONCONTIG;
 
nouveau/nouveau.h +1 -0
index a55e2b020778..4adda0e3594c 100644
@@ -127,6 +127,7 @@ union nouveau_bo_config {
 #define NOUVEAU_BO_MAP     0x80000000
 #define NOUVEAU_BO_CONTIG  0x40000000
 #define NOUVEAU_BO_NOSNOOP 0x20000000
+#define NOUVEAU_BO_COHERENT 0x10000000
 
 struct nouveau_bo {
 	struct nouveau_device *device;
Signature · 1 line
2.3.2
#1 lore raw

Doesn't this require a kernel version that has your other patch? What happens when this runs on an older kernel? Does it get silently ignored, or does it end up erroring out? If it errors out, that's fine. Otherwise some sort of version check should be put in, no?

Quoted 52 lines · Alexandre Courbot

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

---
 include/drm/nouveau_drm.h | 1 +
 nouveau/abi16.c           | 3 +++
 nouveau/nouveau.h         | 1 +
 3 files changed, 5 insertions(+)
include/drm/nouveau_drm.h +1 -0
index b18cad02419b..87aefc5e9d2f 100644
@@ -96,6 +96,7 @@ struct drm_nouveau_setparam {
 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
 #define NOUVEAU_GEM_DOMAIN_MAPPABLE  (1 << 3)
+#define NOUVEAU_GEM_DOMAIN_COHERENT  (1 << 4)
 
 #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
 #define NOUVEAU_GEM_TILE_16BPP       0x00000001
nouveau/abi16.c +3 -0
index ae13821bc0cc..d2d1d0d1942d 100644
@@ -195,6 +195,9 @@ abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment,
        if (bo->flags & NOUVEAU_BO_MAP)
                info->domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE;
 
+       if (bo->flags & NOUVEAU_BO_COHERENT)
+               info->domain |= NOUVEAU_GEM_DOMAIN_COHERENT;
+
        if (!(bo->flags & NOUVEAU_BO_CONTIG))
                info->tile_flags = NOUVEAU_GEM_TILE_NONCONTIG;
 
nouveau/nouveau.h +1 -1
index a55e2b020778..4adda0e3594c 100644
@@ -127,6 +127,7 @@ union nouveau_bo_config {
 #define NOUVEAU_BO_MAP     0x80000000
 #define NOUVEAU_BO_CONTIG  0x40000000
 #define NOUVEAU_BO_NOSNOOP 0x20000000
+#define NOUVEAU_BO_COHERENT 0x10000000
 
 struct nouveau_bo {
        struct nouveau_device *device;
--
Quoted 2 lines

2.3.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 4 lines · Ilia Mirkin

Doesn't this require a kernel version that has your other patch? What happens when this runs on an older kernel? Does it get silently ignored, or does it end up erroring out? If it errors out, that's fine. Otherwise some sort of version check should be put in, no?

The corresponding kernel patch is already merged in Ben's tree. If running with an older kernel, this flag will be a no-op, which is fine since GK20A's GPU (the reason for this patch as you have guessed :)) is not enabled for these kernels.

I am fine with adding a version check if you think it is necessary.

#4 lore raw
In reply to a message not in the archive
Quoted 6 lines · Alexandre Courbot
Quoted 4 lines · Ilia Mirkin

Doesn't this require a kernel version that has your other patch? What happens when this runs on an older kernel? Does it get silently ignored, or does it end up erroring out? If it errors out, that's fine. Otherwise some sort of version check should be put in, no?

Quoted 6 lines

The corresponding kernel patch is already merged in Ben's tree. If running with an older kernel, this flag will be a no-op, which is fine since GK20A's GPU (the reason for this patch as you have guessed :)) is not enabled for these kernels.

I am fine with adding a version check if you think it is necessary.

So as discussed on IRC, I will check the DRM version from Mesa. This patch should be good to go - it will require a version increase in libdrm though. Let me know if you want me to send a patch for this too.
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#5 lore raw
In reply to Alexandre Courbot

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 7 lines

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

I don't see a problem with this patch, but similar patches to intel to libdrm have been shot down when the changes weren't in an official kernel yet, so I think this should wait until the change is at least in drm-next. ;-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
In reply to a message not in the archive
Quoted 11 lines · Maarten Lankhorst

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 7 lines

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

I don't see a problem with this patch, but similar patches to intel to libdrm have been shot down when the changes weren't in an official kernel yet, so I think this should wait until the change is at least in drm-next. ;-)

Sounds good. I will ping you again once the kernel change reaches -next.

#9 lore raw
In reply to a message not in the archive
Quoted 14 lines · Alexandre Courbot
Quoted 13 lines · Maarten Lankhorst

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 8 lines

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

Quoted 7 lines
Quoted 4 lines

I don't see a problem with this patch, but similar patches to intel to libdrm have been shot down when the changes weren't in an official kernel yet, so I think this should wait until the change is at least in drm-next. ;-)

Sounds good. I will ping you again once the kernel change reaches -next.

Hi Marteen,

The kernel change required for this patch is now in -next. Do you think we can merge it now?
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

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

Re-pinging Marteen on an email address that still exists :P

Quoted 21 lines · Alexandre Courbot
Quoted 20 lines · Alexandre Courbot
Quoted 17 lines · Maarten Lankhorst

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 8 lines

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

I don't see a problem with this patch, but similar patches to intel to libdrm have been shot down when the changes weren't in an official kernel yet, so I think this should wait until the change is at least in drm-next. ;-)

Quoted 6 lines
Quoted 1 line

Sounds good. I will ping you again once the kernel change reaches -next.

Hi Marteen,

The kernel change required for this patch is now in -next. Do you think we can merge it now?

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

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

Op 15-05-15 om 09:11 schreef Alexandre Courbot:

Quoted 25 lines

Re-pinging Marteen on an email address that still exists :P

Quoted 22 lines · Alexandre Courbot
Quoted 10 lines · Alexandre Courbot
Quoted 9 lines · Maarten Lankhorst

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 6 lines

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I don't see a problem with this patch, but similar patches to intel to libdrm have been shot down when the changes weren't in an official kernel yet, so I think this should wait until the change is at least in drm-next. ;-)

Sounds good. I will ping you again once the kernel change reaches -next.

Hi Marteen,

The kernel change required for this patch is now in -next. Do you think we can merge it now?

I think it would be ok to merge now.

~Maarten
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#15 lore raw
In reply to a message not in the archive
Quoted 21 lines · Maarten Lankhorst

Op 15-05-15 om 09:11 schreef Alexandre Courbot:

Quoted 20 lines

Re-pinging Marteen on an email address that still exists :P

Quoted 17 lines · Alexandre Courbot
Quoted 16 lines · Alexandre Courbot
Quoted 14 lines · Maarten Lankhorst

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 7 lines

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

I don't see a problem with this patch, but similar patches to intel to libdrm have been shot down when the changes weren't in an official kernel yet, so I think this should wait until the change is at least in drm-next. ;-)

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Sounds good. I will ping you again once the kernel change reaches -next.

Hi Marteen,

The kernel change required for this patch is now in -next. Do you think we can merge it now?

I think it would be ok to merge now.

Great - who could do this? :P

#17 lore raw
In reply to a message not in the archive
Quoted 22 lines · Alexandre Courbot
Quoted 20 lines · Maarten Lankhorst

Op 15-05-15 om 09:11 schreef Alexandre Courbot:

Quoted 19 lines

Re-pinging Marteen on an email address that still exists :P

Quoted 16 lines · Alexandre Courbot
Quoted 15 lines · Alexandre Courbot
Quoted 14 lines · Maarten Lankhorst

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 7 lines

Add a flag allowing Nouveau to specify that an object should be coherent at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

I don't see a problem with this patch, but similar patches to intel to libdrm have been shot down when the changes weren't in an official kernel yet, so I think this should wait until the change is at least in drm-next. ;-)

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Sounds good. I will ping you again once the kernel change reaches -next.

Hi Marteen,

The kernel change required for this patch is now in -next. Do you think we can merge it now?

I think it would be ok to merge now.

Great - who could do this? :P

I could do it. Please provide me with the patch with the necessary R-b and I can push it to our libdrm (and/or mesa).
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#19 lore raw
In reply to a message not in the archive
Quoted 48 lines · Martin Peres
Quoted 47 lines · Alexandre Courbot
Quoted 44 lines · Maarten Lankhorst

Op 15-05-15 om 09:11 schreef Alexandre Courbot:

Quoted 41 lines

Re-pinging Marteen on an email address that still exists :P

Quoted 36 lines · Alexandre Courbot
Quoted 26 lines · Alexandre Courbot
Quoted 16 lines · Maarten Lankhorst

Hey,

Op 13-03-15 om 07:27 schreef Alexandre Courbot:

Quoted 11 lines

Add a flag allowing Nouveau to specify that an object should be coherent
at allocation time. This is required for some class of objects like fences which are randomly-accessed by both the CPU and GPU. This flag
instructs the kernel driver to make sure the object remains coherent even on architectures for which coherency is not guaranteed by the bus.

Quoted 7 lines

I don't see a problem with this patch, but similar patches to intel to
libdrm have been shot down when the changes weren't in an official kernel
yet, so I think this should wait until the change is at least in drm-next.
;-)

Quoted 2 lines

Sounds good. I will ping you again once the kernel change reaches -next.

Hi Marteen,

The kernel change required for this patch is now in -next. Do you think we can merge it now?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I think it would be ok to merge now.

Great - who could do this? :P

I could do it. Please provide me with the patch with the necessary R-b and I can push it to our libdrm (and/or mesa).

Thanks, I just sent a v2 with you included. I have yet to receive formal R-b and A-b for it though.
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau