diff options
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 128 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_sprite.c | 54 |
3 files changed, 139 insertions, 46 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bf564a638dca..be5a73b6805a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3215,28 +3215,38 @@ i9xx_plane_max_stride(struct intel_plane *plane, | |||
3215 | } | 3215 | } |
3216 | } | 3216 | } |
3217 | 3217 | ||
3218 | static u32 i9xx_plane_ctl_crtc(const struct intel_crtc_state *crtc_state) | ||
3219 | { | ||
3220 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
3221 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | ||
3222 | u32 dspcntr = 0; | ||
3223 | |||
3224 | dspcntr |= DISPPLANE_GAMMA_ENABLE; | ||
3225 | |||
3226 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | ||
3227 | dspcntr |= DISPPLANE_PIPE_CSC_ENABLE; | ||
3228 | |||
3229 | if (INTEL_GEN(dev_priv) < 5) | ||
3230 | dspcntr |= DISPPLANE_SEL_PIPE(crtc->pipe); | ||
3231 | |||
3232 | return dspcntr; | ||
3233 | } | ||
3234 | |||
3218 | static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state, | 3235 | static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state, |
3219 | const struct intel_plane_state *plane_state) | 3236 | const struct intel_plane_state *plane_state) |
3220 | { | 3237 | { |
3221 | struct drm_i915_private *dev_priv = | 3238 | struct drm_i915_private *dev_priv = |
3222 | to_i915(plane_state->base.plane->dev); | 3239 | to_i915(plane_state->base.plane->dev); |
3223 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
3224 | const struct drm_framebuffer *fb = plane_state->base.fb; | 3240 | const struct drm_framebuffer *fb = plane_state->base.fb; |
3225 | unsigned int rotation = plane_state->base.rotation; | 3241 | unsigned int rotation = plane_state->base.rotation; |
3226 | u32 dspcntr; | 3242 | u32 dspcntr; |
3227 | 3243 | ||
3228 | dspcntr = DISPLAY_PLANE_ENABLE | DISPPLANE_GAMMA_ENABLE; | 3244 | dspcntr = DISPLAY_PLANE_ENABLE; |
3229 | 3245 | ||
3230 | if (IS_G4X(dev_priv) || IS_GEN(dev_priv, 5) || | 3246 | if (IS_G4X(dev_priv) || IS_GEN(dev_priv, 5) || |
3231 | IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv)) | 3247 | IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv)) |
3232 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; | 3248 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; |
3233 | 3249 | ||
3234 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | ||
3235 | dspcntr |= DISPPLANE_PIPE_CSC_ENABLE; | ||
3236 | |||
3237 | if (INTEL_GEN(dev_priv) < 5) | ||
3238 | dspcntr |= DISPPLANE_SEL_PIPE(crtc->pipe); | ||
3239 | |||
3240 | switch (fb->format->format) { | 3250 | switch (fb->format->format) { |
3241 | case DRM_FORMAT_C8: | 3251 | case DRM_FORMAT_C8: |
3242 | dspcntr |= DISPPLANE_8BPP; | 3252 | dspcntr |= DISPPLANE_8BPP; |
@@ -3364,11 +3374,13 @@ static void i9xx_update_plane(struct intel_plane *plane, | |||
3364 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); | 3374 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
3365 | enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; | 3375 | enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; |
3366 | u32 linear_offset; | 3376 | u32 linear_offset; |
3367 | u32 dspcntr = plane_state->ctl; | ||
3368 | int x = plane_state->color_plane[0].x; | 3377 | int x = plane_state->color_plane[0].x; |
3369 | int y = plane_state->color_plane[0].y; | 3378 | int y = plane_state->color_plane[0].y; |
3370 | unsigned long irqflags; | 3379 | unsigned long irqflags; |
3371 | u32 dspaddr_offset; | 3380 | u32 dspaddr_offset; |
3381 | u32 dspcntr; | ||
3382 | |||
3383 | dspcntr = plane_state->ctl | i9xx_plane_ctl_crtc(crtc_state); | ||
3372 | 3384 | ||
3373 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); | 3385 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); |
3374 | 3386 | ||
@@ -3428,10 +3440,23 @@ static void i9xx_disable_plane(struct intel_plane *plane, | |||
3428 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); | 3440 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
3429 | enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; | 3441 | enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; |
3430 | unsigned long irqflags; | 3442 | unsigned long irqflags; |
3443 | u32 dspcntr; | ||
3444 | |||
3445 | /* | ||
3446 | * DSPCNTR pipe gamma enable on g4x+ and pipe csc | ||
3447 | * enable on ilk+ affect the pipe bottom color as | ||
3448 | * well, so we must configure them even if the plane | ||
3449 | * is disabled. | ||
3450 | * | ||
3451 | * On pre-g4x there is no way to gamma correct the | ||
3452 | * pipe bottom color but we'll keep on doing this | ||
3453 | * anyway. | ||
3454 | */ | ||
3455 | dspcntr = i9xx_plane_ctl_crtc(crtc_state); | ||
3431 | 3456 | ||
3432 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); | 3457 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); |
3433 | 3458 | ||
3434 | I915_WRITE_FW(DSPCNTR(i9xx_plane), 0); | 3459 | I915_WRITE_FW(DSPCNTR(i9xx_plane), dspcntr); |
3435 | if (INTEL_GEN(dev_priv) >= 4) | 3460 | if (INTEL_GEN(dev_priv) >= 4) |
3436 | I915_WRITE_FW(DSPSURF(i9xx_plane), 0); | 3461 | I915_WRITE_FW(DSPSURF(i9xx_plane), 0); |
3437 | else | 3462 | else |
@@ -3668,6 +3693,20 @@ static u32 cnl_plane_ctl_flip(unsigned int reflect) | |||
3668 | return 0; | 3693 | return 0; |
3669 | } | 3694 | } |
3670 | 3695 | ||
3696 | u32 skl_plane_ctl_crtc(const struct intel_crtc_state *crtc_state) | ||
3697 | { | ||
3698 | struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); | ||
3699 | u32 plane_ctl = 0; | ||
3700 | |||
3701 | if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) | ||
3702 | return plane_ctl; | ||
3703 | |||
3704 | plane_ctl |= PLANE_CTL_PIPE_GAMMA_ENABLE; | ||
3705 | plane_ctl |= PLANE_CTL_PIPE_CSC_ENABLE; | ||
3706 | |||
3707 | return plane_ctl; | ||
3708 | } | ||
3709 | |||
3671 | u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, | 3710 | u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, |
3672 | const struct intel_plane_state *plane_state) | 3711 | const struct intel_plane_state *plane_state) |
3673 | { | 3712 | { |
@@ -3682,10 +3721,7 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, | |||
3682 | 3721 | ||
3683 | if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) { | 3722 | if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) { |
3684 | plane_ctl |= skl_plane_ctl_alpha(plane_state); | 3723 | plane_ctl |= skl_plane_ctl_alpha(plane_state); |
3685 | plane_ctl |= | 3724 | plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE; |
3686 | PLANE_CTL_PIPE_GAMMA_ENABLE | | ||
3687 | PLANE_CTL_PIPE_CSC_ENABLE | | ||
3688 | PLANE_CTL_PLANE_GAMMA_DISABLE; | ||
3689 | 3725 | ||
3690 | if (plane_state->base.color_encoding == DRM_COLOR_YCBCR_BT709) | 3726 | if (plane_state->base.color_encoding == DRM_COLOR_YCBCR_BT709) |
3691 | plane_ctl |= PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709; | 3727 | plane_ctl |= PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709; |
@@ -3710,19 +3746,27 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, | |||
3710 | return plane_ctl; | 3746 | return plane_ctl; |
3711 | } | 3747 | } |
3712 | 3748 | ||
3749 | u32 glk_plane_color_ctl_crtc(const struct intel_crtc_state *crtc_state) | ||
3750 | { | ||
3751 | struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); | ||
3752 | u32 plane_color_ctl = 0; | ||
3753 | |||
3754 | if (INTEL_GEN(dev_priv) >= 11) | ||
3755 | return plane_color_ctl; | ||
3756 | |||
3757 | plane_color_ctl |= PLANE_COLOR_PIPE_GAMMA_ENABLE; | ||
3758 | plane_color_ctl |= PLANE_COLOR_PIPE_CSC_ENABLE; | ||
3759 | |||
3760 | return plane_color_ctl; | ||
3761 | } | ||
3762 | |||
3713 | u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, | 3763 | u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, |
3714 | const struct intel_plane_state *plane_state) | 3764 | const struct intel_plane_state *plane_state) |
3715 | { | 3765 | { |
3716 | struct drm_i915_private *dev_priv = | ||
3717 | to_i915(plane_state->base.plane->dev); | ||
3718 | const struct drm_framebuffer *fb = plane_state->base.fb; | 3766 | const struct drm_framebuffer *fb = plane_state->base.fb; |
3719 | struct intel_plane *plane = to_intel_plane(plane_state->base.plane); | 3767 | struct intel_plane *plane = to_intel_plane(plane_state->base.plane); |
3720 | u32 plane_color_ctl = 0; | 3768 | u32 plane_color_ctl = 0; |
3721 | 3769 | ||
3722 | if (INTEL_GEN(dev_priv) < 11) { | ||
3723 | plane_color_ctl |= PLANE_COLOR_PIPE_GAMMA_ENABLE; | ||
3724 | plane_color_ctl |= PLANE_COLOR_PIPE_CSC_ENABLE; | ||
3725 | } | ||
3726 | plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE; | 3770 | plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE; |
3727 | plane_color_ctl |= glk_plane_color_ctl_alpha(plane_state); | 3771 | plane_color_ctl |= glk_plane_color_ctl_alpha(plane_state); |
3728 | 3772 | ||
@@ -9945,11 +9989,15 @@ i845_cursor_max_stride(struct intel_plane *plane, | |||
9945 | return 2048; | 9989 | return 2048; |
9946 | } | 9990 | } |
9947 | 9991 | ||
9992 | static u32 i845_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state) | ||
9993 | { | ||
9994 | return CURSOR_GAMMA_ENABLE; | ||
9995 | } | ||
9996 | |||
9948 | static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state, | 9997 | static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state, |
9949 | const struct intel_plane_state *plane_state) | 9998 | const struct intel_plane_state *plane_state) |
9950 | { | 9999 | { |
9951 | return CURSOR_ENABLE | | 10000 | return CURSOR_ENABLE | |
9952 | CURSOR_GAMMA_ENABLE | | ||
9953 | CURSOR_FORMAT_ARGB | | 10001 | CURSOR_FORMAT_ARGB | |
9954 | CURSOR_STRIDE(plane_state->color_plane[0].stride); | 10002 | CURSOR_STRIDE(plane_state->color_plane[0].stride); |
9955 | } | 10003 | } |
@@ -10019,7 +10067,9 @@ static void i845_update_cursor(struct intel_plane *plane, | |||
10019 | unsigned int width = plane_state->base.crtc_w; | 10067 | unsigned int width = plane_state->base.crtc_w; |
10020 | unsigned int height = plane_state->base.crtc_h; | 10068 | unsigned int height = plane_state->base.crtc_h; |
10021 | 10069 | ||
10022 | cntl = plane_state->ctl; | 10070 | cntl = plane_state->ctl | |
10071 | i845_cursor_ctl_crtc(crtc_state); | ||
10072 | |||
10023 | size = (height << 12) | width; | 10073 | size = (height << 12) | width; |
10024 | 10074 | ||
10025 | base = intel_cursor_base(plane_state); | 10075 | base = intel_cursor_base(plane_state); |
@@ -10086,27 +10136,36 @@ i9xx_cursor_max_stride(struct intel_plane *plane, | |||
10086 | return plane->base.dev->mode_config.cursor_width * 4; | 10136 | return plane->base.dev->mode_config.cursor_width * 4; |
10087 | } | 10137 | } |
10088 | 10138 | ||
10089 | static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state, | 10139 | static u32 i9xx_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state) |
10090 | const struct intel_plane_state *plane_state) | ||
10091 | { | 10140 | { |
10092 | struct drm_i915_private *dev_priv = | ||
10093 | to_i915(plane_state->base.plane->dev); | ||
10094 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | 10141 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); |
10142 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | ||
10095 | u32 cntl = 0; | 10143 | u32 cntl = 0; |
10096 | 10144 | ||
10097 | if (IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv)) | 10145 | if (INTEL_GEN(dev_priv) >= 11) |
10098 | cntl |= MCURSOR_TRICKLE_FEED_DISABLE; | 10146 | return cntl; |
10099 | 10147 | ||
10100 | if (INTEL_GEN(dev_priv) <= 10) { | 10148 | cntl |= MCURSOR_GAMMA_ENABLE; |
10101 | cntl |= MCURSOR_GAMMA_ENABLE; | ||
10102 | 10149 | ||
10103 | if (HAS_DDI(dev_priv)) | 10150 | if (HAS_DDI(dev_priv)) |
10104 | cntl |= MCURSOR_PIPE_CSC_ENABLE; | 10151 | cntl |= MCURSOR_PIPE_CSC_ENABLE; |
10105 | } | ||
10106 | 10152 | ||
10107 | if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv)) | 10153 | if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv)) |
10108 | cntl |= MCURSOR_PIPE_SELECT(crtc->pipe); | 10154 | cntl |= MCURSOR_PIPE_SELECT(crtc->pipe); |
10109 | 10155 | ||
10156 | return cntl; | ||
10157 | } | ||
10158 | |||
10159 | static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state, | ||
10160 | const struct intel_plane_state *plane_state) | ||
10161 | { | ||
10162 | struct drm_i915_private *dev_priv = | ||
10163 | to_i915(plane_state->base.plane->dev); | ||
10164 | u32 cntl = 0; | ||
10165 | |||
10166 | if (IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv)) | ||
10167 | cntl |= MCURSOR_TRICKLE_FEED_DISABLE; | ||
10168 | |||
10110 | switch (plane_state->base.crtc_w) { | 10169 | switch (plane_state->base.crtc_w) { |
10111 | case 64: | 10170 | case 64: |
10112 | cntl |= MCURSOR_MODE_64_ARGB_AX; | 10171 | cntl |= MCURSOR_MODE_64_ARGB_AX; |
@@ -10231,7 +10290,8 @@ static void i9xx_update_cursor(struct intel_plane *plane, | |||
10231 | unsigned long irqflags; | 10290 | unsigned long irqflags; |
10232 | 10291 | ||
10233 | if (plane_state && plane_state->base.visible) { | 10292 | if (plane_state && plane_state->base.visible) { |
10234 | cntl = plane_state->ctl; | 10293 | cntl = plane_state->ctl | |
10294 | i9xx_cursor_ctl_crtc(crtc_state); | ||
10235 | 10295 | ||
10236 | if (plane_state->base.crtc_h != plane_state->base.crtc_w) | 10296 | if (plane_state->base.crtc_h != plane_state->base.crtc_w) |
10237 | fbc_ctl = CUR_FBC_CTL_EN | (plane_state->base.crtc_h - 1); | 10297 | fbc_ctl = CUR_FBC_CTL_EN | (plane_state->base.crtc_h - 1); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 79f102dfe37c..9717b1250e6f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -1765,9 +1765,10 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state) | |||
1765 | 1765 | ||
1766 | u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, | 1766 | u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, |
1767 | const struct intel_plane_state *plane_state); | 1767 | const struct intel_plane_state *plane_state); |
1768 | u32 glk_plane_color_ctl_crtc(const struct intel_crtc_state *crtc_state); | ||
1768 | u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, | 1769 | u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, |
1769 | const struct intel_plane_state *plane_state); | 1770 | const struct intel_plane_state *plane_state); |
1770 | u32 glk_color_ctl(const struct intel_plane_state *plane_state); | 1771 | u32 skl_plane_ctl_crtc(const struct intel_crtc_state *crtc_state); |
1771 | u32 skl_plane_stride(const struct intel_plane_state *plane_state, | 1772 | u32 skl_plane_stride(const struct intel_plane_state *plane_state, |
1772 | int plane); | 1773 | int plane); |
1773 | int skl_check_plane_surface(struct intel_plane_state *plane_state); | 1774 | int skl_check_plane_surface(struct intel_plane_state *plane_state); |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index cd42e81f8a90..b56a1a9ad01d 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -484,9 +484,16 @@ skl_program_plane(struct intel_plane *plane, | |||
484 | struct intel_plane *linked = plane_state->linked_plane; | 484 | struct intel_plane *linked = plane_state->linked_plane; |
485 | const struct drm_framebuffer *fb = plane_state->base.fb; | 485 | const struct drm_framebuffer *fb = plane_state->base.fb; |
486 | u8 alpha = plane_state->base.alpha >> 8; | 486 | u8 alpha = plane_state->base.alpha >> 8; |
487 | u32 plane_color_ctl = 0; | ||
487 | unsigned long irqflags; | 488 | unsigned long irqflags; |
488 | u32 keymsk, keymax; | 489 | u32 keymsk, keymax; |
489 | 490 | ||
491 | plane_ctl |= skl_plane_ctl_crtc(crtc_state); | ||
492 | |||
493 | if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) | ||
494 | plane_color_ctl = plane_state->color_ctl | | ||
495 | glk_plane_color_ctl_crtc(crtc_state); | ||
496 | |||
490 | /* Sizes are 0 based */ | 497 | /* Sizes are 0 based */ |
491 | src_w--; | 498 | src_w--; |
492 | src_h--; | 499 | src_h--; |
@@ -533,8 +540,7 @@ skl_program_plane(struct intel_plane *plane, | |||
533 | } | 540 | } |
534 | 541 | ||
535 | if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) | 542 | if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) |
536 | I915_WRITE_FW(PLANE_COLOR_CTL(pipe, plane_id), | 543 | I915_WRITE_FW(PLANE_COLOR_CTL(pipe, plane_id), plane_color_ctl); |
537 | plane_state->color_ctl); | ||
538 | 544 | ||
539 | if (fb->format->is_yuv && icl_is_hdr_plane(plane)) | 545 | if (fb->format->is_yuv && icl_is_hdr_plane(plane)) |
540 | icl_program_input_csc(plane, crtc_state, plane_state); | 546 | icl_program_input_csc(plane, crtc_state, plane_state); |
@@ -733,6 +739,11 @@ vlv_update_clrc(const struct intel_plane_state *plane_state) | |||
733 | SP_SH_SIN(sh_sin) | SP_SH_COS(sh_cos)); | 739 | SP_SH_SIN(sh_sin) | SP_SH_COS(sh_cos)); |
734 | } | 740 | } |
735 | 741 | ||
742 | static u32 vlv_sprite_ctl_crtc(const struct intel_crtc_state *crtc_state) | ||
743 | { | ||
744 | return SP_GAMMA_ENABLE; | ||
745 | } | ||
746 | |||
736 | static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state, | 747 | static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state, |
737 | const struct intel_plane_state *plane_state) | 748 | const struct intel_plane_state *plane_state) |
738 | { | 749 | { |
@@ -741,7 +752,7 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state, | |||
741 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 752 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
742 | u32 sprctl; | 753 | u32 sprctl; |
743 | 754 | ||
744 | sprctl = SP_ENABLE | SP_GAMMA_ENABLE; | 755 | sprctl = SP_ENABLE; |
745 | 756 | ||
746 | switch (fb->format->format) { | 757 | switch (fb->format->format) { |
747 | case DRM_FORMAT_YUYV: | 758 | case DRM_FORMAT_YUYV: |
@@ -808,7 +819,6 @@ vlv_update_plane(struct intel_plane *plane, | |||
808 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); | 819 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
809 | enum pipe pipe = plane->pipe; | 820 | enum pipe pipe = plane->pipe; |
810 | enum plane_id plane_id = plane->id; | 821 | enum plane_id plane_id = plane->id; |
811 | u32 sprctl = plane_state->ctl; | ||
812 | u32 sprsurf_offset = plane_state->color_plane[0].offset; | 822 | u32 sprsurf_offset = plane_state->color_plane[0].offset; |
813 | u32 linear_offset; | 823 | u32 linear_offset; |
814 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 824 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
@@ -819,6 +829,9 @@ vlv_update_plane(struct intel_plane *plane, | |||
819 | u32 x = plane_state->color_plane[0].x; | 829 | u32 x = plane_state->color_plane[0].x; |
820 | u32 y = plane_state->color_plane[0].y; | 830 | u32 y = plane_state->color_plane[0].y; |
821 | unsigned long irqflags; | 831 | unsigned long irqflags; |
832 | u32 sprctl; | ||
833 | |||
834 | sprctl = plane_state->ctl | vlv_sprite_ctl_crtc(crtc_state); | ||
822 | 835 | ||
823 | /* Sizes are 0 based */ | 836 | /* Sizes are 0 based */ |
824 | crtc_w--; | 837 | crtc_w--; |
@@ -901,6 +914,19 @@ vlv_plane_get_hw_state(struct intel_plane *plane, | |||
901 | return ret; | 914 | return ret; |
902 | } | 915 | } |
903 | 916 | ||
917 | static u32 ivb_sprite_ctl_crtc(const struct intel_crtc_state *crtc_state) | ||
918 | { | ||
919 | struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); | ||
920 | u32 sprctl = 0; | ||
921 | |||
922 | sprctl |= SPRITE_GAMMA_ENABLE; | ||
923 | |||
924 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | ||
925 | sprctl |= SPRITE_PIPE_CSC_ENABLE; | ||
926 | |||
927 | return sprctl; | ||
928 | } | ||
929 | |||
904 | static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state, | 930 | static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state, |
905 | const struct intel_plane_state *plane_state) | 931 | const struct intel_plane_state *plane_state) |
906 | { | 932 | { |
@@ -911,14 +937,11 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state, | |||
911 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 937 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
912 | u32 sprctl; | 938 | u32 sprctl; |
913 | 939 | ||
914 | sprctl = SPRITE_ENABLE | SPRITE_GAMMA_ENABLE; | 940 | sprctl = SPRITE_ENABLE; |
915 | 941 | ||
916 | if (IS_IVYBRIDGE(dev_priv)) | 942 | if (IS_IVYBRIDGE(dev_priv)) |
917 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; | 943 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; |
918 | 944 | ||
919 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | ||
920 | sprctl |= SPRITE_PIPE_CSC_ENABLE; | ||
921 | |||
922 | switch (fb->format->format) { | 945 | switch (fb->format->format) { |
923 | case DRM_FORMAT_XBGR8888: | 946 | case DRM_FORMAT_XBGR8888: |
924 | sprctl |= SPRITE_FORMAT_RGBX888 | SPRITE_RGB_ORDER_RGBX; | 947 | sprctl |= SPRITE_FORMAT_RGBX888 | SPRITE_RGB_ORDER_RGBX; |
@@ -970,7 +993,6 @@ ivb_update_plane(struct intel_plane *plane, | |||
970 | { | 993 | { |
971 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); | 994 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
972 | enum pipe pipe = plane->pipe; | 995 | enum pipe pipe = plane->pipe; |
973 | u32 sprctl = plane_state->ctl, sprscale = 0; | ||
974 | u32 sprsurf_offset = plane_state->color_plane[0].offset; | 996 | u32 sprsurf_offset = plane_state->color_plane[0].offset; |
975 | u32 linear_offset; | 997 | u32 linear_offset; |
976 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 998 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
@@ -982,8 +1004,11 @@ ivb_update_plane(struct intel_plane *plane, | |||
982 | u32 y = plane_state->color_plane[0].y; | 1004 | u32 y = plane_state->color_plane[0].y; |
983 | u32 src_w = drm_rect_width(&plane_state->base.src) >> 16; | 1005 | u32 src_w = drm_rect_width(&plane_state->base.src) >> 16; |
984 | u32 src_h = drm_rect_height(&plane_state->base.src) >> 16; | 1006 | u32 src_h = drm_rect_height(&plane_state->base.src) >> 16; |
1007 | u32 sprctl, sprscale = 0; | ||
985 | unsigned long irqflags; | 1008 | unsigned long irqflags; |
986 | 1009 | ||
1010 | sprctl = plane_state->ctl | ivb_sprite_ctl_crtc(crtc_state); | ||
1011 | |||
987 | /* Sizes are 0 based */ | 1012 | /* Sizes are 0 based */ |
988 | src_w--; | 1013 | src_w--; |
989 | src_h--; | 1014 | src_h--; |
@@ -1080,6 +1105,11 @@ g4x_sprite_max_stride(struct intel_plane *plane, | |||
1080 | return 16384; | 1105 | return 16384; |
1081 | } | 1106 | } |
1082 | 1107 | ||
1108 | static u32 g4x_sprite_ctl_crtc(const struct intel_crtc_state *crtc_state) | ||
1109 | { | ||
1110 | return DVS_GAMMA_ENABLE; | ||
1111 | } | ||
1112 | |||
1083 | static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state, | 1113 | static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state, |
1084 | const struct intel_plane_state *plane_state) | 1114 | const struct intel_plane_state *plane_state) |
1085 | { | 1115 | { |
@@ -1090,7 +1120,7 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state, | |||
1090 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 1120 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
1091 | u32 dvscntr; | 1121 | u32 dvscntr; |
1092 | 1122 | ||
1093 | dvscntr = DVS_ENABLE | DVS_GAMMA_ENABLE; | 1123 | dvscntr = DVS_ENABLE; |
1094 | 1124 | ||
1095 | if (IS_GEN(dev_priv, 6)) | 1125 | if (IS_GEN(dev_priv, 6)) |
1096 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; | 1126 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; |
@@ -1146,7 +1176,6 @@ g4x_update_plane(struct intel_plane *plane, | |||
1146 | { | 1176 | { |
1147 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); | 1177 | struct drm_i915_private *dev_priv = to_i915(plane->base.dev); |
1148 | enum pipe pipe = plane->pipe; | 1178 | enum pipe pipe = plane->pipe; |
1149 | u32 dvscntr = plane_state->ctl, dvsscale = 0; | ||
1150 | u32 dvssurf_offset = plane_state->color_plane[0].offset; | 1179 | u32 dvssurf_offset = plane_state->color_plane[0].offset; |
1151 | u32 linear_offset; | 1180 | u32 linear_offset; |
1152 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; | 1181 | const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; |
@@ -1158,8 +1187,11 @@ g4x_update_plane(struct intel_plane *plane, | |||
1158 | u32 y = plane_state->color_plane[0].y; | 1187 | u32 y = plane_state->color_plane[0].y; |
1159 | u32 src_w = drm_rect_width(&plane_state->base.src) >> 16; | 1188 | u32 src_w = drm_rect_width(&plane_state->base.src) >> 16; |
1160 | u32 src_h = drm_rect_height(&plane_state->base.src) >> 16; | 1189 | u32 src_h = drm_rect_height(&plane_state->base.src) >> 16; |
1190 | u32 dvscntr, dvsscale = 0; | ||
1161 | unsigned long irqflags; | 1191 | unsigned long irqflags; |
1162 | 1192 | ||
1193 | dvscntr = plane_state->ctl | g4x_sprite_ctl_crtc(crtc_state); | ||
1194 | |||
1163 | /* Sizes are 0 based */ | 1195 | /* Sizes are 0 based */ |
1164 | src_w--; | 1196 | src_w--; |
1165 | src_h--; | 1197 | src_h--; |