2011-05-24 21:34:10 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* A Low Level GPU Graphics and Utilities API
|
2011-05-24 21:34:10 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Intel Corporation.
|
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use, copy,
|
|
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
|
|
* of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2011-05-24 21:34:10 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COGL_WINSYS_EGL_PRIVATE_H
|
|
|
|
#define __COGL_WINSYS_EGL_PRIVATE_H
|
|
|
|
|
|
|
|
#include "cogl-defines.h"
|
|
|
|
#include "cogl-winsys-private.h"
|
|
|
|
#include "cogl-context.h"
|
2011-12-06 16:53:53 +00:00
|
|
|
#include "cogl-context-private.h"
|
2011-12-13 11:42:42 +00:00
|
|
|
#include "cogl-framebuffer-private.h"
|
2011-11-28 16:02:35 +00:00
|
|
|
|
2013-10-28 14:32:20 +00:00
|
|
|
/* XXX: depending on what version of Mesa you have then
|
|
|
|
* eglQueryWaylandBuffer may take a wl_buffer or wl_resource argument
|
|
|
|
* and the EGL header will only forward declare the corresponding
|
|
|
|
* type.
|
|
|
|
*
|
|
|
|
* The use of wl_buffer has been deprecated and so internally we
|
|
|
|
* assume that eglQueryWaylandBuffer takes a wl_resource but for
|
|
|
|
* compatibility we forward declare wl_resource in case we are
|
|
|
|
* building with EGL headers that still use wl_buffer.
|
|
|
|
*
|
|
|
|
* Placing the forward declaration here means it comes before we
|
|
|
|
* #include cogl-winsys-egl-feature-functions.h bellow which
|
|
|
|
* declares lots of function pointers for accessing EGL extensions
|
|
|
|
* and cogl-winsys-egl.c will include this header before it also
|
|
|
|
* includes cogl-winsys-egl-feature-functions.h that may depend
|
|
|
|
* on this type.
|
|
|
|
*/
|
|
|
|
#ifdef EGL_WL_bind_wayland_display
|
|
|
|
struct wl_resource;
|
|
|
|
#endif
|
|
|
|
|
2011-12-09 16:10:01 +00:00
|
|
|
typedef struct _CoglWinsysEGLVtable
|
|
|
|
{
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool
|
2011-12-09 16:10:01 +00:00
|
|
|
(* display_setup) (CoglDisplay *display,
|
2012-08-31 18:28:27 +00:00
|
|
|
CoglError **error);
|
2011-12-09 16:10:01 +00:00
|
|
|
void
|
|
|
|
(* display_destroy) (CoglDisplay *display);
|
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool
|
2011-12-12 15:59:35 +00:00
|
|
|
(* context_created) (CoglDisplay *display,
|
2012-08-31 18:28:27 +00:00
|
|
|
CoglError **error);
|
2011-12-12 15:59:35 +00:00
|
|
|
|
2011-12-09 16:10:01 +00:00
|
|
|
void
|
|
|
|
(* cleanup_context) (CoglDisplay *display);
|
2011-12-12 15:59:35 +00:00
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool
|
2012-08-31 18:28:27 +00:00
|
|
|
(* context_init) (CoglContext *context, CoglError **error);
|
2011-12-12 15:59:35 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
(* context_deinit) (CoglContext *context);
|
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool
|
2011-12-12 15:59:35 +00:00
|
|
|
(* onscreen_init) (CoglOnscreen *onscreen,
|
|
|
|
EGLConfig config,
|
2012-08-31 18:28:27 +00:00
|
|
|
CoglError **error);
|
2011-12-12 15:59:35 +00:00
|
|
|
void
|
|
|
|
(* onscreen_deinit) (CoglOnscreen *onscreen);
|
2011-12-13 11:42:42 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
(* add_config_attributes) (CoglDisplay *display,
|
|
|
|
CoglFramebufferConfig *config,
|
|
|
|
EGLint *attributes);
|
2011-12-09 16:10:01 +00:00
|
|
|
} CoglWinsysEGLVtable;
|
|
|
|
|
2011-11-28 16:02:35 +00:00
|
|
|
typedef enum _CoglEGLWinsysFeature
|
|
|
|
{
|
|
|
|
COGL_EGL_WINSYS_FEATURE_SWAP_REGION =1L<<0,
|
|
|
|
COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP =1L<<1,
|
2012-09-26 19:32:36 +00:00
|
|
|
COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER =1L<<2,
|
2013-01-22 21:21:33 +00:00
|
|
|
COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT =1L<<3,
|
2013-01-11 01:13:34 +00:00
|
|
|
COGL_EGL_WINSYS_FEATURE_BUFFER_AGE =1L<<4,
|
|
|
|
COGL_EGL_WINSYS_FEATURE_FENCE_SYNC =1L<<5
|
2011-11-28 16:02:35 +00:00
|
|
|
} CoglEGLWinsysFeature;
|
|
|
|
|
|
|
|
typedef struct _CoglRendererEGL
|
|
|
|
{
|
|
|
|
CoglEGLWinsysFeature private_features;
|
|
|
|
|
|
|
|
EGLDisplay edpy;
|
|
|
|
|
|
|
|
EGLint egl_version_major;
|
|
|
|
EGLint egl_version_minor;
|
|
|
|
|
2013-04-18 13:19:43 +00:00
|
|
|
CoglClosure *resize_notify_idle;
|
2013-04-16 22:46:03 +00:00
|
|
|
|
2011-12-09 16:10:01 +00:00
|
|
|
/* Data specific to the EGL platform */
|
|
|
|
void *platform;
|
|
|
|
/* vtable for platform specific parts */
|
|
|
|
const CoglWinsysEGLVtable *platform_vtable;
|
2011-11-28 16:02:35 +00:00
|
|
|
|
2011-12-12 15:59:35 +00:00
|
|
|
/* Function pointers for EGL specific extensions */
|
2011-11-28 16:02:35 +00:00
|
|
|
#define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d)
|
|
|
|
|
|
|
|
#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \
|
|
|
|
ret (APIENTRY * pf_ ## name) args;
|
|
|
|
|
|
|
|
#define COGL_WINSYS_FEATURE_END()
|
|
|
|
|
|
|
|
#include "cogl-winsys-egl-feature-functions.h"
|
|
|
|
|
|
|
|
#undef COGL_WINSYS_FEATURE_BEGIN
|
|
|
|
#undef COGL_WINSYS_FEATURE_FUNCTION
|
|
|
|
#undef COGL_WINSYS_FEATURE_END
|
|
|
|
} CoglRendererEGL;
|
|
|
|
|
|
|
|
typedef struct _CoglDisplayEGL
|
|
|
|
{
|
|
|
|
EGLContext egl_context;
|
|
|
|
EGLSurface dummy_surface;
|
2011-12-08 17:38:19 +00:00
|
|
|
EGLSurface egl_surface;
|
2011-11-28 16:02:35 +00:00
|
|
|
|
|
|
|
EGLConfig egl_config;
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool found_egl_config;
|
2011-12-09 16:10:01 +00:00
|
|
|
|
2012-03-06 03:21:30 +00:00
|
|
|
EGLSurface current_read_surface;
|
|
|
|
EGLSurface current_draw_surface;
|
|
|
|
EGLContext current_context;
|
|
|
|
|
2011-12-09 16:10:01 +00:00
|
|
|
/* Platform specific display data */
|
|
|
|
void *platform;
|
2011-11-28 16:02:35 +00:00
|
|
|
} CoglDisplayEGL;
|
|
|
|
|
|
|
|
typedef struct _CoglContextEGL
|
|
|
|
{
|
2012-03-06 03:21:30 +00:00
|
|
|
EGLSurface saved_draw_surface;
|
|
|
|
EGLSurface saved_read_surface;
|
2011-11-28 16:02:35 +00:00
|
|
|
} CoglContextEGL;
|
2011-05-24 21:34:10 +00:00
|
|
|
|
2011-12-09 16:10:01 +00:00
|
|
|
typedef struct _CoglOnscreenEGL
|
|
|
|
{
|
|
|
|
EGLSurface egl_surface;
|
|
|
|
|
2012-06-20 15:22:36 +00:00
|
|
|
CoglBool pending_resize_notify;
|
|
|
|
|
2011-12-09 16:10:01 +00:00
|
|
|
/* Platform specific data */
|
|
|
|
void *platform;
|
|
|
|
} CoglOnscreenEGL;
|
|
|
|
|
2011-05-24 21:34:10 +00:00
|
|
|
const CoglWinsysVtable *
|
|
|
|
_cogl_winsys_egl_get_vtable (void);
|
|
|
|
|
2012-03-06 03:21:30 +00:00
|
|
|
EGLBoolean
|
|
|
|
_cogl_winsys_egl_make_current (CoglDisplay *display,
|
|
|
|
EGLSurface draw,
|
|
|
|
EGLSurface read,
|
|
|
|
EGLContext context);
|
|
|
|
|
2011-05-24 21:34:10 +00:00
|
|
|
#ifdef EGL_KHR_image_base
|
|
|
|
EGLImageKHR
|
|
|
|
_cogl_egl_create_image (CoglContext *ctx,
|
|
|
|
EGLenum target,
|
|
|
|
EGLClientBuffer buffer,
|
|
|
|
const EGLint *attribs);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_egl_destroy_image (CoglContext *ctx,
|
|
|
|
EGLImageKHR image);
|
|
|
|
#endif
|
|
|
|
|
2013-04-30 13:09:11 +00:00
|
|
|
#ifdef EGL_WL_bind_wayland_display
|
|
|
|
CoglBool
|
|
|
|
_cogl_egl_query_wayland_buffer (CoglContext *ctx,
|
2013-10-15 18:02:46 +00:00
|
|
|
struct wl_resource *buffer,
|
2013-04-30 13:09:11 +00:00
|
|
|
int attribute,
|
|
|
|
int *value);
|
|
|
|
#endif
|
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool
|
2011-12-09 16:10:01 +00:00
|
|
|
_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer,
|
2012-08-31 18:28:27 +00:00
|
|
|
CoglError **error);
|
2011-12-09 16:10:01 +00:00
|
|
|
|
2011-05-24 21:34:10 +00:00
|
|
|
#endif /* __COGL_WINSYS_EGL_PRIVATE_H */
|