nvk/nvkmd: Do not merge bind operations across VA mappings

We were allowing a possible merge of operation across VA mappings.

This is not a valid usage and will cause a ENOSPC to be returned by the
kernel side.

This fixes Forza Horizon 6 device lost when trying to enter in-game or
benchmark mode with VK_EXT_descriptor_heap MR.

Signed-off-by: Mary Guillemard <mary@mary.zone>
Fixes: 053b7f0f30 ("nvk/nvkmd: Implement nvkmd_ctx for nouveau")
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42183>
This commit is contained in:
Mary Guillemard 2026-06-11 15:38:53 +02:00 committed by Marge Bot
parent bb32d88c6f
commit b3f7f40b13

View file

@ -379,6 +379,7 @@ nvkmd_nouveau_bind_ctx_bind(struct nvkmd_ctx *_ctx,
{
struct nvkmd_nouveau_bind_ctx *ctx = nvkmd_nouveau_bind_ctx(_ctx);
struct nvkmd_va *prev_va = NULL;
for (uint32_t i = 0; i < bind_count; i++) {
STATIC_ASSERT(NVKMD_BIND_OP_BIND == DRM_NOUVEAU_VM_BIND_OP_MAP);
STATIC_ASSERT(NVKMD_BIND_OP_UNBIND == DRM_NOUVEAU_VM_BIND_OP_UNMAP);
@ -399,8 +400,10 @@ nvkmd_nouveau_bind_ctx_bind(struct nvkmd_ctx *_ctx,
struct drm_nouveau_vm_bind_op *prev_op =
&ctx->req_ops[ctx->req.op_count - 1];
/* Try to coalesce bind ops together if we can */
if (op.op == prev_op->op &&
/* Try to coalesce bind ops together if we can (We can only merge
* operations if they are part of the same VA mapping) */
if (binds[i].va == prev_va &&
op.op == prev_op->op &&
op.flags == prev_op->flags &&
op.handle == prev_op->handle &&
op.addr == prev_op->addr + prev_op->range &&
@ -417,6 +420,7 @@ nvkmd_nouveau_bind_ctx_bind(struct nvkmd_ctx *_ctx,
}
ctx->req_ops[ctx->req.op_count++] = op;
prev_va = binds[i].va;
}
return VK_SUCCESS;