diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2021-10-27 13:06:07 +0300 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2021-11-10 17:22:15 +0000 |
commit | 46c37c8600e0a48b8aa98f5635f7ae96db555fea (patch) | |
tree | 6d1ea7c059a4623cde467d87cea7685139bf08e9 /src/intel/vulkan/genX_pipeline.c | |
parent | e0de7aa4d7717bbd79bbc5bfc660f941f680402b (diff) |
anv: don't forget to add scratch buffer to BO list
We reference the scratch BO using a bindless index in the command
streamer instructions, but we forgot to add them to the BO list.
v2: Make use of pipeline reloc list (Jason)
v3: Don't add NULL BOs to the reloc list (Lionel)
v4: Don't add BOs twice to reloc list when dealing with addresses
(Lionel)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: eeeea5cb873b40 ("anv: Add support for scratch on XeHP")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13544>
Diffstat (limited to 'src/intel/vulkan/genX_pipeline.c')
-rw-r--r-- | src/intel/vulkan/genX_pipeline.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 765eaf4e8e6..b63d4cc75f1 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -1743,8 +1743,18 @@ get_scratch_space(const struct anv_shader_bin *bin) static UNUSED uint32_t get_scratch_surf(struct anv_pipeline *pipeline, + gl_shader_stage stage, const struct anv_shader_bin *bin) { + if (bin->prog_data->total_scratch == 0) + return 0; + + struct anv_bo *bo = + anv_scratch_pool_alloc(pipeline->device, + &pipeline->device->scratch_pool, + stage, bin->prog_data->total_scratch); + anv_reloc_list_add_bo(pipeline->batch.relocs, + pipeline->batch.alloc, bo); return anv_scratch_pool_get_surf(pipeline->device, &pipeline->device->scratch_pool, bin->prog_data->total_scratch) >> 4; @@ -1821,7 +1831,8 @@ emit_3dstate_vs(struct anv_graphics_pipeline *pipeline) #endif #if GFX_VERx10 >= 125 - vs.ScratchSpaceBuffer = get_scratch_surf(&pipeline->base, vs_bin); + vs.ScratchSpaceBuffer = + get_scratch_surf(&pipeline->base, MESA_SHADER_VERTEX, vs_bin); #else vs.PerThreadScratchSpace = get_scratch_space(vs_bin); vs.ScratchSpaceBasePointer = @@ -1882,7 +1893,8 @@ emit_3dstate_hs_te_ds(struct anv_graphics_pipeline *pipeline, #endif #if GFX_VERx10 >= 125 - hs.ScratchSpaceBuffer = get_scratch_surf(&pipeline->base, tcs_bin); + hs.ScratchSpaceBuffer = + get_scratch_surf(&pipeline->base, MESA_SHADER_TESS_CTRL, tcs_bin); #else hs.PerThreadScratchSpace = get_scratch_space(tcs_bin); hs.ScratchSpaceBasePointer = @@ -1979,7 +1991,8 @@ emit_3dstate_hs_te_ds(struct anv_graphics_pipeline *pipeline, ds.PrimitiveIDNotRequired = !tes_prog_data->include_primitive_id; #endif #if GFX_VERx10 >= 125 - ds.ScratchSpaceBuffer = get_scratch_surf(&pipeline->base, tes_bin); + ds.ScratchSpaceBuffer = + get_scratch_surf(&pipeline->base, MESA_SHADER_TESS_EVAL, tes_bin); #else ds.PerThreadScratchSpace = get_scratch_space(tes_bin); ds.ScratchSpaceBasePointer = @@ -2050,7 +2063,8 @@ emit_3dstate_gs(struct anv_graphics_pipeline *pipeline) #endif #if GFX_VERx10 >= 125 - gs.ScratchSpaceBuffer = get_scratch_surf(&pipeline->base, gs_bin); + gs.ScratchSpaceBuffer = + get_scratch_surf(&pipeline->base, MESA_SHADER_GEOMETRY, gs_bin); #else gs.PerThreadScratchSpace = get_scratch_space(gs_bin); gs.ScratchSpaceBasePointer = @@ -2322,7 +2336,8 @@ emit_3dstate_ps(struct anv_graphics_pipeline *pipeline, brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, ps, 2); #if GFX_VERx10 >= 125 - ps.ScratchSpaceBuffer = get_scratch_surf(&pipeline->base, fs_bin); + ps.ScratchSpaceBuffer = + get_scratch_surf(&pipeline->base, MESA_SHADER_FRAGMENT, fs_bin); #else ps.PerThreadScratchSpace = get_scratch_space(fs_bin); ps.ScratchSpaceBasePointer = @@ -2623,7 +2638,8 @@ emit_compute_state(struct anv_compute_pipeline *pipeline, anv_batch_emit(&pipeline->base.batch, GENX(CFE_STATE), cfe) { cfe.MaximumNumberofThreads = devinfo->max_cs_threads * devinfo->subslice_total - 1; - cfe.ScratchSpaceBuffer = get_scratch_surf(&pipeline->base, cs_bin); + cfe.ScratchSpaceBuffer = + get_scratch_surf(&pipeline->base, MESA_SHADER_COMPUTE, cs_bin); } } |