aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_object.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-09-01 01:24:30 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 02:20:07 -0400
commitde3a6c0a3b642c0c350414d63298a1b19a009290 (patch)
tree68bd8512acc01f46dd238105edfdb70b211f64ae /drivers/gpu/drm/nouveau/nouveau_object.c
parentb3beb167af0de6d7cb03aed0687eca645cfd06a6 (diff)
drm/nouveau: rebase per-channel pramin heap offsets to 0
Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_object.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_object.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c
index 52db13cd75b2..552f5131650f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_object.c
+++ b/drivers/gpu/drm/nouveau/nouveau_object.c
@@ -131,6 +131,23 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan,
131 } 131 }
132 } 132 }
133 133
134 /* calculate the various different addresses for the object */
135 if (chan) {
136 gpuobj->pinst = gpuobj->im_pramin->start +
137 chan->ramin->gpuobj->im_pramin->start;
138 if (dev_priv->card_type < NV_50) {
139 gpuobj->cinst = gpuobj->pinst;
140 } else {
141 gpuobj->cinst = gpuobj->im_pramin->start;
142 gpuobj->vinst = gpuobj->im_pramin->start +
143 chan->ramin->gpuobj->im_backing_start;
144 }
145 } else {
146 gpuobj->pinst = gpuobj->im_pramin->start;
147 gpuobj->cinst = 0xdeadbeef;
148 gpuobj->vinst = gpuobj->im_backing_start;
149 }
150
134 if (gpuobj->flags & NVOBJ_FLAG_ZERO_ALLOC) { 151 if (gpuobj->flags & NVOBJ_FLAG_ZERO_ALLOC) {
135 int i; 152 int i;
136 153
@@ -260,19 +277,16 @@ nouveau_gpuobj_instance_get(struct drm_device *dev,
260 /* <NV50 use PRAMIN address everywhere */ 277 /* <NV50 use PRAMIN address everywhere */
261 if (dev_priv->card_type < NV_50) { 278 if (dev_priv->card_type < NV_50) {
262 *inst = gpuobj->im_pramin->start; 279 *inst = gpuobj->im_pramin->start;
280 if (gpuobj->im_channel) {
281 cpramin = gpuobj->im_channel->ramin->gpuobj;
282 *inst += cpramin->im_pramin->start;
283 }
263 return 0; 284 return 0;
264 } 285 }
265 286
266 if (chan && gpuobj->im_channel != chan) {
267 NV_ERROR(dev, "Channel mismatch: obj %d, ref %d\n",
268 gpuobj->im_channel->id, chan->id);
269 return -EINVAL;
270 }
271
272 /* NV50 channel-local instance */ 287 /* NV50 channel-local instance */
273 if (chan) { 288 if (chan) {
274 cpramin = chan->ramin->gpuobj; 289 *inst = gpuobj->im_pramin->start;
275 *inst = gpuobj->im_pramin->start - cpramin->im_pramin->start;
276 return 0; 290 return 0;
277 } 291 }
278 292
@@ -288,8 +302,7 @@ nouveau_gpuobj_instance_get(struct drm_device *dev,
288 } else { 302 } else {
289 /* ...from local heap */ 303 /* ...from local heap */
290 cpramin = gpuobj->im_channel->ramin->gpuobj; 304 cpramin = gpuobj->im_channel->ramin->gpuobj;
291 *inst = cpramin->im_backing_start + 305 *inst = cpramin->im_backing_start + gpuobj->im_pramin->start;
292 (gpuobj->im_pramin->start - cpramin->im_pramin->start);
293 return 0; 306 return 0;
294 } 307 }
295 308
@@ -458,6 +471,10 @@ nouveau_gpuobj_new_fake(struct drm_device *dev, uint32_t p_offset,
458 gpuobj->im_backing_start = b_offset; 471 gpuobj->im_backing_start = b_offset;
459 } 472 }
460 473
474 gpuobj->pinst = gpuobj->im_pramin->start;
475 gpuobj->cinst = 0xdeadbeef;
476 gpuobj->vinst = gpuobj->im_backing_start;
477
461 if (gpuobj->flags & NVOBJ_FLAG_ZERO_ALLOC) { 478 if (gpuobj->flags & NVOBJ_FLAG_ZERO_ALLOC) {
462 for (i = 0; i < gpuobj->im_pramin->size; i += 4) 479 for (i = 0; i < gpuobj->im_pramin->size; i += 4)
463 nv_wo32(gpuobj, i, 0); 480 nv_wo32(gpuobj, i, 0);
@@ -789,7 +806,7 @@ nouveau_gpuobj_channel_init_pramin(struct nouveau_channel *chan)
789 } 806 }
790 pramin = chan->ramin->gpuobj; 807 pramin = chan->ramin->gpuobj;
791 808
792 ret = drm_mm_init(&chan->ramin_heap, pramin->im_pramin->start + base, size); 809 ret = drm_mm_init(&chan->ramin_heap, base, size);
793 if (ret) { 810 if (ret) {
794 NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret); 811 NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret);
795 nouveau_gpuobj_ref_del(dev, &chan->ramin); 812 nouveau_gpuobj_ref_del(dev, &chan->ramin);
@@ -1124,13 +1141,11 @@ int nouveau_ioctl_gpuobj_free(struct drm_device *dev, void *data,
1124u32 1141u32
1125nv_ro32(struct nouveau_gpuobj *gpuobj, u32 offset) 1142nv_ro32(struct nouveau_gpuobj *gpuobj, u32 offset)
1126{ 1143{
1127 struct drm_device *dev = gpuobj->dev; 1144 return nv_ri32(gpuobj->dev, gpuobj->pinst + offset);
1128 return nv_ri32(dev, gpuobj->im_pramin->start + offset);
1129} 1145}
1130 1146
1131void 1147void
1132nv_wo32(struct nouveau_gpuobj *gpuobj, u32 offset, u32 val) 1148nv_wo32(struct nouveau_gpuobj *gpuobj, u32 offset, u32 val)
1133{ 1149{
1134 struct drm_device *dev = gpuobj->dev; 1150 nv_wi32(gpuobj->dev, gpuobj->pinst + offset, val);
1135 nv_wi32(dev, gpuobj->im_pramin->start + offset, val);
1136} 1151}