Commit 1575b364 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: fixup init/fini sequence to deal with no CRTCs

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 048a8859
...@@ -793,7 +793,7 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan, ...@@ -793,7 +793,7 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,
return ret; return ret;
/* dma objects for display sync channel semaphore blocks */ /* dma objects for display sync channel semaphore blocks */
for (i = 0; i < 2; i++) { for (i = 0; i < dev->mode_config.num_crtc; i++) {
struct nouveau_gpuobj *sem = NULL; struct nouveau_gpuobj *sem = NULL;
struct nv50_display_crtc *dispc = struct nv50_display_crtc *dispc =
&nv50_display(dev)->crtc[i]; &nv50_display(dev)->crtc[i];
...@@ -878,7 +878,7 @@ nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan) ...@@ -878,7 +878,7 @@ nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan)
if (dev_priv->card_type >= NV_50) { if (dev_priv->card_type >= NV_50) {
struct nv50_display *disp = nv50_display(dev); struct nv50_display *disp = nv50_display(dev);
for (i = 0; i < 2; i++) { for (i = 0; i < dev->mode_config.num_crtc; i++) {
struct nv50_display_crtc *dispc = &disp->crtc[i]; struct nv50_display_crtc *dispc = &disp->crtc[i];
nouveau_bo_vma_del(dispc->sem.bo, &chan->dispc_vma[i]); nouveau_bo_vma_del(dispc->sem.bo, &chan->dispc_vma[i]);
} }
......
...@@ -452,21 +452,6 @@ nouveau_vga_set_decode(void *priv, bool state) ...@@ -452,21 +452,6 @@ nouveau_vga_set_decode(void *priv, bool state)
return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
} }
static int
nouveau_card_init_channel(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
int ret;
ret = nouveau_channel_alloc(dev, &dev_priv->channel, NULL,
NvDmaFB, NvDmaTT);
if (ret)
return ret;
mutex_unlock(&dev_priv->channel->mutex);
return 0;
}
static void nouveau_switcheroo_set_state(struct pci_dev *pdev, static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
enum vga_switcheroo_state state) enum vga_switcheroo_state state)
{ {
...@@ -657,6 +642,10 @@ nouveau_card_init(struct drm_device *dev) ...@@ -657,6 +642,10 @@ nouveau_card_init(struct drm_device *dev)
goto out_engine; goto out_engine;
} }
ret = nouveau_irq_init(dev);
if (ret)
goto out_fifo;
/* initialise general modesetting */ /* initialise general modesetting */
drm_mode_config_init(dev); drm_mode_config_init(dev);
drm_mode_create_scaling_mode_property(dev); drm_mode_create_scaling_mode_property(dev);
...@@ -679,39 +668,40 @@ nouveau_card_init(struct drm_device *dev) ...@@ -679,39 +668,40 @@ nouveau_card_init(struct drm_device *dev)
ret = engine->display.create(dev); ret = engine->display.create(dev);
if (ret) if (ret)
goto out_fifo; goto out_irq;
ret = drm_vblank_init(dev, nv_two_heads(dev) ? 2 : 1);
if (ret)
goto out_vblank;
ret = nouveau_irq_init(dev);
if (ret)
goto out_vblank;
/* what about PVIDEO/PCRTC/PRAMDAC etc? */
if (dev_priv->eng[NVOBJ_ENGINE_GR]) { if (dev_priv->eng[NVOBJ_ENGINE_GR]) {
ret = nouveau_fence_init(dev); ret = nouveau_fence_init(dev);
if (ret) if (ret)
goto out_irq; goto out_disp;
ret = nouveau_card_init_channel(dev); ret = nouveau_channel_alloc(dev, &dev_priv->channel, NULL,
NvDmaFB, NvDmaTT);
if (ret) if (ret)
goto out_fence; goto out_fence;
mutex_unlock(&dev_priv->channel->mutex);
}
if (dev->mode_config.num_crtc) {
ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
if (ret)
goto out_chan;
nouveau_fbcon_init(dev);
drm_kms_helper_poll_init(dev);
} }
nouveau_fbcon_init(dev);
drm_kms_helper_poll_init(dev);
return 0; return 0;
out_chan:
nouveau_channel_put_unlocked(&dev_priv->channel);
out_fence: out_fence:
nouveau_fence_fini(dev); nouveau_fence_fini(dev);
out_disp:
engine->display.destroy(dev);
out_irq: out_irq:
nouveau_irq_fini(dev); nouveau_irq_fini(dev);
out_vblank:
drm_vblank_cleanup(dev);
engine->display.destroy(dev);
out_fifo: out_fifo:
if (!dev_priv->noaccel) if (!dev_priv->noaccel)
engine->fifo.takedown(dev); engine->fifo.takedown(dev);
...@@ -758,8 +748,11 @@ static void nouveau_card_takedown(struct drm_device *dev) ...@@ -758,8 +748,11 @@ static void nouveau_card_takedown(struct drm_device *dev)
struct nouveau_engine *engine = &dev_priv->engine; struct nouveau_engine *engine = &dev_priv->engine;
int e; int e;
drm_kms_helper_poll_fini(dev); if (dev->mode_config.num_crtc) {
nouveau_fbcon_fini(dev); drm_kms_helper_poll_fini(dev);
nouveau_fbcon_fini(dev);
drm_vblank_cleanup(dev);
}
if (dev_priv->channel) { if (dev_priv->channel) {
nouveau_channel_put_unlocked(&dev_priv->channel); nouveau_channel_put_unlocked(&dev_priv->channel);
...@@ -801,7 +794,6 @@ static void nouveau_card_takedown(struct drm_device *dev) ...@@ -801,7 +794,6 @@ static void nouveau_card_takedown(struct drm_device *dev)
engine->vram.takedown(dev); engine->vram.takedown(dev);
nouveau_irq_fini(dev); nouveau_irq_fini(dev);
drm_vblank_cleanup(dev);
nouveau_pm_fini(dev); nouveau_pm_fini(dev);
nouveau_bios_takedown(dev); nouveau_bios_takedown(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment