diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-01-31 19:07:32 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-02-24 15:44:39 -0500 |
commit | ef8389a84bbd80daaf6c60a5534461d82ba22c0a (patch) | |
tree | a0f97e81eb0b74f48724ff40825b9792bdc8e29d /drivers/gpu/drm/nouveau/nv50_evo.c | |
parent | d82f8e6c802bb1244ce590d3877f7c66a8fb0ff0 (diff) |
drm/nv50-nvc0: move non-sharable display state into private structure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_evo.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_evo.c | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index 0ea090f4244a..d3222a73c28e 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
@@ -27,19 +27,20 @@ | |||
27 | #include "nouveau_drv.h" | 27 | #include "nouveau_drv.h" |
28 | #include "nouveau_dma.h" | 28 | #include "nouveau_dma.h" |
29 | #include "nouveau_ramht.h" | 29 | #include "nouveau_ramht.h" |
30 | #include "nv50_display.h" | ||
30 | 31 | ||
31 | static void | 32 | static void |
32 | nv50_evo_channel_del(struct nouveau_channel **pevo) | 33 | nv50_evo_channel_del(struct nouveau_channel **pevo) |
33 | { | 34 | { |
34 | struct drm_nouveau_private *dev_priv; | ||
35 | struct nouveau_channel *evo = *pevo; | 35 | struct nouveau_channel *evo = *pevo; |
36 | struct nv50_display *disp; | ||
36 | 37 | ||
37 | if (!evo) | 38 | if (!evo) |
38 | return; | 39 | return; |
39 | *pevo = NULL; | 40 | *pevo = NULL; |
40 | 41 | ||
41 | dev_priv = evo->dev->dev_private; | 42 | disp = nv50_display(evo->dev); |
42 | dev_priv->evo_alloc &= ~(1 << evo->id); | 43 | disp->evo_alloc &= ~(1 << evo->id); |
43 | 44 | ||
44 | nouveau_gpuobj_channel_takedown(evo); | 45 | nouveau_gpuobj_channel_takedown(evo); |
45 | nouveau_bo_unmap(evo->pushbuf_bo); | 46 | nouveau_bo_unmap(evo->pushbuf_bo); |
@@ -57,11 +58,11 @@ nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name, | |||
57 | u32 flags5) | 58 | u32 flags5) |
58 | { | 59 | { |
59 | struct drm_nouveau_private *dev_priv = evo->dev->dev_private; | 60 | struct drm_nouveau_private *dev_priv = evo->dev->dev_private; |
60 | struct drm_device *dev = evo->dev; | 61 | struct nv50_display *disp = nv50_display(evo->dev); |
61 | struct nouveau_gpuobj *obj = NULL; | 62 | struct nouveau_gpuobj *obj = NULL; |
62 | int ret; | 63 | int ret; |
63 | 64 | ||
64 | ret = nouveau_gpuobj_new(dev, dev_priv->evo, 6*4, 32, 0, &obj); | 65 | ret = nouveau_gpuobj_new(evo->dev, disp->evo, 6*4, 32, 0, &obj); |
65 | if (ret) | 66 | if (ret) |
66 | return ret; | 67 | return ret; |
67 | obj->engine = NVOBJ_ENGINE_DISPLAY; | 68 | obj->engine = NVOBJ_ENGINE_DISPLAY; |
@@ -72,7 +73,7 @@ nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name, | |||
72 | nv_wo32(obj, 12, 0x00000000); | 73 | nv_wo32(obj, 12, 0x00000000); |
73 | nv_wo32(obj, 16, 0x00000000); | 74 | nv_wo32(obj, 16, 0x00000000); |
74 | nv_wo32(obj, 20, flags5); | 75 | nv_wo32(obj, 20, flags5); |
75 | dev_priv->engine.instmem.flush(dev); | 76 | dev_priv->engine.instmem.flush(evo->dev); |
76 | 77 | ||
77 | ret = nouveau_ramht_insert(evo, name, obj); | 78 | ret = nouveau_ramht_insert(evo, name, obj); |
78 | nouveau_gpuobj_ref(NULL, &obj); | 79 | nouveau_gpuobj_ref(NULL, &obj); |
@@ -86,7 +87,7 @@ nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name, | |||
86 | static int | 87 | static int |
87 | nv50_evo_channel_new(struct drm_device *dev, struct nouveau_channel **pevo) | 88 | nv50_evo_channel_new(struct drm_device *dev, struct nouveau_channel **pevo) |
88 | { | 89 | { |
89 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 90 | struct nv50_display *disp = nv50_display(dev); |
90 | struct nouveau_channel *evo; | 91 | struct nouveau_channel *evo; |
91 | int ret; | 92 | int ret; |
92 | 93 | ||
@@ -96,10 +97,10 @@ nv50_evo_channel_new(struct drm_device *dev, struct nouveau_channel **pevo) | |||
96 | *pevo = evo; | 97 | *pevo = evo; |
97 | 98 | ||
98 | for (evo->id = 0; evo->id < 5; evo->id++) { | 99 | for (evo->id = 0; evo->id < 5; evo->id++) { |
99 | if (dev_priv->evo_alloc & (1 << evo->id)) | 100 | if (disp->evo_alloc & (1 << evo->id)) |
100 | continue; | 101 | continue; |
101 | 102 | ||
102 | dev_priv->evo_alloc |= (1 << evo->id); | 103 | disp->evo_alloc |= (1 << evo->id); |
103 | break; | 104 | break; |
104 | } | 105 | } |
105 | 106 | ||
@@ -138,8 +139,8 @@ nv50_evo_channel_new(struct drm_device *dev, struct nouveau_channel **pevo) | |||
138 | } | 139 | } |
139 | 140 | ||
140 | /* bind primary evo channel's ramht to the channel */ | 141 | /* bind primary evo channel's ramht to the channel */ |
141 | if (dev_priv->evo && evo != dev_priv->evo) | 142 | if (disp->evo && evo != disp->evo) |
142 | nouveau_ramht_ref(dev_priv->evo->ramht, &evo->ramht, NULL); | 143 | nouveau_ramht_ref(disp->evo->ramht, &evo->ramht, NULL); |
143 | 144 | ||
144 | return 0; | 145 | return 0; |
145 | } | 146 | } |
@@ -216,6 +217,7 @@ static int | |||
216 | nv50_evo_create(struct drm_device *dev) | 217 | nv50_evo_create(struct drm_device *dev) |
217 | { | 218 | { |
218 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 219 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
220 | struct nv50_display *disp = nv50_display(dev); | ||
219 | struct nouveau_gpuobj *ramht = NULL; | 221 | struct nouveau_gpuobj *ramht = NULL; |
220 | struct nouveau_channel *evo; | 222 | struct nouveau_channel *evo; |
221 | int ret; | 223 | int ret; |
@@ -223,10 +225,10 @@ nv50_evo_create(struct drm_device *dev) | |||
223 | /* create primary evo channel, the one we use for modesetting | 225 | /* create primary evo channel, the one we use for modesetting |
224 | * purporses | 226 | * purporses |
225 | */ | 227 | */ |
226 | ret = nv50_evo_channel_new(dev, &dev_priv->evo); | 228 | ret = nv50_evo_channel_new(dev, &disp->evo); |
227 | if (ret) | 229 | if (ret) |
228 | return ret; | 230 | return ret; |
229 | evo = dev_priv->evo; | 231 | evo = disp->evo; |
230 | 232 | ||
231 | /* setup object management on it, any other evo channel will | 233 | /* setup object management on it, any other evo channel will |
232 | * use this also as there's no per-channel support on the | 234 | * use this also as there's no per-channel support on the |
@@ -236,28 +238,28 @@ nv50_evo_create(struct drm_device *dev) | |||
236 | NVOBJ_FLAG_ZERO_ALLOC, &evo->ramin); | 238 | NVOBJ_FLAG_ZERO_ALLOC, &evo->ramin); |
237 | if (ret) { | 239 | if (ret) { |
238 | NV_ERROR(dev, "Error allocating EVO channel memory: %d\n", ret); | 240 | NV_ERROR(dev, "Error allocating EVO channel memory: %d\n", ret); |
239 | nv50_evo_channel_del(&dev_priv->evo); | 241 | nv50_evo_channel_del(&disp->evo); |
240 | return ret; | 242 | return ret; |
241 | } | 243 | } |
242 | 244 | ||
243 | ret = drm_mm_init(&evo->ramin_heap, 0, 32768); | 245 | ret = drm_mm_init(&evo->ramin_heap, 0, 32768); |
244 | if (ret) { | 246 | if (ret) { |
245 | NV_ERROR(dev, "Error initialising EVO PRAMIN heap: %d\n", ret); | 247 | NV_ERROR(dev, "Error initialising EVO PRAMIN heap: %d\n", ret); |
246 | nv50_evo_channel_del(&dev_priv->evo); | 248 | nv50_evo_channel_del(&disp->evo); |
247 | return ret; | 249 | return ret; |
248 | } | 250 | } |
249 | 251 | ||
250 | ret = nouveau_gpuobj_new(dev, evo, 4096, 16, 0, &ramht); | 252 | ret = nouveau_gpuobj_new(dev, evo, 4096, 16, 0, &ramht); |
251 | if (ret) { | 253 | if (ret) { |
252 | NV_ERROR(dev, "Unable to allocate EVO RAMHT: %d\n", ret); | 254 | NV_ERROR(dev, "Unable to allocate EVO RAMHT: %d\n", ret); |
253 | nv50_evo_channel_del(&dev_priv->evo); | 255 | nv50_evo_channel_del(&disp->evo); |
254 | return ret; | 256 | return ret; |
255 | } | 257 | } |
256 | 258 | ||
257 | ret = nouveau_ramht_new(dev, ramht, &evo->ramht); | 259 | ret = nouveau_ramht_new(dev, ramht, &evo->ramht); |
258 | nouveau_gpuobj_ref(NULL, &ramht); | 260 | nouveau_gpuobj_ref(NULL, &ramht); |
259 | if (ret) { | 261 | if (ret) { |
260 | nv50_evo_channel_del(&dev_priv->evo); | 262 | nv50_evo_channel_del(&disp->evo); |
261 | return ret; | 263 | return ret; |
262 | } | 264 | } |
263 | 265 | ||
@@ -266,28 +268,28 @@ nv50_evo_create(struct drm_device *dev) | |||
266 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0xfe, 0x19, | 268 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0xfe, 0x19, |
267 | 0, 0xffffffff, 0x00000000); | 269 | 0, 0xffffffff, 0x00000000); |
268 | if (ret) { | 270 | if (ret) { |
269 | nv50_evo_channel_del(&dev_priv->evo); | 271 | nv50_evo_channel_del(&disp->evo); |
270 | return ret; | 272 | return ret; |
271 | } | 273 | } |
272 | 274 | ||
273 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, | 275 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, |
274 | 0, dev_priv->vram_size, 0x00020000); | 276 | 0, dev_priv->vram_size, 0x00020000); |
275 | if (ret) { | 277 | if (ret) { |
276 | nv50_evo_channel_del(&dev_priv->evo); | 278 | nv50_evo_channel_del(&disp->evo); |
277 | return ret; | 279 | return ret; |
278 | } | 280 | } |
279 | 281 | ||
280 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, | 282 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, |
281 | 0, dev_priv->vram_size, 0x00000000); | 283 | 0, dev_priv->vram_size, 0x00000000); |
282 | if (ret) { | 284 | if (ret) { |
283 | nv50_evo_channel_del(&dev_priv->evo); | 285 | nv50_evo_channel_del(&disp->evo); |
284 | return ret; | 286 | return ret; |
285 | } | 287 | } |
286 | } else { | 288 | } else { |
287 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, | 289 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, |
288 | 0, 0xffffffff, 0x00010000); | 290 | 0, 0xffffffff, 0x00010000); |
289 | if (ret) { | 291 | if (ret) { |
290 | nv50_evo_channel_del(&dev_priv->evo); | 292 | nv50_evo_channel_del(&disp->evo); |
291 | return ret; | 293 | return ret; |
292 | } | 294 | } |
293 | 295 | ||
@@ -295,21 +297,21 @@ nv50_evo_create(struct drm_device *dev) | |||
295 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19, | 297 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19, |
296 | 0, 0xffffffff, 0x00010000); | 298 | 0, 0xffffffff, 0x00010000); |
297 | if (ret) { | 299 | if (ret) { |
298 | nv50_evo_channel_del(&dev_priv->evo); | 300 | nv50_evo_channel_del(&disp->evo); |
299 | return ret; | 301 | return ret; |
300 | } | 302 | } |
301 | 303 | ||
302 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, | 304 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, |
303 | 0, dev_priv->vram_size, 0x00010000); | 305 | 0, dev_priv->vram_size, 0x00010000); |
304 | if (ret) { | 306 | if (ret) { |
305 | nv50_evo_channel_del(&dev_priv->evo); | 307 | nv50_evo_channel_del(&disp->evo); |
306 | return ret; | 308 | return ret; |
307 | } | 309 | } |
308 | 310 | ||
309 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, | 311 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, |
310 | 0, dev_priv->vram_size, 0x00010000); | 312 | 0, dev_priv->vram_size, 0x00010000); |
311 | if (ret) { | 313 | if (ret) { |
312 | nv50_evo_channel_del(&dev_priv->evo); | 314 | nv50_evo_channel_del(&disp->evo); |
313 | return ret; | 315 | return ret; |
314 | } | 316 | } |
315 | } | 317 | } |
@@ -320,25 +322,25 @@ nv50_evo_create(struct drm_device *dev) | |||
320 | int | 322 | int |
321 | nv50_evo_init(struct drm_device *dev) | 323 | nv50_evo_init(struct drm_device *dev) |
322 | { | 324 | { |
323 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 325 | struct nv50_display *disp = nv50_display(dev); |
324 | int ret; | 326 | int ret; |
325 | 327 | ||
326 | if (!dev_priv->evo) { | 328 | if (!disp->evo) { |
327 | ret = nv50_evo_create(dev); | 329 | ret = nv50_evo_create(dev); |
328 | if (ret) | 330 | if (ret) |
329 | return ret; | 331 | return ret; |
330 | } | 332 | } |
331 | 333 | ||
332 | return nv50_evo_channel_init(dev_priv->evo); | 334 | return nv50_evo_channel_init(disp->evo); |
333 | } | 335 | } |
334 | 336 | ||
335 | void | 337 | void |
336 | nv50_evo_fini(struct drm_device *dev) | 338 | nv50_evo_fini(struct drm_device *dev) |
337 | { | 339 | { |
338 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 340 | struct nv50_display *disp = nv50_display(dev); |
339 | 341 | ||
340 | if (dev_priv->evo) { | 342 | if (disp->evo) { |
341 | nv50_evo_channel_fini(dev_priv->evo); | 343 | nv50_evo_channel_fini(disp->evo); |
342 | nv50_evo_channel_del(&dev_priv->evo); | 344 | nv50_evo_channel_del(&disp->evo); |
343 | } | 345 | } |
344 | } | 346 | } |