diff options
author | Marek Olšák <[email protected]> | 2012-05-11 22:56:08 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-05-12 00:50:52 +0200 |
commit | f808984f438b827afff6fdbe52ac52dee8781d03 (patch) | |
tree | ecdb7ae2845cb3f864b81afe8e67e60e462c36b1 /src/gallium/drivers | |
parent | 4fd60ad6dae7e5cf3eb0ab4f49bf86378230b65f (diff) |
r300g: remove slab allocator for pipe_resource (used mainly for user buffers)
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r300/r300_context.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.h | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen_buffer.c | 7 |
4 files changed, 3 insertions, 45 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index e1330a42a1d..1006336d44e 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -36,26 +36,6 @@ #include "r300_screen.h" #include "r300_screen_buffer.h" -static void r300_update_num_contexts(struct r300_screen *r300screen, - int diff) -{ - pipe_mutex_lock(r300screen->num_contexts_mutex); - if (diff > 0) { - r300screen->num_contexts++; - - if (r300screen->num_contexts > 1) - util_slab_set_thread_safety(&r300screen->pool_buffers, - UTIL_SLAB_MULTITHREADED); - } else { - r300screen->num_contexts--; - - if (r300screen->num_contexts <= 1) - util_slab_set_thread_safety(&r300screen->pool_buffers, - UTIL_SLAB_SINGLETHREADED); - } - pipe_mutex_unlock(r300screen->num_contexts_mutex); -} - static void r300_release_referenced_objects(struct r300_context *r300) { struct pipe_framebuffer_state *fb = @@ -111,8 +91,6 @@ static void r300_destroy_context(struct pipe_context* context) /* XXX: No way to tell if this was initialized or not? */ util_slab_destroy(&r300->pool_transfers); - r300_update_num_contexts(r300->screen, -1); - /* Free the structs allocated in r300_setup_atoms() */ if (r300->aa_state.state) { FREE(r300->aa_state.state); @@ -379,8 +357,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, if (!r300) return NULL; - r300_update_num_contexts(r300screen, 1); - r300->rws = rws; r300->screen = r300screen; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 1e7f9276b73..82bde2a39c1 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -458,9 +458,6 @@ static void r300_destroy_screen(struct pipe_screen* pscreen) struct r300_screen* r300screen = r300_screen(pscreen); struct radeon_winsys *rws = radeon_winsys(pscreen); - util_slab_destroy(&r300screen->pool_buffers); - pipe_mutex_destroy(r300screen->num_contexts_mutex); - if (rws) rws->destroy(rws); @@ -533,12 +530,6 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws) if (r300screen->info.drm_minor < 8) r300screen->caps.has_us_format = FALSE; - pipe_mutex_init(r300screen->num_contexts_mutex); - - util_slab_create(&r300screen->pool_buffers, - sizeof(struct r300_resource), 64, - UTIL_SLAB_SINGLETHREADED); - r300screen->rws = rws; r300screen->screen.destroy = r300_destroy_screen; r300screen->screen.get_name = r300_get_name; diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index 82b2068e7a0..86bb09cee01 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -40,16 +40,8 @@ struct r300_screen { struct radeon_info info; struct r300_capabilities caps; - /* Memory pools. */ - struct util_slab_mempool pool_buffers; - /** Combination of DBG_xxx flags */ unsigned debug; - - /* The number of created contexts to know whether we have multiple - * contexts or not. */ - int num_contexts; - pipe_mutex num_contexts_mutex; }; diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 0c3f8702c4a..9ab2acd671f 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -53,7 +53,6 @@ void r300_upload_index_buffer(struct r300_context *r300, static void r300_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *buf) { - struct r300_screen *r300screen = r300_screen(screen); struct r300_resource *rbuf = r300_resource(buf); if (rbuf->constant_buffer) @@ -62,7 +61,7 @@ static void r300_buffer_destroy(struct pipe_screen *screen, if (rbuf->buf) pb_reference(&rbuf->buf, NULL); - util_slab_free(&r300screen->pool_buffers, rbuf); + FREE(rbuf); } static struct pipe_transfer* @@ -151,7 +150,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen, struct r300_resource *rbuf; unsigned alignment = 16; - rbuf = util_slab_alloc(&r300screen->pool_buffers); + rbuf = MALLOC_STRUCT(r300_resource); rbuf->b.b = *templ; rbuf->b.vtbl = &r300_buffer_vtbl; @@ -172,7 +171,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen, rbuf->b.b.width0, alignment, rbuf->b.b.bind, rbuf->domain); if (!rbuf->buf) { - util_slab_free(&r300screen->pool_buffers, rbuf); + FREE(rbuf); return NULL; } |