Skip to content

Commit

Permalink
drm/vmwgfx: Mark a surface gpu-dirty after the SVGA3dCmdDXGenMips com…
Browse files Browse the repository at this point in the history
…mand

The SVGA3dCmdDXGenMips command uses a shader-resource view to access
the underlying surface. Normally accesses using that view-type are not
dirtying the underlying surface, but that particular command is an
exception.
Mark the surface gpu-dirty after a SVGA3dCmdDXGenMips command has been
submitted.

This fixes the piglit getteximage-formats test run with
SVGA_FORCE_COHERENT=1

Fixes: a9f58c4 ("drm/vmwgfx: Be more restrictive when dirtying resources")
Signed-off-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Charmaine Lee <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Signed-off-by: Zack Rusin <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
thomashvmw authored and zackr committed May 11, 2021
1 parent 2cc8bfe commit 75156a8
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2763,12 +2763,24 @@ static int vmw_cmd_dx_genmips(struct vmw_private *dev_priv,
{
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdDXGenMips) =
container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
struct vmw_resource *view;
struct vmw_res_cache_entry *rcache;

ret = vmw_view_id_val_add(sw_context, vmw_view_sr,
cmd->body.shaderResourceViewId);
view = vmw_view_id_val_add(sw_context, vmw_view_sr,
cmd->body.shaderResourceViewId);
if (IS_ERR(view))
return PTR_ERR(view);

return PTR_ERR_OR_ZERO(ret);
/*
* Normally the shader-resource view is not gpu-dirtying, but for
* this particular command it is...
* So mark the last looked-up surface, which is the surface
* the view points to, gpu-dirty.
*/
rcache = &sw_context->res_cache[vmw_res_surface];
vmw_validation_res_set_dirty(sw_context->ctx, rcache->private,
VMW_RES_DIRTY_SET);
return 0;
}

/**
Expand Down

0 comments on commit 75156a8

Please sign in to comment.