mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
[backends] Remove the idea of offscreen stages from all backends
The only backend that tried to implement offscreen stages was the GLX backend and even this has apparently be broken for some time without anyone noticing. The property still remains and since the property already clearly states that it may not work I don't expect anyone to notice. This simplifies quite a bit of the GLX code which is very desireable from the POV that we want to start migrating window system code down to Cogl and the simpler the code is the more straight forward this work will be. In the future when Cogl has a nicely designed API for framebuffer objects then re-implementing offscreen stages cleanly for *all* backends should be quite straightforward.
This commit is contained in:
parent
35f11d863c
commit
15d7a86621
@ -308,7 +308,6 @@ _clutter_backend_redraw (ClutterBackend *backend,
|
||||
|
||||
gboolean
|
||||
_clutter_backend_create_context (ClutterBackend *backend,
|
||||
gboolean is_offscreen,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
@ -317,7 +316,7 @@ _clutter_backend_create_context (ClutterBackend *backend,
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (klass->create_context)
|
||||
return klass->create_context (backend, is_offscreen, error);
|
||||
return klass->create_context (backend, error);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ struct _ClutterBackendClass
|
||||
void (* redraw) (ClutterBackend *backend,
|
||||
ClutterStage *stage);
|
||||
gboolean (* create_context) (ClutterBackend *backend,
|
||||
gboolean is_offscreen,
|
||||
GError **error);
|
||||
void (* ensure_context) (ClutterBackend *backend,
|
||||
ClutterStage *stage);
|
||||
|
@ -194,7 +194,6 @@ ClutterStageWindow *_clutter_backend_create_stage (ClutterBackend *backend,
|
||||
void _clutter_backend_ensure_context (ClutterBackend *backend,
|
||||
ClutterStage *stage);
|
||||
gboolean _clutter_backend_create_context (ClutterBackend *backend,
|
||||
gboolean is_offscreen,
|
||||
GError **error);
|
||||
|
||||
void _clutter_backend_add_options (ClutterBackend *backend,
|
||||
|
@ -91,7 +91,6 @@ struct _ClutterStagePrivate
|
||||
|
||||
guint redraw_pending : 1;
|
||||
guint is_fullscreen : 1;
|
||||
guint is_offscreen : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint is_user_resizable : 1;
|
||||
guint use_fog : 1;
|
||||
@ -581,13 +580,6 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
|
||||
CLUTTER_CONTEXT ()->redraw_count += 1;
|
||||
}
|
||||
|
||||
static void
|
||||
set_offscreen_while_unrealized (ClutterActor *actor,
|
||||
void *data)
|
||||
{
|
||||
CLUTTER_STAGE (actor)->priv->is_offscreen = GPOINTER_TO_INT (data);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -609,26 +601,8 @@ clutter_stage_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_OFFSCREEN:
|
||||
{
|
||||
gboolean was_showing;
|
||||
|
||||
if (priv->is_offscreen == g_value_get_boolean (value))
|
||||
return;
|
||||
|
||||
was_showing = CLUTTER_ACTOR_IS_VISIBLE (actor);
|
||||
|
||||
/* Backend needs to check this prop and handle accordingly
|
||||
* in realise.
|
||||
* FIXME: More 'obvious' implementation needed?
|
||||
*/
|
||||
_clutter_actor_rerealize (actor,
|
||||
set_offscreen_while_unrealized,
|
||||
GINT_TO_POINTER (g_value_get_boolean (value)));
|
||||
|
||||
if (was_showing &&
|
||||
!CLUTTER_ACTOR_IS_REALIZED (actor))
|
||||
priv->is_offscreen = ~g_value_get_boolean (value);
|
||||
}
|
||||
if (g_value_get_boolean (value))
|
||||
g_warning ("Offscreen stages are currently not supported\n");
|
||||
break;
|
||||
|
||||
case PROP_CURSOR_VISIBLE:
|
||||
@ -679,7 +653,7 @@ clutter_stage_get_property (GObject *gobject,
|
||||
break;
|
||||
|
||||
case PROP_OFFSCREEN:
|
||||
g_value_set_boolean (value, priv->is_offscreen);
|
||||
g_value_set_boolean (value, FALSE);
|
||||
break;
|
||||
|
||||
case PROP_FULLSCREEN_SET:
|
||||
@ -1020,7 +994,6 @@ clutter_stage_init (ClutterStage *self)
|
||||
|
||||
priv->event_queue = g_queue_new ();
|
||||
|
||||
priv->is_offscreen = FALSE;
|
||||
priv->is_fullscreen = FALSE;
|
||||
priv->is_user_resizable = FALSE;
|
||||
priv->is_cursor_visible = TRUE;
|
||||
|
@ -67,16 +67,6 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
EGLConfig configs[2];
|
||||
EGLint config_count;
|
||||
EGLBoolean status;
|
||||
gboolean is_offscreen;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
g_object_get (stage_egl->wrapper, "offscreen", &is_offscreen, NULL);
|
||||
|
||||
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
|
||||
|
||||
if (G_LIKELY (!is_offscreen))
|
||||
{
|
||||
EGLint cfg_attribs[] = { EGL_BUFFER_SIZE, EGL_DONT_CARE,
|
||||
EGL_RED_SIZE, 5,
|
||||
EGL_GREEN_SIZE, 6,
|
||||
@ -91,6 +81,10 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
#endif /* HAVE_COGL_GLES2 */
|
||||
EGL_NONE };
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
|
||||
|
||||
status = eglGetConfigs (backend_egl->edpy,
|
||||
configs,
|
||||
2,
|
||||
@ -210,13 +204,6 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
*/
|
||||
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_ACTOR_SYNC_MATRICES);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("EGL Backend does not yet support offscreen rendering\n");
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_width (ClutterActor *self,
|
||||
|
@ -263,8 +263,7 @@ clutter_backend_egl_create_stage (ClutterBackend *backend,
|
||||
}
|
||||
|
||||
static XVisualInfo *
|
||||
clutter_backend_egl_get_visual_info (ClutterBackendX11 *backend_x11,
|
||||
gboolean for_offscreen)
|
||||
clutter_backend_egl_get_visual_info (ClutterBackendX11 *backend_x11)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend_x11);
|
||||
EGLint visualid;
|
||||
|
@ -34,20 +34,11 @@ clutter_stage_egl_unrealize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (stage_window);
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
gboolean was_offscreen;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Unrealizing stage");
|
||||
|
||||
g_object_get (stage_x11->wrapper, "offscreen", &was_offscreen, NULL);
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
|
||||
if (G_UNLIKELY (was_offscreen))
|
||||
{
|
||||
/* No support as yet for this */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!stage_x11->is_foreign_xwin && stage_x11->xwin != None)
|
||||
{
|
||||
XDestroyWindow (stage_x11->xdpy, stage_x11->xwin);
|
||||
@ -55,7 +46,6 @@ clutter_stage_egl_unrealize (ClutterStageWindow *stage_window)
|
||||
}
|
||||
else
|
||||
stage_x11->xwin = None;
|
||||
}
|
||||
|
||||
if (stage_egl->egl_surface)
|
||||
{
|
||||
@ -79,29 +69,16 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
EGLConfig configs[2];
|
||||
EGLint config_count;
|
||||
EGLBoolean status;
|
||||
gboolean is_offscreen = FALSE;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
g_object_get (stage_x11->wrapper, "offscreen", &is_offscreen, NULL);
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
if (G_LIKELY (!is_offscreen))
|
||||
{
|
||||
Display *xdpy = clutter_eglx_display ();
|
||||
int c;
|
||||
int num_configs;
|
||||
EGLConfig *all_configs;
|
||||
|
||||
EGLint cfg_attribs[] = {
|
||||
EGL_BUFFER_SIZE, EGL_DONT_CARE,
|
||||
EGL_RED_SIZE, 5,
|
||||
EGL_GREEN_SIZE, 6,
|
||||
EGL_BLUE_SIZE, 5,
|
||||
EGL_STENCIL_SIZE, 8,
|
||||
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
#else /* HAVE_COGL_GLES2 */
|
||||
@ -110,16 +87,20 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
|
||||
EGL_NONE
|
||||
};
|
||||
EGLDisplay edpy;
|
||||
|
||||
status = eglGetConfigs (xdpy,
|
||||
configs,
|
||||
2,
|
||||
&config_count);
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
eglGetConfigs (xdpy, NULL, 0, &num_configs);
|
||||
backend = clutter_get_default_backend ();
|
||||
backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
edpy = clutter_eglx_display ();
|
||||
|
||||
eglGetConfigs (edpy, NULL, 0, &num_configs);
|
||||
|
||||
all_configs = g_malloc (num_configs * sizeof (EGLConfig));
|
||||
eglGetConfigs (xdpy,
|
||||
eglGetConfigs (clutter_eglx_display (),
|
||||
all_configs,
|
||||
num_configs,
|
||||
&num_configs);
|
||||
@ -128,24 +109,22 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
EGLint red = -1, green = -1, blue = -1, alpha = -1, stencil = -1;
|
||||
|
||||
eglGetConfigAttrib (xdpy,
|
||||
eglGetConfigAttrib (edpy,
|
||||
all_configs[c],
|
||||
EGL_RED_SIZE, &red);
|
||||
eglGetConfigAttrib (xdpy,
|
||||
eglGetConfigAttrib (edpy,
|
||||
all_configs[c],
|
||||
EGL_GREEN_SIZE, &green);
|
||||
eglGetConfigAttrib (xdpy,
|
||||
eglGetConfigAttrib (edpy,
|
||||
all_configs[c],
|
||||
EGL_BLUE_SIZE, &blue);
|
||||
eglGetConfigAttrib (xdpy,
|
||||
eglGetConfigAttrib (edpy,
|
||||
all_configs[c],
|
||||
EGL_ALPHA_SIZE, &alpha);
|
||||
eglGetConfigAttrib (xdpy,
|
||||
eglGetConfigAttrib (edpy,
|
||||
all_configs[c],
|
||||
EGL_STENCIL_SIZE, &stencil);
|
||||
|
||||
CLUTTER_NOTE (BACKEND,
|
||||
"EGLConfig == R:%d G:%d B:%d A:%d S:%d",
|
||||
CLUTTER_NOTE (BACKEND, "EGLConfig == R:%d G:%d B:%d A:%d S:%d \n",
|
||||
red, green, blue, alpha, stencil);
|
||||
}
|
||||
|
||||
@ -157,7 +136,7 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
status = eglChooseConfig (xdpy,
|
||||
status = eglChooseConfig (edpy,
|
||||
cfg_attribs,
|
||||
configs, G_N_ELEMENTS (configs),
|
||||
&config_count);
|
||||
@ -169,9 +148,8 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
}
|
||||
|
||||
if (stage_x11->xwin == None)
|
||||
{
|
||||
stage_x11->xwin =
|
||||
XCreateSimpleWindow (xdpy,
|
||||
XCreateSimpleWindow (stage_x11->xdpy,
|
||||
stage_x11->xwin_root,
|
||||
0, 0,
|
||||
stage_x11->xwin_width,
|
||||
@ -179,13 +157,12 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
0, 0,
|
||||
WhitePixel (stage_x11->xdpy,
|
||||
stage_x11->xscreen));
|
||||
}
|
||||
|
||||
if (clutter_x11_has_event_retrieval ())
|
||||
{
|
||||
if (clutter_x11_has_xinput ())
|
||||
{
|
||||
XSelectInput (xdpy, stage_x11->xwin,
|
||||
XSelectInput (stage_x11->xdpy, stage_x11->xwin,
|
||||
StructureNotifyMask |
|
||||
FocusChangeMask |
|
||||
ExposureMask |
|
||||
@ -196,7 +173,7 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
#endif
|
||||
}
|
||||
else
|
||||
XSelectInput (xdpy, stage_x11->xwin,
|
||||
XSelectInput (stage_x11->xdpy, stage_x11->xwin,
|
||||
StructureNotifyMask |
|
||||
FocusChangeMask |
|
||||
ExposureMask |
|
||||
@ -212,12 +189,12 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
|
||||
if (stage_egl->egl_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
eglDestroySurface (xdpy, stage_egl->egl_surface);
|
||||
eglDestroySurface (edpy, stage_egl->egl_surface);
|
||||
stage_egl->egl_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
stage_egl->egl_surface =
|
||||
eglCreateWindowSurface (xdpy,
|
||||
eglCreateWindowSurface (edpy,
|
||||
configs[0],
|
||||
(NativeWindowType) stage_x11->xwin,
|
||||
NULL);
|
||||
@ -234,13 +211,13 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
static const EGLint attribs[3]
|
||||
= { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
|
||||
|
||||
backend_egl->egl_context = eglCreateContext (xdpy,
|
||||
backend_egl->egl_context = eglCreateContext (edpy,
|
||||
configs[0],
|
||||
EGL_NO_CONTEXT,
|
||||
attribs);
|
||||
#else
|
||||
/* Seems some GLES implementations 1.x do not like attribs... */
|
||||
backend_egl->egl_context = eglCreateContext (xdpy,
|
||||
backend_egl->egl_context = eglCreateContext (edpy,
|
||||
configs[0],
|
||||
EGL_NO_CONTEXT,
|
||||
NULL);
|
||||
@ -254,12 +231,6 @@ clutter_stage_egl_realize (ClutterStageWindow *stage_window)
|
||||
backend_egl->egl_config = configs[0];
|
||||
CLUTTER_NOTE (GL, "Created EGL Context");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_critical ("EGLX Backend does not support offscreen rendering");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Successfully realized stage");
|
||||
|
||||
|
@ -63,17 +63,8 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
EGLConfig configs[2];
|
||||
EGLint config_count;
|
||||
EGLBoolean status;
|
||||
gboolean is_offscreen;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
g_object_get (stage_egl->wrapper, "offscreen", &is_offscreen, NULL);
|
||||
|
||||
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
|
||||
|
||||
if (G_LIKELY (!is_offscreen))
|
||||
{
|
||||
EGLint cfg_attribs[] = { EGL_BUFFER_SIZE, EGL_DONT_CARE,
|
||||
EGLint cfg_attribs[] = {
|
||||
EGL_BUFFER_SIZE, EGL_DONT_CARE,
|
||||
EGL_RED_SIZE, 5,
|
||||
EGL_GREEN_SIZE, 6,
|
||||
EGL_BLUE_SIZE, 5,
|
||||
@ -83,6 +74,10 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_NONE };
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
|
||||
|
||||
status = eglGetConfigs (backend_egl->edpy,
|
||||
configs,
|
||||
2,
|
||||
@ -180,12 +175,6 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning("EGL Backend does not yet support offscreen rendering\n");
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_width (ClutterActor *self,
|
||||
|
@ -356,7 +356,6 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
|
||||
|
||||
static gboolean
|
||||
clutter_backend_glx_create_context (ClutterBackend *backend,
|
||||
gboolean is_offscreen,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||
@ -365,18 +364,17 @@ clutter_backend_glx_create_context (ClutterBackend *backend,
|
||||
if (backend_glx->gl_context == None)
|
||||
{
|
||||
XVisualInfo *xvisinfo;
|
||||
gboolean is_direct;
|
||||
|
||||
xvisinfo =
|
||||
clutter_backend_x11_get_visual_info (backend_x11, is_offscreen);
|
||||
xvisinfo = clutter_backend_x11_get_visual_info (backend_x11);
|
||||
|
||||
CLUTTER_NOTE (GL, "Creating GL Context (display: %p, %s)",
|
||||
backend_x11->xdpy,
|
||||
is_offscreen ? "offscreen" : "onscreen");
|
||||
CLUTTER_NOTE (GL, "Creating GL Context (display: %p)",
|
||||
backend_x11->xdpy);
|
||||
|
||||
backend_glx->gl_context = glXCreateContext (backend_x11->xdpy,
|
||||
xvisinfo,
|
||||
0,
|
||||
is_offscreen ? False : True);
|
||||
True);
|
||||
|
||||
XFree (xvisinfo);
|
||||
|
||||
@ -384,15 +382,10 @@ clutter_backend_glx_create_context (ClutterBackend *backend,
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"Unable to create suitable %s GL context",
|
||||
is_offscreen ? "offscreen" : "onscreen");
|
||||
"Unable to create suitable GL context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!is_offscreen)
|
||||
{
|
||||
gboolean is_direct;
|
||||
|
||||
is_direct = glXIsDirect (backend_x11->xdpy,
|
||||
backend_glx->gl_context);
|
||||
|
||||
@ -400,7 +393,6 @@ clutter_backend_glx_create_context (ClutterBackend *backend,
|
||||
is_direct ? "direct" : "indirect");
|
||||
_cogl_set_indirect_context (!is_direct);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -576,13 +568,6 @@ clutter_backend_glx_redraw (ClutterBackend *backend,
|
||||
(unsigned long) stage_x11->xwin);
|
||||
glXSwapBuffers (stage_x11->xdpy, stage_x11->xwin);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* offscreen */
|
||||
glXWaitGL ();
|
||||
|
||||
CLUTTER_GLERR ();
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
@ -619,11 +604,10 @@ clutter_backend_glx_create_stage (ClutterBackend *backend,
|
||||
}
|
||||
|
||||
static XVisualInfo *
|
||||
clutter_backend_glx_get_visual_info (ClutterBackendX11 *backend_x11,
|
||||
gboolean for_offscreen)
|
||||
clutter_backend_glx_get_visual_info (ClutterBackendX11 *backend_x11)
|
||||
{
|
||||
XVisualInfo *xvisinfo;
|
||||
int onscreen_gl_attributes[] = {
|
||||
int attributes[] = {
|
||||
GLX_RGBA,
|
||||
GLX_DOUBLEBUFFER,
|
||||
GLX_RED_SIZE, 1,
|
||||
@ -634,32 +618,19 @@ clutter_backend_glx_get_visual_info (ClutterBackendX11 *backend_x11,
|
||||
GLX_DEPTH_SIZE, 1,
|
||||
0
|
||||
};
|
||||
int offscreen_gl_attributes[] = {
|
||||
GLX_RGBA,
|
||||
GLX_USE_GL,
|
||||
GLX_DEPTH_SIZE, 0,
|
||||
GLX_ALPHA_SIZE, 0,
|
||||
GLX_STENCIL_SIZE, 1,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
0
|
||||
};
|
||||
|
||||
if (backend_x11->xdpy == None || backend_x11->xscreen == None)
|
||||
return NULL;
|
||||
|
||||
CLUTTER_NOTE (BACKEND,
|
||||
"Retrieving GL visual (for %s use), dpy: %p, xscreen; %p (%d)",
|
||||
for_offscreen ? "offscreen" : "onscreen",
|
||||
"Retrieving GL visual, dpy: %p, xscreen; %p (%d)",
|
||||
backend_x11->xdpy,
|
||||
backend_x11->xscreen,
|
||||
backend_x11->xscreen_num);
|
||||
|
||||
xvisinfo = glXChooseVisual (backend_x11->xdpy,
|
||||
backend_x11->xscreen_num,
|
||||
for_offscreen ? offscreen_gl_attributes
|
||||
: onscreen_gl_attributes);
|
||||
attributes);
|
||||
|
||||
return xvisinfo;
|
||||
}
|
||||
|
@ -61,32 +61,12 @@ static void
|
||||
clutter_stage_glx_unrealize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage_window);
|
||||
gboolean was_offscreen;
|
||||
|
||||
/* Note unrealize should free up any backend stage related resources */
|
||||
CLUTTER_NOTE (BACKEND, "Unrealizing stage");
|
||||
|
||||
g_object_get (stage_x11->wrapper, "offscreen", &was_offscreen, NULL);
|
||||
|
||||
clutter_x11_trap_x_errors ();
|
||||
|
||||
if (G_UNLIKELY (was_offscreen))
|
||||
{
|
||||
if (stage_glx->glxpixmap)
|
||||
{
|
||||
glXDestroyGLXPixmap (stage_x11->xdpy,stage_glx->glxpixmap);
|
||||
stage_glx->glxpixmap = None;
|
||||
}
|
||||
|
||||
if (stage_x11->xpixmap)
|
||||
{
|
||||
XFreePixmap (stage_x11->xdpy, stage_x11->xpixmap);
|
||||
stage_x11->xpixmap = None;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!stage_x11->is_foreign_xwin && stage_x11->xwin != None)
|
||||
{
|
||||
XDestroyWindow (stage_x11->xdpy, stage_x11->xwin);
|
||||
@ -94,7 +74,6 @@ clutter_stage_glx_unrealize (ClutterStageWindow *stage_window)
|
||||
}
|
||||
else
|
||||
stage_x11->xwin = None;
|
||||
}
|
||||
|
||||
if (stage_x11->xvisinfo != None)
|
||||
{
|
||||
@ -113,28 +92,20 @@ static gboolean
|
||||
clutter_stage_glx_realize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage_window);
|
||||
ClutterBackend *backend;
|
||||
ClutterBackendGLX *backend_glx;
|
||||
ClutterBackendX11 *backend_x11;
|
||||
gboolean is_offscreen;
|
||||
GError *error;
|
||||
|
||||
CLUTTER_NOTE (ACTOR, "Realizing stage '%s' [%p]",
|
||||
G_OBJECT_TYPE_NAME (stage_window),
|
||||
stage_window);
|
||||
|
||||
g_object_get (stage_x11->wrapper, "offscreen", &is_offscreen, NULL);
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
backend_glx = CLUTTER_BACKEND_GLX (backend);
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
if (G_LIKELY (!is_offscreen))
|
||||
{
|
||||
GError *error;
|
||||
|
||||
stage_x11->xvisinfo =
|
||||
clutter_backend_x11_get_visual_info (backend_x11, FALSE);
|
||||
stage_x11->xvisinfo = clutter_backend_x11_get_visual_info (backend_x11);
|
||||
|
||||
if (stage_x11->xvisinfo == None)
|
||||
{
|
||||
@ -203,7 +174,7 @@ clutter_stage_glx_realize (ClutterStageWindow *stage_window)
|
||||
|
||||
/* ask for a context; a no-op, if a context already exists */
|
||||
error = NULL;
|
||||
_clutter_backend_create_context (backend, FALSE, &error);
|
||||
_clutter_backend_create_context (backend, &error);
|
||||
if (error)
|
||||
{
|
||||
g_critical ("Unable to realize stage: %s", error->message);
|
||||
@ -212,55 +183,6 @@ clutter_stage_glx_realize (ClutterStageWindow *stage_window)
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Successfully realized stage");
|
||||
}
|
||||
else
|
||||
{
|
||||
GError *error;
|
||||
|
||||
if (stage_x11->xvisinfo != None)
|
||||
{
|
||||
XFree (stage_x11->xvisinfo);
|
||||
stage_x11->xvisinfo = None;
|
||||
}
|
||||
|
||||
stage_x11->xvisinfo =
|
||||
clutter_backend_x11_get_visual_info (backend_x11, TRUE);
|
||||
|
||||
if (stage_x11->xvisinfo == None)
|
||||
{
|
||||
g_critical ("Unable to find suitable GL visual.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stage_x11->xpixmap = XCreatePixmap (stage_x11->xdpy,
|
||||
stage_x11->xwin_root,
|
||||
stage_x11->xwin_width,
|
||||
stage_x11->xwin_height,
|
||||
DefaultDepth (stage_x11->xdpy,
|
||||
stage_x11->xscreen));
|
||||
|
||||
stage_glx->glxpixmap = glXCreateGLXPixmap (stage_x11->xdpy,
|
||||
stage_x11->xvisinfo,
|
||||
stage_x11->xpixmap);
|
||||
|
||||
/* ask for a context; a no-op, if a context already exists
|
||||
*
|
||||
* FIXME: we probably need a seperate offscreen context here
|
||||
* - though it likely makes most sense to drop offscreen stages
|
||||
* and rely on FBO's instead and GLXPixmaps seems mostly broken
|
||||
* anyway..
|
||||
*/
|
||||
error = NULL;
|
||||
_clutter_backend_create_context (backend, TRUE, &error);
|
||||
if (error)
|
||||
{
|
||||
g_critical ("Unable to realize stage: %s", error->message);
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Successfully realized stage");
|
||||
}
|
||||
|
||||
/* chain up to the StageX11 implementation */
|
||||
return clutter_stage_glx_parent_iface->realize (stage_window);
|
||||
|
@ -259,7 +259,6 @@ clutter_stage_osx_realize (ClutterActor *actor)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (actor);
|
||||
ClutterBackendOSX *backend_osx;
|
||||
gboolean offscreen;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] realize", self);
|
||||
|
||||
@ -268,15 +267,6 @@ clutter_stage_osx_realize (ClutterActor *actor)
|
||||
|
||||
CLUTTER_OSX_POOL_ALLOC();
|
||||
|
||||
g_object_get (self->wrapper, "offscreen", &offscreen, NULL);
|
||||
|
||||
if (offscreen)
|
||||
{
|
||||
g_warning("OSX Backend does not yet support offscreen rendering\n");
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
return;
|
||||
}
|
||||
|
||||
backend_osx = CLUTTER_BACKEND_OSX (self->backend);
|
||||
|
||||
NSRect rect = NSMakeRect(0, 0, self->requisition_width, self->requisition_height);
|
||||
|
@ -54,20 +54,15 @@ static gboolean
|
||||
clutter_stage_sdl_realize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (stage_window);
|
||||
gboolean is_offscreen, is_fullscreen;
|
||||
gboolean is_fullscreen = FALSE;
|
||||
gint flags = SDL_OPENGL;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
is_offscreen = is_fullscreen = FALSE;
|
||||
g_object_get (stage_sdl->wrapper,
|
||||
"offscreen", &is_offscreen,
|
||||
"fullscreen-set", &is_fullscreen,
|
||||
NULL);
|
||||
|
||||
if (G_LIKELY (!is_offscreen))
|
||||
{
|
||||
gint flags = SDL_OPENGL;
|
||||
|
||||
if (is_fullscreen)
|
||||
flags |= SDL_FULLSCREEN;
|
||||
|
||||
@ -85,14 +80,6 @@ clutter_stage_sdl_realize (ClutterStageWindow *stage_window)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME */
|
||||
g_critical ("SDL Backend does not yet support offscreen rendering");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -981,8 +981,7 @@ clutter_x11_has_composite_extension (void)
|
||||
}
|
||||
|
||||
XVisualInfo *
|
||||
clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11,
|
||||
gboolean for_offscreen)
|
||||
clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11)
|
||||
{
|
||||
ClutterBackendX11Class *klass;
|
||||
|
||||
@ -990,7 +989,7 @@ clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11,
|
||||
|
||||
klass = CLUTTER_BACKEND_X11_GET_CLASS (backend_x11);
|
||||
if (klass->get_visual_info)
|
||||
return klass->get_visual_info (backend_x11, for_offscreen);
|
||||
return klass->get_visual_info (backend_x11);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -86,8 +86,7 @@ struct _ClutterBackendX11Class
|
||||
{
|
||||
ClutterBackendClass parent_class;
|
||||
|
||||
XVisualInfo *(* get_visual_info) (ClutterBackendX11 *backend,
|
||||
gboolean for_offscreen);
|
||||
XVisualInfo *(* get_visual_info) (ClutterBackendX11 *backend);
|
||||
};
|
||||
|
||||
void _clutter_backend_x11_events_init (ClutterBackend *backend);
|
||||
@ -119,8 +118,7 @@ ClutterFeatureFlags
|
||||
clutter_backend_x11_get_features (ClutterBackend *backend);
|
||||
|
||||
XVisualInfo *
|
||||
clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11,
|
||||
gboolean for_offscreen);
|
||||
clutter_backend_x11_get_visual_info (ClutterBackendX11 *backend_x11);
|
||||
|
||||
void
|
||||
_clutter_x11_register_xinput (void);
|
||||
|
@ -714,12 +714,9 @@ clutter_x11_get_stage_visual (ClutterStage *stage)
|
||||
{
|
||||
ClutterStageWindow *impl;
|
||||
ClutterStageX11 *stage_x11;
|
||||
gboolean is_offscreen = FALSE;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
|
||||
|
||||
g_object_get (G_OBJECT (stage), "offscreen", &is_offscreen, NULL);
|
||||
|
||||
impl = _clutter_stage_get_window (stage);
|
||||
g_assert (CLUTTER_IS_STAGE_X11 (impl));
|
||||
|
||||
@ -730,7 +727,7 @@ clutter_x11_get_stage_visual (ClutterStage *stage)
|
||||
ClutterBackendX11 *backend_x11 = stage_x11->backend;
|
||||
|
||||
stage_x11->xvisinfo =
|
||||
clutter_backend_x11_get_visual_info (backend_x11, is_offscreen);
|
||||
clutter_backend_x11_get_visual_info (backend_x11);
|
||||
}
|
||||
|
||||
return stage_x11->xvisinfo;
|
||||
|
Loading…
Reference in New Issue
Block a user