aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-08-03 04:31:02 +0200
committerMarek Olšák <[email protected]>2011-08-16 09:15:10 +0200
commit638d75185e66727faaba5dc2df1b6e14c7c0c075 (patch)
tree4bcfc81bbaa09dcb96c06ce92b7dcb057faeef0f /src/gallium/winsys/radeon
parent9865b1ec8c88154d8ceb982c42844b68e9224217 (diff)
r600g: let radeon_winsys maintain the list of relocations
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_cs.c40
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_winsys.h5
2 files changed, 37 insertions, 8 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index 1b30b95a318..9a1e16957d2 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -219,11 +219,11 @@ int radeon_get_reloc(struct radeon_cs_context *csc, struct radeon_bo *bo)
return -1;
}
-static void radeon_add_reloc(struct radeon_cs_context *csc,
- struct radeon_bo *bo,
- enum radeon_bo_domain rd,
- enum radeon_bo_domain wd,
- enum radeon_bo_domain *added_domains)
+static unsigned radeon_add_reloc(struct radeon_cs_context *csc,
+ struct radeon_bo *bo,
+ enum radeon_bo_domain rd,
+ enum radeon_bo_domain wd,
+ enum radeon_bo_domain *added_domains)
{
struct drm_radeon_cs_reloc *reloc;
unsigned i;
@@ -233,7 +233,7 @@ static void radeon_add_reloc(struct radeon_cs_context *csc,
reloc = csc->relocs_hashlist[hash];
if (reloc->handle == bo->handle) {
update_domains(reloc, rd, wd, added_domains);
- return;
+ return csc->reloc_indices_hashlist[hash];
}
/* Hash collision, look for the BO in the list of relocs linearly. */
@@ -246,7 +246,7 @@ static void radeon_add_reloc(struct radeon_cs_context *csc,
csc->relocs_hashlist[hash] = reloc;
csc->reloc_indices_hashlist[hash] = i;
/*printf("write_reloc collision, hash: %i, handle: %i\n", hash, bo->handle);*/
- return;
+ return i;
}
}
}
@@ -280,9 +280,9 @@ static void radeon_add_reloc(struct radeon_cs_context *csc,
csc->reloc_indices_hashlist[hash] = csc->crelocs;
csc->chunks[1].length_dw += RELOC_DWORDS;
- csc->crelocs++;
*added_domains = rd | wd;
+ return csc->crelocs++;
}
static void radeon_drm_cs_add_reloc(struct radeon_winsys_cs *rcs,
@@ -470,6 +470,28 @@ static boolean radeon_bo_is_referenced(struct radeon_winsys_cs *rcs,
return radeon_bo_is_referenced_by_cs(cs, bo);
}
+static unsigned trans_add_reloc(struct radeon_winsys_cs *rcs,
+ struct radeon_winsys_cs_handle *buf,
+ enum radeon_bo_domain rd,
+ enum radeon_bo_domain wd,
+ void **reloc_list, unsigned *reloc_count)
+{
+ struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
+ struct radeon_bo *bo = (struct radeon_bo*)buf;
+ enum radeon_bo_domain added_domains;
+
+ unsigned index = radeon_add_reloc(cs->csc, bo, rd, wd, &added_domains);
+
+ if (added_domains & RADEON_DOMAIN_GTT)
+ cs->csc->used_gart += bo->size;
+ if (added_domains & RADEON_DOMAIN_VRAM)
+ cs->csc->used_vram += bo->size;
+
+ *reloc_list = cs->csc->relocs;
+ *reloc_count = cs->csc->crelocs;
+ return index;
+}
+
void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws)
{
ws->base.cs_create = radeon_drm_cs_create;
@@ -480,4 +502,6 @@ void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws)
ws->base.cs_flush = radeon_drm_cs_flush;
ws->base.cs_set_flush = radeon_drm_cs_set_flush;
ws->base.cs_is_buffer_referenced = radeon_bo_is_referenced;
+
+ ws->base.trans_add_reloc = trans_add_reloc;
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index 2e5000702e0..8e81fa1e301 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -329,6 +329,11 @@ struct radeon_winsys {
/* Transitional functions for r600g when moving to winsys/radeon */
unsigned (*trans_get_buffer_handle)(struct pb_buffer *buf);
+ unsigned (*trans_add_reloc)(struct radeon_winsys_cs *cs,
+ struct radeon_winsys_cs_handle *buf,
+ enum radeon_bo_domain rd,
+ enum radeon_bo_domain wd,
+ void **reloc_list, unsigned *reloc_count);
};
#endif