mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
cogl/onscreen: Add opaque user_data pointer to onscreen present calls
This argument is intended to be used by clutter to be able to communicate with the onscreen backend, that happens to be the native backend. It will be used to pass a ClutterFrame pointer, where the result of page flips, mode sets etc can be communicated whenever it is available. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
parent
72b35e07c0
commit
249512b068
@ -249,7 +249,8 @@ static void
|
|||||||
swap_framebuffer (ClutterStageWindow *stage_window,
|
swap_framebuffer (ClutterStageWindow *stage_window,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
cairo_region_t *swap_region,
|
cairo_region_t *swap_region,
|
||||||
gboolean swap_with_damage)
|
gboolean swap_with_damage,
|
||||||
|
ClutterFrame *frame)
|
||||||
{
|
{
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
ClutterStageCoglPrivate *priv =
|
ClutterStageCoglPrivate *priv =
|
||||||
@ -289,7 +290,8 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
|||||||
|
|
||||||
cogl_onscreen_swap_region (onscreen,
|
cogl_onscreen_swap_region (onscreen,
|
||||||
damage, n_rects,
|
damage, n_rects,
|
||||||
frame_info);
|
frame_info,
|
||||||
|
frame);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -298,7 +300,8 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
|||||||
|
|
||||||
cogl_onscreen_swap_buffers_with_damage (onscreen,
|
cogl_onscreen_swap_buffers_with_damage (onscreen,
|
||||||
damage, n_rects,
|
damage, n_rects,
|
||||||
frame_info);
|
frame_info,
|
||||||
|
frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -445,7 +448,8 @@ transform_swap_region_to_onscreen (ClutterStageView *view,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
|
clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
|
||||||
ClutterStageView *view)
|
ClutterStageView *view,
|
||||||
|
ClutterFrame *frame)
|
||||||
{
|
{
|
||||||
ClutterStageWindow *stage_window = CLUTTER_STAGE_WINDOW (stage_cogl);
|
ClutterStageWindow *stage_window = CLUTTER_STAGE_WINDOW (stage_cogl);
|
||||||
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
|
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
|
||||||
@ -658,7 +662,8 @@ clutter_stage_cogl_redraw_view_primary (ClutterStageCogl *stage_cogl,
|
|||||||
swap_framebuffer (stage_window,
|
swap_framebuffer (stage_window,
|
||||||
view,
|
view,
|
||||||
swap_region,
|
swap_region,
|
||||||
swap_with_damage);
|
swap_with_damage,
|
||||||
|
frame);
|
||||||
|
|
||||||
cairo_region_destroy (swap_region);
|
cairo_region_destroy (swap_region);
|
||||||
}
|
}
|
||||||
@ -667,6 +672,7 @@ static gboolean
|
|||||||
clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
|
clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
CoglScanout *scanout,
|
CoglScanout *scanout,
|
||||||
|
ClutterFrame *frame,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ClutterStageCoglPrivate *priv =
|
ClutterStageCoglPrivate *priv =
|
||||||
@ -681,7 +687,11 @@ clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
|
|||||||
|
|
||||||
frame_info = cogl_frame_info_new (priv->global_frame_counter);
|
frame_info = cogl_frame_info_new (priv->global_frame_counter);
|
||||||
|
|
||||||
if (!cogl_onscreen_direct_scanout (onscreen, scanout, frame_info, error))
|
if (!cogl_onscreen_direct_scanout (onscreen,
|
||||||
|
scanout,
|
||||||
|
frame_info,
|
||||||
|
frame,
|
||||||
|
error))
|
||||||
{
|
{
|
||||||
cogl_object_unref (frame_info);
|
cogl_object_unref (frame_info);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -705,13 +715,17 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
{
|
{
|
||||||
g_autoptr (GError) error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
|
|
||||||
if (clutter_stage_cogl_scanout_view (stage_cogl, view, scanout, &error))
|
if (clutter_stage_cogl_scanout_view (stage_cogl,
|
||||||
|
view,
|
||||||
|
scanout,
|
||||||
|
frame,
|
||||||
|
&error))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_warning ("Failed to scan out client buffer: %s", error->message);
|
g_warning ("Failed to scan out client buffer: %s", error->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_stage_cogl_redraw_view_primary (stage_cogl, view);
|
clutter_stage_cogl_redraw_view_primary (stage_cogl, view, frame);
|
||||||
|
|
||||||
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_PENDING_PRESENTED);
|
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_PENDING_PRESENTED);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,8 @@ void
|
|||||||
cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info)
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
const CoglWinsysVtable *winsys;
|
const CoglWinsysVtable *winsys;
|
||||||
@ -321,7 +322,8 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||||||
winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
||||||
winsys->onscreen_swap_buffers_with_damage (onscreen,
|
winsys->onscreen_swap_buffers_with_damage (onscreen,
|
||||||
rectangles, n_rectangles,
|
rectangles, n_rectangles,
|
||||||
info);
|
info,
|
||||||
|
user_data);
|
||||||
cogl_framebuffer_discard_buffers (framebuffer,
|
cogl_framebuffer_discard_buffers (framebuffer,
|
||||||
COGL_BUFFER_BIT_COLOR |
|
COGL_BUFFER_BIT_COLOR |
|
||||||
COGL_BUFFER_BIT_DEPTH |
|
COGL_BUFFER_BIT_DEPTH |
|
||||||
@ -346,16 +348,18 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
void
|
void
|
||||||
cogl_onscreen_swap_buffers (CoglOnscreen *onscreen,
|
cogl_onscreen_swap_buffers (CoglOnscreen *onscreen,
|
||||||
CoglFrameInfo *info)
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
cogl_onscreen_swap_buffers_with_damage (onscreen, NULL, 0, info);
|
cogl_onscreen_swap_buffers_with_damage (onscreen, NULL, 0, info, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info)
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
const CoglWinsysVtable *winsys;
|
const CoglWinsysVtable *winsys;
|
||||||
@ -379,7 +383,8 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
|||||||
winsys->onscreen_swap_region (COGL_ONSCREEN (framebuffer),
|
winsys->onscreen_swap_region (COGL_ONSCREEN (framebuffer),
|
||||||
rectangles,
|
rectangles,
|
||||||
n_rectangles,
|
n_rectangles,
|
||||||
info);
|
info,
|
||||||
|
user_data);
|
||||||
|
|
||||||
cogl_framebuffer_discard_buffers (framebuffer,
|
cogl_framebuffer_discard_buffers (framebuffer,
|
||||||
COGL_BUFFER_BIT_COLOR |
|
COGL_BUFFER_BIT_COLOR |
|
||||||
@ -423,6 +428,7 @@ gboolean
|
|||||||
cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
|
cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
|
||||||
CoglScanout *scanout,
|
CoglScanout *scanout,
|
||||||
CoglFrameInfo *info,
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
@ -435,7 +441,11 @@ cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
|
|||||||
g_queue_push_tail (&onscreen->pending_frame_infos, info);
|
g_queue_push_tail (&onscreen->pending_frame_infos, info);
|
||||||
|
|
||||||
winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
||||||
if (!winsys->onscreen_direct_scanout (onscreen, scanout, info, error))
|
if (!winsys->onscreen_direct_scanout (onscreen,
|
||||||
|
scanout,
|
||||||
|
info,
|
||||||
|
user_data,
|
||||||
|
error))
|
||||||
{
|
{
|
||||||
g_queue_pop_tail (&onscreen->pending_frame_infos);
|
g_queue_pop_tail (&onscreen->pending_frame_infos);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -174,7 +174,8 @@ cogl_onscreen_hide (CoglOnscreen *onscreen);
|
|||||||
*/
|
*/
|
||||||
COGL_EXPORT void
|
COGL_EXPORT void
|
||||||
cogl_onscreen_swap_buffers (CoglOnscreen *onscreen,
|
cogl_onscreen_swap_buffers (CoglOnscreen *onscreen,
|
||||||
CoglFrameInfo *frame_info);
|
CoglFrameInfo *frame_info,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -281,7 +282,8 @@ COGL_EXPORT void
|
|||||||
cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info);
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_onscreen_direct_scanout: (skip)
|
* cogl_onscreen_direct_scanout: (skip)
|
||||||
@ -290,6 +292,7 @@ COGL_EXPORT gboolean
|
|||||||
cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
|
cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
|
||||||
CoglScanout *scanout,
|
CoglScanout *scanout,
|
||||||
CoglFrameInfo *info,
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -316,7 +319,8 @@ COGL_EXPORT void
|
|||||||
cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info);
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglFrameEvent:
|
* CoglFrameEvent:
|
||||||
|
@ -769,7 +769,8 @@ static void
|
|||||||
_cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
|
||||||
const int *user_rectangles,
|
const int *user_rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info)
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
||||||
@ -809,7 +810,8 @@ static void
|
|||||||
_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info)
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
||||||
|
@ -1637,7 +1637,8 @@ static void
|
|||||||
_cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
|
||||||
const int *user_rectangles,
|
const int *user_rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info)
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
||||||
@ -1844,7 +1845,8 @@ static void
|
|||||||
_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info)
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
|
||||||
|
@ -117,12 +117,14 @@ typedef struct _CoglWinsysVtable
|
|||||||
(*onscreen_swap_buffers_with_damage) (CoglOnscreen *onscreen,
|
(*onscreen_swap_buffers_with_damage) (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info);
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
(*onscreen_direct_scanout) (CoglOnscreen *onscreen,
|
(*onscreen_direct_scanout) (CoglOnscreen *onscreen,
|
||||||
CoglScanout *scanout,
|
CoglScanout *scanout,
|
||||||
CoglFrameInfo *info,
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -138,7 +140,8 @@ typedef struct _CoglWinsysVtable
|
|||||||
(*onscreen_swap_region) (CoglOnscreen *onscreen,
|
(*onscreen_swap_region) (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *info);
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
(*onscreen_set_resizable) (CoglOnscreen *onscreen, gboolean resizable);
|
(*onscreen_set_resizable) (CoglOnscreen *onscreen, gboolean resizable);
|
||||||
|
@ -1919,7 +1919,8 @@ static void
|
|||||||
meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||||
const int *rectangles,
|
const int *rectangles,
|
||||||
int n_rectangles,
|
int n_rectangles,
|
||||||
CoglFrameInfo *frame_info)
|
CoglFrameInfo *frame_info,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
CoglContext *cogl_context = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *cogl_context = cogl_framebuffer_get_context (framebuffer);
|
||||||
@ -1955,7 +1956,8 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||||||
parent_vtable->onscreen_swap_buffers_with_damage (onscreen,
|
parent_vtable->onscreen_swap_buffers_with_damage (onscreen,
|
||||||
rectangles,
|
rectangles,
|
||||||
n_rectangles,
|
n_rectangles,
|
||||||
frame_info);
|
frame_info,
|
||||||
|
user_data);
|
||||||
|
|
||||||
renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
|
renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
|
||||||
render_gpu);
|
render_gpu);
|
||||||
@ -2170,6 +2172,7 @@ static gboolean
|
|||||||
meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
||||||
CoglScanout *scanout,
|
CoglScanout *scanout,
|
||||||
CoglFrameInfo *frame_info,
|
CoglFrameInfo *frame_info,
|
||||||
|
gpointer user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||||
|
@ -196,7 +196,7 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
frame_info = cogl_frame_info_new (0);
|
frame_info = cogl_frame_info_new (0);
|
||||||
cogl_onscreen_swap_buffers (stage_x11->onscreen, frame_info);
|
cogl_onscreen_swap_buffers (stage_x11->onscreen, frame_info, frame);
|
||||||
|
|
||||||
if (!clutter_frame_has_result (frame))
|
if (!clutter_frame_has_result (frame))
|
||||||
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_IDLE);
|
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_IDLE);
|
||||||
|
Loading…
Reference in New Issue
Block a user