1 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */ 2 3 /* 4 * Copyright © 2014 Rob Clark <[email protected]> 5 * SPDX-License-Identifier: MIT 6 * 7 * Authors: 8 * Rob Clark <[email protected]> 9 */ 10 11 #ifndef SCRIPT_H_ 12 #define SCRIPT_H_ 13 14 #include <stdint.h> 15 16 // XXX make script support optional 17 #define ENABLE_SCRIPTING 1 18 19 #ifdef ENABLE_SCRIPTING 20 21 /* called at start to load the script: */ 22 int script_load(const char *file); 23 24 /* called at start of each cmdstream file: */ 25 void script_start_cmdstream(const char *name); 26 27 /* called at each DRAW_INDX, calls script drawidx fxn to process 28 * the current state 29 */ 30 __attribute__((weak)) 31 void script_draw(const char *primtype, uint32_t nindx); 32 33 struct rnn; 34 struct rnndomain; 35 __attribute__((weak)) 36 void script_packet(uint32_t *dwords, uint32_t sizedwords, 37 struct rnn *rnn, 38 struct rnndomain *dom); 39 40 /* maybe at some point it is interesting to add additional script 41 * hooks for CP_EVENT_WRITE, etc? 42 */ 43 44 /* called at end of each cmdstream file: */ 45 void script_end_cmdstream(void); 46 47 void script_start_submit(void); 48 void script_end_submit(void); 49 50 /* called after last cmdstream file: */ 51 void script_finish(void); 52 53 #else 54 // TODO no-op stubs.. 55 #endif 56 57 #endif /* SCRIPT_H_ */ 58