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_display.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_display.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 46 |
1 files changed, 29 insertions, 17 deletions
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) | |||
201 | static int nv50_display_disable(struct drm_device *dev) | 201 | static 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 | |||
346 | nv50_display_destroy(struct drm_device *dev) | 354 | nv50_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 | ||
359 | static u16 | 369 | static u16 |
@@ -469,11 +479,12 @@ static void | |||
469 | nv50_display_unk10_handler(struct drm_device *dev) | 479 | nv50_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 | |||
590 | nv50_display_unk20_handler(struct drm_device *dev) | 601 | nv50_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 | ||
702 | ack: | 714 | ack: |
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) | |||
738 | static void | 750 | static void |
739 | nv50_display_unk40_handler(struct drm_device *dev) | 751 | nv50_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 | ||