2 * Copyright © 2017 Intel Corporation
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:
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
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
24 #ifndef IRIS_BATCH_DOT_H
25 #define IRIS_BATCH_DOT_H
36 struct iris_reloc_list
{
37 struct drm_i915_gem_relocation_entry
*relocs
;
43 struct iris_screen
*screen
;
44 struct pipe_debug_callback
*dbg
;
46 /** Current batchbuffer being queued up. */
47 struct iris_bo
*cmd_bo
;
48 /** Current statebuffer being queued up. */
49 struct iris_bo
*state_bo
;
51 /** Last BO submitted to the hardware. Used for glFinish(). */
52 struct iris_bo
*last_cmd_bo
;
63 struct iris_reloc_list batch_relocs
;
64 struct iris_reloc_list state_relocs
;
66 /** The validation list */
67 struct drm_i915_gem_exec_object2
*validation_list
;
68 struct iris_bo
**exec_bos
;
72 /** The amount of aperture space (in bytes) used by all exec_bos */
75 /** Map from batch offset to iris_alloc_state data (with DEBUG_BATCH) */
76 struct hash_table
*state_sizes
;
79 void iris_batch_init(struct iris_batch
*batch
,
80 struct iris_screen
*screen
,
81 struct pipe_debug_callback
*dbg
);
82 void iris_batch_free(struct iris_batch
*batch
);
83 void iris_require_command_space(struct iris_batch
*batch
, unsigned size
);
84 void iris_require_state_space(struct iris_batch
*batch
, unsigned size
);
85 void iris_batch_emit(struct iris_batch
*batch
, const void *data
, unsigned size
);
86 void *iris_alloc_state(struct iris_batch
*batch
, int size
, int alignment
,
87 uint32_t *out_offset
);
89 int _iris_batch_flush_fence(struct iris_batch
*batch
,
90 int in_fence_fd
, int *out_fence_fd
,
91 const char *file
, int line
);
94 #define iris_batch_flush_fence(batch, in_fence_fd, out_fence_fd) \
95 _iris_batch_flush_fence((batch), (in_fence_fd), (out_fence_fd), \
98 #define iris_batch_flush(batch) iris_batch_flush_fence((batch), -1, NULL)
100 bool iris_batch_references(struct iris_batch
*batch
, struct iris_bo
*bo
);
102 #define RELOC_WRITE EXEC_OBJECT_WRITE
104 uint64_t iris_batch_reloc(struct iris_batch
*batch
,
105 uint32_t batch_offset
,
106 struct iris_bo
*target
,
107 uint32_t target_offset
,
110 uint64_t iris_state_reloc(struct iris_batch
*batch
,
111 uint32_t batch_offset
,
112 struct iris_bo
*target
,
113 uint32_t target_offset
,