101e04c3fSmrg/**************************************************************************
201e04c3fSmrg *
301e04c3fSmrg * Copyright 2015, 2018 Collabora
401e04c3fSmrg * All Rights Reserved.
501e04c3fSmrg *
601e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
701e04c3fSmrg * copy of this software and associated documentation files (the
801e04c3fSmrg * "Software"), to deal in the Software without restriction, including
901e04c3fSmrg * without limitation the rights to use, copy, modify, merge, publish,
1001e04c3fSmrg * distribute, sub license, and/or sell copies of the Software, and to
1101e04c3fSmrg * permit persons to whom the Software is furnished to do so, subject to
1201e04c3fSmrg * the following conditions:
1301e04c3fSmrg *
1401e04c3fSmrg * The above copyright notice and this permission notice (including the
1501e04c3fSmrg * next paragraph) shall be included in all copies or substantial portions
1601e04c3fSmrg * of the Software.
1701e04c3fSmrg *
1801e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1901e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2001e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2101e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2201e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2301e04c3fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2401e04c3fSmrg * DEALINGS IN THE SOFTWARE.
2501e04c3fSmrg *
2601e04c3fSmrg **************************************************************************/
2701e04c3fSmrg
2801e04c3fSmrg
2901e04c3fSmrg#ifndef EGLDEVICE_INCLUDED
3001e04c3fSmrg#define EGLDEVICE_INCLUDED
3101e04c3fSmrg
3201e04c3fSmrg
3301e04c3fSmrg#include <stdbool.h>
347e102996Smaya#include <stddef.h>
3501e04c3fSmrg#include "egltypedefs.h"
3601e04c3fSmrg
3701e04c3fSmrg#ifdef __cplusplus
3801e04c3fSmrgextern "C" {
3901e04c3fSmrg#endif
4001e04c3fSmrg
4101e04c3fSmrgextern _EGLDevice _eglSoftwareDevice;
4201e04c3fSmrg
4301e04c3fSmrgvoid
4401e04c3fSmrg_eglFiniDevice(void);
4501e04c3fSmrg
4601e04c3fSmrgEGLBoolean
4701e04c3fSmrg_eglCheckDeviceHandle(EGLDeviceEXT device);
4801e04c3fSmrg
4901e04c3fSmrgstatic inline _EGLDevice *
5001e04c3fSmrg_eglLookupDevice(EGLDeviceEXT device)
5101e04c3fSmrg{
5201e04c3fSmrg   _EGLDevice *dev = (_EGLDevice *) device;
5301e04c3fSmrg   if (!_eglCheckDeviceHandle(device))
5401e04c3fSmrg      dev = NULL;
5501e04c3fSmrg   return dev;
5601e04c3fSmrg}
5701e04c3fSmrg
5801e04c3fSmrg_EGLDevice *
5901e04c3fSmrg_eglAddDevice(int fd, bool software);
6001e04c3fSmrg
6101e04c3fSmrgenum _egl_device_extension {
6201e04c3fSmrg   _EGL_DEVICE_SOFTWARE,
6301e04c3fSmrg   _EGL_DEVICE_DRM,
647ec681f3Smrg   _EGL_DEVICE_DRM_RENDER_NODE,
6501e04c3fSmrg};
6601e04c3fSmrg
6701e04c3fSmrgtypedef enum _egl_device_extension _EGLDeviceExtension;
6801e04c3fSmrg
6901e04c3fSmrgEGLBoolean
7001e04c3fSmrg_eglDeviceSupports(_EGLDevice *dev, _EGLDeviceExtension ext);
7101e04c3fSmrg
727ec681f3Smrgconst char *
737ec681f3Smrg_eglGetDRMDeviceRenderNode(_EGLDevice *dev);
747ec681f3Smrg
7501e04c3fSmrgEGLBoolean
7601e04c3fSmrg_eglQueryDeviceAttribEXT(_EGLDevice *dev, EGLint attribute,
7701e04c3fSmrg                         EGLAttrib *value);
7801e04c3fSmrg
7901e04c3fSmrgconst char *
8001e04c3fSmrg_eglQueryDeviceStringEXT(_EGLDevice *dev, EGLint name);
8101e04c3fSmrg
8201e04c3fSmrgEGLBoolean
8301e04c3fSmrg_eglQueryDevicesEXT(EGLint max_devices, _EGLDevice **devices,
8401e04c3fSmrg                    EGLint *num_devices);
8501e04c3fSmrg
8601e04c3fSmrg#ifdef __cplusplus
8701e04c3fSmrg}
8801e04c3fSmrg#endif
8901e04c3fSmrg
9001e04c3fSmrg#endif /* EGLDEVICE_INCLUDED */
91