aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_bo.c
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-04-07 06:21:19 -0400
committerDave Airlie <airlied@redhat.com>2010-04-07 20:21:19 -0400
commit9d87fa2138d06ff400551800d67d522625033e35 (patch)
tree284cd0f73ccb2f2fad1c71f974d4e9e4d0035e81 /drivers/gpu/drm/nouveau/nouveau_bo.c
parent3a89b4a9ca7ce11e3b7d5119aea917b9fc29a302 (diff)
drm/ttm: split no_wait argument in 2 GPU or reserve wait
There is case where we want to be able to wait only for the GPU while not waiting for other buffer to be unreserved. This patch split the no_wait argument all the way down in the whole ttm path so that upper level can decide on what to wait on or not. [airlied: squashed these 4 for bisectability reasons.] drm/radeon/kms: update to TTM no_wait splitted argument drm/nouveau: update to TTM no_wait splitted argument drm/vmwgfx: update to TTM no_wait splitted argument [vmwgfx patch: Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>] Signed-off-by: Jerome Glisse <jglisse@redhat.com> Acked-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_bo.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 026612471c92..5a167de895c6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -219,7 +219,7 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
219 for (i = 0; i < nvbo->placement.num_placement; i++) 219 for (i = 0; i < nvbo->placement.num_placement; i++)
220 nvbo->placements[i] |= TTM_PL_FLAG_NO_EVICT; 220 nvbo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
221 221
222 ret = ttm_bo_validate(bo, &nvbo->placement, false, false); 222 ret = ttm_bo_validate(bo, &nvbo->placement, false, false, false);
223 if (ret == 0) { 223 if (ret == 0) {
224 switch (bo->mem.mem_type) { 224 switch (bo->mem.mem_type) {
225 case TTM_PL_VRAM: 225 case TTM_PL_VRAM:
@@ -256,7 +256,7 @@ nouveau_bo_unpin(struct nouveau_bo *nvbo)
256 for (i = 0; i < nvbo->placement.num_placement; i++) 256 for (i = 0; i < nvbo->placement.num_placement; i++)
257 nvbo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; 257 nvbo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
258 258
259 ret = ttm_bo_validate(bo, &nvbo->placement, false, false); 259 ret = ttm_bo_validate(bo, &nvbo->placement, false, false, false);
260 if (ret == 0) { 260 if (ret == 0) {
261 switch (bo->mem.mem_type) { 261 switch (bo->mem.mem_type) {
262 case TTM_PL_VRAM: 262 case TTM_PL_VRAM:
@@ -456,7 +456,8 @@ nouveau_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl)
456 456
457static int 457static int
458nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, 458nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
459 struct nouveau_bo *nvbo, bool evict, bool no_wait, 459 struct nouveau_bo *nvbo, bool evict,
460 bool no_wait_reserve, bool no_wait_gpu,
460 struct ttm_mem_reg *new_mem) 461 struct ttm_mem_reg *new_mem)
461{ 462{
462 struct nouveau_fence *fence = NULL; 463 struct nouveau_fence *fence = NULL;
@@ -467,7 +468,7 @@ nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
467 return ret; 468 return ret;
468 469
469 ret = ttm_bo_move_accel_cleanup(&nvbo->bo, fence, NULL, 470 ret = ttm_bo_move_accel_cleanup(&nvbo->bo, fence, NULL,
470 evict, no_wait, new_mem); 471 evict, no_wait_reserve, no_wait_gpu, new_mem);
471 if (nvbo->channel && nvbo->channel != chan) 472 if (nvbo->channel && nvbo->channel != chan)
472 ret = nouveau_fence_wait(fence, NULL, false, false); 473 ret = nouveau_fence_wait(fence, NULL, false, false);
473 nouveau_fence_unref((void *)&fence); 474 nouveau_fence_unref((void *)&fence);
@@ -491,7 +492,8 @@ nouveau_bo_mem_ctxdma(struct nouveau_bo *nvbo, struct nouveau_channel *chan,
491 492
492static int 493static int
493nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, 494nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
494 int no_wait, struct ttm_mem_reg *new_mem) 495 bool no_wait_reserve, bool no_wait_gpu,
496 struct ttm_mem_reg *new_mem)
495{ 497{
496 struct nouveau_bo *nvbo = nouveau_bo(bo); 498 struct nouveau_bo *nvbo = nouveau_bo(bo);
497 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); 499 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
@@ -569,12 +571,13 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
569 dst_offset += (PAGE_SIZE * line_count); 571 dst_offset += (PAGE_SIZE * line_count);
570 } 572 }
571 573
572 return nouveau_bo_move_accel_cleanup(chan, nvbo, evict, no_wait, new_mem); 574 return nouveau_bo_move_accel_cleanup(chan, nvbo, evict, no_wait_reserve, no_wait_gpu, new_mem);
573} 575}
574 576
575static int 577static int
576nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, 578nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
577 bool no_wait, struct ttm_mem_reg *new_mem) 579 bool no_wait_reserve, bool no_wait_gpu,
580 struct ttm_mem_reg *new_mem)
578{ 581{
579 u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING; 582 u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING;
580 struct ttm_placement placement; 583 struct ttm_placement placement;
@@ -587,7 +590,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
587 590
588 tmp_mem = *new_mem; 591 tmp_mem = *new_mem;
589 tmp_mem.mm_node = NULL; 592 tmp_mem.mm_node = NULL;
590 ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait); 593 ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait_reserve, no_wait_gpu);
591 if (ret) 594 if (ret)
592 return ret; 595 return ret;
593 596
@@ -595,11 +598,11 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
595 if (ret) 598 if (ret)
596 goto out; 599 goto out;
597 600
598 ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait, &tmp_mem); 601 ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait_reserve, no_wait_gpu, &tmp_mem);
599 if (ret) 602 if (ret)
600 goto out; 603 goto out;
601 604
602 ret = ttm_bo_move_ttm(bo, evict, no_wait, new_mem); 605 ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, new_mem);
603out: 606out:
604 if (tmp_mem.mm_node) { 607 if (tmp_mem.mm_node) {
605 spin_lock(&bo->bdev->glob->lru_lock); 608 spin_lock(&bo->bdev->glob->lru_lock);
@@ -612,7 +615,8 @@ out:
612 615
613static int 616static int
614nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, 617nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
615 bool no_wait, struct ttm_mem_reg *new_mem) 618 bool no_wait_reserve, bool no_wait_gpu,
619 struct ttm_mem_reg *new_mem)
616{ 620{
617 u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING; 621 u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING;
618 struct ttm_placement placement; 622 struct ttm_placement placement;
@@ -625,15 +629,15 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
625 629
626 tmp_mem = *new_mem; 630 tmp_mem = *new_mem;
627 tmp_mem.mm_node = NULL; 631 tmp_mem.mm_node = NULL;
628 ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait); 632 ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait_reserve, no_wait_gpu);
629 if (ret) 633 if (ret)
630 return ret; 634 return ret;
631 635
632 ret = ttm_bo_move_ttm(bo, evict, no_wait, &tmp_mem); 636 ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, &tmp_mem);
633 if (ret) 637 if (ret)
634 goto out; 638 goto out;
635 639
636 ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem); 640 ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem);
637 if (ret) 641 if (ret)
638 goto out; 642 goto out;
639 643
@@ -700,7 +704,8 @@ nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo,
700 704
701static int 705static int
702nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, 706nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
703 bool no_wait, struct ttm_mem_reg *new_mem) 707 bool no_wait_reserve, bool no_wait_gpu,
708 struct ttm_mem_reg *new_mem)
704{ 709{
705 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); 710 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
706 struct nouveau_bo *nvbo = nouveau_bo(bo); 711 struct nouveau_bo *nvbo = nouveau_bo(bo);
@@ -715,7 +720,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
715 /* Software copy if the card isn't up and running yet. */ 720 /* Software copy if the card isn't up and running yet. */
716 if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE || 721 if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE ||
717 !dev_priv->channel) { 722 !dev_priv->channel) {
718 ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); 723 ret = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem);
719 goto out; 724 goto out;
720 } 725 }
721 726
@@ -729,17 +734,17 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
729 734
730 /* Hardware assisted copy. */ 735 /* Hardware assisted copy. */
731 if (new_mem->mem_type == TTM_PL_SYSTEM) 736 if (new_mem->mem_type == TTM_PL_SYSTEM)
732 ret = nouveau_bo_move_flipd(bo, evict, intr, no_wait, new_mem); 737 ret = nouveau_bo_move_flipd(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem);
733 else if (old_mem->mem_type == TTM_PL_SYSTEM) 738 else if (old_mem->mem_type == TTM_PL_SYSTEM)
734 ret = nouveau_bo_move_flips(bo, evict, intr, no_wait, new_mem); 739 ret = nouveau_bo_move_flips(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem);
735 else 740 else
736 ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem); 741 ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem);
737 742
738 if (!ret) 743 if (!ret)
739 goto out; 744 goto out;
740 745
741 /* Fallback to software copy. */ 746 /* Fallback to software copy. */
742 ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); 747 ret = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem);
743 748
744out: 749out:
745 if (ret) 750 if (ret)