Path: blob/21.2-virgl/src/gallium/auxiliary/pipe-loader/pipe_loader.h
4561 views
/**************************************************************************1*2* Copyright 2012 Francisco Jerez3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627/**28* \file Library that provides device enumeration and creation of29* winsys/pipe_screen instances.30*/3132#ifndef PIPE_LOADER_H33#define PIPE_LOADER_H3435#include "pipe/p_compiler.h"36#include "frontend/drm_driver.h"37#include "util/xmlconfig.h"3839#ifdef __cplusplus40extern "C" {41#endif4243struct pipe_screen;44struct drisw_loader_funcs;4546enum pipe_loader_device_type {47PIPE_LOADER_DEVICE_SOFTWARE,48PIPE_LOADER_DEVICE_PCI,49PIPE_LOADER_DEVICE_PLATFORM,50NUM_PIPE_LOADER_DEVICE_TYPES51};5253/**54* A device known to the pipe loader.55*/56struct pipe_loader_device {57enum pipe_loader_device_type type;5859union {60struct {61int vendor_id;62int chip_id;63} pci;64} u; /**< Discriminated by \a type */6566char *driver_name;67const struct pipe_loader_ops *ops;6869driOptionCache option_cache;70driOptionCache option_info;71};7273/**74* Get a list of known devices.75*76* \param devs Array that will be filled with pointers to the devices77* available in the system.78* \param ndev Maximum number of devices to return.79* \return Number of devices available in the system.80*/81int82pipe_loader_probe(struct pipe_loader_device **devs, int ndev);8384/**85* Create a pipe_screen for the specified device.86*87* \param dev Device the screen will be created for.88* \param sw_vk Device is for software vulkan89*/90struct pipe_screen *91pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk);9293/**94* Create a pipe_screen for the specified device.95*96* \param dev Device the screen will be created for.97*/98struct pipe_screen *99pipe_loader_create_screen(struct pipe_loader_device *dev);100101/**102* Ensure that dev->option_cache is initialized appropriately for the driver.103*104* This function can be called multiple times.105*106* \param dev Device for which options should be loaded.107*/108void109pipe_loader_load_options(struct pipe_loader_device *dev);110111/**112* Get the driinfo XML string used by the given driver.113*114* The returned string is heap-allocated.115*/116char *117pipe_loader_get_driinfo_xml(const char *driver_name);118119/**120* Release resources allocated for a list of devices.121*122* Should be called when the specified devices are no longer in use to123* release any resources allocated by pipe_loader_probe.124*125* \param devs Devices to release.126* \param ndev Number of devices to release.127*/128void129pipe_loader_release(struct pipe_loader_device **devs, int ndev);130131/**132* Initialize sw dri device give the drisw_loader_funcs.133*134* This function is platform-specific.135*136* Function does not take ownership of the fd, but duplicates it locally.137* The local fd is closed during pipe_loader_release.138*139* \sa pipe_loader_probe140*/141bool142pipe_loader_sw_probe_dri(struct pipe_loader_device **devs,143const struct drisw_loader_funcs *drisw_lf);144145/**146* Initialize a kms backed sw device given an fd.147*148* This function is platform-specific.149*150* Function does not take ownership of the fd, but duplicates it locally.151* The local fd is closed during pipe_loader_release.152*153* \sa pipe_loader_probe154*/155bool156pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd);157158/**159* Initialize a null sw device.160*161* This function is platform-specific.162*163* \sa pipe_loader_probe164*/165bool166pipe_loader_sw_probe_null(struct pipe_loader_device **devs);167168/**169* Get a list of known software devices.170*171* This function is platform-specific.172*173* \sa pipe_loader_probe174*/175int176pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev);177178/**179* Get a software device wrapped atop another device.180*181* This function is platform-specific.182*183* \sa pipe_loader_probe184*/185boolean186pipe_loader_sw_probe_wrapped(struct pipe_loader_device **dev,187struct pipe_screen *screen);188189/**190* Get a list of known DRM devices.191*192* This function is platform-specific.193*194* \sa pipe_loader_probe195*/196int197pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);198199/**200* Initialize a DRM device in an already opened fd.201*202* This function is platform-specific.203*204* \sa pipe_loader_probe205*/206bool207pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);208209/**210* Get the dri options used for the DRM driver of the given name, if any.211*212* The returned array is heap-allocated.213*/214const struct driOptionDescription *215pipe_loader_drm_get_driconf_by_name(const char *driver_name, unsigned *count);216217#ifdef __cplusplus218}219#endif220221#endif /* PIPE_LOADER_H */222223224