diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_bo.c')
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 80353e2b8409..c41e1c200ef5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
| @@ -143,8 +143,10 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
| 143 | nvbo->no_vm = no_vm; | 143 | nvbo->no_vm = no_vm; |
| 144 | nvbo->tile_mode = tile_mode; | 144 | nvbo->tile_mode = tile_mode; |
| 145 | nvbo->tile_flags = tile_flags; | 145 | nvbo->tile_flags = tile_flags; |
| 146 | nvbo->bo.bdev = &dev_priv->ttm.bdev; | ||
| 146 | 147 | ||
| 147 | nouveau_bo_fixup_align(dev, tile_mode, tile_flags, &align, &size); | 148 | nouveau_bo_fixup_align(dev, tile_mode, nouveau_bo_tile_layout(nvbo), |
| 149 | &align, &size); | ||
| 148 | align >>= PAGE_SHIFT; | 150 | align >>= PAGE_SHIFT; |
| 149 | 151 | ||
| 150 | nouveau_bo_placement_set(nvbo, flags, 0); | 152 | nouveau_bo_placement_set(nvbo, flags, 0); |
| @@ -176,6 +178,31 @@ set_placement_list(uint32_t *pl, unsigned *n, uint32_t type, uint32_t flags) | |||
| 176 | pl[(*n)++] = TTM_PL_FLAG_SYSTEM | flags; | 178 | pl[(*n)++] = TTM_PL_FLAG_SYSTEM | flags; |
| 177 | } | 179 | } |
| 178 | 180 | ||
| 181 | static void | ||
| 182 | set_placement_range(struct nouveau_bo *nvbo, uint32_t type) | ||
| 183 | { | ||
| 184 | struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev); | ||
| 185 | |||
| 186 | if (dev_priv->card_type == NV_10 && | ||
| 187 | nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM)) { | ||
| 188 | /* | ||
| 189 | * Make sure that the color and depth buffers are handled | ||
| 190 | * by independent memory controller units. Up to a 9x | ||
| 191 | * speed up when alpha-blending and depth-test are enabled | ||
| 192 | * at the same time. | ||
| 193 | */ | ||
| 194 | int vram_pages = dev_priv->vram_size >> PAGE_SHIFT; | ||
| 195 | |||
| 196 | if (nvbo->tile_flags & NOUVEAU_GEM_TILE_ZETA) { | ||
| 197 | nvbo->placement.fpfn = vram_pages / 2; | ||
| 198 | nvbo->placement.lpfn = ~0; | ||
| 199 | } else { | ||
| 200 | nvbo->placement.fpfn = 0; | ||
| 201 | nvbo->placement.lpfn = vram_pages / 2; | ||
| 202 | } | ||
| 203 | } | ||
| 204 | } | ||
| 205 | |||
| 179 | void | 206 | void |
| 180 | nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) | 207 | nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) |
| 181 | { | 208 | { |
| @@ -190,6 +217,8 @@ nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) | |||
| 190 | pl->busy_placement = nvbo->busy_placements; | 217 | pl->busy_placement = nvbo->busy_placements; |
| 191 | set_placement_list(nvbo->busy_placements, &pl->num_busy_placement, | 218 | set_placement_list(nvbo->busy_placements, &pl->num_busy_placement, |
| 192 | type | busy, flags); | 219 | type | busy, flags); |
| 220 | |||
| 221 | set_placement_range(nvbo, type); | ||
| 193 | } | 222 | } |
| 194 | 223 | ||
| 195 | int | 224 | int |
| @@ -525,7 +554,8 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
| 525 | stride = 16 * 4; | 554 | stride = 16 * 4; |
| 526 | height = amount / stride; | 555 | height = amount / stride; |
| 527 | 556 | ||
| 528 | if (new_mem->mem_type == TTM_PL_VRAM && nvbo->tile_flags) { | 557 | if (new_mem->mem_type == TTM_PL_VRAM && |
| 558 | nouveau_bo_tile_layout(nvbo)) { | ||
| 529 | ret = RING_SPACE(chan, 8); | 559 | ret = RING_SPACE(chan, 8); |
| 530 | if (ret) | 560 | if (ret) |
| 531 | return ret; | 561 | return ret; |
| @@ -546,7 +576,8 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
| 546 | BEGIN_RING(chan, NvSubM2MF, 0x0200, 1); | 576 | BEGIN_RING(chan, NvSubM2MF, 0x0200, 1); |
| 547 | OUT_RING (chan, 1); | 577 | OUT_RING (chan, 1); |
| 548 | } | 578 | } |
| 549 | if (old_mem->mem_type == TTM_PL_VRAM && nvbo->tile_flags) { | 579 | if (old_mem->mem_type == TTM_PL_VRAM && |
| 580 | nouveau_bo_tile_layout(nvbo)) { | ||
| 550 | ret = RING_SPACE(chan, 8); | 581 | ret = RING_SPACE(chan, 8); |
| 551 | if (ret) | 582 | if (ret) |
| 552 | return ret; | 583 | return ret; |
| @@ -753,7 +784,8 @@ nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem, | |||
| 753 | if (dev_priv->card_type == NV_50) { | 784 | if (dev_priv->card_type == NV_50) { |
| 754 | ret = nv50_mem_vm_bind_linear(dev, | 785 | ret = nv50_mem_vm_bind_linear(dev, |
| 755 | offset + dev_priv->vm_vram_base, | 786 | offset + dev_priv->vm_vram_base, |
| 756 | new_mem->size, nvbo->tile_flags, | 787 | new_mem->size, |
| 788 | nouveau_bo_tile_layout(nvbo), | ||
| 757 | offset); | 789 | offset); |
| 758 | if (ret) | 790 | if (ret) |
| 759 | return ret; | 791 | return ret; |
| @@ -894,7 +926,8 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo) | |||
| 894 | * nothing to do here. | 926 | * nothing to do here. |
| 895 | */ | 927 | */ |
| 896 | if (bo->mem.mem_type != TTM_PL_VRAM) { | 928 | if (bo->mem.mem_type != TTM_PL_VRAM) { |
| 897 | if (dev_priv->card_type < NV_50 || !nvbo->tile_flags) | 929 | if (dev_priv->card_type < NV_50 || |
| 930 | !nouveau_bo_tile_layout(nvbo)) | ||
| 898 | return 0; | 931 | return 0; |
| 899 | } | 932 | } |
| 900 | 933 | ||
