Lines Matching refs:sw_context

148 					struct vmw_sw_context *sw_context,
151 struct vmw_sw_context *sw_context,
174 static void vmw_execbuf_bindings_commit(struct vmw_sw_context *sw_context, in vmw_execbuf_bindings_commit() argument
179 list_for_each_entry(entry, &sw_context->ctx_list, head) { in vmw_execbuf_bindings_commit()
183 if (entry->staged != sw_context->staged_bindings) in vmw_execbuf_bindings_commit()
186 sw_context->staged_bindings_inuse = false; in vmw_execbuf_bindings_commit()
190 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_bindings_commit()
198 static void vmw_bind_dx_query_mob(struct vmw_sw_context *sw_context) in vmw_bind_dx_query_mob() argument
200 if (sw_context->dx_query_mob) in vmw_bind_dx_query_mob()
201 vmw_context_bind_dx_query(sw_context->dx_query_ctx, in vmw_bind_dx_query_mob()
202 sw_context->dx_query_mob); in vmw_bind_dx_query_mob()
215 struct vmw_sw_context *sw_context, in vmw_cmd_ctx_first_setup() argument
221 ret = vmw_resource_context_res_add(dev_priv, sw_context, res); in vmw_cmd_ctx_first_setup()
225 if (!sw_context->staged_bindings) { in vmw_cmd_ctx_first_setup()
226 sw_context->staged_bindings = vmw_binding_state_alloc(dev_priv); in vmw_cmd_ctx_first_setup()
227 if (IS_ERR(sw_context->staged_bindings)) { in vmw_cmd_ctx_first_setup()
228 ret = PTR_ERR(sw_context->staged_bindings); in vmw_cmd_ctx_first_setup()
229 sw_context->staged_bindings = NULL; in vmw_cmd_ctx_first_setup()
234 if (sw_context->staged_bindings_inuse) { in vmw_cmd_ctx_first_setup()
242 node->staged = sw_context->staged_bindings; in vmw_cmd_ctx_first_setup()
243 sw_context->staged_bindings_inuse = true; in vmw_cmd_ctx_first_setup()
248 list_add_tail(&node->head, &sw_context->ctx_list); in vmw_cmd_ctx_first_setup()
310 static int vmw_execbuf_res_val_add(struct vmw_sw_context *sw_context, in vmw_execbuf_res_val_add() argument
323 rcache = &sw_context->res_cache[res_type]; in vmw_execbuf_res_val_add()
326 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_execbuf_res_val_add()
332 ret = vmw_validation_add_resource(sw_context->ctx, res, 0, dirty, in vmw_execbuf_res_val_add()
339 ret = vmw_validation_add_resource(sw_context->ctx, res, priv_size, in vmw_execbuf_res_val_add()
346 ret = vmw_cmd_ctx_first_setup(dev_priv, sw_context, res, in vmw_execbuf_res_val_add()
368 static int vmw_view_res_val_add(struct vmw_sw_context *sw_context, in vmw_view_res_val_add() argument
377 ret = vmw_execbuf_res_val_add(sw_context, vmw_view_srf(view), in vmw_view_res_val_add()
382 return vmw_execbuf_res_val_add(sw_context, view, VMW_RES_DIRTY_NONE, in vmw_view_res_val_add()
402 vmw_view_id_val_add(struct vmw_sw_context *sw_context, in vmw_view_id_val_add() argument
405 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_view_id_val_add()
412 view = vmw_view_lookup(sw_context->man, view_type, id); in vmw_view_id_val_add()
416 ret = vmw_view_res_val_add(sw_context, view); in vmw_view_id_val_add()
435 struct vmw_sw_context *sw_context, in vmw_resource_context_res_add() argument
454 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_resource_context_res_add()
468 ret = vmw_view_res_val_add(sw_context, entry->res); in vmw_resource_context_res_add()
470 ret = vmw_execbuf_res_val_add(sw_context, entry->res, in vmw_resource_context_res_add()
486 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_resource_context_res_add()
504 static int vmw_resource_relocation_add(struct vmw_sw_context *sw_context, in vmw_resource_relocation_add() argument
512 rel = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*rel)); in vmw_resource_relocation_add()
521 list_add_tail(&rel->head, &sw_context->res_relocations); in vmw_resource_relocation_add()
572 struct vmw_sw_context *sw_context, in vmw_cmd_invalid() argument
579 struct vmw_sw_context *sw_context, in vmw_cmd_ok() argument
595 static int vmw_resources_reserve(struct vmw_sw_context *sw_context) in vmw_resources_reserve() argument
599 ret = vmw_validation_res_reserve(sw_context->ctx, true); in vmw_resources_reserve()
603 if (sw_context->dx_query_mob) { in vmw_resources_reserve()
607 vmw_context_get_dx_query_mob(sw_context->dx_query_ctx); in vmw_resources_reserve()
609 expected_dx_query_mob != sw_context->dx_query_mob) { in vmw_resources_reserve()
633 struct vmw_sw_context *sw_context, in vmw_cmd_res_check() argument
640 struct vmw_res_cache_entry *rcache = &sw_context->res_cache[res_type]; in vmw_cmd_res_check()
659 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_cmd_res_check()
664 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_cmd_res_check()
669 (dev_priv, sw_context->fp->tfile, *id_loc, converter, &res); in vmw_cmd_res_check()
677 ret = vmw_execbuf_res_val_add(sw_context, res, dirty, vmw_val_add_flag_none); in vmw_cmd_res_check()
687 ret = vmw_resource_relocation_add(sw_context, res, in vmw_cmd_res_check()
688 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_res_check()
742 static int vmw_rebind_contexts(struct vmw_sw_context *sw_context) in vmw_rebind_contexts() argument
747 list_for_each_entry(val, &sw_context->ctx_list, head) { in vmw_rebind_contexts()
777 static int vmw_view_bindings_add(struct vmw_sw_context *sw_context, in vmw_view_bindings_add() argument
784 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_view_bindings_add()
795 view = vmw_view_id_val_add(sw_context, view_type, in vmw_view_bindings_add()
825 struct vmw_sw_context *sw_context, in vmw_cmd_cid_check() argument
831 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_cid_check()
851 vmw_execbuf_info_from_res(struct vmw_sw_context *sw_context, in vmw_execbuf_info_from_res() argument
855 &sw_context->res_cache[vmw_res_type(res)]; in vmw_execbuf_info_from_res()
865 struct vmw_sw_context *sw_context, in vmw_cmd_set_render_target_check() argument
881 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_render_target_check()
887 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_set_render_target_check()
897 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_render_target_check()
912 struct vmw_sw_context *sw_context, in vmw_cmd_surface_copy_check() argument
920 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
926 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
932 struct vmw_sw_context *sw_context, in vmw_cmd_buffer_copy_check() argument
939 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
945 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
951 struct vmw_sw_context *sw_context, in vmw_cmd_pred_copy_check() argument
958 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
964 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
970 struct vmw_sw_context *sw_context, in vmw_cmd_stretch_blt_check() argument
977 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
983 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
989 struct vmw_sw_context *sw_context, in vmw_cmd_blt_surf_screen_check() argument
995 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_blt_surf_screen_check()
1001 struct vmw_sw_context *sw_context, in vmw_cmd_present_check() argument
1007 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_present_check()
1026 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_prepare() argument
1029 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_prepare()
1033 sw_context->last_query_ctx = ctx_entry->res; in vmw_query_bo_switch_prepare()
1035 if (unlikely(new_query_bo != sw_context->cur_query_bo)) { in vmw_query_bo_switch_prepare()
1042 if (unlikely(sw_context->cur_query_bo != NULL)) { in vmw_query_bo_switch_prepare()
1043 sw_context->needs_post_query_barrier = true; in vmw_query_bo_switch_prepare()
1044 vmw_bo_placement_set_default_accelerated(sw_context->cur_query_bo); in vmw_query_bo_switch_prepare()
1045 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1046 sw_context->cur_query_bo); in vmw_query_bo_switch_prepare()
1050 sw_context->cur_query_bo = new_query_bo; in vmw_query_bo_switch_prepare()
1053 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1080 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_commit() argument
1086 if (sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1088 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_commit()
1101 if (dev_priv->pinned_bo != sw_context->cur_query_bo) { in vmw_query_bo_switch_commit()
1107 if (!sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1108 vmw_bo_pin_reserved(sw_context->cur_query_bo, true); in vmw_query_bo_switch_commit()
1121 BUG_ON(sw_context->last_query_ctx == NULL); in vmw_query_bo_switch_commit()
1122 dev_priv->query_cid = sw_context->last_query_ctx->id; in vmw_query_bo_switch_commit()
1125 vmw_bo_reference(sw_context->cur_query_bo); in vmw_query_bo_switch_commit()
1151 struct vmw_sw_context *sw_context, in vmw_translate_mob_ptr() argument
1160 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_mob_ptr()
1161 ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo); in vmw_translate_mob_ptr()
1167 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); in vmw_translate_mob_ptr()
1173 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_mob_ptr()
1181 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_mob_ptr()
1207 struct vmw_sw_context *sw_context, in vmw_translate_guest_ptr() argument
1216 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_guest_ptr()
1217 ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo); in vmw_translate_guest_ptr()
1224 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); in vmw_translate_guest_ptr()
1230 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_guest_ptr()
1237 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_guest_ptr()
1252 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_query() argument
1256 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_query()
1289 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_query() argument
1302 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_dx_bind_query()
1308 sw_context->dx_query_mob = vmw_bo; in vmw_cmd_dx_bind_query()
1309 sw_context->dx_query_ctx = sw_context->dx_ctx_node->ctx; in vmw_cmd_dx_bind_query()
1321 struct vmw_sw_context *sw_context, in vmw_cmd_begin_gb_query() argument
1327 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_gb_query()
1340 struct vmw_sw_context *sw_context, in vmw_cmd_begin_query() argument
1357 return vmw_cmd_begin_gb_query(dev_priv, sw_context, header); in vmw_cmd_begin_query()
1360 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_query()
1373 struct vmw_sw_context *sw_context, in vmw_cmd_end_gb_query() argument
1381 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_gb_query()
1385 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_end_gb_query()
1390 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_gb_query()
1403 struct vmw_sw_context *sw_context, in vmw_cmd_end_query() argument
1424 return vmw_cmd_end_gb_query(dev_priv, sw_context, header); in vmw_cmd_end_query()
1427 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_query()
1431 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_end_query()
1436 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_query()
1449 struct vmw_sw_context *sw_context, in vmw_cmd_wait_gb_query() argument
1457 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_gb_query()
1461 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_wait_gb_query()
1477 struct vmw_sw_context *sw_context, in vmw_cmd_wait_query() argument
1498 return vmw_cmd_wait_gb_query(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1501 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1505 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_wait_query()
1514 struct vmw_sw_context *sw_context, in vmw_cmd_dma() argument
1535 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_dma()
1553 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dma()
1562 srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res); in vmw_cmd_dma()
1564 vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->tbo, header); in vmw_cmd_dma()
1570 struct vmw_sw_context *sw_context, in vmw_cmd_draw() argument
1581 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_draw()
1594 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1611 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1622 struct vmw_sw_context *sw_context, in vmw_cmd_tex_state() argument
1636 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_tex_state()
1652 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_tex_state()
1663 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_tex_state()
1680 struct vmw_sw_context *sw_context, in vmw_cmd_check_define_gmrfb() argument
1690 return vmw_translate_guest_ptr(dev_priv, sw_context, &cmd->body.ptr, in vmw_cmd_check_define_gmrfb()
1710 struct vmw_sw_context *sw_context, in vmw_cmd_res_switch_backup() argument
1718 info = vmw_execbuf_info_from_res(sw_context, res); in vmw_cmd_res_switch_backup()
1722 ret = vmw_translate_mob_ptr(dev_priv, sw_context, buf_id, &vbo); in vmw_cmd_res_switch_backup()
1726 vmw_validation_res_switch_backup(sw_context->ctx, info, vbo, in vmw_cmd_res_switch_backup()
1748 struct vmw_sw_context *sw_context, in vmw_cmd_switch_backup() argument
1757 ret = vmw_cmd_res_check(dev_priv, sw_context, res_type, in vmw_cmd_switch_backup()
1762 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, buf_id, in vmw_cmd_switch_backup()
1774 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_surface() argument
1780 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_bind_gb_surface()
1793 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_image() argument
1799 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_image()
1812 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_surface() argument
1818 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_surface()
1831 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_image() argument
1837 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_image()
1851 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_surface() argument
1857 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_surface()
1871 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_image() argument
1877 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_image()
1891 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_surface() argument
1897 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_surface()
1910 struct vmw_sw_context *sw_context, in vmw_cmd_shader_define() argument
1920 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_define()
1932 size, &sw_context->staged_cmd_res); in vmw_cmd_shader_define()
1936 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_define()
1937 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_define()
1950 struct vmw_sw_context *sw_context, in vmw_cmd_shader_destroy() argument
1959 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_destroy()
1969 cmd->body.type, &sw_context->staged_cmd_res); in vmw_cmd_shader_destroy()
1973 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_destroy()
1974 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_destroy()
1987 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader() argument
2004 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader()
2022 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_cmd_set_shader()
2029 (sw_context, res, in vmw_cmd_set_shader()
2030 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_set_shader()
2039 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_set_shader()
2047 ctx_info = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_shader()
2068 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader_const() argument
2076 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader_const()
2096 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_shader() argument
2102 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_bind_gb_shader()
2117 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_single_constant_buffer() argument
2123 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_single_constant_buffer()
2131 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_single_constant_buffer()
2169 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_constant_buffer_offset() argument
2174 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_constant_buffer_offset()
2206 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader_res() argument
2222 return vmw_view_bindings_add(sw_context, vmw_view_sr, in vmw_cmd_dx_set_shader_res()
2237 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader() argument
2242 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_shader()
2258 res = vmw_shader_lookup(sw_context->man, cmd->body.shaderId, 0); in vmw_cmd_dx_set_shader()
2264 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_cmd_dx_set_shader()
2290 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_vertex_buffers() argument
2293 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_vertex_buffers()
2316 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_vertex_buffers()
2345 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_index_buffer() argument
2348 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_index_buffer()
2358 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_index_buffer()
2384 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_rendertargets() argument
2398 ret = vmw_view_bindings_add(sw_context, vmw_view_ds, vmw_ctx_binding_ds, in vmw_cmd_dx_set_rendertargets()
2403 return vmw_view_bindings_add(sw_context, vmw_view_rt, in vmw_cmd_dx_set_rendertargets()
2417 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_rendertarget_view() argument
2424 ret = vmw_view_id_val_add(sw_context, vmw_view_rt, in vmw_cmd_dx_clear_rendertarget_view()
2439 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_depthstencil_view() argument
2446 ret = vmw_view_id_val_add(sw_context, vmw_view_ds, in vmw_cmd_dx_clear_depthstencil_view()
2453 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_define() argument
2456 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_define()
2483 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_view_define()
2496 return vmw_view_add(sw_context->man, ctx_node->ctx, srf, view_type, in vmw_cmd_dx_view_define()
2499 &sw_context->staged_cmd_res); in vmw_cmd_dx_view_define()
2510 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_so_targets() argument
2513 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_so_targets()
2535 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_so_targets()
2556 struct vmw_sw_context *sw_context, in vmw_cmd_dx_so_define() argument
2559 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_so_define()
2594 struct vmw_sw_context *sw_context, in vmw_cmd_dx_check_subresource() argument
2615 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_check_subresource()
2621 struct vmw_sw_context *sw_context, in vmw_cmd_dx_cid_check() argument
2624 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_cid_check()
2644 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_remove() argument
2647 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_remove()
2659 ret = vmw_view_remove(sw_context->man, cmd->body.view_id, view_type, in vmw_cmd_dx_view_remove()
2660 &sw_context->staged_cmd_res, &view); in vmw_cmd_dx_view_remove()
2670 return vmw_resource_relocation_add(sw_context, view, in vmw_cmd_dx_view_remove()
2671 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_dx_view_remove()
2684 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_shader() argument
2687 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_shader()
2703 return vmw_dx_shader_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_shader()
2705 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_shader()
2716 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_shader() argument
2719 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_destroy_shader()
2727 ret = vmw_shader_remove(sw_context->man, cmd->body.shaderId, 0, in vmw_cmd_dx_destroy_shader()
2728 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_shader()
2741 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_shader() argument
2751 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_dx_bind_shader()
2759 VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_bind_shader()
2773 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_bind_shader()
2780 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_shader()
2793 struct vmw_sw_context *sw_context, in vmw_cmd_dx_genmips() argument
2801 view = vmw_view_id_val_add(sw_context, vmw_view_sr, in vmw_cmd_dx_genmips()
2812 rcache = &sw_context->res_cache[vmw_res_surface]; in vmw_cmd_dx_genmips()
2813 vmw_validation_res_set_dirty(sw_context->ctx, rcache->private, in vmw_cmd_dx_genmips()
2827 struct vmw_sw_context *sw_context, in vmw_cmd_dx_transfer_from_buffer() argument
2834 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2840 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2853 struct vmw_sw_context *sw_context, in vmw_cmd_intra_surface_copy() argument
2862 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_intra_surface_copy()
2868 struct vmw_sw_context *sw_context, in vmw_cmd_sm5() argument
2878 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_define() argument
2884 return vmw_cmd_dx_view_define(dev_priv, sw_context, header); in vmw_cmd_sm5_view_define()
2888 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_remove() argument
2894 return vmw_cmd_dx_view_remove(dev_priv, sw_context, header); in vmw_cmd_sm5_view_remove()
2898 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_uint() argument
2910 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_uint()
2917 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_float() argument
2929 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_float()
2936 struct vmw_sw_context *sw_context, in vmw_cmd_set_uav() argument
2955 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_uav()
2961 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 0, in vmw_cmd_set_uav()
2968 struct vmw_sw_context *sw_context, in vmw_cmd_set_cs_uav() argument
2987 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_cs_uav()
2993 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 1, in vmw_cmd_set_cs_uav()
3000 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_streamoutput() argument
3003 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_define_streamoutput()
3026 return vmw_dx_streamoutput_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_streamoutput()
3028 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_streamoutput()
3032 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_streamoutput() argument
3035 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_destroy_streamoutput()
3063 return vmw_dx_streamoutput_remove(sw_context->man, cmd->body.soid, in vmw_cmd_dx_destroy_streamoutput()
3064 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_streamoutput()
3068 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_streamoutput() argument
3071 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_bind_streamoutput()
3096 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_bind_streamoutput()
3103 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3109 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_streamoutput() argument
3112 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_set_streamoutput()
3146 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_set_streamoutput()
3158 vmw_binding_add(sw_context->dx_ctx_node->staged, &binding.bi, 0, in vmw_cmd_dx_set_streamoutput()
3165 struct vmw_sw_context *sw_context, in vmw_cmd_indexed_instanced_indirect() argument
3176 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_indexed_instanced_indirect()
3182 struct vmw_sw_context *sw_context, in vmw_cmd_instanced_indirect() argument
3193 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_instanced_indirect()
3199 struct vmw_sw_context *sw_context, in vmw_cmd_dispatch_indirect() argument
3210 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dispatch_indirect()
3216 struct vmw_sw_context *sw_context, in vmw_cmd_check_not_3d() argument
3247 if (unlikely(!sw_context->kernel)) { in vmw_cmd_check_not_3d()
3253 return vmw_cmd_check_define_gmrfb(dev_priv, sw_context, buf); in vmw_cmd_check_not_3d()
3665 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check() argument
3678 return vmw_cmd_check_not_3d(dev_priv, sw_context, buf, size); in vmw_cmd_check()
3695 if (unlikely(!entry->user_allow && !sw_context->kernel)) in vmw_cmd_check()
3704 ret = entry->func(dev_priv, sw_context, header); in vmw_cmd_check()
3731 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check_all() argument
3737 sw_context->buf_start = buf; in vmw_cmd_check_all()
3741 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); in vmw_cmd_check_all()
3756 static void vmw_free_relocations(struct vmw_sw_context *sw_context) in vmw_free_relocations() argument
3759 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_free_relocations()
3762 static void vmw_apply_relocations(struct vmw_sw_context *sw_context) in vmw_apply_relocations() argument
3767 list_for_each_entry(reloc, &sw_context->bo_relocations, head) { in vmw_apply_relocations()
3784 vmw_free_relocations(sw_context); in vmw_apply_relocations()
3787 static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, in vmw_resize_cmd_bounce() argument
3790 if (likely(sw_context->cmd_bounce_size >= size)) in vmw_resize_cmd_bounce()
3793 if (sw_context->cmd_bounce_size == 0) in vmw_resize_cmd_bounce()
3794 sw_context->cmd_bounce_size = VMWGFX_CMD_BOUNCE_INIT_SIZE; in vmw_resize_cmd_bounce()
3796 while (sw_context->cmd_bounce_size < size) { in vmw_resize_cmd_bounce()
3797 sw_context->cmd_bounce_size = in vmw_resize_cmd_bounce()
3798 PAGE_ALIGN(sw_context->cmd_bounce_size + in vmw_resize_cmd_bounce()
3799 (sw_context->cmd_bounce_size >> 1)); in vmw_resize_cmd_bounce()
3802 vfree(sw_context->cmd_bounce); in vmw_resize_cmd_bounce()
3803 sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); in vmw_resize_cmd_bounce()
3805 if (sw_context->cmd_bounce == NULL) { in vmw_resize_cmd_bounce()
3807 sw_context->cmd_bounce_size = 0; in vmw_resize_cmd_bounce()
3938 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_fifo() argument
3942 if (sw_context->dx_ctx_node) in vmw_execbuf_submit_fifo()
3944 sw_context->dx_ctx_node->ctx->id); in vmw_execbuf_submit_fifo()
3951 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_fifo()
3953 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3954 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3975 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_cmdbuf() argument
3977 u32 id = ((sw_context->dx_ctx_node) ? sw_context->dx_ctx_node->ctx->id : in vmw_execbuf_submit_cmdbuf()
3982 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_cmdbuf()
3983 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3984 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
4051 struct vmw_sw_context *sw_context, in vmw_execbuf_tie_context() argument
4062 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_execbuf_tie_context()
4067 (dev_priv, sw_context->fp->tfile, handle, in vmw_execbuf_tie_context()
4075 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_SET, in vmw_execbuf_tie_context()
4082 sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); in vmw_execbuf_tie_context()
4083 sw_context->man = vmw_context_res_man(res); in vmw_execbuf_tie_context()
4097 struct vmw_sw_context *sw_context = &dev_priv->ctx; in vmw_execbuf_process() local
4104 DECLARE_VAL_CONTEXT(val_ctx, sw_context, 1); in vmw_execbuf_process()
4132 sw_context->kernel = false; in vmw_execbuf_process()
4134 ret = vmw_resize_cmd_bounce(sw_context, command_size); in vmw_execbuf_process()
4138 ret = copy_from_user(sw_context->cmd_bounce, user_commands, in vmw_execbuf_process()
4146 kernel_commands = sw_context->cmd_bounce; in vmw_execbuf_process()
4148 sw_context->kernel = true; in vmw_execbuf_process()
4151 sw_context->filp = file_priv; in vmw_execbuf_process()
4152 sw_context->fp = vmw_fpriv(file_priv); in vmw_execbuf_process()
4153 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_process()
4154 sw_context->cur_query_bo = dev_priv->pinned_bo; in vmw_execbuf_process()
4155 sw_context->last_query_ctx = NULL; in vmw_execbuf_process()
4156 sw_context->needs_post_query_barrier = false; in vmw_execbuf_process()
4157 sw_context->dx_ctx_node = NULL; in vmw_execbuf_process()
4158 sw_context->dx_query_mob = NULL; in vmw_execbuf_process()
4159 sw_context->dx_query_ctx = NULL; in vmw_execbuf_process()
4160 memset(sw_context->res_cache, 0, sizeof(sw_context->res_cache)); in vmw_execbuf_process()
4161 INIT_LIST_HEAD(&sw_context->res_relocations); in vmw_execbuf_process()
4162 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_execbuf_process()
4164 if (sw_context->staged_bindings) in vmw_execbuf_process()
4165 vmw_binding_state_reset(sw_context->staged_bindings); in vmw_execbuf_process()
4167 INIT_LIST_HEAD(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4168 sw_context->ctx = &val_ctx; in vmw_execbuf_process()
4169 ret = vmw_execbuf_tie_context(dev_priv, sw_context, dx_context_handle); in vmw_execbuf_process()
4173 ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, in vmw_execbuf_process()
4178 ret = vmw_resources_reserve(sw_context); in vmw_execbuf_process()
4203 ret = vmw_rebind_contexts(sw_context); in vmw_execbuf_process()
4210 command_size, sw_context); in vmw_execbuf_process()
4213 sw_context); in vmw_execbuf_process()
4220 vmw_query_bo_switch_commit(dev_priv, sw_context); in vmw_execbuf_process()
4231 vmw_execbuf_bindings_commit(sw_context, false); in vmw_execbuf_process()
4232 vmw_bind_dx_query_mob(sw_context); in vmw_execbuf_process()
4235 vmw_validation_bo_fence(sw_context->ctx, fence); in vmw_execbuf_process()
4280 vmw_cmdbuf_res_commit(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4296 vmw_execbuf_bindings_commit(sw_context, true); in vmw_execbuf_process()
4298 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_process()
4299 vmw_free_relocations(sw_context); in vmw_execbuf_process()
4303 vmw_cmdbuf_res_revert(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4305 WARN_ON(!list_empty(&sw_context->ctx_list)); in vmw_execbuf_process()