From patchwork Wed Jan 27 16:10:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, Shobhit" X-Patchwork-Id: 8135391 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D583BEEE5 for ; Wed, 27 Jan 2016 16:12:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4312320379 for ; Wed, 27 Jan 2016 16:12:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B0A6320380 for ; Wed, 27 Jan 2016 16:12:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 29E0E72055; Wed, 27 Jan 2016 08:12:10 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id C755F72055 for ; Wed, 27 Jan 2016 08:12:04 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 27 Jan 2016 08:10:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,355,1449561600"; d="scan'208";a="902256188" Received: from skumar40-mobl.iind.intel.com ([10.223.179.230]) by fmsmga002.fm.intel.com with ESMTP; 27 Jan 2016 08:10:14 -0800 From: Shobhit Kumar To: intel-gfx@lists.freedesktop.org Date: Wed, 27 Jan 2016 21:40:01 +0530 Message-Id: <1453911003-9856-4-git-send-email-shobhit.kumar@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453911003-9856-1-git-send-email-shobhit.kumar@intel.com> References: <1453911003-9856-1-git-send-email-shobhit.kumar@intel.com> Subject: [Intel-gfx] [v2 4/6] drm/i915/skl+: Use scaling amount for plane data rate calculation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Kumar, Mahesh" if downscaling is enabled plane data rate increases according to scaling amount. take scaling amount under consideration while calculating plane data rate v2: Address Matt's comments, where data rate was overridden because of missing else. Cc: matthew.d.roper@intel.com Signed-off-by: Kumar, Mahesh Reviewed-by: Matt Roper --- drivers/gpu/drm/i915/intel_pm.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 40fff09..a9f9396 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -2912,6 +2912,8 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate, { struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate); struct drm_framebuffer *fb = pstate->fb; + struct intel_plane *intel_plane = to_intel_plane(pstate->plane); + uint32_t down_scale_amount, data_rate; uint32_t width = 0, height = 0; width = drm_rect_width(&intel_pstate->src) >> 16; @@ -2923,15 +2925,20 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate, /* for planar format */ if (fb->pixel_format == DRM_FORMAT_NV12) { if (y) /* y-plane data rate */ - return width * height * + data_rate = width * height * drm_format_plane_cpp(fb->pixel_format, 0); else /* uv-plane data rate */ - return (width / 2) * (height / 2) * + data_rate = (width / 2) * (height / 2) * drm_format_plane_cpp(fb->pixel_format, 1); - } + } else + /* for packed formats */ + data_rate = width * height * + drm_format_plane_cpp(fb->pixel_format, 0); + + down_scale_amount = skl_plane_downscale_amount(intel_plane); + + return DIV_ROUND_UP((data_rate * down_scale_amount), 1000); - /* for packed formats */ - return width * height * drm_format_plane_cpp(fb->pixel_format, 0); } /*