mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
x11: Use EGL instead of GLX when drawing using GLES
When running as a X11 CM we shouldn't use the GLX winsys when the driver doesn't support it, i.e. OpenGL ES drivers. https://bugzilla.gnome.org/show_bug.cgi?id=771636
This commit is contained in:
parent
5d3e7d6ffd
commit
ac813d5285
@ -42,7 +42,7 @@
|
||||
#include <cogl/winsys/cogl-winsys-egl-private.h>
|
||||
#include <cogl/winsys/cogl-winsys-private.h>
|
||||
|
||||
void cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
|
||||
CoglWinsysVtableGetter winsys_vtable_getter);
|
||||
void cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
|
||||
CoglCustomWinsysVtableGetter winsys_vtable_getter);
|
||||
|
||||
#endif /* __COGL_MUTTER_H___ */
|
||||
|
@ -39,12 +39,13 @@
|
||||
#include "cogl-texture-driver.h"
|
||||
#include "cogl-context.h"
|
||||
#include "cogl-closure-list-private.h"
|
||||
#include "cogl-mutter.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
typedef const CoglWinsysVtable *(*CoglCustomWinsysVtableGetter) (CoglRenderer *renderer);
|
||||
|
||||
struct _CoglRenderer
|
||||
{
|
||||
CoglObject _parent;
|
||||
@ -53,7 +54,7 @@ struct _CoglRenderer
|
||||
const CoglDriverVtable *driver_vtable;
|
||||
const CoglTextureDriver *texture_driver;
|
||||
const CoglWinsysVtable *winsys_vtable;
|
||||
CoglWinsysVtableGetter custom_winsys_vtable_getter;
|
||||
CoglCustomWinsysVtableGetter custom_winsys_vtable_getter;
|
||||
CoglWinsysID winsys_id_override;
|
||||
GList *constraints;
|
||||
|
||||
|
@ -565,8 +565,8 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
|
||||
/* Final connection API */
|
||||
|
||||
void
|
||||
cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
|
||||
CoglWinsysVtableGetter winsys_vtable_getter)
|
||||
cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
|
||||
CoglCustomWinsysVtableGetter winsys_vtable_getter)
|
||||
{
|
||||
renderer->custom_winsys_vtable_getter = winsys_vtable_getter;
|
||||
}
|
||||
@ -575,10 +575,11 @@ static CoglBool
|
||||
connect_custom_winsys (CoglRenderer *renderer,
|
||||
CoglError **error)
|
||||
{
|
||||
const CoglWinsysVtable *winsys = renderer->custom_winsys_vtable_getter();
|
||||
const CoglWinsysVtable *winsys;
|
||||
CoglError *tmp_error = NULL;
|
||||
GString *error_message;
|
||||
|
||||
winsys = renderer->custom_winsys_vtable_getter (renderer);
|
||||
renderer->winsys_vtable = winsys;
|
||||
|
||||
error_message = g_string_new ("");
|
||||
|
@ -1563,7 +1563,7 @@ meta_renderer_native_set_legacy_view_size (MetaRendererNative *renderer_native,
|
||||
}
|
||||
|
||||
static const CoglWinsysVtable *
|
||||
get_native_cogl_winsys_vtable (void)
|
||||
get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer)
|
||||
{
|
||||
static gboolean vtable_inited = FALSE;
|
||||
static CoglWinsysVtable vtable;
|
||||
|
@ -48,12 +48,25 @@ struct _MetaRendererX11
|
||||
G_DEFINE_TYPE (MetaRendererX11, meta_renderer_x11, META_TYPE_RENDERER)
|
||||
|
||||
static const CoglWinsysVtable *
|
||||
get_x11_cogl_winsys_vtable (void)
|
||||
get_x11_cogl_winsys_vtable (CoglRenderer *renderer)
|
||||
{
|
||||
if (meta_is_wayland_compositor ())
|
||||
return _cogl_winsys_egl_xlib_get_vtable ();
|
||||
else
|
||||
return _cogl_winsys_glx_get_vtable ();
|
||||
|
||||
switch (renderer->driver)
|
||||
{
|
||||
case COGL_DRIVER_GLES1:
|
||||
case COGL_DRIVER_GLES2:
|
||||
return _cogl_winsys_egl_xlib_get_vtable ();
|
||||
case COGL_DRIVER_GL:
|
||||
case COGL_DRIVER_GL3:
|
||||
return _cogl_winsys_glx_get_vtable ();
|
||||
case COGL_DRIVER_ANY:
|
||||
case COGL_DRIVER_NOP:
|
||||
case COGL_DRIVER_WEBGL:
|
||||
break;
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static CoglRenderer *
|
||||
|
Loading…
Reference in New Issue
Block a user