Path: blob/21.2-virgl/src/freedreno/computerator/main.h
4564 views
/*1* Copyright © 2020 Google, Inc.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 __MAIN_H__24#define __MAIN_H__2526#include <err.h>27#include <stdint.h>28#include <stdio.h>2930#include "drm/freedreno_drmif.h"31#include "drm/freedreno_ringbuffer.h"3233#include "adreno_common.xml.h"34#include "adreno_pm4.xml.h"3536#define MAX_BUFS 43738struct kernel {39/* filled in by backend when shader is assembled: */40uint32_t local_size[3];41uint32_t num_bufs;42uint32_t buf_sizes[MAX_BUFS]; /* size in dwords */43uint32_t buf_addr_regs[MAX_BUFS];4445/* filled in by frontend before launching grid: */46struct fd_bo *bufs[MAX_BUFS];47};4849struct perfcntr {50const char *name;5152/* for backend to configure/read the counter, describes53* the selected counter:54*/55unsigned select_reg;56unsigned counter_reg_lo;57unsigned counter_reg_hi;58/* and selected countable:59*/60unsigned selector;61};6263/* per-generation entry-points: */64struct backend {65struct kernel *(*assemble)(struct backend *b, FILE *in);66void (*disassemble)(struct kernel *kernel, FILE *out);67void (*emit_grid)(struct kernel *kernel, uint32_t grid[3],68struct fd_submit *submit);6970/* performance-counter API: */71void (*set_perfcntrs)(struct backend *b, const struct perfcntr *perfcntrs,72unsigned num_perfcntrs);73void (*read_perfcntrs)(struct backend *b, uint64_t *results);74};7576#define define_cast(_from, _to) \77static inline struct _to *to_##_to(struct _from *f) \78{ \79return (struct _to *)f; \80}8182struct backend *a6xx_init(struct fd_device *dev, uint32_t gpu_id);8384/* for conditionally setting boolean flag(s): */85#define COND(bool, val) ((bool) ? (val) : 0)8687#endif /* __MAIN_H__ */888990