Lines Matching refs:cbs
125 static int vmw_binding_emit_dirty(struct vmw_ctx_binding_state *cbs);
284 vmw_cbs_context(const struct vmw_ctx_binding_state *cbs) in vmw_cbs_context() argument
286 if (list_empty(&cbs->list)) in vmw_cbs_context()
289 return list_first_entry(&cbs->list, struct vmw_ctx_bindinfo, in vmw_cbs_context()
302 vmw_binding_loc(struct vmw_ctx_binding_state *cbs, in vmw_binding_loc() argument
308 return (struct vmw_ctx_bindinfo *)((u8 *) cbs + offset); in vmw_binding_loc()
339 void vmw_binding_add(struct vmw_ctx_binding_state *cbs, in vmw_binding_add() argument
344 vmw_binding_loc(cbs, bi->bt, shader_slot, slot); in vmw_binding_add()
352 list_add(&loc->ctx_list, &cbs->list); in vmw_binding_add()
362 void vmw_binding_add_uav_index(struct vmw_ctx_binding_state *cbs, uint32 slot, in vmw_binding_add_uav_index() argument
365 cbs->ua_views[slot].index = index; in vmw_binding_add_uav_index()
376 static void vmw_binding_transfer(struct vmw_ctx_binding_state *cbs, in vmw_binding_transfer() argument
382 ((unsigned long) cbs + offset); in vmw_binding_transfer()
392 list_add_tail(&loc->ctx_list, &cbs->list); in vmw_binding_transfer()
406 void vmw_binding_state_kill(struct vmw_ctx_binding_state *cbs) in vmw_binding_state_kill() argument
410 vmw_binding_state_scrub(cbs); in vmw_binding_state_kill()
411 list_for_each_entry_safe(entry, next, &cbs->list, ctx_list) in vmw_binding_state_kill()
424 void vmw_binding_state_scrub(struct vmw_ctx_binding_state *cbs) in vmw_binding_state_scrub() argument
428 list_for_each_entry(entry, &cbs->list, ctx_list) { in vmw_binding_state_scrub()
436 (void) vmw_binding_emit_dirty(cbs); in vmw_binding_state_scrub()
479 struct vmw_ctx_binding_state *cbs = in vmw_binding_res_list_scrub() local
482 (void) vmw_binding_emit_dirty(cbs); in vmw_binding_res_list_scrub()
521 int vmw_binding_rebind_all(struct vmw_ctx_binding_state *cbs) in vmw_binding_rebind_all() argument
526 list_for_each_entry(entry, &cbs->list, ctx_list) { in vmw_binding_rebind_all()
541 return vmw_binding_emit_dirty(cbs); in vmw_binding_rebind_all()
727 static void vmw_collect_view_ids(struct vmw_ctx_binding_state *cbs, in vmw_collect_view_ids() argument
733 cbs->bind_cmd_count = 0; in vmw_collect_view_ids()
734 cbs->bind_first_slot = 0; in vmw_collect_view_ids()
740 cbs->bind_cmd_buffer[cbs->bind_cmd_count++] = in vmw_collect_view_ids()
760 static void vmw_collect_dirty_view_ids(struct vmw_ctx_binding_state *cbs, in vmw_collect_dirty_view_ids() argument
769 cbs->bind_cmd_count = 0; in vmw_collect_dirty_view_ids()
772 cbs->bind_first_slot = i; in vmw_collect_dirty_view_ids()
776 cbs->bind_cmd_buffer[cbs->bind_cmd_count++] = in vmw_collect_dirty_view_ids()
794 static int vmw_emit_set_sr(struct vmw_ctx_binding_state *cbs, in vmw_emit_set_sr() argument
798 &cbs->per_shader[shader_slot].shader_res[0].bi; in vmw_emit_set_sr()
804 const struct vmw_resource *ctx = vmw_cbs_context(cbs); in vmw_emit_set_sr()
806 vmw_collect_dirty_view_ids(cbs, loc, in vmw_emit_set_sr()
807 cbs->per_shader[shader_slot].dirty_sr, in vmw_emit_set_sr()
809 if (cbs->bind_cmd_count == 0) in vmw_emit_set_sr()
812 view_id_size = cbs->bind_cmd_count*sizeof(uint32); in vmw_emit_set_sr()
821 cmd->body.startView = cbs->bind_first_slot; in vmw_emit_set_sr()
823 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size); in vmw_emit_set_sr()
826 bitmap_clear(cbs->per_shader[shader_slot].dirty_sr, in vmw_emit_set_sr()
827 cbs->bind_first_slot, cbs->bind_cmd_count); in vmw_emit_set_sr()
837 static int vmw_emit_set_rt(struct vmw_ctx_binding_state *cbs) in vmw_emit_set_rt() argument
839 const struct vmw_ctx_bindinfo_view *loc = &cbs->render_targets[0]; in vmw_emit_set_rt()
845 const struct vmw_resource *ctx = vmw_cbs_context(cbs); in vmw_emit_set_rt()
847 vmw_collect_view_ids(cbs, loc, SVGA3D_DX_MAX_RENDER_TARGETS); in vmw_emit_set_rt()
848 view_id_size = cbs->bind_cmd_count*sizeof(uint32); in vmw_emit_set_rt()
857 if (cbs->ds_view.bi.ctx && !cbs->ds_view.bi.scrubbed) in vmw_emit_set_rt()
858 cmd->body.depthStencilViewId = cbs->ds_view.bi.res->id; in vmw_emit_set_rt()
862 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size); in vmw_emit_set_rt()
884 static void vmw_collect_so_targets(struct vmw_ctx_binding_state *cbs, in vmw_collect_so_targets() argument
889 SVGA3dSoTarget *so_buffer = (SVGA3dSoTarget *) cbs->bind_cmd_buffer; in vmw_collect_so_targets()
891 cbs->bind_cmd_count = 0; in vmw_collect_so_targets()
892 cbs->bind_first_slot = 0; in vmw_collect_so_targets()
895 ++cbs->bind_cmd_count) { in vmw_collect_so_targets()
916 static int vmw_emit_set_so_target(struct vmw_ctx_binding_state *cbs) in vmw_emit_set_so_target() argument
918 const struct vmw_ctx_bindinfo_so_target *loc = &cbs->so_targets[0]; in vmw_emit_set_so_target()
924 const struct vmw_resource *ctx = vmw_cbs_context(cbs); in vmw_emit_set_so_target()
926 vmw_collect_so_targets(cbs, loc, SVGA3D_DX_MAX_SOTARGETS); in vmw_emit_set_so_target()
927 if (cbs->bind_cmd_count == 0) in vmw_emit_set_so_target()
930 so_target_size = cbs->bind_cmd_count*sizeof(SVGA3dSoTarget); in vmw_emit_set_so_target()
938 memcpy(&cmd[1], cbs->bind_cmd_buffer, so_target_size); in vmw_emit_set_so_target()
952 static int vmw_binding_emit_dirty_ps(struct vmw_ctx_binding_state *cbs) in vmw_binding_emit_dirty_ps() argument
954 struct vmw_dx_shader_bindings *sb = &cbs->per_shader[0]; in vmw_binding_emit_dirty_ps()
962 ret = vmw_emit_set_sr(cbs, i); in vmw_binding_emit_dirty_ps()
987 static void vmw_collect_dirty_vbs(struct vmw_ctx_binding_state *cbs, in vmw_collect_dirty_vbs() argument
995 SVGA3dVertexBuffer *vbs = (SVGA3dVertexBuffer *) &cbs->bind_cmd_buffer; in vmw_collect_dirty_vbs()
997 cbs->bind_cmd_count = 0; in vmw_collect_dirty_vbs()
1000 cbs->bind_first_slot = i; in vmw_collect_dirty_vbs()
1013 cbs->bind_cmd_count++; in vmw_collect_dirty_vbs()
1028 static int vmw_emit_set_vb(struct vmw_ctx_binding_state *cbs) in vmw_emit_set_vb() argument
1031 &cbs->vertex_buffers[0].bi; in vmw_emit_set_vb()
1037 const struct vmw_resource *ctx = vmw_cbs_context(cbs); in vmw_emit_set_vb()
1039 vmw_collect_dirty_vbs(cbs, loc, cbs->dirty_vb, in vmw_emit_set_vb()
1041 if (cbs->bind_cmd_count == 0) in vmw_emit_set_vb()
1044 set_vb_size = cbs->bind_cmd_count*sizeof(SVGA3dVertexBuffer); in vmw_emit_set_vb()
1052 cmd->body.startBuffer = cbs->bind_first_slot; in vmw_emit_set_vb()
1054 memcpy(&cmd[1], cbs->bind_cmd_buffer, set_vb_size); in vmw_emit_set_vb()
1057 bitmap_clear(cbs->dirty_vb, in vmw_emit_set_vb()
1058 cbs->bind_first_slot, cbs->bind_cmd_count); in vmw_emit_set_vb()
1063 static int vmw_emit_set_uav(struct vmw_ctx_binding_state *cbs) in vmw_emit_set_uav() argument
1065 const struct vmw_ctx_bindinfo_view *loc = &cbs->ua_views[0].views[0]; in vmw_emit_set_uav()
1071 const struct vmw_resource *ctx = vmw_cbs_context(cbs); in vmw_emit_set_uav()
1073 vmw_collect_view_ids(cbs, loc, SVGA3D_MAX_UAVIEWS); in vmw_emit_set_uav()
1074 view_id_size = cbs->bind_cmd_count*sizeof(uint32); in vmw_emit_set_uav()
1084 cmd->body.uavSpliceIndex = cbs->ua_views[0].index; in vmw_emit_set_uav()
1086 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size); in vmw_emit_set_uav()
1093 static int vmw_emit_set_cs_uav(struct vmw_ctx_binding_state *cbs) in vmw_emit_set_cs_uav() argument
1095 const struct vmw_ctx_bindinfo_view *loc = &cbs->ua_views[1].views[0]; in vmw_emit_set_cs_uav()
1101 const struct vmw_resource *ctx = vmw_cbs_context(cbs); in vmw_emit_set_cs_uav()
1103 vmw_collect_view_ids(cbs, loc, SVGA3D_MAX_UAVIEWS); in vmw_emit_set_cs_uav()
1104 view_id_size = cbs->bind_cmd_count*sizeof(uint32); in vmw_emit_set_cs_uav()
1114 cmd->body.startIndex = cbs->ua_views[1].index; in vmw_emit_set_cs_uav()
1116 memcpy(&cmd[1], cbs->bind_cmd_buffer, view_id_size); in vmw_emit_set_cs_uav()
1133 static int vmw_binding_emit_dirty(struct vmw_ctx_binding_state *cbs) in vmw_binding_emit_dirty() argument
1138 while ((hit = find_next_bit(&cbs->dirty, VMW_BINDING_NUM_BITS, hit)) in vmw_binding_emit_dirty()
1143 ret = vmw_emit_set_rt(cbs); in vmw_binding_emit_dirty()
1146 ret = vmw_binding_emit_dirty_ps(cbs); in vmw_binding_emit_dirty()
1149 ret = vmw_emit_set_so_target(cbs); in vmw_binding_emit_dirty()
1152 ret = vmw_emit_set_vb(cbs); in vmw_binding_emit_dirty()
1155 ret = vmw_emit_set_uav(cbs); in vmw_binding_emit_dirty()
1158 ret = vmw_emit_set_cs_uav(cbs); in vmw_binding_emit_dirty()
1166 __clear_bit(hit, &cbs->dirty); in vmw_binding_emit_dirty()
1184 struct vmw_ctx_binding_state *cbs = in vmw_binding_scrub_sr() local
1187 __set_bit(biv->slot, cbs->per_shader[biv->shader_slot].dirty_sr); in vmw_binding_scrub_sr()
1189 &cbs->per_shader[biv->shader_slot].dirty); in vmw_binding_scrub_sr()
1190 __set_bit(VMW_BINDING_PS_BIT, &cbs->dirty); in vmw_binding_scrub_sr()
1204 struct vmw_ctx_binding_state *cbs = in vmw_binding_scrub_dx_rt() local
1207 __set_bit(VMW_BINDING_RT_BIT, &cbs->dirty); in vmw_binding_scrub_dx_rt()
1221 struct vmw_ctx_binding_state *cbs = in vmw_binding_scrub_so_target() local
1224 __set_bit(VMW_BINDING_SO_T_BIT, &cbs->dirty); in vmw_binding_scrub_so_target()
1240 struct vmw_ctx_binding_state *cbs = in vmw_binding_scrub_vb() local
1243 __set_bit(bivb->slot, cbs->dirty_vb); in vmw_binding_scrub_vb()
1244 __set_bit(VMW_BINDING_VB_BIT, &cbs->dirty); in vmw_binding_scrub_vb()
1288 struct vmw_ctx_binding_state *cbs = vmw_context_binding_state(bi->ctx); in vmw_binding_scrub_uav() local
1290 __set_bit(VMW_BINDING_UAV_BIT, &cbs->dirty); in vmw_binding_scrub_uav()
1296 struct vmw_ctx_binding_state *cbs = vmw_context_binding_state(bi->ctx); in vmw_binding_scrub_cs_uav() local
1298 __set_bit(VMW_BINDING_CS_UAV_BIT, &cbs->dirty); in vmw_binding_scrub_cs_uav()
1340 struct vmw_ctx_binding_state *cbs; in vmw_binding_state_alloc() local
1347 ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), sizeof(*cbs), in vmw_binding_state_alloc()
1352 cbs = vzalloc(sizeof(*cbs)); in vmw_binding_state_alloc()
1353 if (!cbs) { in vmw_binding_state_alloc()
1354 ttm_mem_global_free(vmw_mem_glob(dev_priv), sizeof(*cbs)); in vmw_binding_state_alloc()
1358 cbs->dev_priv = dev_priv; in vmw_binding_state_alloc()
1359 INIT_LIST_HEAD(&cbs->list); in vmw_binding_state_alloc()
1361 return cbs; in vmw_binding_state_alloc()
1370 void vmw_binding_state_free(struct vmw_ctx_binding_state *cbs) in vmw_binding_state_free() argument
1372 struct vmw_private *dev_priv = cbs->dev_priv; in vmw_binding_state_free()
1374 vfree(cbs); in vmw_binding_state_free()
1375 ttm_mem_global_free(vmw_mem_glob(dev_priv), sizeof(*cbs)); in vmw_binding_state_free()
1387 struct list_head *vmw_binding_state_list(struct vmw_ctx_binding_state *cbs) in vmw_binding_state_list() argument
1389 return &cbs->list; in vmw_binding_state_list()
1400 void vmw_binding_state_reset(struct vmw_ctx_binding_state *cbs) in vmw_binding_state_reset() argument
1404 list_for_each_entry_safe(entry, next, &cbs->list, ctx_list) in vmw_binding_state_reset()