Lines Matching refs:rctx
46 bool si_prepare_for_dma_blit(struct r600_common_context *rctx, in si_prepare_for_dma_blit() argument
54 if (!rctx->dma.cs) in si_prepare_for_dma_blit()
93 r600_texture_discard_cmask(rctx->screen, rdst); in si_prepare_for_dma_blit()
98 rctx->b.flush_resource(&rctx->b, &rsrc->resource.b.b); in si_prepare_for_dma_blit()
143 struct r600_common_context *rctx = (struct r600_common_context*)ctx; in r600_copy_to_staging_texture() local
154 rctx->dma_copy(ctx, dst, 0, 0, 0, 0, src, transfer->level, in r600_copy_to_staging_texture()
161 struct r600_common_context *rctx = (struct r600_common_context*)ctx; in r600_copy_from_staging_texture() local
176 rctx->dma_copy(ctx, dst, transfer->level, in r600_copy_from_staging_texture()
385 static void r600_eliminate_fast_color_clear(struct r600_common_context *rctx, in r600_eliminate_fast_color_clear() argument
388 struct si_screen *sscreen = rctx->screen; in r600_eliminate_fast_color_clear()
389 struct pipe_context *ctx = &rctx->b; in r600_eliminate_fast_color_clear()
469 bool si_texture_disable_dcc(struct r600_common_context *rctx, in si_texture_disable_dcc() argument
472 struct si_screen *sscreen = rctx->screen; in si_texture_disable_dcc()
477 if (&rctx->b == sscreen->aux_context) in si_texture_disable_dcc()
481 rctx->decompress_dcc(&rctx->b, rtex); in si_texture_disable_dcc()
482 rctx->b.flush(&rctx->b, NULL, 0); in si_texture_disable_dcc()
484 if (&rctx->b == sscreen->aux_context) in si_texture_disable_dcc()
490 static void r600_reallocate_texture_inplace(struct r600_common_context *rctx, in r600_reallocate_texture_inplace() argument
495 struct pipe_screen *screen = rctx->b.screen; in r600_reallocate_texture_inplace()
510 if (r600_choose_tiling(rctx->screen, &templ) != in r600_reallocate_texture_inplace()
528 rctx->dma_copy(&rctx->b, &new_tex->resource.b.b, i, 0, 0, 0, in r600_reallocate_texture_inplace()
534 r600_texture_discard_cmask(rctx->screen, rtex); in r600_reallocate_texture_inplace()
535 r600_texture_discard_dcc(rctx->screen, rtex); in r600_reallocate_texture_inplace()
575 p_atomic_inc(&rctx->screen->dirty_tex_counter); in r600_reallocate_texture_inplace()
680 struct r600_common_context *rctx; in r600_texture_get_handle() local
689 rctx = (struct r600_common_context*)(ctx ? ctx : sscreen->aux_context); in r600_texture_get_handle()
704 r600_reallocate_texture_inplace(rctx, rtex, in r600_texture_get_handle()
718 if (si_texture_disable_dcc(rctx, rtex)) { in r600_texture_get_handle()
728 r600_eliminate_fast_color_clear(rctx, rtex); in r600_texture_get_handle()
778 rctx->b.resource_copy_region(&rctx->b, newb, 0, 0, 0, 0, in r600_texture_get_handle()
782 si_replace_buffer_storage(&rctx->b, &res->b.b, newb); in r600_texture_get_handle()
796 rctx->b.flush(&rctx->b, NULL, 0); in r600_texture_get_handle()
1616 static void r600_texture_invalidate_storage(struct r600_common_context *rctx, in r600_texture_invalidate_storage() argument
1619 struct si_screen *sscreen = rctx->screen; in r600_texture_invalidate_storage()
1634 rctx->num_alloc_tex_transfer_bytes += rtex->size; in r600_texture_invalidate_storage()
1644 struct r600_common_context *rctx = (struct r600_common_context*)ctx; in r600_texture_transfer_map() local
1661 if (!rctx->screen->info.has_dedicated_vram && in r600_texture_transfer_map()
1666 r600_can_invalidate_texture(rctx->screen, rtex, in r600_texture_transfer_map()
1669 r600_reallocate_texture_inplace(rctx, rtex, in r600_texture_transfer_map()
1690 else if (si_rings_is_buffer_referenced(rctx, rtex->resource.buf, in r600_texture_transfer_map()
1692 !rctx->ws->buffer_wait(rtex->resource.buf, 0, in r600_texture_transfer_map()
1695 if (r600_can_invalidate_texture(rctx->screen, rtex, in r600_texture_transfer_map()
1697 r600_texture_invalidate_storage(rctx, rtex); in r600_texture_transfer_map()
1744 rctx->blit_decompress_depth(ctx, (struct r600_texture*)temp, staging_depth, in r600_texture_transfer_map()
1750 r600_texture_get_offset(rctx->screen, staging_depth, level, NULL, in r600_texture_transfer_map()
1762 rctx->blit_decompress_depth(ctx, rtex, staging_depth, in r600_texture_transfer_map()
1767 offset = r600_texture_get_offset(rctx->screen, staging_depth, in r600_texture_transfer_map()
1794 r600_texture_get_offset(rctx->screen, staging, 0, NULL, in r600_texture_transfer_map()
1806 offset = r600_texture_get_offset(rctx->screen, rtex, level, box, in r600_texture_transfer_map()
1812 if (!(map = si_buffer_map_sync_with_rings(rctx, buf, usage))) { in r600_texture_transfer_map()
1825 struct r600_common_context *rctx = (struct r600_common_context*)ctx; in r600_texture_transfer_unmap() local
1842 rctx->num_alloc_tex_transfer_bytes += rtransfer->staging->buf->size; in r600_texture_transfer_unmap()
1859 if (rctx->num_alloc_tex_transfer_bytes > rctx->screen->info.gart_size / 4) { in r600_texture_transfer_unmap()
1860 rctx->gfx.flush(rctx, PIPE_FLUSH_ASYNC, NULL); in r600_texture_transfer_unmap()
1861 rctx->num_alloc_tex_transfer_bytes = 0; in r600_texture_transfer_unmap()
1973 void vi_disable_dcc_if_incompatible_format(struct r600_common_context *rctx, in vi_disable_dcc_if_incompatible_format() argument
1981 if (!si_texture_disable_dcc(rctx, (struct r600_texture*)tex)) in vi_disable_dcc_if_incompatible_format()
1982 rctx->decompress_dcc(&rctx->b, rtex); in vi_disable_dcc_if_incompatible_format()
2124 static void vi_dcc_clean_up_context_slot(struct r600_common_context *rctx, in vi_dcc_clean_up_context_slot() argument
2129 if (rctx->dcc_stats[slot].query_active) in vi_dcc_clean_up_context_slot()
2130 vi_separate_dcc_stop_query(&rctx->b, in vi_dcc_clean_up_context_slot()
2131 rctx->dcc_stats[slot].tex); in vi_dcc_clean_up_context_slot()
2133 for (i = 0; i < ARRAY_SIZE(rctx->dcc_stats[slot].ps_stats); i++) in vi_dcc_clean_up_context_slot()
2134 if (rctx->dcc_stats[slot].ps_stats[i]) { in vi_dcc_clean_up_context_slot()
2135 rctx->b.destroy_query(&rctx->b, in vi_dcc_clean_up_context_slot()
2136 rctx->dcc_stats[slot].ps_stats[i]); in vi_dcc_clean_up_context_slot()
2137 rctx->dcc_stats[slot].ps_stats[i] = NULL; in vi_dcc_clean_up_context_slot()
2140 r600_texture_reference(&rctx->dcc_stats[slot].tex, NULL); in vi_dcc_clean_up_context_slot()
2146 static unsigned vi_get_context_dcc_stats_index(struct r600_common_context *rctx, in vi_get_context_dcc_stats_index() argument
2152 for (i = 0; i < ARRAY_SIZE(rctx->dcc_stats); i++) in vi_get_context_dcc_stats_index()
2153 if (rctx->dcc_stats[i].tex && in vi_get_context_dcc_stats_index()
2154 rctx->dcc_stats[i].tex->resource.b.b.reference.count == 1) in vi_get_context_dcc_stats_index()
2155 vi_dcc_clean_up_context_slot(rctx, i); in vi_get_context_dcc_stats_index()
2158 for (i = 0; i < ARRAY_SIZE(rctx->dcc_stats); i++) { in vi_get_context_dcc_stats_index()
2160 if (rctx->dcc_stats[i].tex == tex) { in vi_get_context_dcc_stats_index()
2161 rctx->dcc_stats[i].last_use_timestamp = os_time_get(); in vi_get_context_dcc_stats_index()
2166 if (empty_slot == -1 && !rctx->dcc_stats[i].tex) in vi_get_context_dcc_stats_index()
2175 for (i = 1; i < ARRAY_SIZE(rctx->dcc_stats); i++) in vi_get_context_dcc_stats_index()
2176 if (rctx->dcc_stats[oldest_slot].last_use_timestamp > in vi_get_context_dcc_stats_index()
2177 rctx->dcc_stats[i].last_use_timestamp) in vi_get_context_dcc_stats_index()
2181 vi_dcc_clean_up_context_slot(rctx, oldest_slot); in vi_get_context_dcc_stats_index()
2186 r600_texture_reference(&rctx->dcc_stats[empty_slot].tex, tex); in vi_get_context_dcc_stats_index()
2187 rctx->dcc_stats[empty_slot].last_use_timestamp = os_time_get(); in vi_get_context_dcc_stats_index()
2207 struct r600_common_context *rctx = (struct r600_common_context*)ctx; in vi_separate_dcc_start_query() local
2208 unsigned i = vi_get_context_dcc_stats_index(rctx, tex); in vi_separate_dcc_start_query()
2210 assert(!rctx->dcc_stats[i].query_active); in vi_separate_dcc_start_query()
2212 if (!rctx->dcc_stats[i].ps_stats[0]) in vi_separate_dcc_start_query()
2213 rctx->dcc_stats[i].ps_stats[0] = vi_create_resuming_pipestats_query(ctx); in vi_separate_dcc_start_query()
2216 ctx->begin_query(ctx, rctx->dcc_stats[i].ps_stats[0]); in vi_separate_dcc_start_query()
2217 rctx->dcc_stats[i].query_active = true; in vi_separate_dcc_start_query()
2226 struct r600_common_context *rctx = (struct r600_common_context*)ctx; in vi_separate_dcc_stop_query() local
2227 unsigned i = vi_get_context_dcc_stats_index(rctx, tex); in vi_separate_dcc_stop_query()
2229 assert(rctx->dcc_stats[i].query_active); in vi_separate_dcc_stop_query()
2230 assert(rctx->dcc_stats[i].ps_stats[0]); in vi_separate_dcc_stop_query()
2233 ctx->end_query(ctx, rctx->dcc_stats[i].ps_stats[0]); in vi_separate_dcc_stop_query()
2234 rctx->dcc_stats[i].query_active = false; in vi_separate_dcc_stop_query()
2245 void vi_separate_dcc_try_enable(struct r600_common_context *rctx, in vi_separate_dcc_try_enable() argument
2264 vi_separate_dcc_start_query(&rctx->b, tex); in vi_separate_dcc_try_enable()
2273 r600_texture_discard_cmask(rctx->screen, tex); in vi_separate_dcc_try_enable()
2283 si_aligned_buffer_create(rctx->b.screen, in vi_separate_dcc_try_enable()
2307 struct r600_common_context *rctx = (struct r600_common_context*)ctx; in vi_separate_dcc_process_and_reset_stats() local
2309 unsigned i = vi_get_context_dcc_stats_index(rctx, tex); in vi_separate_dcc_process_and_reset_stats()
2310 bool query_active = rctx->dcc_stats[i].query_active; in vi_separate_dcc_process_and_reset_stats()
2313 if (rctx->dcc_stats[i].ps_stats[2]) { in vi_separate_dcc_process_and_reset_stats()
2317 ctx->get_query_result(ctx, rctx->dcc_stats[i].ps_stats[2], in vi_separate_dcc_process_and_reset_stats()
2319 si_query_hw_reset_buffers(rctx, in vi_separate_dcc_process_and_reset_stats()
2321 rctx->dcc_stats[i].ps_stats[2]); in vi_separate_dcc_process_and_reset_stats()
2327 rctx->last_tex_ps_draw_ratio = tex->ps_draw_ratio; in vi_separate_dcc_process_and_reset_stats()
2340 tmp = rctx->dcc_stats[i].ps_stats[2]; in vi_separate_dcc_process_and_reset_stats()
2341 rctx->dcc_stats[i].ps_stats[2] = rctx->dcc_stats[i].ps_stats[1]; in vi_separate_dcc_process_and_reset_stats()
2342 rctx->dcc_stats[i].ps_stats[1] = rctx->dcc_stats[i].ps_stats[0]; in vi_separate_dcc_process_and_reset_stats()
2343 rctx->dcc_stats[i].ps_stats[0] = tmp; in vi_separate_dcc_process_and_reset_stats()
2501 void si_init_context_texture_functions(struct r600_common_context *rctx) in si_init_context_texture_functions() argument
2503 rctx->b.create_surface = r600_create_surface; in si_init_context_texture_functions()
2504 rctx->b.surface_destroy = r600_surface_destroy; in si_init_context_texture_functions()