From patchwork Fri Apr 13 12:14:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Srinivas X-Patchwork-Id: 10339969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 820B060153 for ; Fri, 13 Apr 2018 12:17:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D5DF285E4 for ; Fri, 13 Apr 2018 12:17:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91539286A7; Fri, 13 Apr 2018 12:17:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4658D285E4 for ; Fri, 13 Apr 2018 12:17:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B2C56EB02; Fri, 13 Apr 2018 12:17:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 753056E26A for ; Fri, 13 Apr 2018 12:17:29 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2018 05:17:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,445,1517904000"; d="scan'208";a="31786264" Received: from vsrini4-ubuntu.iind.intel.com ([10.223.161.6]) by fmsmga007.fm.intel.com with ESMTP; 13 Apr 2018 05:17:28 -0700 From: Vidya Srinivas To: intel-gfx@lists.freedesktop.org Date: Fri, 13 Apr 2018 17:44:04 +0530 Message-Id: <1523621644-32363-7-git-send-email-vidya.srinivas@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523621644-32363-1-git-send-email-vidya.srinivas@intel.com> References: <1523621644-32363-1-git-send-email-vidya.srinivas@intel.com> Subject: [Intel-gfx] [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Credits-to: Maarten Lankhorst Signed-off-by: Vidya Srinivas --- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bc83f10..f64708f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct intel_plane *plane, bool can_position = false; int ret; uint32_t pixel_format = 0; + struct drm_plane_state *plane_state = &state->base; + struct drm_rect *src = &plane_state->src; + + *src = drm_plane_state_src(plane_state); if (INTEL_GEN(dev_priv) >= 9) { /* use scaler when colorkey is not required */ @@ -13001,6 +13005,13 @@ intel_check_primary_plane(struct intel_plane *plane, if (!state->base.fb) return 0; + if (pixel_format == DRM_FORMAT_NV12) { + src->x1 = (((src->x1 >> 16)/4)*4) << 16; + src->x2 = (((src->x2 >> 16)/4)*4) << 16; + src->y1 = (((src->y1 >> 16)/4)*4) << 16; + src->y2 = (((src->y2 >> 16)/4)*4) << 16; + } + if (INTEL_GEN(dev_priv) >= 9) { ret = skl_check_plane_surface(crtc_state, state); if (ret) diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 8b7947d..c1dd85e 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -1035,11 +1035,20 @@ intel_check_sprite_plane(struct intel_plane *plane, return vscale; } + if (fb->format->format == DRM_FORMAT_NV12) { + if (src->x2 >> 16 == 16) + src->x2 = 16 << 16; + if (src->y2 >> 16 == 16) + src->y2 = 16 << 16; + goto nv12_min_no_clip; + } + /* Make the source viewport size an exact multiple of the scaling factors. */ drm_rect_adjust_size(src, drm_rect_width(dst) * hscale - drm_rect_width(src), drm_rect_height(dst) * vscale - drm_rect_height(src)); +nv12_min_no_clip: drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, state->base.rotation); @@ -1105,6 +1114,12 @@ intel_check_sprite_plane(struct intel_plane *plane, src->x2 = (src_x + src_w) << 16; src->y1 = src_y << 16; src->y2 = (src_y + src_h) << 16; + if (fb->format->format == DRM_FORMAT_NV12) { + src->x1 = (((src->x1 >> 16)/4)*4) << 16; + src->x2 = (((src->x2 >> 16)/4)*4) << 16; + src->y1 = (((src->y1 >> 16)/4)*4) << 16; + src->y2 = (((src->y2 >> 16)/4)*4) << 16; + } } dst->x1 = crtc_x;