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
This commit is contained in:

committed by
Jerome Glisse

parent
e68b4e5053
commit
9e8a6f801d
@@ -47,6 +47,10 @@ static void r600_blitter_save_states(struct pipe_context *ctx)
|
|||||||
rctx->ps_shader);
|
rctx->ps_shader);
|
||||||
util_blitter_save_vertex_shader(rctx->blitter,
|
util_blitter_save_vertex_shader(rctx->blitter,
|
||||||
rctx->vs_shader);
|
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,
|
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 r600_context *rctx = (struct r600_context*)ctx;
|
||||||
struct pipe_framebuffer_state *fb = &rctx->fb_state;
|
struct pipe_framebuffer_state *fb = &rctx->fb_state;
|
||||||
|
|
||||||
#if 0
|
|
||||||
r600_blitter_save_states(ctx);
|
r600_blitter_save_states(ctx);
|
||||||
util_blitter_clear(rctx->blitter, fb->width, fb->height,
|
util_blitter_clear(rctx->blitter, fb->width, fb->height,
|
||||||
fb->nr_cbufs, buffers, rgba, depth,
|
fb->nr_cbufs, buffers, rgba, depth,
|
||||||
stencil);
|
stencil);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void r600_surface_copy(struct pipe_context *ctx,
|
void r600_surface_copy(struct pipe_context *ctx,
|
||||||
|
@@ -73,8 +73,8 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
|
|||||||
if (rbuffer == NULL)
|
if (rbuffer == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pipe_reference_init(&rbuffer->b.b.reference, 1);
|
|
||||||
rbuffer->b.b = *templ;
|
rbuffer->b.b = *templ;
|
||||||
|
pipe_reference_init(&rbuffer->b.b.reference, 1);
|
||||||
rbuffer->b.b.screen = screen;
|
rbuffer->b.b.screen = screen;
|
||||||
rbuffer->b.vtbl = &r600_buffer_vtbl;
|
rbuffer->b.vtbl = &r600_buffer_vtbl;
|
||||||
|
|
||||||
|
@@ -50,9 +50,8 @@ static int dc = 0;
|
|||||||
|
|
||||||
if (radeon_ctx_pm4(rctx->ctx))
|
if (radeon_ctx_pm4(rctx->ctx))
|
||||||
return;
|
return;
|
||||||
if (dc)
|
if (!dc)
|
||||||
return;
|
radeon_ctx_dump_bof(rctx->ctx, "gallium.bof");
|
||||||
radeon_ctx_dump_bof(rctx->ctx, "gallium.bof");
|
|
||||||
radeon_ctx_submit(rctx->ctx);
|
radeon_ctx_submit(rctx->ctx);
|
||||||
rctx->ctx = radeon_ctx_decref(rctx->ctx);
|
rctx->ctx = radeon_ctx_decref(rctx->ctx);
|
||||||
rctx->ctx = radeon_ctx(rscreen->rw);
|
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_query_functions(rctx);
|
||||||
r600_init_state_functions(rctx);
|
r600_init_state_functions(rctx);
|
||||||
r600_init_context_resource_functions(rctx);
|
r600_init_context_resource_functions(rctx);
|
||||||
#if 0
|
|
||||||
rctx->blitter = util_blitter_create(&rctx->context);
|
rctx->blitter = util_blitter_create(&rctx->context);
|
||||||
if (rctx->blitter == NULL) {
|
if (rctx->blitter == NULL) {
|
||||||
FREE(rctx);
|
FREE(rctx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
rctx->cb_cntl = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL);
|
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;
|
rctx->cb_cntl->states[R600_CB_CNTL__CB_SHADER_MASK] = 0x0000000F;
|
||||||
|
@@ -35,6 +35,13 @@
|
|||||||
struct r600_state;
|
struct r600_state;
|
||||||
typedef void (*r600_state_destroy_t)(struct r600_state *rstate);
|
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 {
|
struct r600_state {
|
||||||
unsigned type;
|
unsigned type;
|
||||||
struct r600_atom *atom;
|
struct r600_atom *atom;
|
||||||
@@ -63,13 +70,13 @@ struct r600_context {
|
|||||||
struct r600_pipe_shader *vs_shader;
|
struct r600_pipe_shader *vs_shader;
|
||||||
unsigned flat_shade;
|
unsigned flat_shade;
|
||||||
unsigned nvertex_buffer;
|
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_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
|
||||||
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
|
|
||||||
struct blitter_context *blitter;
|
struct blitter_context *blitter;
|
||||||
struct pipe_stencil_ref stencil_ref;
|
struct pipe_stencil_ref stencil_ref;
|
||||||
struct pipe_framebuffer_state fb_state;
|
struct pipe_framebuffer_state fb_state;
|
||||||
struct radeon_draw *draw;
|
struct radeon_draw *draw;
|
||||||
|
struct pipe_viewport_state *viewport;
|
||||||
};
|
};
|
||||||
|
|
||||||
void r600_draw_arrays(struct pipe_context *ctx, unsigned mode,
|
void r600_draw_arrays(struct pipe_context *ctx, unsigned mode,
|
||||||
|
@@ -99,11 +99,11 @@ static int r600_draw_common(struct r600_draw *draw)
|
|||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
for (i = 0 ; i < rctx->nvertex_element; i++) {
|
for (i = 0 ; i < rctx->vertex_elements->count; i++) {
|
||||||
j = rctx->vertex_element[i].vertex_buffer_index;
|
j = rctx->vertex_elements->elements[i].vertex_buffer_index;
|
||||||
rbuffer = (struct r600_buffer*)rctx->vertex_buffer[j].buffer;
|
rbuffer = (struct r600_buffer*)rctx->vertex_buffer[j].buffer;
|
||||||
offset = rctx->vertex_element[i].src_offset + rctx->vertex_buffer[j].buffer_offset;
|
offset = rctx->vertex_elements->elements[i].src_offset + rctx->vertex_buffer[j].buffer_offset;
|
||||||
r = r600_conv_pipe_format(rctx->vertex_element[i].src_format, &format);
|
r = r600_conv_pipe_format(rctx->vertex_elements->elements[i].src_format, &format);
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + i);
|
vs_resource = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + i);
|
||||||
|
@@ -200,8 +200,8 @@ int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *r
|
|||||||
rshader = &rpshader->shader;
|
rshader = &rpshader->shader;
|
||||||
switch (rpshader->type) {
|
switch (rpshader->type) {
|
||||||
case C_PROGRAM_TYPE_VS:
|
case C_PROGRAM_TYPE_VS:
|
||||||
for (i = 0; i < rctx->nvertex_element; i++) {
|
for (i = 0; i < rctx->vertex_elements->count; i++) {
|
||||||
resource_format[nresources++] = rctx->vertex_element[i].src_format;
|
resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -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->bo[0] = radeon_bo_incref(rscreen->rw, rstate->bo[0]);
|
||||||
rctx->db->nbo = 1;
|
rctx->db->nbo = 1;
|
||||||
rctx->db->placement[0] = RADEON_GEM_DOMAIN_GTT;
|
rctx->db->placement[0] = RADEON_GEM_DOMAIN_GTT;
|
||||||
|
rctx->fb_state = *state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *r600_create_fs_state(struct pipe_context *ctx,
|
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;
|
return;
|
||||||
}
|
}
|
||||||
radeon_draw_set_new(rctx->draw, rstate);
|
radeon_draw_set_new(rctx->draw, rstate);
|
||||||
|
rctx->viewport = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void r600_set_vertex_buffers(struct pipe_context *ctx,
|
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;
|
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,
|
static void *r600_create_vertex_elements_state(struct pipe_context *ctx,
|
||||||
unsigned count,
|
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_context *rctx = (struct r600_context*)ctx;
|
||||||
struct r600_vertex_elements_state *v = (struct r600_vertex_elements_state*)state;
|
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->vertex_elements = v;
|
||||||
rctx->nvertex_element = v->count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void r600_delete_vertex_elements_state(struct pipe_context *ctx, void *state)
|
static void r600_delete_vertex_elements_state(struct pipe_context *ctx, void *state)
|
||||||
|
@@ -113,7 +113,6 @@ static void r600_texture_destroy(struct pipe_screen *screen,
|
|||||||
{
|
{
|
||||||
struct r600_texture *rtex = (struct r600_texture*)ptex;
|
struct r600_texture *rtex = (struct r600_texture*)ptex;
|
||||||
|
|
||||||
pipe_resource_reference((struct pipe_resource**)&rtex, NULL);
|
|
||||||
FREE(rtex);
|
FREE(rtex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user