summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/r600/compute_memory_pool.c30
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c2
2 files changed, 24 insertions, 8 deletions
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index 648219b9eb9..0f8bee6e1cd 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -48,6 +48,9 @@ static struct r600_resource_texture * create_pool_texture(struct r600_screen * s
struct pipe_resource templ;
struct r600_resource_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;
@@ -93,8 +96,10 @@ struct compute_memory_pool* compute_memory_pool_new(
void compute_memory_pool_delete(struct compute_memory_pool* pool)
{
free(pool->shadow);
- pool->screen->screen.resource_destroy((struct pipe_screen *)
+ if (pool->bo) {
+ pool->screen->screen.resource_destroy((struct pipe_screen *)
pool->screen, (struct pipe_resource *)pool->bo);
+ }
free(pool);
}
@@ -167,15 +172,24 @@ void compute_memory_grow_pool(struct compute_memory_pool* pool,
new_size_in_dw += 1024 - (new_size_in_dw % 1024);
- compute_memory_shadow(pool, pipe, 1);
+ if (pool->bo) {
+ compute_memory_shadow(pool, pipe, 1);
+ }
pool->shadow = (uint32_t*)realloc(pool->shadow, new_size_in_dw*4);
pool->size_in_dw = new_size_in_dw;
- pool->screen->screen.resource_destroy(
- (struct pipe_screen *)pool->screen,
- (struct pipe_resource *)pool->bo);
- pool->bo = (struct r600_resource*)create_pool_texture(pool->screen,
+ if (pool->bo) {
+ pool->screen->screen.resource_destroy(
+ (struct pipe_screen *)pool->screen,
+ (struct pipe_resource *)pool->bo);
+ pool->bo = (struct r600_resource*)create_pool_texture(
+ pool->screen,
pool->size_in_dw);
- compute_memory_shadow(pool, pipe, 0);
+ compute_memory_shadow(pool, pipe, 0);
+ } else {
+ pool->bo = (struct r600_resource*)create_pool_texture(
+ pool->screen,
+ pool->size_in_dw);
+ }
}
/**
@@ -383,6 +397,8 @@ void compute_memory_transfer(
struct pipe_transfer *xfer;
uint32_t *map;
+ assert(gart);
+
if (device_to_host)
{
xfer = pipe->get_transfer(pipe, gart, 0, PIPE_TRANSFER_READ,
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 675834ed048..b354baecf65 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -952,7 +952,7 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
rscreen->use_surface_alloc = debug_get_bool_option("R600_SURF", TRUE);
rscreen->glsl_feature_level = debug_get_bool_option("R600_GLSL130", TRUE) ? 130 : 120;
- rscreen->global_pool = compute_memory_pool_new(1024*16, rscreen);
+ rscreen->global_pool = compute_memory_pool_new(0, rscreen);
return &rscreen->screen;
}