diff options
| author | Jerome Glisse <jglisse@redhat.com> | 2012-01-03 17:37:37 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2012-01-06 04:34:03 -0500 |
| commit | dea7e0ac45fd28f90bbc38ff226d36a9f788efbf (patch) | |
| tree | 1130a3d51f0f8aa8ab462f1735423e3dc37835b6 /drivers | |
| parent | e11d0b87cde80745afe4712a19cd37bca9924a5b (diff) | |
ttm: fix agp since ttm tt rework
ttm tt rework modified the way we allocate and populate the
ttm_tt structure, the AGP side was missing some bit to properly
work. Fix those and fix radeon and nouveau AGP support.
Tested on radeon only so far.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 13 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/ttm/ttm_agp_backend.c | 17 | ||||
| -rw-r--r-- | drivers/gpu/drm/ttm/ttm_tt.c | 2 |
4 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 8cf4a48f872e..724b41a2b9e9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
| @@ -1066,6 +1066,12 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm) | |||
| 1066 | dev_priv = nouveau_bdev(ttm->bdev); | 1066 | dev_priv = nouveau_bdev(ttm->bdev); |
| 1067 | dev = dev_priv->dev; | 1067 | dev = dev_priv->dev; |
| 1068 | 1068 | ||
| 1069 | #if __OS_HAS_AGP | ||
| 1070 | if (dev_priv->gart_info.type == NOUVEAU_GART_AGP) { | ||
| 1071 | return ttm_agp_tt_populate(ttm); | ||
| 1072 | } | ||
| 1073 | #endif | ||
| 1074 | |||
| 1069 | #ifdef CONFIG_SWIOTLB | 1075 | #ifdef CONFIG_SWIOTLB |
| 1070 | if (swiotlb_nr_tbl()) { | 1076 | if (swiotlb_nr_tbl()) { |
| 1071 | return ttm_dma_populate((void *)ttm, dev->dev); | 1077 | return ttm_dma_populate((void *)ttm, dev->dev); |
| @@ -1105,6 +1111,13 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm) | |||
| 1105 | dev_priv = nouveau_bdev(ttm->bdev); | 1111 | dev_priv = nouveau_bdev(ttm->bdev); |
| 1106 | dev = dev_priv->dev; | 1112 | dev = dev_priv->dev; |
| 1107 | 1113 | ||
| 1114 | #if __OS_HAS_AGP | ||
| 1115 | if (dev_priv->gart_info.type == NOUVEAU_GART_AGP) { | ||
| 1116 | ttm_agp_tt_unpopulate(ttm); | ||
| 1117 | return; | ||
| 1118 | } | ||
| 1119 | #endif | ||
| 1120 | |||
| 1108 | #ifdef CONFIG_SWIOTLB | 1121 | #ifdef CONFIG_SWIOTLB |
| 1109 | if (swiotlb_nr_tbl()) { | 1122 | if (swiotlb_nr_tbl()) { |
| 1110 | ttm_dma_unpopulate((void *)ttm, dev->dev); | 1123 | ttm_dma_unpopulate((void *)ttm, dev->dev); |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 1882025a9dc8..c421e77ace71 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
| @@ -618,6 +618,11 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm) | |||
| 618 | return 0; | 618 | return 0; |
| 619 | 619 | ||
| 620 | rdev = radeon_get_rdev(ttm->bdev); | 620 | rdev = radeon_get_rdev(ttm->bdev); |
| 621 | #if __OS_HAS_AGP | ||
| 622 | if (rdev->flags & RADEON_IS_AGP) { | ||
| 623 | return ttm_agp_tt_populate(ttm); | ||
| 624 | } | ||
| 625 | #endif | ||
| 621 | 626 | ||
| 622 | #ifdef CONFIG_SWIOTLB | 627 | #ifdef CONFIG_SWIOTLB |
| 623 | if (swiotlb_nr_tbl()) { | 628 | if (swiotlb_nr_tbl()) { |
| @@ -654,6 +659,12 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm) | |||
| 654 | unsigned i; | 659 | unsigned i; |
| 655 | 660 | ||
| 656 | rdev = radeon_get_rdev(ttm->bdev); | 661 | rdev = radeon_get_rdev(ttm->bdev); |
| 662 | #if __OS_HAS_AGP | ||
| 663 | if (rdev->flags & RADEON_IS_AGP) { | ||
| 664 | ttm_agp_tt_unpopulate(ttm); | ||
| 665 | return; | ||
| 666 | } | ||
| 667 | #endif | ||
| 657 | 668 | ||
| 658 | #ifdef CONFIG_SWIOTLB | 669 | #ifdef CONFIG_SWIOTLB |
| 659 | if (swiotlb_nr_tbl()) { | 670 | if (swiotlb_nr_tbl()) { |
diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index 14ebd3650aa9..747c1413fc95 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | #include "ttm/ttm_module.h" | 32 | #include "ttm/ttm_module.h" |
| 33 | #include "ttm/ttm_bo_driver.h" | 33 | #include "ttm/ttm_bo_driver.h" |
| 34 | #include "ttm/ttm_page_alloc.h" | ||
| 34 | #ifdef TTM_HAS_AGP | 35 | #ifdef TTM_HAS_AGP |
| 35 | #include "ttm/ttm_placement.h" | 36 | #include "ttm/ttm_placement.h" |
| 36 | #include <linux/agp_backend.h> | 37 | #include <linux/agp_backend.h> |
| @@ -97,6 +98,7 @@ static void ttm_agp_destroy(struct ttm_tt *ttm) | |||
| 97 | 98 | ||
| 98 | if (agp_be->mem) | 99 | if (agp_be->mem) |
| 99 | ttm_agp_unbind(ttm); | 100 | ttm_agp_unbind(ttm); |
| 101 | ttm_tt_fini(ttm); | ||
| 100 | kfree(agp_be); | 102 | kfree(agp_be); |
| 101 | } | 103 | } |
| 102 | 104 | ||
| @@ -129,4 +131,19 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev, | |||
| 129 | } | 131 | } |
| 130 | EXPORT_SYMBOL(ttm_agp_tt_create); | 132 | EXPORT_SYMBOL(ttm_agp_tt_create); |
| 131 | 133 | ||
| 134 | int ttm_agp_tt_populate(struct ttm_tt *ttm) | ||
| 135 | { | ||
| 136 | if (ttm->state != tt_unpopulated) | ||
| 137 | return 0; | ||
| 138 | |||
| 139 | return ttm_pool_populate(ttm); | ||
| 140 | } | ||
| 141 | EXPORT_SYMBOL(ttm_agp_tt_populate); | ||
| 142 | |||
| 143 | void ttm_agp_tt_unpopulate(struct ttm_tt *ttm) | ||
| 144 | { | ||
| 145 | ttm_pool_unpopulate(ttm); | ||
| 146 | } | ||
| 147 | EXPORT_SYMBOL(ttm_agp_tt_unpopulate); | ||
| 148 | |||
| 132 | #endif | 149 | #endif |
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 58e1fa14fe3a..2f75d203a2bf 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c | |||
| @@ -191,6 +191,7 @@ int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev, | |||
| 191 | ttm->page_flags = page_flags; | 191 | ttm->page_flags = page_flags; |
| 192 | ttm->dummy_read_page = dummy_read_page; | 192 | ttm->dummy_read_page = dummy_read_page; |
| 193 | ttm->state = tt_unpopulated; | 193 | ttm->state = tt_unpopulated; |
| 194 | ttm->swap_storage = NULL; | ||
| 194 | 195 | ||
| 195 | ttm_tt_alloc_page_directory(ttm); | 196 | ttm_tt_alloc_page_directory(ttm); |
| 196 | if (!ttm->pages) { | 197 | if (!ttm->pages) { |
| @@ -222,6 +223,7 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev, | |||
| 222 | ttm->page_flags = page_flags; | 223 | ttm->page_flags = page_flags; |
| 223 | ttm->dummy_read_page = dummy_read_page; | 224 | ttm->dummy_read_page = dummy_read_page; |
| 224 | ttm->state = tt_unpopulated; | 225 | ttm->state = tt_unpopulated; |
| 226 | ttm->swap_storage = NULL; | ||
| 225 | 227 | ||
| 226 | INIT_LIST_HEAD(&ttm_dma->pages_list); | 228 | INIT_LIST_HEAD(&ttm_dma->pages_list); |
| 227 | ttm_dma_tt_alloc_page_directory(ttm_dma); | 229 | ttm_dma_tt_alloc_page_directory(ttm_dma); |
