Skip to content

Commit 5d79428

Browse files
committed
drm/i915: Add skl_check_nv12_surface for NV12
We skip src trunction/adjustments for NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL. v2: For NV12, making the src coordinates multiplier of 4 v3: Moving all the src coords handling code for NV12 to skl_check_nv12_surface v4: Added RB from Mika v5: Rebased the series. Removed checks of mult of 4 in skl_update_scaler, Added NV12 condition in intel_check_sprite_plane where src x/w is being checked for mult of 2 for yuv planes. v6: Made changes to skl_check_nv12_surface as per WA#1106 Reviewed-by: Mika Kahola <mika.kahola@intel.com> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/1526074397-10457-4-git-send-email-vidya.srinivas@intel.com
1 parent 6deef9b commit 5d79428

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,6 +3102,29 @@ static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
31023102
return 0;
31033103
}
31043104

3105+
static int
3106+
skl_check_nv12_surface(const struct intel_crtc_state *crtc_state,
3107+
struct intel_plane_state *plane_state)
3108+
{
3109+
/* Display WA #1106 */
3110+
if (plane_state->base.rotation !=
3111+
(DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_90) &&
3112+
plane_state->base.rotation != DRM_MODE_ROTATE_270)
3113+
return 0;
3114+
3115+
/*
3116+
* src coordinates are rotated here.
3117+
* We check height but report it as width
3118+
*/
3119+
if (((drm_rect_height(&plane_state->base.src) >> 16) % 4) != 0) {
3120+
DRM_DEBUG_KMS("src width must be multiple "
3121+
"of 4 for rotated NV12\n");
3122+
return -EINVAL;
3123+
}
3124+
3125+
return 0;
3126+
}
3127+
31053128
static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state)
31063129
{
31073130
const struct drm_framebuffer *fb = plane_state->base.fb;
@@ -3185,6 +3208,9 @@ int skl_check_plane_surface(const struct intel_crtc_state *crtc_state,
31853208
* the main surface setup depends on it.
31863209
*/
31873210
if (fb->format->format == DRM_FORMAT_NV12) {
3211+
ret = skl_check_nv12_surface(crtc_state, plane_state);
3212+
if (ret)
3213+
return ret;
31883214
ret = skl_check_nv12_aux_surface(plane_state);
31893215
if (ret)
31903216
return ret;
@@ -4806,8 +4832,7 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
48064832
}
48074833

48084834
if (plane_scaler_check && pixel_format == DRM_FORMAT_NV12 &&
4809-
(src_h < SKL_MIN_YUV_420_SRC_H || (src_w % 4) != 0 ||
4810-
(src_h % 4) != 0)) {
4835+
(src_h < SKL_MIN_YUV_420_SRC_H || src_w < SKL_MIN_YUV_420_SRC_W)) {
48114836
DRM_DEBUG_KMS("NV12: src dimensions not met\n");
48124837
return -EINVAL;
48134838
}

drivers/gpu/drm/i915/intel_sprite.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,8 @@ intel_check_sprite_plane(struct intel_plane *plane,
10601060
src_y = src->y1 >> 16;
10611061
src_h = drm_rect_height(src) >> 16;
10621062

1063-
if (intel_format_is_yuv(fb->format->format)) {
1063+
if (intel_format_is_yuv(fb->format->format) &&
1064+
fb->format->format != DRM_FORMAT_NV12) {
10641065
src_x &= ~1;
10651066
src_w &= ~1;
10661067

0 commit comments

Comments
 (0)