19f464c52Smaya/*
29f464c52Smaya * Copyright (C) 2018-2019 Lima Project
39f464c52Smaya *
49f464c52Smaya * Permission is hereby granted, free of charge, to any person obtaining a
59f464c52Smaya * copy of this software and associated documentation files (the "Software"),
69f464c52Smaya * to deal in the Software without restriction, including without limitation
79f464c52Smaya * the rights to use, copy, modify, merge, publish, distribute, sublicense,
89f464c52Smaya * and/or sell copies of the Software, and to permit persons to whom the
99f464c52Smaya * Software is furnished to do so, subject to the following conditions:
109f464c52Smaya *
119f464c52Smaya * The above copyright notice and this permission notice shall be included in
129f464c52Smaya * all copies or substantial portions of the Software.
139f464c52Smaya *
149f464c52Smaya * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
159f464c52Smaya * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
169f464c52Smaya * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
179f464c52Smaya * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
189f464c52Smaya * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
199f464c52Smaya * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
209f464c52Smaya * OTHER DEALINGS IN THE SOFTWARE.
219f464c52Smaya *
229f464c52Smaya */
239f464c52Smaya
249f464c52Smaya#ifndef H_LIMA_UTIL
259f464c52Smaya#define H_LIMA_UTIL
269f464c52Smaya
279f464c52Smaya#include <stdint.h>
289f464c52Smaya#include <stdbool.h>
299f464c52Smaya
309f464c52Smaya#define LIMA_PAGE_SIZE 4096
319f464c52Smaya
327ec681f3Smrgstruct lima_dump;
337ec681f3Smrg
349f464c52Smayabool lima_get_absolute_timeout(uint64_t *timeout);
357ec681f3Smrg
367ec681f3Smrgstruct lima_dump *lima_dump_create(void);
377ec681f3Smrgstruct lima_dump *lima_dump_next(struct lima_dump *dump);
387ec681f3Smrgvoid lima_dump_free(struct lima_dump *dump);
397ec681f3Smrg
407ec681f3Smrgvoid lima_dump_shader(struct lima_dump *dump, void *data, int size, bool is_frag);
417ec681f3Smrgvoid lima_dump_vs_command_stream_print(struct lima_dump *dump, void *data,
427ec681f3Smrg                                       int size, uint32_t start);
437ec681f3Smrgvoid lima_dump_plbu_command_stream_print(struct lima_dump *dump, void *data,
447ec681f3Smrg                                         int size, uint32_t start);
457ec681f3Smrgvoid lima_dump_rsw_command_stream_print(struct lima_dump *dump, void *data,
467ec681f3Smrg                                        int size, uint32_t start);
477ec681f3Smrgvoid lima_dump_texture_descriptor(struct lima_dump *dump, void *data,
487ec681f3Smrg                                  int size, uint32_t start, uint32_t offset);
497ec681f3Smrg
507ec681f3Smrgvoid _lima_dump_command_stream_print(struct lima_dump *dump, void *data,
517ec681f3Smrg                                     int size, bool is_float, const char *fmt, ...);
527ec681f3Smrg#define lima_dump_command_stream_print(dump, ...) \
537ec681f3Smrg   do { \
547ec681f3Smrg      if (dump) \
557ec681f3Smrg         _lima_dump_command_stream_print(dump, __VA_ARGS__); \
567ec681f3Smrg   } while (0)
579f464c52Smaya
589f464c52Smaya#endif
59