We don't really want extra buffer copying or stalls when mapping,
so it'd be nice to know when it's happening.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_state_cache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c 
b/src/mesa/drivers/dri/i965/brw_state_cache.c
index b0986ea..b9bb0fc 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -175,7 +175,7 @@ brw_cache_new_bo(struct brw_cache *cache, uint32_t new_size)
 
    /* Copy any existing data that needs to be saved. */
    if (cache->next_offset != 0) {
-      drm_intel_bo_map(cache->bo, false);
+      brw_bo_map(brw, cache->bo, false, "program cache");
       drm_intel_bo_subdata(new_bo, 0, cache->next_offset, cache->bo->virtual);
       drm_intel_bo_unmap(cache->bo);
    }
@@ -200,6 +200,7 @@ brw_try_upload_using_copy(struct brw_cache *cache,
                          const void *data,
                          const void *aux)
 {
+   struct brw_context *brw = cache->brw;
    int i;
    struct brw_cache_item *item;
 
@@ -221,7 +222,7 @@ brw_try_upload_using_copy(struct brw_cache *cache,
            continue;
         }
 
-        drm_intel_bo_map(cache->bo, false);
+        brw_bo_map(brw, cache->bo, false, "program cache");
         ret = memcmp(cache->bo->virtual + item->offset, data, item->size);
         drm_intel_bo_unmap(cache->bo);
         if (ret)
@@ -241,6 +242,8 @@ brw_upload_item_data(struct brw_cache *cache,
                     struct brw_cache_item *item,
                     const void *data)
 {
+   struct brw_context *brw = cache->brw;
+
    /* Allocate space in the cache BO for our new program. */
    if (cache->next_offset + item->size > cache->bo->size) {
       uint32_t new_size = cache->bo->size * 2;
@@ -255,6 +258,7 @@ brw_upload_item_data(struct brw_cache *cache,
     * recreate it.
     */
    if (cache->bo_used_by_gpu) {
+      perf_debug("Copying busy program cache buffer.\n");
       brw_cache_new_bo(cache, cache->bo->size);
    }
 
-- 
2.1.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to