diff options
author | Dave Airlie <airlied@redhat.com> | 2015-03-20 03:32:21 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-03-20 03:32:21 -0400 |
commit | 8265d4486d5c2448a1c645fdc20d4e62873d9c3d (patch) | |
tree | 1e2fb500924320cd1cd5c39ce914be70d2b3e8ca | |
parent | f42e2c2429c0a76d99565e20d70d4fbf21c97498 (diff) | |
parent | 7f0801e566cc78315e5dc383bf3c3b5b5b436048 (diff) |
Merge tag 'drm-intel-fixes-2015-03-19' of git://anongit.freedesktop.org/drm-intel into drm-fixes
Backporting a couple of plane related fixes from drm-next to v4.0.
* tag 'drm-intel-fixes-2015-03-19' of git://anongit.freedesktop.org/drm-intel:
drm/i915: Make sure the primary plane is enabled before reading out the fb state
drm/i915: Ensure plane->state->fb stays in sync with plane->fb
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 9943c20a741d..6d22128d97b1 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <drm/i915_drm.h> | 37 | #include <drm/i915_drm.h> |
38 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
39 | #include "i915_trace.h" | 39 | #include "i915_trace.h" |
40 | #include <drm/drm_atomic.h> | ||
40 | #include <drm/drm_atomic_helper.h> | 41 | #include <drm/drm_atomic_helper.h> |
41 | #include <drm/drm_dp_helper.h> | 42 | #include <drm/drm_dp_helper.h> |
42 | #include <drm/drm_crtc_helper.h> | 43 | #include <drm/drm_crtc_helper.h> |
@@ -2416,6 +2417,14 @@ out_unref_obj: | |||
2416 | return false; | 2417 | return false; |
2417 | } | 2418 | } |
2418 | 2419 | ||
2420 | /* Update plane->state->fb to match plane->fb after driver-internal updates */ | ||
2421 | static void | ||
2422 | update_state_fb(struct drm_plane *plane) | ||
2423 | { | ||
2424 | if (plane->fb != plane->state->fb) | ||
2425 | drm_atomic_set_fb_for_plane(plane->state, plane->fb); | ||
2426 | } | ||
2427 | |||
2419 | static void | 2428 | static void |
2420 | intel_find_plane_obj(struct intel_crtc *intel_crtc, | 2429 | intel_find_plane_obj(struct intel_crtc *intel_crtc, |
2421 | struct intel_initial_plane_config *plane_config) | 2430 | struct intel_initial_plane_config *plane_config) |
@@ -2462,6 +2471,8 @@ intel_find_plane_obj(struct intel_crtc *intel_crtc, | |||
2462 | break; | 2471 | break; |
2463 | } | 2472 | } |
2464 | } | 2473 | } |
2474 | |||
2475 | update_state_fb(intel_crtc->base.primary); | ||
2465 | } | 2476 | } |
2466 | 2477 | ||
2467 | static void i9xx_update_primary_plane(struct drm_crtc *crtc, | 2478 | static void i9xx_update_primary_plane(struct drm_crtc *crtc, |
@@ -6602,6 +6613,10 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, | |||
6602 | struct drm_framebuffer *fb; | 6613 | struct drm_framebuffer *fb; |
6603 | struct intel_framebuffer *intel_fb; | 6614 | struct intel_framebuffer *intel_fb; |
6604 | 6615 | ||
6616 | val = I915_READ(DSPCNTR(plane)); | ||
6617 | if (!(val & DISPLAY_PLANE_ENABLE)) | ||
6618 | return; | ||
6619 | |||
6605 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); | 6620 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); |
6606 | if (!intel_fb) { | 6621 | if (!intel_fb) { |
6607 | DRM_DEBUG_KMS("failed to alloc fb\n"); | 6622 | DRM_DEBUG_KMS("failed to alloc fb\n"); |
@@ -6610,8 +6625,6 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, | |||
6610 | 6625 | ||
6611 | fb = &intel_fb->base; | 6626 | fb = &intel_fb->base; |
6612 | 6627 | ||
6613 | val = I915_READ(DSPCNTR(plane)); | ||
6614 | |||
6615 | if (INTEL_INFO(dev)->gen >= 4) | 6628 | if (INTEL_INFO(dev)->gen >= 4) |
6616 | if (val & DISPPLANE_TILED) | 6629 | if (val & DISPPLANE_TILED) |
6617 | plane_config->tiling = I915_TILING_X; | 6630 | plane_config->tiling = I915_TILING_X; |
@@ -6650,6 +6663,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, | |||
6650 | plane_config->size); | 6663 | plane_config->size); |
6651 | 6664 | ||
6652 | crtc->base.primary->fb = fb; | 6665 | crtc->base.primary->fb = fb; |
6666 | update_state_fb(crtc->base.primary); | ||
6653 | } | 6667 | } |
6654 | 6668 | ||
6655 | static void chv_crtc_clock_get(struct intel_crtc *crtc, | 6669 | static void chv_crtc_clock_get(struct intel_crtc *crtc, |
@@ -7643,6 +7657,9 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7643 | fb = &intel_fb->base; | 7657 | fb = &intel_fb->base; |
7644 | 7658 | ||
7645 | val = I915_READ(PLANE_CTL(pipe, 0)); | 7659 | val = I915_READ(PLANE_CTL(pipe, 0)); |
7660 | if (!(val & PLANE_CTL_ENABLE)) | ||
7661 | goto error; | ||
7662 | |||
7646 | if (val & PLANE_CTL_TILED_MASK) | 7663 | if (val & PLANE_CTL_TILED_MASK) |
7647 | plane_config->tiling = I915_TILING_X; | 7664 | plane_config->tiling = I915_TILING_X; |
7648 | 7665 | ||
@@ -7687,6 +7704,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7687 | plane_config->size); | 7704 | plane_config->size); |
7688 | 7705 | ||
7689 | crtc->base.primary->fb = fb; | 7706 | crtc->base.primary->fb = fb; |
7707 | update_state_fb(crtc->base.primary); | ||
7690 | return; | 7708 | return; |
7691 | 7709 | ||
7692 | error: | 7710 | error: |
@@ -7730,6 +7748,10 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7730 | struct drm_framebuffer *fb; | 7748 | struct drm_framebuffer *fb; |
7731 | struct intel_framebuffer *intel_fb; | 7749 | struct intel_framebuffer *intel_fb; |
7732 | 7750 | ||
7751 | val = I915_READ(DSPCNTR(pipe)); | ||
7752 | if (!(val & DISPLAY_PLANE_ENABLE)) | ||
7753 | return; | ||
7754 | |||
7733 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); | 7755 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); |
7734 | if (!intel_fb) { | 7756 | if (!intel_fb) { |
7735 | DRM_DEBUG_KMS("failed to alloc fb\n"); | 7757 | DRM_DEBUG_KMS("failed to alloc fb\n"); |
@@ -7738,8 +7760,6 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7738 | 7760 | ||
7739 | fb = &intel_fb->base; | 7761 | fb = &intel_fb->base; |
7740 | 7762 | ||
7741 | val = I915_READ(DSPCNTR(pipe)); | ||
7742 | |||
7743 | if (INTEL_INFO(dev)->gen >= 4) | 7763 | if (INTEL_INFO(dev)->gen >= 4) |
7744 | if (val & DISPPLANE_TILED) | 7764 | if (val & DISPPLANE_TILED) |
7745 | plane_config->tiling = I915_TILING_X; | 7765 | plane_config->tiling = I915_TILING_X; |
@@ -7778,6 +7798,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7778 | plane_config->size); | 7798 | plane_config->size); |
7779 | 7799 | ||
7780 | crtc->base.primary->fb = fb; | 7800 | crtc->base.primary->fb = fb; |
7801 | update_state_fb(crtc->base.primary); | ||
7781 | } | 7802 | } |
7782 | 7803 | ||
7783 | static bool ironlake_get_pipe_config(struct intel_crtc *crtc, | 7804 | static bool ironlake_get_pipe_config(struct intel_crtc *crtc, |
@@ -9816,6 +9837,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
9816 | drm_gem_object_reference(&obj->base); | 9837 | drm_gem_object_reference(&obj->base); |
9817 | 9838 | ||
9818 | crtc->primary->fb = fb; | 9839 | crtc->primary->fb = fb; |
9840 | update_state_fb(crtc->primary); | ||
9819 | 9841 | ||
9820 | work->pending_flip_obj = obj; | 9842 | work->pending_flip_obj = obj; |
9821 | 9843 | ||
@@ -9884,6 +9906,7 @@ cleanup_unpin: | |||
9884 | cleanup_pending: | 9906 | cleanup_pending: |
9885 | atomic_dec(&intel_crtc->unpin_work_count); | 9907 | atomic_dec(&intel_crtc->unpin_work_count); |
9886 | crtc->primary->fb = old_fb; | 9908 | crtc->primary->fb = old_fb; |
9909 | update_state_fb(crtc->primary); | ||
9887 | drm_gem_object_unreference(&work->old_fb_obj->base); | 9910 | drm_gem_object_unreference(&work->old_fb_obj->base); |
9888 | drm_gem_object_unreference(&obj->base); | 9911 | drm_gem_object_unreference(&obj->base); |
9889 | mutex_unlock(&dev->struct_mutex); | 9912 | mutex_unlock(&dev->struct_mutex); |
@@ -13718,6 +13741,7 @@ void intel_modeset_gem_init(struct drm_device *dev) | |||
13718 | to_intel_crtc(c)->pipe); | 13741 | to_intel_crtc(c)->pipe); |
13719 | drm_framebuffer_unreference(c->primary->fb); | 13742 | drm_framebuffer_unreference(c->primary->fb); |
13720 | c->primary->fb = NULL; | 13743 | c->primary->fb = NULL; |
13744 | update_state_fb(c->primary); | ||
13721 | } | 13745 | } |
13722 | } | 13746 | } |
13723 | mutex_unlock(&dev->struct_mutex); | 13747 | mutex_unlock(&dev->struct_mutex); |