Dummyload

Dummyload — Library for submitting GPU workloads

Functions

Types and Values

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_new_poll ()

igt_spin_t *
igt_spin_batch_new_poll (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->running will containt a pointer which target will change from zero to one once the spinner actually starts executing on the GPU.

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);

IGT_CORK()

#define IGT_CORK(name, cork_type) struct igt_cork name = { .type = cork_type, .fd = -1}

IGT_CORK_HANDLE()

#define IGT_CORK_HANDLE(name) IGT_CORK(name, CORK_VGEM_HANDLE)

IGT_CORK_FENCE()

#define IGT_CORK_FENCE(name) IGT_CORK(name, CORK_SYNC_FD)

igt_cork_plug ()

uint32_t
igt_cork_plug (struct igt_cork *cork,
               int fd);

This function provides a mechanism to stall submission. It provides two blocking methods:

VGEM_BO. Imports a vgem bo with a fence attached to it. This bo can be used as a dependency during submission to stall execution until the fence is signaled.

SW_SYNC: Creates a timeline and then a fence on that timeline. The fence can be used as an input fence to a request, the request will be stalled until the fence is signaled.

The parameters required to unblock the execution and to cleanup are stored in the provided cork structure.

Parameters

fd

open drm file descriptor

 

method

method to utilize for corking.

 

cork

structure that will be filled with the state of the cork bo. Note: this has to match the corking method.

 

Returns

Handle of the imported BO / Sw sync fence FD.


igt_cork_unplug ()

void
igt_cork_unplug (struct igt_cork *cork);

This function unblocks the execution by signaling the fence attached to the imported bo and does the necessary post-processing.

NOTE: the handle returned by igt_cork_plug is not closed during this phase.

Parameters

method

method to utilize for corking.

 

cork

cork state from igt_cork_plug()

 

Types and Values

igt_spin_t

typedef struct {
	unsigned int handle;
	timer_t timer;
	struct igt_list link;
	uint32_t *batch;
	int out_fence;
	struct drm_i915_gem_exec_object2 obj[2];
	struct drm_i915_gem_execbuffer2 execbuf;
	uint32_t poll_handle;
	bool *running;
} igt_spin_t;

enum igt_cork_type

Members

CORK_SYNC_FD

   

CORK_VGEM_HANDLE

   

struct igt_cork_vgem

struct igt_cork_vgem {
	int device;
	uint32_t fence;
};

struct igt_cork_sw_sync

struct igt_cork_sw_sync {
	int timeline;
};

struct igt_cork

struct igt_cork {
	enum igt_cork_type type;

	union {
		int fd;

		struct igt_cork_vgem vgem;
		struct igt_cork_sw_sync sw_sync;
	};
};