egldriver.h revision cdc920a0
14a49301eSmrg#ifndef EGLDRIVER_INCLUDED 24a49301eSmrg#define EGLDRIVER_INCLUDED 34a49301eSmrg 44a49301eSmrg 54a49301eSmrg#include "egltypedefs.h" 64a49301eSmrg#include "eglapi.h" 74a49301eSmrg 84a49301eSmrg 9cdc920a0Smrg/** 10cdc920a0Smrg * Define an inline driver typecast function. 11cdc920a0Smrg * 12cdc920a0Smrg * Note that this macro defines a function and should not be ended with a 13cdc920a0Smrg * semicolon when used. 14cdc920a0Smrg */ 15cdc920a0Smrg#define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \ 16cdc920a0Smrg static INLINE struct drvtype *drvtype(const egltype *obj) \ 17cdc920a0Smrg { return (struct drvtype *) code; } 18cdc920a0Smrg 19cdc920a0Smrg 20cdc920a0Smrg/** 21cdc920a0Smrg * Define the driver typecast functions for _EGLDriver, _EGLDisplay, 22cdc920a0Smrg * _EGLContext, _EGLSurface, and _EGLConfig. 23cdc920a0Smrg * 24cdc920a0Smrg * Note that this macro defines several functions and should not be ended with 25cdc920a0Smrg * a semicolon when used. 26cdc920a0Smrg */ 27cdc920a0Smrg#define _EGL_DRIVER_STANDARD_TYPECASTS(drvname) \ 28cdc920a0Smrg _EGL_DRIVER_TYPECAST(drvname ## _driver, _EGLDriver, obj) \ 29cdc920a0Smrg /* note that this is not a direct cast */ \ 30cdc920a0Smrg _EGL_DRIVER_TYPECAST(drvname ## _display, _EGLDisplay, obj->DriverData) \ 31cdc920a0Smrg _EGL_DRIVER_TYPECAST(drvname ## _context, _EGLContext, obj) \ 32cdc920a0Smrg _EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \ 33cdc920a0Smrg _EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj) 34cdc920a0Smrg 35cdc920a0Smrg 36cdc920a0Smrgtypedef _EGLDriver *(*_EGLMain_t)(const char *args); 37cdc920a0Smrg 38cdc920a0Smrg 394a49301eSmrg/** 404a49301eSmrg * Base class for device drivers. 414a49301eSmrg */ 424a49301eSmrgstruct _egl_driver 434a49301eSmrg{ 444a49301eSmrg void *LibHandle; /**< dlopen handle */ 454a49301eSmrg const char *Path; /**< path to this driver */ 464a49301eSmrg const char *Args; /**< args to load this driver */ 474a49301eSmrg 484a49301eSmrg const char *Name; /**< name of this driver */ 49cdc920a0Smrg 50cdc920a0Smrg /** 51cdc920a0Smrg * Probe a display and return a score. 52cdc920a0Smrg * 53cdc920a0Smrg * Roughly, 54cdc920a0Smrg * 50 means the driver supports the display; 55cdc920a0Smrg * 90 means the driver can accelerate the display; 56cdc920a0Smrg * 100 means a perfect match. 57cdc920a0Smrg */ 58cdc920a0Smrg EGLint (*Probe)(_EGLDriver *drv, _EGLDisplay *dpy); 59cdc920a0Smrg 60cdc920a0Smrg /** 61cdc920a0Smrg * Release the driver resource. 62cdc920a0Smrg * 63cdc920a0Smrg * It is called before dlclose(). 64cdc920a0Smrg */ 654a49301eSmrg void (*Unload)(_EGLDriver *drv); 664a49301eSmrg 674a49301eSmrg _EGLAPI API; /**< EGL API dispatch table */ 684a49301eSmrg}; 694a49301eSmrg 704a49301eSmrg 71cdc920a0SmrgPUBLIC _EGLDriver * 72cdc920a0Smrg_eglMain(const char *args); 734a49301eSmrg 744a49301eSmrg 754a49301eSmrgextern _EGLDriver * 76cdc920a0Smrg_eglMatchDriver(_EGLDisplay *dpy); 774a49301eSmrg 784a49301eSmrg 794a49301eSmrgextern EGLBoolean 80cdc920a0Smrg_eglPreloadDrivers(void); 814a49301eSmrg 824a49301eSmrg 83cdc920a0Smrgextern void 844a49301eSmrg_eglUnloadDrivers(void); 854a49301eSmrg 864a49301eSmrg 87cdc920a0SmrgPUBLIC void 88cdc920a0Smrg_eglInitDriverFallbacks(_EGLDriver *drv); 894a49301eSmrg 904a49301eSmrg 91cdc920a0SmrgPUBLIC void 92cdc920a0Smrg_eglSetProbeCache(EGLint key, const void *val); 934a49301eSmrg 944a49301eSmrg 95cdc920a0SmrgPUBLIC const void * 96cdc920a0Smrg_eglGetProbeCache(EGLint key); 974a49301eSmrg 984a49301eSmrg 994a49301eSmrg#endif /* EGLDRIVER_INCLUDED */ 100