1e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/************************************************************************** 2e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 3e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Copyright 2012 Francisco Jerez 4e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * All Rights Reserved. 5e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 6e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Permission is hereby granted, free of charge, to any person obtaining a 7e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * copy of this software and associated documentation files (the 8e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * "Software"), to deal in the Software without restriction, including 9e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * without limitation the rights to use, copy, modify, merge, publish, 10e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * distribute, sub license, and/or sell copies of the Software, and to 11e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * permit persons to whom the Software is furnished to do so, subject to 12e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * the following conditions: 13e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 14e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * The above copyright notice and this permission notice (including the 15e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * next paragraph) shall be included in all copies or substantial portions 16e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * of the Software. 17e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 18e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21877128505431adaf817dc8069172ebe4a1cdf5d8José Fonseca * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 26e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez **************************************************************************/ 27e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 28e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 29e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \file Library that provides device enumeration and creation of 30e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * winsys/pipe_screen instances. 31e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 32e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 33e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#ifndef PIPE_LOADER_H 34e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#define PIPE_LOADER_H 35e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 36e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#include "pipe/p_compiler.h" 3736ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov#include "state_tracker/drm_driver.h" 38e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 39e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#ifdef __cplusplus 40e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezextern "C" { 41e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#endif 42e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 43e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezstruct pipe_screen; 44969e8d15b77434a0505e883557529ed1073583a6Emil Velikovstruct drisw_loader_funcs; 45e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 46e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezenum pipe_loader_device_type { 47e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez PIPE_LOADER_DEVICE_SOFTWARE, 48e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez PIPE_LOADER_DEVICE_PCI, 4926458420d8802a765cf71c75ef9f3b6da6bdfd8dEmil Velikov PIPE_LOADER_DEVICE_PLATFORM, 50e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez NUM_PIPE_LOADER_DEVICE_TYPES 51e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez}; 52e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 53e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 54e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * A device known to the pipe loader. 55e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 56e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezstruct pipe_loader_device { 57e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez enum pipe_loader_device_type type; 58e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 59e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez union { 60e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez struct { 61e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez int vendor_id; 62e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez int chip_id; 63e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez } pci; 6403e3bc4ba56f1021899a5f773b6ec21893619e3aFrancisco Jerez } u; /**< Discriminated by \a type */ 65e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 6643d954342e02a2bd719e543d567fd6c43b3e5367Tom Stellard char *driver_name; 67e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez const struct pipe_loader_ops *ops; 68e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez}; 69e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 70e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 71e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Get a list of known devices. 72e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 73e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \param devs Array that will be filled with pointers to the devices 74e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * available in the system. 75e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \param ndev Maximum number of devices to return. 76e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \return Number of devices available in the system. 77e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 78e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezint 79e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezpipe_loader_probe(struct pipe_loader_device **devs, int ndev); 80e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 81e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 82e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Create a pipe_screen for the specified device. 83e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 84e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \param dev Device the screen will be created for. 85e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 86e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezstruct pipe_screen * 8774d41a32bc179425e866f8afa33a222488ea7760Emil Velikovpipe_loader_create_screen(struct pipe_loader_device *dev); 88e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 89e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 9036ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov * Query the configuration parameters for the specified device. 9136ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov * 9236ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov * \param dev Device that will be queried. 9336ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov * \param conf The drm_conf id of the option to be queried. 9436ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov */ 9536ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikovconst struct drm_conf_ret * 9636ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikovpipe_loader_configuration(struct pipe_loader_device *dev, 9736ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov enum drm_conf conf); 9836ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov 9936ff20027c43cd7115f1b6f073e4094582f643b6Emil Velikov/** 100e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Release resources allocated for a list of devices. 101e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 102e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Should be called when the specified devices are no longer in use to 103e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * release any resources allocated by pipe_loader_probe. 104e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 105e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \param devs Devices to release. 106e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \param ndev Number of devices to release. 107e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 108e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezvoid 109e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezpipe_loader_release(struct pipe_loader_device **devs, int ndev); 110e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 111e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 112969e8d15b77434a0505e883557529ed1073583a6Emil Velikov * Initialize sw dri device give the drisw_loader_funcs. 113969e8d15b77434a0505e883557529ed1073583a6Emil Velikov * 114969e8d15b77434a0505e883557529ed1073583a6Emil Velikov * This function is platform-specific. 115969e8d15b77434a0505e883557529ed1073583a6Emil Velikov * 116969e8d15b77434a0505e883557529ed1073583a6Emil Velikov * \sa pipe_loader_probe 117969e8d15b77434a0505e883557529ed1073583a6Emil Velikov */ 118969e8d15b77434a0505e883557529ed1073583a6Emil Velikovbool 119969e8d15b77434a0505e883557529ed1073583a6Emil Velikovpipe_loader_sw_probe_dri(struct pipe_loader_device **devs, 120969e8d15b77434a0505e883557529ed1073583a6Emil Velikov struct drisw_loader_funcs *drisw_lf); 121969e8d15b77434a0505e883557529ed1073583a6Emil Velikov 122969e8d15b77434a0505e883557529ed1073583a6Emil Velikov/** 12333f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov * Initialize a kms backed sw device given an fd. 12433f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov * 12533f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov * This function is platform-specific. 12633f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov * 12733f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov * \sa pipe_loader_probe 12833f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov */ 12933f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikovbool 13033f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikovpipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd); 13133f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov 13233f1db1eb412382d2bd6552369e6f63bad52ca8dEmil Velikov/** 133dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov * Initialize a null sw device. 134dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov * 135dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov * This function is platform-specific. 136dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov * 137dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov * \sa pipe_loader_probe 138dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov */ 139dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikovbool 140dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikovpipe_loader_sw_probe_null(struct pipe_loader_device **devs); 141dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov 142dcbf404c0d1e9a40e0e75562e5112f53f95abe9dEmil Velikov/** 143e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Get a list of known software devices. 144e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 145e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * This function is platform-specific. 146e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 147e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \sa pipe_loader_probe 148e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 149e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezint 150e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezpipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev); 151e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 152e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller/** 153e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller * Get a software device wrapped atop another device. 154e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller * 155e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller * This function is platform-specific. 156e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller * 157e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller * \sa pipe_loader_probe 158e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller */ 159e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumillerboolean 160e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumillerpipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev, 161e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller struct pipe_screen *screen); 162e23d63cffd6103b8073c61f2740eb654c5c9b2c3Christoph Bumiller 163e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 164e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Get a list of known DRM devices. 165e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 166e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * This function is platform-specific. 167e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 168e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \sa pipe_loader_probe 169e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 170e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezint 171e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerezpipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev); 172e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 173e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez/** 174e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * Initialize a DRM device in an already opened fd. 175e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 176e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * This function is platform-specific. 177e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * 178e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez * \sa pipe_loader_probe 179e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez */ 1806325fdd6cf69aeefdf54d5725ad1242844e4e2afEmil Velikovbool 1810959d7312d37dd9841cbf7a53cb40b3cfa6e5fc9Emil Velikovpipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd); 182e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 183e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#ifdef __cplusplus 184e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez} 185e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#endif 186e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez 187e1364530622a26f11c79694429cf84418a0b7ef7Francisco Jerez#endif /* PIPE_LOADER_H */ 188