From: Michel Dänzer Date: Fri, 13 Jun 2014 08:48:57 +0000 (+0900) Subject: winsys/radeon: Use separate caching buffer managers for VRAM and GTT X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37d43ebb28ce8be38f3d9b0805b8b14354ce786d;p=mesa.git winsys/radeon: Use separate caching buffer managers for VRAM and GTT Should reduce overhead because the caching buffer manager doesn't need to consider buffers of the wrong type. Reviewed-by: Marek Olšák --- diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 0ebe196d142..d06bb344c73 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -800,10 +800,14 @@ radeon_winsys_bo_create(struct radeon_winsys *rws, desc.initial_domains = domain; /* Assign a buffer manager. */ - if (use_reusable_pool) - provider = ws->cman; - else + if (use_reusable_pool) { + if (domain == RADEON_DOMAIN_VRAM) + provider = ws->cman_vram; + else + provider = ws->cman_gtt; + } else { provider = ws->kman; + } buffer = provider->create_buffer(provider, size, &desc.base); if (!buffer) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 7cda70a98d3..9e60de3ab77 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -423,7 +423,8 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws) pipe_mutex_destroy(ws->cmask_owner_mutex); pipe_mutex_destroy(ws->cs_stack_lock); - ws->cman->destroy(ws->cman); + ws->cman_vram->destroy(ws->cman_vram); + ws->cman_gtt->destroy(ws->cman_gtt); ws->kman->destroy(ws->kman); if (ws->gen >= DRV_R600) { radeon_surface_manager_free(ws->surf_man); @@ -638,8 +639,11 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create) ws->kman = radeon_bomgr_create(ws); if (!ws->kman) goto fail; - ws->cman = pb_cache_manager_create(ws->kman, 1000000, 2.0f, 0); - if (!ws->cman) + ws->cman_vram = pb_cache_manager_create(ws->kman, 1000000, 2.0f, 0); + if (!ws->cman_vram) + goto fail; + ws->cman_gtt = pb_cache_manager_create(ws->kman, 1000000, 2.0f, 0); + if (!ws->cman_gtt) goto fail; if (ws->gen >= DRV_R600) { @@ -695,8 +699,10 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create) fail: pipe_mutex_unlock(fd_tab_mutex); - if (ws->cman) - ws->cman->destroy(ws->cman); + if (ws->cman_gtt) + ws->cman_gtt->destroy(ws->cman_gtt); + if (ws->cman_vram) + ws->cman_vram->destroy(ws->cman_vram); if (ws->kman) ws->kman->destroy(ws->kman); if (ws->surf_man) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h index 18fe0aeab10..fc6f53b7231 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h @@ -57,7 +57,8 @@ struct radeon_drm_winsys { uint32_t va_start; struct pb_manager *kman; - struct pb_manager *cman; + struct pb_manager *cman_vram; + struct pb_manager *cman_gtt; struct radeon_surface_manager *surf_man; uint32_t num_cpus; /* Number of CPUs. */