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->filp, handle); in vmw_translate_mob_ptr()
1179 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, true, false); in vmw_translate_mob_ptr()
1184 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_mob_ptr()
1192 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_mob_ptr()
1218 struct vmw_sw_context *sw_context, in vmw_translate_guest_ptr() argument
1227 vmw_validation_preload_bo(sw_context->ctx); in vmw_translate_guest_ptr()
1228 vmw_bo = vmw_user_bo_noref_lookup(sw_context->filp, handle); in vmw_translate_guest_ptr()
1233 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo, false, false); in vmw_translate_guest_ptr()
1238 reloc = vmw_validation_mem_alloc(sw_context->ctx, sizeof(*reloc)); in vmw_translate_guest_ptr()
1245 list_add_tail(&reloc->head, &sw_context->bo_relocations); in vmw_translate_guest_ptr()
1260 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_query() argument
1264 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_query()
1295 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_query() argument
1308 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_dx_bind_query()
1314 sw_context->dx_query_mob = vmw_bo; in vmw_cmd_dx_bind_query()
1315 sw_context->dx_query_ctx = sw_context->dx_ctx_node->ctx; in vmw_cmd_dx_bind_query()
1327 struct vmw_sw_context *sw_context, in vmw_cmd_begin_gb_query() argument
1333 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_gb_query()
1346 struct vmw_sw_context *sw_context, in vmw_cmd_begin_query() argument
1363 return vmw_cmd_begin_gb_query(dev_priv, sw_context, header); in vmw_cmd_begin_query()
1366 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_begin_query()
1379 struct vmw_sw_context *sw_context, in vmw_cmd_end_gb_query() argument
1387 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_gb_query()
1391 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_end_gb_query()
1396 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_gb_query()
1409 struct vmw_sw_context *sw_context, in vmw_cmd_end_query() argument
1430 return vmw_cmd_end_gb_query(dev_priv, sw_context, header); in vmw_cmd_end_query()
1433 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_end_query()
1437 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_end_query()
1442 ret = vmw_query_bo_switch_prepare(dev_priv, vmw_bo, sw_context); in vmw_cmd_end_query()
1455 struct vmw_sw_context *sw_context, in vmw_cmd_wait_gb_query() argument
1463 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_gb_query()
1467 ret = vmw_translate_mob_ptr(dev_priv, sw_context, &cmd->body.mobid, in vmw_cmd_wait_gb_query()
1483 struct vmw_sw_context *sw_context, in vmw_cmd_wait_query() argument
1504 return vmw_cmd_wait_gb_query(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1507 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_wait_query()
1511 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_wait_query()
1520 struct vmw_sw_context *sw_context, in vmw_cmd_dma() argument
1541 ret = vmw_translate_guest_ptr(dev_priv, sw_context, in vmw_cmd_dma()
1559 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dma()
1568 srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res); in vmw_cmd_dma()
1570 vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->base, header); in vmw_cmd_dma()
1576 struct vmw_sw_context *sw_context, in vmw_cmd_draw() argument
1587 ret = vmw_cmd_cid_check(dev_priv, sw_context, header); in vmw_cmd_draw()
1600 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1617 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_draw()
1628 struct vmw_sw_context *sw_context, in vmw_cmd_tex_state() argument
1642 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_tex_state()
1658 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_tex_state()
1669 node = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_tex_state()
1686 struct vmw_sw_context *sw_context, in vmw_cmd_check_define_gmrfb() argument
1696 return vmw_translate_guest_ptr(dev_priv, sw_context, &cmd->body.ptr, in vmw_cmd_check_define_gmrfb()
1716 struct vmw_sw_context *sw_context, in vmw_cmd_res_switch_backup() argument
1724 info = vmw_execbuf_info_from_res(sw_context, res); in vmw_cmd_res_switch_backup()
1728 ret = vmw_translate_mob_ptr(dev_priv, sw_context, buf_id, &vbo); in vmw_cmd_res_switch_backup()
1732 vmw_validation_res_switch_backup(sw_context->ctx, info, vbo, in vmw_cmd_res_switch_backup()
1754 struct vmw_sw_context *sw_context, in vmw_cmd_switch_backup() argument
1763 ret = vmw_cmd_res_check(dev_priv, sw_context, res_type, in vmw_cmd_switch_backup()
1768 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, buf_id, in vmw_cmd_switch_backup()
1780 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_surface() argument
1786 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_bind_gb_surface()
1799 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_image() argument
1805 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_image()
1818 struct vmw_sw_context *sw_context, in vmw_cmd_update_gb_surface() argument
1824 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_update_gb_surface()
1837 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_image() argument
1843 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_image()
1857 struct vmw_sw_context *sw_context, in vmw_cmd_readback_gb_surface() argument
1863 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_readback_gb_surface()
1877 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_image() argument
1883 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_image()
1897 struct vmw_sw_context *sw_context, in vmw_cmd_invalidate_gb_surface() argument
1903 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_invalidate_gb_surface()
1916 struct vmw_sw_context *sw_context, in vmw_cmd_shader_define() argument
1926 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_define()
1938 size, &sw_context->staged_cmd_res); in vmw_cmd_shader_define()
1942 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_define()
1943 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_define()
1956 struct vmw_sw_context *sw_context, in vmw_cmd_shader_destroy() argument
1965 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_shader_destroy()
1975 cmd->body.type, &sw_context->staged_cmd_res); in vmw_cmd_shader_destroy()
1979 return vmw_resource_relocation_add(sw_context, NULL, in vmw_cmd_shader_destroy()
1980 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_shader_destroy()
1993 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader() argument
2010 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader()
2028 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_set_shader()
2034 (sw_context, res, in vmw_cmd_set_shader()
2035 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_set_shader()
2044 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_set_shader()
2052 ctx_info = vmw_execbuf_info_from_res(sw_context, ctx); in vmw_cmd_set_shader()
2073 struct vmw_sw_context *sw_context, in vmw_cmd_set_shader_const() argument
2081 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_set_shader_const()
2101 struct vmw_sw_context *sw_context, in vmw_cmd_bind_gb_shader() argument
2107 return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader, in vmw_cmd_bind_gb_shader()
2122 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_single_constant_buffer() argument
2130 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_single_constant_buffer()
2138 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_single_constant_buffer()
2176 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_constant_buffer_offset() argument
2181 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_constant_buffer_offset()
2213 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader_res() argument
2231 return vmw_view_bindings_add(sw_context, vmw_view_sr, in vmw_cmd_dx_set_shader_res()
2246 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_shader() argument
2253 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_shader()
2270 res = vmw_shader_lookup(sw_context->man, cmd->body.shaderId, 0); in vmw_cmd_dx_set_shader()
2276 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_set_shader()
2301 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_vertex_buffers() argument
2304 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_vertex_buffers()
2327 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_vertex_buffers()
2356 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_index_buffer() argument
2359 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_index_buffer()
2369 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_index_buffer()
2395 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_rendertargets() argument
2409 ret = vmw_view_bindings_add(sw_context, vmw_view_ds, vmw_ctx_binding_ds, in vmw_cmd_dx_set_rendertargets()
2414 return vmw_view_bindings_add(sw_context, vmw_view_rt, in vmw_cmd_dx_set_rendertargets()
2428 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_rendertarget_view() argument
2435 ret = vmw_view_id_val_add(sw_context, vmw_view_rt, in vmw_cmd_dx_clear_rendertarget_view()
2450 struct vmw_sw_context *sw_context, in vmw_cmd_dx_clear_depthstencil_view() argument
2457 ret = vmw_view_id_val_add(sw_context, vmw_view_ds, in vmw_cmd_dx_clear_depthstencil_view()
2464 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_define() argument
2467 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_define()
2494 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_view_define()
2505 return vmw_view_add(sw_context->man, ctx_node->ctx, srf, view_type, in vmw_cmd_dx_view_define()
2508 &sw_context->staged_cmd_res); in vmw_cmd_dx_view_define()
2519 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_so_targets() argument
2522 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_set_so_targets()
2544 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_set_so_targets()
2565 struct vmw_sw_context *sw_context, in vmw_cmd_dx_so_define() argument
2568 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_so_define()
2603 struct vmw_sw_context *sw_context, in vmw_cmd_dx_check_subresource() argument
2624 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_check_subresource()
2630 struct vmw_sw_context *sw_context, in vmw_cmd_dx_cid_check() argument
2633 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_cid_check()
2653 struct vmw_sw_context *sw_context, in vmw_cmd_dx_view_remove() argument
2656 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_view_remove()
2668 ret = vmw_view_remove(sw_context->man, cmd->body.view_id, view_type, in vmw_cmd_dx_view_remove()
2669 &sw_context->staged_cmd_res, &view); in vmw_cmd_dx_view_remove()
2679 return vmw_resource_relocation_add(sw_context, view, in vmw_cmd_dx_view_remove()
2680 vmw_ptr_diff(sw_context->buf_start, in vmw_cmd_dx_view_remove()
2693 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_shader() argument
2696 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_define_shader()
2710 return vmw_dx_shader_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_shader()
2712 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_shader()
2723 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_shader() argument
2726 struct vmw_ctx_validation_info *ctx_node = VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_destroy_shader()
2734 ret = vmw_shader_remove(sw_context->man, cmd->body.shaderId, 0, in vmw_cmd_dx_destroy_shader()
2735 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_shader()
2748 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_shader() argument
2758 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context, in vmw_cmd_dx_bind_shader()
2766 VMW_GET_CTX_NODE(sw_context); in vmw_cmd_dx_bind_shader()
2780 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_bind_shader()
2787 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_shader()
2800 struct vmw_sw_context *sw_context, in vmw_cmd_dx_genmips() argument
2808 view = vmw_view_id_val_add(sw_context, vmw_view_sr, in vmw_cmd_dx_genmips()
2819 rcache = &sw_context->res_cache[vmw_res_surface]; in vmw_cmd_dx_genmips()
2820 vmw_validation_res_set_dirty(sw_context->ctx, rcache->private, in vmw_cmd_dx_genmips()
2834 struct vmw_sw_context *sw_context, in vmw_cmd_dx_transfer_from_buffer() argument
2841 ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2847 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dx_transfer_from_buffer()
2860 struct vmw_sw_context *sw_context, in vmw_cmd_intra_surface_copy() argument
2869 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_intra_surface_copy()
2875 struct vmw_sw_context *sw_context, in vmw_cmd_sm5() argument
2885 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_define() argument
2891 return vmw_cmd_dx_view_define(dev_priv, sw_context, header); in vmw_cmd_sm5_view_define()
2895 struct vmw_sw_context *sw_context, in vmw_cmd_sm5_view_remove() argument
2901 return vmw_cmd_dx_view_remove(dev_priv, sw_context, header); in vmw_cmd_sm5_view_remove()
2905 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_uint() argument
2917 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_uint()
2924 struct vmw_sw_context *sw_context, in vmw_cmd_clear_uav_float() argument
2936 ret = vmw_view_id_val_add(sw_context, vmw_view_ua, in vmw_cmd_clear_uav_float()
2943 struct vmw_sw_context *sw_context, in vmw_cmd_set_uav() argument
2962 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_uav()
2968 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 0, in vmw_cmd_set_uav()
2975 struct vmw_sw_context *sw_context, in vmw_cmd_set_cs_uav() argument
2994 ret = vmw_view_bindings_add(sw_context, vmw_view_ua, in vmw_cmd_set_cs_uav()
3000 vmw_binding_add_uav_index(sw_context->dx_ctx_node->staged, 1, in vmw_cmd_set_cs_uav()
3007 struct vmw_sw_context *sw_context, in vmw_cmd_dx_define_streamoutput() argument
3010 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_define_streamoutput()
3031 return vmw_dx_streamoutput_add(sw_context->man, ctx_node->ctx, in vmw_cmd_dx_define_streamoutput()
3033 &sw_context->staged_cmd_res); in vmw_cmd_dx_define_streamoutput()
3037 struct vmw_sw_context *sw_context, in vmw_cmd_dx_destroy_streamoutput() argument
3040 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_destroy_streamoutput()
3068 return vmw_dx_streamoutput_remove(sw_context->man, cmd->body.soid, in vmw_cmd_dx_destroy_streamoutput()
3069 &sw_context->staged_cmd_res); in vmw_cmd_dx_destroy_streamoutput()
3073 struct vmw_sw_context *sw_context, in vmw_cmd_dx_bind_streamoutput() argument
3076 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_bind_streamoutput()
3101 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3108 return vmw_cmd_res_switch_backup(dev_priv, sw_context, res, in vmw_cmd_dx_bind_streamoutput()
3114 struct vmw_sw_context *sw_context, in vmw_cmd_dx_set_streamoutput() argument
3117 struct vmw_ctx_validation_info *ctx_node = sw_context->dx_ctx_node; in vmw_cmd_dx_set_streamoutput()
3151 ret = vmw_execbuf_res_noctx_val_add(sw_context, res, in vmw_cmd_dx_set_streamoutput()
3163 vmw_binding_add(sw_context->dx_ctx_node->staged, &binding.bi, 0, in vmw_cmd_dx_set_streamoutput()
3170 struct vmw_sw_context *sw_context, in vmw_cmd_indexed_instanced_indirect() argument
3181 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_indexed_instanced_indirect()
3187 struct vmw_sw_context *sw_context, in vmw_cmd_instanced_indirect() argument
3198 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_instanced_indirect()
3204 struct vmw_sw_context *sw_context, in vmw_cmd_dispatch_indirect() argument
3215 return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, in vmw_cmd_dispatch_indirect()
3221 struct vmw_sw_context *sw_context, in vmw_cmd_check_not_3d() argument
3252 if (unlikely(!sw_context->kernel)) { in vmw_cmd_check_not_3d()
3258 return vmw_cmd_check_define_gmrfb(dev_priv, sw_context, buf); in vmw_cmd_check_not_3d()
3668 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check() argument
3681 return vmw_cmd_check_not_3d(dev_priv, sw_context, buf, size); in vmw_cmd_check()
3698 if (unlikely(!entry->user_allow && !sw_context->kernel)) in vmw_cmd_check()
3707 ret = entry->func(dev_priv, sw_context, header); in vmw_cmd_check()
3734 struct vmw_sw_context *sw_context, void *buf, in vmw_cmd_check_all() argument
3740 sw_context->buf_start = buf; in vmw_cmd_check_all()
3744 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); in vmw_cmd_check_all()
3759 static void vmw_free_relocations(struct vmw_sw_context *sw_context) in vmw_free_relocations() argument
3762 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_free_relocations()
3765 static void vmw_apply_relocations(struct vmw_sw_context *sw_context) in vmw_apply_relocations() argument
3770 list_for_each_entry(reloc, &sw_context->bo_relocations, head) { in vmw_apply_relocations()
3787 vmw_free_relocations(sw_context); in vmw_apply_relocations()
3790 static int vmw_resize_cmd_bounce(struct vmw_sw_context *sw_context, in vmw_resize_cmd_bounce() argument
3793 if (likely(sw_context->cmd_bounce_size >= size)) in vmw_resize_cmd_bounce()
3796 if (sw_context->cmd_bounce_size == 0) in vmw_resize_cmd_bounce()
3797 sw_context->cmd_bounce_size = VMWGFX_CMD_BOUNCE_INIT_SIZE; in vmw_resize_cmd_bounce()
3799 while (sw_context->cmd_bounce_size < size) { in vmw_resize_cmd_bounce()
3800 sw_context->cmd_bounce_size = in vmw_resize_cmd_bounce()
3801 PAGE_ALIGN(sw_context->cmd_bounce_size + in vmw_resize_cmd_bounce()
3802 (sw_context->cmd_bounce_size >> 1)); in vmw_resize_cmd_bounce()
3805 vfree(sw_context->cmd_bounce); in vmw_resize_cmd_bounce()
3806 sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size); in vmw_resize_cmd_bounce()
3808 if (sw_context->cmd_bounce == NULL) { in vmw_resize_cmd_bounce()
3810 sw_context->cmd_bounce_size = 0; in vmw_resize_cmd_bounce()
3942 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_fifo() argument
3946 if (sw_context->dx_ctx_node) in vmw_execbuf_submit_fifo()
3948 sw_context->dx_ctx_node->ctx->id); in vmw_execbuf_submit_fifo()
3955 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_fifo()
3957 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3958 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_fifo()
3979 struct vmw_sw_context *sw_context) in vmw_execbuf_submit_cmdbuf() argument
3981 u32 id = ((sw_context->dx_ctx_node) ? sw_context->dx_ctx_node->ctx->id : in vmw_execbuf_submit_cmdbuf()
3986 vmw_apply_relocations(sw_context); in vmw_execbuf_submit_cmdbuf()
3987 vmw_resource_relocations_apply(cmd, &sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
3988 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_submit_cmdbuf()
4055 struct vmw_sw_context *sw_context, in vmw_execbuf_tie_context() argument
4066 ret = vmw_validation_preload_res(sw_context->ctx, size); in vmw_execbuf_tie_context()
4071 (dev_priv, sw_context->fp->tfile, handle, in vmw_execbuf_tie_context()
4079 ret = vmw_execbuf_res_noref_val_add(sw_context, res, VMW_RES_DIRTY_SET); in vmw_execbuf_tie_context()
4083 sw_context->dx_ctx_node = vmw_execbuf_info_from_res(sw_context, res); in vmw_execbuf_tie_context()
4084 sw_context->man = vmw_context_res_man(res); in vmw_execbuf_tie_context()
4097 struct vmw_sw_context *sw_context = &dev_priv->ctx; in vmw_execbuf_process() local
4104 DECLARE_VAL_CONTEXT(val_ctx, &sw_context->res_ht, 1); in vmw_execbuf_process()
4132 sw_context->kernel = false; in vmw_execbuf_process()
4134 ret = vmw_resize_cmd_bounce(sw_context, command_size); in vmw_execbuf_process()
4138 ret = copy_from_user(sw_context->cmd_bounce, user_commands, in vmw_execbuf_process()
4146 kernel_commands = sw_context->cmd_bounce; in vmw_execbuf_process()
4148 sw_context->kernel = true; in vmw_execbuf_process()
4151 sw_context->filp = file_priv; in vmw_execbuf_process()
4152 sw_context->fp = vmw_fpriv(file_priv); in vmw_execbuf_process()
4153 INIT_LIST_HEAD(&sw_context->ctx_list); in vmw_execbuf_process()
4154 sw_context->cur_query_bo = dev_priv->pinned_bo; in vmw_execbuf_process()
4155 sw_context->last_query_ctx = NULL; in vmw_execbuf_process()
4156 sw_context->needs_post_query_barrier = false; in vmw_execbuf_process()
4157 sw_context->dx_ctx_node = NULL; in vmw_execbuf_process()
4158 sw_context->dx_query_mob = NULL; in vmw_execbuf_process()
4159 sw_context->dx_query_ctx = NULL; in vmw_execbuf_process()
4160 memset(sw_context->res_cache, 0, sizeof(sw_context->res_cache)); in vmw_execbuf_process()
4161 INIT_LIST_HEAD(&sw_context->res_relocations); in vmw_execbuf_process()
4162 INIT_LIST_HEAD(&sw_context->bo_relocations); in vmw_execbuf_process()
4164 if (sw_context->staged_bindings) in vmw_execbuf_process()
4165 vmw_binding_state_reset(sw_context->staged_bindings); in vmw_execbuf_process()
4167 if (!sw_context->res_ht_initialized) { in vmw_execbuf_process()
4168 ret = vmwgfx_ht_create(&sw_context->res_ht, VMW_RES_HT_ORDER); in vmw_execbuf_process()
4172 sw_context->res_ht_initialized = true; in vmw_execbuf_process()
4175 INIT_LIST_HEAD(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4176 sw_context->ctx = &val_ctx; in vmw_execbuf_process()
4177 ret = vmw_execbuf_tie_context(dev_priv, sw_context, dx_context_handle); in vmw_execbuf_process()
4181 ret = vmw_cmd_check_all(dev_priv, sw_context, kernel_commands, in vmw_execbuf_process()
4186 ret = vmw_resources_reserve(sw_context); in vmw_execbuf_process()
4211 ret = vmw_rebind_contexts(sw_context); in vmw_execbuf_process()
4218 command_size, sw_context); in vmw_execbuf_process()
4221 sw_context); in vmw_execbuf_process()
4228 vmw_query_bo_switch_commit(dev_priv, sw_context); in vmw_execbuf_process()
4239 vmw_execbuf_bindings_commit(sw_context, false); in vmw_execbuf_process()
4240 vmw_bind_dx_query_mob(sw_context); in vmw_execbuf_process()
4243 vmw_validation_bo_fence(sw_context->ctx, fence); in vmw_execbuf_process()
4288 vmw_cmdbuf_res_commit(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4304 vmw_execbuf_bindings_commit(sw_context, true); in vmw_execbuf_process()
4306 vmw_resource_relocations_free(&sw_context->res_relocations); in vmw_execbuf_process()
4307 vmw_free_relocations(sw_context); in vmw_execbuf_process()
4311 vmw_cmdbuf_res_revert(&sw_context->staged_cmd_res); in vmw_execbuf_process()
4313 WARN_ON(!list_empty(&sw_context->ctx_list)); in vmw_execbuf_process()