Mesa (master): r600g: Use a RAT buffer as the backing bo for the compute memory pool
Tom Stellard
tstellar at kemper.freedesktop.org
Mon Oct 1 16:11:47 UTC 2012
Module: Mesa
Branch: master
Commit: eacca90f4350ea8271b045370f79f42b1429c210
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eacca90f4350ea8271b045370f79f42b1429c210
Author: Tom Stellard <thomas.stellard at amd.com>
Date: Thu Sep 13 17:03:41 2012 +0000
r600g: Use a RAT buffer as the backing bo for the compute memory pool
---
src/gallium/drivers/r600/compute_memory_pool.c | 37 ++-----------------
.../drivers/r600/evergreen_compute_internal.c | 3 +-
2 files changed, 6 insertions(+), 34 deletions(-)
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index 5e25a1d..04f0be1 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -42,35 +42,6 @@
#include "evergreen_compute_internal.h"
#include <inttypes.h>
-static struct r600_texture * create_pool_texture(struct r600_screen * screen,
- unsigned size_in_dw)
-{
-
- struct pipe_resource templ;
- struct r600_texture * tex;
-
- if (size_in_dw == 0) {
- return NULL;
- }
- memset(&templ, 0, sizeof(templ));
- templ.target = PIPE_TEXTURE_1D;
- templ.format = PIPE_FORMAT_R32_UINT;
- templ.bind = PIPE_BIND_CUSTOM;
- templ.usage = PIPE_USAGE_IMMUTABLE;
- templ.flags = 0;
- templ.width0 = size_in_dw;
- templ.height0 = 1;
- templ.depth0 = 1;
- templ.array_size = 1;
-
- tex = (struct r600_texture *)r600_texture_create(
- &screen->screen, &templ);
- /* XXX: Propagate this error */
- assert(tex && "Out of memory");
- tex->is_rat = 1;
- return tex;
-}
-
/**
* Creates a new pool
*/
@@ -99,8 +70,8 @@ static void compute_memory_pool_init(struct compute_memory_pool * pool,
*/
pool->next_id = 1;
pool->size_in_dw = initial_size_in_dw;
- pool->bo = (struct r600_resource*)create_pool_texture(pool->screen,
- pool->size_in_dw);
+ pool->bo = (struct r600_resource*)r600_compute_buffer_alloc_vram(pool->screen,
+ pool->size_in_dw * 4);
}
/**
@@ -216,9 +187,9 @@ void compute_memory_grow_pool(struct compute_memory_pool* pool,
pool->screen->screen.resource_destroy(
(struct pipe_screen *)pool->screen,
(struct pipe_resource *)pool->bo);
- pool->bo = (struct r600_resource*)create_pool_texture(
+ pool->bo = (struct r600_resource*)r600_compute_buffer_alloc_vram(
pool->screen,
- pool->size_in_dw);
+ pool->size_in_dw * 4);
compute_memory_shadow(pool, pipe, 0);
}
}
diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.c b/src/gallium/drivers/r600/evergreen_compute_internal.c
index d4e9ed6..496d099 100644
--- a/src/gallium/drivers/r600/evergreen_compute_internal.c
+++ b/src/gallium/drivers/r600/evergreen_compute_internal.c
@@ -295,7 +295,8 @@ void evergreen_set_rat(
surf = (struct r600_surface*)pipe->ctx->framebuffer.state.cbufs[id];
- evergreen_init_color_surface(rctx, surf);
+ struct radeon_surface *rsurf = &((struct r600_texture*)surf->base.texture)->surface;
+ evergreen_init_color_surface_rat(rctx, surf);
}
void evergreen_set_gds(
More information about the mesa-commit
mailing list