## Dummyload Dummyload — Library for submitting GPU workloads |

## Functions

igt_spin_t * | igt_spin_batch_new ()
igt_spin_t * | igt_spin_batch_new_fence ()
void | igt_spin_batch_set_timeout ()
void | igt_spin_batch_end ()
void | igt_spin_batch_free ()
void | igt_terminate_spin_batches ()

## Types and Values

| igt_spin_t

## Includes

    #include <igt.h>

## Description

A lot of igt testcases need some GPU workload to make sure a race window is big enough. Unfortunately having a fixed amount of workload leads to spurious test failures or overly long runtimes on some fast/slow platforms. This library contains functionality to submit GPU workloads that should consume exactly a specific amount of time.

## Functions

### igt_spin_batch_new ()

    igt_spin_t *
    igt_spin_batch_new (int fd,
                        uint32_t ctx,
                        unsigned  engine,
                        uint32_t dep);

Start a recursive batch on a ring. Immediately returns a igt_spin_t that contains the batch's handle that can be waited upon. The returned structure must be passed to `igt_spin_batch_free()` for post-processing.

#### Parameters

fd | open i915 drm file descriptor |
engine | Ring to execute batch OR'd with execbuf flags. If value is less than 0, execute on all available rings. |
dep | handle to a buffer object dependency. If greater than 0, add a relocation entry to this buffer within the batch. |

#### Returns

Structure with helper internal state for `igt_spin_batch_free()`.

### igt_spin_batch_new_fence ()

    igt_spin_t *
    igt_spin_batch_new_fence (int fd,
                              uint32_t ctx,
                              unsigned  engine);

Start a recursive batch on a ring. Immediately returns a igt_spin_t that contains the batch's handle that can be waited upon. The returned structure must be passed to `igt_spin_batch_free()` for post-processing.

igt_spin_t will contain an output fence associtated with this batch.

#### Parameters

fd | open i915 drm file descriptor |
engine | Ring to execute batch OR'd with execbuf flags. If value is less than 0, execute on all available rings. |

#### Returns

Structure with helper internal state for `igt_spin_batch_free()`.

### igt_spin_batch_set_timeout ()

    void
    igt_spin_batch_set_timeout (igt_spin_t *spin,
                                int64_t ns);

Specify a timeout. This ends the recursive batch associated with `spin` after the timeout has elapsed.

#### Parameters

spin | spin batch state from `igt_spin_batch_new()` |
ns | amount of time in nanoseconds the batch continues to execute before finishing. |

### igt_spin_batch_end ()

    void
    igt_spin_batch_end (igt_spin_t *spin);

End the recursive batch associated with `spin` manually.

#### Parameters

spin | spin batch state from `igt_spin_batch_new()` |

### igt_spin_batch_free ()

    void
    igt_spin_batch_free (int fd,
                         igt_spin_t *spin);

This function does the necessary post-processing after starting a recursive batch with `igt_spin_batch_new()`.

#### Parameters

fd | open i915 drm file descriptor |
spin | spin batch state from `igt_spin_batch_new()` |

### igt_terminate_spin_batches ()

    void
    igt_terminate_spin_batches (void);

## Types and Values

### igt_spin_t

    typedef struct {
    	unsigned int handle;
    	timer_t timer;
    	struct igt_list link;
    	uint32_t *batch;
    	int out_fence;
    } igt_spin_t;