drm/nouveau: start culling unused code
[linux-2.6-block.git] / drivers / gpu / drm / nouveau / nouveau_drv.c
index cea947beb35bcaf2e91adece0bed9e7a107fb089..666c178c6022d252c77d7e3dc2440bc61eeef606 100644 (file)
 #include "drm.h"
 #include "drm_crtc_helper.h"
 #include "nouveau_drv.h"
-#include "nouveau_agp.h"
 #include "nouveau_abi16.h"
 #include "nouveau_hw.h"
 #include "nouveau_fb.h"
 #include "nouveau_fbcon.h"
+#include "nouveau_fence.h"
 #include "nouveau_pm.h"
-#include <engine/fifo.h>
 #include "nv50_display.h"
 
 #include "drm_pciids.h"
@@ -44,10 +43,6 @@ MODULE_PARM_DESC(modeset, "Enable kernel modesetting");
 int nouveau_modeset = -1;
 module_param_named(modeset, nouveau_modeset, int, 0400);
 
-MODULE_PARM_DESC(vram_pushbuf, "Force DMA push buffers to be in VRAM");
-int nouveau_vram_pushbuf;
-module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400);
-
 MODULE_PARM_DESC(vram_notify, "Force DMA notifiers to be in VRAM");
 int nouveau_vram_notify = 0;
 module_param_named(vram_notify, nouveau_vram_notify, int, 0400);
@@ -72,14 +67,6 @@ MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status");
 int nouveau_ignorelid = 0;
 module_param_named(ignorelid, nouveau_ignorelid, int, 0400);
 
-MODULE_PARM_DESC(noaccel, "Disable all acceleration");
-int nouveau_noaccel = -1;
-module_param_named(noaccel, nouveau_noaccel, int, 0400);
-
-MODULE_PARM_DESC(nofbaccel, "Disable fbcon acceleration");
-int nouveau_nofbaccel = 0;
-module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400);
-
 MODULE_PARM_DESC(force_post, "Force POST");
 int nouveau_force_post = 0;
 module_param_named(force_post, nouveau_force_post, int, 0400);
@@ -100,13 +87,6 @@ MODULE_PARM_DESC(tv_norm, "Default TV norm.\n"
 char *nouveau_tv_norm;
 module_param_named(tv_norm, nouveau_tv_norm, charp, 0400);
 
-MODULE_PARM_DESC(reg_debug, "Register access debug bitmask:\n"
-               "\t\t0x1 mc, 0x2 video, 0x4 fb, 0x8 extdev,\n"
-               "\t\t0x10 crtc, 0x20 ramdac, 0x40 vgacrtc, 0x80 rmvio,\n"
-               "\t\t0x100 vgaattr, 0x200 EVO (G80+)");
-int nouveau_reg_debug;
-module_param_named(reg_debug, nouveau_reg_debug, int, 0600);
-
 MODULE_PARM_DESC(perflvl, "Performance level (default: boot)");
 char *nouveau_perflvl;
 module_param_named(perflvl, nouveau_perflvl, charp, 0400);
@@ -152,19 +132,11 @@ int
 nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
 {
        struct drm_device *dev = pci_get_drvdata(pdev);
-       struct drm_nouveau_private *dev_priv = dev->dev_private;
-       struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem;
-       struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
-       struct nouveau_channel *chan;
        struct drm_crtc *crtc;
-       int ret, i, e;
 
        NV_INFO(dev, "Disabling display...\n");
        nouveau_display_fini(dev);
 
-       NV_INFO(dev, "Disabling fbcon...\n");
-       nouveau_fbcon_set_suspend(dev, 1);
-
        NV_INFO(dev, "Unpinning framebuffer(s)...\n");
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
                struct nouveau_framebuffer *nouveau_fb;
@@ -183,92 +155,23 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
                nouveau_bo_unpin(nv_crtc->cursor.nvbo);
        }
 
-       NV_INFO(dev, "Evicting buffers...\n");
-       ttm_bo_evict_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
-
-       NV_INFO(dev, "Idling channels...\n");
-       for (i = 0; i < (pfifo ? pfifo->channels : 0); i++) {
-               chan = dev_priv->channels.ptr[i];
-
-               if (chan && chan->pushbuf_bo)
-                       nouveau_channel_idle(chan);
-       }
-
-       for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
-               if (!dev_priv->eng[e])
-                       continue;
-
-               ret = dev_priv->eng[e]->fini(dev, e, true);
-               if (ret) {
-                       NV_ERROR(dev, "... engine %d failed: %d\n", e, ret);
-                       goto out_abort;
-               }
-       }
-
-       ret = pinstmem->suspend(dev);
-       if (ret) {
-               NV_ERROR(dev, "... failed: %d\n", ret);
-               goto out_abort;
-       }
-
-       NV_INFO(dev, "Suspending GPU objects...\n");
-       ret = nouveau_gpuobj_suspend(dev);
-       if (ret) {
-               NV_ERROR(dev, "... failed: %d\n", ret);
-               pinstmem->resume(dev);
-               goto out_abort;
-       }
-
-       nouveau_agp_fini(dev);
        return 0;
