Path: blob/21.2-virgl/src/gallium/drivers/v3d/v3d_screen.h
4570 views
/*1* Copyright © 2014-2017 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 V3D_SCREEN_H24#define V3D_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"32#include "broadcom/common/v3d_debug.h"33#include "broadcom/common/v3d_device_info.h"3435struct v3d_bo;3637/* These are tunable parameters in the HW design, but all the V3D38* implementations agree.39*/40#define V3D_UIFCFG_BANKS 841#define V3D_UIFCFG_PAGE_SIZE 409642#define V3D_UIFCFG_XOR_VALUE (1 << 4)43#define V3D_PAGE_CACHE_SIZE (V3D_UIFCFG_PAGE_SIZE * V3D_UIFCFG_BANKS)44#define V3D_UBLOCK_SIZE 6445#define V3D_UIFBLOCK_SIZE (4 * V3D_UBLOCK_SIZE)46#define V3D_UIFBLOCK_ROW_SIZE (4 * V3D_UIFBLOCK_SIZE)4748struct v3d_simulator_file;4950struct v3d_screen {51struct pipe_screen base;52struct renderonly *ro;53int fd;5455struct v3d_device_info devinfo;5657const char *name;5859struct slab_parent_pool transfer_pool;6061struct v3d_bo_cache {62/** List of struct v3d_bo freed, by age. */63struct list_head time_list;64/** List of struct v3d_bo freed, per size, by age. */65struct list_head *size_list;66uint32_t size_list_size;6768mtx_t lock;69} bo_cache;7071const struct v3d_compiler *compiler;7273struct hash_table *bo_handles;74mtx_t bo_handles_mutex;7576uint32_t bo_size;77uint32_t bo_count;7879bool has_csd;80bool has_cache_flush;81bool nonmsaa_texture_size_limit;8283struct v3d_simulator_file *sim_file;84};8586static inline struct v3d_screen *87v3d_screen(struct pipe_screen *screen)88{89return (struct v3d_screen *)screen;90}9192struct pipe_screen *v3d_screen_create(int fd,93const struct pipe_screen_config *config,94struct renderonly *ro);9596void97v3d_fence_init(struct v3d_screen *screen);9899#endif /* V3D_SCREEN_H */100101102