2012-04-25 21:16:00 +01:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright 2012 Francisco Jerez
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sub license, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
2012-04-25 21:16:00 +01:00
|
|
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file Library that provides device enumeration and creation of
|
|
|
|
* winsys/pipe_screen instances.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PIPE_LOADER_H
|
|
|
|
#define PIPE_LOADER_H
|
|
|
|
|
|
|
|
#include "pipe/p_compiler.h"
|
2019-12-03 23:01:31 +00:00
|
|
|
#include "frontend/drm_driver.h"
|
2017-06-28 16:50:19 +01:00
|
|
|
#include "util/xmlconfig.h"
|
2012-04-25 21:16:00 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct pipe_screen;
|
2014-02-22 03:21:40 +00:00
|
|
|
struct drisw_loader_funcs;
|
2012-04-25 21:16:00 +01:00
|
|
|
|
|
|
|
enum pipe_loader_device_type {
|
|
|
|
PIPE_LOADER_DEVICE_SOFTWARE,
|
|
|
|
PIPE_LOADER_DEVICE_PCI,
|
2014-01-11 05:19:36 +00:00
|
|
|
PIPE_LOADER_DEVICE_PLATFORM,
|
2012-04-25 21:16:00 +01:00
|
|
|
NUM_PIPE_LOADER_DEVICE_TYPES
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A device known to the pipe loader.
|
|
|
|
*/
|
|
|
|
struct pipe_loader_device {
|
|
|
|
enum pipe_loader_device_type type;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
int vendor_id;
|
|
|
|
int chip_id;
|
|
|
|
} pci;
|
2012-05-16 14:43:29 +01:00
|
|
|
} u; /**< Discriminated by \a type */
|
2012-04-25 21:16:00 +01:00
|
|
|
|
2014-08-19 22:04:32 +01:00
|
|
|
char *driver_name;
|
2012-04-25 21:16:00 +01:00
|
|
|
const struct pipe_loader_ops *ops;
|
2017-06-28 16:50:19 +01:00
|
|
|
|
|
|
|
driOptionCache option_cache;
|
|
|
|
driOptionCache option_info;
|
2012-04-25 21:16:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a list of known devices.
|
|
|
|
*
|
|
|
|
* \param devs Array that will be filled with pointers to the devices
|
|
|
|
* available in the system.
|
|
|
|
* \param ndev Maximum number of devices to return.
|
|
|
|
* \return Number of devices available in the system.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
pipe_loader_probe(struct pipe_loader_device **devs, int ndev);
|
|
|
|
|
2021-06-29 20:22:58 +01:00
|
|
|
/**
|
|
|
|
* Create a pipe_screen for the specified device.
|
|
|
|
*
|
|
|
|
* \param dev Device the screen will be created for.
|
|
|
|
* \param sw_vk Device is for software vulkan
|
|
|
|
*/
|
|
|
|
struct pipe_screen *
|
|
|
|
pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk);
|
|
|
|
|
2012-04-25 21:16:00 +01:00
|
|
|
/**
|
|
|
|
* Create a pipe_screen for the specified device.
|
|
|
|
*
|
|
|
|
* \param dev Device the screen will be created for.
|
|
|
|
*/
|
|
|
|
struct pipe_screen *
|
2017-08-03 14:02:09 +01:00
|
|
|
pipe_loader_create_screen(struct pipe_loader_device *dev);
|
2012-04-25 21:16:00 +01:00
|
|
|
|
2017-06-28 16:50:19 +01:00
|
|
|
/**
|
2021-07-30 22:35:53 +01:00
|
|
|
* Ensures that the driconf option cache has been parsed for the driver.
|
2017-06-28 16:50:19 +01:00
|
|
|
*
|
2021-07-30 22:35:53 +01:00
|
|
|
* Drivers may parse during screen creation, but for those that don't (probably
|
|
|
|
* due to not having any driver-specific driconf options), this can be used to
|
|
|
|
* finish the parsing so that general driconf options can be queried.
|
2017-06-28 16:50:19 +01:00
|
|
|
*/
|
|
|
|
void
|
2021-07-30 22:35:53 +01:00
|
|
|
pipe_loader_config_options(struct pipe_loader_device *dev);
|
2017-06-28 16:50:19 +01:00
|
|
|
|
2017-06-30 10:06:06 +01:00
|
|
|
/**
|
|
|
|
* Get the driinfo XML string used by the given driver.
|
|
|
|
*
|
|
|
|
* The returned string is heap-allocated.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
pipe_loader_get_driinfo_xml(const char *driver_name);
|
|
|
|
|
2012-04-25 21:16:00 +01:00
|
|
|
/**
|
|
|
|
* Release resources allocated for a list of devices.
|
|
|
|
*
|
|
|
|
* Should be called when the specified devices are no longer in use to
|
|
|
|
* release any resources allocated by pipe_loader_probe.
|
|
|
|
*
|
|
|
|
* \param devs Devices to release.
|
|
|
|
* \param ndev Number of devices to release.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
pipe_loader_release(struct pipe_loader_device **devs, int ndev);
|
|
|
|
|
2014-02-22 03:21:40 +00:00
|
|
|
/**
|
|
|
|
* Initialize sw dri device give the drisw_loader_funcs.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
2018-08-30 17:24:16 +01:00
|
|
|
* Function does not take ownership of the fd, but duplicates it locally.
|
|
|
|
* The local fd is closed during pipe_loader_release.
|
|
|
|
*
|
2014-02-22 03:21:40 +00:00
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
pipe_loader_sw_probe_dri(struct pipe_loader_device **devs,
|
2018-11-23 15:02:27 +00:00
|
|
|
const struct drisw_loader_funcs *drisw_lf);
|
2014-02-22 03:21:40 +00:00
|
|
|
|
2022-03-15 19:36:28 +00:00
|
|
|
/**
|
|
|
|
* Initialize vk dri device give the drisw_loader_funcs.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
|
|
|
* Function does not take ownership of the fd, but duplicates it locally.
|
|
|
|
* The local fd is closed during pipe_loader_release.
|
|
|
|
*
|
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
pipe_loader_vk_probe_dri(struct pipe_loader_device **devs,
|
|
|
|
const struct drisw_loader_funcs *drisw_lf);
|
|
|
|
|
2022-07-28 06:54:55 +01:00
|
|
|
#ifdef HAVE_PIPE_LOADER_KMS
|
2015-10-14 16:24:55 +01:00
|
|
|
/**
|
|
|
|
* Initialize a kms backed sw device given an fd.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
2018-08-29 18:13:14 +01:00
|
|
|
* Function does not take ownership of the fd, but duplicates it locally.
|
|
|
|
* The local fd is closed during pipe_loader_release.
|
|
|
|
*
|
2015-10-14 16:24:55 +01:00
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd);
|
2022-07-28 06:54:55 +01:00
|
|
|
#endif
|
2015-10-14 16:24:55 +01:00
|
|
|
|
2014-02-10 21:04:40 +00:00
|
|
|
/**
|
|
|
|
* Initialize a null sw device.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
pipe_loader_sw_probe_null(struct pipe_loader_device **devs);
|
|
|
|
|
2012-04-25 21:16:00 +01:00
|
|
|
/**
|
|
|
|
* Get a list of known software devices.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev);
|
|
|
|
|
2014-11-17 15:58:24 +00:00
|
|
|
/**
|
|
|
|
* Get a software device wrapped atop another device.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
|
|
|
boolean
|
|
|
|
pipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev,
|
|
|
|
struct pipe_screen *screen);
|
|
|
|
|
2012-04-25 21:16:00 +01:00
|
|
|
/**
|
|
|
|
* Get a list of known DRM devices.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize a DRM device in an already opened fd.
|
|
|
|
*
|
|
|
|
* This function is platform-specific.
|
|
|
|
*
|
|
|
|
* \sa pipe_loader_probe
|
|
|
|
*/
|
2014-02-22 03:15:42 +00:00
|
|
|
bool
|
2015-06-29 12:44:44 +01:00
|
|
|
pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
|
2012-04-25 21:16:00 +01:00
|
|
|
|
2017-06-30 10:06:06 +01:00
|
|
|
/**
|
2020-09-25 20:56:22 +01:00
|
|
|
* Get the dri options used for the DRM driver of the given name, if any.
|
2017-06-30 10:06:06 +01:00
|
|
|
*
|
2020-09-25 20:56:22 +01:00
|
|
|
* The returned array is heap-allocated.
|
2017-06-30 10:06:06 +01:00
|
|
|
*/
|
2020-09-25 20:56:22 +01:00
|
|
|
const struct driOptionDescription *
|
|
|
|
pipe_loader_drm_get_driconf_by_name(const char *driver_name, unsigned *count);
|
2017-06-29 16:37:18 +01:00
|
|
|
|
2012-04-25 21:16:00 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* PIPE_LOADER_H */
|