Browse Source

r300g: fix up buffer emission ordering.

This fixes the code space checking VBOs, then resetting the space list
and space checking other buffers. it fixes demos/ipers

Signed-off-by: Dave Airlie <airlied@redhat.com>
tags/7.8-rc1
Dave Airlie 15 years ago
parent
commit
76bc66b664

+ 28
- 22
src/gallium/drivers/r300/r300_emit.c View File

@@ -1014,32 +1014,12 @@ static void r300_flush_pvs(struct r300_context* r300)
END_CS;
}

/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300)
void r300_emit_buffer_validate(struct r300_context *r300)
{
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_texture* tex;
struct r300_atom* atom;
unsigned i, dwords = 1024;
int dirty_tex = 0;
unsigned i;
boolean invalid = FALSE;

/* Check the required number of dwords against the space remaining in the
* current CS object. If we need more, then flush. */

foreach(atom, &r300->atom_list) {
if (atom->dirty || atom->always_dirty) {
dwords += atom->size;
}
}

/* Make sure we have at least 2*1024 spare dwords. */
/* XXX It would be nice to know the number of dwords we really need to
* XXX emit. */
if (!r300->winsys->check_cs(r300->winsys, dwords)) {
r300->context.flush(&r300->context, 0, NULL);
}

/* Clean out BOs. */
r300->winsys->reset_bos(r300->winsys);

@@ -1103,6 +1083,32 @@ validate:
invalid = TRUE;
goto validate;
}
}

/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300)
{
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_atom* atom;
unsigned i, dwords = 1024;
int dirty_tex = 0;

/* Check the required number of dwords against the space remaining in the
* current CS object. If we need more, then flush. */

foreach(atom, &r300->atom_list) {
if (atom->dirty || atom->always_dirty) {
dwords += atom->size;
}
}

/* Make sure we have at least 2*1024 spare dwords. */
/* XXX It would be nice to know the number of dwords we really need to
* XXX emit. */
if (!r300->winsys->check_cs(r300->winsys, dwords)) {
r300->context.flush(&r300->context, 0, NULL);
r300_emit_buffer_validate(r300);
}

if (r300->dirty_state & R300_NEW_QUERY) {
r300_emit_query_start(r300);

+ 2
- 0
src/gallium/drivers/r300/r300_emit.h View File

@@ -95,4 +95,6 @@ void r300_flush_textures(struct r300_context* r300);
/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300);

void r300_emit_buffer_validate(struct r300_context *r300);

#endif /* R300_EMIT_H */

+ 4
- 0
src/gallium/drivers/r300/r300_render.c View File

@@ -311,6 +311,8 @@ void r300_draw_range_elements(struct pipe_context* pipe,
indexSize = 2;
}

r300_emit_buffer_validate(r300->winsys);

if (!r300->winsys->add_buffer(r300->winsys, indexBuffer,
RADEON_GEM_DOMAIN_GTT, 0)) {
goto cleanup;
@@ -361,6 +363,8 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,

r300_update_derived_state(r300);

r300_emit_buffer_validate(r300);

if (!r300_setup_vertex_buffers(r300)) {
return;
}

Loading…
Cancel
Save