Path: blob/21.2-virgl/src/freedreno/decode/cffdec.h
4565 views
/*1* Copyright (c) 2012 Rob Clark <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*/2223#ifndef __CFFDEC_H__24#define __CFFDEC_H__2526#include <stdbool.h>2728enum query_mode {29/* default mode, dump all queried regs on each draw: */30QUERY_ALL = 0,3132/* only dump if any of the queried regs were written33* since last draw:34*/35QUERY_WRITTEN,3637/* only dump if any of the queried regs changed since38* last draw:39*/40QUERY_DELTA,41};4243struct cffdec_options {44unsigned gpu_id;45int draw_filter;46int color;47int dump_shaders;48int summary;49int allregs;50int dump_textures;51int decode_markers;52char *script;5354int query_compare; /* binning vs SYSMEM/GMEM compare mode */55int query_mode; /* enum query_mode */56char **querystrs;57int nquery;5859/* In "once" mode, only decode a cmdstream buffer once (per draw60* mode, in the case of a6xx+ where a single cmdstream buffer can61* be used for both binning and draw pass), rather than each time62* encountered (ie. once per tile/bin in GMEM draw passes)63*/64int once;6566/* for crashdec, where we know CP_IBx_REM_SIZE, we can use this67* to highlight the cmdstream not parsed yet, to make it easier68* to see how far along the CP is.69*/70struct {71uint64_t base;72uint32_t rem;73} ibs[4];74};7576void printl(int lvl, const char *fmt, ...);77const char *pktname(unsigned opc);78uint32_t regbase(const char *name);79const char *regname(uint32_t regbase, int color);80bool reg_written(uint32_t regbase);81uint32_t reg_lastval(uint32_t regbase);82uint32_t reg_val(uint32_t regbase);83void reg_set(uint32_t regbase, uint32_t val);84void reset_regs(void);85void cffdec_init(const struct cffdec_options *options);86void dump_register_val(uint32_t regbase, uint32_t dword, int level);87void dump_commands(uint32_t *dwords, uint32_t sizedwords, int level);8889#endif /* __CFFDEC_H__ */909192