Chia-I Wu | 00a23b2 | 2014-08-20 15:28:08 +0800 | [diff] [blame] | 1 | /* |
| 2 | * XGL |
| 3 | * |
| 4 | * Copyright (C) 2014 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
Chia-I Wu | 44e4236 | 2014-09-02 08:32:09 +0800 | [diff] [blame] | 23 | * |
| 24 | * Authors: |
| 25 | * Chia-I Wu <olv@lunarg.com> |
Chia-I Wu | 00a23b2 | 2014-08-20 15:28:08 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef CMD_PRIV_H |
| 29 | #define CMD_PRIV_H |
| 30 | |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 31 | #include "genhw/genhw.h" |
Chia-I Wu | 32710d7 | 2014-08-20 16:05:22 +0800 | [diff] [blame] | 32 | #include "dev.h" |
| 33 | #include "gpu.h" |
Chia-I Wu | 00a23b2 | 2014-08-20 15:28:08 +0800 | [diff] [blame] | 34 | #include "cmd.h" |
| 35 | |
Chia-I Wu | 32710d7 | 2014-08-20 16:05:22 +0800 | [diff] [blame] | 36 | #define CMD_ASSERT(cmd, min_gen, max_gen) \ |
| 37 | INTEL_GPU_ASSERT((cmd)->dev->gpu, (min_gen), (max_gen)) |
| 38 | |
Chia-I Wu | 958d1b7 | 2014-08-21 11:28:11 +0800 | [diff] [blame] | 39 | struct intel_cmd_reloc { |
Chia-I Wu | 68f319d | 2014-09-09 09:43:21 +0800 | [diff] [blame] | 40 | enum intel_cmd_writer_type which; |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 41 | XGL_SIZE offset; |
Chia-I Wu | 958d1b7 | 2014-08-21 11:28:11 +0800 | [diff] [blame] | 42 | |
Chia-I Wu | 9ee3872 | 2014-08-25 12:11:36 +0800 | [diff] [blame] | 43 | struct intel_bo *bo; |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 44 | uint32_t bo_offset; |
Chia-I Wu | 958d1b7 | 2014-08-21 11:28:11 +0800 | [diff] [blame] | 45 | |
Chia-I Wu | 32a2246 | 2014-08-26 14:13:46 +0800 | [diff] [blame] | 46 | uint32_t flags; |
Chia-I Wu | 958d1b7 | 2014-08-21 11:28:11 +0800 | [diff] [blame] | 47 | }; |
| 48 | |
Chia-I Wu | 9f03986 | 2014-08-20 15:39:56 +0800 | [diff] [blame] | 49 | static inline int cmd_gen(const struct intel_cmd *cmd) |
| 50 | { |
| 51 | return intel_gpu_gen(cmd->dev->gpu); |
| 52 | } |
| 53 | |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 54 | static inline void cmd_reserve_reloc(struct intel_cmd *cmd, |
| 55 | XGL_UINT reloc_len) |
| 56 | { |
| 57 | /* fail silently */ |
| 58 | if (cmd->reloc_used + reloc_len > cmd->reloc_count) { |
| 59 | cmd->reloc_used = 0; |
| 60 | cmd->result = XGL_ERROR_TOO_MANY_MEMORY_REFERENCES; |
| 61 | } |
| 62 | assert(cmd->reloc_used + reloc_len <= cmd->reloc_count); |
| 63 | } |
| 64 | |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 65 | void cmd_writer_grow(struct intel_cmd *cmd, |
Chia-I Wu | 3c3edc0 | 2014-09-09 10:32:59 +0800 | [diff] [blame] | 66 | enum intel_cmd_writer_type which, |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 67 | XGL_SIZE new_size); |
| 68 | |
| 69 | /** |
| 70 | * Return an offset to a region that is aligned to \p alignment and has at |
| 71 | * least \p size bytes. |
| 72 | */ |
| 73 | static inline XGL_SIZE cmd_writer_reserve(struct intel_cmd *cmd, |
| 74 | enum intel_cmd_writer_type which, |
| 75 | XGL_SIZE alignment, XGL_SIZE size) |
| 76 | { |
| 77 | struct intel_cmd_writer *writer = &cmd->writers[which]; |
| 78 | XGL_SIZE offset; |
| 79 | |
| 80 | assert(alignment && u_is_pow2(alignment)); |
| 81 | offset = u_align(writer->used, alignment); |
| 82 | |
| 83 | if (offset + size > writer->size) { |
| 84 | cmd_writer_grow(cmd, which, offset + size); |
| 85 | /* align again in case of errors */ |
| 86 | offset = u_align(writer->used, alignment); |
| 87 | |
| 88 | assert(offset + size <= writer->size); |
| 89 | } |
| 90 | |
| 91 | return offset; |
| 92 | } |
Chia-I Wu | 00a23b2 | 2014-08-20 15:28:08 +0800 | [diff] [blame] | 93 | |
Chia-I Wu | 32710d7 | 2014-08-20 16:05:22 +0800 | [diff] [blame] | 94 | /** |
Chia-I Wu | bda55fd | 2014-08-25 12:46:10 +0800 | [diff] [blame] | 95 | * Add a reloc at \p pos. No error checking. |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 96 | */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 97 | static inline void cmd_writer_reloc(struct intel_cmd *cmd, |
| 98 | enum intel_cmd_writer_type which, |
| 99 | XGL_SIZE offset, struct intel_bo *bo, |
| 100 | uint32_t bo_offset, uint32_t flags) |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 101 | { |
| 102 | struct intel_cmd_reloc *reloc = &cmd->relocs[cmd->reloc_used]; |
| 103 | |
| 104 | assert(cmd->reloc_used < cmd->reloc_count); |
| 105 | |
Chia-I Wu | 68f319d | 2014-09-09 09:43:21 +0800 | [diff] [blame] | 106 | reloc->which = which; |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 107 | reloc->offset = offset; |
Chia-I Wu | 9ee3872 | 2014-08-25 12:11:36 +0800 | [diff] [blame] | 108 | reloc->bo = bo; |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 109 | reloc->bo_offset = bo_offset; |
Chia-I Wu | 32a2246 | 2014-08-26 14:13:46 +0800 | [diff] [blame] | 110 | reloc->flags = flags; |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 111 | |
| 112 | cmd->reloc_used++; |
| 113 | } |
| 114 | |
| 115 | /** |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 116 | * Reserve a region from the state buffer. Both the offset, in bytes, and the |
| 117 | * pointer to the reserved region are returned. |
| 118 | * |
| 119 | * Note that \p alignment is in bytes and \p len is in DWords. |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 120 | */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 121 | static inline uint32_t cmd_state_pointer(struct intel_cmd *cmd, |
| 122 | XGL_SIZE alignment, XGL_UINT len, |
| 123 | uint32_t **dw) |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 124 | { |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 125 | const enum intel_cmd_writer_type which = INTEL_CMD_WRITER_STATE; |
| 126 | const XGL_SIZE size = len << 2; |
| 127 | const XGL_SIZE offset = cmd_writer_reserve(cmd, which, alignment, size); |
| 128 | struct intel_cmd_writer *writer = &cmd->writers[which]; |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 129 | |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 130 | /* all states are at least aligned to 32-bytes */ |
| 131 | assert(alignment % 32 == 0); |
| 132 | |
| 133 | *dw = (uint32_t *) ((char *) writer->ptr + offset); |
| 134 | |
| 135 | writer->used = offset + size; |
| 136 | |
| 137 | return offset; |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | /** |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 141 | * Write a dynamic state to the state buffer. |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 142 | */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 143 | static inline uint32_t cmd_state_write(struct intel_cmd *cmd, |
| 144 | XGL_SIZE alignment, XGL_UINT len, |
| 145 | const uint32_t *dw) |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 146 | { |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 147 | uint32_t offset, *dst; |
| 148 | |
| 149 | offset = cmd_state_pointer(cmd, alignment, len, &dst); |
| 150 | memcpy(dst, dw, len << 2); |
| 151 | |
| 152 | return offset; |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | /** |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 156 | * Write a surface state to the surface buffer. The offset, in bytes, of the |
| 157 | * state is returned. |
| 158 | * |
| 159 | * Note that \p alignment is in bytes and \p len is in DWords. |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 160 | */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 161 | static inline uint32_t cmd_surface_write(struct intel_cmd *cmd, |
| 162 | XGL_SIZE alignment, XGL_UINT len, |
| 163 | const uint32_t *dw) |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 164 | { |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 165 | return cmd_state_write(cmd, alignment, len, dw); |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | /** |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 169 | * Add a relocation entry for a DWord of a surface state. |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 170 | */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 171 | static inline void cmd_surface_reloc(struct intel_cmd *cmd, |
| 172 | uint32_t offset, XGL_UINT dw_index, |
| 173 | struct intel_bo *bo, |
| 174 | uint32_t bo_offset, uint32_t reloc_flags) |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 175 | { |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 176 | const enum intel_cmd_writer_type which = INTEL_CMD_WRITER_STATE; |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 177 | |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 178 | cmd_writer_reloc(cmd, which, offset + (dw_index << 2), |
| 179 | bo, bo_offset, reloc_flags); |
Chia-I Wu | cdff059 | 2014-08-22 09:27:36 +0800 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | /** |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 183 | * Write a kernel to the instruction buffer. The offset, in bytes, of the |
| 184 | * kernel is returned. |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 185 | */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 186 | static inline uint32_t cmd_instruction_write(struct intel_cmd *cmd, |
| 187 | XGL_SIZE size, |
| 188 | const void *kernel) |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 189 | { |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 190 | const enum intel_cmd_writer_type which = INTEL_CMD_WRITER_INSTRUCTION; |
| 191 | /* |
| 192 | * From the Sandy Bridge PRM, volume 4 part 2, page 112: |
| 193 | * |
| 194 | * "Due to prefetch of the instruction stream, the EUs may attempt to |
| 195 | * access up to 8 instructions (128 bytes) beyond the end of the |
| 196 | * kernel program - possibly into the next memory page. Although |
| 197 | * these instructions will not be executed, software must account for |
| 198 | * the prefetch in order to avoid invalid page access faults." |
| 199 | */ |
| 200 | const XGL_SIZE reserved_size = size + 128; |
| 201 | /* kernels are aligned to 64 bytes */ |
| 202 | const XGL_SIZE alignment = 64; |
| 203 | const XGL_SIZE offset = cmd_writer_reserve(cmd, |
| 204 | which, alignment, reserved_size); |
| 205 | struct intel_cmd_writer *writer = &cmd->writers[which]; |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 206 | |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 207 | memcpy((char *) writer->ptr + offset, kernel, size); |
Chia-I Wu | 5e25c27 | 2014-08-21 20:19:12 +0800 | [diff] [blame] | 208 | |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 209 | writer->used = offset + size; |
| 210 | |
| 211 | return offset; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Reserve a region from the batch buffer. Both the offset, in DWords, and |
| 216 | * the pointer to the reserved region are returned. |
| 217 | * |
| 218 | * Note that \p len is in DWords. |
| 219 | */ |
| 220 | static inline XGL_UINT cmd_batch_pointer(struct intel_cmd *cmd, |
| 221 | XGL_UINT len, uint32_t **dw) |
| 222 | { |
| 223 | const enum intel_cmd_writer_type which = INTEL_CMD_WRITER_BATCH; |
| 224 | /* |
| 225 | * We know the batch bo is always aligned. Using 1 here should allow the |
| 226 | * compiler to optimize away aligning. |
| 227 | */ |
| 228 | const XGL_SIZE alignment = 1; |
| 229 | const XGL_SIZE size = len << 2; |
| 230 | const XGL_SIZE offset = cmd_writer_reserve(cmd, which, alignment, size); |
| 231 | struct intel_cmd_writer *writer = &cmd->writers[which]; |
| 232 | |
| 233 | assert(offset % 4 == 0); |
| 234 | *dw = (uint32_t *) ((char *) writer->ptr + offset); |
| 235 | |
| 236 | writer->used = offset + size; |
| 237 | |
| 238 | return offset >> 2; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Write a command to the batch buffer. |
| 243 | */ |
| 244 | static inline XGL_UINT cmd_batch_write(struct intel_cmd *cmd, |
| 245 | XGL_UINT len, const uint32_t *dw) |
| 246 | { |
| 247 | XGL_UINT pos; |
| 248 | uint32_t *dst; |
| 249 | |
| 250 | pos = cmd_batch_pointer(cmd, len, &dst); |
| 251 | memcpy(dst, dw, len << 2); |
| 252 | |
| 253 | return pos; |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * Add a relocation entry for a DWord of a command. |
| 258 | */ |
| 259 | static inline void cmd_batch_reloc(struct intel_cmd *cmd, XGL_UINT pos, |
| 260 | struct intel_bo *bo, |
| 261 | uint32_t bo_offset, uint32_t reloc_flags) |
| 262 | { |
| 263 | const enum intel_cmd_writer_type which = INTEL_CMD_WRITER_BATCH; |
| 264 | |
| 265 | cmd_writer_reloc(cmd, which, pos << 2, bo, bo_offset, reloc_flags); |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | /** |
Chia-I Wu | 48c283d | 2014-08-25 23:13:46 +0800 | [diff] [blame] | 269 | * Begin the batch buffer. |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 270 | */ |
| 271 | static inline void cmd_batch_begin(struct intel_cmd *cmd) |
| 272 | { |
Chia-I Wu | 48c283d | 2014-08-25 23:13:46 +0800 | [diff] [blame] | 273 | /* STATE_BASE_ADDRESS */ |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 274 | const uint8_t cmd_len = 10; |
Chia-I Wu | 426072d | 2014-08-26 14:31:55 +0800 | [diff] [blame] | 275 | const uint32_t dw0 = GEN6_RENDER_CMD(COMMON, STATE_BASE_ADDRESS) | |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 276 | (cmd_len - 2); |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 277 | XGL_UINT pos; |
| 278 | uint32_t *dw; |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 279 | |
| 280 | CMD_ASSERT(cmd, 6, 7.5); |
| 281 | |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 282 | pos = cmd_batch_pointer(cmd, cmd_len, &dw); |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 283 | |
| 284 | /* relocs are not added until cmd_batch_end() */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 285 | assert(!pos); |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 286 | |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 287 | dw[0] = dw0; |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 288 | /* start offsets */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 289 | dw[1] = 1; |
| 290 | dw[2] = 1; |
| 291 | dw[3] = 1; |
| 292 | dw[4] = 1; |
| 293 | dw[5] = 1; |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 294 | /* end offsets */ |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 295 | dw[6] = 1; |
| 296 | dw[7] = 1 + 0xfffff000; |
| 297 | dw[8] = 1 + 0xfffff000; |
| 298 | dw[9] = 1; |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | /** |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 302 | * End the batch buffer. |
| 303 | */ |
| 304 | static inline void cmd_batch_end(struct intel_cmd *cmd) |
| 305 | { |
Chia-I Wu | 68f319d | 2014-09-09 09:43:21 +0800 | [diff] [blame] | 306 | struct intel_cmd_writer *writer = &cmd->writers[INTEL_CMD_WRITER_BATCH]; |
| 307 | const struct intel_cmd_writer *state = |
| 308 | &cmd->writers[INTEL_CMD_WRITER_STATE]; |
| 309 | const struct intel_cmd_writer *inst = |
| 310 | &cmd->writers[INTEL_CMD_WRITER_INSTRUCTION]; |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 311 | uint32_t *dw; |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 312 | |
| 313 | cmd_reserve_reloc(cmd, 5); |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 314 | cmd_batch_reloc(cmd, 2, state->bo, 1, 0); |
| 315 | cmd_batch_reloc(cmd, 3, state->bo, 1, 0); |
| 316 | cmd_batch_reloc(cmd, 5, inst->bo, 1, 0); |
| 317 | cmd_batch_reloc(cmd, 7, state->bo, 1 + (state->size << 2), 0); |
| 318 | cmd_batch_reloc(cmd, 9, inst->bo, 1 + (inst->size << 2), 0); |
Chia-I Wu | 79dfbb3 | 2014-08-25 12:19:02 +0800 | [diff] [blame] | 319 | |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 320 | if (writer->used & 0x7) { |
| 321 | cmd_batch_pointer(cmd, 1, &dw); |
| 322 | dw[0] = GEN6_MI_CMD(MI_BATCH_BUFFER_END); |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 323 | } else { |
Chia-I Wu | 72292b7 | 2014-09-09 10:48:33 +0800 | [diff] [blame^] | 324 | cmd_batch_pointer(cmd, 2, &dw); |
| 325 | dw[0] = GEN6_MI_CMD(MI_BATCH_BUFFER_END); |
| 326 | dw[1] = GEN6_MI_CMD(MI_NOOP); |
Chia-I Wu | e24c329 | 2014-08-21 14:05:23 +0800 | [diff] [blame] | 327 | } |
Chia-I Wu | 343b137 | 2014-08-20 16:39:20 +0800 | [diff] [blame] | 328 | } |
| 329 | |
Chia-I Wu | 525c660 | 2014-08-27 10:22:34 +0800 | [diff] [blame] | 330 | void cmd_batch_flush(struct intel_cmd *cmd, uint32_t pipe_control_dw0); |
| 331 | |
Chia-I Wu | 759fa2e | 2014-08-30 18:44:47 +0800 | [diff] [blame] | 332 | void cmd_batch_depth_count(struct intel_cmd *cmd, |
| 333 | struct intel_bo *bo, |
| 334 | XGL_GPU_SIZE offset); |
| 335 | |
Chia-I Wu | e8dbd5d | 2014-08-31 13:15:58 +0800 | [diff] [blame] | 336 | void cmd_batch_timestamp(struct intel_cmd *cmd, |
| 337 | struct intel_bo *bo, |
| 338 | XGL_GPU_SIZE offset); |
| 339 | |
| 340 | void cmd_batch_immediate(struct intel_cmd *cmd, |
| 341 | struct intel_bo *bo, |
| 342 | XGL_GPU_SIZE offset, |
| 343 | uint64_t val); |
Chia-I Wu | 1cbc005 | 2014-08-25 09:50:12 +0800 | [diff] [blame] | 344 | |
Chia-I Wu | 00a23b2 | 2014-08-20 15:28:08 +0800 | [diff] [blame] | 345 | #endif /* CMD_PRIV_H */ |