aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2014-07-08 10:50:07 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-09 07:52:03 -0400
commit2ff8fde1ea0992dfd735dce94f8cae2aacff8e5c (patch)
tree1082c38535671f978986032a6bab519fbbedd47d /drivers
parent155e63696caab748da3f344f66de503038a72024 (diff)
drm/i915: Make use of intel_fb_obj() (v2)
This should hopefully simplify the display code slightly and also solves at least one mistake in intel_pipe_set_base() where to_intel_framebuffer(fb)->obj is referenced during local variable initialization, before 'if (!fb)' gets checked. Potential uses of this macro were identified via the following Coccinelle patch: @@ expression E; @@ * to_intel_framebuffer(E)->obj @@ expression E; identifier I; @@ I = to_intel_framebuffer(E); ... * I->obj v2: Rewrite some NULL tests in terms of the obj rather than the fb. Also add a WARN() if trying to pageflip with a disabled primary plane. [Suggested by Chris Wilson] Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c84
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c3
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c24
3 files changed, 48 insertions, 63 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8e738d4315a8..71430a05ba89 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2356,7 +2356,7 @@ static void intel_find_plane_obj(struct intel_crtc *intel_crtc,
2356 struct drm_device *dev = intel_crtc->base.dev; 2356 struct drm_device *dev = intel_crtc->base.dev;
2357 struct drm_crtc *c; 2357 struct drm_crtc *c;
2358 struct intel_crtc *i; 2358 struct intel_crtc *i;
2359 struct intel_framebuffer *fb; 2359 struct drm_i915_gem_object *obj;
2360 2360
2361 if (!intel_crtc->base.primary->fb) 2361 if (!intel_crtc->base.primary->fb)
2362 return; 2362 return;
@@ -2377,14 +2377,17 @@ static void intel_find_plane_obj(struct intel_crtc *intel_crtc,
2377 if (c == &intel_crtc->base) 2377 if (c == &intel_crtc->base)
2378 continue; 2378 continue;
2379 2379
2380 if (!i->active || !c->primary->fb) 2380 if (!i->active)
2381 continue;
2382
2383 obj = intel_fb_obj(c->primary->fb);
2384 if (obj == NULL)
2381 continue; 2385 continue;
2382 2386
2383 fb = to_intel_framebuffer(c->primary->fb); 2387 if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) {
2384 if (i915_gem_obj_ggtt_offset(fb->obj) == plane_config->base) {
2385 drm_framebuffer_reference(c->primary->fb); 2388 drm_framebuffer_reference(c->primary->fb);
2386 intel_crtc->base.primary->fb = c->primary->fb; 2389 intel_crtc->base.primary->fb = c->primary->fb;
2387 fb->obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe); 2390 obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
2388 break; 2391 break;
2389 } 2392 }
2390 } 2393 }
@@ -2397,16 +2400,12 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
2397 struct drm_device *dev = crtc->dev; 2400 struct drm_device *dev = crtc->dev;
2398 struct drm_i915_private *dev_priv = dev->dev_private; 2401 struct drm_i915_private *dev_priv = dev->dev_private;
2399 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 2402 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2400 struct intel_framebuffer *intel_fb; 2403 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
2401 struct drm_i915_gem_object *obj;
2402 int plane = intel_crtc->plane; 2404 int plane = intel_crtc->plane;
2403 unsigned long linear_offset; 2405 unsigned long linear_offset;
2404 u32 dspcntr; 2406 u32 dspcntr;
2405 u32 reg; 2407 u32 reg;
2406 2408
2407 intel_fb = to_intel_framebuffer(fb);
2408 obj = intel_fb->obj;
2409
2410 reg = DSPCNTR(plane); 2409 reg = DSPCNTR(plane);
2411 dspcntr = I915_READ(reg); 2410 dspcntr = I915_READ(reg);
2412 /* Mask out pixel format bits in case we change it */ 2411 /* Mask out pixel format bits in case we change it */
@@ -2487,16 +2486,12 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
2487 struct drm_device *dev = crtc->dev; 2486 struct drm_device *dev = crtc->dev;
2488 struct drm_i915_private *dev_priv = dev->dev_private; 2487 struct drm_i915_private *dev_priv = dev->dev_private;
2489 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 2488 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2490 struct intel_framebuffer *intel_fb; 2489 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
2491 struct drm_i915_gem_object *obj;
2492 int plane = intel_crtc->plane; 2490 int plane = intel_crtc->plane;
2493 unsigned long linear_offset; 2491 unsigned long linear_offset;
2494 u32 dspcntr; 2492 u32 dspcntr;
2495 u32 reg; 2493 u32 reg;
2496 2494
2497 intel_fb = to_intel_framebuffer(fb);
2498 obj = intel_fb->obj;
2499
2500 reg = DSPCNTR(plane); 2495 reg = DSPCNTR(plane);
2501 dspcntr = I915_READ(reg); 2496 dspcntr = I915_READ(reg);
2502 /* Mask out pixel format bits in case we change it */ 2497 /* Mask out pixel format bits in case we change it */
@@ -2627,7 +2622,7 @@ void intel_display_handle_reset(struct drm_device *dev)
2627static int 2622static int
2628intel_finish_fb(struct drm_framebuffer *old_fb) 2623intel_finish_fb(struct drm_framebuffer *old_fb)
2629{ 2624{
2630 struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; 2625 struct drm_i915_gem_object *obj = intel_fb_obj(old_fb);
2631 struct drm_i915_private *dev_priv = obj->base.dev->dev_private; 2626 struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
2632 bool was_interruptible = dev_priv->mm.interruptible; 2627 bool was_interruptible = dev_priv->mm.interruptible;
2633 int ret; 2628 int ret;
@@ -2674,9 +2669,9 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
2674 struct drm_i915_private *dev_priv = dev->dev_private; 2669 struct drm_i915_private *dev_priv = dev->dev_private;
2675 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 2670 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2676 enum pipe pipe = intel_crtc->pipe; 2671 enum pipe pipe = intel_crtc->pipe;
2677 struct drm_framebuffer *old_fb; 2672 struct drm_framebuffer *old_fb = crtc->primary->fb;
2678 struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj; 2673 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
2679 struct drm_i915_gem_object *old_obj; 2674 struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb);
2680 int ret; 2675 int ret;
2681 2676
2682 if (intel_crtc_has_pending_flip(crtc)) { 2677 if (intel_crtc_has_pending_flip(crtc)) {
@@ -2697,9 +2692,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
2697 return -EINVAL; 2692 return -EINVAL;
2698 } 2693 }
2699 2694
2700 old_fb = crtc->primary->fb;
2701 old_obj = old_fb ? to_intel_framebuffer(old_fb)->obj : NULL;
2702
2703 mutex_lock(&dev->struct_mutex); 2695 mutex_lock(&dev->struct_mutex);
2704 ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); 2696 ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
2705 if (ret == 0) 2697 if (ret == 0)
@@ -2755,7 +2747,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
2755 if (intel_crtc->active && old_fb != fb) 2747 if (intel_crtc->active && old_fb != fb)
2756 intel_wait_for_vblank(dev, intel_crtc->pipe); 2748 intel_wait_for_vblank(dev, intel_crtc->pipe);
2757 mutex_lock(&dev->struct_mutex); 2749 mutex_lock(&dev->struct_mutex);
2758 intel_unpin_fb_obj(to_intel_framebuffer(old_fb)->obj); 2750 intel_unpin_fb_obj(old_obj);
2759 mutex_unlock(&dev->struct_mutex); 2751 mutex_unlock(&dev->struct_mutex);
2760 } 2752 }
2761 2753
@@ -4929,7 +4921,7 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
4929 struct drm_device *dev = crtc->dev; 4921 struct drm_device *dev = crtc->dev;
4930 struct drm_connector *connector; 4922 struct drm_connector *connector;
4931 struct drm_i915_private *dev_priv = dev->dev_private; 4923 struct drm_i915_private *dev_priv = dev->dev_private;
4932 struct drm_i915_gem_object *old_obj; 4924 struct drm_i915_gem_object *old_obj = intel_fb_obj(crtc->primary->fb);
4933 enum pipe pipe = to_intel_crtc(crtc)->pipe; 4925 enum pipe pipe = to_intel_crtc(crtc)->pipe;
4934 4926
4935 /* crtc should still be enabled when we disable it. */ 4927 /* crtc should still be enabled when we disable it. */
@@ -4944,7 +4936,6 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
4944 assert_pipe_disabled(dev->dev_private, pipe); 4936 assert_pipe_disabled(dev->dev_private, pipe);
4945 4937
4946 if (crtc->primary->fb) { 4938 if (crtc->primary->fb) {
4947 old_obj = to_intel_framebuffer(crtc->primary->fb)->obj;
4948 mutex_lock(&dev->struct_mutex); 4939 mutex_lock(&dev->struct_mutex);
4949 intel_unpin_fb_obj(old_obj); 4940 intel_unpin_fb_obj(old_obj);
4950 i915_gem_track_fb(old_obj, NULL, 4941 i915_gem_track_fb(old_obj, NULL,
@@ -9586,7 +9577,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
9586 struct drm_device *dev = crtc->dev; 9577 struct drm_device *dev = crtc->dev;
9587 struct drm_i915_private *dev_priv = dev->dev_private; 9578 struct drm_i915_private *dev_priv = dev->dev_private;
9588 struct drm_framebuffer *old_fb = crtc->primary->fb; 9579 struct drm_framebuffer *old_fb = crtc->primary->fb;
9589 struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj; 9580 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
9590 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 9581 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
9591 enum pipe pipe = intel_crtc->pipe; 9582 enum pipe pipe = intel_crtc->pipe;
9592 struct intel_unpin_work *work; 9583 struct intel_unpin_work *work;
@@ -9594,6 +9585,14 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
9594 unsigned long flags; 9585 unsigned long flags;
9595 int ret; 9586 int ret;
9596 9587
9588 /*
9589 * drm_mode_page_flip_ioctl() should already catch this, but double
9590 * check to be safe. In the future we may enable pageflipping from
9591 * a disabled primary plane.
9592 */
9593 if (WARN_ON(intel_fb_obj(old_fb) == NULL))
9594 return -EBUSY;
9595
9597 /* Can't change pixel format via MI display flips. */ 9596 /* Can't change pixel format via MI display flips. */
9598 if (fb->pixel_format != crtc->primary->fb->pixel_format) 9597 if (fb->pixel_format != crtc->primary->fb->pixel_format)
9599 return -EINVAL; 9598 return -EINVAL;
@@ -9616,7 +9615,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
9616 9615
9617 work->event = event; 9616 work->event = event;
9618 work->crtc = crtc; 9617 work->crtc = crtc;
9619 work->old_fb_obj = to_intel_framebuffer(old_fb)->obj; 9618 work->old_fb_obj = intel_fb_obj(old_fb);
9620 INIT_WORK(&work->work, intel_unpin_work_fn); 9619 INIT_WORK(&work->work, intel_unpin_work_fn);
9621 9620
9622 ret = drm_crtc_vblank_get(crtc); 9621 ret = drm_crtc_vblank_get(crtc);
@@ -10758,10 +10757,9 @@ static int __intel_set_mode(struct drm_crtc *crtc,
10758 * on the DPLL. 10757 * on the DPLL.
10759 */ 10758 */
10760 for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) { 10759 for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) {
10761 struct drm_framebuffer *old_fb; 10760 struct drm_framebuffer *old_fb = crtc->primary->fb;
10762 struct drm_i915_gem_object *old_obj = NULL; 10761 struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb);
10763 struct drm_i915_gem_object *obj = 10762 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
10764 to_intel_framebuffer(fb)->obj;
10765 10763
10766 mutex_lock(&dev->struct_mutex); 10764 mutex_lock(&dev->struct_mutex);
10767 ret = intel_pin_and_fence_fb_obj(dev, 10765 ret = intel_pin_and_fence_fb_obj(dev,
@@ -10772,11 +10770,8 @@ static int __intel_set_mode(struct drm_crtc *crtc,
10772 mutex_unlock(&dev->struct_mutex); 10770 mutex_unlock(&dev->struct_mutex);
10773 goto done; 10771 goto done;
10774 } 10772 }
10775 old_fb = crtc->primary->fb; 10773 if (old_fb)
10776 if (old_fb) {
10777 old_obj = to_intel_framebuffer(old_fb)->obj;
10778 intel_unpin_fb_obj(old_obj); 10774 intel_unpin_fb_obj(old_obj);
10779 }
10780 i915_gem_track_fb(old_obj, obj, 10775 i915_gem_track_fb(old_obj, obj,
10781 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe)); 10776 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe));
10782 mutex_unlock(&dev->struct_mutex); 10777 mutex_unlock(&dev->struct_mutex);
@@ -11394,9 +11389,9 @@ intel_primary_plane_disable(struct drm_plane *plane)
11394 intel_disable_primary_hw_plane(dev_priv, intel_plane->plane, 11389 intel_disable_primary_hw_plane(dev_priv, intel_plane->plane,
11395 intel_plane->pipe); 11390 intel_plane->pipe);
11396disable_unpin: 11391disable_unpin:
11397 i915_gem_track_fb(to_intel_framebuffer(plane->fb)->obj, NULL, 11392 i915_gem_track_fb(intel_fb_obj(plane->fb), NULL,
11398 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe)); 11393 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe));
11399 intel_unpin_fb_obj(to_intel_framebuffer(plane->fb)->obj); 11394 intel_unpin_fb_obj(intel_fb_obj(plane->fb));
11400 plane->fb = NULL; 11395 plane->fb = NULL;
11401 11396
11402 return 0; 11397 return 0;
@@ -11413,7 +11408,8 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
11413 struct drm_i915_private *dev_priv = dev->dev_private; 11408 struct drm_i915_private *dev_priv = dev->dev_private;
11414 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 11409 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
11415 struct intel_plane *intel_plane = to_intel_plane(plane); 11410 struct intel_plane *intel_plane = to_intel_plane(plane);
11416 struct drm_i915_gem_object *obj, *old_obj = NULL; 11411 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
11412 struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb);
11417 struct drm_rect dest = { 11413 struct drm_rect dest = {
11418 /* integer pixels */ 11414 /* integer pixels */
11419 .x1 = crtc_x, 11415 .x1 = crtc_x,
@@ -11445,10 +11441,6 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
11445 if (ret) 11441 if (ret)
11446 return ret; 11442 return ret;
11447 11443
11448 if (plane->fb)
11449 old_obj = to_intel_framebuffer(plane->fb)->obj;
11450 obj = to_intel_framebuffer(fb)->obj;
11451
11452 /* 11444 /*
11453 * If the CRTC isn't enabled, we're just pinning the framebuffer, 11445 * If the CRTC isn't enabled, we're just pinning the framebuffer,
11454 * updating the fb pointer, and returning without touching the 11446 * updating the fb pointer, and returning without touching the
@@ -12945,7 +12937,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
12945void intel_modeset_gem_init(struct drm_device *dev) 12937void intel_modeset_gem_init(struct drm_device *dev)
12946{ 12938{
12947 struct drm_crtc *c; 12939 struct drm_crtc *c;
12948 struct intel_framebuffer *fb; 12940 struct drm_i915_gem_object *obj;
12949 12941
12950 mutex_lock(&dev->struct_mutex); 12942 mutex_lock(&dev->struct_mutex);
12951 intel_init_gt_powersave(dev); 12943 intel_init_gt_powersave(dev);
@@ -12962,11 +12954,11 @@ void intel_modeset_gem_init(struct drm_device *dev)
12962 */ 12954 */
12963 mutex_lock(&dev->struct_mutex); 12955 mutex_lock(&dev->struct_mutex);
12964 for_each_crtc(dev, c) { 12956 for_each_crtc(dev, c) {
12965 if (!c->primary->fb) 12957 obj = intel_fb_obj(c->primary->fb);
12958 if (obj == NULL)
12966 continue; 12959 continue;
12967 12960
12968 fb = to_intel_framebuffer(c->primary->fb); 12961 if (intel_pin_and_fence_fb_obj(dev, obj, NULL)) {
12969 if (intel_pin_and_fence_fb_obj(dev, fb->obj, NULL)) {
12970 DRM_ERROR("failed to pin boot fb on pipe %d\n", 12962 DRM_ERROR("failed to pin boot fb on pipe %d\n",
12971 to_intel_crtc(c)->pipe); 12963 to_intel_crtc(c)->pipe);
12972 drm_framebuffer_unreference(c->primary->fb); 12964 drm_framebuffer_unreference(c->primary->fb);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index e0f1bd125d85..3ca6c7c77e05 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1752,7 +1752,7 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)
1752 struct drm_i915_private *dev_priv = dev->dev_private; 1752 struct drm_i915_private *dev_priv = dev->dev_private;
1753 struct drm_crtc *crtc = dig_port->base.base.crtc; 1753 struct drm_crtc *crtc = dig_port->base.base.crtc;
1754 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1754 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1755 struct drm_i915_gem_object *obj = to_intel_framebuffer(crtc->primary->fb)->obj; 1755 struct drm_i915_gem_object *obj = intel_fb_obj(crtc->primary->fb);
1756 struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base; 1756 struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
1757 1757
1758 dev_priv->psr.source_ok = false; 1758 dev_priv->psr.source_ok = false;
@@ -1785,7 +1785,6 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)
1785 return false; 1785 return false;
1786 } 1786 }
1787 1787
1788 obj = to_intel_framebuffer(crtc->primary->fb)->obj;
1789 if (obj->tiling_mode != I915_TILING_X || 1788 if (obj->tiling_mode != I915_TILING_X ||
1790 obj->fence_reg == I915_FENCE_REG_NONE) { 1789 obj->fence_reg == I915_FENCE_REG_NONE) {
1791 DRM_DEBUG_KMS("PSR condition failed: fb not tiled or fenced\n"); 1790 DRM_DEBUG_KMS("PSR condition failed: fb not tiled or fenced\n");
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index d1af6419ec78..19c5c26badae 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -93,8 +93,7 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc)
93 struct drm_device *dev = crtc->dev; 93 struct drm_device *dev = crtc->dev;
94 struct drm_i915_private *dev_priv = dev->dev_private; 94 struct drm_i915_private *dev_priv = dev->dev_private;
95 struct drm_framebuffer *fb = crtc->primary->fb; 95 struct drm_framebuffer *fb = crtc->primary->fb;
96 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 96 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
97 struct drm_i915_gem_object *obj = intel_fb->obj;
98 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 97 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
99 int cfb_pitch; 98 int cfb_pitch;
100 int i; 99 int i;
@@ -150,8 +149,7 @@ static void g4x_enable_fbc(struct drm_crtc *crtc)
150 struct drm_device *dev = crtc->dev; 149 struct drm_device *dev = crtc->dev;
151 struct drm_i915_private *dev_priv = dev->dev_private; 150 struct drm_i915_private *dev_priv = dev->dev_private;
152 struct drm_framebuffer *fb = crtc->primary->fb; 151 struct drm_framebuffer *fb = crtc->primary->fb;
153 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 152 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
154 struct drm_i915_gem_object *obj = intel_fb->obj;
155 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 153 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
156 u32 dpfc_ctl; 154 u32 dpfc_ctl;
157 155
@@ -222,8 +220,7 @@ static void ironlake_enable_fbc(struct drm_crtc *crtc)
222 struct drm_device *dev = crtc->dev; 220 struct drm_device *dev = crtc->dev;
223 struct drm_i915_private *dev_priv = dev->dev_private; 221 struct drm_i915_private *dev_priv = dev->dev_private;
224 struct drm_framebuffer *fb = crtc->primary->fb; 222 struct drm_framebuffer *fb = crtc->primary->fb;
225 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 223 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
226 struct drm_i915_gem_object *obj = intel_fb->obj;
227 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 224 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
228 u32 dpfc_ctl; 225 u32 dpfc_ctl;
229 226
@@ -289,8 +286,7 @@ static void gen7_enable_fbc(struct drm_crtc *crtc)
289 struct drm_device *dev = crtc->dev; 286 struct drm_device *dev = crtc->dev;
290 struct drm_i915_private *dev_priv = dev->dev_private; 287 struct drm_i915_private *dev_priv = dev->dev_private;
291 struct drm_framebuffer *fb = crtc->primary->fb; 288 struct drm_framebuffer *fb = crtc->primary->fb;
292 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 289 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
293 struct drm_i915_gem_object *obj = intel_fb->obj;
294 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 290 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
295 u32 dpfc_ctl; 291 u32 dpfc_ctl;
296 292
@@ -485,7 +481,6 @@ void intel_update_fbc(struct drm_device *dev)
485 struct drm_crtc *crtc = NULL, *tmp_crtc; 481 struct drm_crtc *crtc = NULL, *tmp_crtc;
486 struct intel_crtc *intel_crtc; 482 struct intel_crtc *intel_crtc;
487 struct drm_framebuffer *fb; 483 struct drm_framebuffer *fb;
488 struct intel_framebuffer *intel_fb;
489 struct drm_i915_gem_object *obj; 484 struct drm_i915_gem_object *obj;
490 const struct drm_display_mode *adjusted_mode; 485 const struct drm_display_mode *adjusted_mode;
491 unsigned int max_width, max_height; 486 unsigned int max_width, max_height;
@@ -530,8 +525,7 @@ void intel_update_fbc(struct drm_device *dev)
530 525
531 intel_crtc = to_intel_crtc(crtc); 526 intel_crtc = to_intel_crtc(crtc);
532 fb = crtc->primary->fb; 527 fb = crtc->primary->fb;
533 intel_fb = to_intel_framebuffer(fb); 528 obj = intel_fb_obj(fb);
534 obj = intel_fb->obj;
535 adjusted_mode = &intel_crtc->config.adjusted_mode; 529 adjusted_mode = &intel_crtc->config.adjusted_mode;
536 530
537 if (i915.enable_fbc < 0) { 531 if (i915.enable_fbc < 0) {
@@ -589,7 +583,7 @@ void intel_update_fbc(struct drm_device *dev)
589 if (in_dbg_master()) 583 if (in_dbg_master())
590 goto out_disable; 584 goto out_disable;
591 585
592 if (i915_gem_stolen_setup_compression(dev, intel_fb->obj->base.size, 586 if (i915_gem_stolen_setup_compression(dev, obj->base.size,
593 drm_format_plane_cpp(fb->pixel_format, 0))) { 587 drm_format_plane_cpp(fb->pixel_format, 0))) {
594 if (set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL)) 588 if (set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL))
595 DRM_DEBUG_KMS("framebuffer too large, disabling compression\n"); 589 DRM_DEBUG_KMS("framebuffer too large, disabling compression\n");
@@ -1599,12 +1593,12 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
1599 DRM_DEBUG_KMS("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm); 1593 DRM_DEBUG_KMS("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm);
1600 1594
1601 if (IS_I915GM(dev) && enabled) { 1595 if (IS_I915GM(dev) && enabled) {
1602 struct intel_framebuffer *fb; 1596 struct drm_i915_gem_object *obj;
1603 1597
1604 fb = to_intel_framebuffer(enabled->primary->fb); 1598 obj = intel_fb_obj(enabled->primary->fb);
1605 1599
1606 /* self-refresh seems busted with untiled */ 1600 /* self-refresh seems busted with untiled */
1607 if (fb->obj->tiling_mode == I915_TILING_NONE) 1601 if (obj->tiling_mode == I915_TILING_NONE)
1608 enabled = NULL; 1602 enabled = NULL;
1609 } 1603 }
1610 1604