aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c12
3 files changed, 16 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 931dade12edd..cfdecd31f802 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -54,8 +54,8 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
54} 54}
55 55
56static void 56static void
57nouveau_bo_fixup_align(struct nouveau_bo *nvbo, int *align, int *size, 57nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags,
58 int *page_shift) 58 int *align, int *size, int *page_shift)
59{ 59{
60 struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev); 60 struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev);
61 61
@@ -80,7 +80,7 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, int *align, int *size,
80 } 80 }
81 } else { 81 } else {
82 if (likely(dev_priv->chan_vm)) { 82 if (likely(dev_priv->chan_vm)) {
83 if (*size > 256 * 1024) 83 if (!(flags & TTM_PL_FLAG_TT) && *size > 256 * 1024)
84 *page_shift = dev_priv->chan_vm->lpg_shift; 84 *page_shift = dev_priv->chan_vm->lpg_shift;
85 else 85 else
86 *page_shift = dev_priv->chan_vm->spg_shift; 86 *page_shift = dev_priv->chan_vm->spg_shift;
@@ -113,7 +113,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
113 nvbo->tile_flags = tile_flags; 113 nvbo->tile_flags = tile_flags;
114 nvbo->bo.bdev = &dev_priv->ttm.bdev; 114 nvbo->bo.bdev = &dev_priv->ttm.bdev;
115 115
116 nouveau_bo_fixup_align(nvbo, &align, &size, &page_shift); 116 nouveau_bo_fixup_align(nvbo, flags, &align, &size, &page_shift);
117 align >>= PAGE_SHIFT; 117 align >>= PAGE_SHIFT;
118 118
119 if (dev_priv->chan_vm) { 119 if (dev_priv->chan_vm) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index fce748f0f925..d409c0dc425b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -90,6 +90,7 @@ struct nouveau_tile_reg {
90struct nouveau_bo { 90struct nouveau_bo {
91 struct ttm_buffer_object bo; 91 struct ttm_buffer_object bo;
92 struct ttm_placement placement; 92 struct ttm_placement placement;
93 u32 valid_domains;
93 u32 placements[3]; 94 u32 placements[3];
94 u32 busy_placements[3]; 95 u32 busy_placements[3];
95 struct ttm_bo_kmap_obj kmap; 96 struct ttm_bo_kmap_obj kmap;
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index cd4ed9e86704..3ce58d2222cb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -64,6 +64,7 @@ nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan,
64 int size, int align, uint32_t domain, uint32_t tile_mode, 64 int size, int align, uint32_t domain, uint32_t tile_mode,
65 uint32_t tile_flags, struct nouveau_bo **pnvbo) 65 uint32_t tile_flags, struct nouveau_bo **pnvbo)
66{ 66{
67 struct drm_nouveau_private *dev_priv = dev->dev_private;
67 struct nouveau_bo *nvbo; 68 struct nouveau_bo *nvbo;
68 u32 flags = 0; 69 u32 flags = 0;
69 int ret; 70 int ret;
@@ -81,6 +82,15 @@ nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan,
81 return ret; 82 return ret;
82 nvbo = *pnvbo; 83 nvbo = *pnvbo;
83 84
85 /* we restrict allowed domains on nv50+ to only the types
86 * that were requested at creation time. not possibly on
87 * earlier chips without busting the ABI.
88 */
89 nvbo->valid_domains = NOUVEAU_GEM_DOMAIN_VRAM |
90 NOUVEAU_GEM_DOMAIN_GART;
91 if (dev_priv->card_type >= NV_50)
92 nvbo->valid_domains &= domain;
93
84 nvbo->gem = drm_gem_object_alloc(dev, nvbo->bo.mem.size); 94 nvbo->gem = drm_gem_object_alloc(dev, nvbo->bo.mem.size);
85 if (!nvbo->gem) { 95 if (!nvbo->gem) {
86 nouveau_bo_ref(NULL, pnvbo); 96 nouveau_bo_ref(NULL, pnvbo);
@@ -159,7 +169,7 @@ nouveau_gem_set_domain(struct drm_gem_object *gem, uint32_t read_domains,
159{ 169{
160 struct nouveau_bo *nvbo = gem->driver_private; 170 struct nouveau_bo *nvbo = gem->driver_private;
161 struct ttm_buffer_object *bo = &nvbo->bo; 171 struct ttm_buffer_object *bo = &nvbo->bo;
162 uint32_t domains = valid_domains & 172 uint32_t domains = valid_domains & nvbo->valid_domains &
163 (write_domains ? write_domains : read_domains); 173 (write_domains ? write_domains : read_domains);
164 uint32_t pref_flags = 0, valid_flags = 0; 174 uint32_t pref_flags = 0, valid_flags = 0;
165 175