syncobj: igt-gpu-tools Reference Manual

## syncobj syncobj — Library with syncobj helpers |

## Functions

uint32_t | syncobj_create ()
void | syncobj_destroy ()
int | syncobj_handle_to_fd ()
uint32_t | syncobj_fd_to_handle ()
void | syncobj_import_sync_file ()
int | syncobj_wait_err ()
bool | syncobj_wait ()
bool | syncobj_timeline_wait ()
int | syncobj_timeline_wait_err ()
void | syncobj_reset ()
void | syncobj_signal ()
void | syncobj_timeline_query ()
void | syncobj_binary_to_timeline ()
void | syncobj_timeline_to_binary ()
void | syncobj_timeline_to_timeline ()
void | syncobj_timeline_signal ()

## Includes

    #include <igt_syncobj.h>

## Description

This library contains helpers for sync object tests.

## Functions

### syncobj_create ()

    uint32_t
    syncobj_create (int fd,
                    uint32_t flags);

Create a syncobj with the flags.

#### Parameters

fd | The DRM file descriptor |
flags | Flags to pass syncobj create |

#### Returns

A newly created syncobj

### syncobj_destroy ()

    void
    syncobj_destroy (int fd,
                     uint32_t handle);

#### Parameters

fd | The DRM file descriptor |
handle | The handle to the syncobj to destroy Destroy a syncobj. |

### syncobj_handle_to_fd ()

    int
    syncobj_handle_to_fd (int fd,
                          uint32_t handle,
                          uint32_t flags);

Convert a syncobj handle to an fd using the flags.

#### Parameters

fd | The DRM file descriptor |
handle | Handle to syncobj |
flags | Flags to handle to fd ioctl. |

#### Returns

a file descriptor (either syncobj or sync_file.

### syncobj_fd_to_handle ()

    uint32_t
    syncobj_fd_to_handle (int fd,
                          int syncobj_fd,
                          uint32_t flags);

Convert a syncobj fd a syncobj handle using the flags.

#### Parameters

fd | The DRM file descriptor |
syncobj_fd | syncobj fd to convert |
flags | Flags to the syncobj fd to handle ioctl. |

#### Returns

a syncobj handle.

### syncobj_import_sync_file ()

    void
    syncobj_import_sync_file (int fd,
                              uint32_t handle,
                              int sync_file);

Import a sync_file fd into a syncobj handle.

#### Parameters

fd | The DRM file descriptor |
handle | Handle to the syncobt to import file into |
sync_file | The sync_file fd to import state from. |

### syncobj_wait_err ()

    int
    syncobj_wait_err (int fd,
                      uint32_t *handles,
                      uint32_t count,
                      uint64_t abs_timeout_nsec,
                      uint32_t flags);

### syncobj_wait ()

    bool
    syncobj_wait (int fd,
                  uint32_t *handles,
                  uint32_t count,
                  uint64_t abs_timeout_nsec,
                  uint32_t flags,
                  uint32_t *first_signaled);

Waits in the kernel for any/all the requested syncobjs using the timeout and flags.

#### Parameters

fd | The DRM file descriptor |
handles | List of syncobj handles to wait for. |
count | Count of handles |
abs_timeout_nsec | Absolute wait timeout in nanoseconds. |
flags | Wait ioctl flags. |
first_signaled | Returned handle for first signaled syncobj. |

#### Returns

bool value - false = timedout, true = signaled

### syncobj_timeline_wait ()

    bool
    syncobj_timeline_wait (int fd,
                           uint32_t *handles,
                           uint64_t *points,
                           unsigned  num_handles,
                           int64_t timeout_nsec,
                           unsigned  flags,
                           uint32_t *first_signaled);

Waits in the kernel for any/all the requested syncobjs timeline point using the timeout and flags.

#### Parameters

fd | The DRM file descriptor |
handles | List of syncobj handles to wait for. |
points | List of point of handles to wait for. |
num_handles | Count of handles |
timeout_nsec | Absolute wait timeout in nanoseconds. |
flags | Wait ioctl flags. |
first_signaled | Returned handle for first signaled syncobj. |

#### Returns

bool value - false = timedout, true = signaled

### syncobj_timeline_wait_err ()

    int
    syncobj_timeline_wait_err (int fd,
                               uint32_t *handles,
                               uint64_t *points,
                               unsigned  num_handles,
                               int64_t timeout_nsec,
                               unsigned  flags);

### syncobj_reset ()

    void
    syncobj_reset (int fd,
                   uint32_t *handles,
                   uint32_t count);

Reset state of a set of syncobjs.

#### Parameters

fd | The DRM file descriptor. |
handles | Array of syncobj handles to reset |
count | Count of syncobj handles. |

### syncobj_signal ()

    void
    syncobj_signal (int fd,
                    uint32_t *handles,
                    uint32_t count);

Signal a set of syncobjs.

#### Parameters

fd | The DRM file descriptor. |
handles | Array of syncobj handles to signal |
points | List of point of handles to signal. |
count | Count of syncobj handles. |

### syncobj_timeline_query ()

    void
    syncobj_timeline_query (int fd,
                            uint32_t *handles,
                            uint64_t *points,
                            uint32_t count);

Queries a set of syncobjs.

#### Parameters

fd | The DRM file descriptor. |
handles | Array of syncobj handles. |
points | Array of syncobj points queried. |
count | Count of syncobj handles. |

### syncobj_binary_to_timeline ()

    void
    syncobj_binary_to_timeline (int fd,
                                uint32_t timeline_handle,
                                uint64_t point,
                                uint32_t binary_handle);

Transfers DMA fence from a given point from timeline syncobj into a binary syncobj.

#### Parameters

fd | The DRM file descriptor. |
binary_handle | A syncobj binary handle |
timeline_handle | A syncobj timeline handle |
point | A syncobj timeline point in the timeline handle |

### syncobj_timeline_to_binary ()

    void
    syncobj_timeline_to_binary (int fd,
                                uint32_t binary_handle,
                                uint32_t timeline_handle,
                                uint64_t point,
                                uint32_t flags);

### syncobj_timeline_to_timeline ()

    void
    syncobj_timeline_to_timeline (int fd,
                                  uint64_t timeline_dst,
                                  uint32_t point_dst,
                                  uint64_t timeline_src,
                                  uint32_t point_src);

query a set of syncobjs.

#### Parameters

fd | The DRM file descriptor. |
timeline_src | A timeline syncobj handle |
timeline_dst | A timeline syncobj handle |
point_src | A point on the source timeline syncobj |
point_dst | A point on the destination timeline syncobj |

### syncobj_timeline_signal ()

    void
    syncobj_timeline_signal (int fd,
                             uint32_t *handles,
                             uint64_t *points,
                             uint32_t count);