Path: blob/21.2-virgl/src/freedreno/decode/redump.h
4565 views
/*1* Copyright © 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 REDUMP_H_24#define REDUMP_H_2526enum rd_sect_type {27RD_NONE,28RD_TEST, /* ascii text */29RD_CMD, /* ascii text */30RD_GPUADDR, /* u32 gpuaddr, u32 size */31RD_CONTEXT, /* raw dump */32RD_CMDSTREAM, /* raw dump */33RD_CMDSTREAM_ADDR, /* gpu addr of cmdstream */34RD_PARAM, /* u32 param_type, u32 param_val, u32 bitlen */35RD_FLUSH, /* empty, clear previous params */36RD_PROGRAM, /* shader program, raw dump */37RD_VERT_SHADER,38RD_FRAG_SHADER,39RD_BUFFER_CONTENTS,40RD_GPU_ID,41};4243/* RD_PARAM types: */44enum rd_param_type {45RD_PARAM_SURFACE_WIDTH,46RD_PARAM_SURFACE_HEIGHT,47RD_PARAM_SURFACE_PITCH,48RD_PARAM_COLOR,49RD_PARAM_BLIT_X,50RD_PARAM_BLIT_Y,51RD_PARAM_BLIT_WIDTH,52RD_PARAM_BLIT_HEIGHT,53RD_PARAM_BLIT_X2, /* BLIT_X + BLIT_WIDTH */54RD_PARAM_BLIT_Y2, /* BLIT_Y + BLIT_WIDTH */55};5657void rd_start(const char *name, const char *fmt, ...) __attribute__((weak));58void rd_end(void) __attribute__((weak));59void rd_write_section(enum rd_sect_type type, const void *buf, int sz)60__attribute__((weak));6162/* for code that should run with and without libwrap, use the following63* macros which check if the fxns are present before calling64*/65#define RD_START(n, f, ...) \66do { \67if (rd_start) \68rd_start(n, f, ##__VA_ARGS__); \69} while (0)70#define RD_END() \71do { \72if (rd_end) \73rd_end(); \74} while (0)75#define RD_WRITE_SECTION(t, b, s) \76do { \77if (rd_write_section) \78rd_write_section(t, b, s); \79} while (0)8081#ifndef ARRAY_SIZE82#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))83#endif84#undef ALIGN85#define ALIGN(v, a) (((v) + (a)-1) & ~((a)-1))8687#define min(a, b) (((a) < (b)) ? (a) : (b))88#define max(a, b) (((a) > (b)) ? (a) : (b))8990#endif /* REDUMP_H_ */919293