pan/bi: Properly encode LEA_BUF_IMM

We were hardcoding table 61 and index 0 for IDVS based usage and this
could have been misused.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Fixes: f45654af59 ("pan/va: Add packing routines")
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33371>
(cherry picked from commit fbd5d58e36)
This commit is contained in:
Mary Guillemard 2025-01-30 11:56:15 +00:00 committed by Eric Engestrom
parent fa03018d28
commit f5e6b891fa
4 changed files with 11 additions and 5 deletions

View file

@ -164,7 +164,7 @@
"description": "pan/bi: Properly encode LEA_BUF_IMM",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "f45654af5953d86b4b82760b51a502fb25244073",
"notes": null

View file

@ -1182,7 +1182,13 @@ bi_emit_store_vary(bi_builder *b, nir_intrinsic_instr *instr)
if (index_offset != 0)
index = bi_iadd_imm_i32(b, index, index_offset);
bi_index address = bi_lea_buf_imm(b, index);
/* On Valhall, with IDVS varying are stored in a hardware-controlled
* buffer through table 61 at index 0 */
bi_index address = bi_temp(b->shader);
bi_instr *I = bi_lea_buf_imm_to(b, address, index);
I->table = va_res_fold_table_idx(61);
I->index = 0;
bi_emit_split_i32(b, a, address, 2);
bi_store(b, nr * src_bit_sz, data, a[0], a[1],

View file

@ -306,7 +306,7 @@ TEST_F(ValhallPacking, LdVarBufImmF16)
TEST_F(ValhallPacking, LeaBufImm)
{
CASE(bi_lea_buf_imm_to(b, bi_register(4), bi_discard(bi_register(59))),
0x005e840400000d7b);
0x005e84040000007b);
}
TEST_F(ValhallPacking, StoreSegment)

View file

@ -472,8 +472,8 @@ va_pack_alu(const bi_instr *I)
break;
case BI_OPCODE_LEA_BUF_IMM:
/* Buffer table index */
hex |= 0xD << 8;
hex |= ((uint64_t)I->table) << 8;
hex |= ((uint64_t)I->index) << 12;
break;
case BI_OPCODE_LEA_ATTR_IMM: