summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/drm/intel/gem/intel_be_fence.h
blob: 0fe18f66f83da56fbbf6abcfb45d2d8d400c0d3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

#ifndef INTEL_BE_FENCE_H
#define INTEL_BE_FENCE_H

#include "pipe/p_defines.h"

#include "drm.h"
#include "intel_bufmgr.h"

/**
 * Because gem does not have fence's we have to create our own fences.
 *
 * They work by keeping the batchbuffer around and checking if that has
 * been idled. If bo is NULL fence has expired.
 */
struct intel_be_fence
{
	uint32_t refcount;
	drm_intel_bo *bo;
};

static INLINE void
intel_be_fence_reference(struct intel_be_fence *f)
{
	f->refcount++;
}

static INLINE void
intel_be_fence_unreference(struct intel_be_fence *f)
{
	if (!--f->refcount) {
		if (f->bo)
			drm_intel_bo_unreference(f->bo);
		free(f);
	}
}

#endif