xref: /aosp_15_r20/external/mesa3d/src/asahi/lib/decode.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2017-2019 Lyude Paul
3  * Copyright 2017-2019 Alyssa Rosenzweig
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 
10 #include <sys/types.h>
11 #include "agx_bo.h"
12 
13 #include "unstable_asahi_drm.h"
14 
15 struct agxdecode_ctx;
16 
17 struct agxdecode_ctx *agxdecode_new_context(uint64_t shader_base);
18 
19 void agxdecode_destroy_context(struct agxdecode_ctx *ctx);
20 
21 void agxdecode_next_frame(void);
22 
23 void agxdecode_close(void);
24 
25 void agxdecode_cmdstream(struct agxdecode_ctx *ctx, unsigned cmdbuf_index,
26                          unsigned map_index, bool verbose);
27 
28 void agxdecode_image_heap(struct agxdecode_ctx *ctx, uint64_t heap,
29                           unsigned nr_entries);
30 
31 void agxdecode_drm_cmd_render(struct agxdecode_ctx *ctx,
32                               struct drm_asahi_params_global *params,
33                               struct drm_asahi_cmd_render *cmdbuf,
34                               bool verbose);
35 
36 void agxdecode_drm_cmd_compute(struct agxdecode_ctx *ctx,
37                                struct drm_asahi_params_global *params,
38                                struct drm_asahi_cmd_compute *cmdbuf,
39                                bool verbose);
40 
41 void agxdecode_dump_file_open(void);
42 
43 void agxdecode_track_alloc(struct agxdecode_ctx *ctx, struct agx_bo *alloc);
44 
45 void agxdecode_track_free(struct agxdecode_ctx *ctx, struct agx_bo *bo);
46 
47 struct libagxdecode_config {
48    uint32_t chip_id;
49    size_t (*read_gpu_mem)(uint64_t addr, size_t size, void *data);
50    ssize_t (*stream_write)(const char *buffer, size_t size);
51 };
52 
53 void libagxdecode_init(struct libagxdecode_config *config);
54 void libagxdecode_vdm(struct agxdecode_ctx *ctx, uint64_t addr,
55                       const char *label, bool verbose);
56 void libagxdecode_cdm(struct agxdecode_ctx *ctx, uint64_t addr,
57                       const char *label, bool verbose);
58 void libagxdecode_usc(struct agxdecode_ctx *ctx, uint64_t addr,
59                       const char *label, bool verbose);
60 void libagxdecode_shutdown(void);
61