diff options
author | Marek Olšák <[email protected]> | 2011-08-04 02:36:57 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-08-16 09:15:10 +0200 |
commit | 03b25ad8ffd72f1f88b6c80a2ebfe3cf6e8a6390 (patch) | |
tree | bb1081425fdfaa077e7e8434011954f3cfeb6925 | |
parent | e6fb62594fca714883af9bba9795be8838c16900 (diff) |
winsys/radeon: consolidate the add_reloc function
Reviewed-by: Alex Deucher <[email protected]>
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_priv.h | 2 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 36 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_winsys.h | 13 |
3 files changed, 13 insertions, 38 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index 83e964b7f69..54b66cc9e35 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -135,7 +135,7 @@ static INLINE unsigned r600_context_bo_reloc(struct r600_context *ctx, struct r6 assert(bo != NULL); reloc_index = - ctx->radeon->ws->trans_add_reloc(ctx->cs, bo->cs_buf, rbo->domains, rbo->domains); + ctx->radeon->ws->cs_add_reloc(ctx->cs, bo->cs_buf, rbo->domains, rbo->domains); if (reloc_index >= ctx->creloc) ctx->creloc = reloc_index+1; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index 09befb39b11..6da0ae67743 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -285,24 +285,23 @@ static unsigned radeon_add_reloc(struct radeon_cs_context *csc, return csc->crelocs++; } -static void radeon_drm_cs_add_reloc(struct radeon_winsys_cs *rcs, - struct radeon_winsys_cs_handle *buf, - enum radeon_bo_domain rd, - enum radeon_bo_domain wd) +static unsigned radeon_drm_cs_add_reloc(struct radeon_winsys_cs *rcs, + struct radeon_winsys_cs_handle *buf, + enum radeon_bo_domain rd, + enum radeon_bo_domain wd) { struct radeon_drm_cs *cs = radeon_drm_cs(rcs); struct radeon_bo *bo = (struct radeon_bo*)buf; enum radeon_bo_domain added_domains; - radeon_add_reloc(cs->csc, bo, rd, wd, &added_domains); - - if (!added_domains) - return; + 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; + + return index; } static boolean radeon_drm_cs_validate(struct radeon_winsys_cs *rcs) @@ -470,25 +469,6 @@ 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) -{ - 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; - - return index; -} - void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws) { ws->base.cs_create = radeon_drm_cs_create; @@ -499,6 +479,4 @@ 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 073b6aad79a..6360d6a8401 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -259,11 +259,12 @@ struct radeon_winsys { * \param buf A winsys buffer to validate. * \param rd A read domain containing a bitmask of the RADEON_DOMAIN_* flags. * \param wd A write domain containing a bitmask of the RADEON_DOMAIN_* flags. + * \return Relocation index. */ - void (*cs_add_reloc)(struct radeon_winsys_cs *cs, - struct radeon_winsys_cs_handle *buf, - enum radeon_bo_domain rd, - enum radeon_bo_domain wd); + unsigned (*cs_add_reloc)(struct radeon_winsys_cs *cs, + struct radeon_winsys_cs_handle *buf, + enum radeon_bo_domain rd, + enum radeon_bo_domain wd); /** * Return TRUE if there is enough memory in VRAM and GTT for the relocs @@ -329,10 +330,6 @@ 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); }; #endif |