[mutter] MetaRendererNative: Get EGLDisplay on init
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaRendererNative: Get EGLDisplay on init
- Date: Thu, 17 Nov 2016 16:06:56 +0000 (UTC)
commit cde622b8e1f624d82fc75306c1f22f1b5f2915fa
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Aug 18 10:37:16 2016 +0800
MetaRendererNative: Get EGLDisplay on init
Use MetaEgl to get the EGLDisplay on initialization; use that when
constructing the Cogl renderer.
https://bugzilla.gnome.org/show_bug.cgi?id=773629
src/backends/native/meta-renderer-native.c | 42 ++++++++++++++--------------
1 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 887807b..0bdf2f8 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -82,6 +82,9 @@ struct _MetaRendererNative
MetaRenderer parent;
int kms_fd;
+
+ EGLDisplay egl_display;
+
struct gbm_device *gbm;
CoglClosure *swap_notify_idle;
@@ -236,25 +239,7 @@ meta_renderer_native_connect (CoglRenderer *cogl_renderer,
egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
egl_renderer->platform = renderer_native;
- egl_renderer->edpy = EGL_NO_DISPLAY;
-
- if (renderer_native->gbm == NULL)
- {
- _cogl_set_error (error, COGL_WINSYS_ERROR,
- COGL_WINSYS_ERROR_INIT,
- "Couldn't create gbm device");
- goto fail;
- }
-
- egl_renderer->edpy =
- eglGetDisplay ((EGLNativeDisplayType) renderer_native->gbm);
- if (egl_renderer->edpy == EGL_NO_DISPLAY)
- {
- _cogl_set_error (error, COGL_WINSYS_ERROR,
- COGL_WINSYS_ERROR_INIT,
- "Couldn't get eglDisplay");
- goto fail;
- }
+ egl_renderer->edpy = renderer_native->egl_display;
if (!_cogl_winsys_egl_renderer_connect_common (cogl_renderer, error))
goto fail;
@@ -1241,9 +1226,13 @@ meta_renderer_native_initable_init (GInitable *initable,
GError **error)
{
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (initable);
+ MetaBackend *backend = meta_get_backend ();
+ MetaEgl *egl = meta_backend_get_egl (backend);
+ struct gbm_device *gbm_device;
+ EGLDisplay egl_display;
- renderer_native->gbm = gbm_create_device (renderer_native->kms_fd);
- if (!renderer_native->gbm)
+ gbm_device = gbm_create_device (renderer_native->kms_fd);
+ if (!gbm_device)
{
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_FAILED,
@@ -1251,6 +1240,17 @@ meta_renderer_native_initable_init (GInitable *initable,
return FALSE;
}
+ egl_display = meta_egl_get_display (egl, (EGLNativeDisplayType) gbm_device,
+ error);
+ if (egl_display == EGL_NO_DISPLAY)
+ {
+ gbm_device_destroy (gbm_device);
+ return FALSE;
+ }
+
+ renderer_native->egl_display = egl_display;
+ renderer_native->gbm = gbm_device;
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]