2 * Copyright © 2009 Corbin Simpson
3 * Copyright © 2015 Advanced Micro Devices, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
18 * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
23 * The above copyright notice and this permission notice (including the
24 * next paragraph) shall be included in all copies or substantial portions
29 * Marek Olšák <maraeo@gmail.com>
32 #ifndef AMDGPU_WINSYS_H
33 #define AMDGPU_WINSYS_H
35 #include "gallium/drivers/radeon/radeon_winsys.h"
36 #include "addrlib/addrinterface.h"
37 #include "os/os_thread.h"
42 struct amdgpu_winsys
{
43 struct radeon_winsys base
;
44 struct pipe_reference reference
;
46 amdgpu_device_handle dev
;
48 pipe_mutex bo_fence_lock
;
50 int num_cs
; /* The number of command streams created. */
51 uint32_t next_bo_unique_id
;
52 uint64_t allocated_vram
;
53 uint64_t allocated_gtt
;
54 uint64_t buffer_wait_time
; /* time spent in buffer_wait in ns */
55 uint64_t num_cs_flushes
;
56 unsigned gart_page_size
;
58 struct radeon_info info
;
60 struct pb_manager
*kman
;
61 struct pb_manager
*cman
;
63 struct amdgpu_gpu_info amdinfo
;
69 static inline struct amdgpu_winsys
*
70 amdgpu_winsys(struct radeon_winsys
*base
)
72 return (struct amdgpu_winsys
*)base
;
75 void amdgpu_surface_init_functions(struct amdgpu_winsys
*ws
);
76 ADDR_HANDLE
amdgpu_addr_create(struct amdgpu_winsys
*ws
);