• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2016-2018 Broadcom
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef CLIF_PRIVATE_H
25 #define CLIF_PRIVATE_H
26 
27 #include <stdint.h>
28 #include <stdarg.h>
29 #include "util/list.h"
30 
31 struct clif_dump {
32         const struct v3d_device_info *devinfo;
33         bool (*lookup_vaddr)(void *data, uint32_t addr, void **vaddr);
34         FILE *out;
35         /* Opaque data from the caller that is passed to the callbacks. */
36         void *data;
37 
38         struct v3d_spec *spec;
39 
40         /* List of struct reloc_worklist_entry */
41         struct list_head worklist;
42 };
43 
44 enum reloc_worklist_type {
45         reloc_gl_shader_state,
46         reloc_generic_tile_list,
47 };
48 
49 struct reloc_worklist_entry {
50         struct list_head link;
51 
52         enum reloc_worklist_type type;
53         uint32_t addr;
54 
55         union {
56                 struct {
57                         uint32_t num_attrs;
58                 } shader_state;
59                 struct {
60                         uint32_t end;
61                 } generic_tile_list;
62         };
63 };
64 
65 struct reloc_worklist_entry *
66 clif_dump_add_address_to_worklist(struct clif_dump *clif,
67                                   enum reloc_worklist_type type,
68                                   uint32_t addr);
69 
70 bool v3d33_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
71                             const uint8_t *cl, uint32_t *size);
72 void v3d33_clif_dump_gl_shader_state_record(struct clif_dump *clif,
73                                             struct reloc_worklist_entry *reloc,
74                                             void *vaddr);
75 bool v3d41_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
76                             const uint8_t *cl, uint32_t *size);
77 void v3d41_clif_dump_gl_shader_state_record(struct clif_dump *clif,
78                                             struct reloc_worklist_entry *reloc,
79                                             void *vaddr);
80 
81 static inline void
out(struct clif_dump * clif,const char * fmt,...)82 out(struct clif_dump *clif, const char *fmt, ...)
83 {
84         va_list args;
85 
86         va_start(args, fmt);
87         vfprintf(clif->out, fmt, args);
88         va_end(args);
89 }
90 
91 #endif /* CLIF_PRIVATE_H */
92