aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-04-01 20:31:43 -0400
committerDave Airlie <airlied@redhat.com>2014-04-01 22:09:09 -0400
commit2844ea3f252331cc0ecf3ae74f6226db2f580f8a (patch)
tree8e221e499662c0e768505b5fe24b9c574e92cf33 /drivers/gpu/drm/i915/intel_display.c
parente3d6ddb35f6221859b6054879d186e13a3af351e (diff)
parent6efa1f2f5417e628572a75e667a9d8c63d21bd17 (diff)
Merge branch 'primary-plane' of git://people.freedesktop.org/~robclark/linux into drm-next
Here's the latest iteration of the universal planes work, which I believe is finally ready for merging. Aside from the minor driver patches to use the new drm_for_each_legacy_plane() macro for plane loops, these should all have an r-b from Rob Clark now. Actual userspace-visibility is currently hidden behind a drm.universal_planes module parameter so that we can do some experimental testing of this before flipping it on universally. * 'primary-plane' of git://people.freedesktop.org/~robclark/linux: drm/doc: Update plane documentation and add plane helper library drm: Allow userspace to ask for universal plane list (v2) drm: Remove unused drm_crtc->fb drm: Replace crtc fb with primary plane fb (v3) drm/msm: Switch to universal plane API's drm: Add drm_crtc_init_with_planes() (v2) drm: Add plane type property (v2) drm: Add drm_universal_plane_init() drm: Add primary plane helpers (v3) drm: Make drm_crtc_check_viewport non-static drm/shmobile: Restrict plane loops to only operate on legacy planes drm/i915: Restrict plane loops to only operate on overlay planes (v2) drm/exynos: Restrict plane loops to only operate on overlay planes (v2) drm: Add support for multiple plane types (v2)
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c62
1 files changed, 34 insertions, 28 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0868afbb19d2..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
@@ -3423,22 +3423,28 @@ static void intel_enable_planes(struct drm_crtc *crtc)
3423{ 3423{
3424 struct drm_device *dev = crtc->dev; 3424 struct drm_device *dev = crtc->dev;
3425 enum pipe pipe = to_intel_crtc(crtc)->pipe; 3425 enum pipe pipe = to_intel_crtc(crtc)->pipe;
3426 struct drm_plane *plane;
3426 struct intel_plane *intel_plane; 3427 struct intel_plane *intel_plane;
3427 3428
3428 list_for_each_entry(intel_plane, &dev->mode_config.plane_list, base.head) 3429 drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
3430 intel_plane = to_intel_plane(plane);
3429 if (intel_plane->pipe == pipe) 3431 if (intel_plane->pipe == pipe)
3430 intel_plane_restore(&intel_plane->base); 3432 intel_plane_restore(&intel_plane->base);
3433 }
3431} 3434}
3432 3435
3433static void intel_disable_planes(struct drm_crtc *crtc) 3436static void intel_disable_planes(struct drm_crtc *crtc)
3434{ 3437{
3435 struct drm_device *dev = crtc->dev; 3438 struct drm_device *dev = crtc->dev;
3436 enum pipe pipe = to_intel_crtc(crtc)->pipe; 3439 enum pipe pipe = to_intel_crtc(crtc)->pipe;
3440 struct drm_plane *plane;
3437 struct intel_plane *intel_plane; 3441 struct intel_plane *intel_plane;
3438 3442
3439 list_for_each_entry(intel_plane, &dev->mode_config.plane_list, base.head) 3443 drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
3444 intel_plane = to_intel_plane(plane);
3440 if (intel_plane->pipe == pipe) 3445 if (intel_plane->pipe == pipe)
3441 intel_plane_disable(&intel_plane->base); 3446 intel_plane_disable(&intel_plane->base);
3447 }
3442} 3448}
3443 3449
3444void hsw_enable_ips(struct intel_crtc *crtc) 3450void hsw_enable_ips(struct intel_crtc *crtc)
@@ -4460,11 +4466,11 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
4460 assert_cursor_disabled(dev_priv, to_intel_crtc(crtc)->pipe); 4466 assert_cursor_disabled(dev_priv, to_intel_crtc(crtc)->pipe);
4461 assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); 4467 assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe);
4462 4468
4463 if (crtc->fb) { 4469 if (crtc->primary->fb) {
4464 mutex_lock(&dev->struct_mutex); 4470 mutex_lock(&dev->struct_mutex);
4465 intel_unpin_fb_obj(to_intel_framebuffer(crtc->fb)->obj); 4471 intel_unpin_fb_obj(to_intel_framebuffer(crtc->primary->fb)->obj);
4466 mutex_unlock(&dev->struct_mutex); 4472 mutex_unlock(&dev->struct_mutex);
4467 crtc->fb = NULL; 4473 crtc->primary->fb = NULL;
4468 } 4474 }
4469 4475
4470 /* Update computed state. */ 4476 /* Update computed state. */
@@ -8243,7 +8249,7 @@ void intel_mark_idle(struct drm_device *dev)
8243 goto out; 8249 goto out;
8244 8250
8245 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 8251 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
8246 if (!crtc->fb) 8252 if (!crtc->primary->fb)
8247 continue; 8253 continue;
8248 8254
8249 intel_decrease_pllclock(crtc); 8255 intel_decrease_pllclock(crtc);
@@ -8266,10 +8272,10 @@ void intel_mark_fb_busy(struct drm_i915_gem_object *obj,
8266 return; 8272 return;
8267 8273
8268 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 8274 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
8269 if (!crtc->fb) 8275 if (!crtc->primary->fb)
8270 continue; 8276 continue;
8271 8277
8272 if (to_intel_framebuffer(crtc->fb)->obj != obj) 8278 if (to_intel_framebuffer(crtc->primary->fb)->obj != obj)
8273 continue; 8279 continue;
8274 8280
8275 intel_increase_pllclock(crtc); 8281 intel_increase_pllclock(crtc);
@@ -8697,7 +8703,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8697{ 8703{
8698 struct drm_device *dev = crtc->dev; 8704 struct drm_device *dev = crtc->dev;
8699 struct drm_i915_private *dev_priv = dev->dev_private; 8705 struct drm_i915_private *dev_priv = dev->dev_private;
8700 struct drm_framebuffer *old_fb = crtc->fb; 8706 struct drm_framebuffer *old_fb = crtc->primary->fb;
8701 struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj; 8707 struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
8702 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 8708 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
8703 struct intel_unpin_work *work; 8709 struct intel_unpin_work *work;
@@ -8705,7 +8711,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8705 int ret; 8711 int ret;
8706 8712
8707 /* Can't change pixel format via MI display flips. */ 8713 /* Can't change pixel format via MI display flips. */
8708 if (fb->pixel_format != crtc->fb->pixel_format) 8714 if (fb->pixel_format != crtc->primary->fb->pixel_format)
8709 return -EINVAL; 8715 return -EINVAL;
8710 8716
8711 /* 8717 /*
@@ -8713,8 +8719,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8713 * Note that pitch changes could also affect these register. 8719 * Note that pitch changes could also affect these register.
8714 */ 8720 */
8715 if (INTEL_INFO(dev)->gen > 3 && 8721 if (INTEL_INFO(dev)->gen > 3 &&
8716 (fb->offsets[0] != crtc->fb->offsets[0] || 8722 (fb->offsets[0] != crtc->primary->fb->offsets[0] ||
8717 fb->pitches[0] != crtc->fb->pitches[0])) 8723 fb->pitches[0] != crtc->primary->fb->pitches[0]))
8718 return -EINVAL; 8724 return -EINVAL;
8719 8725
8720 if (i915_terminally_wedged(&dev_priv->gpu_error)) 8726 if (i915_terminally_wedged(&dev_priv->gpu_error))
@@ -8757,7 +8763,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8757 drm_gem_object_reference(&work->old_fb_obj->base); 8763 drm_gem_object_reference(&work->old_fb_obj->base);
8758 drm_gem_object_reference(&obj->base); 8764 drm_gem_object_reference(&obj->base);
8759 8765
8760 crtc->fb = fb; 8766 crtc->primary->fb = fb;
8761 8767
8762 work->pending_flip_obj = obj; 8768 work->pending_flip_obj = obj;
8763 8769
@@ -8780,7 +8786,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
8780 8786
8781cleanup_pending: 8787cleanup_pending:
8782 atomic_dec(&intel_crtc->unpin_work_count); 8788 atomic_dec(&intel_crtc->unpin_work_count);
8783 crtc->fb = old_fb; 8789 crtc->primary->fb = old_fb;
8784 drm_gem_object_unreference(&work->old_fb_obj->base); 8790 drm_gem_object_unreference(&work->old_fb_obj->base);
8785 drm_gem_object_unreference(&obj->base); 8791 drm_gem_object_unreference(&obj->base);
8786 mutex_unlock(&dev->struct_mutex); 8792 mutex_unlock(&dev->struct_mutex);
@@ -9797,7 +9803,7 @@ static int intel_set_mode(struct drm_crtc *crtc,
9797 9803
9798void intel_crtc_restore_mode(struct drm_crtc *crtc) 9804void intel_crtc_restore_mode(struct drm_crtc *crtc)
9799{ 9805{
9800 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);
9801} 9807}
9802 9808
9803#undef for_each_intel_crtc_masked 9809#undef for_each_intel_crtc_masked
@@ -9921,9 +9927,9 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
9921 * and then just flip_or_move it */ 9927 * and then just flip_or_move it */
9922 if (is_crtc_connector_off(set)) { 9928 if (is_crtc_connector_off(set)) {
9923 config->mode_changed = true; 9929 config->mode_changed = true;
9924 } else if (set->crtc->fb != set->fb) { 9930 } else if (set->crtc->primary->fb != set->fb) {
9925 /* 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 */
9926 if (set->crtc->fb == NULL) { 9932 if (set->crtc->primary->fb == NULL) {
9927 struct intel_crtc *intel_crtc = 9933 struct intel_crtc *intel_crtc =
9928 to_intel_crtc(set->crtc); 9934 to_intel_crtc(set->crtc);
9929 9935
@@ -9937,7 +9943,7 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
9937 } else if (set->fb == NULL) { 9943 } else if (set->fb == NULL) {
9938 config->mode_changed = true; 9944 config->mode_changed = true;
9939 } else if (set->fb->pixel_format != 9945 } else if (set->fb->pixel_format !=
9940 set->crtc->fb->pixel_format) { 9946 set->crtc->primary->fb->pixel_format) {
9941 config->mode_changed = true; 9947 config->mode_changed = true;
9942 } else { 9948 } else {
9943 config->fb_changed = true; 9949 config->fb_changed = true;
@@ -10150,7 +10156,7 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
10150 save_set.mode = &set->crtc->mode; 10156 save_set.mode = &set->crtc->mode;
10151 save_set.x = set->crtc->x; 10157 save_set.x = set->crtc->x;
10152 save_set.y = set->crtc->y; 10158 save_set.y = set->crtc->y;
10153 save_set.fb = set->crtc->fb; 10159 save_set.fb = set->crtc->primary->fb;
10154 10160
10155 /* 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
10156 * 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
@@ -11467,7 +11473,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
11467 dev_priv->pipe_to_crtc_mapping[pipe]; 11473 dev_priv->pipe_to_crtc_mapping[pipe];
11468 11474
11469 __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, 11475 __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y,
11470 crtc->fb); 11476 crtc->primary->fb);
11471 } 11477 }
11472 } else { 11478 } else {
11473 intel_modeset_update_staged_output_state(dev); 11479 intel_modeset_update_staged_output_state(dev);
@@ -11516,7 +11522,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
11516 11522
11517 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 11523 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
11518 /* Skip inactive CRTCs */ 11524 /* Skip inactive CRTCs */
11519 if (!crtc->fb) 11525 if (!crtc->primary->fb)
11520 continue; 11526 continue;
11521 11527
11522 intel_increase_pllclock(crtc); 11528 intel_increase_pllclock(crtc);