]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/gpu/drm/nouveau/nv50_crtc.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / gpu / drm / nouveau / nv50_crtc.c
index 56476d0c6de8ee5255ff6c8916070a5c5ed86aec..9023c4dbb449e0dc78b78108dab3a10945ca0c74 100644 (file)
@@ -115,15 +115,16 @@ nv50_crtc_blank(struct nouveau_crtc *nv_crtc, bool blanked)
                OUT_RING(evo, 0);
                BEGIN_RING(evo, 0, NV50_EVO_CRTC(index, FB_DMA), 1);
                if (dev_priv->chipset != 0x50)
-                       if (nv_crtc->fb.tile_flags == 0x7a00)
+                       if (nv_crtc->fb.tile_flags == 0x7a00 ||
+                           nv_crtc->fb.tile_flags == 0xfe00)
                                OUT_RING(evo, NvEvoFB32);
                        else
                        if (nv_crtc->fb.tile_flags == 0x7000)
                                OUT_RING(evo, NvEvoFB16);
                        else
-                               OUT_RING(evo, NvEvoVRAM);
+                               OUT_RING(evo, NvEvoVRAM_LP);
                else
-                       OUT_RING(evo, NvEvoVRAM);
+                       OUT_RING(evo, NvEvoVRAM_LP);
        }
 
        nv_crtc->fb.blanked = blanked;
@@ -345,7 +346,6 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
                     uint32_t buffer_handle, uint32_t width, uint32_t height)
 {
        struct drm_device *dev = crtc->dev;
-       struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
        struct nouveau_bo *cursor = NULL;
        struct drm_gem_object *gem;
@@ -374,8 +374,7 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 
        nouveau_bo_unmap(cursor);
 
-       nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.nvbo->bo.offset -
-                                           dev_priv->vm_vram_base);
+       nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.nvbo->bo.mem.start << PAGE_SHIFT);
        nv_crtc->cursor.show(nv_crtc, true);
 
 out:
@@ -437,6 +436,7 @@ static const struct drm_crtc_funcs nv50_crtc_funcs = {
        .cursor_move = nv50_crtc_cursor_move,
        .gamma_set = nv50_crtc_gamma_set,
        .set_config = drm_crtc_helper_set_config,
+       .page_flip = nouveau_crtc_page_flip,
        .destroy = nv50_crtc_destroy,
 };
 
@@ -453,6 +453,7 @@ nv50_crtc_prepare(struct drm_crtc *crtc)
 
        NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
 
+       drm_vblank_pre_modeset(dev, nv_crtc->index);
        nv50_crtc_blank(nv_crtc, true);
 }
 
@@ -468,6 +469,7 @@ nv50_crtc_commit(struct drm_crtc *crtc)
        NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
 
        nv50_crtc_blank(nv_crtc, false);
+       drm_vblank_post_modeset(dev, nv_crtc->index);
 
        ret = RING_SPACE(evo, 2);
        if (ret) {
@@ -545,7 +547,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
                 return -EINVAL;
        }
 
-       nv_crtc->fb.offset = fb->nvbo->bo.offset - dev_priv->vm_vram_base;
+       nv_crtc->fb.offset = fb->nvbo->bo.mem.start << PAGE_SHIFT;
        nv_crtc->fb.tile_flags = nouveau_bo_tile_layout(fb->nvbo);
        nv_crtc->fb.cpp = drm_fb->bits_per_pixel / 8;
        if (!nv_crtc->fb.blanked && dev_priv->chipset != 0x50) {
@@ -554,13 +556,14 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
                        return ret;
 
                BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, FB_DMA), 1);
-               if (nv_crtc->fb.tile_flags == 0x7a00)
+               if (nv_crtc->fb.tile_flags == 0x7a00 ||
+                   nv_crtc->fb.tile_flags == 0xfe00)
                        OUT_RING(evo, NvEvoFB32);
                else
                if (nv_crtc->fb.tile_flags == 0x7000)
                        OUT_RING(evo, NvEvoFB16);
                else
-                       OUT_RING(evo, NvEvoVRAM);
+                       OUT_RING(evo, NvEvoVRAM_LP);
        }
 
        ret = RING_SPACE(evo, 12);
@@ -574,8 +577,10 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
        if (!nv_crtc->fb.tile_flags) {
                OUT_RING(evo, drm_fb->pitch | (1 << 20));
        } else {
-               OUT_RING(evo, ((drm_fb->pitch / 4) << 4) |
-                                 fb->nvbo->tile_mode);
+               u32 tile_mode = fb->nvbo->tile_mode;
+               if (dev_priv->card_type >= NV_C0)
+                       tile_mode >>= 4;
+               OUT_RING(evo, ((drm_fb->pitch / 4) << 4) | tile_mode);
        }
        if (dev_priv->chipset == 0x50)
                OUT_RING(evo, (nv_crtc->fb.tile_flags << 8) | format);