Path: blob/21.2-virgl/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
4566 views
/*1* Copyright © 2009 Corbin Simpson2* All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining5* a copy of this software and associated documentation files (the6* "Software"), to deal in the Software without restriction, including7* without limitation the rights to use, copy, modify, merge, publish,8* distribute, sub license, and/or sell copies of the Software, and to9* permit persons to whom the Software is furnished to do so, subject to10* the following conditions:11*12* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES14* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND15* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS16* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE19* USE OR OTHER DEALINGS IN THE SOFTWARE.20*21* The above copyright notice and this permission notice (including the22* next paragraph) shall be included in all copies or substantial portions23* of the Software.24*/2526#ifndef RADEON_DRM_WINSYS_H27#define RADEON_DRM_WINSYS_H2829#include "gallium/drivers/radeon/radeon_winsys.h"30#include "pipebuffer/pb_cache.h"31#include "pipebuffer/pb_slab.h"32#include "util/u_queue.h"33#include "util/list.h"34#include <radeon_drm.h>3536struct radeon_drm_cs;3738enum radeon_generation {39DRV_R300,40DRV_R600,41DRV_SI42};4344#define RADEON_SLAB_MIN_SIZE_LOG2 945#define RADEON_SLAB_MAX_SIZE_LOG2 144647struct radeon_vm_heap {48mtx_t mutex;49uint64_t start;50uint64_t end;51struct list_head holes;52};5354struct radeon_drm_winsys {55struct radeon_winsys base;56struct pipe_reference reference;57struct pb_cache bo_cache;58struct pb_slabs bo_slabs;5960int fd; /* DRM file descriptor */61int num_cs; /* The number of command streams created. */62uint64_t allocated_vram;63uint64_t allocated_gtt;64uint64_t mapped_vram;65uint64_t mapped_gtt;66uint64_t buffer_wait_time; /* time spent in buffer_wait in ns */67uint64_t num_gfx_IBs;68uint64_t num_sdma_IBs;69uint64_t num_mapped_buffers;70uint32_t next_bo_hash;7172enum radeon_generation gen;73struct radeon_info info;74uint32_t va_start;75uint32_t va_unmap_working;76uint32_t accel_working2;7778/* List of buffer GEM names. Protected by bo_handles_mutex. */79struct hash_table *bo_names;80/* List of buffer handles. Protected by bo_handles_mutex. */81struct hash_table *bo_handles;82/* List of buffer virtual memory ranges. Protected by bo_handles_mutex. */83struct hash_table_u64 *bo_vas;84mtx_t bo_handles_mutex;85mtx_t bo_fence_lock;8687struct radeon_vm_heap vm32;88struct radeon_vm_heap vm64;8990bool check_vm;91bool noop_cs;9293struct radeon_surface_manager *surf_man;9495uint32_t num_cpus; /* Number of CPUs. */9697struct radeon_drm_cs *hyperz_owner;98mtx_t hyperz_owner_mutex;99struct radeon_drm_cs *cmask_owner;100mtx_t cmask_owner_mutex;101102/* multithreaded command submission */103struct util_queue cs_queue;104};105106static inline struct radeon_drm_winsys *radeon_drm_winsys(struct radeon_winsys *base)107{108return (struct radeon_drm_winsys*)base;109}110111uint32_t radeon_drm_get_gpu_reset_counter(struct radeon_drm_winsys *ws);112void radeon_surface_init_functions(struct radeon_drm_winsys *ws);113114#endif115116117