1
#include "iris_context.h"
2
#include "iris_fine_fence.h"
3
#include "util/u_upload_mgr.h"
6
iris_fine_fence_reset(struct iris_batch *batch)
8
u_upload_alloc(batch->fine_fences.uploader,
9
0, sizeof(uint64_t), sizeof(uint64_t),
10
&batch->fine_fences.ref.offset, &batch->fine_fences.ref.res,
11
(void **)&batch->fine_fences.map);
12
WRITE_ONCE(*batch->fine_fences.map, 0);
13
batch->fine_fences.next++;
17
iris_fine_fence_init(struct iris_batch *batch)
19
batch->fine_fences.ref.res = NULL;
20
batch->fine_fences.next = 0;
21
iris_fine_fence_reset(batch);
25
iris_fine_fence_next(struct iris_batch *batch)
27
uint32_t seqno = batch->fine_fences.next++;
29
if (batch->fine_fences.next == 0)
30
iris_fine_fence_reset(batch);
36
iris_fine_fence_destroy(struct iris_screen *screen,
37
struct iris_fine_fence *fine)
39
iris_syncobj_reference(screen, &fine->syncobj, NULL);
40
pipe_resource_reference(&fine->ref.res, NULL);
44
struct iris_fine_fence *
45
iris_fine_fence_new(struct iris_batch *batch, unsigned flags)
47
struct iris_fine_fence *fine = calloc(1, sizeof(*fine));
51
pipe_reference_init(&fine->reference, 1);
53
fine->seqno = iris_fine_fence_next(batch);
55
iris_syncobj_reference(batch->screen, &fine->syncobj,
56
iris_batch_get_signal_syncobj(batch));
58
pipe_resource_reference(&fine->ref.res, batch->fine_fences.ref.res);
59
fine->ref.offset = batch->fine_fences.ref.offset;
60
fine->map = batch->fine_fences.map;
64
if (flags & IRIS_FENCE_TOP_OF_PIPE) {
65
pc = PIPE_CONTROL_WRITE_IMMEDIATE | PIPE_CONTROL_CS_STALL;
67
pc = PIPE_CONTROL_WRITE_IMMEDIATE |
68
PIPE_CONTROL_RENDER_TARGET_FLUSH |
69
PIPE_CONTROL_DEPTH_CACHE_FLUSH |
70
PIPE_CONTROL_DATA_CACHE_FLUSH;
72
iris_emit_pipe_control_write(batch, "fence: fine", pc,
73
iris_resource_bo(fine->ref.res),