cogl/egl: Move get_egl_display to Context
Allows us to get rid of the extra header Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
This commit is contained in:
parent
e90d2e845e
commit
97c43f9eec
14 changed files with 51 additions and 109 deletions
|
@ -46,6 +46,12 @@ typedef struct _CoglTimestampQuery CoglTimestampQuery;
|
|||
#include "cogl/cogl-pipeline.h"
|
||||
#include "cogl/cogl-primitive.h"
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <EGL/eglmesaext.h>
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -370,4 +376,23 @@ cogl_context_has_winsys_feature (CoglContext *context,
|
|||
COGL_EXPORT void
|
||||
cogl_context_flush (CoglContext *context);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
/**
|
||||
* cogl_context_get_egl_display:
|
||||
* @context: A #CoglContext pointer
|
||||
*
|
||||
* If you have done a runtime check to determine that Cogl is using
|
||||
* EGL internally then this API can be used to retrieve the EGLDisplay
|
||||
* handle that was setup internally. The result is undefined if Cogl
|
||||
* is not using EGL.
|
||||
*
|
||||
* Note: The current window system backend can be checked using
|
||||
* cogl_renderer_get_winsys_id().
|
||||
*
|
||||
* Return value: The internally setup EGLDisplay handle.
|
||||
*/
|
||||
COGL_EXPORT EGLDisplay
|
||||
cogl_context_get_egl_display (CoglContext *context);
|
||||
#endif /* HAVE_EGL */
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <EGL/eglmesaext.h>
|
||||
|
||||
#include "cogl/cogl-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* cogl_egl_context_get_egl_display:
|
||||
* @context: A #CoglContext pointer
|
||||
*
|
||||
* If you have done a runtime check to determine that Cogl is using
|
||||
* EGL internally then this API can be used to retrieve the EGLDisplay
|
||||
* handle that was setup internally. The result is undefined if Cogl
|
||||
* is not using EGL.
|
||||
*
|
||||
* Note: The current window system backend can be checked using
|
||||
* cogl_renderer_get_winsys_id().
|
||||
*
|
||||
* Return value: The internally setup EGLDisplay handle.
|
||||
*/
|
||||
COGL_EXPORT EGLDisplay
|
||||
cogl_egl_context_get_egl_display (CoglContext *context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* The gobject introspection scanner seems to parse public headers in
|
||||
* isolation which means we need to be extra careful about how we
|
||||
* define and undefine __COGL_H_INSIDE__ used to detect when internal
|
||||
* headers are incorrectly included by developers. In the gobject
|
||||
* introspection case we have to manually define __COGL_H_INSIDE__ as
|
||||
* a commandline argument for the scanner which means we must be
|
||||
* careful not to undefine it in a header...
|
||||
*/
|
||||
#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_EGL__
|
||||
#undef __COGL_H_INSIDE__
|
||||
#undef __COGL_EGL_H_INSIDE__
|
||||
#undef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_EGL__
|
||||
#endif
|
|
@ -39,10 +39,6 @@
|
|||
#include "cogl/cogl-context.h"
|
||||
#include "cogl/cogl-bitmap.h"
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include "cogl/cogl-egl.h"
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
|
@ -200,6 +196,12 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
|
|||
COGL_EXPORT CoglTexture *
|
||||
cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* cogl_egl_texture_2d_new_from_image: (skip)
|
||||
*/
|
||||
|
@ -216,10 +218,6 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
|||
CoglEglImageFlags flags,
|
||||
GError **error);
|
||||
|
||||
typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* cogl_texture_2d_new_from_egl_image_external: (skip)
|
||||
*/
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
#include "cogl/cogl-framebuffer.h"
|
||||
#include "cogl/cogl-texture-2d.h"
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include "cogl/cogl-egl.h"
|
||||
#endif
|
||||
|
||||
/* Encodes three possibiloities result of transforming a quad */
|
||||
typedef enum
|
||||
|
|
|
@ -315,9 +315,6 @@ if have_glx
|
|||
endif
|
||||
|
||||
if have_egl
|
||||
cogl_nonintrospected_headers += [
|
||||
'cogl-egl.h',
|
||||
]
|
||||
cogl_sources += [
|
||||
'winsys/cogl-onscreen-egl.c',
|
||||
'winsys/cogl-onscreen-egl.h',
|
||||
|
@ -397,7 +394,6 @@ if have_introspection
|
|||
extra_args: introspection_args + [
|
||||
'-UCOGL_COMPILATION',
|
||||
'-D__COGL_H_INSIDE__',
|
||||
'-D__COGL_EGL_H_INSIDE__',
|
||||
'-DCOGL_GIR_SCANNING',
|
||||
],
|
||||
header: 'cogl/cogl.h',
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "cogl/cogl-onscreen.h"
|
||||
#include "cogl/winsys/cogl-winsys-egl-private.h"
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include "cogl/cogl-context.h"
|
||||
#include "cogl/cogl-context-private.h"
|
||||
#include "cogl/cogl-framebuffer-private.h"
|
||||
|
|
|
@ -34,12 +34,12 @@
|
|||
|
||||
#include "cogl/cogl-util.h"
|
||||
#include "cogl/cogl-feature-private.h"
|
||||
#include "cogl/cogl-context.h"
|
||||
#include "cogl/cogl-context-private.h"
|
||||
#include "cogl/cogl-framebuffer.h"
|
||||
#include "cogl/cogl-onscreen-private.h"
|
||||
#include "cogl/cogl-renderer-private.h"
|
||||
#include "cogl/cogl-onscreen-template-private.h"
|
||||
#include "cogl/cogl-egl.h"
|
||||
#include "cogl/cogl-private.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
#include "cogl/winsys/cogl-winsys-egl-private.h"
|
||||
|
@ -678,7 +678,7 @@ _cogl_egl_query_wayland_buffer (CoglContext *ctx,
|
|||
#endif
|
||||
|
||||
EGLDisplay
|
||||
cogl_egl_context_get_egl_display (CoglContext *context)
|
||||
cogl_context_get_egl_display (CoglContext *context)
|
||||
{
|
||||
CoglRendererEGL *egl_renderer = context->display->renderer->winsys;
|
||||
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#include "backends/native/meta-render-device.h"
|
||||
#include "backends/native/meta-renderer-native-private.h"
|
||||
|
||||
#include "cogl/cogl-egl.h"
|
||||
|
||||
#include "common/meta-cogl-drm-formats.h"
|
||||
#endif
|
||||
|
||||
|
@ -189,7 +187,7 @@ meta_screen_cast_query_modifiers (MetaScreenCast *screen_cast,
|
|||
CoglRenderer *cogl_renderer =
|
||||
cogl_context_get_renderer (cogl_context);
|
||||
EGLDisplay egl_display =
|
||||
cogl_egl_context_get_egl_display (cogl_context);
|
||||
cogl_context_get_egl_display (cogl_context);
|
||||
MetaEgl *egl =
|
||||
meta_backend_get_egl (backend);
|
||||
EGLint num_modifiers;
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "cogl/cogl-egl.h"
|
||||
#include "meta/util.h"
|
||||
#include "wayland/meta-wayland-dma-buf.h"
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
|
@ -184,7 +183,7 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
|
|||
meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
|
||||
if (meta_egl_query_wayland_buffer (egl, egl_display, buffer->resource,
|
||||
EGL_TEXTURE_FORMAT, &format,
|
||||
|
@ -481,7 +480,7 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
int format, width, height, y_inverted;
|
||||
CoglPixelFormat cogl_format;
|
||||
EGLImageKHR egl_image;
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-egl-ext.h"
|
||||
#include "backends/meta-egl.h"
|
||||
#include "cogl/cogl-egl.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "common/meta-cogl-drm-formats.h"
|
||||
#include "common/meta-drm-format-helpers.h"
|
||||
|
@ -174,7 +173,7 @@ should_send_modifiers (MetaBackend *backend)
|
|||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
if (META_IS_BACKEND_NATIVE (backend))
|
||||
|
@ -366,7 +365,7 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
MetaWaylandDmaBufBuffer *dma_buf = buffer->dma_buf.dma_buf;
|
||||
MetaMultiTextureFormat multi_format;
|
||||
CoglPixelFormat cogl_format;
|
||||
|
@ -1820,7 +1819,7 @@ meta_wayland_dma_buf_manager_new (MetaWaylandCompositor *compositor,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
dev_t device_id = 0;
|
||||
int protocol_version;
|
||||
EGLDeviceEXT egl_device;
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "backends/meta-backend-private.h"
|
||||
#include "backends/meta-egl-ext.h"
|
||||
#include "backends/meta-egl.h"
|
||||
#include "cogl/cogl-egl.h"
|
||||
#include "meta/meta-backend.h"
|
||||
#include "wayland/meta-wayland-buffer.h"
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
|
@ -153,7 +152,7 @@ meta_wayland_egl_stream_new (MetaWaylandBuffer *buffer,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
EGLAttrib stream_attribs[] = {
|
||||
EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib) buffer->resource,
|
||||
EGL_NONE
|
||||
|
@ -200,7 +199,7 @@ alloc_egl_stream_texture (CoglTexture2D *texture,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
|
||||
return meta_egl_stream_consumer_gl_texture_external (egl, egl_display,
|
||||
stream->egl_stream,
|
||||
|
@ -217,7 +216,7 @@ meta_wayland_egl_stream_create_texture (MetaWaylandEglStream *stream,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
CoglTexture *texture;
|
||||
int width, height;
|
||||
int y_inverted;
|
||||
|
@ -275,7 +274,7 @@ meta_wayland_egl_stream_attach (MetaWaylandEglStream *stream,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
EGLint stream_state;
|
||||
|
||||
if (!meta_egl_query_stream (egl, egl_display, stream->egl_stream,
|
||||
|
@ -328,7 +327,7 @@ meta_wayland_is_egl_stream_buffer (MetaWaylandBuffer *buffer)
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
int stream_fd;
|
||||
|
||||
if (!meta_egl_has_extensions (egl, egl_display, NULL,
|
||||
|
@ -355,7 +354,7 @@ meta_wayland_egl_stream_finalize (GObject *object)
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
|
||||
g_assert (!stream->texture);
|
||||
|
||||
|
|
|
@ -455,7 +455,7 @@ meta_wayland_drm_syncobj_manager_new (MetaWaylandCompositor *compositor,
|
|||
MetaEgl *egl = meta_backend_get_egl (backend);
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
MetaWaylandDrmSyncobjManager *drm_syncobj_manager;
|
||||
EGLDeviceEXT egl_device;
|
||||
g_autofd int drm_fd = -1;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#endif
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "cogl/cogl-egl.h"
|
||||
#include "compositor/meta-surface-actor-wayland.h"
|
||||
#include "core/events.h"
|
||||
#include "core/meta-context-private.h"
|
||||
|
@ -759,7 +758,7 @@ meta_wayland_init_egl (MetaWaylandCompositor *compositor)
|
|||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context =
|
||||
clutter_backend_get_cogl_context (clutter_backend);
|
||||
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
|
||||
EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context);
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
||||
if (!meta_egl_has_extensions (egl, egl_display, NULL,
|
||||
|
|
Loading…
Reference in a new issue