[mutter] backend/native: Propogate error when creating renderer



commit 547ace3cf8a4f8200d6189e3465d99be4c0c7b39
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Jul 5 18:01:47 2017 +0800

    backend/native: Propogate error when creating renderer
    
    The error was printed, then dropped, eventually resulting in another
    generic error being printed. Lets just propogate the error all the way
    up instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785381

 src/backends/meta-backend-private.h               |    3 ++-
 src/backends/meta-backend.c                       |   16 +++++++++-------
 src/backends/native/meta-backend-native.c         |   12 ++++--------
 src/backends/x11/cm/meta-backend-x11-cm.c         |    3 ++-
 src/backends/x11/nested/meta-backend-x11-nested.c |    3 ++-
 5 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h
index 47aa291..fda36ed 100644
--- a/src/backends/meta-backend-private.h
+++ b/src/backends/meta-backend-private.h
@@ -63,7 +63,8 @@ struct _MetaBackendClass
                                              int          device_id);
   MetaMonitorManager * (* create_monitor_manager) (MetaBackend *backend);
   MetaCursorRenderer * (* create_cursor_renderer) (MetaBackend *backend);
-  MetaRenderer * (* create_renderer) (MetaBackend *backend);
+  MetaRenderer * (* create_renderer) (MetaBackend *backend,
+                                      GError     **error);
   MetaInputSettings * (* create_input_settings) (MetaBackend *backend);
 
   gboolean (* grab_device) (MetaBackend *backend,
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index faa8d6f..2021028 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -579,6 +579,13 @@ experimental_features_changed (MetaSettings            *settings,
 #endif /* HAVE_REMOTE_DESKTOP */
 }
 
+static MetaRenderer *
+meta_backend_create_renderer (MetaBackend *backend,
+                              GError     **error)
+{
+  return META_BACKEND_GET_CLASS (backend)->create_renderer (backend, error);
+}
+
 static gboolean
 meta_backend_initable_init (GInitable     *initable,
                             GCancellable  *cancellable,
@@ -594,14 +601,9 @@ meta_backend_initable_init (GInitable     *initable,
 
   priv->egl = g_object_new (META_TYPE_EGL, NULL);
 
-  priv->renderer = META_BACKEND_GET_CLASS (backend)->create_renderer (backend);
+  priv->renderer = meta_backend_create_renderer (backend, error);
   if (!priv->renderer)
-    {
-      g_set_error (error, G_IO_ERROR,
-                   G_IO_ERROR_FAILED,
-                   "Failed to create MetaRenderer");
-      return FALSE;
-    }
+    return FALSE;
 
   priv->cursor_tracker = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
 
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index d68aca9..fb3392d 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -412,25 +412,21 @@ meta_backend_native_create_cursor_renderer (MetaBackend *backend)
 }
 
 static MetaRenderer *
-meta_backend_native_create_renderer (MetaBackend *backend)
+meta_backend_native_create_renderer (MetaBackend *backend,
+                                     GError     **error)
 {
   MetaBackendNative *native = META_BACKEND_NATIVE (backend);
   MetaBackendNativePrivate *priv =
     meta_backend_native_get_instance_private (native);
   int kms_fd;
   const char *kms_file_path;
-  GError *error = NULL;
   MetaRendererNative *renderer_native;
 
   kms_fd = meta_launcher_get_kms_fd (priv->launcher);
   kms_file_path = meta_launcher_get_kms_file_path (priv->launcher);
-  renderer_native = meta_renderer_native_new (kms_fd, kms_file_path, &error);
+  renderer_native = meta_renderer_native_new (kms_fd, kms_file_path, error);
   if (!renderer_native)
-    {
-      meta_warning ("Failed to create renderer: %s\n", error->message);
-      g_error_free (error);
-      return NULL;
-    }
+    return NULL;
 
   return META_RENDERER (renderer_native);
 }
diff --git a/src/backends/x11/cm/meta-backend-x11-cm.c b/src/backends/x11/cm/meta-backend-x11-cm.c
index 9d83cd1..06825f3 100644
--- a/src/backends/x11/cm/meta-backend-x11-cm.c
+++ b/src/backends/x11/cm/meta-backend-x11-cm.c
@@ -92,7 +92,8 @@ meta_backend_x11_cm_post_init (MetaBackend *backend)
 }
 
 static MetaRenderer *
-meta_backend_x11_cm_create_renderer (MetaBackend *backend)
+meta_backend_x11_cm_create_renderer (MetaBackend *backend,
+                                     GError     **error)
 {
   return g_object_new (META_TYPE_RENDERER_X11_CM, NULL);
 }
diff --git a/src/backends/x11/nested/meta-backend-x11-nested.c 
b/src/backends/x11/nested/meta-backend-x11-nested.c
index 833d1a1..644c270 100644
--- a/src/backends/x11/nested/meta-backend-x11-nested.c
+++ b/src/backends/x11/nested/meta-backend-x11-nested.c
@@ -32,7 +32,8 @@ G_DEFINE_TYPE (MetaBackendX11Nested, meta_backend_x11_nested,
                META_TYPE_BACKEND_X11)
 
 static MetaRenderer *
-meta_backend_x11_nested_create_renderer (MetaBackend *backend)
+meta_backend_x11_nested_create_renderer (MetaBackend *backend,
+                                         GError     **error)
 {
   return g_object_new (META_TYPE_RENDERER_X11_NESTED, NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]