[mutter] egl: Add more API used when rendering
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] egl: Add more API used when rendering
- Date: Fri, 6 Oct 2017 18:25:51 +0000 (UTC)
commit 2d8827cb0c4626df6def40846e9a6ecef7dc44d7
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Jul 24 17:17:25 2017 +0800
egl: Add more API used when rendering
Eventually, we'll render buffers without using Cogl, and for this we
need to be able to do things like creating, destroying and changing the
context, as well as swapping buffers.
https://bugzilla.gnome.org/show_bug.cgi?id=785381
src/backends/meta-egl.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++
src/backends/meta-egl.h | 24 +++++++++++++++++
2 files changed, 91 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c
index fac21f3..b4685ba 100644
--- a/src/backends/meta-egl.c
+++ b/src/backends/meta-egl.c
@@ -422,6 +422,41 @@ meta_egl_terminate (MetaEgl *egl,
return TRUE;
}
+EGLContext
+meta_egl_create_context (MetaEgl *egl,
+ EGLDisplay display,
+ EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list,
+ GError **error)
+{
+ EGLContext context;
+
+ context = eglCreateContext (display, config, share_context, attrib_list);
+ if (context == EGL_NO_CONTEXT)
+ {
+ set_egl_error (error);
+ return EGL_NO_CONTEXT;
+ }
+
+ return context;
+}
+
+gboolean
+meta_egl_destroy_context (MetaEgl *egl,
+ EGLDisplay display,
+ EGLContext context,
+ GError **error)
+{
+ if (!eglDestroyContext (display, context))
+ {
+ set_egl_error (error);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
EGLImageKHR
meta_egl_create_image (MetaEgl *egl,
EGLDisplay display,
@@ -466,6 +501,38 @@ meta_egl_destroy_image (MetaEgl *egl,
}
gboolean
+meta_egl_make_current (MetaEgl *egl,
+ EGLDisplay display,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext context,
+ GError **error)
+{
+ if (!eglMakeCurrent (display, draw, read, context))
+ {
+ set_egl_error (error);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+meta_egl_swap_buffers (MetaEgl *egl,
+ EGLDisplay display,
+ EGLSurface surface,
+ GError **error)
+{
+ if (!eglSwapBuffers (display, surface))
+ {
+ set_egl_error (error);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
meta_egl_query_wayland_buffer (MetaEgl *egl,
EGLDisplay display,
struct wl_resource *buffer,
diff --git a/src/backends/meta-egl.h b/src/backends/meta-egl.h
index 1bde6fa..628e4b4 100644
--- a/src/backends/meta-egl.h
+++ b/src/backends/meta-egl.h
@@ -62,6 +62,18 @@ gboolean meta_egl_choose_config (MetaEgl *egl,
EGLConfig *chosen_config,
GError **error);
+EGLContext meta_egl_create_context (MetaEgl *egl,
+ EGLDisplay display,
+ EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list,
+ GError **error);
+
+gboolean meta_egl_destroy_context (MetaEgl *egl,
+ EGLDisplay display,
+ EGLContext context,
+ GError **error);
+
EGLImageKHR meta_egl_create_image (MetaEgl *egl,
EGLDisplay display,
EGLContext context,
@@ -103,6 +115,18 @@ gboolean meta_egl_terminate (MetaEgl *egl,
EGLDisplay display,
GError **error);
+gboolean meta_egl_make_current (MetaEgl *egl,
+ EGLDisplay display,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext context,
+ GError **error);
+
+gboolean meta_egl_swap_buffers (MetaEgl *egl,
+ EGLDisplay display,
+ EGLSurface surface,
+ GError **error);
+
gboolean meta_egl_query_wayland_buffer (MetaEgl *egl,
EGLDisplay display,
struct wl_resource *buffer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]