Backmerge remote-tracking branch 'drm/drm-next' into drm-misc-next
[linux-block.git] / drivers / gpu / drm / nouveau / dispnv04 / crtc.c
index cc6ab3c2eec703f7262028f994fc59665cfd94e2..086f7cf4c23e450cfa4bd7e84bd4fb3ca181e17e 100644 (file)
@@ -605,15 +605,16 @@ static int
 nv_crtc_swap_fbs(struct drm_crtc *crtc, struct drm_framebuffer *old_fb)
 {
        struct nv04_display *disp = nv04_display(crtc->dev);
-       struct nouveau_framebuffer *nvfb = nouveau_framebuffer(crtc->primary->fb);
+       struct drm_framebuffer *fb = crtc->primary->fb;
+       struct nouveau_bo *nvbo = nouveau_gem_object(fb->obj[0]);
        struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
        int ret;
 
-       ret = nouveau_bo_pin(nvfb->nvbo, TTM_PL_FLAG_VRAM, false);
+       ret = nouveau_bo_pin(nvbo, TTM_PL_FLAG_VRAM, false);
        if (ret == 0) {
                if (disp->image[nv_crtc->index])
                        nouveau_bo_unpin(disp->image[nv_crtc->index]);
-               nouveau_bo_ref(nvfb->nvbo, &disp->image[nv_crtc->index]);
+               nouveau_bo_ref(nvbo, &disp->image[nv_crtc->index]);
        }
 
        return ret;
@@ -822,8 +823,8 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc,
        struct drm_device *dev = crtc->dev;
        struct nouveau_drm *drm = nouveau_drm(dev);
        struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index];
+       struct nouveau_bo *nvbo;
        struct drm_framebuffer *drm_fb;
-       struct nouveau_framebuffer *fb;
        int arb_burst, arb_lwm;
 
        NV_DEBUG(drm, "index %d\n", nv_crtc->index);
@@ -839,13 +840,12 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc,
         */
        if (atomic) {
                drm_fb = passed_fb;
-               fb = nouveau_framebuffer(passed_fb);
        } else {
                drm_fb = crtc->primary->fb;
-               fb = nouveau_framebuffer(crtc->primary->fb);
        }
 
-       nv_crtc->fb.offset = fb->nvbo->offset;
+       nvbo = nouveau_gem_object(drm_fb->obj[0]);
+       nv_crtc->fb.offset = nvbo->offset;
 
        if (nv_crtc->lut.depth != drm_fb->format->depth) {
                nv_crtc->lut.depth = drm_fb->format->depth;
@@ -1143,8 +1143,9 @@ nv04_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
        const int swap_interval = (flags & DRM_MODE_PAGE_FLIP_ASYNC) ? 0 : 1;
        struct drm_device *dev = crtc->dev;
        struct nouveau_drm *drm = nouveau_drm(dev);
-       struct nouveau_bo *old_bo = nouveau_framebuffer(crtc->primary->fb)->nvbo;
-       struct nouveau_bo *new_bo = nouveau_framebuffer(fb)->nvbo;
+       struct drm_framebuffer *old_fb = crtc->primary->fb;
+       struct nouveau_bo *old_bo = nouveau_gem_object(old_fb->obj[0]);
+       struct nouveau_bo *new_bo = nouveau_gem_object(fb->obj[0]);
        struct nv04_page_flip_state *s;
        struct nouveau_channel *chan;
        struct nouveau_cli *cli;