aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
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/i915/intel_display.c
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/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ea66dc2a1b59..3ffe5a6124f1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -744,7 +744,7 @@ bool intel_crtc_active(struct drm_crtc *crtc)
744 * We can ditch the crtc->fb check as soon as we can 744 * We can ditch the crtc->fb check as soon as we can
745 * properly reconstruct framebuffers. 745 * properly reconstruct framebuffers.
746 */ 746 */
747 return intel_crtc->active && crtc->fb && 747 return intel_crtc->active && crtc->primary->fb &&
748 intel_crtc->config.adjusted_mode.crtc_clock; 748 intel_crtc->config.adjusted_mode.crtc_clock;
749} 749}
750 750
@@ -2291,8 +2291,8 @@ void intel_display_handle_reset(struct drm_device *dev)
2291 * disabling them without disabling the entire crtc) allow again 2291 * disabling them without disabling the entire crtc) allow again
2292 * a NULL crtc->fb. 2292 * a NULL crtc->fb.
2293 */ 2293 */
2294 if (intel_crtc->active && crtc->fb) 2294 if (intel_crtc->active && crtc->primary->fb)
2295 dev_priv->display.update_plane(crtc, crtc->fb, 2295 dev_priv->display.update_plane(crtc, crtc->primary->fb,
2296 crtc->x, crtc->y); 2296 crtc->x, crtc->y);
2297 mutex_unlock(&crtc->mutex); 2297 mutex_unlock(&crtc->mutex);
2298 } 2298 }
@@ -2417,8 +2417,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
2417 return ret; 2417 return ret;
2418 } 2418 }
2419 2419
2420 old_fb = crtc->fb; 2420 old_fb = crtc->primary->fb;
2421 crtc->fb = fb; 2421 crtc->primary->fb = fb;
2422 crtc->x = x; 2422 crtc->x = x;
2423 crtc->y = y; 2423 crtc->y = y;
2424 2424
@@ -3009,7 +3009,7 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
3009 struct drm_device *dev = crtc->dev; 3009 struct drm_device *dev = crtc->dev;
3010 struct drm_i915_private *dev_priv = dev->dev_private; 3010 struct drm_i915_private *dev_priv = dev->dev_private;
3011 3011
3012 if (crtc->fb == NULL) 3012 if (crtc->primary->fb == NULL)
3013 return; 3013 return;
3014 3014
3015 WARN_ON(waitqueue_active(&dev_priv->pending_flip_queue)); 3015 WARN_ON(waitqueue_active(&dev_priv->pending_flip_queue));
@@ -3018,7 +3018,7 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
3018 !intel_crtc_has_pending_flip(crtc)); 3018 !intel_crtc_has_pending_flip(crtc));
3019 3019
3020 mutex_lock(&dev->struct_mutex); 3020 mutex_lock(&dev->struct_mutex);
3021 intel_finish_fb(crtc->fb); 3021 intel_finish_fb(crtc->primary->fb);
3022 mutex_unlock(&dev->struct_mutex); 3022 mutex_unlock(&dev->struct_mutex);
3023} 3023}
3024 3024
@@ -4466,11 +4466,11 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
4466 assert_cursor_disabled(dev_priv, to_intel_crtc(crtc)->pipe); 4466 assert_cursor_disabled(dev_priv, to_intel_crtc(crtc)->pipe);
4467 assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); 4467 assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe);
4468 4468
4469 if (crtc->fb) { 4469 if (crtc->primary->fb) {
4470 mutex_lock(&dev->struct_mutex); 4470 mutex_lock(&dev->struct_mutex);
4471 intel_unpin_fb_obj(to_intel_framebuffer(crtc->fb)->obj); 4471 intel_unpin_fb_obj(to_intel_framebuffer(crtc->primary->fb)->obj);
4472 mutex_unlock(&dev->struct_mutex); 4472 mutex_unlock(&dev->struct_mutex);
4473 crtc->fb = NULL; 4473 crtc->primary->fb = NULL;
4474 } 4474 }
4475 4475
4476 /* Update computed state. */ 4476 /* Update computed state. */
@@ -8249,7 +8249,7 @@ void intel_mark_idle(struct drm_device *dev)
8249 goto out; 8249 goto out;
8250 8250
8251 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 8251 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
8252 if (!crtc->fb) 8252 if (!crtc->primary->fb)
8253 continue; 8253 continue;
8254 8254
8255 intel_decrease_pllclock(crtc); 8255 intel_decrease_pllclock(crtc);
@@ -8272,10 +8272,10 @@ void intel_mark_fb_busy(struct drm_i915_gem_object *obj,
8272 return; 8272 return;
8273 8273
8274 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 8274 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
8275 if (!crtc->fb) 8275 if (!crtc->primary->fb)
8276 continue; 8276 continue;
8277 8277
8278 if (to_intel_framebuffer(crtc->fb)->obj != obj) 8278 if (to_intel_framebuffer(crtc->primary->fb)->obj != obj)
8279 continue; 8279 continue;
8280 8280
8281 intel_increase_pllclock(crtc); 8281 intel_increase_pllclock(crtc);
@@ -8703,7 +8703,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8703{ 8703{
8704 struct drm_device *dev = crtc->dev; 8704 struct drm_device *dev = crtc->dev;
8705 struct drm_i915_private *dev_priv = dev->dev_private; 8705 struct drm_i915_private *dev_priv = dev->dev_private;
8706 struct drm_framebuffer *old_fb = crtc->fb; 8706 struct drm_framebuffer *old_fb = crtc->primary->fb;
8707 struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj; 8707 struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
8708 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 8708 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
8709 struct intel_unpin_work *work; 8709 struct intel_unpin_work *work;
@@ -8711,7 +8711,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8711 int ret; 8711 int ret;
8712 8712
8713 /* Can't change pixel format via MI display flips. */ 8713 /* Can't change pixel format via MI display flips. */
8714 if (fb->pixel_format != crtc->fb->pixel_format) 8714 if (fb->pixel_format != crtc->primary->fb->pixel_format)
8715 return -EINVAL; 8715 return -EINVAL;
8716 8716
8717 /* 8717 /*
@@ -8719,8 +8719,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8719 * Note that pitch changes could also affect these register. 8719 * Note that pitch changes could also affect these register.
8720 */ 8720 */
8721 if (INTEL_INFO(dev)->gen > 3 && 8721 if (INTEL_INFO(dev)->gen > 3 &&
8722 (fb->offsets[0] != crtc->fb->offsets[0] || 8722 (fb->offsets[0] != crtc->primary->fb->offsets[0] ||
8723 fb->pitches[0] != crtc->fb->pitches[0])) 8723 fb->pitches[0] != crtc->primary->fb->pitches[0]))
8724 return -EINVAL; 8724 return -EINVAL;
8725 8725
8726 if (i915_terminally_wedged(&dev_priv->gpu_error)) 8726 if (i915_terminally_wedged(&dev_priv->gpu_error))
@@ -8763,7 +8763,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8763 drm_gem_object_reference(&work->old_fb_obj->base); 8763 drm_gem_object_reference(&work->old_fb_obj->base);
8764 drm_gem_object_reference(&obj->base); 8764 drm_gem_object_reference(&obj->base);
8765 8765
8766 crtc->fb = fb; 8766 crtc->primary->fb = fb;
8767 8767
8768 work->pending_flip_obj = obj; 8768 work->pending_flip_obj = obj;
8769 8769
@@ -8786,7 +8786,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8786 8786
8787cleanup_pending: 8787cleanup_pending:
8788 atomic_dec(&intel_crtc->unpin_work_count); 8788 atomic_dec(&intel_crtc->unpin_work_count);
8789 crtc->fb = old_fb; 8789 crtc->primary->fb = old_fb;
8790 drm_gem_object_unreference(&work->old_fb_obj->base); 8790 drm_gem_object_unreference(&work->old_fb_obj->base);
8791 drm_gem_object_unreference(&obj->base); 8791 drm_gem_object_unreference(&obj->base);
8792 mutex_unlock(&dev->struct_mutex); 8792 mutex_unlock(&dev->struct_mutex);
@@ -9803,7 +9803,7 @@ static int intel_set_mode(struct drm_crtc *crtc,
9803 9803
9804void intel_crtc_restore_mode(struct drm_crtc *crtc) 9804void intel_crtc_restore_mode(struct drm_crtc *crtc)
9805{ 9805{
9806 intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb); 9806 intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb);
9807} 9807}
9808 9808
9809#undef for_each_intel_crtc_masked 9809#undef for_each_intel_crtc_masked
@@ -9927,9 +9927,9 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
9927 * and then just flip_or_move it */ 9927 * and then just flip_or_move it */
9928 if (is_crtc_connector_off(set)) { 9928 if (is_crtc_connector_off(set)) {
9929 config->mode_changed = true; 9929 config->mode_changed = true;
9930 } else if (set->crtc->fb != set->fb) { 9930 } else if (set->crtc->primary->fb != set->fb) {
9931 /* If we have no fb then treat it as a full mode set */ 9931 /* If we have no fb then treat it as a full mode set */
9932 if (set->crtc->fb == NULL) { 9932 if (set->crtc->primary->fb == NULL) {
9933 struct intel_crtc *intel_crtc = 9933 struct intel_crtc *intel_crtc =
9934 to_intel_crtc(set->crtc); 9934 to_intel_crtc(set->crtc);
9935 9935
@@ -9943,7 +9943,7 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
9943 } else if (set->fb == NULL) { 9943 } else if (set->fb == NULL) {
9944 config->mode_changed = true; 9944 config->mode_changed = true;
9945 } else if (set->fb->pixel_format != 9945 } else if (set->fb->pixel_format !=
9946 set->crtc->fb->pixel_format) { 9946 set->crtc->primary->fb->pixel_format) {
9947 config->mode_changed = true; 9947 config->mode_changed = true;
9948 } else { 9948 } else {
9949 config->fb_changed = true; 9949 config->fb_changed = true;
@@ -10156,7 +10156,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
10156 save_set.mode = &set->crtc->mode; 10156 save_set.mode = &set->crtc->mode;
10157 save_set.x = set->crtc->x; 10157 save_set.x = set->crtc->x;
10158 save_set.y = set->crtc->y; 10158 save_set.y = set->crtc->y;
10159 save_set.fb = set->crtc->fb; 10159 save_set.fb = set->crtc->primary->fb;
10160 10160
10161 /* Compute whether we need a full modeset, only an fb base update or no 10161 /* Compute whether we need a full modeset, only an fb base update or no
10162 * change at all. In the future we might also check whether only the 10162 * change at all. In the future we might also check whether only the
@@ -11473,7 +11473,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
11473 dev_priv->pipe_to_crtc_mapping[pipe]; 11473 dev_priv->pipe_to_crtc_mapping[pipe];
11474 11474
11475 __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, 11475 __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y,
11476 crtc->fb); 11476 crtc->primary->fb);
11477 } 11477 }
11478 } else { 11478 } else {
11479 intel_modeset_update_staged_output_state(dev); 11479 intel_modeset_update_staged_output_state(dev);
@@ -11522,7 +11522,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
11522 11522
11523 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 11523 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
11524 /* Skip inactive CRTCs */ 11524 /* Skip inactive CRTCs */
11525 if (!crtc->fb) 11525 if (!crtc->primary->fb)
11526 continue; 11526 continue;
11527 11527
11528 intel_increase_pllclock(crtc); 11528 intel_increase_pllclock(crtc);