diff options
author | Marek Olšák <[email protected]> | 2013-09-22 21:45:23 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-09-29 15:18:09 +0200 |
commit | 68f6dec32ed5eede361f76c8dbdf897652659baf (patch) | |
tree | cb05d89cd004f259765188c76ed151d4f77eb615 /src/gallium/drivers/radeon | |
parent | 0cb9de1dd078395d541c32c0de81ea4f05147baa (diff) |
r600g: move aux_context and r600_screen_clear_buffer to drivers/radeon
This will be used in the next commit.
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 21 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 11 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 0a9081b821e..24e0e7a0024 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -53,6 +53,16 @@ void r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->family = rscreen->info.family; rscreen->chip_class = rscreen->info.chip_class; rscreen->debug_flags = debug_get_flags_option("R600_DEBUG", common_debug_options, 0); + + /* Create the auxiliary context. */ + pipe_mutex_init(rscreen->aux_context_lock); + rscreen->aux_context = rscreen->b.context_create(&rscreen->b, NULL); +} + +void r600_common_screen_cleanup(struct r600_common_screen *rscreen) +{ + pipe_mutex_destroy(rscreen->aux_context_lock); + rscreen->aux_context->destroy(rscreen->aux_context); } bool r600_common_context_init(struct r600_common_context *rctx, @@ -130,3 +140,14 @@ bool r600_can_dump_shader(struct r600_common_screen *rscreen, return false; } } + +void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst, + unsigned offset, unsigned size, unsigned value) +{ + struct r600_common_context *rctx = (struct r600_common_context*)rscreen->aux_context; + + pipe_mutex_lock(rscreen->aux_context_lock); + rctx->clear_buffer(&rctx->b, dst, offset, size, value); + rscreen->aux_context->flush(rscreen->aux_context, NULL, 0); + pipe_mutex_unlock(rscreen->aux_context_lock); +} diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index f2510b408ea..86730be15c3 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -151,6 +151,11 @@ struct r600_common_screen { enum chip_class chip_class; struct radeon_info info; unsigned debug_flags; + + /* Auxiliary context. Mainly used to initialize resources. + * It must be locked prior to using and flushed before unlocking. */ + struct pipe_context *aux_context; + pipe_mutex aux_context_lock; }; /* This encapsulates a state or an operation which can emitted into the GPU @@ -228,17 +233,23 @@ struct r600_common_context { struct pipe_resource *src, unsigned src_level, const struct pipe_box *src_box); + + void (*clear_buffer)(struct pipe_context *ctx, struct pipe_resource *dst, + unsigned offset, unsigned size, unsigned value); }; /* r600_common_pipe.c */ void r600_common_screen_init(struct r600_common_screen *rscreen, struct radeon_winsys *ws); +void r600_common_screen_cleanup(struct r600_common_screen *rscreen); bool r600_common_context_init(struct r600_common_context *rctx, struct r600_common_screen *rscreen); void r600_common_context_cleanup(struct r600_common_context *rctx); void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r); bool r600_can_dump_shader(struct r600_common_screen *rscreen, const struct tgsi_token *tokens); +void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst, + unsigned offset, unsigned size, unsigned value); /* r600_streamout.c */ void r600_streamout_buffers_dirty(struct r600_common_context *rctx); |