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.
87 pipe_loader_create_screen(struct pipe_loader_device
*dev
);
90 * Query the configuration parameters for the specified device.
92 * \param dev Device that will be queried.
93 * \param conf The drm_conf id of the option to be queried.
95 const struct drm_conf_ret
*
96 pipe_loader_configuration(struct pipe_loader_device
*dev
,
100 * Release resources allocated for a list of devices.
102 * Should be called when the specified devices are no longer in use to
103 * release any resources allocated by pipe_loader_probe.
105 * \param devs Devices to release.
106 * \param ndev Number of devices to release.
109 pipe_loader_release(struct pipe_loader_device
**devs
, int ndev
);
112 * Initialize sw dri device give the drisw_loader_funcs.
114 * This function is platform-specific.
116 * \sa pipe_loader_probe
119 pipe_loader_sw_probe_dri(struct pipe_loader_device
**devs
,
120 struct drisw_loader_funcs
*drisw_lf
);
123 * Initialize a kms backed sw device given an fd.
125 * This function is platform-specific.
127 * \sa pipe_loader_probe
130 pipe_loader_sw_probe_kms(struct pipe_loader_device
**devs
, int fd
);
133 * Initialize a null sw device.
135 * This function is platform-specific.
137 * \sa pipe_loader_probe
140 pipe_loader_sw_probe_null(struct pipe_loader_device
**devs
);
143 * Get a list of known software devices.
145 * This function is platform-specific.
147 * \sa pipe_loader_probe
150 pipe_loader_sw_probe(struct pipe_loader_device
**devs
, int ndev
);
153 * Get a software device wrapped atop another device.
155 * This function is platform-specific.
157 * \sa pipe_loader_probe
160 pipe_loader_sw_probe_wrapped(struct pipe_loader_device
**dev
,
161 struct pipe_screen
*screen
);
164 * Get a list of known DRM devices.
166 * This function is platform-specific.
168 * \sa pipe_loader_probe
171 pipe_loader_drm_probe(struct pipe_loader_device
**devs
, int ndev
);
174 * Initialize a DRM device in an already opened fd.
176 * This function is platform-specific.
178 * \sa pipe_loader_probe
181 pipe_loader_drm_probe_fd(struct pipe_loader_device
**dev
, int fd
);
187 #endif /* PIPE_LOADER_H */