diff options
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 98 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 1 |
4 files changed, 89 insertions, 15 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c index abfe67c893c7..b14583d6f387 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c | |||
| @@ -37,6 +37,7 @@ struct vmw_user_context { | |||
| 37 | struct vmw_cmdbuf_res_manager *man; | 37 | struct vmw_cmdbuf_res_manager *man; |
| 38 | struct vmw_resource *cotables[SVGA_COTABLE_DX10_MAX]; | 38 | struct vmw_resource *cotables[SVGA_COTABLE_DX10_MAX]; |
| 39 | spinlock_t cotable_lock; | 39 | spinlock_t cotable_lock; |
| 40 | struct vmw_dma_buffer *dx_query_mob; | ||
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| 42 | static void vmw_user_context_free(struct vmw_resource *res); | 43 | static void vmw_user_context_free(struct vmw_resource *res); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 401305bbb810..2553baa7b4d8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
| @@ -553,6 +553,7 @@ static int vmw_resources_reserve(struct vmw_sw_context *sw_context) | |||
| 553 | return ret; | 553 | return ret; |
| 554 | } | 554 | } |
| 555 | } | 555 | } |
| 556 | |||
| 556 | return 0; | 557 | return 0; |
| 557 | } | 558 | } |
| 558 | 559 | ||
| @@ -2484,6 +2485,63 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv, | |||
| 2484 | &sw_context->staged_cmd_res); | 2485 | &sw_context->staged_cmd_res); |
| 2485 | } | 2486 | } |
| 2486 | 2487 | ||
| 2488 | /** | ||
| 2489 | * vmw_cmd_dx_set_so_targets - Validate an | ||
| 2490 | * SVGA_3D_CMD_DX_SET_SOTARGETS command. | ||
| 2491 | * | ||
| 2492 | * @dev_priv: Pointer to a device private struct. | ||
| 2493 | * @sw_context: The software context being used for this batch. | ||
| 2494 | * @header: Pointer to the command header in the command stream. | ||
| 2495 | */ | ||
| 2496 | static int vmw_cmd_dx_set_so_targets(struct vmw_private *dev_priv, | ||
| 2497 | struct vmw_sw_context *sw_context, | ||
| 2498 | SVGA3dCmdHeader *header) | ||
| 2499 | { | ||
| 2500 | struct vmw_resource_val_node *ctx_node = sw_context->dx_ctx_node; | ||
| 2501 | struct vmw_ctx_bindinfo_so binding; | ||
| 2502 | struct vmw_resource_val_node *res_node; | ||
| 2503 | struct { | ||
| 2504 | SVGA3dCmdHeader header; | ||
| 2505 | SVGA3dCmdDXSetSOTargets body; | ||
| 2506 | SVGA3dSoTarget targets[]; | ||
| 2507 | } *cmd; | ||
| 2508 | int i, ret, num; | ||
| 2509 | |||
| 2510 | if (unlikely(ctx_node == NULL)) { | ||
| 2511 | DRM_ERROR("DX Context not set.\n"); | ||
| 2512 | return -EINVAL; | ||
| 2513 | } | ||
| 2514 | |||
| 2515 | cmd = container_of(header, typeof(*cmd), header); | ||
| 2516 | num = (cmd->header.size - sizeof(cmd->body)) / | ||
| 2517 | sizeof(SVGA3dSoTarget); | ||
| 2518 | |||
| 2519 | if (num > SVGA3D_DX_MAX_SOTARGETS) { | ||
| 2520 | DRM_ERROR("Invalid DX SO binding.\n"); | ||
| 2521 | return -EINVAL; | ||
| 2522 | } | ||
| 2523 | |||
| 2524 | for (i = 0; i < num; i++) { | ||
| 2525 | ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, | ||
| 2526 | user_surface_converter, | ||
| 2527 | &cmd->targets[i].sid, &res_node); | ||
| 2528 | if (unlikely(ret != 0)) | ||
| 2529 | return ret; | ||
| 2530 | |||
| 2531 | binding.bi.ctx = ctx_node->res; | ||
| 2532 | binding.bi.res = ((res_node) ? res_node->res : NULL); | ||
| 2533 | binding.bi.bt = vmw_ctx_binding_so, | ||
| 2534 | binding.offset = cmd->targets[i].offset; | ||
| 2535 | binding.size = cmd->targets[i].sizeInBytes; | ||
| 2536 | binding.slot = i; | ||
| 2537 | |||
| 2538 | vmw_binding_add(ctx_node->staged_bindings, &binding.bi, | ||
| 2539 | 0, binding.slot); | ||
| 2540 | } | ||
| 2541 | |||
| 2542 | return 0; | ||
| 2543 | } | ||
| 2544 | |||
| 2487 | static int vmw_cmd_dx_so_define(struct vmw_private *dev_priv, | 2545 | static int vmw_cmd_dx_so_define(struct vmw_private *dev_priv, |
| 2488 | struct vmw_sw_context *sw_context, | 2546 | struct vmw_sw_context *sw_context, |
| 2489 | SVGA3dCmdHeader *header) | 2547 | SVGA3dCmdHeader *header) |
| @@ -2971,11 +3029,17 @@ static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = { | |||
| 2971 | &vmw_cmd_dx_set_shader_res, true, false, true), | 3029 | &vmw_cmd_dx_set_shader_res, true, false, true), |
| 2972 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_SHADER, &vmw_cmd_dx_set_shader, | 3030 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_SHADER, &vmw_cmd_dx_set_shader, |
| 2973 | true, false, true), | 3031 | true, false, true), |
| 2974 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW_INSTANCED, &vmw_cmd_invalid, | 3032 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_SAMPLERS, &vmw_cmd_dx_cid_check, |
| 3033 | true, false, true), | ||
| 3034 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW, &vmw_cmd_dx_cid_check, | ||
| 3035 | true, false, true), | ||
| 3036 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW_INDEXED, &vmw_cmd_dx_cid_check, | ||
| 2975 | true, false, true), | 3037 | true, false, true), |
| 2976 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED, &vmw_cmd_invalid, | 3038 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW_INSTANCED, &vmw_cmd_dx_cid_check, |
| 2977 | true, false, true), | 3039 | true, false, true), |
| 2978 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW_AUTO, &vmw_cmd_invalid, | 3040 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED, |
| 3041 | &vmw_cmd_dx_cid_check, true, false, true), | ||
| 3042 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DRAW_AUTO, &vmw_cmd_dx_cid_check, | ||
| 2979 | true, false, true), | 3043 | true, false, true), |
| 2980 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS, | 3044 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS, |
| 2981 | &vmw_cmd_dx_set_vertex_buffers, true, false, true), | 3045 | &vmw_cmd_dx_set_vertex_buffers, true, false, true), |
| @@ -2985,11 +3049,10 @@ static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = { | |||
| 2985 | &vmw_cmd_dx_set_rendertargets, true, false, true), | 3049 | &vmw_cmd_dx_set_rendertargets, true, false, true), |
| 2986 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_BLEND_STATE, &vmw_cmd_dx_cid_check, | 3050 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_BLEND_STATE, &vmw_cmd_dx_cid_check, |
| 2987 | true, false, true), | 3051 | true, false, true), |
| 2988 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_RASTERIZER_STATE, &vmw_cmd_dx_cid_check, | ||
| 2989 | true, false, true), | ||
| 2990 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE, | 3052 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE, |
| 2991 | &vmw_cmd_dx_cid_check, | 3053 | &vmw_cmd_dx_cid_check, true, false, true), |
| 2992 | true, false, true), | 3054 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_RASTERIZER_STATE, |
| 3055 | &vmw_cmd_dx_cid_check, true, false, true), | ||
| 2993 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DEFINE_QUERY, &vmw_cmd_invalid, | 3056 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DEFINE_QUERY, &vmw_cmd_invalid, |
| 2994 | true, false, true), | 3057 | true, false, true), |
| 2995 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DESTROY_QUERY, &vmw_cmd_invalid, | 3058 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DESTROY_QUERY, &vmw_cmd_invalid, |
| @@ -3066,8 +3129,10 @@ static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = { | |||
| 3066 | &vmw_cmd_dx_so_define, true, false, true), | 3129 | &vmw_cmd_dx_so_define, true, false, true), |
| 3067 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT, | 3130 | VMW_CMD_DEF(SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT, |
| 3068 | &vmw_cmd_dx_cid_check, true, false, true), | 3131 | &vmw_cmd_dx_cid_check, true, false, true), |
| 3069 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_STREAMOUTPUT, &vmw_cmd_invalid, | 3132 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_STREAMOUTPUT, &vmw_cmd_dx_cid_check, |
| 3070 | true, false, true), | 3133 | true, false, true), |
| 3134 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_SOTARGETS, | ||
| 3135 | &vmw_cmd_dx_set_so_targets, true, false, true), | ||
| 3071 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_INPUT_LAYOUT, | 3136 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_INPUT_LAYOUT, |
| 3072 | &vmw_cmd_dx_cid_check, true, false, true), | 3137 | &vmw_cmd_dx_cid_check, true, false, true), |
| 3073 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_TOPOLOGY, | 3138 | VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_TOPOLOGY, |
| @@ -3621,14 +3686,14 @@ int vmw_execbuf_process(struct drm_file *file_priv, | |||
| 3621 | uint32_t handle; | 3686 | uint32_t handle; |
| 3622 | int ret; | 3687 | int ret; |
| 3623 | 3688 | ||
| 3624 | if (throttle_us) { | 3689 | if (throttle_us) { |
| 3625 | ret = vmw_wait_lag(dev_priv, &dev_priv->fifo.marker_queue, | 3690 | ret = vmw_wait_lag(dev_priv, &dev_priv->fifo.marker_queue, |
| 3626 | throttle_us); | 3691 | throttle_us); |
| 3627 | 3692 | ||
| 3628 | if (ret) | 3693 | if (ret) |
| 3629 | return ret; | 3694 | return ret; |
| 3630 | } | 3695 | } |
| 3631 | 3696 | ||
| 3632 | kernel_commands = vmw_execbuf_cmdbuf(dev_priv, user_commands, | 3697 | kernel_commands = vmw_execbuf_cmdbuf(dev_priv, user_commands, |
| 3633 | kernel_commands, command_size, | 3698 | kernel_commands, command_size, |
| 3634 | &header); | 3699 | &header); |
| @@ -3692,11 +3757,18 @@ int vmw_execbuf_process(struct drm_file *file_priv, | |||
| 3692 | 3757 | ||
| 3693 | ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, | 3758 | ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, |
| 3694 | command_size); | 3759 | command_size); |
| 3695 | if (unlikely(ret != 0)) | ||
| 3696 | goto out_err_nores; | ||
| 3697 | 3760 | ||
| 3761 | /* | ||
| 3762 | * Merge the resource lists before checking the return status | ||
| 3763 | * from vmd_cmd_check_all so that all the open hashtabs will | ||
| 3764 | * be handled properly even if vmw_cmd_check_all fails. | ||
| 3765 | */ | ||
| 3698 | list_splice_init(&sw_context->ctx_resource_list, | 3766 | list_splice_init(&sw_context->ctx_resource_list, |
| 3699 | &sw_context->resource_list); | 3767 | &sw_context->resource_list); |
| 3768 | |||
| 3769 | if (unlikely(ret != 0)) | ||
| 3770 | goto out_err_nores; | ||
| 3771 | |||
| 3700 | ret = vmw_resources_reserve(sw_context); | 3772 | ret = vmw_resources_reserve(sw_context); |
| 3701 | if (unlikely(ret != 0)) | 3773 | if (unlikely(ret != 0)) |
| 3702 | goto out_err_nores; | 3774 | goto out_err_nores; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index dca7f7f41aab..893359c8d522 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |||
| @@ -196,8 +196,8 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data, | |||
| 196 | uint32_t *bounce32 = (uint32_t *) bounce; | 196 | uint32_t *bounce32 = (uint32_t *) bounce; |
| 197 | 197 | ||
| 198 | num = size / sizeof(uint32_t); | 198 | num = size / sizeof(uint32_t); |
| 199 | if (num > SVGA3D_DEVCAP_DX) | 199 | if (num > SVGA3D_DEVCAP_MAX) |
| 200 | num = SVGA3D_DEVCAP_DX; | 200 | num = SVGA3D_DEVCAP_MAX; |
| 201 | 201 | ||
| 202 | spin_lock(&dev_priv->cap_lock); | 202 | spin_lock(&dev_priv->cap_lock); |
| 203 | for (i = 0; i < num; ++i) { | 203 | for (i = 0; i < num; ++i) { |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 12ade0cf98d0..ca496a6eb59f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | |||
| @@ -1533,6 +1533,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, | |||
| 1533 | srf->offsets = NULL; | 1533 | srf->offsets = NULL; |
| 1534 | srf->base_size = size; | 1534 | srf->base_size = size; |
| 1535 | srf->autogen_filter = SVGA3D_TEX_FILTER_NONE; | 1535 | srf->autogen_filter = SVGA3D_TEX_FILTER_NONE; |
| 1536 | srf->array_size = array_size; | ||
| 1536 | srf->multisample_count = multisample_count; | 1537 | srf->multisample_count = multisample_count; |
| 1537 | 1538 | ||
| 1538 | if (array_size) | 1539 | if (array_size) |
