2010-10-21 13:13:00 +01:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Intel Corporation.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2010-10-21 11:29:09 +01:00
|
|
|
#ifndef __CLUTTER_STAGE_PRIVATE_H__
|
|
|
|
#define __CLUTTER_STAGE_PRIVATE_H__
|
|
|
|
|
|
|
|
#include <clutter/clutter-stage-window.h>
|
|
|
|
#include <clutter/clutter-stage.h>
|
2011-01-27 17:26:16 +00:00
|
|
|
#include <clutter/clutter-input-device.h>
|
2011-02-01 18:32:08 +00:00
|
|
|
#include <clutter/clutter-private.h>
|
2010-10-21 11:29:09 +01:00
|
|
|
|
2011-03-10 22:05:03 +00:00
|
|
|
#include <cogl/cogl.h>
|
|
|
|
|
2010-10-21 11:29:09 +01:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct _ClutterStageQueueRedrawEntry ClutterStageQueueRedrawEntry;
|
|
|
|
|
|
|
|
/* stage */
|
|
|
|
ClutterStageWindow *_clutter_stage_get_default_window (void);
|
2011-08-16 16:01:22 +01:00
|
|
|
|
2020-02-06 09:00:12 +01:00
|
|
|
void clutter_stage_paint_view (ClutterStage *stage,
|
|
|
|
ClutterStageView *view,
|
|
|
|
const cairo_region_t *redraw_clip);
|
2011-08-16 16:01:22 +01:00
|
|
|
|
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
|
|
|
void clutter_stage_emit_before_update (ClutterStage *stage,
|
|
|
|
ClutterStageView *view);
|
|
|
|
void clutter_stage_emit_before_paint (ClutterStage *stage,
|
|
|
|
ClutterStageView *view);
|
|
|
|
void clutter_stage_emit_after_paint (ClutterStage *stage,
|
|
|
|
ClutterStageView *view);
|
|
|
|
void clutter_stage_emit_after_update (ClutterStage *stage,
|
|
|
|
ClutterStageView *view);
|
2019-03-22 13:53:00 +01:00
|
|
|
|
|
|
|
CLUTTER_EXPORT
|
2010-10-21 11:29:09 +01:00
|
|
|
void _clutter_stage_set_window (ClutterStage *stage,
|
|
|
|
ClutterStageWindow *stage_window);
|
2019-03-22 13:53:00 +01:00
|
|
|
CLUTTER_EXPORT
|
2010-10-21 11:29:09 +01:00
|
|
|
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
|
|
|
|
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
|
|
|
|
CoglMatrix *projection);
|
|
|
|
void _clutter_stage_dirty_projection (ClutterStage *stage);
|
|
|
|
void _clutter_stage_get_viewport (ClutterStage *stage,
|
2011-02-01 16:51:58 +00:00
|
|
|
float *x,
|
|
|
|
float *y,
|
|
|
|
float *width,
|
|
|
|
float *height);
|
2010-10-21 11:29:09 +01:00
|
|
|
void _clutter_stage_dirty_viewport (ClutterStage *stage);
|
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 _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
|
|
|
ClutterStageView *view);
|
2020-04-17 08:43:10 +02:00
|
|
|
void clutter_stage_maybe_relayout (ClutterActor *stage);
|
|
|
|
void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage);
|
|
|
|
GSList * clutter_stage_find_updated_devices (ClutterStage *stage);
|
|
|
|
void clutter_stage_update_devices (ClutterStage *stage,
|
|
|
|
GSList *devices);
|
|
|
|
void clutter_stage_update_actor_stage_views (ClutterStage *stage);
|
2010-10-21 11:29:09 +01:00
|
|
|
|
2019-03-22 13:53:00 +01:00
|
|
|
CLUTTER_EXPORT
|
2010-10-21 11:29:09 +01:00
|
|
|
void _clutter_stage_queue_event (ClutterStage *stage,
|
2013-11-11 18:16:32 +01:00
|
|
|
ClutterEvent *event,
|
|
|
|
gboolean copy_event);
|
2010-10-21 11:29:09 +01:00
|
|
|
gboolean _clutter_stage_has_queued_events (ClutterStage *stage);
|
|
|
|
void _clutter_stage_process_queued_events (ClutterStage *stage);
|
|
|
|
void _clutter_stage_update_input_devices (ClutterStage *stage);
|
|
|
|
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
|
2011-03-15 13:17:04 +00:00
|
|
|
|
2019-02-20 11:53:44 -03:00
|
|
|
void clutter_stage_log_pick (ClutterStage *stage,
|
|
|
|
const graphene_point_t *vertices,
|
|
|
|
ClutterActor *actor);
|
clutter: Introduce geometric picking
Currently, Clutter does picking by drawing with Cogl and reading
the pixel that's beneath the given point. Since Cogl has a journal
that records drawing operations, and has optimizations to read a
single pixel from a list of rectangle, it would be expected that
we would hit this fast path and not flush the journal while picking.
However, that's not the case: dithering, clipping with scissors, etc,
can all flush the journal, issuing commands to the GPU and making
picking slow. On NVidia-based systems, this glReadPixels() call is
extremely costly.
Introduce geometric picking, and avoid using the Cogl journal entirely.
Do this by introducing a stack of actors in ClutterStage. This stack
is cached, but for now, don't use the cache as much as possible.
The picking routines are still tied to painting.
When projecting the actor vertexes, do it manually and take the modelview
matrix of the framebuffer into account as well.
CPU usage on an Intel i7-7700, tested with two different GPUs/drivers:
| | Intel | Nvidia |
| ------: | --------: | -----: |
| Moving the mouse: |
| Before | 10% | 10% |
| After | 6% | 6% |
| Moving a window: |
| Before | 23% | 81% |
| After | 19% | 40% |
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154,
https://gitlab.gnome.org/GNOME/mutter/issues/691
Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283,
https://gitlab.gnome.org/GNOME/mutter/issues/590,
https://gitlab.gnome.org/GNOME/mutter/issues/700
v2: Fix code style issues
Simplify quadrilateral checks
Remove the 0.5f hack
Differentiate axis-aligned rectangles
https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2018-08-02 19:03:30 +08:00
|
|
|
|
2019-02-20 11:53:44 -03:00
|
|
|
void clutter_stage_push_pick_clip (ClutterStage *stage,
|
|
|
|
const graphene_point_t *vertices);
|
clutter: Introduce geometric picking
Currently, Clutter does picking by drawing with Cogl and reading
the pixel that's beneath the given point. Since Cogl has a journal
that records drawing operations, and has optimizations to read a
single pixel from a list of rectangle, it would be expected that
we would hit this fast path and not flush the journal while picking.
However, that's not the case: dithering, clipping with scissors, etc,
can all flush the journal, issuing commands to the GPU and making
picking slow. On NVidia-based systems, this glReadPixels() call is
extremely costly.
Introduce geometric picking, and avoid using the Cogl journal entirely.
Do this by introducing a stack of actors in ClutterStage. This stack
is cached, but for now, don't use the cache as much as possible.
The picking routines are still tied to painting.
When projecting the actor vertexes, do it manually and take the modelview
matrix of the framebuffer into account as well.
CPU usage on an Intel i7-7700, tested with two different GPUs/drivers:
| | Intel | Nvidia |
| ------: | --------: | -----: |
| Moving the mouse: |
| Before | 10% | 10% |
| After | 6% | 6% |
| Moving a window: |
| Before | 23% | 81% |
| After | 19% | 40% |
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154,
https://gitlab.gnome.org/GNOME/mutter/issues/691
Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283,
https://gitlab.gnome.org/GNOME/mutter/issues/590,
https://gitlab.gnome.org/GNOME/mutter/issues/700
v2: Fix code style issues
Simplify quadrilateral checks
Remove the 0.5f hack
Differentiate axis-aligned rectangles
https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2018-08-02 19:03:30 +08:00
|
|
|
|
|
|
|
void clutter_stage_pop_pick_clip (ClutterStage *stage);
|
|
|
|
|
2011-03-15 13:17:04 +00:00
|
|
|
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
|
2019-10-11 15:52:56 +08:00
|
|
|
float x,
|
|
|
|
float y,
|
2011-03-15 13:17:04 +00:00
|
|
|
ClutterPickMode mode);
|
2010-10-21 11:29:09 +01:00
|
|
|
|
|
|
|
ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage);
|
|
|
|
void _clutter_stage_paint_volume_stack_free_all (ClutterStage *stage);
|
|
|
|
|
2011-02-01 18:32:08 +00:00
|
|
|
const ClutterPlane *_clutter_stage_get_clip (ClutterStage *stage);
|
2010-10-21 11:29:09 +01:00
|
|
|
|
|
|
|
ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (ClutterStage *stage,
|
|
|
|
ClutterStageQueueRedrawEntry *entry,
|
|
|
|
ClutterActor *actor,
|
2018-08-15 01:12:49 +02:00
|
|
|
const ClutterPaintVolume *clip);
|
2010-10-21 11:29:09 +01:00
|
|
|
void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry);
|
|
|
|
|
2012-06-13 16:02:05 +01:00
|
|
|
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
|
|
|
ClutterInputDevice *device,
|
|
|
|
ClutterActor *actor);
|
|
|
|
ClutterActor * _clutter_stage_get_pointer_drag_actor (ClutterStage *stage,
|
|
|
|
ClutterInputDevice *device);
|
|
|
|
void _clutter_stage_remove_pointer_drag_actor (ClutterStage *stage,
|
|
|
|
ClutterInputDevice *device);
|
|
|
|
|
|
|
|
void _clutter_stage_add_touch_drag_actor (ClutterStage *stage,
|
|
|
|
ClutterEventSequence *sequence,
|
|
|
|
ClutterActor *actor);
|
|
|
|
ClutterActor * _clutter_stage_get_touch_drag_actor (ClutterStage *stage,
|
|
|
|
ClutterEventSequence *sequence);
|
|
|
|
void _clutter_stage_remove_touch_drag_actor (ClutterStage *stage,
|
|
|
|
ClutterEventSequence *sequence);
|
2011-06-17 16:51:05 +01:00
|
|
|
|
2019-03-22 13:53:00 +01:00
|
|
|
CLUTTER_EXPORT
|
2012-01-25 21:24:47 +00:00
|
|
|
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
|
2019-03-22 13:53:00 +01:00
|
|
|
CLUTTER_EXPORT
|
2012-01-25 21:24:47 +00:00
|
|
|
gboolean _clutter_stage_is_activated (ClutterStage *stage);
|
2019-03-22 13:53:00 +01:00
|
|
|
CLUTTER_EXPORT
|
2012-01-25 21:24:47 +00:00
|
|
|
gboolean _clutter_stage_update_state (ClutterStage *stage,
|
|
|
|
ClutterStageState unset_state,
|
|
|
|
ClutterStageState set_state);
|
|
|
|
|
2013-08-14 11:19:22 +01:00
|
|
|
void _clutter_stage_set_scale_factor (ClutterStage *stage,
|
|
|
|
int factor);
|
|
|
|
|
2020-05-29 23:02:20 +02:00
|
|
|
void clutter_stage_presented (ClutterStage *stage,
|
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
|
|
|
ClutterStageView *view,
|
2016-06-08 13:07:09 +08:00
|
|
|
ClutterFrameInfo *frame_info);
|
|
|
|
|
2019-05-07 13:02:55 +08:00
|
|
|
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
|
|
|
ClutterActor *actor);
|
|
|
|
|
2020-04-10 00:39:07 +02:00
|
|
|
GList * clutter_stage_get_views_for_rect (ClutterStage *stage,
|
|
|
|
const graphene_rect_t *rect);
|
|
|
|
|
2020-04-10 14:54:11 +02:00
|
|
|
void clutter_stage_set_actor_needs_immediate_relayout (ClutterStage *stage);
|
|
|
|
|
2010-10-21 11:29:09 +01:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|