aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h9
-rw-r--r--drivers/gpu/drm/nouveau/nv50_crtc.c16
-rw-r--r--drivers/gpu/drm/nouveau/nv50_cursor.c8
-rw-r--r--drivers/gpu/drm/nouveau/nv50_dac.c6
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c46
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.h18
-rw-r--r--drivers/gpu/drm/nouveau/nv50_evo.c64
-rw-r--r--drivers/gpu/drm/nouveau/nv50_evo.h2
-rw-r--r--drivers/gpu/drm/nouveau/nv50_sor.c6
9 files changed, 96 insertions, 79 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 2e3d7fb4912..da426b95cc8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -387,6 +387,7 @@ struct nouveau_pgraph_engine {
387}; 387};
388 388
389struct nouveau_display_engine { 389struct nouveau_display_engine {
390 void *priv;
390 int (*early_init)(struct drm_device *); 391 int (*early_init)(struct drm_device *);
391 void (*late_takedown)(struct drm_device *); 392 void (*late_takedown)(struct drm_device *);
392 int (*create)(struct drm_device *); 393 int (*create)(struct drm_device *);
@@ -747,14 +748,6 @@ struct drm_nouveau_private {
747 748
748 struct backlight_device *backlight; 749 struct backlight_device *backlight;
749 750
750 struct nouveau_channel *evo;
751 u32 evo_alloc;
752 struct {
753 struct dcb_entry *dcb;
754 u16 script;
755 u32 pclk;
756 } evo_irq;
757
758 struct { 751 struct {
759 struct dentry *channel_root; 752 struct dentry *channel_root;
760 } debugfs; 753 } debugfs;
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
index 9023c4dbb44..62a563eedfe 100644
--- a/drivers/gpu/drm/nouveau/nv50_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
@@ -65,7 +65,7 @@ nv50_crtc_blank(struct nouveau_crtc *nv_crtc, bool blanked)
65{ 65{
66 struct drm_device *dev = nv_crtc->base.dev; 66 struct drm_device *dev = nv_crtc->base.dev;
67 struct drm_nouveau_private *dev_priv = dev->dev_private; 67 struct drm_nouveau_private *dev_priv = dev->dev_private;
68 struct nouveau_channel *evo = dev_priv->evo; 68 struct nouveau_channel *evo = nv50_display(dev)->evo;
69 int index = nv_crtc->index, ret; 69 int index = nv_crtc->index, ret;
70 70
71 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); 71 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
@@ -135,8 +135,7 @@ static int
135nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update) 135nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
136{ 136{
137 struct drm_device *dev = nv_crtc->base.dev; 137 struct drm_device *dev = nv_crtc->base.dev;
138 struct drm_nouveau_private *dev_priv = dev->dev_private; 138 struct nouveau_channel *evo = nv50_display(dev)->evo;
139 struct nouveau_channel *evo = dev_priv->evo;
140 int ret; 139 int ret;
141 140
142 NV_DEBUG_KMS(dev, "\n"); 141 NV_DEBUG_KMS(dev, "\n");
@@ -186,8 +185,7 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update)
186 struct nouveau_connector *nv_connector = 185 struct nouveau_connector *nv_connector =
187 nouveau_crtc_connector_get(nv_crtc); 186 nouveau_crtc_connector_get(nv_crtc);
188 struct drm_device *dev = nv_crtc->base.dev; 187 struct drm_device *dev = nv_crtc->base.dev;
189 struct drm_nouveau_private *dev_priv = dev->dev_private; 188 struct nouveau_channel *evo = nv50_display(dev)->evo;
190 struct nouveau_channel *evo = dev_priv->evo;
191 struct drm_display_mode *native_mode = NULL; 189 struct drm_display_mode *native_mode = NULL;
192 struct drm_display_mode *mode = &nv_crtc->base.mode; 190 struct drm_display_mode *mode = &nv_crtc->base.mode;
193 uint32_t outX, outY, horiz, vert; 191 uint32_t outX, outY, horiz, vert;
@@ -461,8 +459,7 @@ static void
461nv50_crtc_commit(struct drm_crtc *crtc) 459nv50_crtc_commit(struct drm_crtc *crtc)
462{ 460{
463 struct drm_device *dev = crtc->dev; 461 struct drm_device *dev = crtc->dev;
464 struct drm_nouveau_private *dev_priv = dev->dev_private; 462 struct nouveau_channel *evo = nv50_display(dev)->evo;
465 struct nouveau_channel *evo = dev_priv->evo;
466 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 463 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
467 int ret; 464 int ret;
468 465
@@ -496,7 +493,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
496 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 493 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
497 struct drm_device *dev = nv_crtc->base.dev; 494 struct drm_device *dev = nv_crtc->base.dev;
498 struct drm_nouveau_private *dev_priv = dev->dev_private; 495 struct drm_nouveau_private *dev_priv = dev->dev_private;
499 struct nouveau_channel *evo = dev_priv->evo; 496 struct nouveau_channel *evo = nv50_display(dev)->evo;
500 struct drm_framebuffer *drm_fb = nv_crtc->base.fb; 497 struct drm_framebuffer *drm_fb = nv_crtc->base.fb;
501 struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); 498 struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
502 int ret, format; 499 int ret, format;
@@ -619,8 +616,7 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
619 struct drm_framebuffer *old_fb) 616 struct drm_framebuffer *old_fb)
620{ 617{
621 struct drm_device *dev = crtc->dev; 618 struct drm_device *dev = crtc->dev;
622 struct drm_nouveau_private *dev_priv = dev->dev_private; 619 struct nouveau_channel *evo = nv50_display(dev)->evo;
623 struct nouveau_channel *evo = dev_priv->evo;
624 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 620 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
625 struct nouveau_connector *nv_connector = NULL; 621 struct nouveau_connector *nv_connector = NULL;
626 uint32_t hsync_dur, vsync_dur, hsync_start_to_end, vsync_start_to_end; 622 uint32_t hsync_dur, vsync_dur, hsync_start_to_end, vsync_start_to_end;
diff --git a/drivers/gpu/drm/nouveau/nv50_cursor.c b/drivers/gpu/drm/nouveau/nv50_cursor.c
index 1b9ce3021aa..ba75f95ca52 100644
--- a/drivers/gpu/drm/nouveau/nv50_cursor.c
+++ b/drivers/gpu/drm/nouveau/nv50_cursor.c
@@ -36,9 +36,9 @@
36static void 36static void
37nv50_cursor_show(struct nouveau_crtc *nv_crtc, bool update) 37nv50_cursor_show(struct nouveau_crtc *nv_crtc, bool update)
38{ 38{
39 struct drm_nouveau_private *dev_priv = nv_crtc->base.dev->dev_private;
40 struct nouveau_channel *evo = dev_priv->evo;
41 struct drm_device *dev = nv_crtc->base.dev; 39 struct drm_device *dev = nv_crtc->base.dev;
40 struct drm_nouveau_private *dev_priv = dev->dev_private;
41 struct nouveau_channel *evo = nv50_display(dev)->evo;
42 int ret; 42 int ret;
43 43
44 NV_DEBUG_KMS(dev, "\n"); 44 NV_DEBUG_KMS(dev, "\n");
@@ -71,9 +71,9 @@ nv50_cursor_show(struct nouveau_crtc *nv_crtc, bool update)
71static void 71static void
72nv50_cursor_hide(struct nouveau_crtc *nv_crtc, bool update) 72nv50_cursor_hide(struct nouveau_crtc *nv_crtc, bool update)
73{ 73{
74 struct drm_nouveau_private *dev_priv = nv_crtc->base.dev->dev_private;
75 struct nouveau_channel *evo = dev_priv->evo;
76 struct drm_device *dev = nv_crtc->base.dev; 74 struct drm_device *dev = nv_crtc->base.dev;
75 struct drm_nouveau_private *dev_priv = dev->dev_private;
76 struct nouveau_channel *evo = nv50_display(dev)->evo;
77 int ret; 77 int ret;
78 78
79 NV_DEBUG_KMS(dev, "\n"); 79 NV_DEBUG_KMS(dev, "\n");
diff --git a/drivers/gpu/drm/nouveau/nv50_dac.c b/drivers/gpu/drm/nouveau/nv50_dac.c
index 875414b09ad..ca9af5b30d2 100644
--- a/drivers/gpu/drm/nouveau/nv50_dac.c
+++ b/drivers/gpu/drm/nouveau/nv50_dac.c
@@ -41,8 +41,7 @@ nv50_dac_disconnect(struct drm_encoder *encoder)
41{ 41{
42 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 42 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
43 struct drm_device *dev = encoder->dev; 43 struct drm_device *dev = encoder->dev;
44 struct drm_nouveau_private *dev_priv = dev->dev_private; 44 struct nouveau_channel *evo = nv50_display(dev)->evo;
45 struct nouveau_channel *evo = dev_priv->evo;
46 int ret; 45 int ret;
47 46
48 if (!nv_encoder->crtc) 47 if (!nv_encoder->crtc)
@@ -216,8 +215,7 @@ nv50_dac_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
216{ 215{
217 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 216 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
218 struct drm_device *dev = encoder->dev; 217 struct drm_device *dev = encoder->dev;
219 struct drm_nouveau_private *dev_priv = dev->dev_private; 218 struct nouveau_channel *evo = nv50_display(dev)->evo;
220 struct nouveau_channel *evo = dev_priv->evo;
221 struct nouveau_crtc *crtc = nouveau_crtc(encoder->crtc); 219 struct nouveau_crtc *crtc = nouveau_crtc(encoder->crtc);
222 uint32_t mode_ctl = 0, mode_ctl2 = 0; 220 uint32_t mode_ctl = 0, mode_ctl2 = 0;
223 int ret; 221 int ret;
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index a804a350800..636d3a204f0 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -172,7 +172,7 @@ nv50_display_init(struct drm_device *dev)
172 ret = nv50_evo_init(dev); 172 ret = nv50_evo_init(dev);
173 if (ret) 173 if (ret)
174 return ret; 174 return ret;
175 evo = dev_priv->evo; 175 evo = nv50_display(dev)->evo;
176 176
177 nv_wr32(dev, NV50_PDISPLAY_OBJECTS, (evo->ramin->vinst >> 8) | 9); 177 nv_wr32(dev, NV50_PDISPLAY_OBJECTS, (evo->ramin->vinst >> 8) | 9);
178 178
@@ -201,6 +201,8 @@ nv50_display_init(struct drm_device *dev)
201static int nv50_display_disable(struct drm_device *dev) 201static int nv50_display_disable(struct drm_device *dev)
202{ 202{
203 struct drm_nouveau_private *dev_priv = dev->dev_private; 203 struct drm_nouveau_private *dev_priv = dev->dev_private;
204 struct nv50_display *disp = nv50_display(dev);
205 struct nouveau_channel *evo = disp->evo;
204 struct drm_crtc *drm_crtc; 206 struct drm_crtc *drm_crtc;
205 int ret, i; 207 int ret, i;
206 208
@@ -212,12 +214,12 @@ static int nv50_display_disable(struct drm_device *dev)
212 nv50_crtc_blank(crtc, true); 214 nv50_crtc_blank(crtc, true);
213 } 215 }
214 216
215 ret = RING_SPACE(dev_priv->evo, 2); 217 ret = RING_SPACE(evo, 2);
216 if (ret == 0) { 218 if (ret == 0) {
217 BEGIN_RING(dev_priv->evo, 0, NV50_EVO_UPDATE, 1); 219 BEGIN_RING(evo, 0, NV50_EVO_UPDATE, 1);
218 OUT_RING(dev_priv->evo, 0); 220 OUT_RING(evo, 0);
219 } 221 }
220 FIRE_RING(dev_priv->evo); 222 FIRE_RING(evo);
221 223
222 /* Almost like ack'ing a vblank interrupt, maybe in the spirit of 224 /* Almost like ack'ing a vblank interrupt, maybe in the spirit of
223 * cleaning up? 225 * cleaning up?
@@ -267,10 +269,16 @@ int nv50_display_create(struct drm_device *dev)
267 struct drm_nouveau_private *dev_priv = dev->dev_private; 269 struct drm_nouveau_private *dev_priv = dev->dev_private;
268 struct dcb_table *dcb = &dev_priv->vbios.dcb; 270 struct dcb_table *dcb = &dev_priv->vbios.dcb;
269 struct drm_connector *connector, *ct; 271 struct drm_connector *connector, *ct;
272 struct nv50_display *priv;
270 int ret, i; 273 int ret, i;
271 274
272 NV_DEBUG_KMS(dev, "\n"); 275 NV_DEBUG_KMS(dev, "\n");
273 276
277 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
278 if (!priv)
279 return -ENOMEM;
280 dev_priv->engine.display.priv = priv;
281
274 /* init basic kernel modesetting */ 282 /* init basic kernel modesetting */
275 drm_mode_config_init(dev); 283 drm_mode_config_init(dev);
276 284
@@ -346,6 +354,7 @@ void
346nv50_display_destroy(struct drm_device *dev) 354nv50_display_destroy(struct drm_device *dev)
347{ 355{
348 struct drm_nouveau_private *dev_priv = dev->dev_private; 356 struct drm_nouveau_private *dev_priv = dev->dev_private;
357 struct nv50_display *disp = nv50_display(dev);
349 358
350 NV_DEBUG_KMS(dev, "\n"); 359 NV_DEBUG_KMS(dev, "\n");
351 360
@@ -354,6 +363,7 @@ nv50_display_destroy(struct drm_device *dev)
354 nv50_display_disable(dev); 363 nv50_display_disable(dev);
355 nouveau_irq_unregister(dev, 26); 364 nouveau_irq_unregister(dev, 26);
356 flush_work_sync(&dev_priv->irq_work); 365 flush_work_sync(&dev_priv->irq_work);
366 kfree(disp);
357} 367}
358 368
359static u16 369static u16
@@ -469,11 +479,12 @@ static void
469nv50_display_unk10_handler(struct drm_device *dev) 479nv50_display_unk10_handler(struct drm_device *dev)
470{ 480{
471 struct drm_nouveau_private *dev_priv = dev->dev_private; 481 struct drm_nouveau_private *dev_priv = dev->dev_private;
482 struct nv50_display *disp = nv50_display(dev);
472 u32 unk30 = nv_rd32(dev, 0x610030), mc; 483 u32 unk30 = nv_rd32(dev, 0x610030), mc;
473 int i, crtc, or, type = OUTPUT_ANY; 484 int i, crtc, or, type = OUTPUT_ANY;
474 485
475 NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); 486 NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30);
476 dev_priv->evo_irq.dcb = NULL; 487 disp->irq.dcb = NULL;
477 488
478 nv_wr32(dev, 0x619494, nv_rd32(dev, 0x619494) & ~8); 489 nv_wr32(dev, 0x619494, nv_rd32(dev, 0x619494) & ~8);
479 490
@@ -544,7 +555,7 @@ nv50_display_unk10_handler(struct drm_device *dev)
544 555
545 if (dcb->type == type && (dcb->or & (1 << or))) { 556 if (dcb->type == type && (dcb->or & (1 << or))) {
546 nouveau_bios_run_display_table(dev, dcb, 0, -1); 557 nouveau_bios_run_display_table(dev, dcb, 0, -1);
547 dev_priv->evo_irq.dcb = dcb; 558 disp->irq.dcb = dcb;
548 goto ack; 559 goto ack;
549 } 560 }
550 } 561 }
@@ -590,15 +601,16 @@ static void
590nv50_display_unk20_handler(struct drm_device *dev) 601nv50_display_unk20_handler(struct drm_device *dev)
591{ 602{
592 struct drm_nouveau_private *dev_priv = dev->dev_private; 603 struct drm_nouveau_private *dev_priv = dev->dev_private;
604 struct nv50_display *disp = nv50_display(dev);
593 u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0; 605 u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0;
594 struct dcb_entry *dcb; 606 struct dcb_entry *dcb;
595 int i, crtc, or, type = OUTPUT_ANY; 607 int i, crtc, or, type = OUTPUT_ANY;
596 608
597 NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); 609 NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30);
598 dcb = dev_priv->evo_irq.dcb; 610 dcb = disp->irq.dcb;
599 if (dcb) { 611 if (dcb) {
600 nouveau_bios_run_display_table(dev, dcb, 0, -2); 612 nouveau_bios_run_display_table(dev, dcb, 0, -2);
601 dev_priv->evo_irq.dcb = NULL; 613 disp->irq.dcb = NULL;
602 } 614 }
603 615
604 /* CRTC clock change requested? */ 616 /* CRTC clock change requested? */
@@ -695,9 +707,9 @@ nv50_display_unk20_handler(struct drm_device *dev)
695 nv_wr32(dev, NV50_PDISPLAY_DAC_CLK_CTRL2(or), 0); 707 nv_wr32(dev, NV50_PDISPLAY_DAC_CLK_CTRL2(or), 0);
696 } 708 }
697 709
698 dev_priv->evo_irq.dcb = dcb; 710 disp->irq.dcb = dcb;
699 dev_priv->evo_irq.pclk = pclk; 711 disp->irq.pclk = pclk;
700 dev_priv->evo_irq.script = script; 712 disp->irq.script = script;
701 713
702ack: 714ack:
703 nv_wr32(dev, NV50_PDISPLAY_INTR_1, NV50_PDISPLAY_INTR_1_CLK_UNK20); 715 nv_wr32(dev, NV50_PDISPLAY_INTR_1, NV50_PDISPLAY_INTR_1_CLK_UNK20);
@@ -738,13 +750,13 @@ nv50_display_unk40_dp_set_tmds(struct drm_device *dev, struct dcb_entry *dcb)
738static void 750static void
739nv50_display_unk40_handler(struct drm_device *dev) 751nv50_display_unk40_handler(struct drm_device *dev)
740{ 752{
741 struct drm_nouveau_private *dev_priv = dev->dev_private; 753 struct nv50_display *disp = nv50_display(dev);
742 struct dcb_entry *dcb = dev_priv->evo_irq.dcb; 754 struct dcb_entry *dcb = disp->irq.dcb;
743 u16 script = dev_priv->evo_irq.script; 755 u16 script = disp->irq.script;
744 u32 unk30 = nv_rd32(dev, 0x610030), pclk = dev_priv->evo_irq.pclk; 756 u32 unk30 = nv_rd32(dev, 0x610030), pclk = disp->irq.pclk;
745 757
746 NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); 758 NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30);
747 dev_priv->evo_irq.dcb = NULL; 759 disp->irq.dcb = NULL;
748 if (!dcb) 760 if (!dcb)
749 goto ack; 761 goto ack;
750 762
diff --git a/drivers/gpu/drm/nouveau/nv50_display.h b/drivers/gpu/drm/nouveau/nv50_display.h
index f0e30b78ef6..7edd02059b8 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.h
+++ b/drivers/gpu/drm/nouveau/nv50_display.h
@@ -35,6 +35,24 @@
35#include "nouveau_crtc.h" 35#include "nouveau_crtc.h"
36#include "nv50_evo.h" 36#include "nv50_evo.h"
37 37
38struct nv50_display {
39 struct nouveau_channel *evo;
40 u32 evo_alloc;
41
42 struct {
43 struct dcb_entry *dcb;
44 u16 script;
45 u32 pclk;
46 } irq;
47};
48
49static inline struct nv50_display *
50nv50_display(struct drm_device *dev)
51{
52 struct drm_nouveau_private *dev_priv = dev->dev_private;
53 return dev_priv->engine.display.priv;
54}
55
38void nv50_display_irq_handler_bh(struct work_struct *work); 56void nv50_display_irq_handler_bh(struct work_struct *work);
39int nv50_display_early_init(struct drm_device *dev); 57int nv50_display_early_init(struct drm_device *dev);
40void nv50_display_late_takedown(struct drm_device *dev); 58void nv50_display_late_takedown(struct drm_device *dev);
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c
index 0ea090f4244..d3222a73c28 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
31static void 32static void
32nv50_evo_channel_del(struct nouveau_channel **pevo) 33nv50_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,
86static int 87static int
87nv50_evo_channel_new(struct drm_device *dev, struct nouveau_channel **pevo) 88nv50_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
216nv50_evo_create(struct drm_device *dev) 217nv50_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)
320int 322int
321nv50_evo_init(struct drm_device *dev) 323nv50_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
335void 337void
336nv50_evo_fini(struct drm_device *dev) 338nv50_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}
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.h b/drivers/gpu/drm/nouveau/nv50_evo.h
index aa4f0d3cea8..95c411905b1 100644
--- a/drivers/gpu/drm/nouveau/nv50_evo.h
+++ b/drivers/gpu/drm/nouveau/nv50_evo.h
@@ -31,7 +31,7 @@ int nv50_evo_init(struct drm_device *dev);
31void nv50_evo_fini(struct drm_device *dev); 31void nv50_evo_fini(struct drm_device *dev);
32int nv50_evo_dmaobj_new(struct nouveau_channel *, u32 class, u32 name, 32int nv50_evo_dmaobj_new(struct nouveau_channel *, u32 class, u32 name,
33 u32 tile_flags, u32 magic_flags, 33 u32 tile_flags, u32 magic_flags,
34 u32 offset, u32 limit); 34 u32 offset, u32 limit, u32 flags5);
35 35
36#define NV50_EVO_UPDATE 0x00000080 36#define NV50_EVO_UPDATE 0x00000080
37#define NV50_EVO_UNK84 0x00000084 37#define NV50_EVO_UNK84 0x00000084
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c
index b4a5ecb199f..9138d1918ec 100644
--- a/drivers/gpu/drm/nouveau/nv50_sor.c
+++ b/drivers/gpu/drm/nouveau/nv50_sor.c
@@ -41,8 +41,7 @@ nv50_sor_disconnect(struct drm_encoder *encoder)
41{ 41{
42 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 42 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
43 struct drm_device *dev = encoder->dev; 43 struct drm_device *dev = encoder->dev;
44 struct drm_nouveau_private *dev_priv = dev->dev_private; 44 struct nouveau_channel *evo = nv50_display(dev)->evo;
45 struct nouveau_channel *evo = dev_priv->evo;
46 int ret; 45 int ret;
47 46
48 if (!nv_encoder->crtc) 47 if (!nv_encoder->crtc)
@@ -184,8 +183,7 @@ static void
184nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, 183nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
185 struct drm_display_mode *adjusted_mode) 184 struct drm_display_mode *adjusted_mode)
186{ 185{
187 struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; 186 struct nouveau_channel *evo = nv50_display(encoder->dev)->evo;
188 struct nouveau_channel *evo = dev_priv->evo;
189 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 187 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
190 struct drm_device *dev = encoder->dev; 188 struct drm_device *dev = encoder->dev;
191 struct nouveau_crtc *crtc = nouveau_crtc(encoder->crtc); 189 struct nouveau_crtc *crtc = nouveau_crtc(encoder->crtc);