-
-out_abort:
-       NV_INFO(dev, "Re-enabling acceleration..\n");
-       for (e = e + 1; e < NVOBJ_ENGINE_NR; e++) {
-               if (dev_priv->eng[e])
-                       dev_priv->eng[e]->init(dev, e);
-       }
-       return ret;
 }
 
 int
 nouveau_pci_resume(struct pci_dev *pdev)
 {
        struct drm_device *dev = pci_get_drvdata(pdev);
-       struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
-       struct drm_nouveau_private *dev_priv = dev->dev_private;
-       struct nouveau_engine *engine = &dev_priv->engine;
        struct drm_crtc *crtc;
-       int ret, i;
-
-       /* Make sure the AGP controller is in a consistent state */
-       nouveau_agp_reset(dev);
-
-       /* Make the CRTCs accessible */
-       engine->display.early_init(dev);
+       int ret;
 
-       NV_INFO(dev, "POSTing device...\n");
        ret = nouveau_run_vbios_init(dev);
        if (ret)
                return ret;
 
-       nouveau_agp_init(dev);
-
-       NV_INFO(dev, "Restoring GPU objects...\n");
-       nouveau_gpuobj_resume(dev);
-
-       NV_INFO(dev, "Reinitialising engines...\n");
-       engine->instmem.resume(dev);
-       engine->mc.init(dev);
-       engine->timer.init(dev);
-       engine->fb.init(dev);
-       for (i = 0; i < NVOBJ_ENGINE_NR; i++) {
-               if (dev_priv->eng[i])
-                       dev_priv->eng[i]->init(dev, i);
-       }
-
        nouveau_irq_postinstall(dev);
 
+#if 0
        /* Re-write SKIPS, they'll have been lost over the suspend */
        if (nouveau_vram_pushbuf) {
                struct nouveau_channel *chan;
@@ -283,6 +186,7 @@ nouveau_pci_resume(struct pci_dev *pdev)
                                nouveau_bo_wr32(chan->pushbuf_bo, i, 0);
                }
        }
+#endif
 
        nouveau_pm_resume(dev);
 
@@ -365,6 +269,9 @@ static const struct file_operations nouveau_driver_fops = {
 
 int nouveau_drm_load(struct drm_device *, unsigned long);
 int nouveau_drm_unload(struct drm_device *);
+int  nouveau_drm_open(struct drm_device *, struct drm_file *);
+void nouveau_drm_preclose(struct drm_device *dev, struct drm_file *);
+void nouveau_drm_postclose(struct drm_device *, struct drm_file *);
 
 static struct drm_driver driver = {
        .driver_features =
@@ -375,13 +282,9 @@ static struct drm_driver driver = {
        .firstopen = nouveau_firstopen,
        .lastclose = nouveau_lastclose,
        .unload = nouveau_drm_unload,
-       .open = nouveau_open,
-       .preclose = nouveau_preclose,
-       .postclose = nouveau_postclose,
-#if defined(CONFIG_DRM_NOUVEAU_DEBUG)
-       .debugfs_init = nouveau_debugfs_init,
-       .debugfs_cleanup = nouveau_debugfs_takedown,
-#endif
+       .open = nouveau_drm_open,
+       .preclose = nouveau_drm_preclose,
+       .postclose = nouveau_drm_postclose,
        .irq_preinstall = nouveau_irq_preinstall,
        .irq_postinstall = nouveau_irq_postinstall,
        .irq_uninstall = nouveau_irq_uninstall,