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()
304 static int vmw_execbuf_res_noref_val_add(struct vmw_sw_context *sw_context, in vmw_execbuf_res_noref_val_add() argument
316 rcache = &sw_context->res_cache[res_type]; in vmw_execbuf_res_noref_val_add()
319 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_execbuf_res_noref_val_add()
326 ret = vmw_validation_add_resource(sw_context->ctx, res, priv_size, in vmw_execbuf_res_noref_val_add()
334 ret = vmw_cmd_ctx_first_setup(dev_priv, sw_context, res, in vmw_execbuf_res_noref_val_add()
356 static int vmw_execbuf_res_noctx_val_add(struct vmw_sw_context *sw_context, in vmw_execbuf_res_noctx_val_add() argument
365 rcache = &sw_context->res_cache[res_type]; in vmw_execbuf_res_noctx_val_add()
368 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_execbuf_res_noctx_val_add()
373 ret = vmw_validation_add_resource(sw_context->ctx, res, 0, dirty, in vmw_execbuf_res_noctx_val_add()
392 static int vmw_view_res_val_add(struct vmw_sw_context *sw_context, in vmw_view_res_val_add() argument
401 ret = vmw_execbuf_res_noctx_val_add(sw_context, vmw_view_srf(view), in vmw_view_res_val_add()
406 return vmw_execbuf_res_noctx_val_add(sw_context, view, in vmw_view_res_val_add()
426 vmw_view_id_val_add(struct vmw_sw_context *sw_context, in vmw_view_id_val_add() argument
429 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_view_id_val_add()
436 view = vmw_view_lookup(sw_context->man, view_type, id); in vmw_view_id_val_add()
440 ret = vmw_view_res_val_add(sw_context, view); in vmw_view_id_val_add()
459 struct vmw_sw_context *sw_context, in vmw_resource_context_res_add() argument
478 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_resource_context_res_add()
491 ret = vmw_view_res_val_add(sw_context, entry->res); in vmw_resource_context_res_add()
494 (sw_context, entry->res, in vmw_resource_context_res_add()
506 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_resource_context_res_add()
523 static int vmw_resource_relocation_add(struct vmw_sw_context *sw_context, in vmw_resource_relocation_add() argument
531 rel = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*rel)); in vmw_resource_relocation_add()
540 list_add_tail(&rel->head, &sw_context->res_relocations); in vmw_resource_relocation_add()
591 struct vmw_sw_context *sw_context, in vmw_cmd_invalid() argument
598 struct vmw_sw_context *sw_context, in vmw_cmd_ok() argument
614 static int vmw_resources_reserve(struct vmw_sw_context *sw_context) in vmw_resources_reserve() argument
618 ret = vmw_validation_res_reserve(sw_context->ctx, true); in vmw_resources_reserve()
622 if (sw_context->dx_query_mob) { in vmw_resources_reserve()
626 vmw_context_get_dx_query_mob(sw_context->dx_query_ctx); in vmw_resources_reserve()
628 expected_dx_query_mob != sw_context->dx_query_mob) { in vmw_resources_reserve()
652 struct vmw_sw_context *sw_context, in vmw_cmd_res_check() argument
659 struct vmw_res_cache_entry *rcache = &sw_context->res_cache[res_type]; in vmw_cmd_res_check()
677 vmw_validation_res_set_dirty(sw_context->ctx, in vmw_cmd_res_check()
682 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_cmd_res_check()
687 (dev_priv, sw_context->fp->tfile, *id_loc, converter); in vmw_cmd_res_check()
694 ret = vmw_execbuf_res_noref_val_add(sw_context, res, dirty); in vmw_cmd_res_check()
704 ret = vmw_resource_relocation_add(sw_context, res, in vmw_cmd_res_check()
705 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_res_check()
755 static int vmw_rebind_contexts(struct vmw_sw_context *sw_context) in vmw_rebind_contexts() argument
760 list_for_each_entry(val, &sw_context->ctx_list, head) { in vmw_rebind_contexts()
790 static int vmw_view_bindings_add(struct vmw_sw_context *sw_context, in vmw_view_bindings_add() argument
797 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_view_bindings_add()
808 view = vmw_view_id_val_add(sw_context, view_type, in vmw_view_bindings_add()
838 struct vmw_sw_context *sw_context, in vmw_cmd_cid_check() argument
844 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_cid_check()
864 vmw_execbuf_info_from_res(struct vmw_sw_context *sw_context, in vmw_execbuf_info_from_res() argument
868 &sw_context->res_cache[vmw_res_type(res)]; in vmw_execbuf_info_from_res()
878 struct vmw_sw_context *sw_context, in vmw_cmd_set_render_target_check() argument
894 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_render_target_check()
900 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_set_render_target_check()
910 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_render_target_check()
925 struct vmw_sw_context *sw_context, in vmw_cmd_surface_copy_check() argument
933 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
939 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_surface_copy_check()
945 struct vmw_sw_context *sw_context, in vmw_cmd_buffer_copy_check() argument
952 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
958 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_buffer_copy_check()
964 struct vmw_sw_context *sw_context, in vmw_cmd_pred_copy_check() argument
971 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
977 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_pred_copy_check()
983 struct vmw_sw_context *sw_context, in vmw_cmd_stretch_blt_check() argument
990 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
996 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_stretch_blt_check()
1002 struct vmw_sw_context *sw_context, in vmw_cmd_blt_surf_screen_check() argument
1008 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_blt_surf_screen_check()
1014 struct vmw_sw_context *sw_context, in vmw_cmd_present_check() argument
1020 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_present_check()
1039 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_prepare() argument
1042 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_prepare()
1046 sw_context->last_query_ctx = ctx_entry->res; in vmw_query_bo_switch_prepare()
1048 if (unlikely(new_query_bo != sw_context->cur_query_bo)) { in vmw_query_bo_switch_prepare()
1055 if (unlikely(sw_context->cur_query_bo != NULL)) { in vmw_query_bo_switch_prepare()
1056 sw_context->needs_post_query_barrier = true; in vmw_query_bo_switch_prepare()
1057 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1058 sw_context->cur_query_bo, in vmw_query_bo_switch_prepare()
1063 sw_context->cur_query_bo = new_query_bo; in vmw_query_bo_switch_prepare()
1065 ret = vmw_validation_add_bo(sw_context->ctx, in vmw_query_bo_switch_prepare()
1093 struct vmw_sw_context *sw_context) in vmw_query_bo_switch_commit() argument
1099 if (sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1101 &sw_context->res_cache[vmw_res_context]; in vmw_query_bo_switch_commit()
1114 if (dev_priv->pinned_bo != sw_context->cur_query_bo) { in vmw_query_bo_switch_commit()
1120 if (!sw_context->needs_post_query_barrier) { in vmw_query_bo_switch_commit()
1121 vmw_bo_pin_reserved(sw_context->cur_query_bo, true); in vmw_query_bo_switch_commit()
1134 BUG_ON(sw_context->last_query_ctx == NULL); in vmw_query_bo_switch_commit()
1135 dev_priv->query_cid = sw_context->last_query_ctx->id; in vmw_query_bo_switch_commit()
1138 vmw_bo_reference(sw_context->cur_query_bo); in vmw_query_bo_switch_commit()
1164 struct vmw_sw_context *sw_context, in vmw_translate_mob_ptr() argument
1173 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_mob_ptr()
1174 vmw_bo = vmw_user_bo_noref_lookup(sw_context->fp->tfile, handle); in vmw_translate_mob_ptr()
1180 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, true, false); in vmw_translate_mob_ptr()
1185 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_mob_ptr()
1193 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_mob_ptr()
1219 struct vmw_sw_context *sw_context, in vmw_translate_guest_ptr() argument
1228 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_guest_ptr()
1229 vmw_bo = vmw_user_bo_noref_lookup(sw_context->fp->tfile, handle); in vmw_translate_guest_ptr()
1235 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, false, false); in vmw_translate_guest_ptr()
1240 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_guest_ptr()
1247 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_guest_ptr()
1262 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_query() argument
1266 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_query()
1297 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_query() argument
1310 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_dx_bind_query()
1316 sw_context->dx_query_mob = vmw_bo; in vmw_cmd_dx_bind_query()
1317 sw_context->dx_query_ctx = sw_context->dx_ctx_node->ctx; in vmw_cmd_dx_bind_query()
1329 struct vmw_sw_context *sw_context, in vmw_cmd_begin_gb_query() argument
1335 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_gb_query()
1348 struct vmw_sw_context *sw_context, in vmw_cmd_begin_query() argument
1365 return vmw_cmd_begin_gb_query(dev_priv, sw_context, header); in vmw_cmd_begin_query()
1368 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_query()
1381 struct vmw_sw_context *sw_context, in vmw_cmd_end_gb_query() argument
1389 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_gb_query()
1393 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_end_gb_query()
1398 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_gb_query()
1411 struct vmw_sw_context *sw_context, in vmw_cmd_end_query() argument
1432 return vmw_cmd_end_gb_query(dev_priv, sw_context, header); in vmw_cmd_end_query()
1435 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_query()
1439 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_end_query()
1444 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_query()
1457 struct vmw_sw_context *sw_context, in vmw_cmd_wait_gb_query() argument
1465 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_gb_query()
1469 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_wait_gb_query()
1485 struct vmw_sw_context *sw_context, in vmw_cmd_wait_query() argument
1506 return vmw_cmd_wait_gb_query(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1509 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1513 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_wait_query()
1522 struct vmw_sw_context *sw_context, in vmw_cmd_dma() argument
1543 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_dma()
1561 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dma()
1570 srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res); in vmw_cmd_dma()
1572 vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->base, header); in vmw_cmd_dma()
1578 struct vmw_sw_context *sw_context, in vmw_cmd_draw() argument
1589 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_draw()
1602 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1619 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1630 struct vmw_sw_context *sw_context, in vmw_cmd_tex_state() argument
1644 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_tex_state()
1660 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_tex_state()
1671 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_tex_state()
1688 struct vmw_sw_context *sw_context, in vmw_cmd_check_define_gmrfb() argument
1698 return vmw_translate_guest_ptr(dev_priv, sw_context, &cmd->body.ptr, in vmw_cmd_check_define_gmrfb()
1718 struct vmw_sw_context *sw_context, in vmw_cmd_res_switch_backup() argument
1726 info = vmw_execbuf_info_from_res(sw_context, res); in vmw_cmd_res_switch_backup()
1730 ret = vmw_translate_mob_ptr(dev_priv, sw_context, buf_id, &vbo); in vmw_cmd_res_switch_backup()
1734 vmw_validation_res_switch_backup(sw_context->ctx, info, vbo, in vmw_cmd_res_switch_backup()
1756 struct vmw_sw_context *sw_context, in vmw_cmd_switch_backup() argument
1765 ret = vmw_cmd_res_check(dev_priv, sw_context, res_type, in vmw_cmd_switch_backup()
1770 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, buf_id, in vmw_cmd_switch_backup()
1782 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_surface() argument
1788 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_bind_gb_surface()
1801 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_image() argument
1807 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_image()
1820 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_surface() argument
1826 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_surface()
1839 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_image() argument
1845 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_image()
1859 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_surface() argument
1865 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_surface()
1879 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_image() argument
1885 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_image()
1899 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_surface() argument
1905 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_surface()
1918 struct vmw_sw_context *sw_context, in vmw_cmd_shader_define() argument
1928 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_define()
1940 size, &sw_context->staged_cmd_res); in vmw_cmd_shader_define()
1944 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_define()
1945 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_define()
1958 struct vmw_sw_context *sw_context, in vmw_cmd_shader_destroy() argument
1967 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_destroy()
1977 cmd->body.type, &sw_context->staged_cmd_res); in vmw_cmd_shader_destroy()
1981 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_destroy()
1982 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_destroy()
1995 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader() argument
2012 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader()
2030 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_set_shader()
2036 (sw_context, res, in vmw_cmd_set_shader()
2037 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_set_shader()
2046 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_set_shader()
2054 ctx_info = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_shader()
2075 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader_const() argument
2083 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader_const()
2103 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_shader() argument
2109 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_bind_gb_shader()
2124 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_single_constant_buffer() argument
2132 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_single_constant_buffer()
2140 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_single_constant_buffer()
2177 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader_res() argument
2195 return vmw_view_bindings_add(sw_context, vmw_view_sr, in vmw_cmd_dx_set_shader_res()
2210 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader() argument
2217 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_shader()
2234 res = vmw_shader_lookup(sw_context->man, cmd->body.shaderId, 0); in vmw_cmd_dx_set_shader()
2240 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_set_shader()
2265 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_vertex_buffers() argument
2268 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_vertex_buffers()
2291 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_vertex_buffers()
2320 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_index_buffer() argument
2323 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_index_buffer()
2333 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_index_buffer()
2359 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_rendertargets() argument
2373 ret = vmw_view_bindings_add(sw_context, vmw_view_ds, vmw_ctx_binding_ds, in vmw_cmd_dx_set_rendertargets()
2378 return vmw_view_bindings_add(sw_context, vmw_view_rt, in vmw_cmd_dx_set_rendertargets()
2392 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_rendertarget_view() argument
2399 ret = vmw_view_id_val_add(sw_context, vmw_view_rt, in vmw_cmd_dx_clear_rendertarget_view()
2414 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_depthstencil_view() argument
2421 ret = vmw_view_id_val_add(sw_context, vmw_view_ds, in vmw_cmd_dx_clear_depthstencil_view()
2428 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_define() argument
2431 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_define()
2458 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_view_define()
2469 return vmw_view_add(sw_context->man, ctx_node->ctx, srf, view_type, in vmw_cmd_dx_view_define()
2472 &sw_context->staged_cmd_res); in vmw_cmd_dx_view_define()
2483 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_so_targets() argument
2486 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_so_targets()
2508 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_so_targets()
2529 struct vmw_sw_context *sw_context, in vmw_cmd_dx_so_define() argument
2532 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_so_define()
2567 struct vmw_sw_context *sw_context, in vmw_cmd_dx_check_subresource() argument
2588 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_check_subresource()
2594 struct vmw_sw_context *sw_context, in vmw_cmd_dx_cid_check() argument
2597 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_cid_check()
2617 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_remove() argument
2620 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_remove()
2632 ret = vmw_view_remove(sw_context->man, cmd->body.view_id, view_type, in vmw_cmd_dx_view_remove()
2633 &sw_context->staged_cmd_res, &view); in vmw_cmd_dx_view_remove()
2643 return vmw_resource_relocation_add(sw_context, view, in vmw_cmd_dx_view_remove()
2644 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_dx_view_remove()
2657 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_shader() argument
2660 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_shader()
2674 return vmw_dx_shader_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_shader()
2676 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_shader()
2687 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_shader() argument
2690 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_destroy_shader()
2698 ret = vmw_shader_remove(sw_context->man, cmd->body.shaderId, 0, in vmw_cmd_dx_destroy_shader()
2699 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_shader()
2712 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_shader() argument
2722 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_dx_bind_shader()
2730 VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_bind_shader()
2744 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_bind_shader()
2751 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_shader()
2764 struct vmw_sw_context *sw_context, in vmw_cmd_dx_genmips() argument
2772 view = vmw_view_id_val_add(sw_context, vmw_view_sr, in vmw_cmd_dx_genmips()
2783 rcache = &sw_context->res_cache[vmw_res_surface]; in vmw_cmd_dx_genmips()
2784 vmw_validation_res_set_dirty(sw_context->ctx, rcache->private, in vmw_cmd_dx_genmips()
2798 struct vmw_sw_context *sw_context, in vmw_cmd_dx_transfer_from_buffer() argument
2805 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2811 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2824 struct vmw_sw_context *sw_context, in vmw_cmd_intra_surface_copy() argument
2833 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_intra_surface_copy()
2839 struct vmw_sw_context *sw_context, in vmw_cmd_sm5() argument
2849 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_define() argument
2855 return vmw_cmd_dx_view_define(dev_priv, sw_context, header); in vmw_cmd_sm5_view_define()
2859 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_remove() argument
2865 return vmw_cmd_dx_view_remove(dev_priv, sw_context, header); in vmw_cmd_sm5_view_remove()
2869 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_uint() argument
2881 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_uint()
2888 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_float() argument
2900 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_float()
2907 struct vmw_sw_context *sw_context, in vmw_cmd_set_uav() argument
2926 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_uav()
2932 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 0, in vmw_cmd_set_uav()
2939 struct vmw_sw_context *sw_context, in vmw_cmd_set_cs_uav() argument
2958 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_cs_uav()
2964 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 1, in vmw_cmd_set_cs_uav()
2971 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_streamoutput() argument
2974 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_define_streamoutput()
2995 return vmw_dx_streamoutput_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_streamoutput()
2997 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_streamoutput()
3001 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_streamoutput() argument
3004 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_destroy_streamoutput()
3032 return vmw_dx_streamoutput_remove(sw_context->man, cmd->body.soid, in vmw_cmd_dx_destroy_streamoutput()
3033 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_streamoutput()
3037 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_streamoutput() argument
3040 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_bind_streamoutput()
3065 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3072 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3078 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_streamoutput() argument
3081 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_set_streamoutput()
3115 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_set_streamoutput()
3127 vmw_binding_add(sw_context->dx_ctx_node->staged, &binding.bi, 0, in vmw_cmd_dx_set_streamoutput()
3134 struct vmw_sw_context *sw_context, in vmw_cmd_indexed_instanced_indirect() argument
3145 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_indexed_instanced_indirect()
3151 struct vmw_sw_context *sw_context, in vmw_cmd_instanced_indirect() argument
3162 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_instanced_indirect()
3168 struct vmw_sw_context *sw_context, in vmw_cmd_dispatch_indirect() argument
3179 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dispatch_indirect()
3185 struct vmw_sw_context *sw_context, in vmw_cmd_check_not_3d() argument
3216 if (unlikely(!sw_context->kernel)) { in vmw_cmd_check_not_3d()
3222 return vmw_cmd_check_define_gmrfb(dev_priv, sw_context, buf); in vmw_cmd_check_not_3d()
3612 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check() argument
3625 return vmw_cmd_check_not_3d(dev_priv, sw_context, buf, size); in vmw_cmd_check()
3642 if (unlikely(!entry->user_allow && !sw_context->kernel)) in vmw_cmd_check()
3651 ret = entry->func(dev_priv, sw_context, header); in vmw_cmd_check()
3678 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check_all() argument
3684 sw_context->buf_start = buf; in vmw_cmd_check_all()
3688 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); in vmw_cmd_check_all()
3703 static void vmw_free_relocations(struct vmw_sw_context *sw_context) in vmw_free_relocations() argument
3706 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_free_relocations()
3709 static void vmw_apply_relocations(struct vmw_sw_context *sw_context) in vmw_apply_relocations() argument
3714 list_for_each_entry(reloc, &sw_context->bo_relocations, head) { in vmw_apply_relocations()
3731 vmw_free_relocations(sw_context); in vmw_apply_relocations()
3734 static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, in vmw_resize_cmd_bounce() argument
3737 if (likely(sw_context->cmd_bounce_size >= size)) in vmw_resize_cmd_bounce()
3740 if (sw_context->cmd_bounce_size == 0) in vmw_resize_cmd_bounce()
3741 sw_context->cmd_bounce_size = VMWGFX_CMD_BOUNCE_INIT_SIZE; in vmw_resize_cmd_bounce()
3743 while (sw_context->cmd_bounce_size < size) { in vmw_resize_cmd_bounce()
3744 sw_context->cmd_bounce_size = in vmw_resize_cmd_bounce()
3745 PAGE_ALIGN(sw_context->cmd_bounce_size + in vmw_resize_cmd_bounce()
3746 (sw_context->cmd_bounce_size >> 1)); in vmw_resize_cmd_bounce()
3749 vfree(sw_context->cmd_bounce); in vmw_resize_cmd_bounce()
3750 sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); in vmw_resize_cmd_bounce()
3752 if (sw_context->cmd_bounce == NULL) { in vmw_resize_cmd_bounce()
3754 sw_context->cmd_bounce_size = 0; in vmw_resize_cmd_bounce()
3893 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_fifo() argument
3897 if (sw_context->dx_ctx_node) in vmw_execbuf_submit_fifo()
3899 sw_context->dx_ctx_node->ctx->id); in vmw_execbuf_submit_fifo()
3906 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_fifo()
3908 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3909 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3930 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_cmdbuf() argument
3932 u32 id = ((sw_context->dx_ctx_node) ? sw_context->dx_ctx_node->ctx->id : in vmw_execbuf_submit_cmdbuf()
3937 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_cmdbuf()
3938 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3939 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
4006 struct vmw_sw_context *sw_context, in vmw_execbuf_tie_context() argument
4017 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_execbuf_tie_context()
4022 (dev_priv, sw_context->fp->tfile, handle, in vmw_execbuf_tie_context()
4030 ret = vmw_execbuf_res_noref_val_add(sw_context, res, VMW_RES_DIRTY_SET); in vmw_execbuf_tie_context()
4034 sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); in vmw_execbuf_tie_context()
4035 sw_context->man = vmw_context_res_man(res); in vmw_execbuf_tie_context()
4048 struct vmw_sw_context *sw_context = &dev_priv->ctx; in vmw_execbuf_process() local
4055 DECLARE_VAL_CONTEXT(val_ctx, &sw_context->res_ht, 1); in vmw_execbuf_process()
4085 sw_context->kernel = false; in vmw_execbuf_process()
4087 ret = vmw_resize_cmd_bounce(sw_context, command_size); in vmw_execbuf_process()
4091 ret = copy_from_user(sw_context->cmd_bounce, user_commands, in vmw_execbuf_process()
4099 kernel_commands = sw_context->cmd_bounce; in vmw_execbuf_process()
4101 sw_context->kernel = true; in vmw_execbuf_process()
4104 sw_context->fp = vmw_fpriv(file_priv); in vmw_execbuf_process()
4105 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_process()
4106 sw_context->cur_query_bo = dev_priv->pinned_bo; in vmw_execbuf_process()
4107 sw_context->last_query_ctx = NULL; in vmw_execbuf_process()
4108 sw_context->needs_post_query_barrier = false; in vmw_execbuf_process()
4109 sw_context->dx_ctx_node = NULL; in vmw_execbuf_process()
4110 sw_context->dx_query_mob = NULL; in vmw_execbuf_process()
4111 sw_context->dx_query_ctx = NULL; in vmw_execbuf_process()
4112 memset(sw_context->res_cache, 0, sizeof(sw_context->res_cache)); in vmw_execbuf_process()
4113 INIT_LIST_HEAD(&sw_context->res_relocations); in vmw_execbuf_process()
4114 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_execbuf_process()
4116 if (sw_context->staged_bindings) in vmw_execbuf_process()
4117 vmw_binding_state_reset(sw_context->staged_bindings); in vmw_execbuf_process()
4119 if (!sw_context->res_ht_initialized) { in vmw_execbuf_process()
4120 ret = drm_ht_create(&sw_context->res_ht, VMW_RES_HT_ORDER); in vmw_execbuf_process()
4124 sw_context->res_ht_initialized = true; in vmw_execbuf_process()
4127 INIT_LIST_HEAD(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4128 sw_context->ctx = &val_ctx; in vmw_execbuf_process()
4129 ret = vmw_execbuf_tie_context(dev_priv, sw_context, dx_context_handle); in vmw_execbuf_process()
4133 ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, in vmw_execbuf_process()
4138 ret = vmw_resources_reserve(sw_context); in vmw_execbuf_process()
4163 ret = vmw_rebind_contexts(sw_context); in vmw_execbuf_process()
4170 command_size, sw_context); in vmw_execbuf_process()
4173 sw_context); in vmw_execbuf_process()
4180 vmw_query_bo_switch_commit(dev_priv, sw_context); in vmw_execbuf_process()
4191 vmw_execbuf_bindings_commit(sw_context, false); in vmw_execbuf_process()
4192 vmw_bind_dx_query_mob(sw_context); in vmw_execbuf_process()
4195 vmw_validation_bo_fence(sw_context->ctx, fence); in vmw_execbuf_process()
4233 vmw_cmdbuf_res_commit(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4249 vmw_execbuf_bindings_commit(sw_context, true); in vmw_execbuf_process()
4251 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_process()
4252 vmw_free_relocations(sw_context); in vmw_execbuf_process()
4256 vmw_cmdbuf_res_revert(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4258 WARN_ON(!list_empty(&sw_context->ctx_list)); in vmw_execbuf_process()