Commit 566c28bd authored by Jonas Ådahl's avatar Jonas Ådahl

Introduce regional stage rendering

Add support for drawing a stage using multiple framebuffers each making
up one part of the stage. This works by the stage backend
(ClutterStageWindow) providing a list of views which will be for
splitting up the stage in different regions.

A view layout, for now, is a set of rectangles. The stage window (i.e.
stage "backend" will use this information when drawing a frame, using
one framebuffer for each view. The scene graph is adapted to explictly
take a view when painting the stage. It will use this view, its
assigned framebuffer and layout to offset and clip the drawing
accordingly.

This effectively removes any notion of "stage framebuffer", since each
stage now may consist of multiple framebuffers. Therefore, API
involving this has been deprecated and made no-ops; namely
clutter_stage_ensure_context(). Callers are now assumed to either
always use a framebuffer reference explicitly, or push/pop the
framebuffer of a given view where the code has not yet changed to use
the explicit-buffer-using cogl API.

Currently only the nested X11 backend supports this mode fully, and the
per view framebuffers are all offscreen. Upon frame completion, it'll
blit each view's framebuffer onto the onscreen framebuffer before
swapping.

Other backends (X11 CM and native/KMS) are adapted to manage a
full-stage view. The X11 CM backend will continue to use this method,
while the native/KMS backend will be adopted to use multiple view
drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
parent 749237a2
......@@ -114,6 +114,7 @@ source_h = \
clutter-snap-constraint.h \
clutter-stage.h \
clutter-stage-manager.h \
clutter-stage-view.h \
clutter-tap-action.h \
clutter-test-utils.h \
clutter-texture.h \
......@@ -197,6 +198,7 @@ source_c = \
clutter-snap-constraint.c \
clutter-stage.c \
clutter-stage-manager.c \
clutter-stage-view.c \
clutter-stage-window.c \
clutter-tap-action.c \
clutter-test-utils.c \
......
......@@ -86,8 +86,6 @@ struct _ClutterBackendClass
GError **error);
gboolean (* create_context) (ClutterBackend *backend,
GError **error);
void (* ensure_context) (ClutterBackend *backend,
ClutterStage *stage);
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
void (* copy_event_data) (ClutterBackend *backend,
......@@ -113,10 +111,6 @@ ClutterBackend * _clutter_create_backend (void);
ClutterStageWindow * _clutter_backend_create_stage (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
void _clutter_backend_ensure_context (ClutterBackend *backend,
ClutterStage *stage);
void _clutter_backend_ensure_context_internal (ClutterBackend *backend,
ClutterStage *stage);
gboolean _clutter_backend_create_context (ClutterBackend *backend,
GError **error);
......@@ -152,6 +146,7 @@ gint32 _clutter_backend_get_units_serial (Clutter
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend);
CLUTTER_AVAILABLE_IN_MUTTER
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
void clutter_set_allowed_drivers (const char *drivers);
......
......@@ -413,27 +413,6 @@ clutter_backend_real_create_context (ClutterBackend *backend,
return TRUE;
}
static void
clutter_backend_real_ensure_context (ClutterBackend *backend,
ClutterStage *stage)
{
ClutterStageWindow *stage_impl;
CoglFramebuffer *framebuffer;
if (stage == NULL)
return;
stage_impl = _clutter_stage_get_window (stage);
if (stage_impl == NULL)
return;
framebuffer = _clutter_stage_window_get_active_framebuffer (stage_impl);
if (framebuffer == NULL)
return;
cogl_set_framebuffer (framebuffer);
}
static ClutterFeatureFlags
clutter_backend_real_get_features (ClutterBackend *backend)
{
......@@ -697,7 +676,6 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->get_device_manager = clutter_backend_real_get_device_manager;
klass->translate_event = clutter_backend_real_translate_event;
klass->create_context = clutter_backend_real_create_context;
klass->ensure_context = clutter_backend_real_ensure_context;
klass->get_features = clutter_backend_real_get_features;
}
......@@ -789,87 +767,6 @@ _clutter_backend_create_context (ClutterBackend *backend,
return klass->create_context (backend, error);
}
void
_clutter_backend_ensure_context_internal (ClutterBackend *backend,
ClutterStage *stage)
{
ClutterBackendClass *klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (G_LIKELY (klass->ensure_context))
klass->ensure_context (backend, stage);
}
void
_clutter_backend_ensure_context (ClutterBackend *backend,
ClutterStage *stage)
{
static ClutterStage *current_context_stage = NULL;
g_assert (CLUTTER_IS_BACKEND (backend));
g_assert (CLUTTER_IS_STAGE (stage));
if (current_context_stage != stage ||
!clutter_actor_is_realized (CLUTTER_ACTOR (stage)))
{
ClutterStage *new_stage = NULL;
if (!clutter_actor_is_realized (CLUTTER_ACTOR (stage)))
{
new_stage = NULL;
CLUTTER_NOTE (BACKEND,
"Stage [%p] is not realized, unsetting the stage",
stage);
}
else
{
new_stage = stage;
CLUTTER_NOTE (BACKEND,
"Setting the new stage [%p]",
new_stage);
}
/* XXX: Until Cogl becomes fully responsible for backend windows
* Clutter need to manually keep it informed of the current window size
*
* NB: This must be done after we ensure_context above because Cogl
* always assumes there is a current GL context.
*/
if (new_stage != NULL)
{
float width, height;
_clutter_backend_ensure_context_internal (backend, new_stage);
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
cogl_onscreen_clutter_backend_set_size (width, height);
/* Eventually we will have a separate CoglFramebuffer for
* each stage and each one will track private projection
* matrix and viewport state, but until then we need to make
* sure we update the projection and viewport whenever we
* switch between stages.
*
* This dirty mechanism will ensure they are asserted before
* the next paint...
*/
_clutter_stage_dirty_viewport (stage);
_clutter_stage_dirty_projection (stage);
}
/* FIXME: With a NULL stage and thus no active context it may make more
* sense to clean the context but then re call with the default stage
* so at least there is some kind of context in place (as to avoid
* potential issue of GL calls with no context).
*/
current_context_stage = new_stage;
}
else
CLUTTER_NOTE (BACKEND, "Stage is the same");
}
ClutterFeatureFlags
_clutter_backend_get_features (ClutterBackend *backend)
{
......
......@@ -278,6 +278,8 @@
# define CLUTTER_DEPRECATED_IN_1_12_FOR(f) _CLUTTER_EXTERN
#endif
#define CLUTTER_DEPRECATED_IN_MUTTER CLUTTER_DEPRECATED
#if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_12
# define CLUTTER_AVAILABLE_IN_1_12 CLUTTER_UNAVAILABLE(1, 12)
#else
......
......@@ -27,6 +27,7 @@
#include "clutter-backend.h"
#include "clutter-macros.h"
#include "clutter-stage-view.h"
#include "cogl/clutter-stage-cogl.h"
#include "x11/clutter-stage-x11.h"
......
......@@ -244,6 +244,10 @@ void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
const cairo_rectangle_int_t *src2,
cairo_rectangle_int_t *dest);
gboolean _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1,
const cairo_rectangle_int_t *src2,
cairo_rectangle_int_t *dest);
struct _ClutterVertex4
{
......
......@@ -36,7 +36,8 @@ typedef struct _ClutterStageQueueRedrawEntry ClutterStageQueueRedrawEntry;
/* stage */
ClutterStageWindow *_clutter_stage_get_default_window (void);
void _clutter_stage_do_paint (ClutterStage *stage,
void _clutter_stage_paint_view (ClutterStage *stage,
ClutterStageView *view,
const cairo_rectangle_int_t *clip);
void _clutter_stage_set_window (ClutterStage *stage,
......@@ -56,7 +57,8 @@ void _clutter_stage_get_viewport (ClutterStage
float *width,
float *height);
void _clutter_stage_dirty_viewport (ClutterStage *stage);
void _clutter_stage_maybe_setup_viewport (ClutterStage *stage);
void _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
ClutterStageView *view);
void _clutter_stage_maybe_relayout (ClutterActor *stage);
gboolean _clutter_stage_needs_update (ClutterStage *stage);
gboolean _clutter_stage_do_update (ClutterStage *stage);
......
/*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#include "clutter/clutter-stage-view.h"
#include <cairo-gobject.h>
enum
{
PROP_0,
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
typedef struct _ClutterStageViewPrivate
{
cairo_rectangle_int_t layout;
CoglFramebuffer *framebuffer;
guint dirty_viewport : 1;
guint dirty_projection : 1;
} ClutterStageViewPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageView, clutter_stage_view, G_TYPE_OBJECT)
void
clutter_stage_view_get_layout (ClutterStageView *view,
cairo_rectangle_int_t *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
*rect = priv->layout;
}
CoglFramebuffer *
clutter_stage_view_get_framebuffer (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
return priv->framebuffer;
}
gboolean
clutter_stage_view_is_dirty_viewport (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
return priv->dirty_viewport;
}
void
clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
gboolean dirty)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
priv->dirty_viewport = dirty;
}
gboolean
clutter_stage_view_is_dirty_projection (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
return priv->dirty_projection;
}
void
clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
priv->dirty_projection = dirty;
}
static void
clutter_stage_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
switch (prop_id)
{
case PROP_LAYOUT:
g_value_set_boxed (value, &priv->layout);
break;
case PROP_FRAMEBUFFER:
g_value_set_boxed (value, priv->framebuffer);
break;
}
}
static void
clutter_stage_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
cairo_rectangle_int_t *layout;
switch (prop_id)
{
case PROP_LAYOUT:
layout = g_value_get_boxed (value);
priv->layout = *layout;
break;
case PROP_FRAMEBUFFER:
priv->framebuffer = g_value_get_boxed (value);
break;
}
}
static void
clutter_stage_view_dispose (GObject *object)
{
ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
}
static void
clutter_stage_view_init (ClutterStageView *view)
{
}
static void
clutter_stage_view_class_init (ClutterStageViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = clutter_stage_view_get_property;
object_class->set_property = clutter_stage_view_set_property;
object_class->dispose = clutter_stage_view_dispose;
obj_props[PROP_LAYOUT] =
g_param_spec_boxed ("layout",
"View layout",
"The view layout on the screen",
CAIRO_GOBJECT_TYPE_RECTANGLE_INT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_FRAMEBUFFER] =
g_param_spec_boxed ("framebuffer",
"View framebuffer",
"The framebuffer of the view",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
}
/*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_STAGE_VIEW_H__
#define __CLUTTER_STAGE_VIEW_H__
#include <cairo.h>
#include <glib-object.h>
#include <cogl/cogl.h>
#include "clutter-macros.h"
#define CLUTTER_TYPE_STAGE_VIEW (clutter_stage_view_get_type ())
CLUTTER_AVAILABLE_IN_MUTTER
G_DECLARE_DERIVABLE_TYPE (ClutterStageView, clutter_stage_view,
CLUTTER, STAGE_VIEW,
GObject)
struct _ClutterStageViewClass
{
GObjectClass parent_class;
};
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_stage_view_get_layout (ClutterStageView *view,
cairo_rectangle_int_t *rect);
CLUTTER_AVAILABLE_IN_MUTTER
CoglFramebuffer *clutter_stage_view_get_framebuffer (ClutterStageView *view);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
gboolean dirty);
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
#endif /* __CLUTTER_STAGE_VIEW_H__ */
......@@ -274,6 +274,7 @@ _clutter_stage_window_redraw (ClutterStageWindow *window)
void
_clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
ClutterStageView *view,
int *x, int *y)
{
ClutterStageWindowIface *iface;
......@@ -285,27 +286,7 @@ _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_dirty_pixel)
iface->get_dirty_pixel (window, x, y);
}
/* NB: The presumption shouldn't be that a stage can't be comprised of
* multiple internal framebuffers, so instead of simply naming this
* function _clutter_stage_window_get_framebuffer(), the "active"
* infix is intended to clarify that it gets the framebuffer that is
* currently in use/being painted.
*/
CoglFramebuffer *
_clutter_stage_window_get_active_framebuffer (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), NULL);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_active_framebuffer)
return iface->get_active_framebuffer (window);
else
return NULL;
iface->get_dirty_pixel (window, view, x, y);
}
gboolean
......@@ -349,12 +330,12 @@ _clutter_stage_window_get_scale_factor (ClutterStageWindow *window)
return 1;
}
CoglFramebuffer *
_clutter_stage_window_get_legacy_onscreen (ClutterStageWindow *window)
GList *
_clutter_stage_window_get_views (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
return iface->get_legacy_onscreen (window);
return iface->get_views (window);
}
CoglFrameClosure *
......@@ -376,6 +357,15 @@ _clutter_stage_window_remove_frame_callback (ClutterStageWindow *window,
iface->remove_frame_callback (window, closure);
}
void
_clutter_stage_window_finish_frame (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->finish_frame)
iface->finish_frame (window);
}
int64_t
_clutter_stage_window_get_frame_counter (ClutterStageWindow *window)
{
......
......@@ -3,6 +3,7 @@
#include <cogl/cogl.h>
#include <clutter/clutter-types.h>
#include "clutter/clutter-stage-view.h"
G_BEGIN_DECLS
......@@ -77,22 +78,22 @@ struct _ClutterStageWindowIface
void (* redraw) (ClutterStageWindow *stage_window);
void (* get_dirty_pixel) (ClutterStageWindow *stage_window,
ClutterStageView *view,
int *x, int *y);
CoglFramebuffer *(* get_active_framebuffer) (ClutterStageWindow *stage_window);
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
void (* set_scale_factor) (ClutterStageWindow *stage_window,
int factor);
int (* get_scale_factor) (ClutterStageWindow *stage_window);
CoglFramebuffer *(* get_legacy_onscreen) (ClutterStageWindow *stage_window);
GList *(* get_views) (ClutterStageWindow *stage_window);
CoglFrameClosure *(* set_frame_callback) (ClutterStageWindow *stage_window,
CoglFrameCallback callback,
gpointer user_data);
void (* remove_frame_callback) (ClutterStageWindow *stage_window,
CoglFrameClosure *closure);
int64_t (* get_frame_counter) (ClutterStageWindow *stage_window);
void (* finish_frame) (ClutterStageWindow *stage_window);
};
CLUTTER_AVAILABLE_IN_MUTTER
......@@ -139,17 +140,16 @@ void _clutter_stage_window_set_accept_focus (ClutterStageWin
void _clutter_stage_window_redraw (ClutterStageWindow *window);
void _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
ClutterStageView *view,
int *x, int *y);
CoglFramebuffer *_clutter_stage_window_get_active_framebuffer (ClutterStageWindow *window);
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
void _clutter_stage_window_set_scale_factor (ClutterStageWindow *window,
int factor);
int _clutter_stage_window_get_scale_factor (ClutterStageWindow *window);
CoglFramebuffer *_clutter_stage_window_get_legacy_onscreen (ClutterStageWindow *stage_window);
GList * _clutter_stage_window_get_views (ClutterStageWindow *window);
CoglFrameClosure *_clutter_stage_window_set_frame_callback (ClutterStageWindow *window,
CoglFrameCallback callback,
......@@ -158,6 +158,8 @@ CoglFrameClosure *_clutter_stage_window_set_frame_callback (ClutterStageWin
void _clutter_stage_window_remove_frame_callback (ClutterStageWindow *stage_winow,
CoglFrameClosure *closure);
void _clutter_stage_window_finish_frame (ClutterStageWindow *window);
int64_t _clutter_stage_window_get_frame_counter (ClutterStageWindow *window);
G_END_DECLS
......
This diff is collapsed.
......@@ -229,9 +229,6 @@ guchar * clutter_stage_read_pixels (ClutterStage
CLUTTER_AVAILABLE_IN_ALL
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip);
CLUTTER_AVAILABLE_IN_ALL
void clutter_stage_ensure_current (ClutterStage *stage);
CLUTTER_AVAILABLE_IN_ALL
void clutter_stage_ensure_viewport (ClutterStage *stage);
CLUTTER_AVAILABLE_IN_ALL
......
......@@ -161,6 +161,39 @@ _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
dest->y = dest_y;
}
gboolean
_clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1,
const cairo_rectangle_int_t *src2,
cairo_rectangle_int_t *dest)
{
int x1, y1, x2, y2;
x1 = MAX (src1->x, src2->x);
y1 = MAX (src1->y, src2->y);
x2 = MIN (src1->x + (int) src1->width, src2->x + (int) src2->width);
y2 = MIN (src1->y + (int) src1->height, src2->y + (int) src2->height);
if (x1 >= x2 || y1 >= y2)
{
dest->x = 0;
dest->y = 0;
dest->width = 0;
dest->height = 0;
return FALSE;
}
else
{
dest->x = x1;
dest->y = y1;
dest->width = x2 - x1;
dest->height = y2 - y1;
return TRUE;
}
}
float
_clutter_util_matrix_determinant (const ClutterMatrix *matrix)
{
......
This diff is collapsed.
......@@ -11,6 +11,8 @@
#include <X11/Xutil.h>
#endif
#include "clutter/clutter-stage-window.h"
G_BEGIN_DECLS
#define CLUTTER_TYPE_STAGE_COGL (_clutter_stage_cogl_get_type ())
......@@ -25,6 +27,17 @@ typedef struct _ClutterStageCoglClass ClutterStageCoglClass;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStageCogl, g_object_unref)
#define CLUTTER_TYPE_STAGE_VIEW_COGL (clutter_stage_view_cogl_get_type ())
CLUTTER_AVAILABLE_IN_MUTTER
G_DECLARE_DERIVABLE_TYPE (ClutterStageViewCogl, clutter_stage_view_cogl,
CLUTTER, STAGE_VIEW_COGL,
ClutterStageView)
struct _ClutterStageViewCoglClass
{
ClutterStageViewClass parent_class;
};
struct _ClutterStageCogl
{
GObject parent_instance;
......@@ -50,12 +63,6 @@ struct _ClutterStageCogl
cairo_rectangle_int_t bounding_redraw_clip;
/* Stores a list of previous damaged areas */
#define DAMAGE_HISTORY_MAX 16
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX];
unsigned int damage_index;
guint initialized_redraw_clip : 1;
/* TRUE if the current paint cycle has a clipped redraw. In that
......
......@@ -97,6 +97,9 @@ CLUTTER_DEPRECATED_IN_1_10_FOR(clutter_actor_get_background_color)
void clutter_stage_get_color (ClutterStage *stage,
ClutterColor *color);
CLUTTER_DEPRECATED_IN_MUTTER
void clutter_stage_ensure_current (ClutterStage *stage);
G_END_DECLS
#endif /* __CLUTTER_STAGE_DEPRECATED_H__ */
......@@ -445,6 +445,8 @@ clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
clutter_stage_window_parent_iface->unrealize (stage_window);
g_list_free (stage_x11->legacy_views);
g_clear_object (&stage_x11->legacy_view);
g_clear_pointer (&stage_x11->onscreen, cogl_object_unref);
}
......@@ -626,6 +628,11 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
stage_x11->onscreen = cogl_onscreen_new (backend->cogl_context, width, height);
if (stage_x11->legacy_view)
g_object_set (G_OBJECT (stage_x11->legacy_view),
"framebuffer", stage_x11->onscreen,
NULL);
/* We just created a window of the size of the actor. No need to fix
the size of the stage, just update it. */
stage_x11->xwin_width = width;
......@@ -892,12 +899,34 @@ clutter_stage_x11_get_scale_factor (ClutterStageWindow *stage_window)
return stage_x11->scale_factor;
}
static CoglFramebuffer *
clutter_stage_x11_get_legacy_onscreen (ClutterStageWindow *stage_window)
static void