egl: add base EGL_EXT_device_base implementation
[mesa.git] / src / egl / main / egldevice.h
1 /**************************************************************************
2 *
3 * Copyright 2015, 2018 Collabora
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28
29 #ifndef EGLDEVICE_INCLUDED
30 #define EGLDEVICE_INCLUDED
31
32
33 #include <stdbool.h>
34 #include "egltypedefs.h"
35
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 void
42 _eglFiniDevice(void);
43
44 EGLBoolean
45 _eglCheckDeviceHandle(EGLDeviceEXT device);
46
47 static inline _EGLDevice *
48 _eglLookupDevice(EGLDeviceEXT device)
49 {
50 _EGLDevice *dev = (_EGLDevice *) device;
51 if (!_eglCheckDeviceHandle(device))
52 dev = NULL;
53 return dev;
54 }
55
56 _EGLDevice *
57 _eglAddDevice(int fd, bool software);
58
59 enum _egl_device_extension {
60 EGL_FOOBAR, /* A temporary entry, since enum with zero entries is illegal */
61 };
62
63 typedef enum _egl_device_extension _EGLDeviceExtension;
64
65 EGLBoolean
66 _eglDeviceSupports(_EGLDevice *dev, _EGLDeviceExtension ext);
67
68 EGLBoolean
69 _eglQueryDeviceAttribEXT(_EGLDevice *dev, EGLint attribute,
70 EGLAttrib *value);
71
72 const char *
73 _eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name);
74
75 EGLBoolean
76 _eglQueryDevicesEXT(EGLint max_devices, _EGLDevice **devices,
77 EGLint *num_devices);
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83 #endif /* EGLDEVICE_INCLUDED */