diff options
author | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2014-01-09 05:03:15 -0500 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2014-10-01 05:11:15 -0400 |
commit | bb6178b04f5ef6f62990306713fb6afdf5d8bc56 (patch) | |
tree | 22e515525032c8157cc46e4c0481b25ff80e352e /drivers | |
parent | f4f4e3e3e9f3bde110067b9e4487cb267d90055a (diff) |
drm/nouveau: export reservation_object from dmabuf to ttm
Adds an extra argument to nouveau_bo_new, which is only used in nouveau_prime.c.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_chan.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fence.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_prime.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv17_fence.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_fence.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv84_fence.c | 4 |
11 files changed, 22 insertions, 14 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index b90aa5c1f90a..fca6a1f9c20c 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c | |||
@@ -1127,7 +1127,7 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num) | |||
1127 | drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256); | 1127 | drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256); |
1128 | 1128 | ||
1129 | ret = nouveau_bo_new(dev, 64*64*4, 0x100, TTM_PL_FLAG_VRAM, | 1129 | ret = nouveau_bo_new(dev, 64*64*4, 0x100, TTM_PL_FLAG_VRAM, |
1130 | 0, 0x0000, NULL, &nv_crtc->cursor.nvbo); | 1130 | 0, 0x0000, NULL, NULL, &nv_crtc->cursor.nvbo); |
1131 | if (!ret) { | 1131 | if (!ret) { |
1132 | ret = nouveau_bo_pin(nv_crtc->cursor.nvbo, TTM_PL_FLAG_VRAM); | 1132 | ret = nouveau_bo_pin(nv_crtc->cursor.nvbo, TTM_PL_FLAG_VRAM); |
1133 | if (!ret) { | 1133 | if (!ret) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 7034cacaa4a1..3d474ac03f88 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -181,7 +181,7 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags, | |||
181 | int | 181 | int |
182 | nouveau_bo_new(struct drm_device *dev, int size, int align, | 182 | nouveau_bo_new(struct drm_device *dev, int size, int align, |
183 | uint32_t flags, uint32_t tile_mode, uint32_t tile_flags, | 183 | uint32_t flags, uint32_t tile_mode, uint32_t tile_flags, |
184 | struct sg_table *sg, | 184 | struct sg_table *sg, struct reservation_object *robj, |
185 | struct nouveau_bo **pnvbo) | 185 | struct nouveau_bo **pnvbo) |
186 | { | 186 | { |
187 | struct nouveau_drm *drm = nouveau_drm(dev); | 187 | struct nouveau_drm *drm = nouveau_drm(dev); |
@@ -230,7 +230,7 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, | |||
230 | ret = ttm_bo_init(&drm->ttm.bdev, &nvbo->bo, size, | 230 | ret = ttm_bo_init(&drm->ttm.bdev, &nvbo->bo, size, |
231 | type, &nvbo->placement, | 231 | type, &nvbo->placement, |
232 | align >> PAGE_SHIFT, false, NULL, acc_size, sg, | 232 | align >> PAGE_SHIFT, false, NULL, acc_size, sg, |
233 | NULL, nouveau_bo_del_ttm); | 233 | robj, nouveau_bo_del_ttm); |
234 | if (ret) { | 234 | if (ret) { |
235 | /* ttm will call nouveau_bo_del_ttm if it fails.. */ | 235 | /* ttm will call nouveau_bo_del_ttm if it fails.. */ |
236 | return ret; | 236 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.h b/drivers/gpu/drm/nouveau/nouveau_bo.h index f238def41a92..22d2c764d80b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.h +++ b/drivers/gpu/drm/nouveau/nouveau_bo.h | |||
@@ -70,6 +70,7 @@ extern struct ttm_bo_driver nouveau_bo_driver; | |||
70 | void nouveau_bo_move_init(struct nouveau_drm *); | 70 | void nouveau_bo_move_init(struct nouveau_drm *); |
71 | int nouveau_bo_new(struct drm_device *, int size, int align, u32 flags, | 71 | int nouveau_bo_new(struct drm_device *, int size, int align, u32 flags, |
72 | u32 tile_mode, u32 tile_flags, struct sg_table *sg, | 72 | u32 tile_mode, u32 tile_flags, struct sg_table *sg, |
73 | struct reservation_object *robj, | ||
73 | struct nouveau_bo **); | 74 | struct nouveau_bo **); |
74 | int nouveau_bo_pin(struct nouveau_bo *, u32 flags); | 75 | int nouveau_bo_pin(struct nouveau_bo *, u32 flags); |
75 | int nouveau_bo_unpin(struct nouveau_bo *); | 76 | int nouveau_bo_unpin(struct nouveau_bo *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index 9a362ddd8225..977fb8f15d97 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c | |||
@@ -106,7 +106,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, | |||
106 | if (nouveau_vram_pushbuf) | 106 | if (nouveau_vram_pushbuf) |
107 | target = TTM_PL_FLAG_VRAM; | 107 | target = TTM_PL_FLAG_VRAM; |
108 | 108 | ||
109 | ret = nouveau_bo_new(drm->dev, size, 0, target, 0, 0, NULL, | 109 | ret = nouveau_bo_new(drm->dev, size, 0, target, 0, 0, NULL, NULL, |
110 | &chan->push.buffer); | 110 | &chan->push.buffer); |
111 | if (ret == 0) { | 111 | if (ret == 0) { |
112 | ret = nouveau_bo_pin(chan->push.buffer, target); | 112 | ret = nouveau_bo_pin(chan->push.buffer, target); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index dba1f7e15cb6..515cd9aebb99 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -216,8 +216,12 @@ nouveau_fence_work(struct fence *fence, | |||
216 | 216 | ||
217 | work = kmalloc(sizeof(*work), GFP_KERNEL); | 217 | work = kmalloc(sizeof(*work), GFP_KERNEL); |
218 | if (!work) { | 218 | if (!work) { |
219 | /* | ||
220 | * this might not be a nouveau fence any more, | ||
221 | * so force a lazy wait here | ||
222 | */ | ||
219 | WARN_ON(nouveau_fence_wait((struct nouveau_fence *)fence, | 223 | WARN_ON(nouveau_fence_wait((struct nouveau_fence *)fence, |
220 | false, false)); | 224 | true, false)); |
221 | goto err; | 225 | goto err; |
222 | } | 226 | } |
223 | 227 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 3f693c1f5b36..36951ee4b157 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -165,7 +165,7 @@ nouveau_gem_new(struct drm_device *dev, int size, int align, uint32_t domain, | |||
165 | flags |= TTM_PL_FLAG_SYSTEM; | 165 | flags |= TTM_PL_FLAG_SYSTEM; |
166 | 166 | ||
167 | ret = nouveau_bo_new(dev, size, align, flags, tile_mode, | 167 | ret = nouveau_bo_new(dev, size, align, flags, tile_mode, |
168 | tile_flags, NULL, pnvbo); | 168 | tile_flags, NULL, NULL, pnvbo); |
169 | if (ret) | 169 | if (ret) |
170 | return ret; | 170 | return ret; |
171 | nvbo = *pnvbo; | 171 | nvbo = *pnvbo; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index 2215cdba587d..228226ab27fc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c | |||
@@ -61,13 +61,16 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev, | |||
61 | struct sg_table *sg) | 61 | struct sg_table *sg) |
62 | { | 62 | { |
63 | struct nouveau_bo *nvbo; | 63 | struct nouveau_bo *nvbo; |
64 | struct reservation_object *robj = attach->dmabuf->resv; | ||
64 | u32 flags = 0; | 65 | u32 flags = 0; |
65 | int ret; | 66 | int ret; |
66 | 67 | ||
67 | flags = TTM_PL_FLAG_TT; | 68 | flags = TTM_PL_FLAG_TT; |
68 | 69 | ||
70 | ww_mutex_lock(&robj->lock, NULL); | ||
69 | ret = nouveau_bo_new(dev, attach->dmabuf->size, 0, flags, 0, 0, | 71 | ret = nouveau_bo_new(dev, attach->dmabuf->size, 0, flags, 0, 0, |
70 | sg, &nvbo); | 72 | sg, robj, &nvbo); |
73 | ww_mutex_unlock(&robj->lock); | ||
71 | if (ret) | 74 | if (ret) |
72 | return ERR_PTR(ret); | 75 | return ERR_PTR(ret); |
73 | 76 | ||
diff --git a/drivers/gpu/drm/nouveau/nv17_fence.c b/drivers/gpu/drm/nouveau/nv17_fence.c index 6f9a1f8e2d0f..40b461c7d5c5 100644 --- a/drivers/gpu/drm/nouveau/nv17_fence.c +++ b/drivers/gpu/drm/nouveau/nv17_fence.c | |||
@@ -129,7 +129,7 @@ nv17_fence_create(struct nouveau_drm *drm) | |||
129 | spin_lock_init(&priv->lock); | 129 | spin_lock_init(&priv->lock); |
130 | 130 | ||
131 | ret = nouveau_bo_new(drm->dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, | 131 | ret = nouveau_bo_new(drm->dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, |
132 | 0, 0x0000, NULL, &priv->bo); | 132 | 0, 0x0000, NULL, NULL, &priv->bo); |
133 | if (!ret) { | 133 | if (!ret) { |
134 | ret = nouveau_bo_pin(priv->bo, TTM_PL_FLAG_VRAM); | 134 | ret = nouveau_bo_pin(priv->bo, TTM_PL_FLAG_VRAM); |
135 | if (!ret) { | 135 | if (!ret) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index fdb3e1adea1e..ae873d1a8d46 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1383,7 +1383,7 @@ nv50_crtc_create(struct drm_device *dev, int index) | |||
1383 | drm_mode_crtc_set_gamma_size(crtc, 256); | 1383 | drm_mode_crtc_set_gamma_size(crtc, 256); |
1384 | 1384 | ||
1385 | ret = nouveau_bo_new(dev, 8192, 0x100, TTM_PL_FLAG_VRAM, | 1385 | ret = nouveau_bo_new(dev, 8192, 0x100, TTM_PL_FLAG_VRAM, |
1386 | 0, 0x0000, NULL, &head->base.lut.nvbo); | 1386 | 0, 0x0000, NULL, NULL, &head->base.lut.nvbo); |
1387 | if (!ret) { | 1387 | if (!ret) { |
1388 | ret = nouveau_bo_pin(head->base.lut.nvbo, TTM_PL_FLAG_VRAM); | 1388 | ret = nouveau_bo_pin(head->base.lut.nvbo, TTM_PL_FLAG_VRAM); |
1389 | if (!ret) { | 1389 | if (!ret) { |
@@ -1406,7 +1406,7 @@ nv50_crtc_create(struct drm_device *dev, int index) | |||
1406 | goto out; | 1406 | goto out; |
1407 | 1407 | ||
1408 | ret = nouveau_bo_new(dev, 64 * 64 * 4, 0x100, TTM_PL_FLAG_VRAM, | 1408 | ret = nouveau_bo_new(dev, 64 * 64 * 4, 0x100, TTM_PL_FLAG_VRAM, |
1409 | 0, 0x0000, NULL, &head->base.cursor.nvbo); | 1409 | 0, 0x0000, NULL, NULL, &head->base.cursor.nvbo); |
1410 | if (!ret) { | 1410 | if (!ret) { |
1411 | ret = nouveau_bo_pin(head->base.cursor.nvbo, TTM_PL_FLAG_VRAM); | 1411 | ret = nouveau_bo_pin(head->base.cursor.nvbo, TTM_PL_FLAG_VRAM); |
1412 | if (!ret) { | 1412 | if (!ret) { |
@@ -2468,7 +2468,7 @@ nv50_display_create(struct drm_device *dev) | |||
2468 | 2468 | ||
2469 | /* small shared memory area we use for notifiers and semaphores */ | 2469 | /* small shared memory area we use for notifiers and semaphores */ |
2470 | ret = nouveau_bo_new(dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, | 2470 | ret = nouveau_bo_new(dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, |
2471 | 0, 0x0000, NULL, &disp->sync); | 2471 | 0, 0x0000, NULL, NULL, &disp->sync); |
2472 | if (!ret) { | 2472 | if (!ret) { |
2473 | ret = nouveau_bo_pin(disp->sync, TTM_PL_FLAG_VRAM); | 2473 | ret = nouveau_bo_pin(disp->sync, TTM_PL_FLAG_VRAM); |
2474 | if (!ret) { | 2474 | if (!ret) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_fence.c b/drivers/gpu/drm/nouveau/nv50_fence.c index 08fad3668a1c..22d242b37962 100644 --- a/drivers/gpu/drm/nouveau/nv50_fence.c +++ b/drivers/gpu/drm/nouveau/nv50_fence.c | |||
@@ -100,7 +100,7 @@ nv50_fence_create(struct nouveau_drm *drm) | |||
100 | spin_lock_init(&priv->lock); | 100 | spin_lock_init(&priv->lock); |
101 | 101 | ||
102 | ret = nouveau_bo_new(drm->dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, | 102 | ret = nouveau_bo_new(drm->dev, 4096, 0x1000, TTM_PL_FLAG_VRAM, |
103 | 0, 0x0000, NULL, &priv->bo); | 103 | 0, 0x0000, NULL, NULL, &priv->bo); |
104 | if (!ret) { | 104 | if (!ret) { |
105 | ret = nouveau_bo_pin(priv->bo, TTM_PL_FLAG_VRAM); | 105 | ret = nouveau_bo_pin(priv->bo, TTM_PL_FLAG_VRAM); |
106 | if (!ret) { | 106 | if (!ret) { |
diff --git a/drivers/gpu/drm/nouveau/nv84_fence.c b/drivers/gpu/drm/nouveau/nv84_fence.c index 41cd1a28d89f..d6c6c87c3f07 100644 --- a/drivers/gpu/drm/nouveau/nv84_fence.c +++ b/drivers/gpu/drm/nouveau/nv84_fence.c | |||
@@ -232,7 +232,7 @@ nv84_fence_create(struct nouveau_drm *drm) | |||
232 | priv->base.uevent = true; | 232 | priv->base.uevent = true; |
233 | 233 | ||
234 | ret = nouveau_bo_new(drm->dev, 16 * priv->base.contexts, 0, | 234 | ret = nouveau_bo_new(drm->dev, 16 * priv->base.contexts, 0, |
235 | TTM_PL_FLAG_VRAM, 0, 0, NULL, &priv->bo); | 235 | TTM_PL_FLAG_VRAM, 0, 0, NULL, NULL, &priv->bo); |
236 | if (ret == 0) { | 236 | if (ret == 0) { |
237 | ret = nouveau_bo_pin(priv->bo, TTM_PL_FLAG_VRAM); | 237 | ret = nouveau_bo_pin(priv->bo, TTM_PL_FLAG_VRAM); |
238 | if (ret == 0) { | 238 | if (ret == 0) { |
@@ -246,7 +246,7 @@ nv84_fence_create(struct nouveau_drm *drm) | |||
246 | 246 | ||
247 | if (ret == 0) | 247 | if (ret == 0) |
248 | ret = nouveau_bo_new(drm->dev, 16 * priv->base.contexts, 0, | 248 | ret = nouveau_bo_new(drm->dev, 16 * priv->base.contexts, 0, |
249 | TTM_PL_FLAG_TT, 0, 0, NULL, | 249 | TTM_PL_FLAG_TT, 0, 0, NULL, NULL, |
250 | &priv->bo_gart); | 250 | &priv->bo_gart); |
251 | if (ret == 0) { | 251 | if (ret == 0) { |
252 | ret = nouveau_bo_pin(priv->bo_gart, TTM_PL_FLAG_TT); | 252 | ret = nouveau_bo_pin(priv->bo_gart, TTM_PL_FLAG_TT); |