Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions clutter/clutter/clutter-actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -20019,6 +20019,24 @@ clutter_actor_get_transition (ClutterActor *self,
return clos->transition;
}

/**
* clutter_actor_has_transitions: (skip)
*/

gboolean
clutter_actor_has_transitions (ClutterActor *self)
{
const ClutterAnimationInfo *info;

g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);

info = _clutter_actor_get_animation_info_or_defaults (self);
if (info->transitions == NULL)
return FALSE;

return g_hash_table_size (info->transitions) > 0;
}

/**
* clutter_actor_save_easing_state:
* @self: a #ClutterActor
Expand Down
7 changes: 7 additions & 0 deletions clutter/clutter/clutter-muffin.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ void clutter_stage_thaw_updates (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_update_resource_scales (ClutterStage *stage);

CLUTTER_EXPORT
void clutter_stage_view_assign_next_scanout (ClutterStageView *stage_view,
CoglScanout *scanout);

CLUTTER_EXPORT
gboolean clutter_actor_has_damage (ClutterActor *actor);

CLUTTER_EXPORT
gboolean clutter_actor_has_transitions (ClutterActor *actor);

CLUTTER_EXPORT
void clutter_stage_get_device_coords (ClutterStage *stage,
ClutterInputDevice *device,
Expand Down
2 changes: 2 additions & 0 deletions clutter/clutter/clutter-stage-view-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ const cairo_region_t * clutter_stage_view_peek_redraw_clip (ClutterStageView *vi

cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);

CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view);

#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
23 changes: 23 additions & 0 deletions clutter/clutter/clutter-stage-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <math.h>

#include "clutter/clutter-private.h"
#include "clutter/clutter-muffin.h"
#include "cogl/cogl.h"

enum
{
Expand Down Expand Up @@ -52,6 +54,8 @@ typedef struct _ClutterStageViewPrivate
CoglOffscreen *shadowfb;
CoglPipeline *shadowfb_pipeline;

CoglScanout *next_scanout;

gboolean has_redraw_clip;
cairo_region_t *redraw_clip;

Expand Down Expand Up @@ -407,6 +411,25 @@ clutter_stage_default_get_offscreen_transformation_matrix (ClutterStageView *vie
cogl_matrix_init_identity (matrix);
}

void
clutter_stage_view_assign_next_scanout (ClutterStageView *view,
CoglScanout *scanout)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);

g_set_object (&priv->next_scanout, scanout);
}

CoglScanout *
clutter_stage_view_take_scanout (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);

return g_steal_pointer (&priv->next_scanout);
}

static void
clutter_stage_view_get_property (GObject *object,
guint prop_id,
Expand Down
28 changes: 28 additions & 0 deletions clutter/clutter/cogl/clutter-stage-cogl.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,20 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
}

static void
clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
ClutterStageView *view,
CoglScanout *scanout)
{
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
CoglOnscreen *onscreen;

g_return_if_fail (cogl_is_onscreen (framebuffer));

onscreen = COGL_ONSCREEN (framebuffer);
cogl_onscreen_direct_scanout (onscreen, scanout);
}

static void
clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
{
Expand Down Expand Up @@ -1016,10 +1030,24 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
for (l = _clutter_stage_window_get_views (stage_window); l; l = l->next)
{
ClutterStageView *view = l->data;
g_autoptr (CoglScanout) scanout = NULL;

if (!clutter_stage_view_has_redraw_clip (view))
continue;

scanout = clutter_stage_view_take_scanout (view);
if (scanout)
{
clutter_stage_cogl_scanout_view (stage_cogl,
view,
scanout);
swap_event = TRUE;
}
else
{
swap_event |= clutter_stage_cogl_redraw_view (stage_window, view);
}

swap_event |= clutter_stage_cogl_redraw_view (stage_window, view);
}

Expand Down
21 changes: 21 additions & 0 deletions cogl/cogl/cogl-onscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,27 @@ cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen)
return winsys->onscreen_get_buffer_age (onscreen);
}

void
cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
CoglScanout *scanout)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
const CoglWinsysVtable *winsys;
CoglFrameInfo *info;

g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
g_return_if_fail (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT));

info = _cogl_frame_info_new ();
info->frame_counter = onscreen->frame_counter;
g_queue_push_tail (&onscreen->pending_frame_infos, info);

winsys = _cogl_framebuffer_get_winsys (framebuffer);
winsys->onscreen_direct_scanout (onscreen, scanout);

onscreen->frame_counter++;
}

#ifdef COGL_HAS_X11_SUPPORT
uint32_t
cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen)
Expand Down
9 changes: 9 additions & 0 deletions cogl/cogl/cogl-onscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ G_BEGIN_DECLS
typedef struct _CoglOnscreen CoglOnscreen;
#define COGL_ONSCREEN(X) ((CoglOnscreen *)(X))

typedef struct _CoglScanout CoglScanout;

/**
* cogl_onscreen_get_gtype:
*
Expand Down Expand Up @@ -284,6 +286,13 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
const int *rectangles,
int n_rectangles);

/**
* cogl_onscreen_direct_scanout: (skip)
*/
COGL_EXPORT void
cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
CoglScanout *scanout);

