diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-02-09 23:42:08 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-02-24 15:45:40 -0500 |
commit | 6ba9a68317781537d6184d3fdb2d0f20c97da3a4 (patch) | |
tree | 8d4a1335d09868883da891f96e54e624d4209241 /drivers/gpu/drm/nouveau/nouveau_gem.c | |
parent | a67047883410ee37d27806bb8415a84673934b4f (diff) |
drm/nouveau: pass domain rather than ttm flags to gem_new()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_gem.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 29ededdee980..cd4ed9e86704 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -61,12 +61,20 @@ nouveau_gem_object_del(struct drm_gem_object *gem) | |||
61 | 61 | ||
62 | int | 62 | int |
63 | nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan, | 63 | nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan, |
64 | int size, int align, uint32_t flags, 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 nouveau_bo *nvbo; | 67 | struct nouveau_bo *nvbo; |
68 | u32 flags = 0; | ||
68 | int ret; | 69 | int ret; |
69 | 70 | ||
71 | if (domain & NOUVEAU_GEM_DOMAIN_VRAM) | ||
72 | flags |= TTM_PL_FLAG_VRAM; | ||
73 | if (domain & NOUVEAU_GEM_DOMAIN_GART) | ||
74 | flags |= TTM_PL_FLAG_TT; | ||
75 | if (!flags || domain & NOUVEAU_GEM_DOMAIN_CPU) | ||
76 | flags |= TTM_PL_FLAG_SYSTEM; | ||
77 | |||
70 | ret = nouveau_bo_new(dev, chan, size, align, flags, tile_mode, | 78 | ret = nouveau_bo_new(dev, chan, size, align, flags, tile_mode, |
71 | tile_flags, pnvbo); | 79 | tile_flags, pnvbo); |
72 | if (ret) | 80 | if (ret) |
@@ -110,19 +118,11 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
110 | struct drm_nouveau_gem_new *req = data; | 118 | struct drm_nouveau_gem_new *req = data; |
111 | struct nouveau_bo *nvbo = NULL; | 119 | struct nouveau_bo *nvbo = NULL; |
112 | struct nouveau_channel *chan = NULL; | 120 | struct nouveau_channel *chan = NULL; |
113 | uint32_t flags = 0; | ||
114 | int ret = 0; | 121 | int ret = 0; |
115 | 122 | ||
116 | if (unlikely(dev_priv->ttm.bdev.dev_mapping == NULL)) | 123 | if (unlikely(dev_priv->ttm.bdev.dev_mapping == NULL)) |
117 | dev_priv->ttm.bdev.dev_mapping = dev_priv->dev->dev_mapping; | 124 | dev_priv->ttm.bdev.dev_mapping = dev_priv->dev->dev_mapping; |
118 | 125 | ||
119 | if (req->info.domain & NOUVEAU_GEM_DOMAIN_VRAM) | ||
120 | flags |= TTM_PL_FLAG_VRAM; | ||
121 | if (req->info.domain & NOUVEAU_GEM_DOMAIN_GART) | ||
122 | flags |= TTM_PL_FLAG_TT; | ||
123 | if (!flags || req->info.domain & NOUVEAU_GEM_DOMAIN_CPU) | ||
124 | flags |= TTM_PL_FLAG_SYSTEM; | ||
125 | |||
126 | if (!dev_priv->engine.vram.flags_valid(dev, req->info.tile_flags)) { | 126 | if (!dev_priv->engine.vram.flags_valid(dev, req->info.tile_flags)) { |
127 | NV_ERROR(dev, "bad page flags: 0x%08x\n", req->info.tile_flags); | 127 | NV_ERROR(dev, "bad page flags: 0x%08x\n", req->info.tile_flags); |
128 | return -EINVAL; | 128 | return -EINVAL; |
@@ -134,8 +134,9 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
134 | return PTR_ERR(chan); | 134 | return PTR_ERR(chan); |
135 | } | 135 | } |
136 | 136 | ||
137 | ret = nouveau_gem_new(dev, chan, req->info.size, req->align, flags, | 137 | ret = nouveau_gem_new(dev, chan, req->info.size, req->align, |
138 | req->info.tile_mode, req->info.tile_flags, &nvbo); | 138 | req->info.domain, req->info.tile_mode, |
139 | req->info.tile_flags, &nvbo); | ||
139 | if (chan) | 140 | if (chan) |
140 | nouveau_channel_put(&chan); | 141 | nouveau_channel_put(&chan); |
141 | if (ret) | 142 | if (ret) |