Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4358 | Serge | 1 | /********************************************************** |
2 | * Copyright 2009 VMware, Inc. All rights reserved. |
||
3 | * |
||
4 | * Permission is hereby granted, free of charge, to any person |
||
5 | * obtaining a copy of this software and associated documentation |
||
6 | * files (the "Software"), to deal in the Software without |
||
7 | * restriction, including without limitation the rights to use, copy, |
||
8 | * modify, merge, publish, distribute, sublicense, and/or sell copies |
||
9 | * of the Software, and to permit persons to whom the Software is |
||
10 | * furnished to do so, subject to the following conditions: |
||
11 | * |
||
12 | * The above copyright notice and this permission notice shall be |
||
13 | * included in all copies or substantial portions of the Software. |
||
14 | * |
||
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
||
19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
||
20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||
21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||
22 | * SOFTWARE. |
||
23 | * |
||
24 | **********************************************************/ |
||
25 | |||
26 | /** |
||
27 | * @file |
||
28 | * Common definitions for the VMware SVGA winsys. |
||
29 | * |
||
30 | * @author Jose Fonseca |
||
31 | */ |
||
32 | |||
33 | |||
34 | #ifndef VMW_SCREEN_H_ |
||
35 | #define VMW_SCREEN_H_ |
||
36 | |||
37 | |||
38 | #include "pipe/p_compiler.h" |
||
39 | #include "pipe/p_state.h" |
||
40 | |||
41 | #include "svga_winsys.h" |
||
42 | |||
43 | |||
44 | #define VMW_GMR_POOL_SIZE (16*1024*1024) |
||
45 | #define VMW_QUERY_POOL_SIZE (8192) |
||
46 | /* |
||
47 | * Something big, but arbitrary. The kernel reports an error if it can't |
||
48 | * handle this, and the svga driver will resort to multiple partial |
||
49 | * uploads. |
||
50 | */ |
||
51 | #define VMW_MAX_BUFFER_SIZE (512*1024*1024) |
||
52 | |||
53 | struct pb_manager; |
||
54 | struct vmw_region; |
||
55 | |||
56 | |||
57 | struct vmw_winsys_screen |
||
58 | { |
||
59 | struct svga_winsys_screen base; |
||
60 | |||
61 | boolean use_old_scanout_flag; |
||
62 | |||
63 | struct { |
||
64 | int drm_fd; |
||
65 | uint32_t hwversion; |
||
66 | uint32_t *buffer; |
||
67 | } ioctl; |
||
68 | |||
69 | struct { |
||
70 | struct pb_manager *gmr; |
||
71 | struct pb_manager *gmr_mm; |
||
72 | struct pb_manager *gmr_fenced; |
||
73 | struct pb_manager *gmr_slab; |
||
74 | struct pb_manager *gmr_slab_fenced; |
||
75 | struct pb_manager *query; |
||
76 | struct pb_manager *query_mm; |
||
77 | struct pb_manager *query_fenced; |
||
78 | } pools; |
||
79 | }; |
||
80 | |||
81 | |||
82 | static INLINE struct vmw_winsys_screen * |
||
83 | vmw_winsys_screen(struct svga_winsys_screen *base) |
||
84 | { |
||
85 | return (struct vmw_winsys_screen *)base; |
||
86 | } |
||
87 | |||
88 | /* */ |
||
89 | uint32 |
||
90 | vmw_ioctl_context_create(struct vmw_winsys_screen *vws); |
||
91 | |||
92 | void |
||
93 | vmw_ioctl_context_destroy(struct vmw_winsys_screen *vws, |
||
94 | uint32 cid); |
||
95 | |||
96 | uint32 |
||
97 | vmw_ioctl_surface_create(struct vmw_winsys_screen *vws, |
||
98 | SVGA3dSurfaceFlags flags, |
||
99 | SVGA3dSurfaceFormat format, |
||
100 | SVGA3dSize size, |
||
101 | uint32 numFaces, |
||
102 | uint32 numMipLevels); |
||
103 | |||
104 | void |
||
105 | vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, |
||
106 | uint32 sid); |
||
107 | |||
108 | void |
||
109 | vmw_ioctl_command(struct vmw_winsys_screen *vws, |
||
110 | int32_t cid, |
||
111 | uint32_t throttle_us, |
||
112 | void *commands, |
||
113 | uint32_t size, |
||
114 | struct pipe_fence_handle **fence); |
||
115 | |||
116 | struct vmw_region * |
||
117 | vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size); |
||
118 | |||
119 | void |
||
120 | vmw_ioctl_region_destroy(struct vmw_region *region); |
||
121 | |||
122 | struct SVGAGuestPtr |
||
123 | vmw_ioctl_region_ptr(struct vmw_region *region); |
||
124 | |||
125 | void * |
||
126 | vmw_ioctl_region_map(struct vmw_region *region); |
||
127 | void |
||
128 | vmw_ioctl_region_unmap(struct vmw_region *region); |
||
129 | |||
130 | |||
131 | int |
||
132 | vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws, |
||
133 | uint32_t handle, uint32_t flags); |
||
134 | |||
135 | int |
||
136 | vmw_ioctl_fence_signalled(struct vmw_winsys_screen *vws, |
||
137 | uint32_t handle, uint32_t flags); |
||
138 | |||
139 | void |
||
140 | vmw_ioctl_fence_unref(struct vmw_winsys_screen *vws, |
||
141 | uint32_t handle); |
||
142 | |||
143 | |||
144 | /* Initialize parts of vmw_winsys_screen at startup: |
||
145 | */ |
||
146 | boolean vmw_ioctl_init(struct vmw_winsys_screen *vws); |
||
147 | boolean vmw_pools_init(struct vmw_winsys_screen *vws); |
||
148 | boolean vmw_query_pools_init(struct vmw_winsys_screen *vws); |
||
149 | boolean vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws); |
||
150 | |||
151 | void vmw_ioctl_cleanup(struct vmw_winsys_screen *vws); |
||
152 | void vmw_pools_cleanup(struct vmw_winsys_screen *vws); |
||
153 | |||
154 | struct vmw_winsys_screen *vmw_winsys_create(int fd, boolean use_old_scanout_flag); |
||
155 | void vmw_winsys_destroy(struct vmw_winsys_screen *sws); |
||
156 | void vmw_winsys_screen_set_throttling(struct pipe_screen *screen, |
||
157 | uint32_t throttle_us); |
||
158 | |||
159 | #endif /* VMW_SCREEN_H_ */ |