summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-12-03 02:48:11 +0100
committerMarek Olšák <[email protected]>2010-12-03 04:40:22 +0100
commit3ba8843307a909f35f2a04e6be6dcadd760ad82b (patch)
tree4c69fda7f8962184259483b8b96a85243a84e159 /src/gallium/winsys/radeon
parent6299f241e9fdd86e705d144a42d9b1979c13f9ad (diff)
r300g: use internal BO handle for add_buffer and write_reloc
Small perf improvement in ipers. radeon_drm_get_cs_handle is exactly what this commit tries to avoid in every write_reloc.
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_buffer.h10
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_buffer.c31
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_r300.c1
3 files changed, 28 insertions, 14 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_buffer.h b/src/gallium/winsys/radeon/drm/radeon_buffer.h
index a8137d85e83..59edbcadbc9 100644
--- a/src/gallium/winsys/radeon/drm/radeon_buffer.h
+++ b/src/gallium/winsys/radeon/drm/radeon_buffer.h
@@ -63,12 +63,12 @@ struct pb_manager *
radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws);
void radeon_drm_bufmgr_add_buffer(struct r300_winsys_cs *cs,
- struct r300_winsys_buffer *buf,
+ struct r300_winsys_cs_buffer *buf,
enum r300_buffer_domain rd,
enum r300_buffer_domain wd);
void radeon_drm_bufmgr_write_reloc(struct r300_winsys_cs *cs,
- struct r300_winsys_buffer *buf,
+ struct r300_winsys_cs_buffer *buf,
enum r300_buffer_domain rd,
enum r300_buffer_domain wd);
@@ -92,7 +92,7 @@ boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
struct winsys_handle *whandle);
boolean radeon_drm_bufmgr_is_buffer_referenced(struct r300_winsys_cs *cs,
- struct r300_winsys_buffer *buf,
+ struct r300_winsys_cs_buffer *buf,
enum r300_reference_domain domain);
void radeon_drm_bufmgr_wait(struct r300_winsys_screen *ws,
@@ -106,4 +106,8 @@ void *radeon_drm_buffer_map(struct r300_winsys_screen *ws,
void radeon_drm_buffer_unmap(struct r300_winsys_screen *ws,
struct r300_winsys_buffer *buf);
+struct r300_winsys_cs_buffer *radeon_drm_get_cs_handle(
+ struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *_buf);
+
#endif
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
index 78723948d41..294d4fac7cd 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
@@ -477,54 +477,63 @@ static uint32_t get_gem_domain(enum r300_buffer_domain domain)
}
void radeon_drm_bufmgr_add_buffer(struct r300_winsys_cs *rcs,
- struct r300_winsys_buffer *_buf,
+ struct r300_winsys_cs_buffer *_buf,
enum r300_buffer_domain rd,
enum r300_buffer_domain wd)
{
struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
- struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
+ struct radeon_bo *bo = (struct radeon_bo*)_buf;
uint32_t gem_rd = get_gem_domain(rd);
uint32_t gem_wd = get_gem_domain(wd);
- radeon_cs_space_add_persistent_bo(cs->cs, buf->bo, gem_rd, gem_wd);
+ radeon_cs_space_add_persistent_bo(cs->cs, bo, gem_rd, gem_wd);
}
void radeon_drm_bufmgr_write_reloc(struct r300_winsys_cs *rcs,
- struct r300_winsys_buffer *_buf,
+ struct r300_winsys_cs_buffer *_buf,
enum r300_buffer_domain rd,
enum r300_buffer_domain wd)
{
struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
- struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
+ struct radeon_bo *bo = (struct radeon_bo*)_buf;
int retval;
uint32_t gem_rd = get_gem_domain(rd);
uint32_t gem_wd = get_gem_domain(wd);
cs->cs->cdw = cs->base.cdw;
- retval = radeon_cs_write_reloc(cs->cs, buf->bo, gem_rd, gem_wd, 0);
+ retval = radeon_cs_write_reloc(cs->cs, bo, gem_rd, gem_wd, 0);
cs->base.cdw = cs->cs->cdw;
if (retval) {
fprintf(stderr, "radeon: Relocation of %p (%d, %d, %d) failed!\n",
- buf, gem_rd, gem_wd, 0);
+ bo, gem_rd, gem_wd, 0);
}
}
+struct r300_winsys_cs_buffer *radeon_drm_get_cs_handle(
+ struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *_buf)
+{
+ /* return pure radeon_bo. */
+ return (struct r300_winsys_cs_buffer*)
+ get_drm_buffer(radeon_pb_buffer(_buf))->bo;
+}
+
boolean radeon_drm_bufmgr_is_buffer_referenced(struct r300_winsys_cs *rcs,
- struct r300_winsys_buffer *_buf,
+ struct r300_winsys_cs_buffer *_buf,
enum r300_reference_domain domain)
{
struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
- struct radeon_drm_buffer *buf = get_drm_buffer(radeon_pb_buffer(_buf));
+ struct radeon_bo *bo = (struct radeon_bo*)_buf;
uint32_t tmp;
if (domain & R300_REF_CS) {
- if (radeon_bo_is_referenced_by_cs(buf->bo, cs->cs)) {
+ if (radeon_bo_is_referenced_by_cs(bo, cs->cs)) {
return TRUE;
}
}
if (domain & R300_REF_HW) {
- if (radeon_bo_is_busy(buf->bo, &tmp)) {
+ if (radeon_bo_is_busy(bo, &tmp)) {
return TRUE;
}
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c
index 3b3e2c2f281..412f3adca46 100644
--- a/src/gallium/winsys/radeon/drm/radeon_r300.c
+++ b/src/gallium/winsys/radeon/drm/radeon_r300.c
@@ -286,6 +286,7 @@ boolean radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
ws->base.get_value = radeon_get_value;
ws->base.buffer_create = radeon_r300_winsys_buffer_create;
+ ws->base.buffer_get_cs_handle = radeon_drm_get_cs_handle;
ws->base.buffer_set_tiling = radeon_drm_bufmgr_set_tiling;
ws->base.buffer_get_tiling = radeon_drm_bufmgr_get_tiling;
ws->base.buffer_map = radeon_drm_buffer_map;