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.

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
main
Alexandre Courbot 2015-05-21 15:08:28 +09:00 committed by Martin Peres
parent e9ea1f42d1
commit a1acffd4e0
3 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;