panfrost: Allocate tiler and scratchpad BOs per-batch
[mesa.git] / src / gallium / drivers / panfrost / pan_job.c
1 /*
2 * Copyright (C) 2019 Alyssa Rosenzweig
3 * Copyright (C) 2014-2017 Broadcom
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * 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 FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 */
25
26 #include <assert.h>
27
28 #include "drm-uapi/panfrost_drm.h"
29
30 #include "pan_bo.h"
31 #include "pan_context.h"
32 #include "util/hash_table.h"
33 #include "util/ralloc.h"
34 #include "util/u_format.h"
35 #include "util/u_pack_color.h"
36 #include "pan_util.h"
37 #include "pandecode/decode.h"
38
39 static struct panfrost_batch *
40 panfrost_create_batch(struct panfrost_context *ctx,
41 const struct pipe_framebuffer_state *key)
42 {
43 struct panfrost_batch *batch = rzalloc(ctx, struct panfrost_batch);
44
45 batch->ctx = ctx;
46
47 batch->bos = _mesa_set_create(batch,
48 _mesa_hash_pointer,
49 _mesa_key_pointer_equal);
50
51 batch->minx = batch->miny = ~0;
52 batch->maxx = batch->maxy = 0;
53 batch->transient_offset = 0;
54
55 util_dynarray_init(&batch->headers, batch);
56 util_dynarray_init(&batch->gpu_headers, batch);
57 util_copy_framebuffer_state(&batch->key, key);
58
59 return batch;
60 }
61
62 static void
63 panfrost_free_batch(struct panfrost_batch *batch)
64 {
65 if (!batch)
66 return;
67
68 struct panfrost_context *ctx = batch->ctx;
69
70 set_foreach(batch->bos, entry) {
71 struct panfrost_bo *bo = (struct panfrost_bo *)entry->key;
72 panfrost_bo_unreference(bo);
73 }
74
75 _mesa_hash_table_remove_key(ctx->batches, &batch->key);
76
77 if (ctx->batch == batch)
78 ctx->batch = NULL;
79
80 util_unreference_framebuffer_state(&batch->key);
81 ralloc_free(batch);
82 }
83
84 static struct panfrost_batch *
85 panfrost_get_batch(struct panfrost_context *ctx,
86 const struct pipe_framebuffer_state *key)
87 {
88 /* Lookup the job first */
89 struct hash_entry *entry = _mesa_hash_table_search(ctx->batches, key);
90
91 if (entry)
92 return entry->data;
93
94 /* Otherwise, let's create a job */
95
96 struct panfrost_batch *batch = panfrost_create_batch(ctx, key);
97
98 /* Save the created job */
99 _mesa_hash_table_insert(ctx->batches, &batch->key, batch);
100
101 return batch;
102 }
103
104 /* Get the job corresponding to the FBO we're currently rendering into */
105
106 struct panfrost_batch *
107 panfrost_get_batch_for_fbo(struct panfrost_context *ctx)
108 {
109 /* If we're wallpapering, we special case to workaround
110 * u_blitter abuse */
111
112 if (ctx->wallpaper_batch)
113 return ctx->wallpaper_batch;
114
115 /* If we already began rendering, use that */
116
117 if (ctx->batch) {
118 assert(util_framebuffer_state_equal(&ctx->batch->key,
119 &ctx->pipe_framebuffer));
120 return ctx->batch;
121 }
122
123 /* If not, look up the job */
124 struct panfrost_batch *batch = panfrost_get_batch(ctx,
125 &ctx->pipe_framebuffer);
126
127 /* Set this job as the current FBO job. Will be reset when updating the
128 * FB state and when submitting or releasing a job.
129 */
130 ctx->batch = batch;
131 return batch;
132 }
133
134 void
135 panfrost_batch_add_bo(struct panfrost_batch *batch, struct panfrost_bo *bo)
136 {
137 if (!bo)
138 return;
139
140 if (_mesa_set_search(batch->bos, bo))
141 return;
142
143 panfrost_bo_reference(bo);
144 _mesa_set_add(batch->bos, bo);
145 }
146
147 void panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
148 {
149 for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) {
150 struct panfrost_resource *rsrc = pan_resource(batch->key.cbufs[i]->texture);
151 panfrost_batch_add_bo(batch, rsrc->bo);
152 }
153
154 if (batch->key.zsbuf) {
155 struct panfrost_resource *rsrc = pan_resource(batch->key.zsbuf->texture);
156 panfrost_batch_add_bo(batch, rsrc->bo);
157 }
158 }
159
160 struct panfrost_bo *
161 panfrost_batch_create_bo(struct panfrost_batch *batch, size_t size,
162 uint32_t create_flags)
163 {
164 struct panfrost_bo *bo;
165
166 bo = panfrost_bo_create(pan_screen(batch->ctx->base.screen), size,
167 create_flags);
168 panfrost_batch_add_bo(batch, bo);
169
170 /* panfrost_batch_add_bo() has retained a reference and
171 * panfrost_bo_create() initialize the refcnt to 1, so let's
172 * unreference the BO here so it gets released when the batch is
173 * destroyed (unless it's retained by someone else in the meantime).
174 */
175 panfrost_bo_unreference(bo);
176 return bo;
177 }
178
179 /* Returns the polygon list's GPU address if available, or otherwise allocates
180 * the polygon list. It's perfectly fast to use allocate/free BO directly,
181 * since we'll hit the BO cache and this is one-per-batch anyway. */
182
183 mali_ptr
184 panfrost_batch_get_polygon_list(struct panfrost_batch *batch, unsigned size)
185 {
186 if (batch->polygon_list) {
187 assert(batch->polygon_list->size >= size);
188 } else {
189 /* Create the BO as invisible, as there's no reason to map */
190
191 batch->polygon_list = panfrost_batch_create_bo(batch, size,
192 PAN_BO_INVISIBLE);
193 }
194
195 return batch->polygon_list->gpu;
196 }
197
198 struct panfrost_bo *
199 panfrost_batch_get_scratchpad(struct panfrost_batch *batch)
200 {
201 if (batch->scratchpad)
202 return batch->scratchpad;
203
204 batch->scratchpad = panfrost_batch_create_bo(batch, 64 * 4 * 4096,
205 PAN_BO_INVISIBLE);
206 assert(batch->scratchpad);
207 return batch->scratchpad;
208 }
209
210 struct panfrost_bo *
211 panfrost_batch_get_tiler_heap(struct panfrost_batch *batch)
212 {
213 if (batch->tiler_heap)
214 return batch->tiler_heap;
215
216 batch->tiler_heap = panfrost_batch_create_bo(batch, 4096 * 4096,
217 PAN_BO_INVISIBLE |
218 PAN_BO_GROWABLE);
219 assert(batch->tiler_heap);
220 return batch->tiler_heap;
221 }
222
223 struct panfrost_bo *
224 panfrost_batch_get_tiler_dummy(struct panfrost_batch *batch)
225 {
226 if (batch->tiler_dummy)
227 return batch->tiler_dummy;
228
229 batch->tiler_dummy = panfrost_batch_create_bo(batch, 4096,
230 PAN_BO_INVISIBLE);
231 assert(batch->tiler_dummy);
232 return batch->tiler_dummy;
233 }
234
235 static void
236 panfrost_batch_draw_wallpaper(struct panfrost_batch *batch)
237 {
238 /* Nothing to reload? TODO: MRT wallpapers */
239 if (batch->key.cbufs[0] == NULL)
240 return;
241
242 /* Check if the buffer has any content on it worth preserving */
243
244 struct pipe_surface *surf = batch->key.cbufs[0];
245 struct panfrost_resource *rsrc = pan_resource(surf->texture);
246 unsigned level = surf->u.tex.level;
247
248 if (!rsrc->slices[level].initialized)
249 return;
250
251 batch->ctx->wallpaper_batch = batch;
252
253 /* Clamp the rendering area to the damage extent. The
254 * KHR_partial_update() spec states that trying to render outside of
255 * the damage region is "undefined behavior", so we should be safe.
256 */
257 unsigned damage_width = (rsrc->damage.extent.maxx - rsrc->damage.extent.minx);
258 unsigned damage_height = (rsrc->damage.extent.maxy - rsrc->damage.extent.miny);
259
260 if (damage_width && damage_height) {
261 panfrost_batch_intersection_scissor(batch,
262 rsrc->damage.extent.minx,
263 rsrc->damage.extent.miny,
264 rsrc->damage.extent.maxx,
265 rsrc->damage.extent.maxy);
266 }
267
268 /* FIXME: Looks like aligning on a tile is not enough, but
269 * aligning on twice the tile size seems to works. We don't
270 * know exactly what happens here but this deserves extra
271 * investigation to figure it out.
272 */
273 batch->minx = batch->minx & ~((MALI_TILE_LENGTH * 2) - 1);
274 batch->miny = batch->miny & ~((MALI_TILE_LENGTH * 2) - 1);
275 batch->maxx = MIN2(ALIGN_POT(batch->maxx, MALI_TILE_LENGTH * 2),
276 rsrc->base.width0);
277 batch->maxy = MIN2(ALIGN_POT(batch->maxy, MALI_TILE_LENGTH * 2),
278 rsrc->base.height0);
279
280 struct pipe_scissor_state damage;
281 struct pipe_box rects[4];
282
283 /* Clamp the damage box to the rendering area. */
284 damage.minx = MAX2(batch->minx, rsrc->damage.biggest_rect.x);
285 damage.miny = MAX2(batch->miny, rsrc->damage.biggest_rect.y);
286 damage.maxx = MIN2(batch->maxx,
287 rsrc->damage.biggest_rect.x +
288 rsrc->damage.biggest_rect.width);
289 damage.maxy = MIN2(batch->maxy,
290 rsrc->damage.biggest_rect.y +
291 rsrc->damage.biggest_rect.height);
292
293 /* One damage rectangle means we can end up with at most 4 reload
294 * regions:
295 * 1: left region, only exists if damage.x > 0
296 * 2: right region, only exists if damage.x + damage.width < fb->width
297 * 3: top region, only exists if damage.y > 0. The intersection with
298 * the left and right regions are dropped
299 * 4: bottom region, only exists if damage.y + damage.height < fb->height.
300 * The intersection with the left and right regions are dropped
301 *
302 * ____________________________
303 * | | 3 | |
304 * | |___________| |
305 * | | damage | |
306 * | 1 | rect | 2 |
307 * | |___________| |
308 * | | 4 | |
309 * |_______|___________|______|
310 */
311 u_box_2d(batch->minx, batch->miny, damage.minx - batch->minx,
312 batch->maxy - batch->miny, &rects[0]);
313 u_box_2d(damage.maxx, batch->miny, batch->maxx - damage.maxx,
314 batch->maxy - batch->miny, &rects[1]);
315 u_box_2d(damage.minx, batch->miny, damage.maxx - damage.minx,
316 damage.miny - batch->miny, &rects[2]);
317 u_box_2d(damage.minx, damage.maxy, damage.maxx - damage.minx,
318 batch->maxy - damage.maxy, &rects[3]);
319
320 for (unsigned i = 0; i < 4; i++) {
321 /* Width and height are always >= 0 even if width is declared as a
322 * signed integer: u_box_2d() helper takes unsigned args and
323 * panfrost_set_damage_region() is taking care of clamping
324 * negative values.
325 */
326 if (!rects[i].width || !rects[i].height)
327 continue;
328
329 /* Blit the wallpaper in */
330 panfrost_blit_wallpaper(batch->ctx, &rects[i]);
331 }
332 batch->ctx->wallpaper_batch = NULL;
333 }
334
335 static int
336 panfrost_batch_submit_ioctl(struct panfrost_batch *batch,
337 mali_ptr first_job_desc,
338 uint32_t reqs)
339 {
340 struct panfrost_context *ctx = batch->ctx;
341 struct pipe_context *gallium = (struct pipe_context *) ctx;
342 struct panfrost_screen *screen = pan_screen(gallium->screen);
343 struct drm_panfrost_submit submit = {0,};
344 uint32_t *bo_handles;
345 int ret;
346
347 submit.in_syncs = (u64) (uintptr_t) &ctx->out_sync;
348 submit.in_sync_count = 1;
349
350 submit.out_sync = ctx->out_sync;
351
352 submit.jc = first_job_desc;
353 submit.requirements = reqs;
354
355 bo_handles = calloc(batch->bos->entries, sizeof(*bo_handles));
356 assert(bo_handles);
357
358 set_foreach(batch->bos, entry) {
359 struct panfrost_bo *bo = (struct panfrost_bo *)entry->key;
360 assert(bo->gem_handle > 0);
361 bo_handles[submit.bo_handle_count++] = bo->gem_handle;
362 }
363
364 submit.bo_handles = (u64) (uintptr_t) bo_handles;
365 ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
366 free(bo_handles);
367 if (ret) {
368 fprintf(stderr, "Error submitting: %m\n");
369 return errno;
370 }
371
372 /* Trace the job if we're doing that */
373 if (pan_debug & PAN_DBG_TRACE) {
374 /* Wait so we can get errors reported back */
375 drmSyncobjWait(screen->fd, &ctx->out_sync, 1, INT64_MAX, 0, NULL);
376 pandecode_jc(submit.jc, FALSE);
377 }
378
379 return 0;
380 }
381
382 static int
383 panfrost_batch_submit_jobs(struct panfrost_batch *batch)
384 {
385 bool has_draws = batch->first_job.gpu;
386 int ret = 0;
387
388 if (has_draws) {
389 ret = panfrost_batch_submit_ioctl(batch, batch->first_job.gpu, 0);
390 assert(!ret);
391 }
392
393 if (batch->first_tiler.gpu || batch->clear) {
394 mali_ptr fragjob = panfrost_fragment_job(batch, has_draws);
395
396 ret = panfrost_batch_submit_ioctl(batch, fragjob, PANFROST_JD_REQ_FS);
397 assert(!ret);
398 }
399
400 return ret;
401 }
402
403 void
404 panfrost_batch_submit(struct panfrost_batch *batch)
405 {
406 assert(batch);
407
408 struct panfrost_context *ctx = batch->ctx;
409 int ret;
410
411 /* Nothing to do! */
412 if (!batch->last_job.gpu && !batch->clear)
413 goto out;
414
415 if (!batch->clear && batch->last_tiler.gpu)
416 panfrost_batch_draw_wallpaper(batch);
417
418 panfrost_scoreboard_link_batch(batch);
419
420 ret = panfrost_batch_submit_jobs(batch);
421
422 if (ret)
423 fprintf(stderr, "panfrost_batch_submit failed: %d\n", ret);
424
425 out:
426 /* If this is the bound batch, the panfrost_context parameters are
427 * relevant so submitting it invalidates those paramaters, but if it's
428 * not bound, the context parameters are for some other batch so we
429 * can't invalidate them.
430 */
431 if (ctx->batch == batch)
432 panfrost_invalidate_frame(ctx);
433
434 /* The job has been submitted, let's invalidate the current FBO job
435 * cache.
436 */
437 assert(!ctx->batch || batch == ctx->batch);
438 ctx->batch = NULL;
439
440 /* We always stall the pipeline for correct results since pipelined
441 * rendering is quite broken right now (to be fixed by the panfrost_job
442 * refactor, just take the perf hit for correctness)
443 */
444 drmSyncobjWait(pan_screen(ctx->base.screen)->fd, &ctx->out_sync, 1,
445 INT64_MAX, 0, NULL);
446 panfrost_free_batch(batch);
447 }
448
449 void
450 panfrost_batch_set_requirements(struct panfrost_batch *batch)
451 {
452 struct panfrost_context *ctx = batch->ctx;
453
454 if (ctx->rasterizer && ctx->rasterizer->base.multisample)
455 batch->requirements |= PAN_REQ_MSAA;
456
457 if (ctx->depth_stencil && ctx->depth_stencil->depth.writemask)
458 batch->requirements |= PAN_REQ_DEPTH_WRITE;
459 }
460
461 /* Helper to smear a 32-bit color across 128-bit components */
462
463 static void
464 pan_pack_color_32(uint32_t *packed, uint32_t v)
465 {
466 for (unsigned i = 0; i < 4; ++i)
467 packed[i] = v;
468 }
469
470 static void
471 pan_pack_color_64(uint32_t *packed, uint32_t lo, uint32_t hi)
472 {
473 for (unsigned i = 0; i < 4; i += 2) {
474 packed[i + 0] = lo;
475 packed[i + 1] = hi;
476 }
477 }
478
479 static void
480 pan_pack_color(uint32_t *packed, const union pipe_color_union *color, enum pipe_format format)
481 {
482 /* Alpha magicked to 1.0 if there is no alpha */
483
484 bool has_alpha = util_format_has_alpha(format);
485 float clear_alpha = has_alpha ? color->f[3] : 1.0f;
486
487 /* Packed color depends on the framebuffer format */
488
489 const struct util_format_description *desc =
490 util_format_description(format);
491
492 if (util_format_is_rgba8_variant(desc)) {
493 pan_pack_color_32(packed,
494 (float_to_ubyte(clear_alpha) << 24) |
495 (float_to_ubyte(color->f[2]) << 16) |
496 (float_to_ubyte(color->f[1]) << 8) |
497 (float_to_ubyte(color->f[0]) << 0));
498 } else if (format == PIPE_FORMAT_B5G6R5_UNORM) {
499 /* First, we convert the components to R5, G6, B5 separately */
500 unsigned r5 = CLAMP(color->f[0], 0.0, 1.0) * 31.0;
501 unsigned g6 = CLAMP(color->f[1], 0.0, 1.0) * 63.0;
502 unsigned b5 = CLAMP(color->f[2], 0.0, 1.0) * 31.0;
503
504 /* Then we pack into a sparse u32. TODO: Why these shifts? */
505 pan_pack_color_32(packed, (b5 << 25) | (g6 << 14) | (r5 << 5));
506 } else if (format == PIPE_FORMAT_B4G4R4A4_UNORM) {
507 /* We scale the components against 0xF0 (=240.0), rather than 0xFF */
508 unsigned r4 = CLAMP(color->f[0], 0.0, 1.0) * 240.0;
509 unsigned g4 = CLAMP(color->f[1], 0.0, 1.0) * 240.0;
510 unsigned b4 = CLAMP(color->f[2], 0.0, 1.0) * 240.0;
511 unsigned a4 = CLAMP(clear_alpha, 0.0, 1.0) * 240.0;
512
513 /* Pack on *byte* intervals */
514 pan_pack_color_32(packed, (a4 << 24) | (b4 << 16) | (g4 << 8) | r4);
515 } else if (format == PIPE_FORMAT_B5G5R5A1_UNORM) {
516 /* Scale as expected but shift oddly */
517 unsigned r5 = round(CLAMP(color->f[0], 0.0, 1.0)) * 31.0;
518 unsigned g5 = round(CLAMP(color->f[1], 0.0, 1.0)) * 31.0;
519 unsigned b5 = round(CLAMP(color->f[2], 0.0, 1.0)) * 31.0;
520 unsigned a1 = round(CLAMP(clear_alpha, 0.0, 1.0)) * 1.0;
521
522 pan_pack_color_32(packed, (a1 << 31) | (b5 << 25) | (g5 << 15) | (r5 << 5));
523 } else {
524 /* Try Gallium's generic default path. Doesn't work for all
525 * formats but it's a good guess. */
526
527 union util_color out;
528
529 if (util_format_is_pure_integer(format)) {
530 memcpy(out.ui, color->ui, 16);
531 } else {
532 util_pack_color(color->f, format, &out);
533 }
534
535 unsigned size = util_format_get_blocksize(format);
536
537 if (size == 1) {
538 unsigned b = out.ui[0];
539 unsigned s = b | (b << 8);
540 pan_pack_color_32(packed, s | (s << 16));
541 } else if (size == 2)
542 pan_pack_color_32(packed, out.ui[0] | (out.ui[0] << 16));
543 else if (size == 4)
544 pan_pack_color_32(packed, out.ui[0]);
545 else if (size == 8)
546 pan_pack_color_64(packed, out.ui[0], out.ui[1]);
547 else if (size == 16)
548 memcpy(packed, out.ui, 16);
549 else
550 unreachable("Unknown generic format size packing clear colour");
551 }
552 }
553
554 void
555 panfrost_batch_clear(struct panfrost_batch *batch,
556 unsigned buffers,
557 const union pipe_color_union *color,
558 double depth, unsigned stencil)
559 {
560 struct panfrost_context *ctx = batch->ctx;
561
562 if (buffers & PIPE_CLEAR_COLOR) {
563 for (unsigned i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) {
564 if (!(buffers & (PIPE_CLEAR_COLOR0 << i)))
565 continue;
566
567 enum pipe_format format = ctx->pipe_framebuffer.cbufs[i]->format;
568 pan_pack_color(batch->clear_color[i], color, format);
569 }
570 }
571
572 if (buffers & PIPE_CLEAR_DEPTH) {
573 batch->clear_depth = depth;
574 }
575
576 if (buffers & PIPE_CLEAR_STENCIL) {
577 batch->clear_stencil = stencil;
578 }
579
580 batch->clear |= buffers;
581
582 /* Clearing affects the entire framebuffer (by definition -- this is
583 * the Gallium clear callback, which clears the whole framebuffer. If
584 * the scissor test were enabled from the GL side, the state tracker
585 * would emit a quad instead and we wouldn't go down this code path) */
586
587 panfrost_batch_union_scissor(batch, 0, 0,
588 ctx->pipe_framebuffer.width,
589 ctx->pipe_framebuffer.height);
590 }
591
592 static bool
593 panfrost_batch_compare(const void *a, const void *b)
594 {
595 return util_framebuffer_state_equal(a, b);
596 }
597
598 static uint32_t
599 panfrost_batch_hash(const void *key)
600 {
601 return _mesa_hash_data(key, sizeof(struct pipe_framebuffer_state));
602 }
603
604 /* Given a new bounding rectangle (scissor), let the job cover the union of the
605 * new and old bounding rectangles */
606
607 void
608 panfrost_batch_union_scissor(struct panfrost_batch *batch,
609 unsigned minx, unsigned miny,
610 unsigned maxx, unsigned maxy)
611 {
612 batch->minx = MIN2(batch->minx, minx);
613 batch->miny = MIN2(batch->miny, miny);
614 batch->maxx = MAX2(batch->maxx, maxx);
615 batch->maxy = MAX2(batch->maxy, maxy);
616 }
617
618 void
619 panfrost_batch_intersection_scissor(struct panfrost_batch *batch,
620 unsigned minx, unsigned miny,
621 unsigned maxx, unsigned maxy)
622 {
623 batch->minx = MAX2(batch->minx, minx);
624 batch->miny = MAX2(batch->miny, miny);
625 batch->maxx = MIN2(batch->maxx, maxx);
626 batch->maxy = MIN2(batch->maxy, maxy);
627 }
628
629 /* Are we currently rendering to the screen (rather than an FBO)? */
630
631 bool
632 panfrost_batch_is_scanout(struct panfrost_batch *batch)
633 {
634 /* If there is no color buffer, it's an FBO */
635 if (batch->key.nr_cbufs != 1)
636 return false;
637
638 /* If we're too early that no framebuffer was sent, it's scanout */
639 if (!batch->key.cbufs[0])
640 return true;
641
642 return batch->key.cbufs[0]->texture->bind & PIPE_BIND_DISPLAY_TARGET ||
643 batch->key.cbufs[0]->texture->bind & PIPE_BIND_SCANOUT ||
644 batch->key.cbufs[0]->texture->bind & PIPE_BIND_SHARED;
645 }
646
647 void
648 panfrost_batch_init(struct panfrost_context *ctx)
649 {
650 ctx->batches = _mesa_hash_table_create(ctx,
651 panfrost_batch_hash,
652 panfrost_batch_compare);
653 }