intel/fs: put scratch surface in the surface state heap
In4ceaed7839
we made scratch surface state allocations part of the internal heap (mapped to STATE_BASE_ADDRESS::SurfaceStateBaseAddress) so that it doesn't uses slots in the application's expected 1M descriptors (especially with vkd3d-proton). But all our compiler code relies on BSS (STATE_BASE_ADDRESS::BindlessSurfaceStateBaseAddress). The additional issue is that there is only 26bits of surface offset available in CS instruction (CFE_STATE, 3DSTATE_VS, etc...) for scratch surfaces. So we need the drivers to put the scratch surfaces in the first chunk of STATE_BASE_ADDRESS::SurfaceStateBaseAddress (hence all the driver changes). Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes:4ceaed7839
("anv: split internal surface states from descriptors") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7687 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19727>
This commit is contained in:

committed by
Marge Bot

parent
daab161535
commit
9c1c1888d9
@@ -1718,13 +1718,20 @@ lower_lsc_surface_logical_send(const fs_builder &bld, fs_inst *inst)
|
||||
else
|
||||
inst->sfid = GFX12_SFID_UGM;
|
||||
|
||||
/* We must have exactly one of surface and surface_handle */
|
||||
assert((surface.file == BAD_FILE) != (surface_handle.file == BAD_FILE));
|
||||
/* We should have exactly one of surface and surface_handle. For scratch
|
||||
* messages generated by brw_fs_nir.cpp we also allow a special value to
|
||||
* know what heap base we should use in STATE_BASE_ADDRESS (SS = Surface
|
||||
* State Offset, or BSS = Bindless Surface State Offset).
|
||||
*/
|
||||
bool non_bindless = surface.file == IMM && surface.ud == GFX125_NON_BINDLESS;
|
||||
assert((surface.file == BAD_FILE) != (surface_handle.file == BAD_FILE) ||
|
||||
(non_bindless && surface_handle.file != BAD_FILE));
|
||||
|
||||
enum lsc_addr_surface_type surf_type;
|
||||
if (surface_handle.file != BAD_FILE)
|
||||
surf_type = LSC_ADDR_SURFTYPE_BSS;
|
||||
else if (surface.file == IMM && surface.ud == GFX7_BTI_SLM)
|
||||
if (surface_handle.file != BAD_FILE) {
|
||||
assert(surface.file == IMM && (surface.ud == 0 || surface.ud == GFX125_NON_BINDLESS));
|
||||
surf_type = non_bindless ? LSC_ADDR_SURFTYPE_SS : LSC_ADDR_SURFTYPE_BSS;
|
||||
} else if (surface.file == IMM && surface.ud == GFX7_BTI_SLM)
|
||||
surf_type = LSC_ADDR_SURFTYPE_FLAT;
|
||||
else
|
||||
surf_type = LSC_ADDR_SURFTYPE_BTI;
|
||||
@@ -1801,6 +1808,7 @@ lower_lsc_surface_logical_send(const fs_builder &bld, fs_inst *inst)
|
||||
case LSC_ADDR_SURFTYPE_FLAT:
|
||||
inst->src[1] = brw_imm_ud(0);
|
||||
break;
|
||||
case LSC_ADDR_SURFTYPE_SS:
|
||||
case LSC_ADDR_SURFTYPE_BSS:
|
||||
/* We assume that the driver provided the handle in the top 20 bits so
|
||||
* we can use the surface handle directly as the extended descriptor.
|
||||
|
Reference in New Issue
Block a user