cogl/frame-info: Add ZERO_COPY flag

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>
This commit is contained in:
Ivan Molodetskikh 2021-01-28 11:17:52 +03:00 committed by Marge Bot
parent 99efb40cce
commit 9123aa4e84
4 changed files with 18 additions and 0 deletions

View File

@ -40,6 +40,14 @@ typedef enum _CoglFrameInfoFlag
COGL_FRAME_INFO_FLAG_SYMBOLIC = 1 << 0, COGL_FRAME_INFO_FLAG_SYMBOLIC = 1 << 0,
/* presentation_time timestamp was provided by the hardware */ /* presentation_time timestamp was provided by the hardware */
COGL_FRAME_INFO_FLAG_HW_CLOCK = 1 << 1, COGL_FRAME_INFO_FLAG_HW_CLOCK = 1 << 1,
/*
* The presentation of this frame was done zero-copy. This means the buffer
* from the client was given to display hardware as is, without copying it.
* Compositing with OpenGL counts as copying, even if textured directly from
* the client buffer. Possible zero-copy cases include direct scanout of a
* fullscreen surface and a surface on a hardware overlay.
*/
COGL_FRAME_INFO_FLAG_ZERO_COPY = 1 << 2,
} CoglFrameInfoFlag; } CoglFrameInfoFlag;
struct _CoglFrameInfo struct _CoglFrameInfo

View File

@ -95,6 +95,12 @@ cogl_frame_info_is_hw_clock (CoglFrameInfo *info)
return !!(info->flags & COGL_FRAME_INFO_FLAG_HW_CLOCK); return !!(info->flags & COGL_FRAME_INFO_FLAG_HW_CLOCK);
} }
gboolean
cogl_frame_info_is_zero_copy (CoglFrameInfo *info)
{
return !!(info->flags & COGL_FRAME_INFO_FLAG_ZERO_COPY);
}
unsigned int unsigned int
cogl_frame_info_get_sequence (CoglFrameInfo *info) cogl_frame_info_get_sequence (CoglFrameInfo *info)
{ {

View File

@ -141,6 +141,9 @@ gboolean cogl_frame_info_get_is_symbolic (CoglFrameInfo *info);
COGL_EXPORT COGL_EXPORT
gboolean cogl_frame_info_is_hw_clock (CoglFrameInfo *info); gboolean cogl_frame_info_is_hw_clock (CoglFrameInfo *info);
COGL_EXPORT
gboolean cogl_frame_info_is_zero_copy (CoglFrameInfo *info);
COGL_EXPORT COGL_EXPORT
unsigned int cogl_frame_info_get_sequence (CoglFrameInfo *info); unsigned int cogl_frame_info_get_sequence (CoglFrameInfo *info);

View File

@ -458,6 +458,7 @@ cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
return FALSE; return FALSE;
} }
info->flags |= COGL_FRAME_INFO_FLAG_ZERO_COPY;
priv->frame_counter++; priv->frame_counter++;
return TRUE; return TRUE;
} }