Mir
Classes | Typedefs | Enumerations
fenced_buffers.h File Reference
#include "mir_toolkit/mir_extension_core.h"
Include dependency graph for fenced_buffers.h:

Go to the source code of this file.

Classes

struct  MirExtensionFencedBuffersV1
 

Typedefs

typedef enum MirBufferAccess MirBufferAccess
 

Enumerations

enum  MirBufferAccess { mir_none, mir_read, mir_read_write }
 

Fenced Buffer content access functions.

These functions will wait until it is safe to access the buffer for the given purpose.

If used with mir_none, the buffer will be given the buffer immediately, and without synchronization. It is then up to the user to ensure that the buffer contents are not accessed at inapproprate times.

Note
the following functions (mir_buffer_get_native_buffer, mir_buffer_get_graphics_region) can only be used when the buffer is not submitted to the server.
typedef int(* mir_buffer_get_fence) (MirBuffer *)
 Retrieve the native fence associated with this buffer. More...
 
typedef void(* mir_buffer_associate_fence) (MirBuffer *buffer, int fence, MirBufferAccess access)
 Protect the buffer's contents by associating a native fence with it. More...
 
typedef int(* mir_buffer_wait_for_access) (MirBuffer *buffer, MirBufferAccess access, int timeout)
 Wait for the fence associated with the buffer to signal. More...
 
typedef struct MirExtensionFencedBuffersV1 MirExtensionFencedBuffersV1
 

Typedef Documentation

◆ mir_buffer_associate_fence

typedef void(* mir_buffer_associate_fence) (MirBuffer *buffer, int fence, MirBufferAccess access)

Protect the buffer's contents by associating a native fence with it.

Warning
any fence currently associated with buffer will be replaced in favor of fence without waiting for the replaced fence to clear
The Mir client api assumes ownership of the fence fd.
Parameters
[in]bufferThe buffer
[in]fenceThe fence that will be associated with buffer. If negative, this will remove the fence associated with this buffer.
[in]accessThe ongoing access that is represented by fence. If mir_none is set, this will remove the fence protecting the buffer content.

◆ mir_buffer_get_fence

typedef int(* mir_buffer_get_fence) (MirBuffer *)

Retrieve the native fence associated with this buffer.

Warning
Take care not to close the fd, the Mir client api retains ownership of the fence fd.
Parameters
[in]bufferThe buffer.
Returns
The fd representing the fence associated with buffer.

◆ mir_buffer_wait_for_access

typedef int(* mir_buffer_wait_for_access) (MirBuffer *buffer, MirBufferAccess access, int timeout)

Wait for the fence associated with the buffer to signal.

After returning, it is permissible to access the buffer's content for the designated purpose in access.

Parameters
[in]bufferThe buffer
[in]accessThe access to wait for.
[in]timeoutThe amount of time to wait for the fence in nanoseconds, or -1 for infinite timeout.
Returns
zero when fence was cleared successfully, or a negative number when the timeout was reached before the fence signals

◆ MirBufferAccess

◆ MirExtensionFencedBuffersV1

Enumeration Type Documentation

◆ MirBufferAccess

Enumerator
mir_none 
mir_read 
mir_read_write 

Copyright © 2012-2020 Canonical Ltd.
Generated on Thu Apr 2 01:16:04 UTC 2020
This documentation is licensed under the GPL version 2 or 3.