}
struct fd_bo *
-fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
+_fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags)
{
struct fd_bo *bo = bo_new(dev, size, flags, &dev->bo_cache);
if (bo)
return bo;
}
+void
+_fd_bo_set_name(struct fd_bo *bo, const char *fmt, va_list ap)
+{
+ bo->funcs->set_name(bo, fmt, ap);
+}
+
/* internal function to allocate bo's that use the ringbuffer cache
* instead of the normal bo_cache. The purpose is, because cmdstream
* bo's get vmap'd on the kernel side, and that is expensive, we want
struct fd_bo *bo = bo_new(dev, size, flags, &dev->ring_cache);
if (bo)
bo->bo_reuse = RING_CACHE;
+ fd_bo_set_name(bo, "cmdstream");
return bo;
}
#include <stdint.h>
+#include "util/u_debug.h"
+
struct fd_bo;
struct fd_pipe;
struct fd_device;
/* buffer-object functions:
*/
-struct fd_bo * fd_bo_new(struct fd_device *dev,
+struct fd_bo * _fd_bo_new(struct fd_device *dev,
uint32_t size, uint32_t flags);
+void _fd_bo_set_name(struct fd_bo *bo, const char *fmt, va_list ap);
+
+static inline void
+fd_bo_set_name(struct fd_bo *bo, const char *fmt, ...) _util_printf_format(2, 3);
+
+static inline void
+fd_bo_set_name(struct fd_bo *bo, const char *fmt, ...)
+{
+#ifndef NDEBUG
+ va_list ap;
+ va_start(ap, fmt);
+ _fd_bo_set_name(bo, fmt, ap);
+ va_end(ap);
+#endif
+}
+
+static inline struct fd_bo *
+fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags,
+ const char *fmt, ...) _util_printf_format(4, 5);
+
+static inline struct fd_bo *
+fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags,
+ const char *fmt, ...)
+{
+ struct fd_bo *bo = _fd_bo_new(dev, size, flags);
+#ifndef NDEBUG
+ if (fmt) {
+ va_list ap;
+ va_start(ap, fmt);
+ _fd_bo_set_name(bo, fmt, ap);
+ va_end(ap);
+ }
+#endif
+ return bo;
+}
+
struct fd_bo *fd_bo_from_handle(struct fd_device *dev,
uint32_t handle, uint32_t size);
struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name);
void (*cpu_fini)(struct fd_bo *bo);
int (*madvise)(struct fd_bo *bo, int willneed);
uint64_t (*iova)(struct fd_bo *bo);
+ void (*set_name)(struct fd_bo *bo, const char *fmt, va_list ap);
void (*destroy)(struct fd_bo *bo);
};
return req.value;
}
+static void msm_bo_set_name(struct fd_bo *bo, const char *fmt, va_list ap)
+{
+ struct drm_msm_gem_info req = {
+ .handle = bo->handle,
+ .info = MSM_INFO_SET_NAME,
+ };
+ char buf[32];
+ int sz;
+
+ if (bo->dev->version < FD_VERSION_SOFTPIN)
+ return;
+
+ sz = vsnprintf(buf, sizeof(buf), fmt, ap);
+
+ req.value = VOID2U64(buf);
+ req.len = MIN2(sz, sizeof(buf));
+
+ drmCommandWrite(bo->dev->fd, DRM_MSM_GEM_INFO, &req, sizeof(req));
+}
+
static void msm_bo_destroy(struct fd_bo *bo)
{
struct msm_bo *msm_bo = to_msm_bo(bo);
free(msm_bo);
-
}
static const struct fd_bo_funcs funcs = {
.cpu_fini = msm_bo_cpu_fini,
.madvise = msm_bo_madvise,
.iova = msm_bo_iova,
+ .set_name = msm_bo_set_name,
.destroy = msm_bo_destroy,
};
assemble_variant(struct ir3_shader_variant *v)
{
struct ir3_compiler *compiler = v->shader->compiler;
+ struct shader_info *info = &v->shader->nir->info;
uint32_t gpu_id = compiler->gpu_id;
uint32_t sz, *bin;
v->bo = fd_bo_new(compiler->dev, sz,
DRM_FREEDRENO_GEM_CACHE_WCOMBINE |
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM,
+ "%s:%s", ir3_shader_stage(v->shader), info->name);
memcpy(fd_bo_map(v->bo), bin, sz);
fd_hw_query_init(pctx);
fd3_ctx->vs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vs_pvt");
fd3_ctx->fs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "fs_pvt");
fd3_ctx->vsc_size_mem = fd_bo_new(screen->dev, 0x1000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_size");
fd_context_setup_common_vbos(&fd3_ctx->base);
if (!pipe->bo) {
pipe->bo = fd_bo_new(ctx->dev, 0x40000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_pipe[%u]", i);
}
OUT_PKT0(ring, REG_A3XX_VSC_PIPE(i), 3);
fd_hw_query_init(pctx);
fd4_ctx->vs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vs_pvt");
fd4_ctx->fs_pvt_mem = fd_bo_new(screen->dev, 0x2000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "fs_pvt");
fd4_ctx->vsc_size_mem = fd_bo_new(screen->dev, 0x1000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_size");
fd_context_setup_common_vbos(&fd4_ctx->base);
struct fd_vsc_pipe *pipe = &ctx->vsc_pipe[i];
if (!pipe->bo) {
pipe->bo = fd_bo_new(ctx->dev, 0x40000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_pipe[%u]", i);
}
OUT_RELOCW(ring, pipe->bo, 0, 0, 0); /* VSC_PIPE_DATA_ADDRESS[i] */
}
util_blitter_set_texture_multisample(fd5_ctx->base.blitter, true);
fd5_ctx->vsc_size_mem = fd_bo_new(screen->dev, 0x1000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_size");
fd5_ctx->blit_mem = fd_bo_new(screen->dev, 0x1000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "blit");
fd_context_setup_common_vbos(&fd5_ctx->base);
struct fd_vsc_pipe *pipe = &ctx->vsc_pipe[i];
if (!pipe->bo) {
pipe->bo = fd_bo_new(ctx->dev, 0x20000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_pipe[%u]", i);
}
OUT_RELOCW(ring, pipe->bo, 0, 0, 0); /* VSC_PIPE_DATA_ADDRESS[i].LO/HI */
}
fd6_ctx->vsc_data = fd_bo_new(screen->dev,
(A6XX_VSC_DATA_PITCH * 32) + 0x100,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_data");
fd6_ctx->vsc_data2 = fd_bo_new(screen->dev,
A6XX_VSC_DATA2_PITCH * 32,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "vsc_data2");
fd6_ctx->blit_mem = fd_bo_new(screen->dev, 0x1000,
- DRM_FREEDRENO_GEM_TYPE_KMEM);
+ DRM_FREEDRENO_GEM_TYPE_KMEM, "blit");
fd_context_setup_common_vbos(&fd6_ctx->base);
static void
realloc_bo(struct fd_resource *rsc, uint32_t size)
{
+ struct pipe_resource *prsc = &rsc->base;
struct fd_screen *screen = fd_screen(rsc->base.screen);
uint32_t flags = DRM_FREEDRENO_GEM_CACHE_WCOMBINE |
DRM_FREEDRENO_GEM_TYPE_KMEM |
- COND(rsc->base.bind & PIPE_BIND_SCANOUT, DRM_FREEDRENO_GEM_SCANOUT);
+ COND(prsc->bind & PIPE_BIND_SCANOUT, DRM_FREEDRENO_GEM_SCANOUT);
/* TODO other flags? */
/* if we start using things other than write-combine,
if (rsc->bo)
fd_bo_del(rsc->bo);
- rsc->bo = fd_bo_new(screen->dev, size, flags);
+ rsc->bo = fd_bo_new(screen->dev, size, flags, "%ux%ux%u@%u:%x",
+ prsc->width0, prsc->height0, prsc->depth0, rsc->cpp, prsc->bind);
rsc->seqno = p_atomic_inc_return(&screen->rsc_seqno);
util_range_set_empty(&rsc->valid_buffer_range);
fd_bc_invalidate_resource(rsc, true);
rsc->lrz_height = lrz_height;
rsc->lrz_width = lrz_pitch;
rsc->lrz_pitch = lrz_pitch;
- rsc->lrz = fd_bo_new(screen->dev, size, flags);
+ rsc->lrz = fd_bo_new(screen->dev, size, flags, "lrz");
}
size = screen->setup_slices(rsc);