aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/armada
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2014-04-01 18:22:40 -0400
committerRob Clark <robdclark@gmail.com>2014-04-01 20:18:28 -0400
commitf4510a2752b75ad5847b7935b68c233cab497f97 (patch)
tree0104efe442302d22b705f34605070a009cc633c9 /drivers/gpu/drm/armada
parent2d82d188b2cb11b6b221eb84dda2344ef3cd1bb4 (diff)
drm: Replace crtc fb with primary plane fb (v3)
Now that CRTC's have a primary plane, there's no need to track the framebuffer in the CRTC. Replace all references to the CRTC fb with the primary plane's fb. This patch was generated by the Coccinelle semantic patching tool using the following rules: @@ struct drm_crtc C; @@ - (C).fb + C.primary->fb @@ struct drm_crtc *C; @@ - (C)->fb + C->primary->fb v3: Generate patch via coccinelle. Actual removal of crtc->fb has been moved to a subsequent patch. v2: Fixup several lingering crtc->fb instances that were missed in the first patch iteration. [Rob Clark] Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/armada')
-rw-r--r--drivers/gpu/drm/armada/armada_crtc.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index d8e398275ca8..5831e4109e75 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -478,11 +478,12 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
478 unsigned i; 478 unsigned i;
479 bool interlaced; 479 bool interlaced;
480 480
481 drm_framebuffer_reference(crtc->fb); 481 drm_framebuffer_reference(crtc->primary->fb);
482 482
483 interlaced = !!(adj->flags & DRM_MODE_FLAG_INTERLACE); 483 interlaced = !!(adj->flags & DRM_MODE_FLAG_INTERLACE);
484 484
485 i = armada_drm_crtc_calc_fb(dcrtc->crtc.fb, x, y, regs, interlaced); 485 i = armada_drm_crtc_calc_fb(dcrtc->crtc.primary->fb,
486 x, y, regs, interlaced);
486 487
487 rm = adj->crtc_hsync_start - adj->crtc_hdisplay; 488 rm = adj->crtc_hsync_start - adj->crtc_hdisplay;
488 lm = adj->crtc_htotal - adj->crtc_hsync_end; 489 lm = adj->crtc_htotal - adj->crtc_hsync_end;
@@ -567,10 +568,10 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
567 } 568 }
568 569
569 val = CFG_GRA_ENA | CFG_GRA_HSMOOTH; 570 val = CFG_GRA_ENA | CFG_GRA_HSMOOTH;
570 val |= CFG_GRA_FMT(drm_fb_to_armada_fb(dcrtc->crtc.fb)->fmt); 571 val |= CFG_GRA_FMT(drm_fb_to_armada_fb(dcrtc->crtc.primary->fb)->fmt);
571 val |= CFG_GRA_MOD(drm_fb_to_armada_fb(dcrtc->crtc.fb)->mod); 572 val |= CFG_GRA_MOD(drm_fb_to_armada_fb(dcrtc->crtc.primary->fb)->mod);
572 573
573 if (drm_fb_to_armada_fb(dcrtc->crtc.fb)->fmt > CFG_420) 574 if (drm_fb_to_armada_fb(dcrtc->crtc.primary->fb)->fmt > CFG_420)
574 val |= CFG_PALETTE_ENA; 575 val |= CFG_PALETTE_ENA;
575 576
576 if (interlaced) 577 if (interlaced)
@@ -608,7 +609,7 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
608 struct armada_regs regs[4]; 609 struct armada_regs regs[4];
609 unsigned i; 610 unsigned i;
610 611
611 i = armada_drm_crtc_calc_fb(crtc->fb, crtc->x, crtc->y, regs, 612 i = armada_drm_crtc_calc_fb(crtc->primary->fb, crtc->x, crtc->y, regs,
612 dcrtc->interlaced); 613 dcrtc->interlaced);
613 armada_reg_queue_end(regs, i); 614 armada_reg_queue_end(regs, i);
614 615
@@ -616,7 +617,7 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
616 wait_event(dcrtc->frame_wait, !dcrtc->frame_work); 617 wait_event(dcrtc->frame_wait, !dcrtc->frame_work);
617 618
618 /* Take a reference to the new fb as we're using it */ 619 /* Take a reference to the new fb as we're using it */
619 drm_framebuffer_reference(crtc->fb); 620 drm_framebuffer_reference(crtc->primary->fb);
620 621
621 /* Update the base in the CRTC */ 622 /* Update the base in the CRTC */
622 armada_drm_crtc_update_regs(dcrtc, regs); 623 armada_drm_crtc_update_regs(dcrtc, regs);
@@ -637,7 +638,7 @@ static void armada_drm_crtc_disable(struct drm_crtc *crtc)
637 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); 638 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
638 639
639 armada_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); 640 armada_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
640 armada_drm_crtc_finish_fb(dcrtc, crtc->fb, true); 641 armada_drm_crtc_finish_fb(dcrtc, crtc->primary->fb, true);
641 642
642 /* Power down most RAMs and FIFOs */ 643 /* Power down most RAMs and FIFOs */
643 writel_relaxed(CFG_PDWN256x32 | CFG_PDWN256x24 | CFG_PDWN256x8 | 644 writel_relaxed(CFG_PDWN256x32 | CFG_PDWN256x24 | CFG_PDWN256x8 |
@@ -904,7 +905,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
904 int ret; 905 int ret;
905 906
906 /* We don't support changing the pixel format */ 907 /* We don't support changing the pixel format */
907 if (fb->pixel_format != crtc->fb->pixel_format) 908 if (fb->pixel_format != crtc->primary->fb->pixel_format)
908 return -EINVAL; 909 return -EINVAL;
909 910
910 work = kmalloc(sizeof(*work), GFP_KERNEL); 911 work = kmalloc(sizeof(*work), GFP_KERNEL);
@@ -912,7 +913,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
912 return -ENOMEM; 913 return -ENOMEM;
913 914
914 work->event = event; 915 work->event = event;
915 work->old_fb = dcrtc->crtc.fb; 916 work->old_fb = dcrtc->crtc.primary->fb;
916 917
917 i = armada_drm_crtc_calc_fb(fb, crtc->x, crtc->y, work->regs, 918 i = armada_drm_crtc_calc_fb(fb, crtc->x, crtc->y, work->regs,
918 dcrtc->interlaced); 919 dcrtc->interlaced);
@@ -941,7 +942,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
941 * will _not_ drop that reference on successful return from this 942 * will _not_ drop that reference on successful return from this
942 * function. Simply mark this new framebuffer as the current one. 943 * function. Simply mark this new framebuffer as the current one.
943 */ 944 */
944 dcrtc->crtc.fb = fb; 945 dcrtc->crtc.primary->fb = fb;
945 946
946 /* 947 /*
947 * Finally, if the display is blanked, we won't receive an 948 * Finally, if the display is blanked, we won't receive an