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
473 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_resource_context_res_add()
486 ret = vmw_view_res_val_add(sw_context, entry->res); in vmw_resource_context_res_add()
489 (sw_context, entry->res, in vmw_resource_context_res_add()
501 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_resource_context_res_add()
518 static int vmw_resource_relocation_add(struct vmw_sw_context *sw_context, in vmw_resource_relocation_add() argument
526 rel = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*rel)); in vmw_resource_relocation_add()
535 list_add_tail(&rel->head, &sw_context->res_relocations); in vmw_resource_relocation_add()
586 struct vmw_sw_context *sw_context, in vmw_cmd_invalid() argument
593 struct vmw_sw_context *sw_context, in vmw_cmd_ok() argument
609 static int vmw_resources_reserve(struct vmw_sw_context *sw_context) in vmw_resources_reserve() argument
613 ret = vmw_validation_res_reserve(sw_context->ctx, true); in vmw_resources_reserve()
617 if (sw_context->dx_query_mob) { in vmw_resources_reserve()
621 vmw_context_get_dx_query_mob(sw_context->dx_query_ctx); in vmw_resources_reserve()
623 expected_dx_query_mob != sw_context->dx_query_mob) { in vmw_resources_reserve()
647 struct vmw_sw_context *sw_context, in vmw_cmd_res_check() argument
654 struct vmw_res_cache_entry *rcache = &sw_context->res_cache[res_type]; in vmw_cmd_res_check()
672 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_cmd_res_check()
677 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_cmd_res_check()
682 (dev_priv, sw_context->fp->tfile, *id_loc, converter); in vmw_cmd_res_check()
689 ret = vmw_execbuf_res_noref_val_add(sw_context, res, dirty); in vmw_cmd_res_check()
699 ret = vmw_resource_relocation_add(sw_context, res, in vmw_cmd_res_check()
700 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_res_check()
750 static int vmw_rebind_contexts(struct vmw_sw_context *sw_context) in vmw_rebind_contexts() argument
755 list_for_each_entry(val, &sw_context->ctx_list, head) { in vmw_rebind_contexts()
785 static int vmw_view_bindings_add(struct vmw_sw_context *sw_context, in vmw_view_bindings_add() argument
792 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_view_bindings_add()
803 view = vmw_view_id_val_add(sw_context, view_type, in vmw_view_bindings_add()
833 struct vmw_sw_context *sw_context, in vmw_cmd_cid_check() argument
839 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_cid_check()
859 vmw_execbuf_info_from_res(struct vmw_sw_context *sw_context, in vmw_execbuf_info_from_res() argument
863 &sw_context->res_cache[vmw_res_type(res)]; in vmw_execbuf_info_from_res()
873 struct vmw_sw_context *sw_context, in vmw_cmd_set_render_target_check() argument
889 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_render_target_check()
895 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_set_render_target_check()
905 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_render_target_check()
920 struct vmw_sw_context *sw_context, in vmw_cmd_surface_copy_check() argument
928 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
934 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
940 struct vmw_sw_context *sw_context, in vmw_cmd_buffer_copy_check() argument
947 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
953 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
959 struct vmw_sw_context *sw_context, in vmw_cmd_pred_copy_check() argument
966 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
972 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
978 struct vmw_sw_context *sw_context, in vmw_cmd_stretch_blt_check() argument
985 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
991 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
997 struct vmw_sw_context *sw_context, in vmw_cmd_blt_surf_screen_check() argument
1003 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_blt_surf_screen_check()
1009 struct vmw_sw_context *sw_context, in vmw_cmd_present_check() argument
1015 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_present_check()
1034 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_prepare() argument
1037 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_prepare()
1041 sw_context->last_query_ctx = ctx_entry->res; in vmw_query_bo_switch_prepare()
1043 if (unlikely(new_query_bo != sw_context->cur_query_bo)) { in vmw_query_bo_switch_prepare()
1050 if (unlikely(sw_context->cur_query_bo != NULL)) { in vmw_query_bo_switch_prepare()
1051 sw_context->needs_post_query_barrier = true; in vmw_query_bo_switch_prepare()
1052 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1053 sw_context->cur_query_bo, in vmw_query_bo_switch_prepare()
1058 sw_context->cur_query_bo = new_query_bo; in vmw_query_bo_switch_prepare()
1060 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1088 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_commit() argument
1094 if (sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1096 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_commit()
1109 if (dev_priv->pinned_bo != sw_context->cur_query_bo) { in vmw_query_bo_switch_commit()
1115 if (!sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1116 vmw_bo_pin_reserved(sw_context->cur_query_bo, true); in vmw_query_bo_switch_commit()
1129 BUG_ON(sw_context->last_query_ctx == NULL); in vmw_query_bo_switch_commit()
1130 dev_priv->query_cid = sw_context->last_query_ctx->id; in vmw_query_bo_switch_commit()
1133 vmw_bo_reference(sw_context->cur_query_bo); in vmw_query_bo_switch_commit()
1159 struct vmw_sw_context *sw_context, in vmw_translate_mob_ptr() argument
1168 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_mob_ptr()
1169 vmw_bo = vmw_user_bo_noref_lookup(sw_context->fp->tfile, handle); in vmw_translate_mob_ptr()
1175 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, true, false); in vmw_translate_mob_ptr()
1180 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_mob_ptr()
1188 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_mob_ptr()
1214 struct vmw_sw_context *sw_context, in vmw_translate_guest_ptr() argument
1223 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_guest_ptr()
1224 vmw_bo = vmw_user_bo_noref_lookup(sw_context->fp->tfile, handle); in vmw_translate_guest_ptr()
1230 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, false, false); in vmw_translate_guest_ptr()
1235 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_guest_ptr()
1242 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_guest_ptr()
1257 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_query() argument
1261 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_query()
1292 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_query() argument
1305 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_dx_bind_query()
1311 sw_context->dx_query_mob = vmw_bo; in vmw_cmd_dx_bind_query()
1312 sw_context->dx_query_ctx = sw_context->dx_ctx_node->ctx; in vmw_cmd_dx_bind_query()
1324 struct vmw_sw_context *sw_context, in vmw_cmd_begin_gb_query() argument
1330 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_gb_query()
1343 struct vmw_sw_context *sw_context, in vmw_cmd_begin_query() argument
1360 return vmw_cmd_begin_gb_query(dev_priv, sw_context, header); in vmw_cmd_begin_query()
1363 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_query()
1376 struct vmw_sw_context *sw_context, in vmw_cmd_end_gb_query() argument
1384 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_gb_query()
1388 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_end_gb_query()
1393 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_gb_query()
1406 struct vmw_sw_context *sw_context, in vmw_cmd_end_query() argument
1427 return vmw_cmd_end_gb_query(dev_priv, sw_context, header); in vmw_cmd_end_query()
1430 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_query()
1434 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_end_query()
1439 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_query()
1452 struct vmw_sw_context *sw_context, in vmw_cmd_wait_gb_query() argument
1460 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_gb_query()
1464 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_wait_gb_query()
1480 struct vmw_sw_context *sw_context, in vmw_cmd_wait_query() argument
1501 return vmw_cmd_wait_gb_query(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1504 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1508 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_wait_query()
1517 struct vmw_sw_context *sw_context, in vmw_cmd_dma() argument
1538 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_dma()
1556 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dma()
1565 srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res); in vmw_cmd_dma()
1567 vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->base, header); in vmw_cmd_dma()
1573 struct vmw_sw_context *sw_context, in vmw_cmd_draw() argument
1584 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_draw()
1597 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1614 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1625 struct vmw_sw_context *sw_context, in vmw_cmd_tex_state() argument
1639 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_tex_state()
1655 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_tex_state()
1666 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_tex_state()
1683 struct vmw_sw_context *sw_context, in vmw_cmd_check_define_gmrfb() argument
1693 return vmw_translate_guest_ptr(dev_priv, sw_context, &cmd->body.ptr, in vmw_cmd_check_define_gmrfb()
1713 struct vmw_sw_context *sw_context, in vmw_cmd_res_switch_backup() argument
1721 info = vmw_execbuf_info_from_res(sw_context, res); in vmw_cmd_res_switch_backup()
1725 ret = vmw_translate_mob_ptr(dev_priv, sw_context, buf_id, &vbo); in vmw_cmd_res_switch_backup()
1729 vmw_validation_res_switch_backup(sw_context->ctx, info, vbo, in vmw_cmd_res_switch_backup()
1751 struct vmw_sw_context *sw_context, in vmw_cmd_switch_backup() argument
1760 ret = vmw_cmd_res_check(dev_priv, sw_context, res_type, in vmw_cmd_switch_backup()
1765 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, buf_id, in vmw_cmd_switch_backup()
1777 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_surface() argument
1783 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_bind_gb_surface()
1796 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_image() argument
1802 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_image()
1815 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_surface() argument
1821 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_surface()
1834 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_image() argument
1840 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_image()
1854 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_surface() argument
1860 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_surface()
1874 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_image() argument
1880 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_image()
1894 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_surface() argument
1900 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_surface()
1913 struct vmw_sw_context *sw_context, in vmw_cmd_shader_define() argument
1923 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_define()
1935 size, &sw_context->staged_cmd_res); in vmw_cmd_shader_define()
1939 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_define()
1940 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_define()
1953 struct vmw_sw_context *sw_context, in vmw_cmd_shader_destroy() argument
1962 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_destroy()
1972 cmd->body.type, &sw_context->staged_cmd_res); in vmw_cmd_shader_destroy()
1976 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_destroy()
1977 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_destroy()
1990 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader() argument
2007 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader()
2025 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_set_shader()
2031 (sw_context, res, in vmw_cmd_set_shader()
2032 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_set_shader()
2041 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_set_shader()
2049 ctx_info = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_shader()
2070 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader_const() argument
2078 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader_const()
2098 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_shader() argument
2104 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_bind_gb_shader()
2119 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_single_constant_buffer() argument
2127 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_single_constant_buffer()
2135 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_single_constant_buffer()
2172 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader_res() argument
2190 return vmw_view_bindings_add(sw_context, vmw_view_sr, in vmw_cmd_dx_set_shader_res()
2205 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader() argument
2212 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_shader()
2229 res = vmw_shader_lookup(sw_context->man, cmd->body.shaderId, 0); in vmw_cmd_dx_set_shader()
2235 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_set_shader()
2260 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_vertex_buffers() argument
2263 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_vertex_buffers()
2286 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_vertex_buffers()
2315 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_index_buffer() argument
2318 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_index_buffer()
2328 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_index_buffer()
2354 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_rendertargets() argument
2368 ret = vmw_view_bindings_add(sw_context, vmw_view_ds, vmw_ctx_binding_ds, in vmw_cmd_dx_set_rendertargets()
2373 return vmw_view_bindings_add(sw_context, vmw_view_rt, in vmw_cmd_dx_set_rendertargets()
2387 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_rendertarget_view() argument
2394 ret = vmw_view_id_val_add(sw_context, vmw_view_rt, in vmw_cmd_dx_clear_rendertarget_view()
2409 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_depthstencil_view() argument
2416 ret = vmw_view_id_val_add(sw_context, vmw_view_ds, in vmw_cmd_dx_clear_depthstencil_view()
2423 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_define() argument
2426 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_define()
2453 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_view_define()
2464 return vmw_view_add(sw_context->man, ctx_node->ctx, srf, view_type, in vmw_cmd_dx_view_define()
2467 &sw_context->staged_cmd_res); in vmw_cmd_dx_view_define()
2478 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_so_targets() argument
2481 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_so_targets()
2503 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_so_targets()
2524 struct vmw_sw_context *sw_context, in vmw_cmd_dx_so_define() argument
2527 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_so_define()
2560 struct vmw_sw_context *sw_context, in vmw_cmd_dx_check_subresource() argument
2581 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_check_subresource()
2587 struct vmw_sw_context *sw_context, in vmw_cmd_dx_cid_check() argument
2590 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_cid_check()
2610 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_remove() argument
2613 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_remove()
2625 ret = vmw_view_remove(sw_context->man, cmd->body.view_id, view_type, in vmw_cmd_dx_view_remove()
2626 &sw_context->staged_cmd_res, &view); in vmw_cmd_dx_view_remove()
2636 return vmw_resource_relocation_add(sw_context, view, in vmw_cmd_dx_view_remove()
2637 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_dx_view_remove()
2650 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_shader() argument
2653 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_shader()
2667 return vmw_dx_shader_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_shader()
2669 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_shader()
2680 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_shader() argument
2683 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_destroy_shader()
2691 ret = vmw_shader_remove(sw_context->man, cmd->body.shaderId, 0, in vmw_cmd_dx_destroy_shader()
2692 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_shader()
2705 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_shader() argument
2715 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_dx_bind_shader()
2723 VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_bind_shader()
2737 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_bind_shader()
2744 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_shader()
2757 struct vmw_sw_context *sw_context, in vmw_cmd_dx_genmips() argument
2764 ret = vmw_view_id_val_add(sw_context, vmw_view_sr, in vmw_cmd_dx_genmips()
2779 struct vmw_sw_context *sw_context, in vmw_cmd_dx_transfer_from_buffer() argument
2786 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2792 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2805 struct vmw_sw_context *sw_context, in vmw_cmd_intra_surface_copy() argument
2814 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_intra_surface_copy()
2820 struct vmw_sw_context *sw_context, in vmw_cmd_sm5() argument
2830 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_define() argument
2836 return vmw_cmd_dx_view_define(dev_priv, sw_context, header); in vmw_cmd_sm5_view_define()
2840 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_remove() argument
2846 return vmw_cmd_dx_view_remove(dev_priv, sw_context, header); in vmw_cmd_sm5_view_remove()
2850 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_uint() argument
2862 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_uint()
2869 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_float() argument
2881 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_float()
2888 struct vmw_sw_context *sw_context, in vmw_cmd_set_uav() argument
2907 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_uav()
2913 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 0, in vmw_cmd_set_uav()
2920 struct vmw_sw_context *sw_context, in vmw_cmd_set_cs_uav() argument
2939 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_cs_uav()
2945 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 1, in vmw_cmd_set_cs_uav()
2952 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_streamoutput() argument
2955 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_define_streamoutput()
2976 return vmw_dx_streamoutput_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_streamoutput()
2978 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_streamoutput()
2982 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_streamoutput() argument
2985 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_destroy_streamoutput()
3013 return vmw_dx_streamoutput_remove(sw_context->man, cmd->body.soid, in vmw_cmd_dx_destroy_streamoutput()
3014 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_streamoutput()
3018 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_streamoutput() argument
3021 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_bind_streamoutput()
3046 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3053 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3059 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_streamoutput() argument
3062 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_set_streamoutput()
3096 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_set_streamoutput()
3108 vmw_binding_add(sw_context->dx_ctx_node->staged, &binding.bi, 0, in vmw_cmd_dx_set_streamoutput()
3115 struct vmw_sw_context *sw_context, in vmw_cmd_indexed_instanced_indirect() argument
3126 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_indexed_instanced_indirect()
3132 struct vmw_sw_context *sw_context, in vmw_cmd_instanced_indirect() argument
3143 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_instanced_indirect()
3149 struct vmw_sw_context *sw_context, in vmw_cmd_dispatch_indirect() argument
3160 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dispatch_indirect()
3166 struct vmw_sw_context *sw_context, in vmw_cmd_check_not_3d() argument
3197 if (unlikely(!sw_context->kernel)) { in vmw_cmd_check_not_3d()
3203 return vmw_cmd_check_define_gmrfb(dev_priv, sw_context, buf); in vmw_cmd_check_not_3d()
3593 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check() argument
3606 return vmw_cmd_check_not_3d(dev_priv, sw_context, buf, size); in vmw_cmd_check()
3623 if (unlikely(!entry->user_allow && !sw_context->kernel)) in vmw_cmd_check()
3632 ret = entry->func(dev_priv, sw_context, header); in vmw_cmd_check()
3659 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check_all() argument
3665 sw_context->buf_start = buf; in vmw_cmd_check_all()
3669 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); in vmw_cmd_check_all()
3684 static void vmw_free_relocations(struct vmw_sw_context *sw_context) in vmw_free_relocations() argument
3687 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_free_relocations()
3690 static void vmw_apply_relocations(struct vmw_sw_context *sw_context) in vmw_apply_relocations() argument
3695 list_for_each_entry(reloc, &sw_context->bo_relocations, head) { in vmw_apply_relocations()
3712 vmw_free_relocations(sw_context); in vmw_apply_relocations()
3715 static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, in vmw_resize_cmd_bounce() argument
3718 if (likely(sw_context->cmd_bounce_size >= size)) in vmw_resize_cmd_bounce()
3721 if (sw_context->cmd_bounce_size == 0) in vmw_resize_cmd_bounce()
3722 sw_context->cmd_bounce_size = VMWGFX_CMD_BOUNCE_INIT_SIZE; in vmw_resize_cmd_bounce()
3724 while (sw_context->cmd_bounce_size < size) { in vmw_resize_cmd_bounce()
3725 sw_context->cmd_bounce_size = in vmw_resize_cmd_bounce()
3726 PAGE_ALIGN(sw_context->cmd_bounce_size + in vmw_resize_cmd_bounce()
3727 (sw_context->cmd_bounce_size >> 1)); in vmw_resize_cmd_bounce()
3730 vfree(sw_context->cmd_bounce); in vmw_resize_cmd_bounce()
3731 sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); in vmw_resize_cmd_bounce()
3733 if (sw_context->cmd_bounce == NULL) { in vmw_resize_cmd_bounce()
3735 sw_context->cmd_bounce_size = 0; in vmw_resize_cmd_bounce()
3874 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_fifo() argument
3878 if (sw_context->dx_ctx_node) in vmw_execbuf_submit_fifo()
3880 sw_context->dx_ctx_node->ctx->id); in vmw_execbuf_submit_fifo()
3887 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_fifo()
3889 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3890 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3911 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_cmdbuf() argument
3913 u32 id = ((sw_context->dx_ctx_node) ? sw_context->dx_ctx_node->ctx->id : in vmw_execbuf_submit_cmdbuf()
3918 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_cmdbuf()
3919 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3920 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3987 struct vmw_sw_context *sw_context, in vmw_execbuf_tie_context() argument
3998 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_execbuf_tie_context()
4003 (dev_priv, sw_context->fp->tfile, handle, in vmw_execbuf_tie_context()
4011 ret = vmw_execbuf_res_noref_val_add(sw_context, res, VMW_RES_DIRTY_SET); in vmw_execbuf_tie_context()
4015 sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); in vmw_execbuf_tie_context()
4016 sw_context->man = vmw_context_res_man(res); in vmw_execbuf_tie_context()
4029 struct vmw_sw_context *sw_context = &dev_priv->ctx; in vmw_execbuf_process() local
4036 DECLARE_VAL_CONTEXT(val_ctx, &sw_context->res_ht, 1); in vmw_execbuf_process()
4070 sw_context->kernel = false; in vmw_execbuf_process()
4072 ret = vmw_resize_cmd_bounce(sw_context, command_size); in vmw_execbuf_process()
4076 ret = copy_from_user(sw_context->cmd_bounce, user_commands, in vmw_execbuf_process()
4084 kernel_commands = sw_context->cmd_bounce; in vmw_execbuf_process()
4086 sw_context->kernel = true; in vmw_execbuf_process()
4089 sw_context->fp = vmw_fpriv(file_priv); in vmw_execbuf_process()
4090 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_process()
4091 sw_context->cur_query_bo = dev_priv->pinned_bo; in vmw_execbuf_process()
4092 sw_context->last_query_ctx = NULL; in vmw_execbuf_process()
4093 sw_context->needs_post_query_barrier = false; in vmw_execbuf_process()
4094 sw_context->dx_ctx_node = NULL; in vmw_execbuf_process()
4095 sw_context->dx_query_mob = NULL; in vmw_execbuf_process()
4096 sw_context->dx_query_ctx = NULL; in vmw_execbuf_process()
4097 memset(sw_context->res_cache, 0, sizeof(sw_context->res_cache)); in vmw_execbuf_process()
4098 INIT_LIST_HEAD(&sw_context->res_relocations); in vmw_execbuf_process()
4099 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_execbuf_process()
4101 if (sw_context->staged_bindings) in vmw_execbuf_process()
4102 vmw_binding_state_reset(sw_context->staged_bindings); in vmw_execbuf_process()
4104 if (!sw_context->res_ht_initialized) { in vmw_execbuf_process()
4105 ret = drm_ht_create(&sw_context->res_ht, VMW_RES_HT_ORDER); in vmw_execbuf_process()
4109 sw_context->res_ht_initialized = true; in vmw_execbuf_process()
4112 INIT_LIST_HEAD(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4113 sw_context->ctx = &val_ctx; in vmw_execbuf_process()
4114 ret = vmw_execbuf_tie_context(dev_priv, sw_context, dx_context_handle); in vmw_execbuf_process()
4118 ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, in vmw_execbuf_process()
4123 ret = vmw_resources_reserve(sw_context); in vmw_execbuf_process()
4148 ret = vmw_rebind_contexts(sw_context); in vmw_execbuf_process()
4155 command_size, sw_context); in vmw_execbuf_process()
4158 sw_context); in vmw_execbuf_process()
4165 vmw_query_bo_switch_commit(dev_priv, sw_context); in vmw_execbuf_process()
4176 vmw_execbuf_bindings_commit(sw_context, false); in vmw_execbuf_process()
4177 vmw_bind_dx_query_mob(sw_context); in vmw_execbuf_process()
4180 vmw_validation_bo_fence(sw_context->ctx, fence); in vmw_execbuf_process()
4218 vmw_cmdbuf_res_commit(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4234 vmw_execbuf_bindings_commit(sw_context, true); in vmw_execbuf_process()
4236 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_process()
4237 vmw_free_relocations(sw_context); in vmw_execbuf_process()
4241 vmw_cmdbuf_res_revert(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4243 WARN_ON(!list_empty(&sw_context->ctx_list)); in vmw_execbuf_process()