Lines Matching refs:sw_context

130 					struct vmw_sw_context *sw_context,
133 struct vmw_sw_context *sw_context,
156 static void vmw_execbuf_bindings_commit(struct vmw_sw_context *sw_context, in vmw_execbuf_bindings_commit() argument
161 list_for_each_entry(entry, &sw_context->ctx_list, head) { in vmw_execbuf_bindings_commit()
165 if (entry->staged != sw_context->staged_bindings) in vmw_execbuf_bindings_commit()
168 sw_context->staged_bindings_inuse = false; in vmw_execbuf_bindings_commit()
172 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_bindings_commit()
180 static void vmw_bind_dx_query_mob(struct vmw_sw_context *sw_context) in vmw_bind_dx_query_mob() argument
182 if (sw_context->dx_query_mob) in vmw_bind_dx_query_mob()
183 vmw_context_bind_dx_query(sw_context->dx_query_ctx, in vmw_bind_dx_query_mob()
184 sw_context->dx_query_mob); in vmw_bind_dx_query_mob()
197 struct vmw_sw_context *sw_context, in vmw_cmd_ctx_first_setup() argument
203 ret = vmw_resource_context_res_add(dev_priv, sw_context, res); in vmw_cmd_ctx_first_setup()
207 if (!sw_context->staged_bindings) { in vmw_cmd_ctx_first_setup()
208 sw_context->staged_bindings = vmw_binding_state_alloc(dev_priv); in vmw_cmd_ctx_first_setup()
209 if (IS_ERR(sw_context->staged_bindings)) { in vmw_cmd_ctx_first_setup()
210 ret = PTR_ERR(sw_context->staged_bindings); in vmw_cmd_ctx_first_setup()
211 sw_context->staged_bindings = NULL; in vmw_cmd_ctx_first_setup()
216 if (sw_context->staged_bindings_inuse) { in vmw_cmd_ctx_first_setup()
224 node->staged = sw_context->staged_bindings; in vmw_cmd_ctx_first_setup()
225 sw_context->staged_bindings_inuse = true; in vmw_cmd_ctx_first_setup()
230 list_add_tail(&node->head, &sw_context->ctx_list); in vmw_cmd_ctx_first_setup()
292 static int vmw_execbuf_res_val_add(struct vmw_sw_context *sw_context, in vmw_execbuf_res_val_add() argument
305 rcache = &sw_context->res_cache[res_type]; in vmw_execbuf_res_val_add()
308 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_execbuf_res_val_add()
314 ret = vmw_validation_add_resource(sw_context->ctx, res, 0, dirty, in vmw_execbuf_res_val_add()
321 ret = vmw_validation_add_resource(sw_context->ctx, res, priv_size, in vmw_execbuf_res_val_add()
328 ret = vmw_cmd_ctx_first_setup(dev_priv, sw_context, res, in vmw_execbuf_res_val_add()
350 static int vmw_view_res_val_add(struct vmw_sw_context *sw_context, in vmw_view_res_val_add() argument
359 ret = vmw_execbuf_res_val_add(sw_context, vmw_view_srf(view), in vmw_view_res_val_add()
364 return vmw_execbuf_res_val_add(sw_context, view, VMW_RES_DIRTY_NONE, in vmw_view_res_val_add()
384 vmw_view_id_val_add(struct vmw_sw_context *sw_context, in vmw_view_id_val_add() argument
387 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_view_id_val_add()
394 view = vmw_view_lookup(sw_context->man, view_type, id); in vmw_view_id_val_add()
398 ret = vmw_view_res_val_add(sw_context, view); in vmw_view_id_val_add()
417 struct vmw_sw_context *sw_context, in vmw_resource_context_res_add() argument
436 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_resource_context_res_add()
450 ret = vmw_view_res_val_add(sw_context, entry->res); in vmw_resource_context_res_add()
452 ret = vmw_execbuf_res_val_add(sw_context, entry->res, in vmw_resource_context_res_add()
468 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_resource_context_res_add()
486 static int vmw_resource_relocation_add(struct vmw_sw_context *sw_context, in vmw_resource_relocation_add() argument
494 rel = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*rel)); in vmw_resource_relocation_add()
503 list_add_tail(&rel->head, &sw_context->res_relocations); in vmw_resource_relocation_add()
554 struct vmw_sw_context *sw_context, in vmw_cmd_invalid() argument
561 struct vmw_sw_context *sw_context, in vmw_cmd_ok() argument
577 static int vmw_resources_reserve(struct vmw_sw_context *sw_context) in vmw_resources_reserve() argument
581 ret = vmw_validation_res_reserve(sw_context->ctx, true); in vmw_resources_reserve()
585 if (sw_context->dx_query_mob) { in vmw_resources_reserve()
589 vmw_context_get_dx_query_mob(sw_context->dx_query_ctx); in vmw_resources_reserve()
591 expected_dx_query_mob != sw_context->dx_query_mob) { in vmw_resources_reserve()
615 struct vmw_sw_context *sw_context, in vmw_cmd_res_check() argument
622 struct vmw_res_cache_entry *rcache = &sw_context->res_cache[res_type]; in vmw_cmd_res_check()
641 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_cmd_res_check()
646 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_cmd_res_check()
651 (dev_priv, sw_context->fp->tfile, *id_loc, converter, &res); in vmw_cmd_res_check()
659 ret = vmw_execbuf_res_val_add(sw_context, res, dirty, vmw_val_add_flag_none); in vmw_cmd_res_check()
669 ret = vmw_resource_relocation_add(sw_context, res, in vmw_cmd_res_check()
670 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_res_check()
724 static int vmw_rebind_contexts(struct vmw_sw_context *sw_context) in vmw_rebind_contexts() argument
729 list_for_each_entry(val, &sw_context->ctx_list, head) { in vmw_rebind_contexts()
759 static int vmw_view_bindings_add(struct vmw_sw_context *sw_context, in vmw_view_bindings_add() argument
766 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_view_bindings_add()
777 view = vmw_view_id_val_add(sw_context, view_type, in vmw_view_bindings_add()
807 struct vmw_sw_context *sw_context, in vmw_cmd_cid_check() argument
813 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_cid_check()
833 vmw_execbuf_info_from_res(struct vmw_sw_context *sw_context, in vmw_execbuf_info_from_res() argument
837 &sw_context->res_cache[vmw_res_type(res)]; in vmw_execbuf_info_from_res()
847 struct vmw_sw_context *sw_context, in vmw_cmd_set_render_target_check() argument
863 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_render_target_check()
869 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_set_render_target_check()
879 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_render_target_check()
894 struct vmw_sw_context *sw_context, in vmw_cmd_surface_copy_check() argument
902 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
908 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
914 struct vmw_sw_context *sw_context, in vmw_cmd_buffer_copy_check() argument
921 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
927 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
933 struct vmw_sw_context *sw_context, in vmw_cmd_pred_copy_check() argument
940 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
946 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
952 struct vmw_sw_context *sw_context, in vmw_cmd_stretch_blt_check() argument
959 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
965 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
971 struct vmw_sw_context *sw_context, in vmw_cmd_blt_surf_screen_check() argument
977 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_blt_surf_screen_check()
983 struct vmw_sw_context *sw_context, in vmw_cmd_present_check() argument
989 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_present_check()
1008 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_prepare() argument
1011 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_prepare()
1015 sw_context->last_query_ctx = ctx_entry->res; in vmw_query_bo_switch_prepare()
1017 if (unlikely(new_query_bo != sw_context->cur_query_bo)) { in vmw_query_bo_switch_prepare()
1024 if (unlikely(sw_context->cur_query_bo != NULL)) { in vmw_query_bo_switch_prepare()
1025 sw_context->needs_post_query_barrier = true; in vmw_query_bo_switch_prepare()
1026 vmw_bo_placement_set_default_accelerated(sw_context->cur_query_bo); in vmw_query_bo_switch_prepare()
1027 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1028 sw_context->cur_query_bo); in vmw_query_bo_switch_prepare()
1032 sw_context->cur_query_bo = new_query_bo; in vmw_query_bo_switch_prepare()
1035 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1062 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_commit() argument
1068 if (sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1070 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_commit()
1083 if (dev_priv->pinned_bo != sw_context->cur_query_bo) { in vmw_query_bo_switch_commit()
1089 if (!sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1090 vmw_bo_pin_reserved(sw_context->cur_query_bo, true); in vmw_query_bo_switch_commit()
1103 BUG_ON(sw_context->last_query_ctx == NULL); in vmw_query_bo_switch_commit()
1104 dev_priv->query_cid = sw_context->last_query_ctx->id; in vmw_query_bo_switch_commit()
1107 vmw_bo_reference(sw_context->cur_query_bo); in vmw_query_bo_switch_commit()
1133 struct vmw_sw_context *sw_context, in vmw_translate_mob_ptr() argument
1142 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_mob_ptr()
1143 ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo); in vmw_translate_mob_ptr()
1149 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); in vmw_translate_mob_ptr()
1155 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_mob_ptr()
1163 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_mob_ptr()
1189 struct vmw_sw_context *sw_context, in vmw_translate_guest_ptr() argument
1198 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_guest_ptr()
1199 ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo); in vmw_translate_guest_ptr()
1206 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); in vmw_translate_guest_ptr()
1212 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_guest_ptr()
1219 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_guest_ptr()
1234 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_query() argument
1238 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_query()
1271 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_query() argument
1284 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_dx_bind_query()
1290 sw_context->dx_query_mob = vmw_bo; in vmw_cmd_dx_bind_query()
1291 sw_context->dx_query_ctx = sw_context->dx_ctx_node->ctx; in vmw_cmd_dx_bind_query()
1303 struct vmw_sw_context *sw_context, in vmw_cmd_begin_gb_query() argument
1309 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_gb_query()
1322 struct vmw_sw_context *sw_context, in vmw_cmd_begin_query() argument
1339 return vmw_cmd_begin_gb_query(dev_priv, sw_context, header); in vmw_cmd_begin_query()
1342 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_query()
1355 struct vmw_sw_context *sw_context, in vmw_cmd_end_gb_query() argument
1363 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_gb_query()
1367 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_end_gb_query()
1372 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_gb_query()
1385 struct vmw_sw_context *sw_context, in vmw_cmd_end_query() argument
1406 return vmw_cmd_end_gb_query(dev_priv, sw_context, header); in vmw_cmd_end_query()
1409 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_query()
1413 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_end_query()
1418 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_query()
1431 struct vmw_sw_context *sw_context, in vmw_cmd_wait_gb_query() argument
1439 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_gb_query()
1443 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_wait_gb_query()
1459 struct vmw_sw_context *sw_context, in vmw_cmd_wait_query() argument
1480 return vmw_cmd_wait_gb_query(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1483 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1487 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_wait_query()
1496 struct vmw_sw_context *sw_context, in vmw_cmd_dma() argument
1517 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_dma()
1535 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dma()
1544 srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res); in vmw_cmd_dma()
1546 vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->tbo, header); in vmw_cmd_dma()
1552 struct vmw_sw_context *sw_context, in vmw_cmd_draw() argument
1563 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_draw()
1576 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1593 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1604 struct vmw_sw_context *sw_context, in vmw_cmd_tex_state() argument
1618 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_tex_state()
1634 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_tex_state()
1645 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_tex_state()
1662 struct vmw_sw_context *sw_context, in vmw_cmd_check_define_gmrfb() argument
1672 return vmw_translate_guest_ptr(dev_priv, sw_context, &cmd->body.ptr, in vmw_cmd_check_define_gmrfb()
1692 struct vmw_sw_context *sw_context, in vmw_cmd_res_switch_backup() argument
1700 info = vmw_execbuf_info_from_res(sw_context, res); in vmw_cmd_res_switch_backup()
1704 ret = vmw_translate_mob_ptr(dev_priv, sw_context, buf_id, &vbo); in vmw_cmd_res_switch_backup()
1708 vmw_validation_res_switch_backup(sw_context->ctx, info, vbo, in vmw_cmd_res_switch_backup()
1730 struct vmw_sw_context *sw_context, in vmw_cmd_switch_backup() argument
1739 ret = vmw_cmd_res_check(dev_priv, sw_context, res_type, in vmw_cmd_switch_backup()
1744 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, buf_id, in vmw_cmd_switch_backup()
1756 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_surface() argument
1762 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_bind_gb_surface()
1775 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_image() argument
1781 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_image()
1794 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_surface() argument
1800 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_surface()
1813 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_image() argument
1819 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_image()
1833 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_surface() argument
1839 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_surface()
1853 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_image() argument
1859 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_image()
1873 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_surface() argument
1879 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_surface()
1892 struct vmw_sw_context *sw_context, in vmw_cmd_shader_define() argument
1902 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_define()
1914 size, &sw_context->staged_cmd_res); in vmw_cmd_shader_define()
1918 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_define()
1919 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_define()
1932 struct vmw_sw_context *sw_context, in vmw_cmd_shader_destroy() argument
1941 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_destroy()
1951 cmd->body.type, &sw_context->staged_cmd_res); in vmw_cmd_shader_destroy()
1955 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_destroy()
1956 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_destroy()
1969 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader() argument
1986 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader()
2004 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_cmd_set_shader()
2011 (sw_context, res, in vmw_cmd_set_shader()
2012 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_set_shader()
2021 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_set_shader()
2029 ctx_info = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_shader()
2050 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader_const() argument
2058 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader_const()
2078 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_shader() argument
2084 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_bind_gb_shader()
2099 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_single_constant_buffer() argument
2105 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_single_constant_buffer()
2113 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_single_constant_buffer()
2151 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_constant_buffer_offset() argument
2156 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_constant_buffer_offset()
2188 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader_res() argument
2204 return vmw_view_bindings_add(sw_context, vmw_view_sr, in vmw_cmd_dx_set_shader_res()
2219 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader() argument
2224 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_shader()
2240 res = vmw_shader_lookup(sw_context->man, cmd->body.shaderId, 0); in vmw_cmd_dx_set_shader()
2246 ret = vmw_execbuf_res_val_add(sw_context, res, in vmw_cmd_dx_set_shader()
2272 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_vertex_buffers() argument
2275 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_vertex_buffers()
2298 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_vertex_buffers()
2327 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_index_buffer() argument
2330 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_index_buffer()
2340 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_index_buffer()
2366 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_rendertargets() argument
2380 ret = vmw_view_bindings_add(sw_context, vmw_view_ds, vmw_ctx_binding_ds, in vmw_cmd_dx_set_rendertargets()
2385 return vmw_view_bindings_add(sw_context, vmw_view_rt, in vmw_cmd_dx_set_rendertargets()
2399 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_rendertarget_view() argument
2406 ret = vmw_view_id_val_add(sw_context, vmw_view_rt, in vmw_cmd_dx_clear_rendertarget_view()
2421 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_depthstencil_view() argument
2428 ret = vmw_view_id_val_add(sw_context, vmw_view_ds, in vmw_cmd_dx_clear_depthstencil_view()
2435 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_define() argument
2438 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_define()
2465 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_view_define()
2478 return vmw_view_add(sw_context->man, ctx_node->ctx, srf, view_type, in vmw_cmd_dx_view_define()
2481 &sw_context->staged_cmd_res); in vmw_cmd_dx_view_define()
2492 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_so_targets() argument
2495 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_so_targets()
2517 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_so_targets()
2538 struct vmw_sw_context *sw_context, in vmw_cmd_dx_so_define() argument
2541 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_so_define()
2576 struct vmw_sw_context *sw_context, in vmw_cmd_dx_check_subresource() argument
2597 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_check_subresource()
2603 struct vmw_sw_context *sw_context, in vmw_cmd_dx_cid_check() argument
2606 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_cid_check()
2626 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_remove() argument
2629 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_remove()
2641 ret = vmw_view_remove(sw_context->man, cmd->body.view_id, view_type, in vmw_cmd_dx_view_remove()
2642 &sw_context->staged_cmd_res, &view); in vmw_cmd_dx_view_remove()
2652 return vmw_resource_relocation_add(sw_context, view, in vmw_cmd_dx_view_remove()
2653 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_dx_view_remove()
2666 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_shader() argument
2669 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_shader()
2685 return vmw_dx_shader_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_shader()
2687 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_shader()
2698 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_shader() argument
2701 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_destroy_shader()
2709 ret = vmw_shader_remove(sw_context->man, cmd->body.shaderId, 0, in vmw_cmd_dx_destroy_shader()
2710 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_shader()
2723 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_shader() argument
2733 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_dx_bind_shader()
2741 VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_bind_shader()
2755 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_bind_shader()
2762 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_shader()
2775 struct vmw_sw_context *sw_context, in vmw_cmd_dx_genmips() argument
2783 view = vmw_view_id_val_add(sw_context, vmw_view_sr, in vmw_cmd_dx_genmips()
2794 rcache = &sw_context->res_cache[vmw_res_surface]; in vmw_cmd_dx_genmips()
2795 vmw_validation_res_set_dirty(sw_context->ctx, rcache->private, in vmw_cmd_dx_genmips()
2809 struct vmw_sw_context *sw_context, in vmw_cmd_dx_transfer_from_buffer() argument
2816 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2822 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2835 struct vmw_sw_context *sw_context, in vmw_cmd_intra_surface_copy() argument
2844 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_intra_surface_copy()
2850 struct vmw_sw_context *sw_context, in vmw_cmd_sm5() argument
2860 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_define() argument
2866 return vmw_cmd_dx_view_define(dev_priv, sw_context, header); in vmw_cmd_sm5_view_define()
2870 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_remove() argument
2876 return vmw_cmd_dx_view_remove(dev_priv, sw_context, header); in vmw_cmd_sm5_view_remove()
2880 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_uint() argument
2892 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_uint()
2899 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_float() argument
2911 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_float()
2918 struct vmw_sw_context *sw_context, in vmw_cmd_set_uav() argument
2937 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_uav()
2943 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 0, in vmw_cmd_set_uav()
2950 struct vmw_sw_context *sw_context, in vmw_cmd_set_cs_uav() argument
2969 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_cs_uav()
2975 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 1, in vmw_cmd_set_cs_uav()
2982 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_streamoutput() argument
2985 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_define_streamoutput()
3008 return vmw_dx_streamoutput_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_streamoutput()
3010 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_streamoutput()
3014 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_streamoutput() argument
3017 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_destroy_streamoutput()
3045 return vmw_dx_streamoutput_remove(sw_context->man, cmd->body.soid, in vmw_cmd_dx_destroy_streamoutput()
3046 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_streamoutput()
3050 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_streamoutput() argument
3053 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_bind_streamoutput()
3078 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_bind_streamoutput()
3085 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3091 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_streamoutput() argument
3094 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_set_streamoutput()
3128 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_NONE, in vmw_cmd_dx_set_streamoutput()
3140 vmw_binding_add(sw_context->dx_ctx_node->staged, &binding.bi, 0, in vmw_cmd_dx_set_streamoutput()
3147 struct vmw_sw_context *sw_context, in vmw_cmd_indexed_instanced_indirect() argument
3158 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_indexed_instanced_indirect()
3164 struct vmw_sw_context *sw_context, in vmw_cmd_instanced_indirect() argument
3175 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_instanced_indirect()
3181 struct vmw_sw_context *sw_context, in vmw_cmd_dispatch_indirect() argument
3192 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dispatch_indirect()
3198 struct vmw_sw_context *sw_context, in vmw_cmd_check_not_3d() argument
3229 if (unlikely(!sw_context->kernel)) { in vmw_cmd_check_not_3d()
3235 return vmw_cmd_check_define_gmrfb(dev_priv, sw_context, buf); in vmw_cmd_check_not_3d()
3647 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check() argument
3660 return vmw_cmd_check_not_3d(dev_priv, sw_context, buf, size); in vmw_cmd_check()
3677 if (unlikely(!entry->user_allow && !sw_context->kernel)) in vmw_cmd_check()
3686 ret = entry->func(dev_priv, sw_context, header); in vmw_cmd_check()
3713 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check_all() argument
3719 sw_context->buf_start = buf; in vmw_cmd_check_all()
3723 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); in vmw_cmd_check_all()
3738 static void vmw_free_relocations(struct vmw_sw_context *sw_context) in vmw_free_relocations() argument
3741 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_free_relocations()
3744 static void vmw_apply_relocations(struct vmw_sw_context *sw_context) in vmw_apply_relocations() argument
3749 list_for_each_entry(reloc, &sw_context->bo_relocations, head) { in vmw_apply_relocations()
3766 vmw_free_relocations(sw_context); in vmw_apply_relocations()
3769 static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, in vmw_resize_cmd_bounce() argument
3772 if (likely(sw_context->cmd_bounce_size >= size)) in vmw_resize_cmd_bounce()
3775 if (sw_context->cmd_bounce_size == 0) in vmw_resize_cmd_bounce()
3776 sw_context->cmd_bounce_size = VMWGFX_CMD_BOUNCE_INIT_SIZE; in vmw_resize_cmd_bounce()
3778 while (sw_context->cmd_bounce_size < size) { in vmw_resize_cmd_bounce()
3779 sw_context->cmd_bounce_size = in vmw_resize_cmd_bounce()
3780 PAGE_ALIGN(sw_context->cmd_bounce_size + in vmw_resize_cmd_bounce()
3781 (sw_context->cmd_bounce_size >> 1)); in vmw_resize_cmd_bounce()
3784 vfree(sw_context->cmd_bounce); in vmw_resize_cmd_bounce()
3785 sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); in vmw_resize_cmd_bounce()
3787 if (sw_context->cmd_bounce == NULL) { in vmw_resize_cmd_bounce()
3789 sw_context->cmd_bounce_size = 0; in vmw_resize_cmd_bounce()
3919 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_fifo() argument
3923 if (sw_context->dx_ctx_node) in vmw_execbuf_submit_fifo()
3925 sw_context->dx_ctx_node->ctx->id); in vmw_execbuf_submit_fifo()
3932 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_fifo()
3934 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3935 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3956 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_cmdbuf() argument
3958 u32 id = ((sw_context->dx_ctx_node) ? sw_context->dx_ctx_node->ctx->id : in vmw_execbuf_submit_cmdbuf()
3963 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_cmdbuf()
3964 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3965 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
4032 struct vmw_sw_context *sw_context, in vmw_execbuf_tie_context() argument
4043 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_execbuf_tie_context()
4048 (dev_priv, sw_context->fp->tfile, handle, in vmw_execbuf_tie_context()
4056 ret = vmw_execbuf_res_val_add(sw_context, res, VMW_RES_DIRTY_SET, in vmw_execbuf_tie_context()
4063 sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); in vmw_execbuf_tie_context()
4064 sw_context->man = vmw_context_res_man(res); in vmw_execbuf_tie_context()
4078 struct vmw_sw_context *sw_context = &dev_priv->ctx; in vmw_execbuf_process() local
4085 DECLARE_VAL_CONTEXT(val_ctx, sw_context, 1); in vmw_execbuf_process()
4113 sw_context->kernel = false; in vmw_execbuf_process()
4115 ret = vmw_resize_cmd_bounce(sw_context, command_size); in vmw_execbuf_process()
4119 ret = copy_from_user(sw_context->cmd_bounce, user_commands, in vmw_execbuf_process()
4127 kernel_commands = sw_context->cmd_bounce; in vmw_execbuf_process()
4129 sw_context->kernel = true; in vmw_execbuf_process()
4132 sw_context->filp = file_priv; in vmw_execbuf_process()
4133 sw_context->fp = vmw_fpriv(file_priv); in vmw_execbuf_process()
4134 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_process()
4135 sw_context->cur_query_bo = dev_priv->pinned_bo; in vmw_execbuf_process()
4136 sw_context->last_query_ctx = NULL; in vmw_execbuf_process()
4137 sw_context->needs_post_query_barrier = false; in vmw_execbuf_process()
4138 sw_context->dx_ctx_node = NULL; in vmw_execbuf_process()
4139 sw_context->dx_query_mob = NULL; in vmw_execbuf_process()
4140 sw_context->dx_query_ctx = NULL; in vmw_execbuf_process()
4141 memset(sw_context->res_cache, 0, sizeof(sw_context->res_cache)); in vmw_execbuf_process()
4142 INIT_LIST_HEAD(&sw_context->res_relocations); in vmw_execbuf_process()
4143 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_execbuf_process()
4145 if (sw_context->staged_bindings) in vmw_execbuf_process()
4146 vmw_binding_state_reset(sw_context->staged_bindings); in vmw_execbuf_process()
4148 INIT_LIST_HEAD(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4149 sw_context->ctx = &val_ctx; in vmw_execbuf_process()
4150 ret = vmw_execbuf_tie_context(dev_priv, sw_context, dx_context_handle); in vmw_execbuf_process()
4154 ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, in vmw_execbuf_process()
4159 ret = vmw_resources_reserve(sw_context); in vmw_execbuf_process()
4184 ret = vmw_rebind_contexts(sw_context); in vmw_execbuf_process()
4191 command_size, sw_context); in vmw_execbuf_process()
4194 sw_context); in vmw_execbuf_process()
4201 vmw_query_bo_switch_commit(dev_priv, sw_context); in vmw_execbuf_process()
4212 vmw_execbuf_bindings_commit(sw_context, false); in vmw_execbuf_process()
4213 vmw_bind_dx_query_mob(sw_context); in vmw_execbuf_process()
4216 vmw_validation_bo_fence(sw_context->ctx, fence); in vmw_execbuf_process()
4261 vmw_cmdbuf_res_commit(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4277 vmw_execbuf_bindings_commit(sw_context, true); in vmw_execbuf_process()
4279 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_process()
4280 vmw_free_relocations(sw_context); in vmw_execbuf_process()
4284 vmw_cmdbuf_res_revert(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4286 WARN_ON(!list_empty(&sw_context->ctx_list)); in vmw_execbuf_process()