mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2025-12-07 18:53:09 +08:00
implement a new API: TestIfSharedSurfaceChanged()
This commit is contained in:
@@ -1883,12 +1883,34 @@ MG_EXPORT HSURF GUIAPI AttachToSharedSurface (GHANDLE video, int fd,
|
||||
MG_EXPORT const char *GUIAPI GetSharedSurfaceInfo (HSURF surf, int *fd,
|
||||
SIZE *size, int *pitch, size_t *map_size, off_t *pixels_off);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI TestIfSharedSurfaceChanged (HSURF surf,
|
||||
* unsigned dirty_age)
|
||||
* \brief Tests if a shared surface changed.
|
||||
*
|
||||
* This function tests if the given shared surface \a surf had changed, i.e.,
|
||||
* it has a different dirty age value against the specified value \a dirty_age.
|
||||
*
|
||||
* \param surf The handle to the shared surface.
|
||||
* \param dirty_age The dirty age to compare.
|
||||
*
|
||||
* \return TRUE for changed; FALSE for no change or failure.
|
||||
*
|
||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||
*
|
||||
* \sa LockSharedSurface
|
||||
*
|
||||
* Since 5.2.0
|
||||
*/
|
||||
MG_EXPORT BOOL GUIAPI TestIfSharedSurfaceChanged (HSURF surf,
|
||||
unsigned dirty_age);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI LockSharedSurface (HSURF surf,
|
||||
* unsigned *dirty_age, int *nr_dirty_rects, const RECT **dirty_rects)
|
||||
* \brief Locks the shared surface for read.
|
||||
*
|
||||
* This function lock the given shared surface \a surf and returns
|
||||
* This function locks the given shared surface \a surf and returns
|
||||
* the dirty information.
|
||||
*
|
||||
* \param surf The handle to the shared surface.
|
||||
|
||||
@@ -327,6 +327,21 @@ failed:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL GUIAPI TestIfSharedSurfaceChanged(HSURF surf, unsigned dirty_age)
|
||||
{
|
||||
if (surf->shared_header == NULL) {
|
||||
_WRN_PRINTF("INVALID_ARG: surface handle: %p\n", surf);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/* TODO: use atomic comparison */
|
||||
if (dirty_age != surf->shared_header->dirty_info.dirty_age)
|
||||
return TRUE;
|
||||
|
||||
failed:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL GUIAPI LockSharedSurface(HSURF surf, unsigned *dirty_age,
|
||||
int *nr_dirty_rcs, const RECT **dirty_rcs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user