Chia-I Wu | f2001df | 2011-07-02 17:57:30 +0900 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
José Fonseca | 8771285 | 2014-01-17 16:27:50 +0000 | [diff] [blame] | 3 | * Copyright 2008 VMware, Inc. |
Chia-I Wu | f2001df | 2011-07-02 17:57:30 +0900 | [diff] [blame] | 4 | * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
| 5 | * Copyright 2010-2011 LunarG, Inc. |
| 6 | * All Rights Reserved. |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 9 | * copy of this software and associated documentation files (the |
| 10 | * "Software"), to deal in the Software without restriction, including |
| 11 | * without limitation the rights to use, copy, modify, merge, publish, |
| 12 | * distribute, sub license, and/or sell copies of the Software, and to |
| 13 | * permit persons to whom the Software is furnished to do so, subject to |
| 14 | * the following conditions: |
| 15 | * |
| 16 | * The above copyright notice and this permission notice (including the |
| 17 | * next paragraph) shall be included in all copies or substantial portions |
| 18 | * of the Software. |
| 19 | * |
| 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 23 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 26 | * DEALINGS IN THE SOFTWARE. |
| 27 | * |
| 28 | **************************************************************************/ |
| 29 | |
| 30 | |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 31 | #ifndef EGLDRIVER_INCLUDED |
| 32 | #define EGLDRIVER_INCLUDED |
| 33 | |
| 34 | |
Emil Velikov | 7bd1693 | 2015-02-28 16:35:22 +0000 | [diff] [blame] | 35 | #include "c99_compat.h" |
| 36 | |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 37 | #include "egltypedefs.h" |
Brian Paul | daf585d | 2005-11-24 04:02:16 +0000 | [diff] [blame] | 38 | #include "eglapi.h" |
Thomas Hellstrom | 675aec8 | 2010-11-01 17:10:03 +0100 | [diff] [blame] | 39 | #include <stddef.h> |
Brian Paul | 5285c32 | 2005-11-29 04:43:37 +0000 | [diff] [blame] | 40 | |
Alexander von Gluck IV | 8362068 | 2015-05-13 17:13:37 -0500 | [diff] [blame] | 41 | |
| 42 | #ifdef __cplusplus |
| 43 | extern "C" { |
| 44 | #endif |
| 45 | |
Chia-I Wu | bdb9e20 | 2010-02-04 12:52:15 +0800 | [diff] [blame] | 46 | /** |
| 47 | * Define an inline driver typecast function. |
Chia-I Wu | cb260e1 | 2010-02-05 11:42:05 +0800 | [diff] [blame] | 48 | * |
| 49 | * Note that this macro defines a function and should not be ended with a |
| 50 | * semicolon when used. |
Chia-I Wu | bdb9e20 | 2010-02-04 12:52:15 +0800 | [diff] [blame] | 51 | */ |
| 52 | #define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \ |
Emil Velikov | 7bd1693 | 2015-02-28 16:35:22 +0000 | [diff] [blame] | 53 | static inline struct drvtype *drvtype(const egltype *obj) \ |
Chia-I Wu | bdb9e20 | 2010-02-04 12:52:15 +0800 | [diff] [blame] | 54 | { return (struct drvtype *) code; } |
| 55 | |
| 56 | |
| 57 | /** |
| 58 | * Define the driver typecast functions for _EGLDriver, _EGLDisplay, |
| 59 | * _EGLContext, _EGLSurface, and _EGLConfig. |
Chia-I Wu | cb260e1 | 2010-02-05 11:42:05 +0800 | [diff] [blame] | 60 | * |
| 61 | * Note that this macro defines several functions and should not be ended with |
| 62 | * a semicolon when used. |
Chia-I Wu | bdb9e20 | 2010-02-04 12:52:15 +0800 | [diff] [blame] | 63 | */ |
| 64 | #define _EGL_DRIVER_STANDARD_TYPECASTS(drvname) \ |
| 65 | _EGL_DRIVER_TYPECAST(drvname ## _driver, _EGLDriver, obj) \ |
| 66 | /* note that this is not a direct cast */ \ |
| 67 | _EGL_DRIVER_TYPECAST(drvname ## _display, _EGLDisplay, obj->DriverData) \ |
| 68 | _EGL_DRIVER_TYPECAST(drvname ## _context, _EGLContext, obj) \ |
| 69 | _EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \ |
| 70 | _EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj) |
| 71 | |
| 72 | |
Brian Paul | 5285c32 | 2005-11-29 04:43:37 +0000 | [diff] [blame] | 73 | /** |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 74 | * Base class for device drivers. |
| 75 | */ |
| 76 | struct _egl_driver |
| 77 | { |
Brian Paul | c56e15b | 2008-05-28 15:43:41 -0600 | [diff] [blame] | 78 | _EGLAPI API; /**< EGL API dispatch table */ |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | |
Eric Engestrom | cb0980e | 2017-09-25 22:35:24 +0100 | [diff] [blame] | 82 | extern void |
| 83 | _eglInitDriver(_EGLDriver *driver); |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 84 | |
| 85 | |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 86 | extern _EGLDriver * |
Eric Engestrom | 54fa5ec | 2019-02-02 11:38:45 +0000 | [diff] [blame] | 87 | _eglMatchDriver(_EGLDisplay *disp); |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 88 | |
| 89 | |
Chia-I Wu | f2aa361 | 2010-07-04 15:55:12 +0800 | [diff] [blame] | 90 | extern __eglMustCastToProperFunctionPointerType |
| 91 | _eglGetDriverProc(const char *procname); |
Chia-I Wu | b3bcd33 | 2010-01-19 18:13:50 +0800 | [diff] [blame] | 92 | |
| 93 | |
| 94 | extern void |
Chia-I Wu | 0eaa02c | 2009-08-13 13:01:48 +0800 | [diff] [blame] | 95 | _eglUnloadDrivers(void); |
Brian Paul | e3805ca | 2008-05-30 14:50:33 -0600 | [diff] [blame] | 96 | |
| 97 | |
Emil Velikov | dd438ae | 2015-02-28 17:20:01 +0000 | [diff] [blame] | 98 | extern void |
Chia-I Wu | e8ba281 | 2010-05-05 17:37:19 +0800 | [diff] [blame] | 99 | _eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *), |
| 100 | void *callback_data); |
| 101 | |
| 102 | |
Alexander von Gluck IV | 8362068 | 2015-05-13 17:13:37 -0500 | [diff] [blame] | 103 | #ifdef __cplusplus |
| 104 | } |
| 105 | #endif |
| 106 | |
| 107 | |
Brian Paul | adbff7e | 2005-04-22 21:09:39 +0000 | [diff] [blame] | 108 | #endif /* EGLDRIVER_INCLUDED */ |