diff options
| author | Dave Airlie <airlied@redhat.com> | 2010-12-21 18:48:04 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2010-12-21 18:48:04 -0500 |
| commit | 1d99e5c57255d188773fb437391df24fe8faf575 (patch) | |
| tree | 25300afe457342c6d694de18020c804486a10eac | |
| parent | 880981e49b90568ebb53428e231b43b8c1049ef9 (diff) | |
| parent | 183720b8af5301e2eab7f3163f03133c5a6ad6da (diff) | |
Merge remote branch 'nouveau/drm-nouveau-next' of /ssd/git/drm-nouveau-next into drm-core-next
* 'nouveau/drm-nouveau-next' of /ssd/git/drm-nouveau-next:
drm/nvc0: accelerate ttm buffer moves
drm/nvc0: initial support for tiled buffer objects
drm/nvc0: implement fbcon acceleration
drm/nvc0: implement pgraph engine hooks
drm/nvc0: implement pfifo engine hooks
drm/nvc0: implement fencing
drm/nvc0: fix channel dma init paths
drm/nvc0: skip dma object creation for drm channel
drm/nvc0: implement channel structure initialisation
drm/nvc0: gpuobj_new need only check validity and init the relevant engine
drm/nvc0: reject the notifier_alloc ioctl
drm/nvc0: create shared channel vm
drm/nvc0: initial vm implementation, use for bar1/bar3 management
drm/nvc0: import initial vm backend
drm/nouveau: modify vm to accomodate dual page tables for nvc0
drm/nv50: add missing license header to nv50_fbcon.c
drm/nv50: fix smatch warning in nv50_vram.c
drm/nouveau: sizeof() vs ARRAY_SIZE()
30 files changed, 5044 insertions, 341 deletions
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index b1d8941e04d8..e12c97fd8db8 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
| @@ -18,17 +18,19 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ | |||
| 18 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o nvc0_fifo.o \ | 18 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o nvc0_fifo.o \ |
| 19 | nv04_graph.o nv10_graph.o nv20_graph.o \ | 19 | nv04_graph.o nv10_graph.o nv20_graph.o \ |
| 20 | nv40_graph.o nv50_graph.o nvc0_graph.o \ | 20 | nv40_graph.o nv50_graph.o nvc0_graph.o \ |
| 21 | nv40_grctx.o nv50_grctx.o \ | 21 | nv40_grctx.o nv50_grctx.o nvc0_grctx.o \ |
| 22 | nv84_crypt.o \ | 22 | nv84_crypt.o \ |
| 23 | nv04_instmem.o nv50_instmem.o nvc0_instmem.o \ | 23 | nv04_instmem.o nv50_instmem.o nvc0_instmem.o \ |
| 24 | nv50_evo.o nv50_crtc.o nv50_dac.o nv50_sor.o \ | 24 | nv50_evo.o nv50_crtc.o nv50_dac.o nv50_sor.o \ |
| 25 | nv50_cursor.o nv50_display.o nv50_fbcon.o \ | 25 | nv50_cursor.o nv50_display.o \ |
| 26 | nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o \ | 26 | nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o \ |
| 27 | nv04_crtc.o nv04_display.o nv04_cursor.o nv04_fbcon.o \ | 27 | nv04_crtc.o nv04_display.o nv04_cursor.o \ |
| 28 | nv04_fbcon.o nv50_fbcon.o nvc0_fbcon.o \ | ||
| 28 | nv10_gpio.o nv50_gpio.o \ | 29 | nv10_gpio.o nv50_gpio.o \ |
| 29 | nv50_calc.o \ | 30 | nv50_calc.o \ |
| 30 | nv04_pm.o nv50_pm.o nva3_pm.o \ | 31 | nv04_pm.o nv50_pm.o nva3_pm.o \ |
| 31 | nv50_vram.o nv50_vm.o | 32 | nv50_vram.o nvc0_vram.o \ |
| 33 | nv50_vm.o nvc0_vm.o | ||
| 32 | 34 | ||
| 33 | nouveau-$(CONFIG_DRM_NOUVEAU_DEBUG) += nouveau_debugfs.o | 35 | nouveau-$(CONFIG_DRM_NOUVEAU_DEBUG) += nouveau_debugfs.o |
| 34 | nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o | 36 | nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 42d1ad62b381..a7fae26f4654 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
| @@ -413,7 +413,7 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | |||
| 413 | man->default_caching = TTM_PL_FLAG_CACHED; | 413 | man->default_caching = TTM_PL_FLAG_CACHED; |
| 414 | break; | 414 | break; |
| 415 | case TTM_PL_VRAM: | 415 | case TTM_PL_VRAM: |
| 416 | if (dev_priv->card_type == NV_50) { | 416 | if (dev_priv->card_type >= NV_50) { |
| 417 | man->func = &nouveau_vram_manager; | 417 | man->func = &nouveau_vram_manager; |
| 418 | man->io_reserve_fastpath = false; | 418 | man->io_reserve_fastpath = false; |
| 419 | man->use_io_reserve_lru = true; | 419 | man->use_io_reserve_lru = true; |
| @@ -515,6 +515,58 @@ nouveau_bo_mem_ctxdma(struct ttm_buffer_object *bo, | |||
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | static int | 517 | static int |
| 518 | nvc0_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | ||
| 519 | struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) | ||
| 520 | { | ||
| 521 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | ||
| 522 | struct nouveau_bo *nvbo = nouveau_bo(bo); | ||
| 523 | u64 src_offset = old_mem->start << PAGE_SHIFT; | ||
| 524 | u64 dst_offset = new_mem->start << PAGE_SHIFT; | ||
| 525 | u32 page_count = new_mem->num_pages; | ||
| 526 | int ret; | ||
| 527 | |||
| 528 | if (!nvbo->no_vm) { | ||
| 529 | if (old_mem->mem_type == TTM_PL_VRAM) | ||
| 530 | src_offset = nvbo->vma.offset; | ||
| 531 | else | ||
| 532 | src_offset += dev_priv->gart_info.aper_base; | ||
| 533 | |||
| 534 | if (new_mem->mem_type == TTM_PL_VRAM) | ||
| 535 | dst_offset = nvbo->vma.offset; | ||
| 536 | else | ||
| 537 | dst_offset += dev_priv->gart_info.aper_base; | ||
| 538 | } | ||
| 539 | |||
| 540 | page_count = new_mem->num_pages; | ||
| 541 | while (page_count) { | ||
| 542 | int line_count = (page_count > 2047) ? 2047 : page_count; | ||
| 543 | |||
| 544 | ret = RING_SPACE(chan, 12); | ||
| 545 | if (ret) | ||
| 546 | return ret; | ||
| 547 | |||
| 548 | BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0238, 2); | ||
| 549 | OUT_RING (chan, upper_32_bits(dst_offset)); | ||
| 550 | OUT_RING (chan, lower_32_bits(dst_offset)); | ||
| 551 | BEGIN_NVC0(chan, 2, NvSubM2MF, 0x030c, 6); | ||
| 552 | OUT_RING (chan, upper_32_bits(src_offset)); | ||
| 553 | OUT_RING (chan, lower_32_bits(src_offset)); | ||
| 554 | OUT_RING (chan, PAGE_SIZE); /* src_pitch */ | ||
| 555 | OUT_RING (chan, PAGE_SIZE); /* dst_pitch */ | ||
| 556 | OUT_RING (chan, PAGE_SIZE); /* line_length */ | ||
| 557 | OUT_RING (chan, line_count); | ||
| 558 | BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0300, 1); | ||
| 559 | OUT_RING (chan, 0x00100110); | ||
| 560 | |||
| 561 | page_count -= line_count; | ||
| 562 | src_offset += (PAGE_SIZE * line_count); | ||
| 563 | dst_offset += (PAGE_SIZE * line_count); | ||
| 564 | } | ||
| 565 | |||
| 566 | return 0; | ||
| 567 | } | ||
| 568 | |||
| 569 | static int | ||
| 518 | nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | 570 | nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, |
| 519 | struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) | 571 | struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) |
| 520 | { | 572 | { |
| @@ -690,7 +742,10 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, | |||
| 690 | if (dev_priv->card_type < NV_50) | 742 | if (dev_priv->card_type < NV_50) |
| 691 | ret = nv04_bo_move_m2mf(chan, bo, &bo->mem, new_mem); | 743 | ret = nv04_bo_move_m2mf(chan, bo, &bo->mem, new_mem); |
| 692 | else | 744 | else |
| 745 | if (dev_priv->card_type < NV_C0) | ||
| 693 | ret = nv50_bo_move_m2mf(chan, bo, &bo->mem, new_mem); | 746 | ret = nv50_bo_move_m2mf(chan, bo, &bo->mem, new_mem); |
| 747 | else | ||
| 748 | ret = nvc0_bo_move_m2mf(chan, bo, &bo->mem, new_mem); | ||
| 694 | if (ret == 0) { | 749 | if (ret == 0) { |
| 695 | ret = nouveau_bo_move_accel_cleanup(chan, nvbo, evict, | 750 | ret = nouveau_bo_move_accel_cleanup(chan, nvbo, evict, |
| 696 | no_wait_reserve, | 751 | no_wait_reserve, |
| @@ -901,6 +956,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | |||
| 901 | case TTM_PL_VRAM: | 956 | case TTM_PL_VRAM: |
| 902 | { | 957 | { |
| 903 | struct nouveau_vram *vram = mem->mm_node; | 958 | struct nouveau_vram *vram = mem->mm_node; |
| 959 | u8 page_shift; | ||
| 904 | 960 | ||
| 905 | if (!dev_priv->bar1_vm) { | 961 | if (!dev_priv->bar1_vm) { |
| 906 | mem->bus.offset = mem->start << PAGE_SHIFT; | 962 | mem->bus.offset = mem->start << PAGE_SHIFT; |
| @@ -909,8 +965,14 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | |||
| 909 | break; | 965 | break; |
