.. | .. |
---|
80 | 80 | {1, sizeof(SVGACOTableDXDepthStencilEntry), NULL}, |
---|
81 | 81 | {1, sizeof(SVGACOTableDXRasterizerStateEntry), NULL}, |
---|
82 | 82 | {1, sizeof(SVGACOTableDXSamplerEntry), NULL}, |
---|
83 | | - {1, sizeof(SVGACOTableDXStreamOutputEntry), NULL}, |
---|
| 83 | + {1, sizeof(SVGACOTableDXStreamOutputEntry), &vmw_dx_streamoutput_cotable_list_scrub}, |
---|
84 | 84 | {1, sizeof(SVGACOTableDXQueryEntry), NULL}, |
---|
85 | | - {1, sizeof(SVGACOTableDXShaderEntry), &vmw_dx_shader_cotable_list_scrub} |
---|
| 85 | + {1, sizeof(SVGACOTableDXShaderEntry), &vmw_dx_shader_cotable_list_scrub}, |
---|
| 86 | + {1, sizeof(SVGACOTableDXUAViewEntry), &vmw_view_cotable_list_destroy} |
---|
86 | 87 | }; |
---|
87 | 88 | |
---|
88 | 89 | /* |
---|
.. | .. |
---|
102 | 103 | SVGA_COTABLE_SAMPLER, |
---|
103 | 104 | SVGA_COTABLE_STREAMOUTPUT, |
---|
104 | 105 | SVGA_COTABLE_DXQUERY, |
---|
| 106 | + SVGA_COTABLE_UAVIEW, |
---|
105 | 107 | }; |
---|
106 | 108 | |
---|
107 | 109 | static int vmw_cotable_bind(struct vmw_resource *res, |
---|
.. | .. |
---|
116 | 118 | .res_type = vmw_res_cotable, |
---|
117 | 119 | .needs_backup = true, |
---|
118 | 120 | .may_evict = true, |
---|
| 121 | + .prio = 3, |
---|
| 122 | + .dirty_prio = 3, |
---|
119 | 123 | .type_name = "context guest backed object tables", |
---|
120 | 124 | .backup_placement = &vmw_mob_placement, |
---|
121 | 125 | .create = vmw_cotable_create, |
---|
.. | .. |
---|
169 | 173 | } *cmd; |
---|
170 | 174 | |
---|
171 | 175 | WARN_ON_ONCE(bo->mem.mem_type != VMW_PL_MOB); |
---|
172 | | - lockdep_assert_held(&bo->resv->lock.base); |
---|
| 176 | + dma_resv_assert_held(bo->base.resv); |
---|
173 | 177 | |
---|
174 | | - cmd = vmw_fifo_reserve_dx(dev_priv, sizeof(*cmd), SVGA3D_INVALID_ID); |
---|
175 | | - if (!cmd) { |
---|
176 | | - DRM_ERROR("Failed reserving FIFO space for cotable " |
---|
177 | | - "binding.\n"); |
---|
| 178 | + cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd)); |
---|
| 179 | + if (!cmd) |
---|
178 | 180 | return -ENOMEM; |
---|
179 | | - } |
---|
180 | 181 | |
---|
181 | 182 | WARN_ON(vcotbl->ctx->id == SVGA3D_INVALID_ID); |
---|
182 | 183 | WARN_ON(bo->mem.mem_type != VMW_PL_MOB); |
---|
.. | .. |
---|
262 | 263 | if (readback) |
---|
263 | 264 | submit_size += sizeof(*cmd0); |
---|
264 | 265 | |
---|
265 | | - cmd1 = vmw_fifo_reserve_dx(dev_priv, submit_size, SVGA3D_INVALID_ID); |
---|
266 | | - if (!cmd1) { |
---|
267 | | - DRM_ERROR("Failed reserving FIFO space for cotable " |
---|
268 | | - "unbinding.\n"); |
---|
| 266 | + cmd1 = VMW_FIFO_RESERVE(dev_priv, submit_size); |
---|
| 267 | + if (!cmd1) |
---|
269 | 268 | return -ENOMEM; |
---|
270 | | - } |
---|
271 | 269 | |
---|
272 | 270 | vcotbl->size_read_back = 0; |
---|
273 | 271 | if (readback) { |
---|
.. | .. |
---|
313 | 311 | struct ttm_buffer_object *bo = val_buf->bo; |
---|
314 | 312 | struct vmw_fence_obj *fence; |
---|
315 | 313 | |
---|
316 | | - if (list_empty(&res->mob_head)) |
---|
| 314 | + if (!vmw_resource_mob_attached(res)) |
---|
317 | 315 | return 0; |
---|
318 | 316 | |
---|
319 | 317 | WARN_ON_ONCE(bo->mem.mem_type != VMW_PL_MOB); |
---|
320 | | - lockdep_assert_held(&bo->resv->lock.base); |
---|
| 318 | + dma_resv_assert_held(bo->base.resv); |
---|
321 | 319 | |
---|
322 | 320 | mutex_lock(&dev_priv->binding_mutex); |
---|
323 | 321 | if (!vcotbl->scrubbed) |
---|
.. | .. |
---|
351 | 349 | struct vmw_fence_obj *fence; |
---|
352 | 350 | |
---|
353 | 351 | if (!vcotbl->scrubbed) { |
---|
354 | | - cmd = vmw_fifo_reserve_dx(dev_priv, sizeof(*cmd), |
---|
355 | | - SVGA3D_INVALID_ID); |
---|
356 | | - if (!cmd) { |
---|
357 | | - DRM_ERROR("Failed reserving FIFO space for cotable " |
---|
358 | | - "readback.\n"); |
---|
| 352 | + cmd = VMW_FIFO_RESERVE(dev_priv, sizeof(*cmd)); |
---|
| 353 | + if (!cmd) |
---|
359 | 354 | return -ENOMEM; |
---|
360 | | - } |
---|
| 355 | + |
---|
361 | 356 | cmd->header.id = SVGA_3D_CMD_DX_READBACK_COTABLE; |
---|
362 | 357 | cmd->header.size = sizeof(cmd->body); |
---|
363 | 358 | cmd->body.cid = vcotbl->ctx->id; |
---|
.. | .. |
---|
462 | 457 | goto out_wait; |
---|
463 | 458 | } |
---|
464 | 459 | |
---|
| 460 | + vmw_resource_mob_detach(res); |
---|
465 | 461 | res->backup = buf; |
---|
466 | 462 | res->backup_size = new_size; |
---|
467 | 463 | vcotbl->size_read_back = cur_size_read_back; |
---|
.. | .. |
---|
476 | 472 | res->backup = old_buf; |
---|
477 | 473 | res->backup_size = old_size; |
---|
478 | 474 | vcotbl->size_read_back = old_size_read_back; |
---|
| 475 | + vmw_resource_mob_attach(res); |
---|
479 | 476 | goto out_wait; |
---|
480 | 477 | } |
---|
481 | 478 | |
---|
| 479 | + vmw_resource_mob_attach(res); |
---|
482 | 480 | /* Let go of the old mob. */ |
---|
483 | | - list_del(&res->mob_head); |
---|
484 | | - list_add_tail(&res->mob_head, &buf->res_list); |
---|
485 | 481 | vmw_bo_unreference(&old_buf); |
---|
486 | 482 | res->id = vcotbl->type; |
---|
487 | 483 | |
---|
.. | .. |
---|
505 | 501 | * is called before bind() in the validation sequence is instead used for two |
---|
506 | 502 | * things. |
---|
507 | 503 | * 1) Unscrub the cotable if it is scrubbed and still attached to a backup |
---|
508 | | - * buffer, that is, if @res->mob_head is non-empty. |
---|
| 504 | + * buffer. |
---|
509 | 505 | * 2) Resize the cotable if needed. |
---|
510 | 506 | */ |
---|
511 | 507 | static int vmw_cotable_create(struct vmw_resource *res) |
---|
.. | .. |
---|
521 | 517 | new_size *= 2; |
---|
522 | 518 | |
---|
523 | 519 | if (likely(new_size <= res->backup_size)) { |
---|
524 | | - if (vcotbl->scrubbed && !list_empty(&res->mob_head)) { |
---|
| 520 | + if (vcotbl->scrubbed && vmw_resource_mob_attached(res)) { |
---|
525 | 521 | ret = vmw_cotable_unscrub(res); |
---|
526 | 522 | if (ret) |
---|
527 | 523 | return ret; |
---|
.. | .. |
---|
615 | 611 | vcotbl->type = type; |
---|
616 | 612 | vcotbl->ctx = ctx; |
---|
617 | 613 | |
---|
618 | | - vmw_resource_activate(&vcotbl->res, vmw_hw_cotable_destroy); |
---|
| 614 | + vcotbl->res.hw_destroy = vmw_hw_cotable_destroy; |
---|
619 | 615 | |
---|
620 | 616 | return &vcotbl->res; |
---|
621 | 617 | |
---|