Lines Matching refs:ring
8 struct intel_ring *ring; in mock_ring() local
10 ring = kzalloc(sizeof(*ring) + sz, GFP_KERNEL); in mock_ring()
11 if (!ring) in mock_ring()
14 kref_init(&ring->ref); in mock_ring()
15 ring->size = sz; in mock_ring()
16 ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(sz); in mock_ring()
17 ring->effective_size = sz; in mock_ring()
18 ring->vaddr = (void *)(ring + 1); in mock_ring()
19 atomic_set(&ring->pin_count, 1); in mock_ring()
21 intel_ring_update_space(ring); in mock_ring()
23 return ring; in mock_ring()
26 static void mock_ring_free(struct intel_ring *ring) in mock_ring_free() argument
28 kfree(ring); in mock_ring_free()
31 static int check_ring_direction(struct intel_ring *ring, in check_ring_direction() argument
37 result = intel_ring_direction(ring, next, prev); in check_ring_direction()
52 static int check_ring_step(struct intel_ring *ring, u32 x, u32 step) in check_ring_step() argument
54 u32 prev = x, next = intel_ring_wrap(ring, x + step); in check_ring_step()
57 err |= check_ring_direction(ring, next, next, 0); in check_ring_step()
58 err |= check_ring_direction(ring, prev, prev, 0); in check_ring_step()
59 err |= check_ring_direction(ring, next, prev, 1); in check_ring_step()
60 err |= check_ring_direction(ring, prev, next, -1); in check_ring_step()
65 static int check_ring_offset(struct intel_ring *ring, u32 x, u32 step) in check_ring_offset() argument
69 err |= check_ring_step(ring, x, step); in check_ring_offset()
70 err |= check_ring_step(ring, intel_ring_wrap(ring, x + 1), step); in check_ring_offset()
71 err |= check_ring_step(ring, intel_ring_wrap(ring, x - 1), step); in check_ring_offset()
78 struct intel_ring *ring; in igt_ring_direction() local
82 ring = mock_ring(2 * half); in igt_ring_direction()
83 if (!ring) in igt_ring_direction()
86 GEM_BUG_ON(ring->size != 2 * half); in igt_ring_direction()
90 err |= check_ring_offset(ring, 0, step); in igt_ring_direction()
91 err |= check_ring_offset(ring, half, step); in igt_ring_direction()
93 err |= check_ring_step(ring, 0, half - 64); in igt_ring_direction()
96 err |= check_ring_offset(ring, 0, 2 * half + 64); in igt_ring_direction()
97 err |= check_ring_offset(ring, 3 * half, 1); in igt_ring_direction()
99 mock_ring_free(ring); in igt_ring_direction()