1 /* 2 * Copyright © 2024 Igalia S.L. 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef __FREEDRENO_RD_OUTPUT_H__ 7 #define __FREEDRENO_RD_OUTPUT_H__ 8 9 #include <stdbool.h> 10 #include <stdint.h> 11 #include <zlib.h> 12 13 #include "redump.h" 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 enum fd_rd_dump_flags { 20 FD_RD_DUMP_ENABLE = 1 << 0, 21 FD_RD_DUMP_COMBINE = 1 << 1, 22 FD_RD_DUMP_FULL = 1 << 2, 23 FD_RD_DUMP_TRIGGER = 1 << 3, 24 }; 25 26 struct fd_rd_dump_env { 27 uint32_t flags; 28 }; 29 30 extern struct fd_rd_dump_env fd_rd_dump_env; 31 32 #define FD_RD_DUMP(name) unlikely(fd_rd_dump_env.flags & FD_RD_DUMP_##name) 33 34 void 35 fd_rd_dump_env_init(void); 36 37 struct fd_rd_output { 38 char *name; 39 bool combine; 40 gzFile file; 41 42 int trigger_fd; 43 uint32_t trigger_count; 44 }; 45 46 void 47 fd_rd_output_init(struct fd_rd_output *output, const char* output_name); 48 49 void 50 fd_rd_output_fini(struct fd_rd_output *output); 51 52 bool 53 fd_rd_output_begin(struct fd_rd_output *output, uint32_t submit_idx); 54 55 void 56 fd_rd_output_write_section(struct fd_rd_output *output, enum rd_sect_type type, 57 const void *buffer, int size); 58 59 void 60 fd_rd_output_end(struct fd_rd_output *output); 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif /* __FREEDRENO_RD_OUTPUT_H__ */ 67