• Home
  • Raw
  • Download

Lines Matching refs:sctx

33 bool si_rings_is_buffer_referenced(struct si_context *sctx, struct pb_buffer *buf,  in si_rings_is_buffer_referenced()  argument
36 if (sctx->ws->cs_is_buffer_referenced(sctx->gfx_cs, buf, usage)) { in si_rings_is_buffer_referenced()
39 if (radeon_emitted(sctx->sdma_cs, 0) && in si_rings_is_buffer_referenced()
40 sctx->ws->cs_is_buffer_referenced(sctx->sdma_cs, buf, usage)) { in si_rings_is_buffer_referenced()
46 void *si_buffer_map_sync_with_rings(struct si_context *sctx, struct si_resource *resource, in si_buffer_map_sync_with_rings() argument
55 return sctx->ws->buffer_map(resource->buf, NULL, usage); in si_buffer_map_sync_with_rings()
63 if (radeon_emitted(sctx->gfx_cs, sctx->initial_gfx_cs_size) && in si_buffer_map_sync_with_rings()
64 sctx->ws->cs_is_buffer_referenced(sctx->gfx_cs, resource->buf, rusage)) { in si_buffer_map_sync_with_rings()
66 si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); in si_buffer_map_sync_with_rings()
69 si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); in si_buffer_map_sync_with_rings()
73 if (radeon_emitted(sctx->sdma_cs, 0) && in si_buffer_map_sync_with_rings()
74 sctx->ws->cs_is_buffer_referenced(sctx->sdma_cs, resource->buf, rusage)) { in si_buffer_map_sync_with_rings()
76 si_flush_dma_cs(sctx, PIPE_FLUSH_ASYNC, NULL); in si_buffer_map_sync_with_rings()
79 si_flush_dma_cs(sctx, 0, NULL); in si_buffer_map_sync_with_rings()
84 if (busy || !sctx->ws->buffer_wait(resource->buf, 0, rusage)) { in si_buffer_map_sync_with_rings()
90 sctx->ws->cs_sync_flush(sctx->gfx_cs); in si_buffer_map_sync_with_rings()
91 if (sctx->sdma_cs) in si_buffer_map_sync_with_rings()
92 sctx->ws->cs_sync_flush(sctx->sdma_cs); in si_buffer_map_sync_with_rings()
97 return sctx->ws->buffer_map(resource->buf, NULL, usage); in si_buffer_map_sync_with_rings()
276 static bool si_invalidate_buffer(struct si_context *sctx, struct si_resource *buf) in si_invalidate_buffer() argument
293 if (si_rings_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) || in si_invalidate_buffer()
294 !sctx->ws->buffer_wait(buf->buf, 0, RADEON_USAGE_READWRITE)) { in si_invalidate_buffer()
296 si_alloc_resource(sctx->screen, buf); in si_invalidate_buffer()
297 si_rebind_buffer(sctx, &buf->b.b); in si_invalidate_buffer()
309 struct si_context *sctx = (struct si_context *)ctx; in si_replace_buffer_storage() local
326 si_rebind_buffer(sctx, dst); in si_replace_buffer_storage()
331 struct si_context *sctx = (struct si_context *)ctx; in si_invalidate_resource() local
336 (void)si_invalidate_buffer(sctx, buf); in si_invalidate_resource()
344 struct si_context *sctx = (struct si_context *)ctx; in si_buffer_get_transfer() local
350 transfer = slab_alloc(&sctx->pool_transfers_unsync); in si_buffer_get_transfer()
352 transfer = slab_alloc(&sctx->pool_transfers); in si_buffer_get_transfer()
372 struct si_context *sctx = (struct si_context *)ctx; in si_buffer_transfer_map() local
424 if (si_invalidate_buffer(sctx, buf)) { in si_buffer_transfer_map()
448 si_rings_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) || in si_buffer_transfer_map()
449 !sctx->ws->buffer_wait(buf->buf, 0, RADEON_USAGE_READWRITE)) { in si_buffer_transfer_map()
460 uploader = sctx->tc->base.stream_uploader; in si_buffer_transfer_map()
462 uploader = sctx->b.stream_uploader; in si_buffer_transfer_map()
465 sctx->screen->info.tcc_cache_line_size, &offset, in si_buffer_transfer_map()
493 si_sdma_copy_buffer(sctx, &staging->b.b, resource, box->x % SI_MAP_BUFFER_ALIGNMENT, in si_buffer_transfer_map()
496 data = si_buffer_map_sync_with_rings(sctx, staging, usage & ~PIPE_MAP_UNSYNCHRONIZED); in si_buffer_transfer_map()
509 data = si_buffer_map_sync_with_rings(sctx, buf, usage); in si_buffer_transfer_map()
521 struct si_context *sctx = (struct si_context *)ctx; in si_buffer_do_flush_region() local
536 for (int i = sctx->num_sdma_uploads - 1; i >= 0; i--) { in si_buffer_do_flush_region()
537 struct si_sdma_upload *up = &sctx->sdma_uploads[i]; in si_buffer_do_flush_region()
549 if (sctx->num_sdma_uploads == sctx->max_sdma_uploads) { in si_buffer_do_flush_region()
552 sctx->max_sdma_uploads += 4; in si_buffer_do_flush_region()
553 size = sctx->max_sdma_uploads * sizeof(sctx->sdma_uploads[0]); in si_buffer_do_flush_region()
554 sctx->sdma_uploads = realloc(sctx->sdma_uploads, size); in si_buffer_do_flush_region()
558 struct si_sdma_upload *up = &sctx->sdma_uploads[sctx->num_sdma_uploads++]; in si_buffer_do_flush_region()
569 si_copy_buffer(sctx, transfer->resource, &stransfer->staging->b.b, box->x, src_offset, in si_buffer_do_flush_region()
591 struct si_context *sctx = (struct si_context *)ctx; in si_buffer_transfer_unmap() local
607 slab_free(&sctx->pool_transfers, transfer); in si_buffer_transfer_unmap()
816 void si_init_buffer_functions(struct si_context *sctx) in si_init_buffer_functions() argument
818 sctx->b.invalidate_resource = si_invalidate_resource; in si_init_buffer_functions()
819 sctx->b.transfer_map = u_transfer_map_vtbl; in si_init_buffer_functions()
820 sctx->b.transfer_flush_region = u_transfer_flush_region_vtbl; in si_init_buffer_functions()
821 sctx->b.transfer_unmap = u_transfer_unmap_vtbl; in si_init_buffer_functions()
822 sctx->b.texture_subdata = u_default_texture_subdata; in si_init_buffer_functions()
823 sctx->b.buffer_subdata = si_buffer_subdata; in si_init_buffer_functions()
824 sctx->b.resource_commit = si_resource_commit; in si_init_buffer_functions()