Lines Matching refs:sw_context

143 					struct vmw_sw_context *sw_context,
146 struct vmw_sw_context *sw_context,
169 static void vmw_execbuf_bindings_commit(struct vmw_sw_context *sw_context, in vmw_execbuf_bindings_commit() argument
174 list_for_each_entry(entry, &sw_context->ctx_list, head) { in vmw_execbuf_bindings_commit()
178 if (entry->staged != sw_context->staged_bindings) in vmw_execbuf_bindings_commit()
181 sw_context->staged_bindings_inuse = false; in vmw_execbuf_bindings_commit()
185 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_bindings_commit()
193 static void vmw_bind_dx_query_mob(struct vmw_sw_context *sw_context) in vmw_bind_dx_query_mob() argument
195 if (sw_context->dx_query_mob) in vmw_bind_dx_query_mob()
196 vmw_context_bind_dx_query(sw_context->dx_query_ctx, in vmw_bind_dx_query_mob()
197 sw_context->dx_query_mob); in vmw_bind_dx_query_mob()
209 struct vmw_sw_context *sw_context, in vmw_cmd_ctx_first_setup() argument
215 ret = vmw_resource_context_res_add(dev_priv, sw_context, res); in vmw_cmd_ctx_first_setup()
219 if (!sw_context->staged_bindings) { in vmw_cmd_ctx_first_setup()
220 sw_context->staged_bindings = vmw_binding_state_alloc(dev_priv); in vmw_cmd_ctx_first_setup()
221 if (IS_ERR(sw_context->staged_bindings)) { in vmw_cmd_ctx_first_setup()
222 ret = PTR_ERR(sw_context->staged_bindings); in vmw_cmd_ctx_first_setup()
223 sw_context->staged_bindings = NULL; in vmw_cmd_ctx_first_setup()
228 if (sw_context->staged_bindings_inuse) { in vmw_cmd_ctx_first_setup()
236 node->staged = sw_context->staged_bindings; in vmw_cmd_ctx_first_setup()
237 sw_context->staged_bindings_inuse = true; in vmw_cmd_ctx_first_setup()
242 list_add_tail(&node->head, &sw_context->ctx_list); in vmw_cmd_ctx_first_setup()
299 static int vmw_execbuf_res_noref_val_add(struct vmw_sw_context *sw_context, in vmw_execbuf_res_noref_val_add() argument
311 rcache = &sw_context->res_cache[res_type]; in vmw_execbuf_res_noref_val_add()
314 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_execbuf_res_noref_val_add()
321 ret = vmw_validation_add_resource(sw_context->ctx, res, priv_size, in vmw_execbuf_res_noref_val_add()
329 ret = vmw_cmd_ctx_first_setup(dev_priv, sw_context, res, in vmw_execbuf_res_noref_val_add()
351 static int vmw_execbuf_res_noctx_val_add(struct vmw_sw_context *sw_context, in vmw_execbuf_res_noctx_val_add() argument
360 rcache = &sw_context->res_cache[res_type]; in vmw_execbuf_res_noctx_val_add()
363 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_execbuf_res_noctx_val_add()
368 ret = vmw_validation_add_resource(sw_context->ctx, res, 0, dirty, in vmw_execbuf_res_noctx_val_add()
387 static int vmw_view_res_val_add(struct vmw_sw_context *sw_context, in vmw_view_res_val_add() argument
396 ret = vmw_execbuf_res_noctx_val_add(sw_context, vmw_view_srf(view), in vmw_view_res_val_add()
401 return vmw_execbuf_res_noctx_val_add(sw_context, view, in vmw_view_res_val_add()
421 vmw_view_id_val_add(struct vmw_sw_context *sw_context, in vmw_view_id_val_add() argument
424 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_view_id_val_add()
431 view = vmw_view_lookup(sw_context->man, view_type, id); in vmw_view_id_val_add()
435 ret = vmw_view_res_val_add(sw_context, view); in vmw_view_id_val_add()
454 struct vmw_sw_context *sw_context, in vmw_resource_context_res_add() argument
470 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_resource_context_res_add()
483 ret = vmw_view_res_val_add(sw_context, entry->res); in vmw_resource_context_res_add()
486 (sw_context, entry->res, in vmw_resource_context_res_add()
497 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_resource_context_res_add()
514 static int vmw_resource_relocation_add(struct vmw_sw_context *sw_context, in vmw_resource_relocation_add() argument
522 rel = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*rel)); in vmw_resource_relocation_add()
531 list_add_tail(&rel->head, &sw_context->res_relocations); in vmw_resource_relocation_add()
582 struct vmw_sw_context *sw_context, in vmw_cmd_invalid() argument
589 struct vmw_sw_context *sw_context, in vmw_cmd_ok() argument
605 static int vmw_resources_reserve(struct vmw_sw_context *sw_context) in vmw_resources_reserve() argument
609 ret = vmw_validation_res_reserve(sw_context->ctx, true); in vmw_resources_reserve()
613 if (sw_context->dx_query_mob) { in vmw_resources_reserve()
617 vmw_context_get_dx_query_mob(sw_context->dx_query_ctx); in vmw_resources_reserve()
619 expected_dx_query_mob != sw_context->dx_query_mob) { in vmw_resources_reserve()
643 struct vmw_sw_context *sw_context, in vmw_cmd_res_check() argument
650 struct vmw_res_cache_entry *rcache = &sw_context->res_cache[res_type]; in vmw_cmd_res_check()
668 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_cmd_res_check()
673 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_cmd_res_check()
678 (dev_priv, sw_context->fp->tfile, *id_loc, converter); in vmw_cmd_res_check()
685 ret = vmw_execbuf_res_noref_val_add(sw_context, res, dirty); in vmw_cmd_res_check()
695 ret = vmw_resource_relocation_add(sw_context, res, in vmw_cmd_res_check()
696 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_res_check()
746 static int vmw_rebind_contexts(struct vmw_sw_context *sw_context) in vmw_rebind_contexts() argument
751 list_for_each_entry(val, &sw_context->ctx_list, head) { in vmw_rebind_contexts()
781 static int vmw_view_bindings_add(struct vmw_sw_context *sw_context, in vmw_view_bindings_add() argument
788 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_view_bindings_add()
799 view = vmw_view_id_val_add(sw_context, view_type, in vmw_view_bindings_add()
829 struct vmw_sw_context *sw_context, in vmw_cmd_cid_check() argument
835 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_cid_check()
855 vmw_execbuf_info_from_res(struct vmw_sw_context *sw_context, in vmw_execbuf_info_from_res() argument
859 &sw_context->res_cache[vmw_res_type(res)]; in vmw_execbuf_info_from_res()
869 struct vmw_sw_context *sw_context, in vmw_cmd_set_render_target_check() argument
885 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_render_target_check()
891 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_set_render_target_check()
901 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_render_target_check()
916 struct vmw_sw_context *sw_context, in vmw_cmd_surface_copy_check() argument
924 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
930 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
936 struct vmw_sw_context *sw_context, in vmw_cmd_buffer_copy_check() argument
943 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
949 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
955 struct vmw_sw_context *sw_context, in vmw_cmd_pred_copy_check() argument
962 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
968 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
974 struct vmw_sw_context *sw_context, in vmw_cmd_stretch_blt_check() argument
981 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
987 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
993 struct vmw_sw_context *sw_context, in vmw_cmd_blt_surf_screen_check() argument
999 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_blt_surf_screen_check()
1005 struct vmw_sw_context *sw_context, in vmw_cmd_present_check() argument
1011 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_present_check()
1030 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_prepare() argument
1033 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_prepare()
1037 sw_context->last_query_ctx = ctx_entry->res; in vmw_query_bo_switch_prepare()
1039 if (unlikely(new_query_bo != sw_context->cur_query_bo)) { in vmw_query_bo_switch_prepare()
1046 if (unlikely(sw_context->cur_query_bo != NULL)) { in vmw_query_bo_switch_prepare()
1047 sw_context->needs_post_query_barrier = true; in vmw_query_bo_switch_prepare()
1048 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1049 sw_context->cur_query_bo, in vmw_query_bo_switch_prepare()
1054 sw_context->cur_query_bo = new_query_bo; in vmw_query_bo_switch_prepare()
1056 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1084 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_commit() argument
1090 if (sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1092 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_commit()
1105 if (dev_priv->pinned_bo != sw_context->cur_query_bo) { in vmw_query_bo_switch_commit()
1111 if (!sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1112 vmw_bo_pin_reserved(sw_context->cur_query_bo, true); in vmw_query_bo_switch_commit()
1125 BUG_ON(sw_context->last_query_ctx == NULL); in vmw_query_bo_switch_commit()
1126 dev_priv->query_cid = sw_context->last_query_ctx->id; in vmw_query_bo_switch_commit()
1129 vmw_bo_reference(sw_context->cur_query_bo); in vmw_query_bo_switch_commit()
1155 struct vmw_sw_context *sw_context, in vmw_translate_mob_ptr() argument
1164 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_mob_ptr()
1165 vmw_bo = vmw_user_bo_noref_lookup(sw_context->fp->tfile, handle); in vmw_translate_mob_ptr()
1171 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, true, false); in vmw_translate_mob_ptr()
1176 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_mob_ptr()
1184 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_mob_ptr()
1210 struct vmw_sw_context *sw_context, in vmw_translate_guest_ptr() argument
1219 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_guest_ptr()
1220 vmw_bo = vmw_user_bo_noref_lookup(sw_context->fp->tfile, handle); in vmw_translate_guest_ptr()
1226 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, false, false); in vmw_translate_guest_ptr()
1231 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_guest_ptr()
1238 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_guest_ptr()
1253 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_query() argument
1257 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_query()
1288 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_query() argument
1301 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_dx_bind_query()
1307 sw_context->dx_query_mob = vmw_bo; in vmw_cmd_dx_bind_query()
1308 sw_context->dx_query_ctx = sw_context->dx_ctx_node->ctx; in vmw_cmd_dx_bind_query()
1320 struct vmw_sw_context *sw_context, in vmw_cmd_begin_gb_query() argument
1326 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_gb_query()
1339 struct vmw_sw_context *sw_context, in vmw_cmd_begin_query() argument
1356 return vmw_cmd_begin_gb_query(dev_priv, sw_context, header); in vmw_cmd_begin_query()
1359 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_query()
1372 struct vmw_sw_context *sw_context, in vmw_cmd_end_gb_query() argument
1380 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_gb_query()
1384 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_end_gb_query()
1389 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_gb_query()
1402 struct vmw_sw_context *sw_context, in vmw_cmd_end_query() argument
1423 return vmw_cmd_end_gb_query(dev_priv, sw_context, header); in vmw_cmd_end_query()
1426 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_query()
1430 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_end_query()
1435 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_query()
1448 struct vmw_sw_context *sw_context, in vmw_cmd_wait_gb_query() argument
1456 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_gb_query()
1460 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_wait_gb_query()
1476 struct vmw_sw_context *sw_context, in vmw_cmd_wait_query() argument
1497 return vmw_cmd_wait_gb_query(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1500 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1504 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_wait_query()
1513 struct vmw_sw_context *sw_context, in vmw_cmd_dma() argument
1534 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_dma()
1552 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dma()
1561 srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res); in vmw_cmd_dma()
1563 vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->base, header); in vmw_cmd_dma()
1569 struct vmw_sw_context *sw_context, in vmw_cmd_draw() argument
1580 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_draw()
1593 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1610 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1621 struct vmw_sw_context *sw_context, in vmw_cmd_tex_state() argument
1635 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_tex_state()
1651 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_tex_state()
1662 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_tex_state()
1679 struct vmw_sw_context *sw_context, in vmw_cmd_check_define_gmrfb() argument
1689 return vmw_translate_guest_ptr(dev_priv, sw_context, &cmd->body.ptr, in vmw_cmd_check_define_gmrfb()
1709 struct vmw_sw_context *sw_context, in vmw_cmd_res_switch_backup() argument
1717 info = vmw_execbuf_info_from_res(sw_context, res); in vmw_cmd_res_switch_backup()
1721 ret = vmw_translate_mob_ptr(dev_priv, sw_context, buf_id, &vbo); in vmw_cmd_res_switch_backup()
1725 vmw_validation_res_switch_backup(sw_context->ctx, info, vbo, in vmw_cmd_res_switch_backup()
1747 struct vmw_sw_context *sw_context, in vmw_cmd_switch_backup() argument
1756 ret = vmw_cmd_res_check(dev_priv, sw_context, res_type, in vmw_cmd_switch_backup()
1761 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, buf_id, in vmw_cmd_switch_backup()
1773 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_surface() argument
1779 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_bind_gb_surface()
1792 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_image() argument
1798 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_image()
1811 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_surface() argument
1817 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_surface()
1830 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_image() argument
1836 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_image()
1850 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_surface() argument
1856 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_surface()
1870 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_image() argument
1876 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_image()
1890 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_surface() argument
1896 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_surface()
1909 struct vmw_sw_context *sw_context, in vmw_cmd_shader_define() argument
1919 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_define()
1931 size, &sw_context->staged_cmd_res); in vmw_cmd_shader_define()
1935 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_define()
1936 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_define()
1949 struct vmw_sw_context *sw_context, in vmw_cmd_shader_destroy() argument
1958 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_destroy()
1968 cmd->body.type, &sw_context->staged_cmd_res); in vmw_cmd_shader_destroy()
1972 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_destroy()
1973 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_destroy()
1986 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader() argument
2003 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader()
2021 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_set_shader()
2027 (sw_context, res, in vmw_cmd_set_shader()
2028 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_set_shader()
2037 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_set_shader()
2045 ctx_info = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_shader()
2066 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader_const() argument
2074 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader_const()
2094 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_shader() argument
2100 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_bind_gb_shader()
2115 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_single_constant_buffer() argument
2120 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_single_constant_buffer()
2128 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_single_constant_buffer()
2165 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader_res() argument
2180 return vmw_view_bindings_add(sw_context, vmw_view_sr, in vmw_cmd_dx_set_shader_res()
2195 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader() argument
2200 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_shader()
2217 res = vmw_shader_lookup(sw_context->man, cmd->body.shaderId, 0); in vmw_cmd_dx_set_shader()
2223 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_set_shader()
2248 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_vertex_buffers() argument
2251 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_vertex_buffers()
2274 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_vertex_buffers()
2303 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_index_buffer() argument
2306 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_index_buffer()
2316 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_index_buffer()
2342 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_rendertargets() argument
2356 ret = vmw_view_bindings_add(sw_context, vmw_view_ds, vmw_ctx_binding_ds, in vmw_cmd_dx_set_rendertargets()
2361 return vmw_view_bindings_add(sw_context, vmw_view_rt, in vmw_cmd_dx_set_rendertargets()
2375 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_rendertarget_view() argument
2381 return PTR_RET(vmw_view_id_val_add(sw_context, vmw_view_rt, in vmw_cmd_dx_clear_rendertarget_view()
2394 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_depthstencil_view() argument
2400 return PTR_RET(vmw_view_id_val_add(sw_context, vmw_view_ds, in vmw_cmd_dx_clear_depthstencil_view()
2405 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_define() argument
2408 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_define()
2435 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_view_define()
2446 return vmw_view_add(sw_context->man, ctx_node->ctx, srf, view_type, in vmw_cmd_dx_view_define()
2449 &sw_context->staged_cmd_res); in vmw_cmd_dx_view_define()
2460 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_so_targets() argument
2463 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_so_targets()
2485 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_so_targets()
2506 struct vmw_sw_context *sw_context, in vmw_cmd_dx_so_define() argument
2509 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_so_define()
2542 struct vmw_sw_context *sw_context, in vmw_cmd_dx_check_subresource() argument
2564 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_check_subresource()
2570 struct vmw_sw_context *sw_context, in vmw_cmd_dx_cid_check() argument
2573 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_cid_check()
2593 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_remove() argument
2596 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_remove()
2608 ret = vmw_view_remove(sw_context->man, cmd->body.view_id, view_type, in vmw_cmd_dx_view_remove()
2609 &sw_context->staged_cmd_res, &view); in vmw_cmd_dx_view_remove()
2619 return vmw_resource_relocation_add(sw_context, view, in vmw_cmd_dx_view_remove()
2620 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_dx_view_remove()
2633 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_shader() argument
2636 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_shader()
2650 return vmw_dx_shader_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_shader()
2652 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_shader()
2663 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_shader() argument
2666 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_destroy_shader()
2674 ret = vmw_shader_remove(sw_context->man, cmd->body.shaderId, 0, in vmw_cmd_dx_destroy_shader()
2675 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_shader()
2688 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_shader() argument
2698 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_dx_bind_shader()
2706 VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_bind_shader()
2720 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_bind_shader()
2727 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_shader()
2740 struct vmw_sw_context *sw_context, in vmw_cmd_dx_genmips() argument
2746 return PTR_RET(vmw_view_id_val_add(sw_context, vmw_view_sr, in vmw_cmd_dx_genmips()
2759 struct vmw_sw_context *sw_context, in vmw_cmd_dx_transfer_from_buffer() argument
2766 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2772 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2785 struct vmw_sw_context *sw_context, in vmw_cmd_intra_surface_copy() argument
2794 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_intra_surface_copy()
2800 struct vmw_sw_context *sw_context, in vmw_cmd_check_not_3d() argument
2831 if (unlikely(!sw_context->kernel)) { in vmw_cmd_check_not_3d()
2837 return vmw_cmd_check_define_gmrfb(dev_priv, sw_context, buf); in vmw_cmd_check_not_3d()
3202 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check() argument
3215 return vmw_cmd_check_not_3d(dev_priv, sw_context, buf, size); in vmw_cmd_check()
3232 if (unlikely(!entry->user_allow && !sw_context->kernel)) in vmw_cmd_check()
3241 ret = entry->func(dev_priv, sw_context, header); in vmw_cmd_check()
3268 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check_all() argument
3274 sw_context->buf_start = buf; in vmw_cmd_check_all()
3278 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); in vmw_cmd_check_all()
3293 static void vmw_free_relocations(struct vmw_sw_context *sw_context) in vmw_free_relocations() argument
3296 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_free_relocations()
3299 static void vmw_apply_relocations(struct vmw_sw_context *sw_context) in vmw_apply_relocations() argument
3304 list_for_each_entry(reloc, &sw_context->bo_relocations, head) { in vmw_apply_relocations()
3321 vmw_free_relocations(sw_context); in vmw_apply_relocations()
3324 static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, in vmw_resize_cmd_bounce() argument
3327 if (likely(sw_context->cmd_bounce_size >= size)) in vmw_resize_cmd_bounce()
3330 if (sw_context->cmd_bounce_size == 0) in vmw_resize_cmd_bounce()
3331 sw_context->cmd_bounce_size = VMWGFX_CMD_BOUNCE_INIT_SIZE; in vmw_resize_cmd_bounce()
3333 while (sw_context->cmd_bounce_size < size) { in vmw_resize_cmd_bounce()
3334 sw_context->cmd_bounce_size = in vmw_resize_cmd_bounce()
3335 PAGE_ALIGN(sw_context->cmd_bounce_size + in vmw_resize_cmd_bounce()
3336 (sw_context->cmd_bounce_size >> 1)); in vmw_resize_cmd_bounce()
3339 vfree(sw_context->cmd_bounce); in vmw_resize_cmd_bounce()
3340 sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); in vmw_resize_cmd_bounce()
3342 if (sw_context->cmd_bounce == NULL) { in vmw_resize_cmd_bounce()
3344 sw_context->cmd_bounce_size = 0; in vmw_resize_cmd_bounce()
3483 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_fifo() argument
3487 if (sw_context->dx_ctx_node) in vmw_execbuf_submit_fifo()
3489 sw_context->dx_ctx_node->ctx->id); in vmw_execbuf_submit_fifo()
3496 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_fifo()
3498 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3499 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3520 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_cmdbuf() argument
3522 u32 id = ((sw_context->dx_ctx_node) ? sw_context->dx_ctx_node->ctx->id : in vmw_execbuf_submit_cmdbuf()
3527 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_cmdbuf()
3528 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3529 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3596 struct vmw_sw_context *sw_context, in vmw_execbuf_tie_context() argument
3607 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_execbuf_tie_context()
3612 (dev_priv, sw_context->fp->tfile, handle, in vmw_execbuf_tie_context()
3620 ret = vmw_execbuf_res_noref_val_add(sw_context, res, VMW_RES_DIRTY_SET); in vmw_execbuf_tie_context()
3624 sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); in vmw_execbuf_tie_context()
3625 sw_context->man = vmw_context_res_man(res); in vmw_execbuf_tie_context()
3638 struct vmw_sw_context *sw_context = &dev_priv->ctx; in vmw_execbuf_process() local
3645 DECLARE_VAL_CONTEXT(val_ctx, &sw_context->res_ht, 1); in vmw_execbuf_process()
3679 sw_context->kernel = false; in vmw_execbuf_process()
3681 ret = vmw_resize_cmd_bounce(sw_context, command_size); in vmw_execbuf_process()
3685 ret = copy_from_user(sw_context->cmd_bounce, user_commands, in vmw_execbuf_process()
3693 kernel_commands = sw_context->cmd_bounce; in vmw_execbuf_process()
3695 sw_context->kernel = true; in vmw_execbuf_process()
3698 sw_context->fp = vmw_fpriv(file_priv); in vmw_execbuf_process()
3699 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_process()
3700 sw_context->cur_query_bo = dev_priv->pinned_bo; in vmw_execbuf_process()
3701 sw_context->last_query_ctx = NULL; in vmw_execbuf_process()
3702 sw_context->needs_post_query_barrier = false; in vmw_execbuf_process()
3703 sw_context->dx_ctx_node = NULL; in vmw_execbuf_process()
3704 sw_context->dx_query_mob = NULL; in vmw_execbuf_process()
3705 sw_context->dx_query_ctx = NULL; in vmw_execbuf_process()
3706 memset(sw_context->res_cache, 0, sizeof(sw_context->res_cache)); in vmw_execbuf_process()
3707 INIT_LIST_HEAD(&sw_context->res_relocations); in vmw_execbuf_process()
3708 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_execbuf_process()
3710 if (sw_context->staged_bindings) in vmw_execbuf_process()
3711 vmw_binding_state_reset(sw_context->staged_bindings); in vmw_execbuf_process()
3713 if (!sw_context->res_ht_initialized) { in vmw_execbuf_process()
3714 ret = drm_ht_create(&sw_context->res_ht, VMW_RES_HT_ORDER); in vmw_execbuf_process()
3718 sw_context->res_ht_initialized = true; in vmw_execbuf_process()
3721 INIT_LIST_HEAD(&sw_context->staged_cmd_res); in vmw_execbuf_process()
3722 sw_context->ctx = &val_ctx; in vmw_execbuf_process()
3723 ret = vmw_execbuf_tie_context(dev_priv, sw_context, dx_context_handle); in vmw_execbuf_process()
3727 ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, in vmw_execbuf_process()
3732 ret = vmw_resources_reserve(sw_context); in vmw_execbuf_process()
3757 ret = vmw_rebind_contexts(sw_context); in vmw_execbuf_process()
3764 command_size, sw_context); in vmw_execbuf_process()
3767 sw_context); in vmw_execbuf_process()
3774 vmw_query_bo_switch_commit(dev_priv, sw_context); in vmw_execbuf_process()
3785 vmw_execbuf_bindings_commit(sw_context, false); in vmw_execbuf_process()
3786 vmw_bind_dx_query_mob(sw_context); in vmw_execbuf_process()
3789 vmw_validation_bo_fence(sw_context->ctx, fence); in vmw_execbuf_process()
3827 vmw_cmdbuf_res_commit(&sw_context->staged_cmd_res); in vmw_execbuf_process()
3843 vmw_execbuf_bindings_commit(sw_context, true); in vmw_execbuf_process()
3845 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_process()
3846 vmw_free_relocations(sw_context); in vmw_execbuf_process()
3850 vmw_cmdbuf_res_revert(&sw_context->staged_cmd_res); in vmw_execbuf_process()
3852 WARN_ON(!list_empty(&sw_context->ctx_list)); in vmw_execbuf_process()