4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2010 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see
20 * <http://www.gnu.org/licenses/>.
23 * Robert Bragg <robert@linux.intel.com>
27 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
28 #error "Only <cogl/cogl.h> can be included directly."
31 #ifndef __COGL_DISPLAY_H__
32 #define __COGL_DISPLAY_H__
34 #include <cogl/cogl-renderer.h>
35 #include <cogl/cogl-onscreen-template.h>
39 #ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
44 * SECTION:cogl-display
45 * @short_description: Common aspects of a display pipeline
47 * The basic intention for this object is to let the application
48 * configure common display preferences before creating a context, and
49 * there are a few different aspects to this...
51 * Firstly there are options directly relating to the physical display
52 * pipeline that is currently being used including the digital to
53 * analogue conversion hardware and the screens the user sees.
55 * Another aspect is that display options may constrain or affect how
56 * onscreen framebuffers should later be configured. The original
57 * rationale for the display object in fact was to let us handle GLX
58 * and EGLs requirements that framebuffers must be "compatible" with
59 * the config associated with the current context meaning we have to
60 * force the user to describe how they would like to create their
61 * onscreen windows before we can choose a suitable fbconfig and
65 typedef struct _CoglDisplay CoglDisplay;
67 #define COGL_DISPLAY(OBJECT) ((CoglDisplay *)OBJECT)
71 * @renderer: A #CoglRenderer
72 * @onscreen_template: A #CoglOnscreenTemplate
74 * Explicitly allocates a new #CoglDisplay object to encapsulate the
75 * common state of the display pipeline that applies to the whole
78 * <note>Many applications don't need to explicitly use
79 * cogl_display_new() and can just jump straight to cogl_context_new()
80 * and pass a %NULL display argument so Cogl will automatically
81 * connect and setup a renderer and display.</note>
83 * A @display can only be made for a specific choice of renderer which
84 * is why this takes the @renderer argument.
86 * A common use for explicitly allocating a display object is to
87 * define a template for allocating onscreen framebuffers which is
88 * what the @onscreen_template argument is for.
90 * When a display is first allocated via cogl_display_new() it is in a
91 * mutable configuration mode. It's designed this way so we can
92 * extend the apis available for configuring a display without
93 * requiring huge numbers of constructor arguements.
95 * When you have finished configuring a display object you can
96 * optionally call cogl_display_setup() to explicitly apply the
97 * configuration and check for errors. Alternaitvely you can pass the
98 * display to cogl_context_new() and Cogl will implicitly apply your
99 * configuration but if there are errors then the application will
100 * abort with a message. For simple applications with no fallback
101 * options then relying on the implicit setup can be fine.
103 * Return value: A newly allocated #CoglDisplay object in a mutable
104 * configuration mode.
106 * Stability: unstable
109 cogl_display_new (CoglRenderer *renderer,
110 CoglOnscreenTemplate *onscreen_template);
113 * cogl_display_get_renderer:
114 * @display: a #CoglDisplay
116 * Queries the #CoglRenderer associated with the given @display.
119 * Stability: unstable
122 cogl_display_get_renderer (CoglDisplay *display);
125 * cogl_display_setup:
126 * @display: a #CoglDisplay
127 * @error: return location for a #GError
129 * Explicitly sets up the given @display object. Use of this api is
130 * optional since Cogl will internally setup the display if not done
133 * When a display is first allocated via cogl_display_new() it is in a
134 * mutable configuration mode. This allows us to extend the apis
135 * available for configuring a display without requiring huge numbers
136 * of constructor arguements.
138 * Its possible to request a configuration that might not be
139 * supportable on the current system and so this api provides a means
140 * to apply the configuration explicitly but if it fails then an
141 * exception will be returned so you can handle the error gracefully
142 * and perhaps fall back to an alternative configuration.
144 * If you instead rely on Cogl implicitly calling cogl_display_setup()
145 * for you then if there is an error with the configuration you won't
146 * get an opportunity to handle that and the application may abort
147 * with a message. For simple applications that don't have any
148 * fallback options this behaviour may be fine.
150 * Return value: Returns %TRUE if there was no error, else it returns
151 * %FALSE and returns an exception via @error.
153 * Stability: unstable
156 cogl_display_setup (CoglDisplay *display,
159 #ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
161 * cogl_gdl_display_set_plane:
162 * @display: a #CoglDisplay
164 * Request that Cogl output to a specific GDL overlay @plane.
167 * Stability: unstable
170 cogl_gdl_display_set_plane (CoglDisplay *display,
171 gdl_plane_id_t plane);
174 #ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
176 * cogl_wayland_display_set_compositor_display:
177 * @display: a #CoglDisplay
178 * @wayland_display: A compositor's Wayland display pointer
180 * Informs Cogl of a compositor's Wayland display pointer. This
181 * enables Cogl to register private wayland extensions required to
182 * pass buffers between the clients and compositor.
185 * Stability: unstable
188 cogl_wayland_display_set_compositor_display (CoglDisplay *display,
189 struct wl_display *wayland_display);
194 * @object: A #CoglObject pointer
196 * Gets whether the given object references a #CoglDisplay.
198 * Return value: %TRUE if the object references a #CoglDisplay
199 * and %FALSE otherwise.
201 * Stability: unstable
204 cogl_is_display (void *object);
208 #endif /* __COGL_DISPLAY_H__ */