/**
* cogl_onscreen_swap_region:
* @onscreen: A #CoglOnscreen framebuffer
Expand Down
27 changes: 27 additions & 0 deletions cogl/cogl/cogl-scanout.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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/>.
*/

#include "cogl-config.h"

#include "cogl-scanout.h"

G_DEFINE_INTERFACE (CoglScanout, cogl_scanout, G_TYPE_OBJECT)

static void
cogl_scanout_default_init (CoglScanoutInterface *iface)
{
}
35 changes: 35 additions & 0 deletions cogl/cogl/cogl-scanout.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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/>.
*/

#ifndef COGL_SCANOUT_H
#define COGL_SCANOUT_H

#include "cogl/cogl-types.h"

#include <glib-object.h>

#define COGL_TYPE_SCANOUT (cogl_scanout_get_type ())
COGL_EXPORT
G_DECLARE_INTERFACE (CoglScanout, cogl_scanout,
COGL, SCANOUT, GObject)

struct _CoglScanoutInterface
{
GTypeInterface parent_iface;
};

#endif /* COGL_SCANOUT_H */
1 change: 1 addition & 0 deletions cogl/cogl/cogl.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
#include <cogl/cogl-fence.h>
#include <cogl/cogl-glib-source.h>
#include <cogl/cogl-trace.h>
#include <cogl/cogl-scanout.h>
/* XXX: This will definitly go away once all the Clutter winsys
* code has been migrated down into Cogl! */
#include <cogl/deprecated/cogl-clutter.h>
Expand Down
2 changes: 2 additions & 0 deletions cogl/cogl/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ cogl_nonintrospected_headers = [
'cogl-version.h',
'cogl-gtype-private.h',
'cogl-glib-source.h',
'cogl-scanout.h',
]

cogl_nodist_headers = [
Expand Down Expand Up @@ -347,6 +348,7 @@ cogl_sources = [
'cogl-closure-list.c',
'cogl-fence.c',
'cogl-fence-private.h',
'cogl-scanout.c',
'deprecated/cogl-material-compat.c',
'deprecated/cogl-program.c',
'deprecated/cogl-program-private.h',
Expand Down
5 changes: 5 additions & 0 deletions cogl/cogl/winsys/cogl-winsys-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "cogl-renderer.h"
#include "cogl-onscreen.h"
#include "cogl-scanout.h"

#ifdef COGL_HAS_XLIB_SUPPORT
#include "cogl-texture-pixmap-x11-private.h"
Expand Down Expand Up @@ -117,6 +118,10 @@ typedef struct _CoglWinsysVtable
const int *rectangles,
int n_rectangles);

void
(*onscreen_direct_scanout) (CoglOnscreen *onscreen,
CoglScanout *scanout);

void
(*onscreen_set_visibility) (CoglOnscreen *onscreen,
gboolean visibility);
Expand Down
Loading
Loading