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"
44 struct drisw_loader_funcs
;
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
54 * A device known to the pipe loader.
56 struct pipe_loader_device
{
57 enum pipe_loader_device_type type
;
64 } u
; /**< Discriminated by \a type */
67 const struct pipe_loader_ops
*ops
;
71 * Get a list of known devices.
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.
79 pipe_loader_probe(struct pipe_loader_device
**devs
, int ndev
);
82 * Create a pipe_screen for the specified device.
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.
90 pipe_loader_create_screen(struct pipe_loader_device
*dev
,
91 const char *library_paths
);
94 * Query the configuration parameters for the specified device.
96 * \param dev Device that will be queried.
97 * \param conf The drm_conf id of the option to be queried.
99 const struct drm_conf_ret
*
100 pipe_loader_configuration(struct pipe_loader_device
*dev
,
104 * Release resources allocated for a list of devices.
106 * Should be called when the specified devices are no longer in use to
107 * release any resources allocated by pipe_loader_probe.
109 * \param devs Devices to release.
110 * \param ndev Number of devices to release.
113 pipe_loader_release(struct pipe_loader_device
**devs
, int ndev
);
116 * Initialize sw dri device give the drisw_loader_funcs.
118 * This function is platform-specific.
120 * \sa pipe_loader_probe
123 pipe_loader_sw_probe_dri(struct pipe_loader_device
**devs
,
124 struct drisw_loader_funcs
*drisw_lf
);
127 * Initialize a null sw device.
129 * This function is platform-specific.
131 * \sa pipe_loader_probe
134 pipe_loader_sw_probe_null(struct pipe_loader_device
**devs
);
137 * Get a list of known software devices.
139 * This function is platform-specific.
141 * \sa pipe_loader_probe
144 pipe_loader_sw_probe(struct pipe_loader_device
**devs
, int ndev
);
147 * Get a software device wrapped atop another device.
149 * This function is platform-specific.
151 * \sa pipe_loader_probe
154 pipe_loader_sw_probe_wrapped(struct pipe_loader_device
**dev
,
155 struct pipe_screen
*screen
);
158 * Get a list of known DRM devices.
160 * This function is platform-specific.
162 * \sa pipe_loader_probe
165 pipe_loader_drm_probe(struct pipe_loader_device
**devs
, int ndev
);
168 * Initialize a DRM device in an already opened fd.
170 * This function is platform-specific.
172 * \sa pipe_loader_probe
175 pipe_loader_drm_probe_fd(struct pipe_loader_device
**dev
, int fd
);
181 #endif /* PIPE_LOADER_H */