17ec681f3Smrg/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
27ec681f3Smrg
37ec681f3Smrg/*
47ec681f3Smrg * Copyright (C) 2014 Rob Clark <robclark@freedesktop.org>
57ec681f3Smrg *
67ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
77ec681f3Smrg * copy of this software and associated documentation files (the "Software"),
87ec681f3Smrg * to deal in the Software without restriction, including without limitation
97ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
107ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the
117ec681f3Smrg * Software is furnished to do so, subject to the following conditions:
127ec681f3Smrg *
137ec681f3Smrg * The above copyright notice and this permission notice (including the next
147ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the
157ec681f3Smrg * Software.
167ec681f3Smrg *
177ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
187ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
197ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
207ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
217ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
227ec681f3Smrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
237ec681f3Smrg * SOFTWARE.
247ec681f3Smrg *
257ec681f3Smrg * Authors:
267ec681f3Smrg *    Rob Clark <robclark@freedesktop.org>
277ec681f3Smrg */
287ec681f3Smrg
297ec681f3Smrg#ifndef SCRIPT_H_
307ec681f3Smrg#define SCRIPT_H_
317ec681f3Smrg
327ec681f3Smrg#include <stdint.h>
337ec681f3Smrg
347ec681f3Smrg// XXX make script support optional
357ec681f3Smrg#define ENABLE_SCRIPTING 1
367ec681f3Smrg
377ec681f3Smrg#ifdef ENABLE_SCRIPTING
387ec681f3Smrg
397ec681f3Smrg/* called at start to load the script: */
407ec681f3Smrgint script_load(const char *file);
417ec681f3Smrg
427ec681f3Smrg/* called at start of each cmdstream file: */
437ec681f3Smrgvoid script_start_cmdstream(const char *name);
447ec681f3Smrg
457ec681f3Smrg/* called at each DRAW_INDX, calls script drawidx fxn to process
467ec681f3Smrg * the current state
477ec681f3Smrg */
487ec681f3Smrg__attribute__((weak))
497ec681f3Smrgvoid script_draw(const char *primtype, uint32_t nindx);
507ec681f3Smrg
517ec681f3Smrgstruct rnn;
527ec681f3Smrgstruct rnndomain;
537ec681f3Smrg__attribute__((weak))
547ec681f3Smrgvoid script_packet(uint32_t *dwords, uint32_t sizedwords,
557ec681f3Smrg                   struct rnn *rnn,
567ec681f3Smrg                   struct rnndomain *dom);
577ec681f3Smrg
587ec681f3Smrg/* maybe at some point it is interesting to add additional script
597ec681f3Smrg * hooks for CP_EVENT_WRITE, etc?
607ec681f3Smrg */
617ec681f3Smrg
627ec681f3Smrg/* called at end of each cmdstream file: */
637ec681f3Smrgvoid script_end_cmdstream(void);
647ec681f3Smrg
657ec681f3Smrgvoid script_start_submit(void);
667ec681f3Smrgvoid script_end_submit(void);
677ec681f3Smrg
687ec681f3Smrg/* called after last cmdstream file: */
697ec681f3Smrgvoid script_finish(void);
707ec681f3Smrg
717ec681f3Smrg#else
727ec681f3Smrg// TODO no-op stubs..
737ec681f3Smrg#endif
747ec681f3Smrg
757ec681f3Smrg#endif /* SCRIPT_H_ */
76