mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
pan/bit: Open up the device
As a start and a sanity check. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4382>
This commit is contained in:
parent
39378eec57
commit
bf1929e479
4 changed files with 31 additions and 0 deletions
|
|
@ -30,6 +30,7 @@
|
||||||
#include "compiler/nir_types.h"
|
#include "compiler/nir_types.h"
|
||||||
#include "util/u_dynarray.h"
|
#include "util/u_dynarray.h"
|
||||||
#include "bifrost_compile.h"
|
#include "bifrost_compile.h"
|
||||||
|
#include "test/bit.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compile_shader(char **argv)
|
compile_shader(char **argv)
|
||||||
|
|
@ -91,6 +92,13 @@ disassemble(const char *filename)
|
||||||
free(code);
|
free(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test(void)
|
||||||
|
{
|
||||||
|
void *memctx = NULL; /* TODO */
|
||||||
|
bit_initialize(memctx);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
@ -103,6 +111,8 @@ main(int argc, char **argv)
|
||||||
compile_shader(&argv[2]);
|
compile_shader(&argv[2]);
|
||||||
else if (strcmp(argv[1], "disasm") == 0)
|
else if (strcmp(argv[1], "disasm") == 0)
|
||||||
disassemble(argv[2]);
|
disassemble(argv[2]);
|
||||||
|
else if (strcmp(argv[1], "test") == 0)
|
||||||
|
test();
|
||||||
else
|
else
|
||||||
unreachable("Unknown command. Valid: compile/disasm");
|
unreachable("Unknown command. Valid: compile/disasm");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,3 +37,20 @@ bit_bo_create(struct panfrost_device *dev, size_t size)
|
||||||
pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
|
pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
|
||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct panfrost_device *
|
||||||
|
bit_initialize(void *memctx)
|
||||||
|
{
|
||||||
|
int fd = drmOpenWithType("panfrost", NULL, DRM_NODE_RENDER);
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
unreachable("No panfrost device found. Try chmod?");
|
||||||
|
|
||||||
|
struct panfrost_device *dev = rzalloc(memctx, struct panfrost_device);
|
||||||
|
panfrost_open_device(memctx, fd, dev);
|
||||||
|
|
||||||
|
pandecode_initialize(true);
|
||||||
|
printf("%X\n", dev->gpu_id);
|
||||||
|
|
||||||
|
return dev;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@
|
||||||
#include "panfrost/encoder/pan_device.h"
|
#include "panfrost/encoder/pan_device.h"
|
||||||
#include "panfrost/encoder/pan_bo.h"
|
#include "panfrost/encoder/pan_bo.h"
|
||||||
|
|
||||||
|
struct panfrost_device *
|
||||||
|
bit_initialize(void *memctx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ bifrost_compiler = executable(
|
||||||
libpanfrost_bifrost,
|
libpanfrost_bifrost,
|
||||||
libpanfrost_decode,
|
libpanfrost_decode,
|
||||||
libpanfrost_encoder,
|
libpanfrost_encoder,
|
||||||
|
libpanfrost_midgard, # references disassemble_midgard...
|
||||||
],
|
],
|
||||||
build_by_default : true
|
build_by_default : true
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue