iris: drop unused field
[mesa.git] / src / gallium / drivers / iris / iris_batch.h
1 /*
2 * Copyright © 2017 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #ifndef IRIS_BATCH_DOT_H
25 #define IRIS_BATCH_DOT_H
26
27 #include <stdint.h>
28 #include <stdbool.h>
29
30 struct iris_address {
31 struct iris_bo *bo;
32 unsigned reloc_flags;
33 uint32_t offset;
34 };
35
36 struct iris_reloc_list {
37 struct drm_i915_gem_relocation_entry *relocs;
38 int reloc_count;
39 int reloc_array_size;
40 };
41
42 struct iris_batch_buffer {
43 struct iris_bo *bo;
44 void *map;
45 void *map_next;
46
47 struct iris_bo *partial_bo;
48 unsigned partial_bytes;
49
50 struct iris_reloc_list relocs;
51 };
52
53 struct iris_batch {
54 struct iris_screen *screen;
55 struct pipe_debug_callback *dbg;
56
57 /** Current batchbuffer being queued up. */
58 struct iris_batch_buffer cmdbuf;
59 /** Current statebuffer being queued up. */
60 struct iris_batch_buffer statebuf;
61
62 /** Last BO submitted to the hardware. Used for glFinish(). */
63 struct iris_bo *last_cmd_bo;
64
65 uint32_t hw_ctx_id;
66
67 bool no_wrap;
68
69 /** The validation list */
70 struct drm_i915_gem_exec_object2 *validation_list;
71 struct iris_bo **exec_bos;
72 int exec_count;
73 int exec_array_size;
74
75 /** The amount of aperture space (in bytes) used by all exec_bos */
76 int aperture_space;
77
78 /** Map from batch offset to iris_alloc_state data (with DEBUG_BATCH) */
79 struct hash_table *state_sizes;
80 };
81
82 void iris_batch_init(struct iris_batch *batch,
83 struct iris_screen *screen,
84 struct pipe_debug_callback *dbg);
85 void iris_batch_free(struct iris_batch *batch);
86 void iris_require_command_space(struct iris_batch *batch, unsigned size);
87 void iris_require_state_space(struct iris_batch *batch, unsigned size);
88 void iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size);
89 uint32_t iris_emit_state(struct iris_batch *batch, const void *data, int size,
90 int alignment);
91 void *iris_alloc_state(struct iris_batch *batch, int size, int alignment,
92 uint32_t *out_offset);
93
94 int _iris_batch_flush_fence(struct iris_batch *batch,
95 int in_fence_fd, int *out_fence_fd,
96 const char *file, int line);
97
98
99 #define iris_batch_flush_fence(batch, in_fence_fd, out_fence_fd) \
100 _iris_batch_flush_fence((batch), (in_fence_fd), (out_fence_fd), \
101 __FILE__, __LINE__)
102
103 #define iris_batch_flush(batch) iris_batch_flush_fence((batch), -1, NULL)
104
105 bool iris_batch_references(struct iris_batch *batch, struct iris_bo *bo);
106
107 #define RELOC_WRITE EXEC_OBJECT_WRITE
108
109 uint64_t iris_batch_reloc(struct iris_batch *batch,
110 uint32_t batch_offset,
111 struct iris_bo *target,
112 uint32_t target_offset,
113 unsigned flags);
114
115 uint64_t iris_state_reloc(struct iris_batch *batch,
116 uint32_t batch_offset,
117 struct iris_bo *target,
118 uint32_t target_offset,
119 unsigned flags);
120 #endif