diff options
author | Dave Airlie <[email protected]> | 2011-05-13 14:16:31 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-05-18 17:31:51 +1000 |
commit | ecc051d65b6e17115439fb3609cccfd59f6272bf (patch) | |
tree | 478efbf8678e8d381ad05b0f5923da7c83ba6a06 /src/gallium | |
parent | 4e98318fc1722171a07d867a99ab7608ecf758cd (diff) |
r600g: bump domain selection up one layer.
this is taken from a patch from Mathias Froehlich, just going to
stage it in a few pieces.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_bo.c | 24 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_priv.h | 2 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/radeon_bo.c | 4 |
3 files changed, 24 insertions, 6 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c index e9c650d23be..2bfb8e4e193 100644 --- a/src/gallium/winsys/r600/drm/r600_bo.c +++ b/src/gallium/winsys/r600/drm/r600_bo.c @@ -38,7 +38,8 @@ struct r600_bo *r600_bo(struct radeon *radeon, { struct r600_bo *bo; struct radeon_bo *rbo; - + uint32_t initial_domain; + if (binding & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) { bo = r600_bomgr_bo_create(radeon->bomgr, size, alignment, *radeon->cfence); if (bo) { @@ -46,7 +47,24 @@ struct r600_bo *r600_bo(struct radeon *radeon, } } - rbo = radeon_bo(radeon, 0, size, alignment); + if (binding & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) { + initial_domain = RADEON_GEM_DOMAIN_GTT; + } else { + switch(usage) { + case PIPE_USAGE_DYNAMIC: + case PIPE_USAGE_STREAM: + case PIPE_USAGE_STAGING: + initial_domain = RADEON_GEM_DOMAIN_GTT; + break; + case PIPE_USAGE_DEFAULT: + case PIPE_USAGE_STATIC: + case PIPE_USAGE_IMMUTABLE: + default: + initial_domain = RADEON_GEM_DOMAIN_VRAM; + break; + } + } + rbo = radeon_bo(radeon, 0, size, alignment, initial_domain); if (rbo == NULL) { return NULL; } @@ -80,7 +98,7 @@ struct r600_bo *r600_bo_handle(struct radeon *radeon, struct r600_bo *bo = calloc(1, sizeof(struct r600_bo)); struct radeon_bo *rbo; - rbo = bo->bo = radeon_bo(radeon, handle, 0, 0); + rbo = bo->bo = radeon_bo(radeon, handle, 0, 0, 0); if (rbo == NULL) { free(bo); return NULL; diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 4f7e60c3413..78b8190d6f5 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -132,7 +132,7 @@ unsigned radeon_family_from_device(unsigned device); * radeon_bo.c */ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, - unsigned size, unsigned alignment); + unsigned size, unsigned alignment, unsigned initial_domain); void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst, struct radeon_bo *src); int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo); diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c index cd817fc240b..45cf6f09671 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo.c +++ b/src/gallium/winsys/r600/drm/radeon_bo.c @@ -71,7 +71,7 @@ static void radeon_bo_fixed_unmap(struct radeon *radeon, struct radeon_bo *bo) } struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, - unsigned size, unsigned alignment) + unsigned size, unsigned alignment, unsigned initial_domain) { struct radeon_bo *bo; int r; @@ -115,7 +115,7 @@ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle, args.size = size; args.alignment = alignment; - args.initial_domain = RADEON_GEM_DOMAIN_CPU; + args.initial_domain = initial_domain; args.flags = 0; args.handle = 0; r = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_CREATE, |