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
This commit is contained in:
Jonas Ådahl 2017-07-05 18:01:47 +08:00
parent a4ba38ee78
commit 547ace3cf8
5 changed files with 19 additions and 18 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}