diff options
author | Corbin Simpson <[email protected]> | 2010-01-25 11:01:16 -0800 |
---|---|---|
committer | Corbin Simpson <[email protected]> | 2010-01-25 11:30:39 -0800 |
commit | 67149051be56825151659eb1672242b624555f7d (patch) | |
tree | 9b16a75b6392388a61a33d0bc8bebcecb355faf6 /src/gallium/winsys/drm/radeon | |
parent | 72778a9d254f6c9c63d86413936ee7f3e5a6e56e (diff) |
radeong: Clean up domain usages.
Split from Marek's immd-mode patch.
Diffstat (limited to 'src/gallium/winsys/drm/radeon')
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 25e1cdcdb6d..421fda2b450 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -51,6 +51,23 @@ static const char *radeon_get_name(struct pipe_winsys *ws) return "Radeon/GEM+KMS"; } +static uint32_t radeon_domain_from_usage(unsigned usage) +{ + uint32_t domain = 0; + + if (usage & PIPE_BUFFER_USAGE_PIXEL) { + domain |= RADEON_GEM_DOMAIN_VRAM; + } + if (usage & PIPE_BUFFER_USAGE_VERTEX) { + domain |= RADEON_GEM_DOMAIN_GTT; + } + if (usage & PIPE_BUFFER_USAGE_INDEX) { + domain |= RADEON_GEM_DOMAIN_GTT; + } + + return domain; +} + static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws, unsigned alignment, unsigned usage, @@ -79,17 +96,7 @@ static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws, return &radeon_buffer->base; } - domain = 0; - - if (usage & PIPE_BUFFER_USAGE_PIXEL) { - domain |= RADEON_GEM_DOMAIN_VRAM; - } - if (usage & PIPE_BUFFER_USAGE_VERTEX) { - domain |= RADEON_GEM_DOMAIN_GTT; - } - if (usage & PIPE_BUFFER_USAGE_INDEX) { - domain |= RADEON_GEM_DOMAIN_GTT; - } + domain = radeon_domain_from_usage(usage); radeon_buffer->bo = radeon_bo_open(radeon_ws->priv->bom, 0, size, alignment, domain, 0); |