diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r600/r600_buffer.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 32 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 5 |
3 files changed, 4 insertions, 41 deletions
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 2f7eb513d4e..3d7d1f04739 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -26,15 +26,15 @@ */ #include "r600_pipe.h" #include "util/u_upload_mgr.h" +#include "util/u_memory.h" static void r600_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *buf) { - struct r600_screen *rscreen = (struct r600_screen*)screen; struct r600_resource *rbuffer = r600_resource(buf); pb_reference(&rbuffer->buf, NULL); - util_slab_free(&rscreen->pool_buffers, rbuffer); + FREE(rbuffer); } static struct pipe_transfer *r600_get_transfer(struct pipe_context *ctx, @@ -207,7 +207,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, /* XXX We probably want a different alignment for buffers and textures. */ unsigned alignment = 4096; - rbuffer = util_slab_alloc(&rscreen->pool_buffers); + rbuffer = MALLOC_STRUCT(r600_resource); rbuffer->b.b = *templ; pipe_reference_init(&rbuffer->b.b.reference, 1); @@ -215,7 +215,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, rbuffer->b.vtbl = &r600_buffer_vtbl; if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) { - util_slab_free(&rscreen->pool_buffers, rbuffer); + FREE(rbuffer); return NULL; } return &rbuffer->b.b; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index bb2336a37e4..cb13ca767c9 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -152,25 +152,6 @@ static void r600_flush_from_winsys(void *ctx, unsigned flags) r600_flush((struct pipe_context*)ctx, NULL, flags); } -static void r600_update_num_contexts(struct r600_screen *rscreen, int diff) -{ - pipe_mutex_lock(rscreen->mutex_num_contexts); - if (diff > 0) { - rscreen->num_contexts++; - - if (rscreen->num_contexts > 1) - util_slab_set_thread_safety(&rscreen->pool_buffers, - UTIL_SLAB_MULTITHREADED); - } else { - rscreen->num_contexts--; - - if (rscreen->num_contexts <= 1) - util_slab_set_thread_safety(&rscreen->pool_buffers, - UTIL_SLAB_SINGLETHREADED); - } - pipe_mutex_unlock(rscreen->mutex_num_contexts); -} - static void r600_destroy_context(struct pipe_context *context) { struct r600_context *rctx = (struct r600_context *)context; @@ -197,8 +178,6 @@ static void r600_destroy_context(struct pipe_context *context) } util_slab_destroy(&rctx->pool_transfers); - r600_update_num_contexts(rctx->screen, -1); - r600_release_command_buffer(&rctx->start_cs_cmd); if (rctx->cs) { @@ -221,8 +200,6 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void sizeof(struct pipe_transfer), 64, UTIL_SLAB_SINGLETHREADED); - r600_update_num_contexts(rscreen, 1); - rctx->context.screen = screen; rctx->context.priv = priv; rctx->context.destroy = r600_destroy_context; @@ -613,9 +590,6 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) pipe_mutex_destroy(rscreen->fences.mutex); rscreen->ws->destroy(rscreen->ws); - - util_slab_destroy(&rscreen->pool_buffers); - pipe_mutex_destroy(rscreen->mutex_num_contexts); FREE(rscreen); } @@ -873,12 +847,6 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) util_format_s3tc_init(); - util_slab_create(&rscreen->pool_buffers, - sizeof(struct r600_resource), 64, - UTIL_SLAB_SINGLETHREADED); - - pipe_mutex_init(rscreen->mutex_num_contexts); - rscreen->fences.bo = NULL; rscreen->fences.data = NULL; rscreen->fences.next_index = 0; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index d6a97077641..e5ba49c5ac5 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -119,15 +119,10 @@ struct r600_screen { enum chip_class chip_class; struct radeon_info info; struct r600_tiling_info tiling_info; - struct util_slab_mempool pool_buffers; struct r600_pipe_fences fences; - unsigned num_contexts; bool use_surface_alloc; int glsl_feature_level; - - /* for thread-safe write accessing to num_contexts */ - pipe_mutex mutex_num_contexts; }; struct r600_pipe_sampler_view { |