pipe-loader: remove HAVE_PIPE_LOADER_foo function prototype guards
[mesa.git] / src / gallium / auxiliary / pipe-loader / pipe_loader.h
1 /**************************************************************************
2 *
3 * Copyright 2012 Francisco Jerez
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * 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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 /**
29 * \file Library that provides device enumeration and creation of
30 * winsys/pipe_screen instances.
31 */
32
33 #ifndef PIPE_LOADER_H
34 #define PIPE_LOADER_H
35
36 #include "pipe/p_compiler.h"
37 #include "state_tracker/drm_driver.h"
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 struct pipe_screen;
44 struct drisw_loader_funcs;
45
46 enum pipe_loader_device_type {
47 PIPE_LOADER_DEVICE_SOFTWARE,
48 PIPE_LOADER_DEVICE_PCI,
49 PIPE_LOADER_DEVICE_PLATFORM,
50 NUM_PIPE_LOADER_DEVICE_TYPES
51 };
52
53 /**
54 * A device known to the pipe loader.
55 */
56 struct pipe_loader_device {
57 enum pipe_loader_device_type type;
58
59 union {
60 struct {
61 int vendor_id;
62 int chip_id;
63 } pci;
64 } u; /**< Discriminated by \a type */
65
66 char *driver_name;
67 const struct pipe_loader_ops *ops;
68 };
69
70 /**
71 * Get a list of known devices.
72 *
73 * \param devs Array that will be filled with pointers to the devices
74 * available in the system.
75 * \param ndev Maximum number of devices to return.
76 * \return Number of devices available in the system.
77 */
78 int
79 pipe_loader_probe(struct pipe_loader_device **devs, int ndev);
80
81 /**
82 * Create a pipe_screen for the specified device.
83 *
84 * \param dev Device the screen will be created for.
85 * \param library_paths Colon-separated list of filesystem paths that
86 * will be used to look for the pipe driver
87 * module that handles this device.
88 */
89 struct pipe_screen *
90 pipe_loader_create_screen(struct pipe_loader_device *dev,
91 const char *library_paths);
92
93 /**
94 * Query the configuration parameters for the specified device.
95 *
96 * \param dev Device that will be queried.
97 * \param conf The drm_conf id of the option to be queried.
98 */
99 const struct drm_conf_ret *
100 pipe_loader_configuration(struct pipe_loader_device *dev,
101 enum drm_conf conf);
102
103 /**
104 * Release resources allocated for a list of devices.
105 *
106 * Should be called when the specified devices are no longer in use to
107 * release any resources allocated by pipe_loader_probe.
108 *
109 * \param devs Devices to release.
110 * \param ndev Number of devices to release.
111 */
112 void
113 pipe_loader_release(struct pipe_loader_device **devs, int ndev);
114
115 /**
116 * Initialize sw dri device give the drisw_loader_funcs.
117 *
118 * This function is platform-specific.
119 *
120 * \sa pipe_loader_probe
121 */
122 bool
123 pipe_loader_sw_probe_dri(struct pipe_loader_device **devs,
124 struct drisw_loader_funcs *drisw_lf);
125
126 /**
127 * Initialize a null sw device.
128 *
129 * This function is platform-specific.
130 *
131 * \sa pipe_loader_probe
132 */
133 bool
134 pipe_loader_sw_probe_null(struct pipe_loader_device **devs);
135
136 /**
137 * Get a list of known software devices.
138 *
139 * This function is platform-specific.
140 *
141 * \sa pipe_loader_probe
142 */
143 int
144 pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev);
145
146 /**
147 * Get a software device wrapped atop another device.
148 *
149 * This function is platform-specific.
150 *
151 * \sa pipe_loader_probe
152 */
153 boolean
154 pipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev,
155 struct pipe_screen *screen);
156
157 /**
158 * Get a list of known DRM devices.
159 *
160 * This function is platform-specific.
161 *
162 * \sa pipe_loader_probe
163 */
164 int
165 pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);
166
167 /**
168 * Initialize a DRM device in an already opened fd.
169 *
170 * This function is platform-specific.
171 *
172 * \sa pipe_loader_probe
173 */
174 bool
175 pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
176
177 #ifdef __cplusplus
178 }
179 #endif
180
181 #endif /* PIPE_LOADER_H */