[mutter] compositor: Don't access use the onscreen framebuffer directly
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] compositor: Don't access use the onscreen framebuffer directly
- Date: Wed, 20 Jul 2016 06:28:03 +0000 (UTC)
commit 7f0e6b9b4b66b25a98a17d3ad3faf02a1e77b2cf
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed May 25 14:40:12 2016 +0800
compositor: Don't access use the onscreen framebuffer directly
Instead of assuming there is a single onscreen framebuffer, use the
helper functions for setting the frame callback and getting the frame
counter.
https://bugzilla.gnome.org/show_bug.cgi?id=768976
clutter/clutter/clutter-mutter.h | 8 ++++++++
clutter/clutter/clutter-stage.c | 22 ++++++++++++++++++++++
src/compositor/compositor-private.h | 1 -
src/compositor/compositor.c | 12 ++++++------
src/compositor/meta-window-actor.c | 8 ++++----
5 files changed, 40 insertions(+), 11 deletions(-)
---
diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h
index f09a07f..ab50742 100644
--- a/clutter/clutter/clutter-mutter.h
+++ b/clutter/clutter/clutter-mutter.h
@@ -36,6 +36,14 @@ void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
CLUTTER_AVAILABLE_IN_MUTTER
gboolean _clutter_get_sync_to_vblank (void);
+CLUTTER_AVAILABLE_IN_MUTTER
+CoglFrameClosure *clutter_stage_add_frame_callback (ClutterStage *stage,
+ CoglFrameCallback callback,
+ gpointer user_data);
+
+CLUTTER_AVAILABLE_IN_MUTTER
+int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
+
#undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_MUTTER_H__ */
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 8f5abb4..ac5a356 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -4510,3 +4510,25 @@ _clutter_stage_set_scale_factor (ClutterStage *stage,
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
+
+CoglFrameClosure *
+clutter_stage_add_frame_callback (ClutterStage *stage,
+ CoglFrameCallback callback,
+ gpointer user_data)
+{
+ ClutterStageWindow *stage_window;
+
+ stage_window = _clutter_stage_get_window (stage);
+ return _clutter_stage_window_set_frame_callback (stage_window,
+ callback,
+ user_data);
+}
+
+int64_t
+clutter_stage_get_frame_counter (ClutterStage *stage)
+{
+ ClutterStageWindow *stage_window;
+
+ stage_window = _clutter_stage_get_window (stage);
+ return _clutter_stage_window_get_frame_counter (stage_window);
+}
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index c534926..72dffe5 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -29,7 +29,6 @@ struct _MetaCompositor
GList *windows;
Window output;
- CoglOnscreen *onscreen;
CoglFrameClosure *frame_closure;
CoglContext *context;
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 49b039d..0efb09b 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -77,6 +77,7 @@
#include "meta-sync-ring.h"
#include "backends/x11/meta-backend-x11.h"
+#include "clutter/clutter-mutter.h"
#ifdef HAVE_WAYLAND
#include "wayland/meta-wayland-private.h"
@@ -1044,13 +1045,12 @@ meta_pre_paint_func (gpointer data)
MetaWindowActor *top_window;
MetaCompositor *compositor = data;
- if (compositor->onscreen == NULL)
+ if (!compositor->frame_closure)
{
- compositor->onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer ());
- compositor->frame_closure = cogl_onscreen_add_frame_callback (compositor->onscreen,
- frame_callback,
- compositor,
- NULL);
+ compositor->frame_closure =
+ clutter_stage_add_frame_callback (CLUTTER_STAGE (compositor->stage),
+ frame_callback,
+ compositor);
}
if (compositor->windows == NULL)
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 5ab79c5..197a193 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -23,6 +23,7 @@
#include <meta/meta-enum-types.h>
#include <meta/meta-shadow-factory.h>
+#include "clutter/clutter-mutter.h"
#include "compositor-private.h"
#include "meta-shaped-texture-private.h"
#include "meta-window-actor-private.h"
@@ -659,6 +660,8 @@ static void
assign_frame_counter_to_frames (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
+ MetaCompositor *compositor = priv->compositor;
+ ClutterStage *stage = CLUTTER_STAGE (compositor->stage);
GList *l;
/* If the window is obscured, then we're expecting to deal with sending
@@ -672,10 +675,7 @@ assign_frame_counter_to_frames (MetaWindowActor *self)
FrameData *frame = l->data;
if (frame->frame_counter == -1)
- {
- CoglOnscreen *onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer());
- frame->frame_counter = cogl_onscreen_get_frame_counter (onscreen);
- }
+ frame->frame_counter = clutter_stage_get_frame_counter (stage);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]