mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-21 12:28:24 +02:00
panfrost: Separate the compiler from libpanfrost
Previously libpanfrost depended on the panfrost compiler, that was just used for the pan_disassemble function used to disassemble and print shaders. We'll need to add a dependency from kraid tests to libpanfrost and this made things harder due to meson shenanigans. This commit splits the dependency between libpanfrost and the compiler by adding the disassembler as a callback, so that the user can provide its own disassembler. Signed-off-by: Lorenzo Rossi <lorenzo.rossi@collabora.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42189>
This commit is contained in:
parent
7634b2da20
commit
323d32bb00
8 changed files with 29 additions and 4 deletions
|
|
@ -84,8 +84,10 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev)
|
|||
list_inithead(&dev->bo_cache.buckets[i]);
|
||||
|
||||
/* Initialize pandecode before we start allocating */
|
||||
if (dev->debug & (PAN_DBG_TRACE | PAN_DBG_SYNC))
|
||||
if (dev->debug & (PAN_DBG_TRACE | PAN_DBG_SYNC)) {
|
||||
dev->decode_ctx = pandecode_create_context(!(dev->debug & PAN_DBG_TRACE));
|
||||
pandecode_set_disassemble(dev->decode_ctx, pan_disassemble);
|
||||
}
|
||||
|
||||
/* Tiler heap is internally required by the tiler, which can only be
|
||||
* active for a single job chain at once, so a single heap can be
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ struct pandecode_context {
|
|||
int dump_frame_count;
|
||||
simple_mtx_t lock;
|
||||
|
||||
pandecode_shader_disassemble_cb dissassemble;
|
||||
|
||||
/* On CSF context, set to true if the root CS ring buffer
|
||||
* is managed in userspace. The blob does that, and mesa might use
|
||||
* usermode queues too at some point.
|
||||
|
|
|
|||
|
|
@ -485,6 +485,14 @@ pandecode_cs_trace(struct pandecode_context *ctx, uint64_t trace_gpu_va,
|
|||
simple_mtx_unlock(&ctx->lock);
|
||||
}
|
||||
|
||||
void
|
||||
pandecode_set_disassemble(struct pandecode_context *ctx,
|
||||
pandecode_shader_disassemble_cb cb)
|
||||
{
|
||||
assert(ctx->dissassemble == NULL && "pandecode_set_disassemble already called");
|
||||
ctx->dissassemble = cb;
|
||||
}
|
||||
|
||||
void
|
||||
pandecode_shader_disassemble(struct pandecode_context *ctx, uint64_t shader_ptr,
|
||||
uint64_t gpu_id)
|
||||
|
|
@ -503,7 +511,8 @@ pandecode_shader_disassemble(struct pandecode_context *ctx, uint64_t shader_ptr,
|
|||
code, shader_ptr, sz);
|
||||
|
||||
bool verbose = pan_arch(gpu_id) >= 6;
|
||||
pan_disassemble(ctx->dump_stream, code, sz, gpu_id, verbose);
|
||||
if (ctx->dissassemble)
|
||||
ctx->dissassemble(ctx->dump_stream, code, sz, gpu_id, verbose);
|
||||
|
||||
pandecode_log_cont(ctx, "\n\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ libpanfrost_lib = static_library(
|
|||
)
|
||||
|
||||
libpanfrost_dep = declare_dependency(
|
||||
link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_compiler, libpanfrost_pixel_format, libpanfrost_per_arch],
|
||||
link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_pixel_format, libpanfrost_per_arch],
|
||||
include_directories: [inc_include, inc_src, inc_panfrost],
|
||||
dependencies: [deps_for_libpanfrost, libpankmod_dep, idep_nir],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,12 +24,19 @@
|
|||
|
||||
// TODO: update panwrap
|
||||
|
||||
typedef void (*pandecode_shader_disassemble_cb)(FILE *fp, const void *code,
|
||||
size_t size, uint64_t gpu_id,
|
||||
bool verbose);
|
||||
|
||||
struct pandecode_context;
|
||||
|
||||
struct pandecode_context *pandecode_create_context(bool to_stderr);
|
||||
|
||||
void pandecode_next_frame(struct pandecode_context *ctx);
|
||||
|
||||
void pandecode_set_disassemble(struct pandecode_context *ctx,
|
||||
pandecode_shader_disassemble_cb cb);
|
||||
|
||||
void pandecode_destroy_context(struct pandecode_context *ctx);
|
||||
|
||||
void pandecode_inject_mmap(struct pandecode_context *ctx, uint64_t gpu_va,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ coredumpdec = executable(
|
|||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src],
|
||||
dependencies: [libpanfrost_dep],
|
||||
link_with: [libpanfrost_compiler],
|
||||
build_by_default : true,
|
||||
install: true
|
||||
)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <drm-uapi/panfrost_drm.h>
|
||||
|
||||
#include "decode.h"
|
||||
#include "pan_compiler.h"
|
||||
|
||||
/* Same as panfrost_dump_object_header, but with field
|
||||
* entries in host byte order
|
||||
|
|
@ -236,6 +237,7 @@ main(int argc, char *argv[])
|
|||
|
||||
atexit(cleanup);
|
||||
struct pandecode_context *ctx = pandecode_create_context(false);
|
||||
pandecode_set_disassemble(ctx, pan_disassemble);
|
||||
|
||||
hdr_fp = fopen(argv[optind], "r");
|
||||
if (!hdr_fp) {
|
||||
|
|
|
|||
|
|
@ -405,8 +405,10 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device,
|
|||
goto err_finish_dev;
|
||||
}
|
||||
|
||||
if (PANVK_DEBUG(TRACE) || PANVK_DEBUG(SYNC) || PANVK_DEBUG(DUMP))
|
||||
if (PANVK_DEBUG(TRACE) || PANVK_DEBUG(SYNC) || PANVK_DEBUG(DUMP)) {
|
||||
device->debug.decode_ctx = pandecode_create_context(false);
|
||||
pandecode_set_disassemble(device->debug.decode_ctx, pan_disassemble);
|
||||
}
|
||||
|
||||
/* 48bit address space clamped by the physical device limits, with the lower
|
||||
* 32MB reserved. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue