Skip to contentSkip to conversation

nouveau: add coherent BO attribute

PATCH In review Alexandre Courbot 8 participants 8 messages May 21, 2015 – May 26, 2015 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---
Changes since v1:
None, just added Martin so he can merge the patch. R-b and A-b wanted. :)

 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 538f3a730dbe..4ca0bfbaf592 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.4.0

A message that is not in the archive (sent off-list or not yet received): 1432188508-650-1-git-send-email-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 7 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.

Quoted 50 lines

---
Changes since v1:
None, just added Martin so he can merge the patch. R-b and A-b wanted. :)

 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 538f3a730dbe..4ca0bfbaf592 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;
--

2.4.0

Quoted 4 lines

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

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

#3 lore raw
Quoted 9 lines · Ben Skeggs
Quoted 7 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.

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 10 lines · Martin Peres
Quoted 9 lines · Ben Skeggs
Quoted 7 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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Pushed!

Thanks! Should we also bump the ABI version or something?

A message that is not in the archive (sent off-list or not yet received): CAAVeFuJHL664jbsEBUYFp0atnuF3gisbwhJhR-R=cy+iB8gUCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw

Op 23-05-15 om 08:45 schreef Alexandre Courbot:

Quoted 9 lines · Martin Peres
Quoted 8 lines · Ben Skeggs
Quoted 7 lines · 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 5 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Pushed!

Thanks! Should we also bump the ABI version or something?

If you mean changing libdrm_nouveau.so.2 to .so.3 no! If you mean having something that pkg-config can pick up that's done automatically on every drm release.

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

#8 lore raw
Quoted 10 lines · Maarten Lankhorst

Op 23-05-15 om 08:45 schreef Alexandre Courbot:

Quoted 9 lines · Martin Peres
Quoted 8 lines · Ben Skeggs
Quoted 7 lines · 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 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Pushed!

Thanks! Should we also bump the ABI version or something?

If you mean changing libdrm_nouveau.so.2 to .so.3 no! If you mean having something that pkg-config can pick up that's done automatically on every drm release.

Sorry for not having been clear. I was talking about checking against the driver version to ensure it supports all the features that libdrm can throw at it. We increased the modules's version to 1.2.2 when adding the coherent flag:

drm/nouveau/nouveau_drm.h:
* 1.2.2:
* - add NOUVEAU_GEM_DOMAIN_COHERENT flag
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): CAAVeFuJ4oNi-_ALd3NRNeje7wNntcJ5QME2TWHKTBVWzE0yG1w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#10 lore raw
Quoted 17 lines · Alexandre Courbot
Quoted 10 lines · Maarten Lankhorst

Op 23-05-15 om 08:45 schreef Alexandre Courbot:

Quoted 9 lines · Martin Peres
Quoted 8 lines · Ben Skeggs
Quoted 7 lines · 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 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Pushed!

Thanks! Should we also bump the ABI version or something?

If you mean changing libdrm_nouveau.so.2 to .so.3 no! If you mean having something that pkg-config can pick up that's done automatically on every drm release.

Quoted 8 lines

Sorry for not having been clear. I was talking about checking against the driver version to ensure it supports all the features that libdrm can throw at it. We increased the modules's version to 1.2.2 when adding the coherent flag:

drm/nouveau/nouveau_drm.h:
* 1.2.2:
* - add NOUVEAU_GEM_DOMAIN_COHERENT flag

That will be the job of mesa to check the DRM version, I would guess.

#11 lore raw
Quoted 30 lines · Martin Peres
Quoted 29 lines · Alexandre Courbot
Quoted 15 lines · Maarten Lankhorst

Op 23-05-15 om 08:45 schreef Alexandre Courbot:

Quoted 14 lines
Quoted 12 lines · Martin Peres
Quoted 11 lines · Ben Skeggs
Quoted 9 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.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Pushed!

Thanks! Should we also bump the ABI version or something?

If you mean changing libdrm_nouveau.so.2 to .so.3 no! If you mean having something that pkg-config can pick up that's done automatically on every drm release.

Sorry for not having been clear. I was talking about checking against the driver version to ensure it supports all the features that libdrm can throw at it. We increased the modules's version to 1.2.2 when adding the coherent flag:

Quoted 5 lines
Quoted 3 lines

drm/nouveau/nouveau_drm.h:
* 1.2.2:
* - add NOUVEAU_GEM_DOMAIN_COHERENT flag

That will be the job of mesa to check the DRM version, I would guess.

Precisely. It's up-to the user of nouveau_bo_new() to check for it.

Search for drm_version in src/gallium/drivers/nouveau to see how we already do it for similar changes.

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