aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 2ff7ba04d8c8..33533d126277 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2010,6 +2010,11 @@ static int vmw_cmd_set_shader(struct vmw_private *dev_priv,
2010 return 0; 2010 return 0;
2011 2011
2012 if (cmd->body.shid != SVGA3D_INVALID_ID) { 2012 if (cmd->body.shid != SVGA3D_INVALID_ID) {
2013 /*
2014 * This is the compat shader path - Per device guest-backed
2015 * shaders, but user-space thinks it's per context host-
2016 * backed shaders.
2017 */
2013 res = vmw_shader_lookup(vmw_context_res_man(ctx), 2018 res = vmw_shader_lookup(vmw_context_res_man(ctx),
2014 cmd->body.shid, cmd->body.type); 2019 cmd->body.shid, cmd->body.type);
2015 if (!IS_ERR(res)) { 2020 if (!IS_ERR(res)) {
@@ -2017,6 +2022,14 @@ static int vmw_cmd_set_shader(struct vmw_private *dev_priv,
2017 VMW_RES_DIRTY_NONE); 2022 VMW_RES_DIRTY_NONE);
2018 if (unlikely(ret != 0)) 2023 if (unlikely(ret != 0))
2019 return ret; 2024 return ret;
2025
2026 ret = vmw_resource_relocation_add
2027 (sw_context, res,
2028 vmw_ptr_diff(sw_context->buf_start,
2029 &cmd->body.shid),
2030 vmw_res_rel_normal);
2031 if (unlikely(ret != 0))
2032 return ret;
2020 } 2033 }
2021 } 2034 }
2022 2035
@@ -2193,7 +2206,8 @@ static int vmw_cmd_dx_set_shader(struct vmw_private *dev_priv,
2193 2206
2194 cmd = container_of(header, typeof(*cmd), header); 2207 cmd = container_of(header, typeof(*cmd), header);
2195 2208
2196 if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX) { 2209 if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX ||
2210 cmd->body.type < SVGA3D_SHADERTYPE_MIN) {
2197 VMW_DEBUG_USER("Illegal shader type %u.\n", 2211 VMW_DEBUG_USER("Illegal shader type %u.\n",
2198 (unsigned int) cmd->body.type); 2212 (unsigned int) cmd->body.type);
2199 return -EINVAL; 2213 return -EINVAL;
@@ -2414,6 +2428,10 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv,
2414 return -EINVAL; 2428 return -EINVAL;
2415 2429
2416 cmd = container_of(header, typeof(*cmd), header); 2430 cmd = container_of(header, typeof(*cmd), header);
2431 if (unlikely(cmd->sid == SVGA3D_INVALID_ID)) {
2432 VMW_DEBUG_USER("Invalid surface id.\n");
2433 return -EINVAL;
2434 }
2417 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, 2435 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
2418 VMW_RES_DIRTY_NONE, user_surface_converter, 2436 VMW_RES_DIRTY_NONE, user_surface_converter,
2419 &cmd->sid, &srf); 2437 &cmd->sid, &srf);