Rev 5078 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5078 | Rev 6296 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /************************************************************************** |
1 | /************************************************************************** |
2 | * |
2 | * |
3 | * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA |
3 | * Copyright © 2009-2015 VMware, Inc., Palo Alto, CA., USA |
4 | * All Rights Reserved. |
4 | * All Rights Reserved. |
5 | * |
5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the |
7 | * copy of this software and associated documentation files (the |
8 | * "Software"), to deal in the Software without restriction, including |
8 | * "Software"), to deal in the Software without restriction, including |
Line 30... | Line 30... | ||
30 | 30 | ||
31 | #include "vmwgfx_reg.h" |
31 | #include "vmwgfx_reg.h" |
32 | #include |
32 | #include |
33 | #include |
33 | #include |
34 | #include |
- | |
35 | #include |
34 | #include |
36 | //#include |
35 | //#include |
37 | #include |
36 | #include |
38 | #include |
37 | #include |
39 | #include |
38 | #include |
40 | #include |
39 | #include |
41 | //#include |
40 | //#include |
Line 42... | Line 41... | ||
42 | #include "vmwgfx_fence.h" |
41 | #include "vmwgfx_fence.h" |
43 | 42 | ||
44 | #define VMWGFX_DRIVER_DATE "20140704" |
43 | #define VMWGFX_DRIVER_DATE "20150810" |
45 | #define VMWGFX_DRIVER_MAJOR 2 |
44 | #define VMWGFX_DRIVER_MAJOR 2 |
46 | #define VMWGFX_DRIVER_MINOR 6 |
45 | #define VMWGFX_DRIVER_MINOR 9 |
47 | #define VMWGFX_DRIVER_PATCHLEVEL 1 |
46 | #define VMWGFX_DRIVER_PATCHLEVEL 0 |
48 | #define VMWGFX_FILE_PAGE_OFFSET 0x00100000 |
47 | #define VMWGFX_FILE_PAGE_OFFSET 0x00100000 |
49 | #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) |
48 | #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) |
50 | #define VMWGFX_MAX_RELOCATIONS 2048 |
49 | #define VMWGFX_MAX_RELOCATIONS 2048 |
51 | #define VMWGFX_MAX_VALIDATIONS 2048 |
50 | #define VMWGFX_MAX_VALIDATIONS 2048 |
52 | #define VMWGFX_MAX_DISPLAYS 16 |
51 | #define VMWGFX_MAX_DISPLAYS 16 |
Line 53... | Line 52... | ||
53 | #define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 |
52 | #define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 |
54 | #define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 0 |
53 | #define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1 |
55 | 54 | ||
56 | /* |
55 | /* |
57 | * Perhaps we should have sysfs entries for these. |
56 | * Perhaps we should have sysfs entries for these. |
58 | */ |
57 | */ |
59 | #define VMWGFX_NUM_GB_CONTEXT 256 |
58 | #define VMWGFX_NUM_GB_CONTEXT 256 |
- | 59 | #define VMWGFX_NUM_GB_SHADER 20000 |
|
- | 60 | #define VMWGFX_NUM_GB_SURFACE 32768 |
|
60 | #define VMWGFX_NUM_GB_SHADER 20000 |
61 | #define VMWGFX_NUM_GB_SCREEN_TARGET VMWGFX_MAX_DISPLAYS |
61 | #define VMWGFX_NUM_GB_SURFACE 32768 |
62 | #define VMWGFX_NUM_DXCONTEXT 256 |
62 | #define VMWGFX_NUM_GB_SCREEN_TARGET VMWGFX_MAX_DISPLAYS |
63 | #define VMWGFX_NUM_DXQUERY 512 |
63 | #define VMWGFX_NUM_MOB (VMWGFX_NUM_GB_CONTEXT +\ |
64 | #define VMWGFX_NUM_MOB (VMWGFX_NUM_GB_CONTEXT +\ |
Line 74... | Line 75... | ||
74 | #define VMW_RES_SURFACE ttm_driver_type1 |
75 | #define VMW_RES_SURFACE ttm_driver_type1 |
75 | #define VMW_RES_STREAM ttm_driver_type2 |
76 | #define VMW_RES_STREAM ttm_driver_type2 |
76 | #define VMW_RES_FENCE ttm_driver_type3 |
77 | #define VMW_RES_FENCE ttm_driver_type3 |
77 | #define VMW_RES_SHADER ttm_driver_type4 |
78 | #define VMW_RES_SHADER ttm_driver_type4 |
Line 78... | Line -... | ||
78 | - | ||
79 | #define ioread32(addr) readl(addr) |
- | |
80 | 79 | ||
81 | static inline void outl(u32 v, u16 port) |
80 | static inline void outl(u32 v, u16 port) |
82 | { |
81 | { |
83 | asm volatile("outl %0,%1" : : "a" (v), "dN" (port)); |
82 | asm volatile("outl %0,%1" : : "a" (v), "dN" (port)); |
84 | } |
83 | } |
85 | static inline u32 inl(u16 port) |
84 | static inline u32 inl(u16 port) |
86 | { |
85 | { |
87 | u32 v; |
86 | u32 v; |
88 | asm volatile("inl %1,%0" : "=a" (v) : "dN" (port)); |
87 | asm volatile("inl %1,%0" : "=a" (v) : "dN" (port)); |
89 | return v; |
88 | return v; |
90 | } |
- | |
91 | - | ||
92 | 89 | } |
|
93 | struct vmw_fpriv { |
90 | struct vmw_fpriv { |
94 | // struct drm_master *locked_master; |
91 | struct drm_master *locked_master; |
95 | struct ttm_object_file *tfile; |
92 | struct ttm_object_file *tfile; |
96 | struct list_head fence_events; |
93 | struct list_head fence_events; |
97 | bool gb_aware; |
94 | bool gb_aware; |
Line 98... | Line 95... | ||
98 | }; |
95 | }; |
99 | 96 | ||
100 | struct vmw_dma_buffer { |
97 | struct vmw_dma_buffer { |
- | 98 | struct ttm_buffer_object base; |
|
- | 99 | struct list_head res_list; |
|
- | 100 | s32 pin_count; |
|
101 | struct ttm_buffer_object base; |
101 | /* Not ref-counted. Protected by binding_mutex */ |
Line 102... | Line 102... | ||
102 | struct list_head res_list; |
102 | struct vmw_resource *dx_query_ctx; |
103 | }; |
103 | }; |
104 | 104 | ||
Line 126... | Line 126... | ||
126 | unsigned long backup_size; |
126 | unsigned long backup_size; |
127 | bool res_dirty; /* Protected by backup buffer reserved */ |
127 | bool res_dirty; /* Protected by backup buffer reserved */ |
128 | bool backup_dirty; /* Protected by backup buffer reserved */ |
128 | bool backup_dirty; /* Protected by backup buffer reserved */ |
129 | struct vmw_dma_buffer *backup; |
129 | struct vmw_dma_buffer *backup; |
130 | unsigned long backup_offset; |
130 | unsigned long backup_offset; |
- | 131 | unsigned long pin_count; /* Protected by resource reserved */ |
|
131 | const struct vmw_res_func *func; |
132 | const struct vmw_res_func *func; |
132 | struct list_head lru_head; /* Protected by the resource lock */ |
133 | struct list_head lru_head; /* Protected by the resource lock */ |
133 | struct list_head mob_head; /* Protected by @backup reserved */ |
134 | struct list_head mob_head; /* Protected by @backup reserved */ |
134 | struct list_head binding_head; /* Protected by binding_mutex */ |
135 | struct list_head binding_head; /* Protected by binding_mutex */ |
135 | void (*res_free) (struct vmw_resource *res); |
136 | void (*res_free) (struct vmw_resource *res); |
Line 143... | Line 144... | ||
143 | enum vmw_res_type { |
144 | enum vmw_res_type { |
144 | vmw_res_context, |
145 | vmw_res_context, |
145 | vmw_res_surface, |
146 | vmw_res_surface, |
146 | vmw_res_stream, |
147 | vmw_res_stream, |
147 | vmw_res_shader, |
148 | vmw_res_shader, |
- | 149 | vmw_res_dx_context, |
|
- | 150 | vmw_res_cotable, |
|
- | 151 | vmw_res_view, |
|
148 | vmw_res_max |
152 | vmw_res_max |
149 | }; |
153 | }; |
Line 150... | Line 154... | ||
150 | 154 | ||
151 | /* |
155 | /* |
152 | * Resources that are managed using command streams. |
156 | * Resources that are managed using command streams. |
153 | */ |
157 | */ |
154 | enum vmw_cmdbuf_res_type { |
158 | enum vmw_cmdbuf_res_type { |
- | 159 | vmw_cmdbuf_res_shader, |
|
155 | vmw_cmdbuf_res_compat_shader |
160 | vmw_cmdbuf_res_view |
Line 156... | Line 161... | ||
156 | }; |
161 | }; |
Line 157... | Line 162... | ||
157 | 162 | ||
Line 173... | Line 178... | ||
173 | uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; |
178 | uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; |
174 | struct drm_vmw_size base_size; |
179 | struct drm_vmw_size base_size; |
175 | struct drm_vmw_size *sizes; |
180 | struct drm_vmw_size *sizes; |
176 | uint32_t num_sizes; |
181 | uint32_t num_sizes; |
177 | bool scanout; |
182 | bool scanout; |
- | 183 | uint32_t array_size; |
|
178 | /* TODO so far just a extra pointer */ |
184 | /* TODO so far just a extra pointer */ |
179 | struct vmw_cursor_snooper snooper; |
185 | struct vmw_cursor_snooper snooper; |
180 | struct vmw_surface_offset *offsets; |
186 | struct vmw_surface_offset *offsets; |
181 | SVGA3dTextureFilter autogen_filter; |
187 | SVGA3dTextureFilter autogen_filter; |
182 | uint32_t multisample_count; |
188 | uint32_t multisample_count; |
- | 189 | struct list_head view_list; |
|
183 | }; |
190 | }; |
Line 184... | Line 191... | ||
184 | 191 | ||
185 | struct vmw_marker_queue { |
192 | struct vmw_marker_queue { |
186 | struct list_head head; |
193 | struct list_head head; |
Line 189... | Line 196... | ||
189 | spinlock_t lock; |
196 | spinlock_t lock; |
190 | }; |
197 | }; |
Line 191... | Line 198... | ||
191 | 198 | ||
192 | struct vmw_fifo_state { |
199 | struct vmw_fifo_state { |
193 | unsigned long reserved_size; |
200 | unsigned long reserved_size; |
194 | __le32 *dynamic_buffer; |
201 | u32 *dynamic_buffer; |
195 | __le32 *static_buffer; |
202 | u32 *static_buffer; |
196 | unsigned long static_buffer_size; |
203 | unsigned long static_buffer_size; |
197 | bool using_bounce_buffer; |
204 | bool using_bounce_buffer; |
198 | uint32_t capabilities; |
205 | uint32_t capabilities; |
199 | struct mutex fifo_mutex; |
206 | struct mutex fifo_mutex; |
200 | struct rw_semaphore rwsem; |
207 | struct rw_semaphore rwsem; |
- | 208 | struct vmw_marker_queue marker_queue; |
|
201 | struct vmw_marker_queue marker_queue; |
209 | bool dx; |
Line 202... | Line 210... | ||
202 | }; |
210 | }; |
203 | 211 | ||
204 | struct vmw_relocation { |
212 | struct vmw_relocation { |
Line 240... | Line 248... | ||
240 | /** |
248 | /** |
241 | * struct vmw_sg_table - Scatter/gather table for binding, with additional |
249 | * struct vmw_sg_table - Scatter/gather table for binding, with additional |
242 | * device-specific information. |
250 | * device-specific information. |
243 | * |
251 | * |
244 | * @sgt: Pointer to a struct sg_table with binding information |
252 | * @sgt: Pointer to a struct sg_table with binding information |
245 | * @num_regions: Number of regions with device-address contigous pages |
253 | * @num_regions: Number of regions with device-address contiguous pages |
246 | */ |
254 | */ |
247 | struct vmw_sg_table { |
255 | struct vmw_sg_table { |
248 | enum vmw_dma_map_mode mode; |
256 | enum vmw_dma_map_mode mode; |
249 | struct page **pages; |
257 | struct page **pages; |
250 | const dma_addr_t *addrs; |
258 | const dma_addr_t *addrs; |
Line 277... | Line 285... | ||
277 | dma_addr_t (*dma_address)(struct vmw_piter *); |
285 | dma_addr_t (*dma_address)(struct vmw_piter *); |
278 | struct page *(*page)(struct vmw_piter *); |
286 | struct page *(*page)(struct vmw_piter *); |
279 | }; |
287 | }; |
Line 280... | Line 288... | ||
280 | 288 | ||
281 | /* |
289 | /* |
282 | * enum vmw_ctx_binding_type - abstract resource to context binding types |
- | |
283 | */ |
- | |
284 | enum vmw_ctx_binding_type { |
- | |
285 | vmw_ctx_binding_shader, |
- | |
286 | vmw_ctx_binding_rt, |
- | |
287 | vmw_ctx_binding_tex, |
- | |
288 | vmw_ctx_binding_max |
- | |
289 | }; |
- | |
290 | - | ||
291 | /** |
- | |
292 | * struct vmw_ctx_bindinfo - structure representing a single context binding |
- | |
293 | * |
- | |
294 | * @ctx: Pointer to the context structure. NULL means the binding is not |
- | |
295 | * active. |
- | |
296 | * @res: Non ref-counted pointer to the bound resource. |
- | |
297 | * @bt: The binding type. |
- | |
298 | * @i1: Union of information needed to unbind. |
290 | * enum vmw_display_unit_type - Describes the display unit |
299 | */ |
291 | */ |
300 | struct vmw_ctx_bindinfo { |
292 | enum vmw_display_unit_type { |
301 | struct vmw_resource *ctx; |
293 | vmw_du_invalid = 0, |
302 | struct vmw_resource *res; |
294 | vmw_du_legacy, |
303 | enum vmw_ctx_binding_type bt; |
- | |
304 | bool scrubbed; |
- | |
305 | union { |
- | |
306 | SVGA3dShaderType shader_type; |
- | |
307 | SVGA3dRenderTargetType rt_type; |
295 | vmw_du_screen_object, |
308 | uint32 texture_stage; |
- | |
309 | } i1; |
296 | vmw_du_screen_target |
Line 310... | Line -... | ||
310 | }; |
- | |
311 | - | ||
312 | /** |
- | |
313 | * struct vmw_ctx_binding - structure representing a single context binding |
- | |
314 | * - suitable for tracking in a context |
- | |
315 | * |
- | |
316 | * @ctx_list: List head for context. |
- | |
317 | * @res_list: List head for bound resource. |
- | |
318 | * @bi: Binding info |
- | |
319 | */ |
- | |
320 | struct vmw_ctx_binding { |
- | |
321 | struct list_head ctx_list; |
- | |
322 | struct list_head res_list; |
- | |
323 | struct vmw_ctx_bindinfo bi; |
- | |
324 | }; |
- | |
325 | - | ||
326 | - | ||
327 | /** |
- | |
328 | * struct vmw_ctx_binding_state - context binding state |
- | |
329 | * |
- | |
330 | * @list: linked list of individual bindings. |
- | |
331 | * @render_targets: Render target bindings. |
- | |
332 | * @texture_units: Texture units/samplers bindings. |
- | |
333 | * @shaders: Shader bindings. |
- | |
334 | * |
- | |
335 | * Note that this structure also provides storage space for the individual |
- | |
336 | * struct vmw_ctx_binding objects, so that no dynamic allocation is needed |
- | |
337 | * for individual bindings. |
- | |
338 | * |
- | |
339 | */ |
- | |
340 | struct vmw_ctx_binding_state { |
- | |
341 | struct list_head list; |
- | |
342 | struct vmw_ctx_binding render_targets[SVGA3D_RT_MAX]; |
- | |
343 | struct vmw_ctx_binding texture_units[SVGA3D_NUM_TEXTURE_UNITS]; |
- | |
Line 344... | Line 297... | ||
344 | struct vmw_ctx_binding shaders[SVGA3D_SHADERTYPE_MAX]; |
297 | }; |
345 | }; |
298 | |
346 | 299 | ||
347 | struct vmw_sw_context{ |
300 | struct vmw_sw_context{ |
Line 355... | Line 308... | ||
355 | struct vmw_validate_buffer val_bufs[VMWGFX_MAX_VALIDATIONS]; |
308 | struct vmw_validate_buffer val_bufs[VMWGFX_MAX_VALIDATIONS]; |
356 | uint32_t cur_val_buf; |
309 | uint32_t cur_val_buf; |
357 | uint32_t *cmd_bounce; |
310 | uint32_t *cmd_bounce; |
358 | uint32_t cmd_bounce_size; |
311 | uint32_t cmd_bounce_size; |
359 | struct list_head resource_list; |
312 | struct list_head resource_list; |
360 | uint32_t fence_flags; |
313 | struct list_head ctx_resource_list; /* For contexts and cotables */ |
361 | struct ttm_buffer_object *cur_query_bo; |
314 | struct vmw_dma_buffer *cur_query_bo; |
362 | struct list_head res_relocations; |
315 | struct list_head res_relocations; |
363 | uint32_t *buf_start; |
316 | uint32_t *buf_start; |
364 | struct vmw_res_cache_entry res_cache[vmw_res_max]; |
317 | struct vmw_res_cache_entry res_cache[vmw_res_max]; |
365 | struct vmw_resource *last_query_ctx; |
318 | struct vmw_resource *last_query_ctx; |
366 | bool needs_post_query_barrier; |
319 | bool needs_post_query_barrier; |
367 | struct vmw_resource *error_resource; |
320 | struct vmw_resource *error_resource; |
368 | struct vmw_ctx_binding_state staged_bindings; |
321 | struct vmw_ctx_binding_state *staged_bindings; |
- | 322 | bool staged_bindings_inuse; |
|
369 | struct list_head staged_cmd_res; |
323 | struct list_head staged_cmd_res; |
- | 324 | struct vmw_resource_val_node *dx_ctx_node; |
|
- | 325 | struct vmw_dma_buffer *dx_query_mob; |
|
- | 326 | struct vmw_resource *dx_query_ctx; |
|
- | 327 | struct vmw_cmdbuf_res_manager *man; |
|
370 | }; |
328 | }; |
Line 371... | Line 329... | ||
371 | 329 | ||
372 | struct vmw_legacy_display; |
330 | struct vmw_legacy_display; |
Line 373... | Line 331... | ||
373 | struct vmw_overlay; |
331 | struct vmw_overlay; |
374 | 332 | ||
375 | struct vmw_master { |
- | |
376 | struct ttm_lock lock; |
- | |
377 | struct mutex fb_surf_mutex; |
333 | struct vmw_master { |
Line 378... | Line 334... | ||
378 | struct list_head fb_surf; |
334 | struct ttm_lock lock; |
379 | }; |
335 | }; |
380 | 336 | ||
381 | struct vmw_vga_topology_state { |
337 | struct vmw_vga_topology_state { |
382 | uint32_t width; |
338 | uint32_t width; |
383 | uint32_t height; |
339 | uint32_t height; |
384 | uint32_t primary; |
340 | uint32_t primary; |
Line -... | Line 341... | ||
- | 341 | uint32_t pos_x; |
|
- | 342 | uint32_t pos_y; |
|
- | 343 | }; |
|
- | 344 | ||
- | 345 | ||
- | 346 | /* |
|
- | 347 | * struct vmw_otable - Guest Memory OBject table metadata |
|
- | 348 | * |
|
- | 349 | * @size: Size of the table (page-aligned). |
|
- | 350 | * @page_table: Pointer to a struct vmw_mob holding the page table. |
|
- | 351 | */ |
|
- | 352 | struct vmw_otable { |
|
- | 353 | unsigned long size; |
|
- | 354 | struct vmw_mob *page_table; |
|
- | 355 | bool enabled; |
|
- | 356 | }; |
|
- | 357 | ||
- | 358 | struct vmw_otable_batch { |
|
- | 359 | unsigned num_otables; |
|
- | 360 | struct vmw_otable *otables; |
|
385 | uint32_t pos_x; |
361 | struct vmw_resource *context; |
386 | uint32_t pos_y; |
362 | struct ttm_buffer_object *otable_bo; |
387 | }; |
363 | }; |
388 | 364 | ||
Line 401... | Line 377... | ||
401 | uint32_t prim_bb_mem; |
377 | uint32_t prim_bb_mem; |
402 | uint32_t mmio_start; |
378 | uint32_t mmio_start; |
403 | uint32_t mmio_size; |
379 | uint32_t mmio_size; |
404 | uint32_t fb_max_width; |
380 | uint32_t fb_max_width; |
405 | uint32_t fb_max_height; |
381 | uint32_t fb_max_height; |
- | 382 | uint32_t texture_max_width; |
|
- | 383 | uint32_t texture_max_height; |
|
- | 384 | uint32_t stdu_max_width; |
|
- | 385 | uint32_t stdu_max_height; |
|
406 | uint32_t initial_width; |
386 | uint32_t initial_width; |
407 | uint32_t initial_height; |
387 | uint32_t initial_height; |
408 | __le32 __iomem *mmio_virt; |
- | |
409 | int mmio_mtrr; |
388 | u32 *mmio_virt; |
410 | uint32_t capabilities; |
389 | uint32_t capabilities; |
411 | uint32_t max_gmr_ids; |
390 | uint32_t max_gmr_ids; |
412 | uint32_t max_gmr_pages; |
391 | uint32_t max_gmr_pages; |
413 | uint32_t max_mob_pages; |
392 | uint32_t max_mob_pages; |
414 | uint32_t max_mob_size; |
393 | uint32_t max_mob_size; |
415 | uint32_t memory_size; |
394 | uint32_t memory_size; |
416 | bool has_gmr; |
395 | bool has_gmr; |
417 | bool has_mob; |
396 | bool has_mob; |
418 | struct mutex hw_mutex; |
397 | spinlock_t hw_lock; |
- | 398 | spinlock_t cap_lock; |
|
- | 399 | bool has_dx; |
|
Line 419... | Line 400... | ||
419 | 400 | ||
420 | /* |
401 | /* |
421 | * VGA registers. |
402 | * VGA registers. |
Line 433... | Line 414... | ||
433 | /* |
414 | /* |
434 | * Framebuffer info. |
415 | * Framebuffer info. |
435 | */ |
416 | */ |
Line 436... | Line 417... | ||
436 | 417 | ||
- | 418 | void *fb_info; |
|
437 | void *fb_info; |
419 | enum vmw_display_unit_type active_display_unit; |
438 | struct vmw_legacy_display *ldu_priv; |
420 | struct vmw_legacy_display *ldu_priv; |
439 | struct vmw_screen_object_display *sou_priv; |
421 | struct vmw_screen_object_display *sou_priv; |
Line 440... | Line 422... | ||
440 | struct vmw_overlay *overlay_priv; |
422 | struct vmw_overlay *overlay_priv; |
Line 463... | Line 445... | ||
463 | */ |
445 | */ |
Line 464... | Line 446... | ||
464 | 446 | ||
465 | atomic_t marker_seq; |
447 | atomic_t marker_seq; |
466 | wait_queue_head_t fence_queue; |
448 | wait_queue_head_t fence_queue; |
- | 449 | wait_queue_head_t fifo_queue; |
|
467 | wait_queue_head_t fifo_queue; |
450 | spinlock_t waiter_lock; |
468 | int fence_queue_waiters; /* Protected by hw_mutex */ |
451 | int fence_queue_waiters; /* Protected by waiter_lock */ |
- | 452 | int goal_queue_waiters; /* Protected by waiter_lock */ |
|
- | 453 | int cmdbuf_waiters; /* Protected by waiter_lock */ |
|
469 | int goal_queue_waiters; /* Protected by hw_mutex */ |
454 | int error_waiters; /* Protected by waiter_lock */ |
470 | atomic_t fifo_queue_waiters; |
455 | int fifo_queue_waiters; /* Protected by waiter_lock */ |
471 | uint32_t last_read_seqno; |
- | |
472 | spinlock_t irq_lock; |
456 | uint32_t last_read_seqno; |
473 | struct vmw_fence_manager *fman; |
457 | struct vmw_fence_manager *fman; |
Line 474... | Line 458... | ||
474 | uint32_t irq_mask; |
458 | uint32_t irq_mask; /* Updates protected by waiter_lock */ |
475 | 459 | ||
476 | /* |
460 | /* |
Line 496... | Line 480... | ||
496 | * Operating mode. |
480 | * Operating mode. |
497 | */ |
481 | */ |
Line 498... | Line 482... | ||
498 | 482 | ||
499 | bool stealth; |
483 | bool stealth; |
- | 484 | bool enable_fb; |
|
Line 500... | Line 485... | ||
500 | bool enable_fb; |
485 | spinlock_t svga_lock; |
501 | 486 | ||
502 | /** |
487 | /** |
Line 503... | Line 488... | ||
503 | * Master management. |
488 | * Master management. |
504 | */ |
489 | */ |
505 | - | ||
506 | struct vmw_master *active_master; |
490 | |
- | 491 | struct vmw_master *active_master; |
|
Line 507... | Line 492... | ||
507 | struct vmw_master fbdev_master; |
492 | struct vmw_master fbdev_master; |
508 | // struct notifier_block pm_nb; |
493 | bool suspended; |
Line 509... | Line 494... | ||
509 | bool suspended; |
494 | bool refuse_hibernation; |
510 | 495 | ||
511 | struct mutex release_mutex; |
496 | struct mutex release_mutex; |
512 | uint32_t num_3d_resources; |
497 | atomic_t num_fifo_resources; |
Line 519... | Line 504... | ||
519 | /* |
504 | /* |
520 | * Query processing. These members |
505 | * Query processing. These members |
521 | * are protected by the cmdbuf mutex. |
506 | * are protected by the cmdbuf mutex. |
522 | */ |
507 | */ |
Line 523... | Line 508... | ||
523 | 508 | ||
524 | struct ttm_buffer_object *dummy_query_bo; |
509 | struct vmw_dma_buffer *dummy_query_bo; |
525 | struct ttm_buffer_object *pinned_bo; |
510 | struct vmw_dma_buffer *pinned_bo; |
526 | uint32_t query_cid; |
511 | uint32_t query_cid; |
527 | uint32_t query_cid_valid; |
512 | uint32_t query_cid_valid; |
Line 528... | Line 513... | ||
528 | bool dummy_query_bo_pinned; |
513 | bool dummy_query_bo_pinned; |
Line 543... | Line 528... | ||
543 | enum vmw_dma_map_mode map_mode; |
528 | enum vmw_dma_map_mode map_mode; |
Line 544... | Line 529... | ||
544 | 529 | ||
545 | /* |
530 | /* |
546 | * Guest Backed stuff |
531 | * Guest Backed stuff |
547 | */ |
532 | */ |
- | 533 | struct vmw_otable_batch otable_batch; |
|
548 | struct ttm_buffer_object *otable_bo; |
534 | |
549 | struct vmw_otable *otables; |
535 | struct vmw_cmdbuf_man *cman; |
Line 550... | Line 536... | ||
550 | }; |
536 | }; |
551 | 537 | ||
552 | static inline struct vmw_surface *vmw_res_to_srf(struct vmw_resource *res) |
538 | static inline struct vmw_surface *vmw_res_to_srf(struct vmw_resource *res) |
Line 567... | Line 553... | ||
567 | static inline struct vmw_master *vmw_master(struct drm_master *master) |
553 | static inline struct vmw_master *vmw_master(struct drm_master *master) |
568 | { |
554 | { |
569 | return (struct vmw_master *) master->driver_priv; |
555 | return (struct vmw_master *) master->driver_priv; |
570 | } |
556 | } |
Line -... | Line 557... | ||
- | 557 | ||
- | 558 | /* |
|
- | 559 | * The locking here is fine-grained, so that it is performed once |
|
- | 560 | * for every read- and write operation. This is of course costly, but we |
|
- | 561 | * don't perform much register access in the timing critical paths anyway. |
|
- | 562 | * Instead we have the extra benefit of being sure that we don't forget |
|
- | 563 | * the hw lock around register accesses. |
|
571 | 564 | */ |
|
572 | static inline void vmw_write(struct vmw_private *dev_priv, |
565 | static inline void vmw_write(struct vmw_private *dev_priv, |
573 | unsigned int offset, uint32_t value) |
566 | unsigned int offset, uint32_t value) |
- | 567 | { |
|
- | 568 | unsigned long irq_flags; |
|
- | 569 | ||
574 | { |
570 | spin_lock_irqsave(&dev_priv->hw_lock, irq_flags); |
575 | outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT); |
571 | outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT); |
- | 572 | outl(value, dev_priv->io_start + VMWGFX_VALUE_PORT); |
|
576 | outl(value, dev_priv->io_start + VMWGFX_VALUE_PORT); |
573 | spin_unlock_irqrestore(&dev_priv->hw_lock, irq_flags); |
Line 577... | Line 574... | ||
577 | } |
574 | } |
578 | 575 | ||
579 | static inline uint32_t vmw_read(struct vmw_private *dev_priv, |
576 | static inline uint32_t vmw_read(struct vmw_private *dev_priv, |
- | 577 | unsigned int offset) |
|
580 | unsigned int offset) |
578 | { |
Line -... | Line 579... | ||
- | 579 | unsigned long irq_flags; |
|
581 | { |
580 | u32 val; |
582 | uint32_t val; |
581 | |
- | 582 | spin_lock_irqsave(&dev_priv->hw_lock, irq_flags); |
|
- | 583 | outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT); |
|
583 | 584 | val = inl(dev_priv->io_start + VMWGFX_VALUE_PORT); |
|
584 | outl(offset, dev_priv->io_start + VMWGFX_INDEX_PORT); |
585 | spin_unlock_irqrestore(&dev_priv->hw_lock, irq_flags); |
Line 585... | Line 586... | ||
585 | val = inl(dev_priv->io_start + VMWGFX_VALUE_PORT); |
586 | |
586 | return val; |
587 | return val; |
- | 588 | } |
|
Line 587... | Line 589... | ||
587 | } |
589 | |
588 | 590 | extern void vmw_svga_enable(struct vmw_private *dev_priv); |
|
589 | int vmw_3d_resource_inc(struct vmw_private *dev_priv, bool unhide_svga); |
591 | extern void vmw_svga_disable(struct vmw_private *dev_priv); |
Line 607... | Line 609... | ||
607 | extern void vmw_resource_unreference(struct vmw_resource **p_res); |
609 | extern void vmw_resource_unreference(struct vmw_resource **p_res); |
608 | extern struct vmw_resource *vmw_resource_reference(struct vmw_resource *res); |
610 | extern struct vmw_resource *vmw_resource_reference(struct vmw_resource *res); |
609 | extern struct vmw_resource * |
611 | extern struct vmw_resource * |
610 | vmw_resource_reference_unless_doomed(struct vmw_resource *res); |
612 | vmw_resource_reference_unless_doomed(struct vmw_resource *res); |
611 | extern int vmw_resource_validate(struct vmw_resource *res); |
613 | extern int vmw_resource_validate(struct vmw_resource *res); |
612 | extern int vmw_resource_reserve(struct vmw_resource *res, bool no_backup); |
614 | extern int vmw_resource_reserve(struct vmw_resource *res, bool interruptible, |
- | 615 | bool no_backup); |
|
613 | extern bool vmw_resource_needs_backup(const struct vmw_resource *res); |
616 | extern bool vmw_resource_needs_backup(const struct vmw_resource *res); |
614 | extern int vmw_user_lookup_handle(struct vmw_private *dev_priv, |
617 | extern int vmw_user_lookup_handle(struct vmw_private *dev_priv, |
615 | struct ttm_object_file *tfile, |
618 | struct ttm_object_file *tfile, |
616 | uint32_t handle, |
619 | uint32_t handle, |
617 | struct vmw_surface **out_surf, |
620 | struct vmw_surface **out_surf, |
Line 633... | Line 636... | ||
633 | extern int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv, |
636 | extern int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv, |
634 | struct ttm_object_file *tfile, |
637 | struct ttm_object_file *tfile, |
635 | uint32_t size, |
638 | uint32_t size, |
636 | bool shareable, |
639 | bool shareable, |
637 | uint32_t *handle, |
640 | uint32_t *handle, |
638 | struct vmw_dma_buffer **p_dma_buf); |
641 | struct vmw_dma_buffer **p_dma_buf, |
- | 642 | struct ttm_base_object **p_base); |
|
639 | extern int vmw_user_dmabuf_reference(struct ttm_object_file *tfile, |
643 | extern int vmw_user_dmabuf_reference(struct ttm_object_file *tfile, |
640 | struct vmw_dma_buffer *dma_buf, |
644 | struct vmw_dma_buffer *dma_buf, |
641 | uint32_t *handle); |
645 | uint32_t *handle); |
642 | extern int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, |
646 | extern int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, |
643 | struct drm_file *file_priv); |
647 | struct drm_file *file_priv); |
Line 647... | Line 651... | ||
647 | struct drm_file *file_priv); |
651 | struct drm_file *file_priv); |
648 | extern uint32_t vmw_dmabuf_validate_node(struct ttm_buffer_object *bo, |
652 | extern uint32_t vmw_dmabuf_validate_node(struct ttm_buffer_object *bo, |
649 | uint32_t cur_validate_node); |
653 | uint32_t cur_validate_node); |
650 | extern void vmw_dmabuf_validate_clear(struct ttm_buffer_object *bo); |
654 | extern void vmw_dmabuf_validate_clear(struct ttm_buffer_object *bo); |
651 | extern int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile, |
655 | extern int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile, |
652 | uint32_t id, struct vmw_dma_buffer **out); |
656 | uint32_t id, struct vmw_dma_buffer **out, |
- | 657 | struct ttm_base_object **base); |
|
653 | extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data, |
658 | extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data, |
654 | struct drm_file *file_priv); |
659 | struct drm_file *file_priv); |
655 | extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data, |
660 | extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data, |
656 | struct drm_file *file_priv); |
661 | struct drm_file *file_priv); |
657 | extern int vmw_user_stream_lookup(struct vmw_private *dev_priv, |
662 | extern int vmw_user_stream_lookup(struct vmw_private *dev_priv, |
658 | struct ttm_object_file *tfile, |
663 | struct ttm_object_file *tfile, |
659 | uint32_t *inout_id, |
664 | uint32_t *inout_id, |
660 | struct vmw_resource **out); |
665 | struct vmw_resource **out); |
661 | extern void vmw_resource_unreserve(struct vmw_resource *res, |
666 | extern void vmw_resource_unreserve(struct vmw_resource *res, |
- | 667 | bool switch_backup, |
|
662 | struct vmw_dma_buffer *new_backup, |
668 | struct vmw_dma_buffer *new_backup, |
663 | unsigned long new_backup_offset); |
669 | unsigned long new_backup_offset); |
664 | extern void vmw_resource_move_notify(struct ttm_buffer_object *bo, |
670 | extern void vmw_resource_move_notify(struct ttm_buffer_object *bo, |
665 | struct ttm_mem_reg *mem); |
671 | struct ttm_mem_reg *mem); |
- | 672 | extern void vmw_query_move_notify(struct ttm_buffer_object *bo, |
|
- | 673 | struct ttm_mem_reg *mem); |
|
- | 674 | extern int vmw_query_readback_all(struct vmw_dma_buffer *dx_query_mob); |
|
666 | extern void vmw_fence_single_bo(struct ttm_buffer_object *bo, |
675 | extern void vmw_fence_single_bo(struct ttm_buffer_object *bo, |
667 | struct vmw_fence_obj *fence); |
676 | struct vmw_fence_obj *fence); |
668 | extern void vmw_resource_evict_all(struct vmw_private *dev_priv); |
677 | extern void vmw_resource_evict_all(struct vmw_private *dev_priv); |
Line 669... | Line 678... | ||
669 | 678 | ||
670 | /** |
679 | /** |
671 | * DMA buffer helper routines - vmwgfx_dmabuf.c |
680 | * DMA buffer helper routines - vmwgfx_dmabuf.c |
672 | */ |
681 | */ |
673 | extern int vmw_dmabuf_to_placement(struct vmw_private *vmw_priv, |
682 | extern int vmw_dmabuf_pin_in_placement(struct vmw_private *vmw_priv, |
674 | struct vmw_dma_buffer *bo, |
683 | struct vmw_dma_buffer *bo, |
675 | struct ttm_placement *placement, |
684 | struct ttm_placement *placement, |
676 | bool interruptible); |
685 | bool interruptible); |
677 | extern int vmw_dmabuf_to_vram(struct vmw_private *dev_priv, |
686 | extern int vmw_dmabuf_pin_in_vram(struct vmw_private *dev_priv, |
678 | struct vmw_dma_buffer *buf, |
687 | struct vmw_dma_buffer *buf, |
679 | bool pin, bool interruptible); |
688 | bool interruptible); |
680 | extern int vmw_dmabuf_to_vram_or_gmr(struct vmw_private *dev_priv, |
689 | extern int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv, |
681 | struct vmw_dma_buffer *buf, |
690 | struct vmw_dma_buffer *buf, |
682 | bool pin, bool interruptible); |
691 | bool interruptible); |
683 | extern int vmw_dmabuf_to_start_of_vram(struct vmw_private *vmw_priv, |
692 | extern int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *vmw_priv, |
684 | struct vmw_dma_buffer *bo, |
693 | struct vmw_dma_buffer *bo, |
685 | bool pin, bool interruptible); |
694 | bool interruptible); |
686 | extern int vmw_dmabuf_unpin(struct vmw_private *vmw_priv, |
695 | extern int vmw_dmabuf_unpin(struct vmw_private *vmw_priv, |
687 | struct vmw_dma_buffer *bo, |
696 | struct vmw_dma_buffer *bo, |
688 | bool interruptible); |
697 | bool interruptible); |
689 | extern void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *buf, |
698 | extern void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *buf, |
690 | SVGAGuestPtr *ptr); |
699 | SVGAGuestPtr *ptr); |
Line 691... | Line 700... | ||
691 | extern void vmw_bo_pin(struct ttm_buffer_object *bo, bool pin); |
700 | extern void vmw_bo_pin_reserved(struct vmw_dma_buffer *bo, bool pin); |
692 | 701 | ||
693 | /** |
702 | /** |
Line 700... | Line 709... | ||
700 | struct drm_file *file_priv); |
709 | struct drm_file *file_priv); |
701 | extern int vmw_present_ioctl(struct drm_device *dev, void *data, |
710 | extern int vmw_present_ioctl(struct drm_device *dev, void *data, |
702 | struct drm_file *file_priv); |
711 | struct drm_file *file_priv); |
703 | extern int vmw_present_readback_ioctl(struct drm_device *dev, void *data, |
712 | extern int vmw_present_readback_ioctl(struct drm_device *dev, void *data, |
704 | struct drm_file *file_priv); |
713 | struct drm_file *file_priv); |
- | 714 | extern unsigned int vmw_fops_poll(struct file *filp, |
|
- | 715 | struct poll_table_struct *wait); |
|
705 | extern ssize_t vmw_fops_read(struct file *filp, char __user *buffer, |
716 | extern ssize_t vmw_fops_read(struct file *filp, char __user *buffer, |
706 | size_t count, loff_t *offset); |
717 | size_t count, loff_t *offset); |
Line 707... | Line 718... | ||
707 | 718 | ||
708 | /** |
719 | /** |
Line 712... | Line 723... | ||
712 | extern int vmw_fifo_init(struct vmw_private *dev_priv, |
723 | extern int vmw_fifo_init(struct vmw_private *dev_priv, |
713 | struct vmw_fifo_state *fifo); |
724 | struct vmw_fifo_state *fifo); |
714 | extern void vmw_fifo_release(struct vmw_private *dev_priv, |
725 | extern void vmw_fifo_release(struct vmw_private *dev_priv, |
715 | struct vmw_fifo_state *fifo); |
726 | struct vmw_fifo_state *fifo); |
716 | extern void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes); |
727 | extern void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes); |
- | 728 | extern void * |
|
- | 729 | vmw_fifo_reserve_dx(struct vmw_private *dev_priv, uint32_t bytes, int ctx_id); |
|
717 | extern void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes); |
730 | extern void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes); |
- | 731 | extern void vmw_fifo_commit_flush(struct vmw_private *dev_priv, uint32_t bytes); |
|
718 | extern int vmw_fifo_send_fence(struct vmw_private *dev_priv, |
732 | extern int vmw_fifo_send_fence(struct vmw_private *dev_priv, |
719 | uint32_t *seqno); |
733 | uint32_t *seqno); |
- | 734 | extern void vmw_fifo_ping_host_locked(struct vmw_private *, uint32_t reason); |
|
720 | extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason); |
735 | extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason); |
721 | extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv); |
736 | extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv); |
722 | extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv); |
737 | extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv); |
723 | extern int vmw_fifo_emit_dummy_query(struct vmw_private *dev_priv, |
738 | extern int vmw_fifo_emit_dummy_query(struct vmw_private *dev_priv, |
724 | uint32_t cid); |
739 | uint32_t cid); |
- | 740 | extern int vmw_fifo_flush(struct vmw_private *dev_priv, |
|
- | 741 | bool interruptible); |
|
Line 725... | Line 742... | ||
725 | 742 | ||
726 | /** |
743 | /** |
727 | * TTM glue - vmwgfx_ttm_glue.c |
744 | * TTM glue - vmwgfx_ttm_glue.c |
Line 744... | Line 761... | ||
744 | extern struct ttm_placement vmw_sys_placement; |
761 | extern struct ttm_placement vmw_sys_placement; |
745 | extern struct ttm_placement vmw_sys_ne_placement; |
762 | extern struct ttm_placement vmw_sys_ne_placement; |
746 | extern struct ttm_placement vmw_evictable_placement; |
763 | extern struct ttm_placement vmw_evictable_placement; |
747 | extern struct ttm_placement vmw_srf_placement; |
764 | extern struct ttm_placement vmw_srf_placement; |
748 | extern struct ttm_placement vmw_mob_placement; |
765 | extern struct ttm_placement vmw_mob_placement; |
- | 766 | extern struct ttm_placement vmw_mob_ne_placement; |
|
749 | extern struct ttm_bo_driver vmw_bo_driver; |
767 | extern struct ttm_bo_driver vmw_bo_driver; |
750 | extern int vmw_dma_quiescent(struct drm_device *dev); |
768 | extern int vmw_dma_quiescent(struct drm_device *dev); |
751 | extern int vmw_bo_map_dma(struct ttm_buffer_object *bo); |
769 | extern int vmw_bo_map_dma(struct ttm_buffer_object *bo); |
752 | extern void vmw_bo_unmap_dma(struct ttm_buffer_object *bo); |
770 | extern void vmw_bo_unmap_dma(struct ttm_buffer_object *bo); |
753 | extern const struct vmw_sg_table * |
771 | extern const struct vmw_sg_table * |
Line 794... | Line 812... | ||
794 | 812 | ||
795 | /** |
813 | /** |
796 | * Command submission - vmwgfx_execbuf.c |
814 | * Command submission - vmwgfx_execbuf.c |
Line 797... | Line 815... | ||
797 | */ |
815 | */ |
798 | 816 | ||
799 | extern int vmw_execbuf_ioctl(struct drm_device *dev, void *data, |
817 | extern int vmw_execbuf_ioctl(struct drm_device *dev, unsigned long data, |
800 | struct drm_file *file_priv); |
818 | struct drm_file *file_priv, size_t size); |
801 | extern int vmw_execbuf_process(struct drm_file *file_priv, |
819 | extern int vmw_execbuf_process(struct drm_file *file_priv, |
802 | struct vmw_private *dev_priv, |
820 | struct vmw_private *dev_priv, |
803 | void __user *user_commands, |
821 | void __user *user_commands, |
804 | void *kernel_commands, |
822 | void *kernel_commands, |
- | 823 | uint32_t command_size, |
|
805 | uint32_t command_size, |
824 | uint64_t throttle_us, |
806 | uint64_t throttle_us, |
825 | uint32_t dx_context_handle, |
807 | struct drm_vmw_fence_rep __user |
826 | struct drm_vmw_fence_rep __user |
808 | *user_fence_rep, |
827 | *user_fence_rep, |
809 | struct vmw_fence_obj **out_fence); |
828 | struct vmw_fence_obj **out_fence); |
Line 820... | Line 839... | ||
820 | int ret, |
839 | int ret, |
821 | struct drm_vmw_fence_rep __user |
840 | struct drm_vmw_fence_rep __user |
822 | *user_fence_rep, |
841 | *user_fence_rep, |
823 | struct vmw_fence_obj *fence, |
842 | struct vmw_fence_obj *fence, |
824 | uint32_t fence_handle); |
843 | uint32_t fence_handle); |
- | 844 | extern int vmw_validate_single_buffer(struct vmw_private *dev_priv, |
|
- | 845 | struct ttm_buffer_object *bo, |
|
- | 846 | bool interruptible, |
|
- | 847 | bool validate_as_mob); |
|
- | 848 | ||
Line 825... | Line 849... | ||
825 | 849 | ||
826 | /** |
850 | /** |
827 | * IRQs and wating - vmwgfx_irq.c |
851 | * IRQs and wating - vmwgfx_irq.c |
Line 846... | Line 870... | ||
846 | struct vmw_fifo_state *fifo_state); |
870 | struct vmw_fifo_state *fifo_state); |
847 | extern void vmw_seqno_waiter_add(struct vmw_private *dev_priv); |
871 | extern void vmw_seqno_waiter_add(struct vmw_private *dev_priv); |
848 | extern void vmw_seqno_waiter_remove(struct vmw_private *dev_priv); |
872 | extern void vmw_seqno_waiter_remove(struct vmw_private *dev_priv); |
849 | extern void vmw_goal_waiter_add(struct vmw_private *dev_priv); |
873 | extern void vmw_goal_waiter_add(struct vmw_private *dev_priv); |
850 | extern void vmw_goal_waiter_remove(struct vmw_private *dev_priv); |
874 | extern void vmw_goal_waiter_remove(struct vmw_private *dev_priv); |
- | 875 | extern void vmw_generic_waiter_add(struct vmw_private *dev_priv, u32 flag, |
|
- | 876 | int *waiter_count); |
|
- | 877 | extern void vmw_generic_waiter_remove(struct vmw_private *dev_priv, |
|
- | 878 | u32 flag, int *waiter_count); |
|
Line 851... | Line 879... | ||
851 | 879 | ||
852 | /** |
880 | /** |
853 | * Rudimentary fence-like objects currently used only for throttling - |
881 | * Rudimentary fence-like objects currently used only for throttling - |
854 | * vmwgfx_marker.c |
882 | * vmwgfx_marker.c |
Line 892... | Line 920... | ||
892 | unsigned bpp, unsigned depth); |
920 | unsigned bpp, unsigned depth); |
893 | void vmw_kms_idle_workqueues(struct vmw_master *vmaster); |
921 | void vmw_kms_idle_workqueues(struct vmw_master *vmaster); |
894 | bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv, |
922 | bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv, |
895 | uint32_t pitch, |
923 | uint32_t pitch, |
896 | uint32_t height); |
924 | uint32_t height); |
897 | u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc); |
925 | u32 vmw_get_vblank_counter(struct drm_device *dev, unsigned int pipe); |
898 | int vmw_enable_vblank(struct drm_device *dev, int crtc); |
926 | int vmw_enable_vblank(struct drm_device *dev, unsigned int pipe); |
899 | void vmw_disable_vblank(struct drm_device *dev, int crtc); |
927 | void vmw_disable_vblank(struct drm_device *dev, unsigned int pipe); |
900 | int vmw_kms_present(struct vmw_private *dev_priv, |
928 | int vmw_kms_present(struct vmw_private *dev_priv, |
901 | struct drm_file *file_priv, |
929 | struct drm_file *file_priv, |
902 | struct vmw_framebuffer *vfb, |
930 | struct vmw_framebuffer *vfb, |
903 | struct vmw_surface *surface, |
931 | struct vmw_surface *surface, |
904 | uint32_t sid, int32_t destX, int32_t destY, |
932 | uint32_t sid, int32_t destX, int32_t destY, |
905 | struct drm_vmw_rect *clips, |
933 | struct drm_vmw_rect *clips, |
906 | uint32_t num_clips); |
934 | uint32_t num_clips); |
907 | int vmw_kms_readback(struct vmw_private *dev_priv, |
- | |
908 | struct drm_file *file_priv, |
- | |
909 | struct vmw_framebuffer *vfb, |
- | |
910 | struct drm_vmw_fence_rep __user *user_fence_rep, |
- | |
911 | struct drm_vmw_rect *clips, |
- | |
912 | uint32_t num_clips); |
- | |
913 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, |
935 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, |
914 | struct drm_file *file_priv); |
936 | struct drm_file *file_priv); |
- | 937 | void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv); |
|
Line 915... | Line 938... | ||
915 | 938 | ||
916 | int vmw_dumb_create(struct drm_file *file_priv, |
939 | int vmw_dumb_create(struct drm_file *file_priv, |
917 | struct drm_device *dev, |
940 | struct drm_device *dev, |
Line 921... | Line 944... | ||
921 | struct drm_device *dev, uint32_t handle, |
944 | struct drm_device *dev, uint32_t handle, |
922 | uint64_t *offset); |
945 | uint64_t *offset); |
923 | int vmw_dumb_destroy(struct drm_file *file_priv, |
946 | int vmw_dumb_destroy(struct drm_file *file_priv, |
924 | struct drm_device *dev, |
947 | struct drm_device *dev, |
925 | uint32_t handle); |
948 | uint32_t handle); |
- | 949 | extern int vmw_resource_pin(struct vmw_resource *res, bool interruptible); |
|
- | 950 | extern void vmw_resource_unpin(struct vmw_resource *res); |
|
- | 951 | extern enum vmw_res_type vmw_res_type(const struct vmw_resource *res); |
|
- | 952 | ||
926 | /** |
953 | /** |
927 | * Overlay control - vmwgfx_overlay.c |
954 | * Overlay control - vmwgfx_overlay.c |
928 | */ |
955 | */ |
Line 929... | Line 956... | ||
929 | 956 | ||
Line 944... | Line 971... | ||
944 | */ |
971 | */ |
Line 945... | Line 972... | ||
945 | 972 | ||
Line 946... | Line 973... | ||
946 | extern const struct ttm_mem_type_manager_func vmw_gmrid_manager_func; |
973 | extern const struct ttm_mem_type_manager_func vmw_gmrid_manager_func; |
- | 974 | ||
- | 975 | /** |
|
- | 976 | * Prime - vmwgfx_prime.c |
|
- | 977 | */ |
|
- | 978 | ||
- | 979 | extern const struct dma_buf_ops vmw_prime_dmabuf_ops; |
|
- | 980 | extern int vmw_prime_fd_to_handle(struct drm_device *dev, |
|
- | 981 | struct drm_file *file_priv, |
|
- | 982 | int fd, u32 *handle); |
|
- | 983 | extern int vmw_prime_handle_to_fd(struct drm_device *dev, |
|
- | 984 | struct drm_file *file_priv, |
|
- | 985 | uint32_t handle, uint32_t flags, |
|
947 | 986 | int *prime_fd); |
|
948 | /** |
987 | |
949 | /* |
988 | /* |
950 | * MemoryOBject management - vmwgfx_mob.c |
989 | * MemoryOBject management - vmwgfx_mob.c |
951 | */ |
990 | */ |
Line 964... | Line 1003... | ||
964 | * Context management - vmwgfx_context.c |
1003 | * Context management - vmwgfx_context.c |
965 | */ |
1004 | */ |
Line 966... | Line 1005... | ||
966 | 1005 | ||
Line 967... | Line -... | ||
967 | extern const struct vmw_user_resource_conv *user_context_converter; |
- | |
968 | - | ||
969 | extern struct vmw_resource *vmw_context_alloc(struct vmw_private *dev_priv); |
1006 | extern const struct vmw_user_resource_conv *user_context_converter; |
970 | 1007 | ||
971 | extern int vmw_context_check(struct vmw_private *dev_priv, |
1008 | extern int vmw_context_check(struct vmw_private *dev_priv, |
972 | struct ttm_object_file *tfile, |
1009 | struct ttm_object_file *tfile, |
973 | int id, |
1010 | int id, |
974 | struct vmw_resource **p_res); |
1011 | struct vmw_resource **p_res); |
- | 1012 | extern int vmw_context_define_ioctl(struct drm_device *dev, void *data, |
|
- | 1013 | struct drm_file *file_priv); |
|
975 | extern int vmw_context_define_ioctl(struct drm_device *dev, void *data, |
1014 | extern int vmw_extended_context_define_ioctl(struct drm_device *dev, void *data, |
976 | struct drm_file *file_priv); |
1015 | struct drm_file *file_priv); |
977 | extern int vmw_context_destroy_ioctl(struct drm_device *dev, void *data, |
- | |
978 | struct drm_file *file_priv); |
- | |
979 | extern int vmw_context_binding_add(struct vmw_ctx_binding_state *cbs, |
- | |
980 | const struct vmw_ctx_bindinfo *ci); |
- | |
981 | extern void |
- | |
982 | vmw_context_binding_state_transfer(struct vmw_resource *res, |
- | |
983 | struct vmw_ctx_binding_state *cbs); |
- | |
984 | extern void vmw_context_binding_res_list_kill(struct list_head *head); |
- | |
985 | extern void vmw_context_binding_res_list_scrub(struct list_head *head); |
1016 | extern int vmw_context_destroy_ioctl(struct drm_device *dev, void *data, |
- | 1017 | struct drm_file *file_priv); |
|
- | 1018 | extern struct list_head *vmw_context_binding_list(struct vmw_resource *ctx); |
|
- | 1019 | extern struct vmw_cmdbuf_res_manager * |
|
- | 1020 | vmw_context_res_man(struct vmw_resource *ctx); |
|
- | 1021 | extern struct vmw_resource *vmw_context_cotable(struct vmw_resource *ctx, |
|
- | 1022 | SVGACOTableType cotable_type); |
|
- | 1023 | extern struct list_head *vmw_context_binding_list(struct vmw_resource *ctx); |
|
- | 1024 | struct vmw_ctx_binding_state; |
|
- | 1025 | extern struct vmw_ctx_binding_state * |
|
- | 1026 | vmw_context_binding_state(struct vmw_resource *ctx); |
|
- | 1027 | extern void vmw_dx_context_scrub_cotables(struct vmw_resource *ctx, |
|
- | 1028 | bool readback); |
|
- | 1029 | extern int vmw_context_bind_dx_query(struct vmw_resource *ctx_res, |
|
- | 1030 | struct vmw_dma_buffer *mob); |
|
- | 1031 | extern struct vmw_dma_buffer * |
|
Line 986... | Line 1032... | ||
986 | extern int vmw_context_rebind_all(struct vmw_resource *ctx); |
1032 | vmw_context_get_dx_query_mob(struct vmw_resource *ctx_res); |
987 | extern struct list_head *vmw_context_binding_list(struct vmw_resource *ctx); |
1033 | |
988 | 1034 | ||
Line 989... | Line 1035... | ||
989 | /* |
1035 | /* |
Line 990... | Line 1036... | ||
990 | * Surface management - vmwgfx_surface.c |
1036 | * Surface management - vmwgfx_surface.c |
- | 1037 | */ |
|
- | 1038 | ||
- | 1039 | extern const struct vmw_user_resource_conv *user_surface_converter; |
|
- | 1040 | ||
- | 1041 | extern void vmw_surface_res_free(struct vmw_resource *res); |
|
- | 1042 | extern int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, |
|
- | 1043 | struct drm_file *file_priv); |
|
- | 1044 | extern int vmw_surface_define_ioctl(struct drm_device *dev, void *data, |
|
- | 1045 | struct drm_file *file_priv); |
|
- | 1046 | extern int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, |
|
991 | */ |
1047 | struct drm_file *file_priv); |
992 | 1048 | extern int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, |
|
993 | extern const struct vmw_user_resource_conv *user_surface_converter; |
1049 | struct drm_file *file_priv); |
994 | 1050 | extern int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data, |
|
995 | extern void vmw_surface_res_free(struct vmw_resource *res); |
1051 | struct drm_file *file_priv); |
- | 1052 | extern int vmw_surface_check(struct vmw_private *dev_priv, |
|
- | 1053 | struct ttm_object_file *tfile, |
|
- | 1054 | uint32_t handle, int *id); |
|
- | 1055 | extern int vmw_surface_validate(struct vmw_private *dev_priv, |
|
- | 1056 | struct vmw_surface *srf); |
|
- | 1057 | int vmw_surface_gb_priv_define(struct drm_device *dev, |
|
- | 1058 | uint32_t user_accounting_size, |
|
- | 1059 | uint32_t svga3d_flags, |
|
- | 1060 | SVGA3dSurfaceFormat format, |
|
- | 1061 | bool for_scanout, |
|
Line 996... | Line 1062... | ||
996 | extern int vmw_surface_check(struct vmw_private *dev_priv, |
1062 | uint32_t num_mip_levels, |
997 | struct ttm_object_file *tfile, |
1063 | uint32_t multisample_count, |
998 | uint32_t handle, int *id); |
1064 | uint32_t array_size, |
Line 999... | Line 1065... | ||
999 | extern int vmw_surface_validate(struct vmw_private *dev_priv, |
1065 | struct drm_vmw_size size, |
- | 1066 | struct vmw_surface **srf_out); |
|
- | 1067 | ||
- | 1068 | /* |
|
- | 1069 | * Shader management - vmwgfx_shader.c |
|
- | 1070 | */ |
|
- | 1071 | ||
- | 1072 | extern const struct vmw_user_resource_conv *user_shader_converter; |
|
- | 1073 | ||
- | 1074 | extern int vmw_shader_define_ioctl(struct drm_device *dev, void *data, |
|
- | 1075 | struct drm_file *file_priv); |
|
- | 1076 | extern int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data, |
|
- | 1077 | struct drm_file *file_priv); |
|
- | 1078 | extern int vmw_compat_shader_add(struct vmw_private *dev_priv, |
|
- | 1079 | struct vmw_cmdbuf_res_manager *man, |
|
- | 1080 | u32 user_key, const void *bytecode, |
|
- | 1081 | SVGA3dShaderType shader_type, |
|
- | 1082 | size_t size, |
|
- | 1083 | struct list_head *list); |
|
- | 1084 | extern int vmw_shader_remove(struct vmw_cmdbuf_res_manager *man, |
|
- | 1085 | u32 user_key, SVGA3dShaderType shader_type, |
|
- | 1086 | struct list_head *list); |
|
- | 1087 | extern int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man, |
|
- | 1088 | struct vmw_resource *ctx, |
|
- | 1089 | u32 user_key, |
|
- | 1090 | SVGA3dShaderType shader_type, |
|
- | 1091 | struct list_head *list); |
|
- | 1092 | extern void vmw_dx_shader_cotable_list_scrub(struct vmw_private *dev_priv, |
|
- | 1093 | struct list_head *list, |
|
- | 1094 | bool readback); |
|
- | 1095 | ||
- | 1096 | extern struct vmw_resource * |
|
1000 | struct vmw_surface *srf); |
1097 | vmw_shader_lookup(struct vmw_cmdbuf_res_manager *man, |
1001 | 1098 | u32 user_key, SVGA3dShaderType shader_type); |
|
1002 | /* |
1099 | |
1003 | * Shader management - vmwgfx_shader.c |
1100 | /* |
1004 | */ |
1101 | * Command buffer managed resources - vmwgfx_cmdbuf_res.c |
Line 1020... | Line 1117... | ||
1020 | struct vmw_resource *res, |
1117 | struct vmw_resource *res, |
1021 | struct list_head *list); |
1118 | struct list_head *list); |
1022 | extern int vmw_cmdbuf_res_remove(struct vmw_cmdbuf_res_manager *man, |
1119 | extern int vmw_cmdbuf_res_remove(struct vmw_cmdbuf_res_manager *man, |
1023 | enum vmw_cmdbuf_res_type res_type, |
1120 | enum vmw_cmdbuf_res_type res_type, |
1024 | u32 user_key, |
1121 | u32 user_key, |
1025 | struct list_head *list); |
1122 | struct list_head *list, |
- | 1123 | struct vmw_resource **res); |
|
- | 1124 | ||
- | 1125 | /* |
|
- | 1126 | * COTable management - vmwgfx_cotable.c |
|
- | 1127 | */ |
|
- | 1128 | extern const SVGACOTableType vmw_cotable_scrub_order[]; |
|
- | 1129 | extern struct vmw_resource *vmw_cotable_alloc(struct vmw_private *dev_priv, |
|
- | 1130 | struct vmw_resource *ctx, |
|
- | 1131 | u32 type); |
|
- | 1132 | extern int vmw_cotable_notify(struct vmw_resource *res, int id); |
|
- | 1133 | extern int vmw_cotable_scrub(struct vmw_resource *res, bool readback); |
|
- | 1134 | extern void vmw_cotable_add_resource(struct vmw_resource *ctx, |
|
- | 1135 | struct list_head *head); |
|
- | 1136 | ||
- | 1137 | /* |
|
- | 1138 | * Command buffer managerment vmwgfx_cmdbuf.c |
|
- | 1139 | */ |
|
- | 1140 | struct vmw_cmdbuf_man; |
|
- | 1141 | struct vmw_cmdbuf_header; |
|
- | 1142 | ||
- | 1143 | extern struct vmw_cmdbuf_man * |
|
- | 1144 | vmw_cmdbuf_man_create(struct vmw_private *dev_priv); |
|
- | 1145 | extern int vmw_cmdbuf_set_pool_size(struct vmw_cmdbuf_man *man, |
|
- | 1146 | size_t size, size_t default_size); |
|
- | 1147 | extern void vmw_cmdbuf_remove_pool(struct vmw_cmdbuf_man *man); |
|
- | 1148 | extern void vmw_cmdbuf_man_destroy(struct vmw_cmdbuf_man *man); |
|
- | 1149 | extern int vmw_cmdbuf_idle(struct vmw_cmdbuf_man *man, bool interruptible, |
|
- | 1150 | unsigned long timeout); |
|
- | 1151 | extern void *vmw_cmdbuf_reserve(struct vmw_cmdbuf_man *man, size_t size, |
|
- | 1152 | int ctx_id, bool interruptible, |
|
- | 1153 | struct vmw_cmdbuf_header *header); |
|
- | 1154 | extern void vmw_cmdbuf_commit(struct vmw_cmdbuf_man *man, size_t size, |
|
- | 1155 | struct vmw_cmdbuf_header *header, |
|
- | 1156 | bool flush); |
|
- | 1157 | extern void vmw_cmdbuf_tasklet_schedule(struct vmw_cmdbuf_man *man); |
|
- | 1158 | extern void *vmw_cmdbuf_alloc(struct vmw_cmdbuf_man *man, |
|
- | 1159 | size_t size, bool interruptible, |
|
- | 1160 | struct vmw_cmdbuf_header **p_header); |
|
- | 1161 | extern void vmw_cmdbuf_header_free(struct vmw_cmdbuf_header *header); |
|
- | 1162 | extern int vmw_cmdbuf_cur_flush(struct vmw_cmdbuf_man *man, |
|
- | 1163 | bool interruptible); |
|
Line 1026... | Line 1164... | ||
1026 | 1164 | ||
1027 | 1165 | ||
1028 | /** |
1166 | /** |
Line 1066... | Line 1204... | ||
1066 | static inline struct ttm_mem_global *vmw_mem_glob(struct vmw_private *dev_priv) |
1204 | static inline struct ttm_mem_global *vmw_mem_glob(struct vmw_private *dev_priv) |
1067 | { |
1205 | { |
1068 | return (struct ttm_mem_global *) dev_priv->mem_global_ref.object; |
1206 | return (struct ttm_mem_global *) dev_priv->mem_global_ref.object; |
1069 | } |
1207 | } |
Line 1070... | Line 1208... | ||
1070 | 1208 | ||
- | 1209 | static inline void vmw_fifo_resource_inc(struct vmw_private *dev_priv) |
|
1071 | extern struct drm_device *main_device; |
1210 | { |
- | 1211 | atomic_inc(&dev_priv->num_fifo_resources); |
|
Line 1072... | Line 1212... | ||
1072 | extern struct drm_file *drm_file_handlers[256]; |
1212 | } |
1073 | 1213 | ||
1074 | typedef struct |
- | |
1075 | { |
- | |
1076 | int width; |
- | |
1077 | int height; |
1214 | static inline void vmw_fifo_resource_dec(struct vmw_private *dev_priv) |
1078 | int bpp; |
1215 | { |
Line -... | Line 1216... | ||
- | 1216 | atomic_dec(&dev_priv->num_fifo_resources); |
|
- | 1217 | } |
|
- | 1218 | ||
- | 1219 | /** |
|
- | 1220 | * vmw_mmio_read - Perform a MMIO read from volatile memory |
|
- | 1221 | * |
|
- | 1222 | * @addr: The address to read from |
|
- | 1223 | * |
|
- | 1224 | * This function is intended to be equivalent to ioread32() on |
|
- | 1225 | * memremap'd memory, but without byteswapping. |
|
- | 1226 | */ |
|
- | 1227 | static inline u32 vmw_mmio_read(u32 *addr) |
|
- | 1228 | { |
|
- | 1229 | return READ_ONCE(*addr); |
|
- | 1230 | } |
|
- | 1231 | ||
- | 1232 | /** |
|
- | 1233 | * vmw_mmio_write - Perform a MMIO write to volatile memory |
|
- | 1234 | * |
|
- | 1235 | * @addr: The address to write to |
|
- | 1236 | * |
|
- | 1237 | * This function is intended to be equivalent to iowrite32 on |
|
- | 1238 | * memremap'd memory, but without byteswapping. |
|
- | 1239 | */ |
|
- | 1240 | static inline void vmw_mmio_write(u32 value, u32 *addr) |
|
1079 | int freq; |
1241 | { |