Path: blob/21.2-virgl/src/gallium/drivers/vc4/vc4_screen.h
4570 views
/*1* Copyright © 2014 Broadcom2*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, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef VC4_SCREEN_H24#define VC4_SCREEN_H2526#include "pipe/p_screen.h"27#include "renderonly/renderonly.h"28#include "os/os_thread.h"29#include "frontend/drm_driver.h"30#include "util/list.h"31#include "util/slab.h"3233#ifndef DRM_VC4_PARAM_SUPPORTS_ETC134#define DRM_VC4_PARAM_SUPPORTS_ETC1 435#endif3637struct vc4_bo;3839#define VC4_DEBUG_CL 0x000140#define VC4_DEBUG_QPU 0x000241#define VC4_DEBUG_QIR 0x000442#define VC4_DEBUG_TGSI 0x000843#define VC4_DEBUG_SHADERDB 0x001044#define VC4_DEBUG_PERF 0x002045#define VC4_DEBUG_NORAST 0x004046#define VC4_DEBUG_ALWAYS_FLUSH 0x008047#define VC4_DEBUG_ALWAYS_SYNC 0x010048#define VC4_DEBUG_NIR 0x020049#define VC4_DEBUG_DUMP 0x040050#define VC4_DEBUG_SURFACE 0x08005152#define VC4_MAX_MIP_LEVELS 1253#define VC4_MAX_TEXTURE_SAMPLERS 165455struct vc4_simulator_file;5657struct vc4_screen {58struct pipe_screen base;59struct renderonly *ro;6061int fd;6263int v3d_ver;6465const char *name;6667/** The last seqno we've completed a wait for.68*69* This lets us slightly optimize our waits by skipping wait syscalls70* if we know the job's already done.71*/72uint64_t finished_seqno;7374struct slab_parent_pool transfer_pool;7576struct vc4_bo_cache {77/** List of struct vc4_bo freed, by age. */78struct list_head time_list;79/** List of struct vc4_bo freed, per size, by age. */80struct list_head *size_list;81uint32_t size_list_size;8283mtx_t lock;8485uint32_t bo_size;86uint32_t bo_count;87} bo_cache;8889struct hash_table *bo_handles;90mtx_t bo_handles_mutex;9192uint32_t bo_size;93uint32_t bo_count;94bool has_control_flow;95bool has_etc1;96bool has_threaded_fs;97bool has_madvise;98bool has_tiling_ioctl;99bool has_perfmon_ioctl;100bool has_syncobj;101102struct vc4_simulator_file *sim_file;103};104105static inline struct vc4_screen *106vc4_screen(struct pipe_screen *screen)107{108return (struct vc4_screen *)screen;109}110111struct pipe_screen *vc4_screen_create(int fd, struct renderonly *ro);112113const void *114vc4_screen_get_compiler_options(struct pipe_screen *pscreen,115enum pipe_shader_ir ir,116enum pipe_shader_type shader);117118extern uint32_t vc4_debug;119120void121vc4_fence_screen_init(struct vc4_screen *screen);122123struct vc4_fence *124vc4_fence_create(struct vc4_screen *screen, uint64_t seqno, int fd);125126#endif /* VC4_SCREEN_H */127128129