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
|
|
|
|
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_paint_view (ClutterStage *stage,
|
|
|
|
ClutterStageView *view,
|
2011-08-16 16:01:22 +01:00
|
|
|
const cairo_rectangle_int_t *clip);
|
|
|
|
|
2019-06-17 19:16:47 -03:00
|
|
|
void _clutter_stage_emit_after_paint (ClutterStage *stage);
|
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_set_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_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);
|
2010-10-21 11:29:09 +01:00
|
|
|
void _clutter_stage_maybe_relayout (ClutterActor *stage);
|
|
|
|
gboolean _clutter_stage_needs_update (ClutterStage *stage);
|
|
|
|
gboolean _clutter_stage_do_update (ClutterStage *stage);
|
|
|
|
|
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);
|
2012-11-08 12:42:24 -05:00
|
|
|
void _clutter_stage_schedule_update (ClutterStage *stage);
|
|
|
|
gint64 _clutter_stage_get_update_time (ClutterStage *stage);
|
|
|
|
void _clutter_stage_clear_update_time (ClutterStage *stage);
|
2010-10-21 11:29:09 +01:00
|
|
|
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);
|
2019-02-20 12:23:04 -03:00
|
|
|
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
|
|
|
graphene_rect_t *rect,
|
|
|
|
float *view_scale);
|
2013-08-14 11:19:22 +01:00
|
|
|
|
2016-06-08 13:07:09 +08:00
|
|
|
void _clutter_stage_presented (ClutterStage *stage,
|
|
|
|
CoglFrameEvent frame_event,
|
|
|
|
ClutterFrameInfo *frame_info);
|
|
|
|
|
2017-04-07 14:06:36 +02:00
|
|
|
GList * _clutter_stage_peek_stage_views (ClutterStage *stage);
|
|
|
|
|
2019-05-07 13:02:55 +08:00
|
|
|
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
|
|
|
ClutterActor *actor);
|
|
|
|
|
2010-10-21 11:29:09 +01:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|