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
This commit is contained in:
parent
a465e4c5b8
commit
7f0e6b9b4b
@ -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__ */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ struct _MetaCompositor
|
||||
GList *windows;
|
||||
Window output;
|
||||
|
||||
CoglOnscreen *onscreen;
|
||||
CoglFrameClosure *frame_closure;
|
||||
CoglContext *context;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user