diff options
Diffstat (limited to 'src/gallium/drivers/r600/r600_pipe.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 4948dddae74..008539d7c0c 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -940,6 +940,9 @@ static void r600_destroy_screen(struct pipe_screen* pscreen) if (rscreen == NULL) return; + pipe_mutex_destroy(rscreen->aux_context_lock); + rscreen->aux_context->destroy(rscreen->aux_context); + if (rscreen->global_pool) { compute_memory_pool_delete(rscreen->global_pool); } @@ -1319,5 +1322,41 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) } #endif + /* Create the auxiliary context. */ + pipe_mutex_init(rscreen->aux_context_lock); + rscreen->aux_context = rscreen->screen.context_create(&rscreen->screen, NULL); + +#if 0 /* This is for testing whether aux_context and buffer clearing work correctly. */ + struct pipe_resource templ = {}; + + templ.width0 = 4; + templ.height0 = 2048; + templ.depth0 = 1; + templ.array_size = 1; + templ.target = PIPE_TEXTURE_2D; + templ.format = PIPE_FORMAT_R8G8B8A8_UNORM; + templ.usage = PIPE_USAGE_STATIC; + + struct r600_resource *res = r600_resource(rscreen->screen.resource_create(&rscreen->screen, &templ)); + unsigned char *map = ws->buffer_map(res->cs_buf, NULL, PIPE_TRANSFER_WRITE); + + memset(map, 0, 256); + + r600_screen_clear_buffer(rscreen, &res->b.b, 4, 4, 0xCC); + r600_screen_clear_buffer(rscreen, &res->b.b, 8, 4, 0xDD); + r600_screen_clear_buffer(rscreen, &res->b.b, 12, 4, 0xEE); + r600_screen_clear_buffer(rscreen, &res->b.b, 20, 4, 0xFF); + r600_screen_clear_buffer(rscreen, &res->b.b, 32, 20, 0x87); + + ws->buffer_wait(res->buf, RADEON_USAGE_WRITE); + + int i; + for (i = 0; i < 256; i++) { + printf("%02X", map[i]); + if (i % 16 == 15) + printf("\n"); + } +#endif + return &rscreen->screen; } |