diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2013-07-03 16:06:04 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-24 08:39:46 -0400 |
commit | 70d21f0e914415c39bfdffdcaebb6bc8fb6ce79c (patch) | |
tree | 0b5616351c13aa548b5fb3439c21d838eddf965a /drivers/gpu/drm/i915/intel_display.c | |
parent | 5907f5fb6a16ae70cde25bcf4be201a93dfa0b9c (diff) |
drm/i915/skl: Implement the new update_plane() for primary planes
Skylake makes primary planes the same as sprite planes and call the
result "universal planes".
This commit emulates a primary plane with plane 0, taking the
opportunity to redefine primary and sprite registers to be identical now
that the underlying hardware is. It also makes sense as plenty of fields
have changed.
v2: Rebase on top of the vma code.
v3: Follow upstream evolution:
- Drop return values.
- Remove pipe checks since redudant and BUG instead.
- Remove tiling checks and BUG instead.
- Drop commented out DISP_MODIFY usage.
v4: s/plane/primary_plane/
v5: Misc fixes:
- Fix the fields we need to clear up
- Disable trickle feed
- Correctly use PLANE_OFFSET for the panning
v6: (Jesse)
Use pipe src size when programming plane size. This makes cloned configs
work correctly w/o the use of a panel fitter.
v7: Rebase on top of Ville's rmw elimination series
v8: Remove clearing the trickle feed bit now that we don't do a RMW (Rodrigo,
Damien)
Add a comment about the stride unit (Rodrigo)
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> (v1,5,6,7)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v2,3)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 92 |
1 files changed, 90 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dc264de4e39e..65f4ff668208 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2644,6 +2644,90 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc, | |||
2644 | POSTING_READ(reg); | 2644 | POSTING_READ(reg); |
2645 | } | 2645 | } |
2646 | 2646 | ||
2647 | static void skylake_update_primary_plane(struct drm_crtc *crtc, | ||
2648 | struct drm_framebuffer *fb, | ||
2649 | int x, int y) | ||
2650 | { | ||
2651 | struct drm_device *dev = crtc->dev; | ||
2652 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2653 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
2654 | struct intel_framebuffer *intel_fb; | ||
2655 | struct drm_i915_gem_object *obj; | ||
2656 | int pipe = intel_crtc->pipe; | ||
2657 | u32 plane_ctl, stride; | ||
2658 | |||
2659 | if (!intel_crtc->primary_enabled) { | ||
2660 | I915_WRITE(PLANE_CTL(pipe, 0), 0); | ||
2661 | I915_WRITE(PLANE_SURF(pipe, 0), 0); | ||
2662 | POSTING_READ(PLANE_CTL(pipe, 0)); | ||
2663 | return; | ||
2664 | } | ||
2665 | |||
2666 | plane_ctl = PLANE_CTL_ENABLE | | ||
2667 | PLANE_CTL_PIPE_GAMMA_ENABLE | | ||
2668 | PLANE_CTL_PIPE_CSC_ENABLE; | ||
2669 | |||
2670 | switch (fb->pixel_format) { | ||
2671 | case DRM_FORMAT_RGB565: | ||
2672 | plane_ctl |= PLANE_CTL_FORMAT_RGB_565; | ||
2673 | break; | ||
2674 | case DRM_FORMAT_XRGB8888: | ||
2675 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; | ||
2676 | break; | ||
2677 | case DRM_FORMAT_XBGR8888: | ||
2678 | plane_ctl |= PLANE_CTL_ORDER_RGBX; | ||
2679 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; | ||
2680 | break; | ||
2681 | case DRM_FORMAT_XRGB2101010: | ||
2682 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_2101010; | ||
2683 | break; | ||
2684 | case DRM_FORMAT_XBGR2101010: | ||
2685 | plane_ctl |= PLANE_CTL_ORDER_RGBX; | ||
2686 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_2101010; | ||
2687 | break; | ||
2688 | default: | ||
2689 | BUG(); | ||
2690 | } | ||
2691 | |||
2692 | intel_fb = to_intel_framebuffer(fb); | ||
2693 | obj = intel_fb->obj; | ||
2694 | |||
2695 | /* | ||
2696 | * The stride is either expressed as a multiple of 64 bytes chunks for | ||
2697 | * linear buffers or in number of tiles for tiled buffers. | ||
2698 | */ | ||
2699 | switch (obj->tiling_mode) { | ||
2700 | case I915_TILING_NONE: | ||
2701 | stride = fb->pitches[0] >> 6; | ||
2702 | break; | ||
2703 | case I915_TILING_X: | ||
2704 | plane_ctl |= PLANE_CTL_TILED_X; | ||
2705 | stride = fb->pitches[0] >> 9; | ||
2706 | break; | ||
2707 | default: | ||
2708 | BUG(); | ||
2709 | } | ||
2710 | |||
2711 | plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE; | ||
2712 | |||
2713 | I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl); | ||
2714 | |||
2715 | DRM_DEBUG_KMS("Writing base %08lX %d,%d,%d,%d pitch=%d\n", | ||
2716 | i915_gem_obj_ggtt_offset(obj), | ||
2717 | x, y, fb->width, fb->height, | ||
2718 | fb->pitches[0]); | ||
2719 | |||
2720 | I915_WRITE(PLANE_POS(pipe, 0), 0); | ||
2721 | I915_WRITE(PLANE_OFFSET(pipe, 0), (y << 16) | x); | ||
2722 | I915_WRITE(PLANE_SIZE(pipe, 0), | ||
2723 | (intel_crtc->config.pipe_src_h - 1) << 16 | | ||
2724 | (intel_crtc->config.pipe_src_w - 1)); | ||
2725 | I915_WRITE(PLANE_STRIDE(pipe, 0), stride); | ||
2726 | I915_WRITE(PLANE_SURF(pipe, 0), i915_gem_obj_ggtt_offset(obj)); | ||
2727 | |||
2728 | POSTING_READ(PLANE_SURF(pipe, 0)); | ||
2729 | } | ||
2730 | |||
2647 | /* Assume fb object is pinned & idle & fenced and just update base pointers */ | 2731 | /* Assume fb object is pinned & idle & fenced and just update base pointers */ |
2648 | static int | 2732 | static int |
2649 | intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, | 2733 | intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
@@ -12581,8 +12665,12 @@ static void intel_init_display(struct drm_device *dev) | |||
12581 | dev_priv->display.crtc_enable = haswell_crtc_enable; | 12665 | dev_priv->display.crtc_enable = haswell_crtc_enable; |
12582 | dev_priv->display.crtc_disable = haswell_crtc_disable; | 12666 | dev_priv->display.crtc_disable = haswell_crtc_disable; |
12583 | dev_priv->display.off = ironlake_crtc_off; | 12667 | dev_priv->display.off = ironlake_crtc_off; |
12584 | dev_priv->display.update_primary_plane = | 12668 | if (INTEL_INFO(dev)->gen >= 9) |
12585 | ironlake_update_primary_plane; | 12669 | dev_priv->display.update_primary_plane = |
12670 | skylake_update_primary_plane; | ||
12671 | else | ||
12672 | dev_priv->display.update_primary_plane = | ||
12673 | ironlake_update_primary_plane; | ||
12586 | } else if (HAS_PCH_SPLIT(dev)) { | 12674 | } else if (HAS_PCH_SPLIT(dev)) { |
12587 | dev_priv->display.get_pipe_config = ironlake_get_pipe_config; | 12675 | dev_priv->display.get_pipe_config = ironlake_get_pipe_config; |
12588 | dev_priv->display.get_plane_config = ironlake_get_plane_config; | 12676 | dev_priv->display.get_plane_config = ironlake_get_plane_config; |