drm/nouveau: remove PUSHBUF_CAL macro
[pandora-kernel.git] / drivers / gpu / drm / nouveau / nouveau_gem.c
index 70cc308..df72cd8 100644 (file)
@@ -614,8 +614,6 @@ out:
        return ret;
 }
 
-#define PUSHBUF_CAL (dev_priv->card_type >= NV_20)
-
 int
 nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
                               struct drm_file *file_priv)
@@ -703,11 +701,11 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
        /* If presumed return address doesn't match, we need to map the
         * push buffer and fix it..
         */
-       if (!PUSHBUF_CAL) {
+       if (dev_priv->card_type < NV_20) {
                uint32_t retaddy;
 
                if (chan->dma.free < 4 + NOUVEAU_DMA_SKIPS) {
-                       ret = nouveau_dma_wait(chan, 4 + NOUVEAU_DMA_SKIPS);
+                       ret = nouveau_dma_wait(chan, 0, 4 + NOUVEAU_DMA_SKIPS);
                        if (ret) {
                                NV_ERROR(dev, "jmp_space: %d\n", ret);
                                goto out;
@@ -741,7 +739,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
                                                      req->offset / 4,
                                                      pbvirt, is_iomem);
 
-               if (!PUSHBUF_CAL) {
+               if (dev_priv->card_type < NV_20) {
                        nouveau_bo_wr32(pbbo,
                                        req->offset / 4 + req->nr_dwords - 2,
                                        req->suffix0);
@@ -754,7 +752,16 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
                }
        }
 
-       if (PUSHBUF_CAL) {
+       if (chan->dma.ib_max) {
+               ret = nouveau_dma_wait(chan, 2, 6);
+               if (ret) {
+                       NV_INFO(dev, "nv50cal_space: %d\n", ret);
+                       goto out;
+               }
+
+               nv50_dma_push(chan, pbbo, req->offset, req->nr_dwords);
+       } else
+       if (dev_priv->card_type >= NV_20) {
                ret = RING_SPACE(chan, 2);
                if (ret) {
                        NV_ERROR(dev, "cal_space: %d\n", ret);
@@ -792,7 +799,11 @@ out:
        kfree(bo);
 
 out_next:
-       if (PUSHBUF_CAL) {
+       if (chan->dma.ib_max) {
+               req->suffix0 = 0x00000000;
+               req->suffix1 = 0x00000000;
+       } else
+       if (dev_priv->card_type >= NV_20) {
                req->suffix0 = 0x00020000;
                req->suffix1 = 0x00000000;
        } else {