1 /* 2 * Cogl 3 * 4 * A Low Level GPU Graphics and Utilities API 5 * 6 * Copyright (C) 2011 Intel Corporation. 7 * 8 * Permission is hereby granted, free of charge, to any person 9 * obtaining a copy of this software and associated documentation 10 * files (the "Software"), to deal in the Software without 11 * restriction, including without limitation the rights to use, copy, 12 * modify, merge, publish, distribute, sublicense, and/or sell copies 13 * of the Software, and to permit persons to whom the Software is 14 * furnished to do so, subject to the following conditions: 15 * 16 * The above copyright notice and this permission notice shall be 17 * included in all copies or substantial portions of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 23 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 24 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 * SOFTWARE. 27 * 28 * 29 */ 30 31 #ifndef __COGL_RENDERER_PRIVATE_H 32 #define __COGL_RENDERER_PRIVATE_H 33 34 #include <gmodule.h> 35 36 #include "cogl-object-private.h" 37 #include "cogl-winsys-private.h" 38 #include "cogl-driver.h" 39 #include "cogl-texture-driver.h" 40 #include "cogl-context.h" 41 #include "cogl-closure-list-private.h" 42 43 #ifdef COGL_HAS_XLIB_SUPPORT 44 #include <X11/Xlib.h> 45 #endif 46 47 #if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) 48 #include <wayland-client.h> 49 #endif 50 51 #if defined (COGL_HAS_EGL_PLATFORM_MIR_SUPPORT) 52 #include <mir_toolkit/mir_client_library.h> 53 #endif 54 55 struct _CoglRenderer 56 { 57 CoglObject _parent; 58 CoglBool connected; 59 CoglDriver driver_override; 60 const CoglDriverVtable *driver_vtable; 61 const CoglTextureDriver *texture_driver; 62 const CoglWinsysVtable *winsys_vtable; 63 CoglWinsysID winsys_id_override; 64 GList *constraints; 65 66 GArray *poll_fds; 67 int poll_fds_age; 68 GList *poll_sources; 69 70 CoglList idle_closures; 71 72 GList *outputs; 73 74 #ifdef COGL_HAS_XLIB_SUPPORT 75 Display *foreign_xdpy; 76 CoglBool xlib_enable_event_retrieval; 77 #endif 78 79 #ifdef COGL_HAS_WIN32_SUPPORT 80 CoglBool win32_enable_event_retrieval; 81 #endif 82 83 CoglDriver driver; 84 unsigned long private_features 85 [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)]; 86 #ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY 87 GModule *libgl_module; 88 #endif 89 90 #if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) 91 struct wl_display *foreign_wayland_display; 92 CoglBool wayland_enable_event_dispatch; 93 #endif 94 95 #if defined (COGL_HAS_EGL_PLATFORM_MIR_SUPPORT) 96 MirConnection *foreign_mir_connection; 97 #endif 98 99 #if defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT) 100 int kms_fd; 101 #endif 102 103 #ifdef COGL_HAS_SDL_SUPPORT 104 CoglBool sdl_event_type_set; 105 uint32_t sdl_event_type; 106 #endif 107 108 /* List of callback functions that will be given every native event */ 109 GSList *event_filters; 110 void *winsys; 111 }; 112 113 /* Mask of constraints that effect driver selection. All of the other 114 * constraints effect only the winsys selection */ 115 #define COGL_RENDERER_DRIVER_CONSTRAINTS \ 116 COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 117 118 typedef CoglFilterReturn (* CoglNativeFilterFunc) (void *native_event, 119 void *data); 120 121 CoglFilterReturn 122 _cogl_renderer_handle_native_event (CoglRenderer *renderer, 123 void *event); 124 125 void 126 _cogl_renderer_add_native_filter (CoglRenderer *renderer, 127 CoglNativeFilterFunc func, 128 void *data); 129 130 void 131 _cogl_renderer_remove_native_filter (CoglRenderer *renderer, 132 CoglNativeFilterFunc func, 133 void *data); 134 135 void * 136 _cogl_renderer_get_proc_address (CoglRenderer *renderer, 137 const char *name, 138 CoglBool in_core); 139 140 #endif /* __COGL_RENDERER_PRIVATE_H */ 141