drm/vmwgfx: Mark a surface gpu-dirty after the SVGA3dCmdDXGenMips command
[linux-2.6-microblaze.git] / drivers / gpu / drm / vmwgfx / vmwgfx_execbuf.c
index ab752b1..ca5360e 100644 (file)
@@ -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;
 }
 
 /**