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 _EGL_DEVICE_DRM_RENDER_NODE, 65}; 66 67typedef enum _egl_device_extension _EGLDeviceExtension; 68 69EGLBoolean 70_eglDeviceSupports(_EGLDevice *dev, _EGLDeviceExtension ext); 71 72const char * 73_eglGetDRMDeviceRenderNode(_EGLDevice *dev); 74 75EGLBoolean 76_eglQueryDeviceAttribEXT(_EGLDevice *dev, EGLint attribute, 77 EGLAttrib *value); 78 79const char * 80_eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name); 81 82EGLBoolean 83_eglQueryDevicesEXT(EGLint max_devices, _EGLDevice **devices, 84 EGLint *num_devices); 85 86#ifdef __cplusplus 87} 88#endif 89 90#endif /* EGLDEVICE_INCLUDED */ 91