/*1* Copyright (C) 2013 Rob Clark <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*22* Authors:23* Rob Clark <[email protected]>24*/2526#ifndef LOADER_H27#define LOADER_H2829#include <stdbool.h>3031#ifdef __cplusplus32extern "C" {33#endif3435struct __DRIextensionRec;3637/* Helpers to figure out driver and device name, eg. from pci-id, etc. */3839int40loader_open_device(const char *);4142int43loader_open_render_node(const char *name);4445bool46loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id);4748char *49loader_get_driver_for_fd(int fd);5051void *52loader_open_driver_lib(const char *driver_name,53const char *lib_suffix,54const char **search_path_vars,55const char *default_search_path,56bool warn_on_fail);5758const struct __DRIextensionRec **59loader_open_driver(const char *driver_name,60void **out_driver_handle,61const char **search_path_vars);6263char *64loader_get_device_name_for_fd(int fd);6566/* Function to get a different device than the one we are to use by default,67* if the user requests so and it is possible. The initial fd will be closed68* if necessary. The returned fd is potentially a render-node.69*/7071int72loader_get_user_preferred_fd(int default_fd, bool *different_device);7374/* for logging.. keep this aligned with egllog.h so we can just use75* _eglLog directly.76*/7778#define _LOADER_FATAL 0 /* unrecoverable error */79#define _LOADER_WARNING 1 /* recoverable error/problem */80#define _LOADER_INFO 2 /* just useful info */81#define _LOADER_DEBUG 3 /* useful info for debugging */8283typedef void loader_logger(int level, const char *fmt, ...);84void85loader_set_logger(loader_logger *logger);8687char *88loader_get_extensions_name(const char *driver_name);8990#ifdef __cplusplus91}92#endif9394#endif /* LOADER_H */959697