r300-gallium, radeon-gallium: Make add_buffer indicate when a flush is needed.
On a side note, why is RADEON_MAX_BOS 24? Should ask airlied about that.
This commit is contained in:
@@ -467,27 +467,39 @@ validate:
|
||||
for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) {
|
||||
tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture;
|
||||
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
|
||||
r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM);
|
||||
if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
goto validate;
|
||||
}
|
||||
}
|
||||
/* ...depth buffer... */
|
||||
if (r300->framebuffer_state.zsbuf) {
|
||||
tex = (struct r300_texture*)r300->framebuffer_state.zsbuf->texture;
|
||||
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
|
||||
r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM);
|
||||
if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
goto validate;
|
||||
}
|
||||
}
|
||||
/* ...textures... */
|
||||
for (i = 0; i < r300->texture_count; i++) {
|
||||
tex = r300->textures[i];
|
||||
assert(tex && tex->buffer && "texture is marked, but NULL!");
|
||||
r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0);
|
||||
if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
goto validate;
|
||||
}
|
||||
}
|
||||
/* ...and vertex buffer. */
|
||||
if (r300->vbo) {
|
||||
r300->winsys->add_buffer(r300->winsys, r300->vbo,
|
||||
RADEON_GEM_DOMAIN_GTT, 0);
|
||||
if (!r300->winsys->add_buffer(r300->winsys, r300->vbo,
|
||||
RADEON_GEM_DOMAIN_GTT, 0)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
goto validate;
|
||||
}
|
||||
} else {
|
||||
debug_printf("No VBO while emitting dirty state!\n");
|
||||
}
|
||||
|
||||
@@ -120,8 +120,11 @@ fallback:
|
||||
|
||||
/* Make sure our target BO is okay. */
|
||||
validate:
|
||||
r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM);
|
||||
if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
goto validate;
|
||||
}
|
||||
if (r300->winsys->validate(r300->winsys)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
if (invalid) {
|
||||
@@ -242,10 +245,16 @@ fallback:
|
||||
|
||||
/* Add our target BOs to the list. */
|
||||
validate:
|
||||
r300->winsys->add_buffer(r300->winsys, srctex->buffer,
|
||||
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0);
|
||||
r300->winsys->add_buffer(r300->winsys, desttex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM);
|
||||
if (!r300->winsys->add_buffer(r300->winsys, srctex->buffer,
|
||||
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
goto validate;
|
||||
}
|
||||
if (!r300->winsys->add_buffer(r300->winsys, desttex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
goto validate;
|
||||
}
|
||||
if (r300->winsys->validate(r300->winsys)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
if (invalid) {
|
||||
|
||||
@@ -52,10 +52,10 @@ struct r300_winsys {
|
||||
uint32_t vram_size;
|
||||
|
||||
/* Add a pipe_buffer to the list of buffer objects to validate. */
|
||||
void (*add_buffer)(struct r300_winsys* winsys,
|
||||
struct pipe_buffer* pbuffer,
|
||||
uint32_t rd,
|
||||
uint32_t wd);
|
||||
boolean (*add_buffer)(struct r300_winsys* winsys,
|
||||
struct pipe_buffer* pbuffer,
|
||||
uint32_t rd,
|
||||
uint32_t wd);
|
||||
|
||||
/* Revalidate all currently setup pipe_buffers.
|
||||
* Returns TRUE if a flush is required. */
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#include "radeon_r300.h"
|
||||
|
||||
static void radeon_r300_add_buffer(struct r300_winsys* winsys,
|
||||
struct pipe_buffer* pbuffer,
|
||||
uint32_t rd,
|
||||
uint32_t wd)
|
||||
static boolean radeon_r300_add_buffer(struct r300_winsys* winsys,
|
||||
struct pipe_buffer* pbuffer,
|
||||
uint32_t rd,
|
||||
uint32_t wd)
|
||||
{
|
||||
int i;
|
||||
struct radeon_winsys_priv* priv =
|
||||
@@ -35,7 +35,6 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys,
|
||||
|
||||
/* Check to see if this BO is already in line for validation;
|
||||
* find a slot for it otherwise. */
|
||||
assert(priv->bo_count <= RADEON_MAX_BOS);
|
||||
for (i = 0; i < priv->bo_count; i++) {
|
||||
if (sc[i].bo == bo) {
|
||||
sc[i].read_domains |= rd;
|
||||
@@ -44,10 +43,17 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys,
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->bo_count >= RADEON_MAX_BOS) {
|
||||
/* Dohoho. Not falling for that one again. Request a flush. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sc[priv->bo_count].bo = bo;
|
||||
sc[priv->bo_count].read_domains = rd;
|
||||
sc[priv->bo_count].write_domain = wd;
|
||||
priv->bo_count++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static boolean radeon_r300_validate(struct r300_winsys* winsys)
|
||||
|
||||
Reference in New Issue
Block a user