Lines Matching refs:sw_context
147 struct vmw_sw_context *sw_context,
150 struct vmw_sw_context *sw_context,
173 static void vmw_execbuf_bindings_commit(struct vmw_sw_context *sw_context, in vmw_execbuf_bindings_commit() argument
178 list_for_each_entry(entry, &sw_context->ctx_list, head) { in vmw_execbuf_bindings_commit()
182 if (entry->staged != sw_context->staged_bindings) in vmw_execbuf_bindings_commit()
185 sw_context->staged_bindings_inuse = false; in vmw_execbuf_bindings_commit()
189 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_bindings_commit()
197 static void vmw_bind_dx_query_mob(struct vmw_sw_context *sw_context) in vmw_bind_dx_query_mob() argument
199 if (sw_context->dx_query_mob) in vmw_bind_dx_query_mob()
200 vmw_context_bind_dx_query(sw_context->dx_query_ctx, in vmw_bind_dx_query_mob()
201 sw_context->dx_query_mob); in vmw_bind_dx_query_mob()
214 struct vmw_sw_context *sw_context, in vmw_cmd_ctx_first_setup() argument
220 ret = vmw_resource_context_res_add(dev_priv, sw_context, res); in vmw_cmd_ctx_first_setup()
224 if (!sw_context->staged_bindings) { in vmw_cmd_ctx_first_setup()
225 sw_context->staged_bindings = vmw_binding_state_alloc(dev_priv); in vmw_cmd_ctx_first_setup()
226 if (IS_ERR(sw_context->staged_bindings)) { in vmw_cmd_ctx_first_setup()
227 ret = PTR_ERR(sw_context->staged_bindings); in vmw_cmd_ctx_first_setup()
228 sw_context->staged_bindings = NULL; in vmw_cmd_ctx_first_setup()
233 if (sw_context->staged_bindings_inuse) { in vmw_cmd_ctx_first_setup()
241 node->staged = sw_context->staged_bindings; in vmw_cmd_ctx_first_setup()
242 sw_context->staged_bindings_inuse = true; in vmw_cmd_ctx_first_setup()
247 list_add_tail(&node->head, &sw_context->ctx_list); in vmw_cmd_ctx_first_setup()
309 static int vmw_execbuf_res_val_add(struct vmw_sw_context *sw_context, in vmw_execbuf_res_val_add() argument
322 rcache = &sw_context->res_cache[res_type]; in vmw_execbuf_res_val_add()
325 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_execbuf_res_val_add()
331 ret = vmw_validation_add_resource(sw_context->ctx, res, 0, dirty, in vmw_execbuf_res_val_add()
338 ret = vmw_validation_add_resource(sw_context->ctx, res, priv_size, in vmw_execbuf_res_val_add()
345 ret = vmw_cmd_ctx_first_setup(dev_priv, sw_context, res, in vmw_execbuf_res_val_add()
367 static int vmw_view_res_val_add(struct vmw_sw_context *sw_context, in vmw_view_res_val_add() argument
376 ret = vmw_execbuf_res_val_add(sw_context, vmw_view_srf(view), in vmw_view_res_val_add()
381 return vmw_execbuf_res_val_add(sw_context, view, VMW_RES_DIRTY_NONE, in vmw_view_res_val_add()
401 vmw_view_id_val_add(struct vmw_sw_context *sw_context, in vmw_view_id_val_add() argument
404 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_view_id_val_add()
411 view = vmw_view_lookup(sw_context->man, view_type, id); in vmw_view_id_val_add()
415 ret = vmw_view_res_val_add(sw_context, view); in vmw_view_id_val_add()
434 struct vmw_sw_context *sw_context, in vmw_resource_context_res_add() argument
453 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_resource_context_res_add()
467 ret = vmw_view_res_val_add(sw_context, entry->res); in vmw_resource_context_res_add()
469 ret = vmw_execbuf_res_val_add(sw_context, entry->res, in vmw_resource_context_res_add()
485 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_resource_context_res_add()
503 static int vmw_resource_relocation_add(struct vmw_sw_context *sw_context, in vmw_resource_relocation_add() argument
511 rel = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*rel)); in vmw_resource_relocation_add()
520 list_add_tail(&rel->head, &sw_context->res_relocations); in vmw_resource_relocation_add()
571 struct vmw_sw_context *sw_context, in vmw_cmd_invalid() argument
578 struct vmw_sw_context *sw_context, in vmw_cmd_ok() argument
594 static int vmw_resources_reserve(struct vmw_sw_context *sw_context) in vmw_resources_reserve() argument
598 ret = vmw_validation_res_reserve(sw_context->ctx, true); in vmw_resources_reserve()
602 if (sw_context->dx_query_mob) { in vmw_resources_reserve()
606 vmw_context_get_dx_query_mob(sw_context->dx_query_ctx); in vmw_resources_reserve()
608 expected_dx_query_mob != sw_context->dx_query_mob) { in vmw_resources_reserve()
632 struct vmw_sw_context *sw_context, in vmw_cmd_res_check() argument
639 struct vmw_res_cache_entry *rcache = &sw_context->res_cache[res_type]; in vmw_cmd_res_check()
658 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_cmd_res_check()
663 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_cmd_res_check()
668 (dev_priv, sw_context->fp->tfile, *id_loc, converter, &res); in vmw_cmd_res_check()
676 ret = vmw_execbuf_res_val_add(sw_context, res, dirty, vmw_val_add_flag_none); in vmw_cmd_res_check()
686 ret = vmw_resource_relocation_add(sw_context, res, in vmw_cmd_res_check()
687 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_res_check()
741 static int vmw_rebind_contexts(struct vmw_sw_context *sw_context) in vmw_rebind_contexts() argument
746 list_for_each_entry(val, &sw_context->ctx_list, head) { in vmw_rebind_contexts()
776 static int vmw_view_bindings_add(struct vmw_sw_context *sw_context, in vmw_view_bindings_add() argument
783 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_view_bindings_add()
794 view = vmw_view_id_val_add(sw_context, view_type, in vmw_view_bindings_add()
824 struct vmw_sw_context *sw_context, in vmw_cmd_cid_check() argument
830 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_cid_check()
850 vmw_execbuf_info_from_res(struct vmw_sw_context *sw_context, in vmw_execbuf_info_from_res() argument
854 &sw_context->res_cache[vmw_res_type(res)]; in vmw_execbuf_info_from_res()
864 struct vmw_sw_context *sw_context, in vmw_cmd_set_render_target_check() argument
880 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_render_target_check()
886 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_set_render_target_check()
896 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_render_target_check()
911 struct vmw_sw_context *sw_context, in vmw_cmd_surface_copy_check() argument
919 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
925 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
931 struct vmw_sw_context *sw_context, in vmw_cmd_buffer_copy_check() argument
938 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
944 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
950 struct vmw_sw_context *sw_context, in vmw_cmd_pred_copy_check() argument
957 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
963 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
969 struct vmw_sw_context *sw_context, in vmw_cmd_stretch_blt_check() argument
976 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
982 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
988 struct vmw_sw_context *sw_context, in vmw_cmd_blt_surf_screen_check() argument
994 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_blt_surf_screen_check()
1000 struct vmw_sw_context *sw_context, in vmw_cmd_present_check() argument
1006 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_present_check()
1025 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_prepare() argument
1028 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_prepare()
1032 sw_context->last_query_ctx = ctx_entry->res; in vmw_query_bo_switch_prepare()
1034 if (unlikely(new_query_bo != sw_context->cur_query_bo)) { in vmw_query_bo_switch_prepare()
1041 if (unlikely(sw_context->cur_query_bo != NULL)) { in vmw_query_bo_switch_prepare()
1042 sw_context->needs_post_query_barrier = true; in vmw_query_bo_switch_prepare()
1043 vmw_bo_placement_set_default_accelerated(sw_context->cur_query_bo); in vmw_query_bo_switch_prepare()
1044 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1045 sw_context->cur_query_bo); in vmw_query_bo_switch_prepare()
1049 sw_context->cur_query_bo = new_query_bo; in vmw_query_bo_switch_prepare()
1052 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1079 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_commit() argument
1085 if (sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1087 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_commit()
1100 if (dev_priv->pinned_bo != sw_context->cur_query_bo) { in vmw_query_bo_switch_commit()
1106 if (!sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1107 vmw_bo_pin_reserved(sw_context->cur_query_bo, true); in vmw_query_bo_switch_commit()
1120 BUG_ON(sw_context->last_query_ctx == NULL); in vmw_query_bo_switch_commit()
1121 dev_priv->query_cid = sw_context->last_query_ctx->id; in vmw_query_bo_switch_commit()
1124 vmw_bo_reference(sw_context->cur_query_bo); in vmw_query_bo_switch_commit()
1150 struct vmw_sw_context *sw_context, in vmw_translate_mob_ptr() argument
1159 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_mob_ptr()
1160 ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo); in vmw_translate_mob_ptr()
1166 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); in vmw_translate_mob_ptr()
1172 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_mob_ptr()
1180 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_mob_ptr()
1206 struct vmw_sw_context *sw_context, in vmw_translate_guest_ptr() argument
1215 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_guest_ptr()
1216 ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo); in vmw_translate_guest_ptr()
1223 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); in vmw_translate_guest_ptr()
1229 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_guest_ptr()
1236 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_guest_ptr()
1251 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_query() argument
1255 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_query()
1286 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_query() argument
1299 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_dx_bind_query()
1305 sw_context->dx_query_mob = vmw_bo; in vmw_cmd_dx_bind_query()
1306 sw_context->dx_query_ctx = sw_context->dx_ctx_node->ctx; in vmw_cmd_dx_bind_query()
1318 struct vmw_sw_context *sw_context, in vmw_cmd_begin_gb_query() argument
1324 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_gb_query()
1337 struct vmw_sw_context *sw_context, in vmw_cmd_begin_query() argument
1354 return vmw_cmd_begin_gb_query(dev_priv, sw_context, header); in vmw_cmd_begin_query()
1357 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_query()
1370 struct vmw_sw_context *sw_context, in vmw_cmd_end_gb_query() argument
1378 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_gb_query()
1382 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_end_gb_query()
1387 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_gb_query()
1400 struct vmw_sw_context *sw_context, in vmw_cmd_end_query() argument
1421 return vmw_cmd_end_gb_query(dev_priv, sw_context, header); in vmw_cmd_end_query()
1424 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_query()
1428 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_end_query()
1433 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_query()
1446 struct vmw_sw_context *sw_context, in vmw_cmd_wait_gb_query() argument
1454 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_gb_query()
1458 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_wait_gb_query()
1474 struct vmw_sw_context *sw_context, in vmw_cmd_wait_query() argument
1495 return vmw_cmd_wait_gb_query(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1498 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1502 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_wait_query()
1511 struct vmw_sw_context *sw_context, in vmw_cmd_dma() argument
1532 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_dma()
1550 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dma()
1559 srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res); in vmw_cmd_dma()
1561 vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->tbo, header); in vmw_cmd_dma()
1567 struct vmw_sw_context *sw_context, in vmw_cmd_draw() argument
1578 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_draw()
1591 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1608 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1619 struct vmw_sw_context *sw_context, in vmw_cmd_tex_state() argument
1633 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_tex_state()
1649 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_tex_state()
1660 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_tex_state()
1677 struct vmw_sw_context *sw_context, in vmw_cmd_check_define_gmrfb() argument
1687 return vmw_translate_guest_ptr(dev_priv, sw_context, &cmd->body.ptr, in vmw_cmd_check_define_gmrfb()
1707 struct vmw_sw_context *sw_context, in vmw_cmd_res_switch_backup() argument
1715 info = vmw_execbuf_info_from_res(sw_context, res); in vmw_cmd_res_switch_backup()
1719 ret = vmw_translate_mob_ptr(dev_priv, sw_context, buf_id, &vbo); in vmw_cmd_res_switch_backup()
1723 vmw_validation_res_switch_backup(sw_context->ctx, info, vbo, in vmw_cmd_res_switch_backup()
1745 struct vmw_sw_context *sw_context, in vmw_cmd_switch_backup() argument
1754 ret = vmw_cmd_res_check(dev_priv, sw_context, res_type, in vmw_cmd_switch_backup()
1759 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, buf_id, in vmw_cmd_switch_backup()
1771 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_surface() argument
1777 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_bind_gb_surface()
1790 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_image() argument
1796 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_image()
1809 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_surface() argument
1815 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_surface()
1828 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_image() argument
1834 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_image()
1848 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_surface() argument
1854 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_surface()
1868 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_image() argument
1874 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_image()
1888 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_surface() argument
1894 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_surface()
1907 struct vmw_sw_context *sw_context, in vmw_cmd_shader_define() argument
1917 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_define()
1929 size, &sw_context->staged_cmd_res); in vmw_cmd_shader_define()
1933 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_define()
1934 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_define()
1947 struct vmw_sw_context *sw_context, in vmw_cmd_shader_destroy() argument
1956 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_destroy()
1966 cmd->body.type, &sw_context->staged_cmd_res); in vmw_cmd_shader_destroy()
1970 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_destroy()
1971 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_destroy()
1984 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader() argument
2001 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader()
2019 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_cmd_set_shader()
2026 (sw_context, res, in vmw_cmd_set_shader()
2027 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_set_shader()
2036 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_set_shader()
2044 ctx_info = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_shader()
2065 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader_const() argument
2073 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader_const()
2093 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_shader() argument
2099 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_bind_gb_shader()
2114 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()
2166 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_constant_buffer_offset() argument
2171 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_constant_buffer_offset()
2203 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader_res() argument
2219 return vmw_view_bindings_add(sw_context, vmw_view_sr, in vmw_cmd_dx_set_shader_res()
2234 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader() argument
2239 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_shader()
2255 res = vmw_shader_lookup(sw_context->man, cmd->body.shaderId, 0); in vmw_cmd_dx_set_shader()
2261 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_cmd_dx_set_shader()
2287 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_vertex_buffers() argument
2290 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_vertex_buffers()
2313 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_vertex_buffers()
2342 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_index_buffer() argument
2345 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_index_buffer()
2355 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_index_buffer()
2381 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_rendertargets() argument
2395 ret = vmw_view_bindings_add(sw_context, vmw_view_ds, vmw_ctx_binding_ds, in vmw_cmd_dx_set_rendertargets()
2400 return vmw_view_bindings_add(sw_context, vmw_view_rt, in vmw_cmd_dx_set_rendertargets()
2414 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_rendertarget_view() argument
2421 ret = vmw_view_id_val_add(sw_context, vmw_view_rt, in vmw_cmd_dx_clear_rendertarget_view()
2436 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_depthstencil_view() argument
2443 ret = vmw_view_id_val_add(sw_context, vmw_view_ds, in vmw_cmd_dx_clear_depthstencil_view()
2450 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_define() argument
2453 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_define()
2480 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_view_define()
2491 return vmw_view_add(sw_context->man, ctx_node->ctx, srf, view_type, in vmw_cmd_dx_view_define()
2494 &sw_context->staged_cmd_res); in vmw_cmd_dx_view_define()
2505 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_so_targets() argument
2508 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_so_targets()
2530 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_so_targets()
2551 struct vmw_sw_context *sw_context, in vmw_cmd_dx_so_define() argument
2554 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_so_define()
2589 struct vmw_sw_context *sw_context, in vmw_cmd_dx_check_subresource() argument
2610 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_check_subresource()
2616 struct vmw_sw_context *sw_context, in vmw_cmd_dx_cid_check() argument
2619 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_cid_check()
2639 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_remove() argument
2642 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_remove()
2654 ret = vmw_view_remove(sw_context->man, cmd->body.view_id, view_type, in vmw_cmd_dx_view_remove()
2655 &sw_context->staged_cmd_res, &view); in vmw_cmd_dx_view_remove()
2665 return vmw_resource_relocation_add(sw_context, view, in vmw_cmd_dx_view_remove()
2666 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_dx_view_remove()
2679 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_shader() argument
2682 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_shader()
2696 return vmw_dx_shader_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_shader()
2698 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_shader()
2709 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_shader() argument
2712 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_destroy_shader()
2720 ret = vmw_shader_remove(sw_context->man, cmd->body.shaderId, 0, in vmw_cmd_dx_destroy_shader()
2721 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_shader()
2734 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_shader() argument
2744 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_dx_bind_shader()
2752 VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_bind_shader()
2766 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_bind_shader()
2773 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_shader()
2786 struct vmw_sw_context *sw_context, in vmw_cmd_dx_genmips() argument
2794 view = vmw_view_id_val_add(sw_context, vmw_view_sr, in vmw_cmd_dx_genmips()
2805 rcache = &sw_context->res_cache[vmw_res_surface]; in vmw_cmd_dx_genmips()
2806 vmw_validation_res_set_dirty(sw_context->ctx, rcache->private, in vmw_cmd_dx_genmips()
2820 struct vmw_sw_context *sw_context, in vmw_cmd_dx_transfer_from_buffer() argument
2827 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2833 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2846 struct vmw_sw_context *sw_context, in vmw_cmd_intra_surface_copy() argument
2855 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_intra_surface_copy()
2861 struct vmw_sw_context *sw_context, in vmw_cmd_sm5() argument
2871 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_define() argument
2877 return vmw_cmd_dx_view_define(dev_priv, sw_context, header); in vmw_cmd_sm5_view_define()
2881 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_remove() argument
2887 return vmw_cmd_dx_view_remove(dev_priv, sw_context, header); in vmw_cmd_sm5_view_remove()
2891 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_uint() argument
2903 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_uint()
2910 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_float() argument
2922 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_float()
2929 struct vmw_sw_context *sw_context, in vmw_cmd_set_uav() argument
2948 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_uav()
2954 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 0, in vmw_cmd_set_uav()
2961 struct vmw_sw_context *sw_context, in vmw_cmd_set_cs_uav() argument
2980 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_cs_uav()
2986 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 1, in vmw_cmd_set_cs_uav()
2993 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_streamoutput() argument
2996 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_define_streamoutput()
3017 return vmw_dx_streamoutput_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_streamoutput()
3019 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_streamoutput()
3023 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_streamoutput() argument
3026 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_destroy_streamoutput()
3054 return vmw_dx_streamoutput_remove(sw_context->man, cmd->body.soid, in vmw_cmd_dx_destroy_streamoutput()
3055 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_streamoutput()
3059 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_streamoutput() argument
3062 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_bind_streamoutput()
3087 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_bind_streamoutput()
3094 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3100 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_streamoutput() argument
3103 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_set_streamoutput()
3137 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_set_streamoutput()
3149 vmw_binding_add(sw_context->dx_ctx_node->staged, &binding.bi, 0, in vmw_cmd_dx_set_streamoutput()
3156 struct vmw_sw_context *sw_context, in vmw_cmd_indexed_instanced_indirect() argument
3167 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_indexed_instanced_indirect()
3173 struct vmw_sw_context *sw_context, in vmw_cmd_instanced_indirect() argument
3184 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_instanced_indirect()
3190 struct vmw_sw_context *sw_context, in vmw_cmd_dispatch_indirect() argument
3201 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dispatch_indirect()
3207 struct vmw_sw_context *sw_context, in vmw_cmd_check_not_3d() argument
3238 if (unlikely(!sw_context->kernel)) { in vmw_cmd_check_not_3d()
3244 return vmw_cmd_check_define_gmrfb(dev_priv, sw_context, buf); in vmw_cmd_check_not_3d()
3654 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check() argument
3667 return vmw_cmd_check_not_3d(dev_priv, sw_context, buf, size); in vmw_cmd_check()
3684 if (unlikely(!entry->user_allow && !sw_context->kernel)) in vmw_cmd_check()
3693 ret = entry->func(dev_priv, sw_context, header); in vmw_cmd_check()
3720 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check_all() argument
3726 sw_context->buf_start = buf; in vmw_cmd_check_all()
3730 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); in vmw_cmd_check_all()
3745 static void vmw_free_relocations(struct vmw_sw_context *sw_context) in vmw_free_relocations() argument
3748 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_free_relocations()
3751 static void vmw_apply_relocations(struct vmw_sw_context *sw_context) in vmw_apply_relocations() argument
3756 list_for_each_entry(reloc, &sw_context->bo_relocations, head) { in vmw_apply_relocations()
3773 vmw_free_relocations(sw_context); in vmw_apply_relocations()
3776 static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, in vmw_resize_cmd_bounce() argument
3779 if (likely(sw_context->cmd_bounce_size >= size)) in vmw_resize_cmd_bounce()
3782 if (sw_context->cmd_bounce_size == 0) in vmw_resize_cmd_bounce()
3783 sw_context->cmd_bounce_size = VMWGFX_CMD_BOUNCE_INIT_SIZE; in vmw_resize_cmd_bounce()
3785 while (sw_context->cmd_bounce_size < size) { in vmw_resize_cmd_bounce()
3786 sw_context->cmd_bounce_size = in vmw_resize_cmd_bounce()
3787 PAGE_ALIGN(sw_context->cmd_bounce_size + in vmw_resize_cmd_bounce()
3788 (sw_context->cmd_bounce_size >> 1)); in vmw_resize_cmd_bounce()
3791 vfree(sw_context->cmd_bounce); in vmw_resize_cmd_bounce()
3792 sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); in vmw_resize_cmd_bounce()
3794 if (sw_context->cmd_bounce == NULL) { in vmw_resize_cmd_bounce()
3796 sw_context->cmd_bounce_size = 0; in vmw_resize_cmd_bounce()
3927 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_fifo() argument
3931 if (sw_context->dx_ctx_node) in vmw_execbuf_submit_fifo()
3933 sw_context->dx_ctx_node->ctx->id); in vmw_execbuf_submit_fifo()
3940 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_fifo()
3942 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3943 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3964 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_cmdbuf() argument
3966 u32 id = ((sw_context->dx_ctx_node) ? sw_context->dx_ctx_node->ctx->id : in vmw_execbuf_submit_cmdbuf()
3971 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_cmdbuf()
3972 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3973 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
4040 struct vmw_sw_context *sw_context, in vmw_execbuf_tie_context() argument
4051 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_execbuf_tie_context()
4056 (dev_priv, sw_context->fp->tfile, handle, in vmw_execbuf_tie_context()
4064 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_SET, in vmw_execbuf_tie_context()
4071 sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); in vmw_execbuf_tie_context()
4072 sw_context->man = vmw_context_res_man(res); in vmw_execbuf_tie_context()
4086 struct vmw_sw_context *sw_context = &dev_priv->ctx; in vmw_execbuf_process() local
4093 DECLARE_VAL_CONTEXT(val_ctx, sw_context, 1); in vmw_execbuf_process()
4121 sw_context->kernel = false; in vmw_execbuf_process()
4123 ret = vmw_resize_cmd_bounce(sw_context, command_size); in vmw_execbuf_process()
4127 ret = copy_from_user(sw_context->cmd_bounce, user_commands, in vmw_execbuf_process()
4135 kernel_commands = sw_context->cmd_bounce; in vmw_execbuf_process()
4137 sw_context->kernel = true; in vmw_execbuf_process()
4140 sw_context->filp = file_priv; in vmw_execbuf_process()
4141 sw_context->fp = vmw_fpriv(file_priv); in vmw_execbuf_process()
4142 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_process()
4143 sw_context->cur_query_bo = dev_priv->pinned_bo; in vmw_execbuf_process()
4144 sw_context->last_query_ctx = NULL; in vmw_execbuf_process()
4145 sw_context->needs_post_query_barrier = false; in vmw_execbuf_process()
4146 sw_context->dx_ctx_node = NULL; in vmw_execbuf_process()
4147 sw_context->dx_query_mob = NULL; in vmw_execbuf_process()
4148 sw_context->dx_query_ctx = NULL; in vmw_execbuf_process()
4149 memset(sw_context->res_cache, 0, sizeof(sw_context->res_cache)); in vmw_execbuf_process()
4150 INIT_LIST_HEAD(&sw_context->res_relocations); in vmw_execbuf_process()
4151 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_execbuf_process()
4153 if (sw_context->staged_bindings) in vmw_execbuf_process()
4154 vmw_binding_state_reset(sw_context->staged_bindings); in vmw_execbuf_process()
4156 INIT_LIST_HEAD(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4157 sw_context->ctx = &val_ctx; in vmw_execbuf_process()
4158 ret = vmw_execbuf_tie_context(dev_priv, sw_context, dx_context_handle); in vmw_execbuf_process()
4162 ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, in vmw_execbuf_process()
4167 ret = vmw_resources_reserve(sw_context); in vmw_execbuf_process()
4192 ret = vmw_rebind_contexts(sw_context); in vmw_execbuf_process()
4199 command_size, sw_context); in vmw_execbuf_process()
4202 sw_context); in vmw_execbuf_process()
4209 vmw_query_bo_switch_commit(dev_priv, sw_context); in vmw_execbuf_process()
4220 vmw_execbuf_bindings_commit(sw_context, false); in vmw_execbuf_process()
4221 vmw_bind_dx_query_mob(sw_context); in vmw_execbuf_process()
4224 vmw_validation_bo_fence(sw_context->ctx, fence); in vmw_execbuf_process()
4269 vmw_cmdbuf_res_commit(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4285 vmw_execbuf_bindings_commit(sw_context, true); in vmw_execbuf_process()
4287 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_process()
4288 vmw_free_relocations(sw_context); in vmw_execbuf_process()
4292 vmw_cmdbuf_res_revert(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4294 WARN_ON(!list_empty(&sw_context->ctx_list)); in vmw_execbuf_process()