2016-05-05 22:21:51 +08:00
|
|
|
#include "clutter-build-config.h"
|
2008-04-04 15:02:11 +00:00
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
|
|
#include "clutter-actor.h"
|
2020-10-09 18:16:16 +02:00
|
|
|
#include "clutter-frame.h"
|
2008-04-04 15:02:11 +00:00
|
|
|
#include "clutter-stage-window.h"
|
|
|
|
#include "clutter-private.h"
|
|
|
|
|
2018-10-19 09:15:54 +02:00
|
|
|
/**
|
2022-05-25 18:41:48 +02:00
|
|
|
* ClutterStageWindow:
|
|
|
|
*
|
|
|
|
* Handles the implementation for [class@Stage]
|
2018-10-19 09:15:54 +02:00
|
|
|
*
|
|
|
|
* #ClutterStageWindow is an interface that provides the implementation for the
|
2022-05-25 18:41:48 +02:00
|
|
|
* [class@Stage] actor, abstracting away the specifics of the windowing system.
|
2018-10-19 09:15:54 +02:00
|
|
|
*/
|
|
|
|
|
2010-10-08 14:47:46 +01:00
|
|
|
G_DEFINE_INTERFACE (ClutterStageWindow, clutter_stage_window, G_TYPE_OBJECT);
|
2008-04-04 15:02:11 +00:00
|
|
|
|
2010-10-08 14:47:46 +01:00
|
|
|
static void
|
|
|
|
clutter_stage_window_default_init (ClutterStageWindowInterface *iface)
|
|
|
|
{
|
2008-04-04 15:02:11 +00:00
|
|
|
}
|
2009-08-13 12:34:07 +01:00
|
|
|
|
2018-10-19 09:15:54 +02:00
|
|
|
/**
|
|
|
|
* _clutter_stage_window_get_wrapper:
|
|
|
|
* @window: a #ClutterStageWindow object
|
|
|
|
*
|
|
|
|
* Returns the pointer to the #ClutterStage it's part of.
|
|
|
|
*/
|
2009-08-13 12:34:07 +01:00
|
|
|
ClutterActor *
|
|
|
|
_clutter_stage_window_get_wrapper (ClutterStageWindow *window)
|
|
|
|
{
|
|
|
|
return CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_wrapper (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_stage_window_set_title (ClutterStageWindow *window,
|
|
|
|
const gchar *title)
|
|
|
|
{
|
2019-01-08 13:51:47 +01:00
|
|
|
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
2011-05-11 19:59:52 +01:00
|
|
|
|
|
|
|
if (iface->set_title)
|
|
|
|
iface->set_title (window, title);
|
2009-08-13 12:34:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_clutter_stage_window_realize (ClutterStageWindow *window)
|
|
|
|
{
|
|
|
|
return CLUTTER_STAGE_WINDOW_GET_IFACE (window)->realize (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_stage_window_unrealize (ClutterStageWindow *window)
|
|
|
|
{
|
|
|
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->unrealize (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_stage_window_show (ClutterStageWindow *window,
|
|
|
|
gboolean do_raise)
|
|
|
|
{
|
|
|
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->show (window, do_raise);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_stage_window_hide (ClutterStageWindow *window)
|
|
|
|
{
|
|
|
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->hide (window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_clutter_stage_window_resize (ClutterStageWindow *window,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
|
|
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->resize (window, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-08-16 16:01:22 +01:00
|
|
|
_clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
|
|
|
cairo_rectangle_int_t *geometry)
|
2009-08-13 12:34:07 +01:00
|
|
|
{
|
|
|
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_geometry (window, geometry);
|
|
|
|
}
|
2009-11-12 20:37:01 +00:00
|
|
|
|
2012-11-08 12:42:24 -05:00
|
|
|
void
|
clutter: Paint views with individual frame clocks
Replace the default master clock with multiple frame clocks, each
driving its own stage view. As each stage view represents one CRTC, this
means we draw each CRTC with its own designated frame clock,
disconnected from all the others.
For example this means we when using the native backend will never need
to wait for one monitor to vsync before painting another, so e.g. having
a 144 Hz monitor next to a 60 Hz monitor, things including both Wayland
and X11 applications and shell UI will be able to render at the
corresponding monitor refresh rate.
This also changes a warning about missed frames when sending
_NETWM_FRAME_TIMINGS messages to a debug log entry, as it's expected
that we'll start missing frames e.g. when a X11 window (via Xwayland) is
exclusively within a stage view that was not painted, while another one
was, still increasing the global frame clock.
Addititonally, this also requires the X11 window actor to schedule
timeouts for _NET_WM_FRAME_DRAWN/_NET_WM_FRAME_TIMINGS event emitting,
if the actor wasn't on any stage views, as now we'll only get the frame
callbacks on actors when they actually were painted, while in the past,
we'd invoke that vfunc when anything was painted.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/903
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-05-30 00:27:56 +02:00
|
|
|
_clutter_stage_window_redraw_view (ClutterStageWindow *window,
|
2020-10-09 18:16:16 +02:00
|
|
|
ClutterStageView *view,
|
|
|
|
ClutterFrame *frame)
|
2012-11-08 12:42:24 -05:00
|
|
|
{
|
2011-02-04 15:08:48 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
|
|
|
|
2020-10-09 18:16:16 +02:00
|
|
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->redraw_view (window, view, frame);
|
2011-02-04 15:08:48 +00:00
|
|
|
}
|
2011-03-10 22:05:03 +00:00
|
|
|
|
2011-09-30 13:58:40 +01:00
|
|
|
gboolean
|
|
|
|
_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
|
|
|
|
{
|
2019-01-08 13:51:47 +01:00
|
|
|
ClutterStageWindowInterface *iface;
|
2011-09-30 13:58:40 +01:00
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
|
|
|
|
|
|
|
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
|
|
|
if (iface->can_clip_redraws != NULL)
|
|
|
|
return iface->can_clip_redraws (window);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-08-14 11:17:09 +01:00
|
|
|
|
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
2016-05-27 11:09:24 +08:00
|
|
|
GList *
|
|
|
|
_clutter_stage_window_get_views (ClutterStageWindow *window)
|
2016-05-25 12:44:52 +08:00
|
|
|
{
|
2019-01-08 13:51:47 +01:00
|
|
|
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
2016-05-25 12:44:52 +08:00
|
|
|
|
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
2016-05-27 11:09:24 +08:00
|
|
|
return iface->get_views (window);
|
2016-05-25 12:44:52 +08:00
|
|
|
}
|
|
|
|
|
2020-10-10 01:02:28 +02:00
|
|
|
void
|
|
|
|
_clutter_stage_window_prepare_frame (ClutterStageWindow *window,
|
|
|
|
ClutterStageView *view,
|
|
|
|
ClutterFrame *frame)
|
|
|
|
{
|
|
|
|
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
|
|
|
|
|
|
|
if (iface->prepare_frame)
|
|
|
|
iface->prepare_frame (window, view, frame);
|
|
|
|
}
|
|
|
|
|
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
2016-05-27 11:09:24 +08:00
|
|
|
void
|
2020-10-09 18:02:03 +02:00
|
|
|
_clutter_stage_window_finish_frame (ClutterStageWindow *window,
|
2020-10-09 18:16:16 +02:00
|
|
|
ClutterStageView *view,
|
|
|
|
ClutterFrame *frame)
|
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
2016-05-27 11:09:24 +08:00
|
|
|
{
|
2019-01-08 13:51:47 +01:00
|
|
|
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
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
2016-05-27 11:09:24 +08:00
|
|
|
|
|
|
|
if (iface->finish_frame)
|
2020-10-09 18:16:16 +02:00
|
|
|
{
|
|
|
|
iface->finish_frame (window, view, frame);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!clutter_frame_has_result (frame))
|
|
|
|
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_IDLE);
|
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
2016-05-27 11:09:24 +08:00
|
|
|
}
|
|
|
|
|
2016-05-25 12:44:52 +08:00
|
|
|
int64_t
|
|
|
|
_clutter_stage_window_get_frame_counter (ClutterStageWindow *window)
|
|
|
|
{
|
2019-01-08 13:51:47 +01:00
|
|
|
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
2016-05-25 12:44:52 +08:00
|
|
|
|
|
|
|
if (iface->get_frame_counter)
|
|
|
|
return iface->get_frame_counter (window);
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|