diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2021-10-27 13:06:07 +0300 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2021-11-10 21:58:07 +0000 |
commit | a4ba2774512b03f859b74dae1bb163c492a66d86 (patch) | |
tree | 155c9986fae5f53ecfeb4c784582e3ef4ae52136 | |
parent | 44b5b835931db52b3f3d8a8dcaeef2b5ece31301 (diff) | |
download | mesa-a4ba2774512b03f859b74dae1bb163c492a66d86.tar.gz |
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>
(cherry picked from commit 46c37c8600e0a48b8aa98f5635f7ae96db555fea)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/intel/vulkan/genX_pipeline.c | 28 |
2 files changed, 23 insertions, 7 deletions
diff --git a/.pick_status.json b/.pick_status.json index db4ccb7a9bb..65ae497ff06 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -22,7 +22,7 @@ "description": "anv: don't forget to add scratch buffer to BO list", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "eeeea5cb873b40418c738e25e4032fb1fd9b7ac9" }, diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 7675475e17f..60c43a69eb6 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 = @@ -1966,7 +1978,8 @@ emit_3dstate_hs_te_ds(struct anv_graphics_pipeline *pipeline, #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 = @@ -2037,7 +2050,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 = @@ -2309,7 +2323,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 = @@ -2610,7 +2625,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); } } |