From patchwork Wed Jan 8 12:35:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13930848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9BBAE77199 for ; Wed, 8 Jan 2025 12:39:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 611A810E88E; Wed, 8 Jan 2025 12:39:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kKdNtM4V"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18BD410E29A; Wed, 8 Jan 2025 12:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736339943; x=1767875943; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uBrlv8zNxoFzlVhfSw0hE399TwXwzoT92odXX8T1erc=; b=kKdNtM4VZ942QRcmMS9HEIlNhSeGuCnnuPLc24QCpu7yGmx7d2I1JQ2G 8wmbY53aj1ImzMw4fHT/jZ2pjBJOwZgkKJmTijyxE7r92xKDAD1p1riaq kWFAZ42HjV3fgQn9jzXE8EpVCqeKStXPfQLrMDNixDqBMAu3T9dhzpwDw Oq5sIEAN1IZr45jX6C4Q58O070Ks7z2dnmZLxLpoffaWlgj+2/ogiaoGp fHTzwHqUvLM2LSwPkQgnt/syWtHTu/3MOqrRYhIfHxbMgC9NOf3nfsuHn PMSM7VvNg58uuTaUB57Hb2gLbKD3r4C+mZFvzLfGJluIu1KOa9H9/i27e A==; X-CSE-ConnectionGUID: Gqz8AzKoQqKsYLcr5uyl/w== X-CSE-MsgGUID: /BpIDeTASuy+QNZ32KsXjA== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="35855364" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="35855364" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 04:39:02 -0800 X-CSE-ConnectionGUID: W0lSoKFIRaCogFDOlrm9fQ== X-CSE-MsgGUID: n0LvqRdkR0mQqjt2ks4i/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="102886086" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa006.fm.intel.com with ESMTP; 08 Jan 2025 04:39:00 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, jani.nikula@intel.com, ville.syrjala@intel.com Subject: [PATCH v4 1/7] drm/i915/scaler: Add and compute scaling factors Date: Wed, 8 Jan 2025 18:05:35 +0530 Message-ID: <20250108123541.2101643-2-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add scaling factors to scaler_state for a particular scaler user. These factors will be used later to compute scaler prefill latency. Currently, only plane scaling factors are stored, but the same members can later be extended to store pipe scaling factors as well. --v2: - Rephrase commit message which corrects typo and information about scaling factor storage. [Ankit] Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/intel_display_types.h | 2 ++ drivers/gpu/drm/i915/display/skl_scaler.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 8271e50e3644..603f292996aa 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -711,6 +711,8 @@ struct intel_initial_plane_config { struct intel_scaler { u32 mode; bool in_use; + int hscale; + int vscale; }; struct intel_crtc_scaler_state { diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c index ae21fce534dc..6c69545fe172 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -424,6 +424,9 @@ static int intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_stat return -EINVAL; } + + scaler_state->scalers[*scaler_id].hscale = hscale; + scaler_state->scalers[*scaler_id].vscale = vscale; } drm_dbg_kms(display->drm, "Attached scaler id %u.%u to %s:%d\n", From patchwork Wed Jan 8 12:35:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13930849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2FD5AE77188 for ; Wed, 8 Jan 2025 12:39:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD96910E89B; Wed, 8 Jan 2025 12:39:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="E95iBurG"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 646AB10E894; Wed, 8 Jan 2025 12:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736339944; x=1767875944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MkHbAyAkzfU8IzkPLwpgO+KmcHgHhCH2CGNwUp+UBYY=; b=E95iBurG2aoPf1RqPP3H46r/Xo5RtmKHEeN2J1+f2Uqrr0bTxnBaN9+M GKBNagOgc3zLo2iCngccsHT5nN6Wl/CRlh6o8Y/aFbXAtBdiD3ObQdROF vzlRbp0WP9FBtIoLzsRvlcUdSri+OoDktJ53Naz7bp9TJAvD7cz0Jbkgp zvyeqjWUbT/iscWimp+iEkGazwBu3xlfEcx6jJ2lmbEvFsMWRldY9OzHy BIFzbk7LXyeJXrcVFGWEXuVWapSxAHVvUC6abuAkBGbHSAX1KvHvsxkrJ VMkd6EaYkSm5lfEG5PLLXVFc53QXI0DXrxne5ew0HagR9wyI33eKtp1/R A==; X-CSE-ConnectionGUID: 9AzFCYh5R6qo/ZsqVKam6w== X-CSE-MsgGUID: oulHo3EBSe+smgn8IHrArg== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="35855367" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="35855367" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 04:39:04 -0800 X-CSE-ConnectionGUID: f+IEjwPoR8ShuB/HGUWYUQ== X-CSE-MsgGUID: sZ1CuxqDSEKX+rMr/3/7gg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="102886093" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa006.fm.intel.com with ESMTP; 08 Jan 2025 04:39:02 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, jani.nikula@intel.com, ville.syrjala@intel.com Subject: [PATCH v4 2/7] drm/i915/scaler: Use crtc_state to setup plane or pipe scaler Date: Wed, 8 Jan 2025 18:05:36 +0530 Message-ID: <20250108123541.2101643-3-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Pass crtc_state to intel_atomic_setup_scaler, this will help to check if pch_pfit enabled or not and also will be useful to pass scaler_state with the same which will be used later to store hscale and vscale values. -- v2: - Commit message updates. parse to pass. (Ankit) Signed-off-by: Mitul Golani Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/skl_scaler.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c index 6c69545fe172..4f838220f880 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -309,13 +309,15 @@ static int intel_allocate_scaler(struct intel_crtc_scaler_state *scaler_state, return -1; } -static int intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_state, +static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, int num_scalers_need, struct intel_crtc *crtc, const char *name, int idx, struct intel_plane_state *plane_state, int *scaler_id) { struct intel_display *display = to_intel_display(crtc); + struct intel_crtc_scaler_state *scaler_state = + &crtc_state->scaler_state; struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); u32 mode; @@ -444,7 +446,7 @@ static int setup_crtc_scaler(struct intel_atomic_state *state, struct intel_crtc_scaler_state *scaler_state = &crtc_state->scaler_state; - return intel_atomic_setup_scaler(scaler_state, + return intel_atomic_setup_scaler(crtc_state, hweight32(scaler_state->scaler_users), crtc, "CRTC", crtc->base.base.id, NULL, &scaler_state->scaler_id); @@ -479,7 +481,7 @@ static int setup_plane_scaler(struct intel_atomic_state *state, if (IS_ERR(plane_state)) return PTR_ERR(plane_state); - return intel_atomic_setup_scaler(scaler_state, + return intel_atomic_setup_scaler(crtc_state, hweight32(scaler_state->scaler_users), crtc, "PLANE", plane->base.base.id, plane_state, &plane_state->scaler_id); From patchwork Wed Jan 8 12:35:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13930850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39BF1E77199 for ; Wed, 8 Jan 2025 12:39:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C503D10E8A9; Wed, 8 Jan 2025 12:39:07 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Eipbjd8H"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8BAD610E8A8; Wed, 8 Jan 2025 12:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736339946; x=1767875946; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X38wTEQyIH6GPZB6nzxv+hz5RiV5x+x0f5+oucnc32c=; b=Eipbjd8HUVOcXKRCm/2PMF/ehj0vSEk4Rhp0ZGCfCJCLR+sH2FYQNaJb OsObE60DFvEoJOluNQw9QNLSDRaVyUxQpl18WY09l8DlRILsQPBNoAI5C O7OL4HWloWRBKNPHzLOakyxyT4Rr2WSNO+mENVEruEGjVKKZTlOqi7dTm /klwLX/V0nS20z7PBRAN1W0ZvKacbFei6+79wCUs/uPT87I9s0QikP0Gb Gez2s1agZb9iEq8sJzdyQ0PslRQdXMkvkMciRcGKoQHGv+/yMaOpVxDH3 jHpEu+kGigfvC7xBbDMk1nTgh8NMLW/CjpC/ZEsPgeOECB73pDDxreylL Q==; X-CSE-ConnectionGUID: RR4xNj8cRUmVdEVr/0bOsQ== X-CSE-MsgGUID: IxKIKj1OQNyq3SnSwN7HSQ== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="35855368" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="35855368" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 04:39:06 -0800 X-CSE-ConnectionGUID: nIl2fITWS+uvYzw+yPnyRg== X-CSE-MsgGUID: uPBbMMsOSlGBHON7dV5ilw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="102886097" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa006.fm.intel.com with ESMTP; 08 Jan 2025 04:39:04 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, jani.nikula@intel.com, ville.syrjala@intel.com Subject: [PATCH v4 3/7] drm/i915/scaler: Refactor max_scale computation Date: Wed, 8 Jan 2025 18:05:37 +0530 Message-ID: <20250108123541.2101643-4-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Refactor max scaling factor computation into a reusable function for scalers. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_scaler.c | 63 ++++++++++++----------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c index 4f838220f880..19ab7b38c64e 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -309,6 +309,37 @@ static int intel_allocate_scaler(struct intel_crtc_scaler_state *scaler_state, return -1; } +static void +calculate_max_scale(struct intel_crtc *crtc, + bool is_yuv_semiplanar, + int scaler_id, + int *max_hscale, int *max_vscale) +{ + struct intel_display *display = to_intel_display(crtc); + + /* + * FIXME: When two scalers are needed, but only one of + * them needs to downscale, we should make sure that + * the one that needs downscaling support is assigned + * as the first scaler, so we don't reject downscaling + * unnecessarily. + */ + if (DISPLAY_VER(display) >= 14) { + *max_hscale = 0x30000 - 1; + + if (scaler_id == 0) + *max_vscale = 0x30000 - 1; + else + *max_vscale = 0x10000; + } else if (DISPLAY_VER(display) >= 10 || !is_yuv_semiplanar) { + *max_hscale = 0x30000 - 1; + *max_vscale = 0x30000 - 1; + } else { + *max_hscale = 0x20000 - 1; + *max_vscale = 0x20000 - 1; + } +} + static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, int num_scalers_need, struct intel_crtc *crtc, const char *name, int idx, @@ -378,35 +409,9 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, const struct drm_rect *dst = &plane_state->uapi.dst; int hscale, vscale, max_vscale, max_hscale; - /* - * FIXME: When two scalers are needed, but only one of - * them needs to downscale, we should make sure that - * the one that needs downscaling support is assigned - * as the first scaler, so we don't reject downscaling - * unnecessarily. - */ - - if (DISPLAY_VER(display) >= 14) { - /* - * On versions 14 and up, only the first - * scaler supports a vertical scaling factor - * of more than 1.0, while a horizontal - * scaling factor of 3.0 is supported. - */ - max_hscale = 0x30000 - 1; - if (*scaler_id == 0) - max_vscale = 0x30000 - 1; - else - max_vscale = 0x10000; - - } else if (DISPLAY_VER(display) >= 10 || - !intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier)) { - max_hscale = 0x30000 - 1; - max_vscale = 0x30000 - 1; - } else { - max_hscale = 0x20000 - 1; - max_vscale = 0x20000 - 1; - } + calculate_max_scale(crtc, + intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier), + *scaler_id, &max_hscale, &max_vscale); /* * FIXME: We should change the if-else block above to From patchwork Wed Jan 8 12:35:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13930851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AA86E77188 for ; Wed, 8 Jan 2025 12:39:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32C5A10E8AB; Wed, 8 Jan 2025 12:39:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="OlbAybOO"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8433210EB71; Wed, 8 Jan 2025 12:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736339948; x=1767875948; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VmTSz5jwbOmyVnPiDjTNCLWrVqercSccYQhlAccuFhQ=; b=OlbAybOOH56nNifE0Jdk9CQ9zmd58QGsJFwcUq4RUIGBjCPTuyM8d670 cPW/VDBRxedtyt8VfVWfEzs0hI81We3bFZvJxW+lfxc2mSOpeRXKcvlqJ WL2wBaoy5Da8pZfWLgkU5U0HBfeDkG9gbcmD569mUOpt9P4/W0WtkaCjP 5wbmH/u6o/cwajXaIIEsx6Oqrpa5Dr++tB0sRc2WlxQBermqVUFD/O2/u AjuvfuguaA45qHT1Em10RoiLTHSYsM2nEk4xBMrLZMwlqnBxNH9HZ4s7V CB3WGIrBY90ObiwoWnUTa9J5j0tdgtAWFunOBHVTqDt90ENei8IUQBYhM Q==; X-CSE-ConnectionGUID: h7hHXBuXQTyI1cFn+sVXrg== X-CSE-MsgGUID: eS4MBk2+QqiRPmQodce4Tw== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="35855371" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="35855371" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 04:39:08 -0800 X-CSE-ConnectionGUID: jZpfSN2cScyOgCEBZ5aojw== X-CSE-MsgGUID: 2zNT3NUHSIKty/vzqxkaWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="102886102" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa006.fm.intel.com with ESMTP; 08 Jan 2025 04:39:06 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, jani.nikula@intel.com, ville.syrjala@intel.com Subject: [PATCH v4 4/7] drm/i915/scaler: Compute scaling factors for pipe scaler Date: Wed, 8 Jan 2025 18:05:38 +0530 Message-ID: <20250108123541.2101643-5-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Compute scaling factors and scaler user for pipe scaler if particular scaler user is pipe scaler. --v2: - Update typo 'plane scaling' to 'pipe scaling'. [Ankit] - Remove FIXME tag which was added to check for pipe scaling factors as well. [Ankit] - Should be common hscale, vscale instead of local one to avoid garbage overwritten. - Typo in commit message 'perticular' to 'particular'. --v3: - Separate out max_scaling information. [Ankit] - Use max_hscale and max_vscale info instead of INT_MAX. [Ankit] Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_scaler.c | 36 ++++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c index 19ab7b38c64e..e0aeacaa6b56 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -351,6 +351,7 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, &crtc_state->scaler_state; struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); u32 mode; + int hscale, vscale, max_vscale, max_hscale; if (*scaler_id < 0) *scaler_id = intel_allocate_scaler(scaler_state, crtc); @@ -399,15 +400,10 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, mode = SKL_PS_SCALER_MODE_DYN; } - /* - * FIXME: we should also check the scaler factors for pfit, so - * this shouldn't be tied directly to planes. - */ if (plane_state && plane_state->hw.fb) { const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_rect *src = &plane_state->uapi.src; const struct drm_rect *dst = &plane_state->uapi.dst; - int hscale, vscale, max_vscale, max_hscale; calculate_max_scale(crtc, intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier), @@ -431,11 +427,37 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, return -EINVAL; } + } + + if (crtc_state->pch_pfit.enabled) { + struct drm_rect src; + + drm_rect_init(&src, 0, 0, + drm_rect_width(&crtc_state->pipe_src) << 16, + drm_rect_height(&crtc_state->pipe_src) << 16); + + calculate_max_scale(crtc, 0, *scaler_id, + &max_hscale, &max_vscale); + + hscale = drm_rect_calc_hscale(&src, &crtc_state->pch_pfit.dst, + 0, max_hscale); + vscale = drm_rect_calc_vscale(&src, &crtc_state->pch_pfit.dst, + 0, max_vscale); - scaler_state->scalers[*scaler_id].hscale = hscale; - scaler_state->scalers[*scaler_id].vscale = vscale; + if (hscale < 0 || vscale < 0) { + drm_dbg_kms(display->drm, + "Scaler %d doesn't support required pipe scaling\n", + *scaler_id); + drm_rect_debug_print("src: ", &src, true); + drm_rect_debug_print("dst: ", &crtc_state->pch_pfit.dst, false); + + return -EINVAL; + } } + scaler_state->scalers[*scaler_id].hscale = hscale; + scaler_state->scalers[*scaler_id].vscale = vscale; + drm_dbg_kms(display->drm, "Attached scaler id %u.%u to %s:%d\n", crtc->pipe, *scaler_id, name, idx); scaler_state->scalers[*scaler_id].mode = mode; From patchwork Wed Jan 8 12:35:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13930854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F417DE7719D for ; Wed, 8 Jan 2025 12:39:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72B2B10EB71; Wed, 8 Jan 2025 12:39:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="i4C65xZG"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3D7910E0AB; Wed, 8 Jan 2025 12:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736339960; x=1767875960; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z3TQOVbVGPW1JnEKRKnJD2SoxhCb6v5QN+qKoPWTDyQ=; b=i4C65xZGpnBUEKLtXdF3EwLmAx7+aCJYGHITjW1ymj6jgjkfkMl9EG0d ANbx/EhV6PLpZOZvIu8LqrFGbbb+tpp+2Jjj48i5xeWfJgS03NbHqAGQ7 BOXh/4dZNTzoS10L1iMzrK/dxA10OeX5gNmwk6mXoU5mtW7E3CyfB6qGC IrInTXql23HdX9QYNknQJmTJ0CWPIk5qSOCc1KBGEjxkGrcSU6dqH5f74 Mm/p6BNXGoWW2lvJfV95ioUZ7NE57mCUw5WljRT5zmDfD97b+d84qajX6 DChkXVmiA5ts+Y6CxhwpmDIHpgKc2Nq4u2IwnTOpsuCVAUTSA9hKRX7Il w==; X-CSE-ConnectionGUID: dTORpsWHTDqN6ZQzAu5sMA== X-CSE-MsgGUID: 6JdYpXy4Q3iJzZx1WIXNQA== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="35855380" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="35855380" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 04:39:10 -0800 X-CSE-ConnectionGUID: v8y2BK7SRvaEG1j5EAKGJg== X-CSE-MsgGUID: 9VWGxVwURYO4eEB+SuNujQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="102886120" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa006.fm.intel.com with ESMTP; 08 Jan 2025 04:39:08 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, jani.nikula@intel.com, ville.syrjala@intel.com Subject: [PATCH v4 5/7] drm/i915/scaler: Limit pipe scaler downscaling factors for YUV420 Date: Wed, 8 Jan 2025 18:05:39 +0530 Message-ID: <20250108123541.2101643-6-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Limit downscaling to less than 1.5 (source/destination) in the horizontal direction and 1.0 in the vertical direction, When configured for Pipe YUV 420 encoding for port output. Bspec: 50441 Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_scaler.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c index e0aeacaa6b56..7b378fa01192 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -439,6 +439,16 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, calculate_max_scale(crtc, 0, *scaler_id, &max_hscale, &max_vscale); + /* + * When configured for Pipe YUV 420 encoding for port output, + * limit downscaling to less than 1.5 (source/destination) in + * the horizontal direction and 1.0 in the vertical direction. + */ + if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) { + max_hscale = 0x18000 - 1; + max_vscale = 0x10000; + } + hscale = drm_rect_calc_hscale(&src, &crtc_state->pch_pfit.dst, 0, max_hscale); vscale = drm_rect_calc_vscale(&src, &crtc_state->pch_pfit.dst, From patchwork Wed Jan 8 12:35:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13930853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 973F7E7719C for ; Wed, 8 Jan 2025 12:39:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3101510EB6D; Wed, 8 Jan 2025 12:39:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YArAbKhX"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F7FF10E89C; Wed, 8 Jan 2025 12:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736339960; x=1767875960; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wM7Za0a4OoyMu19nYapa2G0801DyohJL2nGjYwmkqWQ=; b=YArAbKhXwnm1nGeQkRn9sli1f2hWonL/Z7l9pNUa0g5ILzqp+slgl+Co k0ZqoY7DOPHGQMMPrpsEbm+CwOB3MlHmK4XSeMGiwUjS4fg7PqvW78g5a i38BN+x+6yoNP+uUM8P8Wiw0P9i7b9PPd15TbyzJfwZmbTHeXEwJi9kKX /bm/KHTpuydRphEfav/JuHY5TWk2NZX3Gcvh+SwUSbUTE3euy1dS/81NY dlXKwZVUPG88sgV8NI5R2ROL4KkGyAnY9tBZ4etNT9L8sEx8P0qwUhtjl 2oeOcjD+t+cDG17nKMeeGnCB8pdTjbs13EvYiXnKMudbgImemUSPsPaqS Q==; X-CSE-ConnectionGUID: +hfI78uVQR64UAsKTskJyw== X-CSE-MsgGUID: Z6LqwylWTya8mRjMCEd0lQ== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="35855383" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="35855383" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 04:39:12 -0800 X-CSE-ConnectionGUID: rH5aMEQTRAmD0H93vP7XRA== X-CSE-MsgGUID: Ow0O8gveTsCiTUs9Oyk5FQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="102886140" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa006.fm.intel.com with ESMTP; 08 Jan 2025 04:39:10 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, jani.nikula@intel.com, ville.syrjala@intel.com Subject: [PATCH v4 6/7] drm/i915/scaler: Check if vblank is sufficient for scaler Date: Wed, 8 Jan 2025 18:05:40 +0530 Message-ID: <20250108123541.2101643-7-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Check if vblank is too short for scaler prefill latency. --v2: - Use hweight* family of functions for counting bits. [Jani] - Update precision handling for hscale and vscale. [Ankit] - Consider chroma downscaling factor during latency calculation. [Ankit] - Replace function name from scaler_prefill_time to scaler_prefill_latency. --v3: - hscale_k and vscale_k values are already left shifted by 16, after multiplying by 1000, those need to be right shifted to 16. [Ankit] - Replace YCBCR444 to YCBCR420. [Ankit] - Divide by 1000 * 1000 in end to get correct precision. [Ankit] - Initialise latency to 0 to avoid any garbage. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_watermark.c | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index f4458d1185b3..fe91854e456c 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2292,6 +2292,36 @@ static int icl_build_plane_wm(struct intel_crtc_state *crtc_state, return 0; } +static int +scaler_prefill_latency(const struct intel_crtc_state *crtc_state) +{ + const struct intel_crtc_scaler_state *scaler_state = + &crtc_state->scaler_state; + int count = hweight32(scaler_state->scaler_users); + int latency = 0; + long long hscale_k = + mul_u32_u32(scaler_state->scalers[0].hscale, 1000) >> 16; + long long vscale_k = + mul_u32_u32(scaler_state->scalers[0].vscale, 1000) >> 16; + + if (!count) + return latency; + + if (count > 1) { + int chroma_downscaling_factor = + crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ? 2 : 1; + + latency = (4 * crtc_state->linetime) + + (chroma_downscaling_factor * + DIV_ROUND_UP_ULL((4 * crtc_state->linetime * hscale_k * vscale_k), + 1000000)); + } else { + latency = 4 * crtc_state->linetime; + } + + return latency; +} + static bool skl_is_vblank_too_short(const struct intel_crtc_state *crtc_state, int wm0_lines, int latency) @@ -2302,6 +2332,7 @@ skl_is_vblank_too_short(const struct intel_crtc_state *crtc_state, /* FIXME missing scaler and DSC pre-fill time */ return crtc_state->framestart_delay + intel_usecs_to_scanlines(adjusted_mode, latency) + + scaler_prefill_latency(crtc_state) + wm0_lines > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vblank_start; } From patchwork Wed Jan 8 12:35:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Golani, Mitulkumar Ajitkumar" X-Patchwork-Id: 13930852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05B4AE77188 for ; Wed, 8 Jan 2025 12:39:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A60410E894; Wed, 8 Jan 2025 12:39:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YlbpGIoa"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3BE710E894; Wed, 8 Jan 2025 12:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736339961; x=1767875961; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=he07DjH+vg2eiymKM8MN9UBeJpZcDVoZlPjSrAQywo4=; b=YlbpGIoaCbsr8f6z3i/6gjrSZz4xGe5fWNWQV+SBio6onLGcTyTe5jtp t+mlSviIWXRRO/XUDHv8j7NapgsB/4aXNsIg14osiVWgaoeRayzVvSYxw fAhyYj8telsx7v2qO0aZ54DB0PDx7yHxVvWQecaUMCERFwJQ0UJ7pTiAl BPt53biY03ennP4gFtkVz9UBSim4i/TdXvVd1msbptAxaPf2VpRXqbA1N RTGlKp1/H+YMkRjkYu1SWfPWe+GPsnrTzn7WwPfivYOuYWLOxrsBt0urO W82Fmc3+A6LuuoJ32nJ1nqXk+QGjoJRLnxaAlFQnlgyD84xRnaBJYDvIv A==; X-CSE-ConnectionGUID: UlgjbwUNSee3jIo01tdJNg== X-CSE-MsgGUID: Mg0aBfuSQ1acQm8m88NWmg== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="35855387" X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="35855387" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 04:39:14 -0800 X-CSE-ConnectionGUID: MpqAny94RAaoQHQjAUMwdA== X-CSE-MsgGUID: epLouHk/QmOyt5nCIsooOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,298,1728975600"; d="scan'208";a="102886146" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa006.fm.intel.com with ESMTP; 08 Jan 2025 04:39:12 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, jani.nikula@intel.com, ville.syrjala@intel.com Subject: [PATCH v4 7/7] drm/i915/dsc: Check if vblank is sufficient for dsc prefill Date: Wed, 8 Jan 2025 18:05:41 +0530 Message-ID: <20250108123541.2101643-8-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250108123541.2101643-1-mitulkumar.ajitkumar.golani@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Check if vblank is sufficient for dsc prefill latency. --v2: - Consider chroma downscaling factor in latency calculation. [Ankit] - Replace with appropriate function name. --v3: - Remove FIXME tag.[Ankit] - Replace Ycbcr444 to Ycbcr420.[Anit] - Correct precision. [Ankit] - Use some local valiables like linetime_factor and latency to adjust precision. - Declare latency to 0 initially to avoid returning any garbage values. - Account for second scaler downscaling factor as well. [Ankit] Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_watermark.c | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index fe91854e456c..d275ec687748 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2292,6 +2292,42 @@ static int icl_build_plane_wm(struct intel_crtc_state *crtc_state, return 0; } +static int +dsc_prefill_latency(const struct intel_crtc_state *crtc_state) +{ + const struct intel_crtc_scaler_state *scaler_state = + &crtc_state->scaler_state; + int latency = 0; + int count = hweight32(scaler_state->scaler_users); + long long hscale_k[2] = {1, 1}; + long long vscale_k[2] = {1, 1}; + + if (!crtc_state->dsc.compression_enable) + return latency; + + for (int i = 0; i < count; i++) { + hscale_k[i] = mul_u32_u32(scaler_state->scalers[i].hscale, 1000) >> 16; + vscale_k[i] = mul_u32_u32(scaler_state->scalers[i].vscale, 1000) >> 16; + } + + if (count) { + int chroma_downscaling_factor = + crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 ? 2 : 1; + long long total_scaling_factor; + int linetime_factor = DIV_ROUND_UP(15 * crtc_state->linetime, 10); + + total_scaling_factor = DIV_ROUND_UP_ULL(hscale_k[0] * vscale_k[0], 1000000); + + if (count > 1) + total_scaling_factor *= DIV_ROUND_UP_ULL(hscale_k[1] * vscale_k[1], + 1000000); + + latency = total_scaling_factor * linetime_factor * chroma_downscaling_factor; + } + + return latency; +} + static int scaler_prefill_latency(const struct intel_crtc_state *crtc_state) { @@ -2333,6 +2369,7 @@ skl_is_vblank_too_short(const struct intel_crtc_state *crtc_state, return crtc_state->framestart_delay + intel_usecs_to_scanlines(adjusted_mode, latency) + scaler_prefill_latency(crtc_state) + + dsc_prefill_latency(crtc_state) + wm0_lines > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vblank_start; }