diff options
author | Bas Nieuwenhuizen <[email protected]> | 2010-05-19 18:46:45 +0200 |
---|---|---|
committer | Jerome Glisse <[email protected]> | 2010-05-27 23:24:22 +0200 |
commit | 9e8a6f801d360f85cc7bb53b85f15129b07b26da (patch) | |
tree | 12d5d3bd39ece8e88fa4016bfe815e09607583ff /src/gallium | |
parent | e68b4e50536b3438a3bb8c3d12acebc6845461a8 (diff) |
r600g: various fixes
- enabled flushing a buffer more than once
- enabled the blitter for r600_clear
- added some more colors to r600_is_format_supported (copied from r600_conv_pipe_format)
- r600_set_framebuffer_state now sets rctx->fb_state
- more states are saved before a blit (had to add some accounting for the viewport and the vertex elements state)
- fixed a few errors with reference counting
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_buffer.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_context.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_context.h | 11 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_draw.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 1 |
8 files changed, 26 insertions, 25 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 88b865ef9a6..e92e9281059 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -47,6 +47,10 @@ static void r600_blitter_save_states(struct pipe_context *ctx) rctx->ps_shader); util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader); + util_blitter_save_vertex_elements(rctx->blitter, + rctx->vertex_elements); + util_blitter_save_viewport(rctx->blitter, + rctx->viewport); } void r600_clear(struct pipe_context *ctx, unsigned buffers, @@ -55,12 +59,10 @@ void r600_clear(struct pipe_context *ctx, unsigned buffers, struct r600_context *rctx = (struct r600_context*)ctx; struct pipe_framebuffer_state *fb = &rctx->fb_state; -#if 0 r600_blitter_save_states(ctx); util_blitter_clear(rctx->blitter, fb->width, fb->height, fb->nr_cbufs, buffers, rgba, depth, stencil); -#endif } void r600_surface_copy(struct pipe_context *ctx, diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index fd94c605bb1..272f4dd6730 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -73,8 +73,8 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen, if (rbuffer == NULL) return NULL; - pipe_reference_init(&rbuffer->b.b.reference, 1); rbuffer->b.b = *templ; + pipe_reference_init(&rbuffer->b.b.reference, 1); rbuffer->b.b.screen = screen; rbuffer->b.vtbl = &r600_buffer_vtbl; diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index f4d4ed0d3ef..0d36641a8e2 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -50,9 +50,8 @@ static int dc = 0; if (radeon_ctx_pm4(rctx->ctx)) return; - if (dc) - return; - radeon_ctx_dump_bof(rctx->ctx, "gallium.bof"); + if (!dc) + radeon_ctx_dump_bof(rctx->ctx, "gallium.bof"); radeon_ctx_submit(rctx->ctx); rctx->ctx = radeon_ctx_decref(rctx->ctx); rctx->ctx = radeon_ctx(rscreen->rw); @@ -78,13 +77,12 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) r600_init_query_functions(rctx); r600_init_state_functions(rctx); r600_init_context_resource_functions(rctx); -#if 0 + rctx->blitter = util_blitter_create(&rctx->context); if (rctx->blitter == NULL) { FREE(rctx); return NULL; } -#endif rctx->cb_cntl = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL); rctx->cb_cntl->states[R600_CB_CNTL__CB_SHADER_MASK] = 0x0000000F; diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index afe544819c8..b8ce8b88cae 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -35,6 +35,13 @@ struct r600_state; typedef void (*r600_state_destroy_t)(struct r600_state *rstate); +/* XXX move this to a more appropriate place */ +struct r600_vertex_elements_state +{ + unsigned count; + struct pipe_vertex_element elements[32]; +}; + struct r600_state { unsigned type; struct r600_atom *atom; @@ -63,13 +70,13 @@ struct r600_context { struct r600_pipe_shader *vs_shader; unsigned flat_shade; unsigned nvertex_buffer; - unsigned nvertex_element; + struct r600_vertex_elements_state *vertex_elements; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; struct blitter_context *blitter; struct pipe_stencil_ref stencil_ref; struct pipe_framebuffer_state fb_state; struct radeon_draw *draw; + struct pipe_viewport_state *viewport; }; void r600_draw_arrays(struct pipe_context *ctx, unsigned mode, diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c index aa254faf159..26cc94f857b 100644 --- a/src/gallium/drivers/r600/r600_draw.c +++ b/src/gallium/drivers/r600/r600_draw.c @@ -99,11 +99,11 @@ static int r600_draw_common(struct r600_draw *draw) if (r) return r; - for (i = 0 ; i < rctx->nvertex_element; i++) { - j = rctx->vertex_element[i].vertex_buffer_index; + for (i = 0 ; i < rctx->vertex_elements->count; i++) { + j = rctx->vertex_elements->elements[i].vertex_buffer_index; rbuffer = (struct r600_buffer*)rctx->vertex_buffer[j].buffer; - offset = rctx->vertex_element[i].src_offset + rctx->vertex_buffer[j].buffer_offset; - r = r600_conv_pipe_format(rctx->vertex_element[i].src_format, &format); + offset = rctx->vertex_elements->elements[i].src_offset + rctx->vertex_buffer[j].buffer_offset; + r = r600_conv_pipe_format(rctx->vertex_elements->elements[i].src_format, &format); if (r) return r; vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + i); diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index f8a18658a98..e8efdc9db37 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -200,8 +200,8 @@ int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *r rshader = &rpshader->shader; switch (rpshader->type) { case C_PROGRAM_TYPE_VS: - for (i = 0; i < rctx->nvertex_element; i++) { - resource_format[nresources++] = rctx->vertex_element[i].src_format; + for (i = 0; i < rctx->vertex_elements->count; i++) { + resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format; } break; default: diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index e70ef95c1da..d57e88dd56e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -128,6 +128,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, rctx->db->bo[0] = radeon_bo_incref(rscreen->rw, rstate->bo[0]); rctx->db->nbo = 1; rctx->db->placement[0] = RADEON_GEM_DOMAIN_GTT; + rctx->fb_state = *state; } static void *r600_create_fs_state(struct pipe_context *ctx, @@ -308,6 +309,7 @@ static void r600_set_viewport_state(struct pipe_context *ctx, return; } radeon_draw_set_new(rctx->draw, rstate); + rctx->viewport = state; } static void r600_set_vertex_buffers(struct pipe_context *ctx, @@ -320,12 +322,6 @@ static void r600_set_vertex_buffers(struct pipe_context *ctx, rctx->nvertex_buffer = count; } -/* XXX move this to a more appropriate place */ -struct r600_vertex_elements_state -{ - unsigned count; - struct pipe_vertex_element elements[32]; -}; static void *r600_create_vertex_elements_state(struct pipe_context *ctx, unsigned count, @@ -344,8 +340,7 @@ static void r600_bind_vertex_elements_state(struct pipe_context *ctx, void *stat struct r600_context *rctx = (struct r600_context*)ctx; struct r600_vertex_elements_state *v = (struct r600_vertex_elements_state*)state; - memcpy(rctx->vertex_element, v->elements, v->count * sizeof(struct pipe_vertex_element)); - rctx->nvertex_element = v->count; + rctx->vertex_elements = v; } static void r600_delete_vertex_elements_state(struct pipe_context *ctx, void *state) diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index b41d7a3b00b..7d94bbe510f 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -113,7 +113,6 @@ static void r600_texture_destroy(struct pipe_screen *screen, { struct r600_texture *rtex = (struct r600_texture*)ptex; - pipe_resource_reference((struct pipe_resource**)&rtex, NULL); FREE(rtex); } |