blob: 1a5238af298899c92544467c2a9bb696caa885df [file] [log] [blame]
Chia-I Wuf2001df2011-07-02 17:57:30 +09001/**************************************************************************
2 *
José Fonseca87712852014-01-17 16:27:50 +00003 * Copyright 2008 VMware, Inc.
Chia-I Wuf2001df2011-07-02 17:57:30 +09004 * 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 Pauladbff7e2005-04-22 21:09:39 +000031#ifndef EGLDRIVER_INCLUDED
32#define EGLDRIVER_INCLUDED
33
34
Emil Velikov7bd16932015-02-28 16:35:22 +000035#include "c99_compat.h"
36
Brian Pauladbff7e2005-04-22 21:09:39 +000037#include "egltypedefs.h"
Brian Pauldaf585d2005-11-24 04:02:16 +000038#include "eglapi.h"
Thomas Hellstrom675aec82010-11-01 17:10:03 +010039#include <stddef.h>
Brian Paul5285c322005-11-29 04:43:37 +000040
Alexander von Gluck IV83620682015-05-13 17:13:37 -050041
42#ifdef __cplusplus
43extern "C" {
44#endif
45
Chia-I Wubdb9e202010-02-04 12:52:15 +080046/**
47 * Define an inline driver typecast function.
Chia-I Wucb260e12010-02-05 11:42:05 +080048 *
49 * Note that this macro defines a function and should not be ended with a
50 * semicolon when used.
Chia-I Wubdb9e202010-02-04 12:52:15 +080051 */
52#define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \
Emil Velikov7bd16932015-02-28 16:35:22 +000053 static inline struct drvtype *drvtype(const egltype *obj) \
Chia-I Wubdb9e202010-02-04 12:52:15 +080054 { return (struct drvtype *) code; }
55
56
57/**
58 * Define the driver typecast functions for _EGLDriver, _EGLDisplay,
59 * _EGLContext, _EGLSurface, and _EGLConfig.
Chia-I Wucb260e12010-02-05 11:42:05 +080060 *
61 * Note that this macro defines several functions and should not be ended with
62 * a semicolon when used.
Chia-I Wubdb9e202010-02-04 12:52:15 +080063 */
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 Paul5285c322005-11-29 04:43:37 +000073/**
Brian Pauladbff7e2005-04-22 21:09:39 +000074 * Base class for device drivers.
75 */
76struct _egl_driver
77{
Brian Paulc56e15b2008-05-28 15:43:41 -060078 _EGLAPI API; /**< EGL API dispatch table */
Brian Pauladbff7e2005-04-22 21:09:39 +000079};
80
81
Eric Engestromcb0980e2017-09-25 22:35:24 +010082extern void
83_eglInitDriver(_EGLDriver *driver);
Brian Pauladbff7e2005-04-22 21:09:39 +000084
85
Brian Pauladbff7e2005-04-22 21:09:39 +000086extern _EGLDriver *
Eric Engestrom54fa5ec2019-02-02 11:38:45 +000087_eglMatchDriver(_EGLDisplay *disp);
Brian Pauladbff7e2005-04-22 21:09:39 +000088
89
Chia-I Wuf2aa3612010-07-04 15:55:12 +080090extern __eglMustCastToProperFunctionPointerType
91_eglGetDriverProc(const char *procname);
Chia-I Wub3bcd332010-01-19 18:13:50 +080092
93
94extern void
Chia-I Wu0eaa02c2009-08-13 13:01:48 +080095_eglUnloadDrivers(void);
Brian Paule3805ca2008-05-30 14:50:33 -060096
97
Emil Velikovdd438ae2015-02-28 17:20:01 +000098extern void
Chia-I Wue8ba2812010-05-05 17:37:19 +080099_eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *),
100 void *callback_data);
101
102
Alexander von Gluck IV83620682015-05-13 17:13:37 -0500103#ifdef __cplusplus
104}
105#endif
106
107
Brian Pauladbff7e2005-04-22 21:09:39 +0000108#endif /* EGLDRIVER_INCLUDED */