egl: add EGL_MESA_device_software support
[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 extern _EGLDevice _eglSoftwareDevice;
42
43 void
44 _eglFiniDevice(void);
45
46 EGLBoolean
47 _eglCheckDeviceHandle(EGLDeviceEXT device);
48
49 static inline _EGLDevice *
50 _eglLookupDevice(EGLDeviceEXT device)
51 {
52 _EGLDevice *dev = (_EGLDevice *) device;
53 if (!_eglCheckDeviceHandle(device))
54 dev = NULL;
55 return dev;
56 }
57
58 _EGLDevice *
59 _eglAddDevice(int fd, bool software);
60
61 enum _egl_device_extension {
62 _EGL_DEVICE_SOFTWARE,
63 };
64
65 typedef enum _egl_device_extension _EGLDeviceExtension;
66
67 EGLBoolean
68 _eglDeviceSupports(_EGLDevice *dev, _EGLDeviceExtension ext);
69
70 EGLBoolean
71 _eglQueryDeviceAttribEXT(_EGLDevice *dev, EGLint attribute,
72 EGLAttrib *value);
73
74 const char *
75 _eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name);
76
77 EGLBoolean
78 _eglQueryDevicesEXT(EGLint max_devices, _EGLDevice **devices,
79 EGLint *num_devices);
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif /* EGLDEVICE_INCLUDED */