diff options
author | Christoph Bumiller <[email protected]> | 2012-05-17 14:43:47 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-05-17 15:24:58 +0200 |
commit | 1befacc7647f51344f5cfbfa86b62e53625a436f (patch) | |
tree | cc3ef152070aeed35223e0f145792bd469dfb77f /src/gallium/drivers/nouveau/nouveau_buffer.c | |
parent | 717f55d79d9709a31e0f85a87f076ac13446701d (diff) |
nouveau: place static buffers in VRAM if preferred by the driver
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_buffer.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nouveau_buffer.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index c396e3c3986..d04ac2f9f1c 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -363,10 +363,31 @@ nouveau_buffer_create(struct pipe_screen *pscreen, pipe_reference_init(&buffer->base.reference, 1); buffer->base.screen = pscreen; - if ((buffer->base.bind & screen->sysmem_bindings) == screen->sysmem_bindings) - ret = nouveau_buffer_allocate(screen, buffer, 0); - else - ret = nouveau_buffer_allocate(screen, buffer, NOUVEAU_BO_GART); + if (buffer->base.bind & + (screen->vidmem_bindings & screen->sysmem_bindings)) { + switch (buffer->base.usage) { + case PIPE_USAGE_DEFAULT: + case PIPE_USAGE_IMMUTABLE: + case PIPE_USAGE_STATIC: + buffer->domain = NOUVEAU_BO_VRAM; + break; + case PIPE_USAGE_DYNAMIC: + case PIPE_USAGE_STAGING: + case PIPE_USAGE_STREAM: + buffer->domain = NOUVEAU_BO_GART; + break; + default: + assert(0); + break; + } + } else { + if (buffer->base.bind & screen->vidmem_bindings) + buffer->domain = NOUVEAU_BO_VRAM; + else + if (buffer->base.bind & screen->sysmem_bindings) + buffer->domain = NOUVEAU_BO_GART; + } + ret = nouveau_buffer_allocate(screen, buffer, buffer->domain); if (ret == FALSE) goto fail; |