Path: blob/21.2-virgl/src/gallium/drivers/lima/lima_screen.h
4565 views
/*1* Copyright (c) 2017-2019 Lima Project2*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, sub license,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 the11* next paragraph) shall be included in all copies or substantial portions12* of the 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 NON-INFRINGEMENT. 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 OTHER20* DEALINGS IN THE SOFTWARE.21*22*/2324#ifndef H_LIMA_SCREEN25#define H_LIMA_SCREEN2627#include <stdio.h>2829#include "util/slab.h"30#include "util/list.h"31#include "util/disk_cache.h"32#include "os/os_thread.h"3334#include "pipe/p_screen.h"3536#define LIMA_DEBUG_GP (1 << 0)37#define LIMA_DEBUG_PP (1 << 1)38#define LIMA_DEBUG_DUMP (1 << 2)39#define LIMA_DEBUG_SHADERDB (1 << 3)40#define LIMA_DEBUG_NO_BO_CACHE (1 << 4)41#define LIMA_DEBUG_BO_CACHE (1 << 5)42#define LIMA_DEBUG_NO_TILING (1 << 6)43#define LIMA_DEBUG_NO_GROW_HEAP (1 << 7)44#define LIMA_DEBUG_SINGLE_JOB (1 << 8)45#define LIMA_DEBUG_PRECOMPILE (1 << 9)46#define LIMA_DEBUG_DISK_CACHE (1 << 10)4748extern uint32_t lima_debug;49extern int lima_ctx_num_plb;50extern int lima_plb_max_blk;51extern int lima_ppir_force_spilling;52extern int lima_plb_pp_stream_cache_size;5354struct ra_regs;5556#define MIN_BO_CACHE_BUCKET (12) /* 2^12 = 4KB */57#define MAX_BO_CACHE_BUCKET (22) /* 2^22 = 4MB */5859#define NR_BO_CACHE_BUCKETS (MAX_BO_CACHE_BUCKET - MIN_BO_CACHE_BUCKET + 1)6061struct lima_screen {62struct pipe_screen base;63struct renderonly *ro;6465int refcnt;66void *winsys_priv;6768int fd;69int gpu_type;70int num_pp;71uint32_t plb_max_blk;7273/* bo table */74mtx_t bo_table_lock;75mtx_t bo_cache_lock;76struct hash_table *bo_handles;77struct hash_table *bo_flink_names;78struct list_head bo_cache_buckets[NR_BO_CACHE_BUCKETS];79struct list_head bo_cache_time;8081struct slab_parent_pool transfer_pool;8283struct ra_regs *pp_ra;8485struct lima_bo *pp_buffer;86#define pp_frame_rsw_offset 0x000087#define pp_clear_program_offset 0x004088#define pp_reload_program_offset 0x008089#define pp_shared_index_offset 0x00c090#define pp_clear_gl_pos_offset 0x010091#define pp_buffer_size 0x10009293bool has_growable_heap_buffer;9495struct disk_cache *disk_cache;96};9798static inline struct lima_screen *99lima_screen(struct pipe_screen *pscreen)100{101return (struct lima_screen *)pscreen;102}103104struct pipe_screen *105lima_screen_create(int fd, struct renderonly *ro);106107#endif108109110