static void
vc4_bo_cache_free_all(struct vc4_bo_cache *cache);
+void
+vc4_bo_label(struct vc4_screen *screen, struct vc4_bo *bo, const char *fmt, ...)
+{
+ /* Perform BO labeling by default on debug builds (so that you get
+ * whole-system allocation information), or if VC4_DEBUG=surf is set
+ * (for debugging a single app's allocation).
+ */
+#ifndef DEBUG
+ if (!(VC4_DEBUG & VC4_DEBUG_SURFACE))
+ return;
+#endif
+ va_list va;
+ va_start(va, fmt);
+ char *name = ralloc_vasprintf(NULL, fmt, va);
+ va_end(va);
+
+ struct drm_vc4_label_bo label = {
+ .handle = bo->handle,
+ .len = strlen(name),
+ .name = (uintptr_t)name,
+ };
+ drmIoctl(screen->fd, DRM_IOCTL_VC4_LABEL_BO, &label);
+
+ ralloc_free(name);
+}
+
static void
vc4_bo_dump_stats(struct vc4_screen *screen)
{
pipe_reference_init(&bo->reference, 1);
vc4_bo_remove_from_cache(cache, bo);
+ vc4_bo_label(screen, bo, "%s", name);
bo->name = name;
}
mtx_unlock(&cache->lock);
vc4_bo_dump_stats(screen);
}
+ vc4_bo_label(screen, bo, "%s", name);
+
return bo;
}
vc4_bo_dump_stats(screen);
}
bo->name = NULL;
+ vc4_bo_label(screen, bo, "mesa cache");
free_stale_bos(screen, time);
}
vc4_wait_seqno(struct vc4_screen *screen, uint64_t seqno, uint64_t timeout_ns,
const char *reason);
+void
+vc4_bo_label(struct vc4_screen *screen, struct vc4_bo *bo, const char *fmt, ...);
+
void
vc4_bufmgr_destroy(struct pipe_screen *pscreen);
goto fail;
}
+ vc4_bo_label(screen, rsc->bo, "%sresource %dx%d@%d/%d",
+ (tmpl->bind & PIPE_BIND_SCANOUT) ? "scanout " : "",
+ tmpl->width0, tmpl->height0,
+ rsc->cpp * 8, prsc->last_level);
+
return prsc;
fail:
vc4_resource_destroy(pscreen, prsc);
return NULL;
}
rsc = vc4_resource(prsc);
+ vc4_bo_label(vc4_screen(pctx->screen), rsc->bo,
+ "tiling shadow %dx%d",
+ tmpl.width0, tmpl.height0);
/* Flag it as needing update of the contents from the parent. */
rsc->writes = shadow_parent->writes - 1;