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 <stddef.h> 35#include "egltypedefs.h" 36 37#ifdef __cplusplus 38extern "C" { 39#endif 40 41extern _EGLDevice _eglSoftwareDevice; 42 43void 44_eglFiniDevice(void); 45 46EGLBoolean 47_eglCheckDeviceHandle(EGLDeviceEXT device); 48 49static 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 61enum _egl_device_extension { 62 _EGL_DEVICE_SOFTWARE, 63 _EGL_DEVICE_DRM, 64}; 65 66typedef enum _egl_device_extension _EGLDeviceExtension; 67 68EGLBoolean 69_eglDeviceSupports(_EGLDevice *dev, _EGLDeviceExtension ext); 70 71EGLBoolean 72_eglQueryDeviceAttribEXT(_EGLDevice *dev, EGLint attribute, 73 EGLAttrib *value); 74 75const char * 76_eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name); 77 78EGLBoolean 79_eglQueryDevicesEXT(EGLint max_devices, _EGLDevice **devices, 80 EGLint *num_devices); 81 82#ifdef __cplusplus 83} 84#endif 85 86#endif /* EGLDEVICE_INCLUDED */ 87