3efe851a4be37fd5c8c157fff1cbb9cebfcad638
[mesa.git] / src / gallium / winsys / drm / vmware / xorg / vmw_driver.h
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 * Contains the shared resources for VMware Xorg driver
29 * that sits ontop of the Xorg State Traker.
30 *
31 * It is initialized in vmw_screen.c.
32 *
33 * @author Jakob Bornecrantz <jakob@vmware.com>
34 */
35
36 #ifndef VMW_DRIVER_H_
37 #define VMW_DRIVER_H_
38
39 #include "state_trackers/xorg/xorg_tracker.h"
40
41 struct vmw_dma_buffer;
42
43 struct vmw_driver
44 {
45 int fd;
46
47 void *cursor_priv;
48
49 /* vmw_video.c */
50 void *video_priv;
51 };
52
53 static INLINE struct vmw_driver *
54 vmw_driver(ScrnInfoPtr pScrn)
55 {
56 modesettingPtr ms = modesettingPTR(pScrn);
57 return ms ? (struct vmw_driver *)ms->winsys_priv : NULL;
58 }
59
60
61 /***********************************************************************
62 * vmw_video.c
63 */
64
65 Bool vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
66
67 Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
68
69 void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
70
71
72 /***********************************************************************
73 * vmw_ioctl.c
74 */
75
76 int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot);
77
78 struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw,
79 uint32_t size,
80 unsigned *handle);
81
82 void * vmw_ioctl_buffer_map(struct vmw_driver *vmw,
83 struct vmw_dma_buffer *buf);
84
85 void vmw_ioctl_buffer_unmap(struct vmw_driver *vmw,
86 struct vmw_dma_buffer *buf);
87
88 void vmw_ioctl_buffer_destroy(struct vmw_driver *vmw,
89 struct vmw_dma_buffer *buf);
90
91 int vmw_ioctl_supports_streams(struct vmw_driver *vmw);
92
93 int vmw_ioctl_num_streams(struct vmw_driver *vmw,
94 uint32_t *ntot, uint32_t *nfree);
95
96 int vmw_ioctl_unref_stream(struct vmw_driver *vmw, uint32_t stream_id);
97
98 int vmw_ioctl_claim_stream(struct vmw_driver *vmw, uint32_t *out);
99
100
101 #endif