diff options
author | Marek Olšák <[email protected]> | 2013-04-21 23:26:52 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-04-23 20:26:20 +0200 |
commit | b69207642079fe8ba33c594750415e8d9c66a06f (patch) | |
tree | f71b6cfd90363297b7f15c0acd55508267fc7a5a /src/gallium/drivers/r600/r600_pipe.c | |
parent | 1ba46bbb4c99caa7e297f2ec6717e962765275cb (diff) |
r600g: initialize CMASK and HTILE with the GPU using streamout
This fixes a crash when a resource cannot be mapped to the CPU's address space
because it's too big.
This puts a global pipe_context in r600_screen, which is guarded by a mutex,
so that we can use pipe_context when there isn't one around.
Hopefully our multi-context support is solid.
Reviewed-by: Alex Deucher <[email protected]>
NOTE: This is a candidate for the 9.1 branch.
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; } |