From patchwork Mon Jan 6 16:51:07 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: 13927699 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 A8419E77198 for ; Mon, 6 Jan 2025 16:54:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B71510E2CD; Mon, 6 Jan 2025 16:54:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mP7qgQoN"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5E89710E22E; Mon, 6 Jan 2025 16:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736182473; x=1767718473; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FMJuUPSkU48mOmGQAyF8C+FNtuvFvRXMQx3agOjty6g=; b=mP7qgQoNtMx5xwGg2PrzFvM47a7GVuU+wIrTkVfFFVhLbeK6KWxuE5Fj osrJ46qF7HoPXeF+f9cWhyEdWUnuMGf2NfV8OaaOTiSxSG9HhZPs1k+c0 15NNbQ7HDii6fcp6sRSxLhsE0tM1W6GB9DF10AkoadUAwE5kEqDv5dX8V uSXc9nlJQuHYmGcYrxEbDW01yqy0WwAuN689xm42s1n4dABOr7IBOX6ec P0NELIDcIqLv4Jp5Sx4j00ccykw/pOhgFlNRq3Ft5vqoBjQVWypul7X2g owyLoKl7k4ZQpYrFsYr2Rw4gAxlEf0KFEdx2JWvKqVWDKj1YJFGOP34da w==; X-CSE-ConnectionGUID: eQcAA13NRyKSJsxsn9Lzuw== X-CSE-MsgGUID: T9CeUT09TFCMsNrpOBWYpQ== X-IronPort-AV: E=McAfee;i="6700,10204,11307"; a="53880874" X-IronPort-AV: E=Sophos;i="6.12,293,1728975600"; d="scan'208";a="53880874" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2025 08:54:33 -0800 X-CSE-ConnectionGUID: BwP0x0iKRdm+xsNEjfamMQ== X-CSE-MsgGUID: HhhngYTOT7qfXcqZGJ3Lug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="133408732" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa001.fm.intel.com with ESMTP; 06 Jan 2025 08:54:31 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org Cc: intel-xe@lists.freedesktop.org, ankit.k.nautiyal@intel.com, jani.nikula@intel.com Subject: [PATCH v3 1/5] drm/i915/scaler: Add and compute scaling factors Date: Mon, 6 Jan 2025 22:21:07 +0530 Message-ID: <20250106165111.1672722-2-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250106165111.1672722-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250106165111.1672722-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 perticular scaler user, use it later to compute scaler prefill latency. Also to extend this when either pipe or plane scaler is in use. 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 f230163226d1..67c49a1d0232 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 Mon Jan 6 16:51:08 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: 13927700 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 C51BFE77188 for ; Mon, 6 Jan 2025 16:54:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 671F910E2DF; Mon, 6 Jan 2025 16:54:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="aZx2rmq/"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF3A010E2CD; Mon, 6 Jan 2025 16:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736182475; x=1767718475; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3Pl/VwRc59Nvpxo/+btO1Pe+J4Nrwko2WBltLBYN11s=; b=aZx2rmq/nvzXYTrxyn9K8ao/1VQolIiuRMunt7RMJ//JHYhgwWt9O060 nFPWvUGruTBGp2hXV13DPBawJPpwJ8O77Snoqq74ZMC6TNJg6Qi1GoNCU +CH+qoZMJ9JkRh0B1DEkMC/k5X7kpZRhaMkncbGvUAOFiDS5w3tRPYizc 4b/ZyCL2dNlGbLqLnaruAXAJoNZo5b/NzKPCmgGfjHNqOOiKttD8sicRi Rr0QTGosnF1FydDDNcgP5SH6c9qLuRt1GHNpSnohSvENXg5I/OEtE1WG5 0hCJwBjnBQAU9yPwLttqzWW4J0vgIMEPBXO3lVMEhkJlvyeDqvJOLADTl w==; X-CSE-ConnectionGUID: JK3IXubrTsGIN4qA1li1ug== X-CSE-MsgGUID: rFKdhCSZQ+CNgD5zLkrK0w== X-IronPort-AV: E=McAfee;i="6700,10204,11307"; a="53880882" X-IronPort-AV: E=Sophos;i="6.12,293,1728975600"; d="scan'208";a="53880882" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2025 08:54:34 -0800 X-CSE-ConnectionGUID: NuoupviHTZq6e1hcwH6wSA== X-CSE-MsgGUID: D7Rj2wXSR5Ga3Fy8RIsTsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="133408740" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa001.fm.intel.com with ESMTP; 06 Jan 2025 08:54:33 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org Cc: intel-xe@lists.freedesktop.org, ankit.k.nautiyal@intel.com, jani.nikula@intel.com Subject: [PATCH v3 2/5] drm/i915/scaler: Use crtc_state to setup plane or pipe scaler Date: Mon, 6 Jan 2025 22:21:08 +0530 Message-ID: <20250106165111.1672722-3-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250106165111.1672722-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250106165111.1672722-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 Mon Jan 6 16:51:09 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: 13927701 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 C7F0FE7719A for ; Mon, 6 Jan 2025 16:54:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5CE2B10E2E3; Mon, 6 Jan 2025 16:54:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="VdV8h76Y"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id D13F710E2E3; Mon, 6 Jan 2025 16:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736182477; x=1767718477; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3yKB6t3AYsBPDdBDdGEi3vXcUe1j/qY3WNUmDRlSXUU=; b=VdV8h76YR3lmDH627DLL/8p7Oiy8MZb39iUmh5bo2X/p0h4ROrn4xBFq 2/hVFkoDtlr20eBjBVhKgIrkV9rjbobOoSj2mwzMQbdVVzVoc9AU+DB3t oAivbTf+lCkVIC9/4V3DG7qlVhIeRUJw+mrsgUTkRq1GeQcuFf/+jBTIE 9DZ/PIyLDhvr7OGUeqmKtPRJ+/ADwyCiW8amRpkdMH8ZoPbn5UgdvJkv6 wnqZKXhq4sVD/k42HjYtd+0v/Wx7NPVr3/RhftKp7O+q3AugJoF5+RY91 Cvi6CtLuL817ZDf5Vj3fAC7nQ8IKUlMwOoNGAAMGylPSU4lkjMKvE2pE1 Q==; X-CSE-ConnectionGUID: /8fbYULGRI6fm0TPtnCNTQ== X-CSE-MsgGUID: U+PTppVvQdm0jKDMrVjofw== X-IronPort-AV: E=McAfee;i="6700,10204,11307"; a="53880887" X-IronPort-AV: E=Sophos;i="6.12,293,1728975600"; d="scan'208";a="53880887" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2025 08:54:36 -0800 X-CSE-ConnectionGUID: 2r6OuoeRR6qcXuvzDnhIxQ== X-CSE-MsgGUID: U+VWLygER1WeNjxE0z3CVQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="133408754" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa001.fm.intel.com with ESMTP; 06 Jan 2025 08:54:35 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org Cc: intel-xe@lists.freedesktop.org, ankit.k.nautiyal@intel.com, jani.nikula@intel.com Subject: [PATCH v3 3/5] drm/i915/scaler: Compute scaling factors for pipe scaler Date: Mon, 6 Jan 2025 22:21:09 +0530 Message-ID: <20250106165111.1672722-4-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250106165111.1672722-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250106165111.1672722-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'. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_scaler.c | 34 ++++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c index 4f838220f880..294493e5ee53 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -320,6 +320,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; if (*scaler_id < 0) *scaler_id = intel_allocate_scaler(scaler_state, crtc); @@ -368,15 +369,11 @@ 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; + int max_vscale, max_hscale; /* * FIXME: When two scalers are needed, but only one of @@ -426,11 +423,34 @@ 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); + + hscale = drm_rect_calc_hscale(&src, &crtc_state->pch_pfit.dst, + 0, INT_MAX); + vscale = drm_rect_calc_vscale(&src, &crtc_state->pch_pfit.dst, + 0, INT_MAX); - 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 Mon Jan 6 16:51:10 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: 13927702 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 0B0F8E77188 for ; Mon, 6 Jan 2025 16:54:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0B9110E991; Mon, 6 Jan 2025 16:54:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Me+9c+ee"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A3DE10E991; Mon, 6 Jan 2025 16:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736182478; x=1767718478; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ff6aCHtHwo6c4PfAtU+RJABooeKgo6iozunL+v6vhB8=; b=Me+9c+eegzwXHtoY8pXZoe4rKwSsMU9DYKZZ8+d3MdJAP8pkVEir6ClM sJKj2cMXeyHOIGNkMa80efVHBwWWDtRMJkeSPoIW0mp/Wc30sqMtGGBZg 42+3GJjKVcHyz35uqL8DTH165aA73RfItUpWA8BfnRa05ESpqq6uu+0jZ 5PKpNuTw2345ifPSsfryzG7JGq63K5WF1OJF8XoAyR4xZ8CDv7ikQLn9P PEBtPX2AU4Kti8yYTK+zo8q7BeVWuoPt/DSo3wNXHPEVB4NRYynHuZDPa lVN50nJnk/6RGf/TgVr4p2UZYlzR6BA5lxzAvYe7nbh//68dXj6msNnyb A==; X-CSE-ConnectionGUID: 8YdOT4SDTouWx/Nb8zsl9A== X-CSE-MsgGUID: iGfxnBWqTdexYRUfQdBPsA== X-IronPort-AV: E=McAfee;i="6700,10204,11307"; a="53880892" X-IronPort-AV: E=Sophos;i="6.12,293,1728975600"; d="scan'208";a="53880892" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2025 08:54:38 -0800 X-CSE-ConnectionGUID: WawhU5dPT2CcIUbkbo6IBg== X-CSE-MsgGUID: AWtHoszGTDmwlCMbt0oLag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="133408779" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa001.fm.intel.com with ESMTP; 06 Jan 2025 08:54:36 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org Cc: intel-xe@lists.freedesktop.org, ankit.k.nautiyal@intel.com, jani.nikula@intel.com Subject: [PATCH v3 4/5] drm/i915/scaler: Check if vblank is sufficient for scaler Date: Mon, 6 Jan 2025 22:21:10 +0530 Message-ID: <20250106165111.1672722-5-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250106165111.1672722-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250106165111.1672722-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. 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 29e8ea91c858..95f60819fe0a 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; + long long hscale_k = + mul_u32_u32(scaler_state->scalers[0].hscale, 1000); + long long vscale_k = + mul_u32_u32(scaler_state->scalers[0].vscale, 1000); + + if (!count) + return 0; + + if (count > 1) { + int chroma_downscaling_factor = + crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444 ? 2 : 1; + + latency = (4 * crtc_state->linetime) + + (chroma_downscaling_factor * + DIV_ROUND_UP_ULL((4 * crtc_state->linetime * hscale_k * vscale_k), + USHRT_MAX)); + } 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 Mon Jan 6 16:51:11 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: 13927703 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 D1AE9E77199 for ; Mon, 6 Jan 2025 16:54:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A1BD10E999; Mon, 6 Jan 2025 16:54:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="fX2+EZOK"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0491310E999; Mon, 6 Jan 2025 16:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736182481; x=1767718481; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J7SGXMEhe+WW8O2rguEhLMgTvSSbXtB7UGHkoXhHIl4=; b=fX2+EZOKrhpZNqhDZKOcLjANvumfQyWJj0jbp5T2qcEGkzIHq4wMTJnT NrH26i2Cv26BKELtwO9dnktfKZ3NefkEi4sD3MW8jE5MqppSb7lOU/Pw6 bjU3oCoEB5fp8b1mZBSdqg22Dd/BRuGxuJ0mmtQtWC1DS7K0bxEnnK5EX WXllVwMns40S6JmN3VTC8pOn8IvFrB6FPGyjzBacxLzgXJenuebD0EYx1 mw0CHRybOZadDq694WRXIPSeo6IsgqEEqMD0Ij67YyznjMOXeXTnhvYXs Ca1iLwA4iZ+nk3BpHs510Xo53tomtLpmbseY15ON9uUbG3ISJwh/3YLk7 Q==; X-CSE-ConnectionGUID: xMvdGyIuQ9ub6Tkf83OByA== X-CSE-MsgGUID: BCJvdUEDSEeHlDfDrIJedA== X-IronPort-AV: E=McAfee;i="6700,10204,11307"; a="53880895" X-IronPort-AV: E=Sophos;i="6.12,293,1728975600"; d="scan'208";a="53880895" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2025 08:54:40 -0800 X-CSE-ConnectionGUID: FIL74sfCSo+pjRLwVBXMiQ== X-CSE-MsgGUID: tBp7EeNcQimbWaIBt+LkZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="133408798" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa001.fm.intel.com with ESMTP; 06 Jan 2025 08:54:38 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org Cc: intel-xe@lists.freedesktop.org, ankit.k.nautiyal@intel.com, jani.nikula@intel.com Subject: [PATCH v3 5/5] drm/i915/dsc: Check if dsc prefill sufficient for vblank Date: Mon, 6 Jan 2025 22:21:11 +0530 Message-ID: <20250106165111.1672722-6-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250106165111.1672722-1-mitulkumar.ajitkumar.golani@intel.com> References: <20250106165111.1672722-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 dsc prefill latency is sufficient for vblank. --v2: - Consider chroma downscaling factor in latency calculation. [Ankit] - Replace function name from dsc_prefill_time to dsc_prefill_latency. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_watermark.c | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index 95f60819fe0a..900e1c54450d 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2292,6 +2292,30 @@ 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 hscale = scaler_state->scalers[0].hscale; + int vscale = scaler_state->scalers[0].vscale; + + if (!crtc_state->dsc.compression_enable) + return 0; + /* + * FIXME: CDCLK Prefill adjustment to add + */ + if (scaler_state->scaler_users) { + int chroma_downscaling_factor = + crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR444 ? 2 : 1; + + return DIV_ROUND_UP(15 * crtc_state->linetime * hscale * vscale * + chroma_downscaling_factor, 10); + } + + return 0; +} + static int scaler_prefill_latency(const struct intel_crtc_state *crtc_state) { @@ -2333,6 +2357,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; }