summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2009-05-09 00:43:05 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-05-09 00:45:48 -0700
commit53c2cc8fefa07723fc456d94eda292e201c41dae (patch)
treebf40508a08edd9c5fff6e5f44e7f5dce31df963c
parenta738d2b4c2979d7d54064f2ad08da401b28a473b (diff)
radeon-gallium: Clean up some of the BO counting logic.
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index cbe1652302f..be70ead68d0 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -35,21 +35,19 @@ 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. */
- for (i = 0; i < RADEON_MAX_BOS; i++) {
+ 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;
sc[i].write_domain |= wd;
return;
- } else if (sc[i].bo == NULL) {
- sc[i].bo = bo;
- sc[i].read_domains = rd;
- sc[i].write_domain = wd;
- priv->bo_count = i + 1;
- return;
}
}
- assert(FALSE && "Oh God too many BOs!");
+ sc[priv->bo_count].bo = bo;
+ sc[priv->bo_count].read_domains = rd;
+ sc[priv->bo_count].write_domain = wd;
+ priv->bo_count++;
}
static boolean radeon_r300_validate(struct r300_winsys* winsys)
@@ -148,6 +146,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys)
/* Clean out BOs. */
memset(sc, 0, sizeof(struct radeon_cs_space_check) * RADEON_MAX_BOS);
+ priv->bo_count = 0;
}
/* Helper function to do the ioctls needed for setup and init. */