1 /**************************************************************************
3 * Copyright 2012 Francisco Jerez
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
29 * \file Library that provides device enumeration and creation of
30 * winsys/pipe_screen instances.
36 #include "pipe/p_compiler.h"
37 #include "state_tracker/drm_driver.h"
38 #include "util/xmlconfig.h"
45 struct drisw_loader_funcs
;
47 enum pipe_loader_device_type
{
48 PIPE_LOADER_DEVICE_SOFTWARE
,
49 PIPE_LOADER_DEVICE_PCI
,
50 PIPE_LOADER_DEVICE_PLATFORM
,
51 NUM_PIPE_LOADER_DEVICE_TYPES
55 * A device known to the pipe loader.
57 struct pipe_loader_device
{
58 enum pipe_loader_device_type type
;
65 } u
; /**< Discriminated by \a type */
68 const struct pipe_loader_ops
*ops
;
70 driOptionCache option_cache
;
71 driOptionCache option_info
;
75 * Get a list of known devices.
77 * \param devs Array that will be filled with pointers to the devices
78 * available in the system.
79 * \param ndev Maximum number of devices to return.
80 * \return Number of devices available in the system.
83 pipe_loader_probe(struct pipe_loader_device
**devs
, int ndev
);
86 * Create a pipe_screen for the specified device.
88 * \param dev Device the screen will be created for.
89 * \param config Configuration options. The lifetime of this structure and its
90 * elements may be limited to the duration of this call.
93 pipe_loader_create_screen(struct pipe_loader_device
*dev
,
94 struct pipe_screen_config
*config
);
97 * Query the configuration parameters for the specified device.
99 * \param dev Device that will be queried.
100 * \param conf The drm_conf id of the option to be queried.
102 const struct drm_conf_ret
*
103 pipe_loader_configuration(struct pipe_loader_device
*dev
,
107 * Ensure that dev->option_cache is initialized appropriately for the driver.
109 * This function can be called multiple times.
111 * \param dev Device for which options should be loaded.
114 pipe_loader_load_options(struct pipe_loader_device
*dev
);
117 * Release resources allocated for a list of devices.
119 * Should be called when the specified devices are no longer in use to
120 * release any resources allocated by pipe_loader_probe.
122 * \param devs Devices to release.
123 * \param ndev Number of devices to release.
126 pipe_loader_release(struct pipe_loader_device
**devs
, int ndev
);
129 * Initialize sw dri device give the drisw_loader_funcs.
131 * This function is platform-specific.
133 * \sa pipe_loader_probe
136 pipe_loader_sw_probe_dri(struct pipe_loader_device
**devs
,
137 struct drisw_loader_funcs
*drisw_lf
);
140 * Initialize a kms backed sw device given an fd.
142 * This function is platform-specific.
144 * \sa pipe_loader_probe
147 pipe_loader_sw_probe_kms(struct pipe_loader_device
**devs
, int fd
);
150 * Initialize a null sw device.
152 * This function is platform-specific.
154 * \sa pipe_loader_probe
157 pipe_loader_sw_probe_null(struct pipe_loader_device
**devs
);
160 * Get a list of known software devices.
162 * This function is platform-specific.
164 * \sa pipe_loader_probe
167 pipe_loader_sw_probe(struct pipe_loader_device
**devs
, int ndev
);
170 * Get a software device wrapped atop another device.
172 * This function is platform-specific.
174 * \sa pipe_loader_probe
177 pipe_loader_sw_probe_wrapped(struct pipe_loader_device
**dev
,
178 struct pipe_screen
*screen
);
181 * Get a list of known DRM devices.
183 * This function is platform-specific.
185 * \sa pipe_loader_probe
188 pipe_loader_drm_probe(struct pipe_loader_device
**devs
, int ndev
);
191 * Initialize a DRM device in an already opened fd.
193 * This function is platform-specific.
195 * \sa pipe_loader_probe
198 pipe_loader_drm_probe_fd(struct pipe_loader_device
**dev
, int fd
);
200 extern const char gallium_driinfo_xml
[];
206 #endif /* PIPE_LOADER_H */