summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2012-06-21 19:32:43 -0400
committerTom Stellard <[email protected]>2012-07-09 13:41:18 +0000
commiteb065f5d9d1159af3a88a64a7606c9b6d67dc3e3 (patch)
tree42d4f5370dda569352c444fe2da3a00427c5989e /src/gallium/drivers
parent9d3644137427893b1deb629410ebc68c89f26d74 (diff)
r600g: Use a texture as the underlying resource for compute_memory_pool
This the first step towards being able to use evergreen_cb to bind RATs.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/compute_memory_pool.c34
-rw-r--r--src/gallium/drivers/r600/evergreen_compute_internal.c21
2 files changed, 37 insertions, 18 deletions
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index 01bf0c33dfd..1e88aafae0a 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -41,6 +41,32 @@
#include "compute_memory_pool.h"
#include "evergreen_compute_internal.h"
+static struct r600_resource_texture * create_pool_texture(struct r600_screen * screen,
+ unsigned size_in_dw)
+{
+
+ struct pipe_resource templ;
+ struct r600_resource_texture * tex;
+
+ memset(&templ, 0, sizeof(templ));
+ templ.target = PIPE_TEXTURE_1D;
+ templ.format = PIPE_FORMAT_R32_UNORM;
+ 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_resource_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
*/
@@ -54,8 +80,8 @@ struct compute_memory_pool* compute_memory_pool_new(
pool->next_id = 1;
pool->size_in_dw = initial_size_in_dw;
pool->screen = rscreen;
- pool->bo = (struct r600_resource*)r600_compute_buffer_alloc_vram(
- pool->screen, pool->size_in_dw*4);
+ pool->bo = (struct r600_resource*)create_pool_texture(pool->screen,
+ pool->size_in_dw);
pool->shadow = (uint32_t*)CALLOC(4, pool->size_in_dw);
return pool;
@@ -147,8 +173,8 @@ 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 = r600_compute_buffer_alloc_vram(pool->screen,
- pool->size_in_dw*4);
+ pool->bo = (struct r600_resource*)create_pool_texture(pool->screen,
+ pool->size_in_dw);
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 13c82f0e156..ca44837a432 100644
--- a/src/gallium/drivers/r600/evergreen_compute_internal.c
+++ b/src/gallium/drivers/r600/evergreen_compute_internal.c
@@ -298,20 +298,13 @@ void evergreen_set_rat(
evergreen_compute_get_gpu_format(&fmt, bo);
}
- if (linear) {
- evergreen_reg_set(res,
- R_028C70_CB_COLOR0_INFO, S_028C70_RAT(1)
- | S_028C70_ARRAY_MODE(V_028C70_ARRAY_LINEAR_ALIGNED)
- | S_028C70_FORMAT(fmt.format)
- | S_028C70_NUMBER_TYPE(fmt.number_type)
- );
- evergreen_emit_force_reloc(res);
- } else {
- assert(0 && "TODO");
- ///TODO
-// evergreen_reg_set(res, R_028C70_CB_COLOR0_INFO, S_028C70_RAT(1) | S_028C70_ARRAY_MODE(????));
-// evergreen_emit_force_reloc(res);
- }
+ evergreen_reg_set(res,
+ R_028C70_CB_COLOR0_INFO, S_028C70_RAT(1)
+ | S_028C70_ARRAY_MODE(V_028C70_ARRAY_LINEAR_ALIGNED)
+ | S_028C70_FORMAT(fmt.format)
+ | S_028C70_NUMBER_TYPE(fmt.number_type)
+ );
+ evergreen_emit_force_reloc(res);
evergreen_reg_set(res, R_028C74_CB_COLOR0_ATTRIB, S_028C74_NON_DISP_TILING_ORDER(1));
evergreen_emit_force_reloc(res);