From patchwork Tue Dec 17 18:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mitul Golani X-Patchwork-Id: 13912369 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 56A72E77187 for ; Tue, 17 Dec 2024 18:04:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 00EE610EA4E; Tue, 17 Dec 2024 18:04:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="DgStpE+l"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id B400710EA4A; Tue, 17 Dec 2024 18:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734458689; x=1765994689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mz5F3fyHihxypOFEWu3f6Wgbd1MsxntRXAVGtlDz9K8=; b=DgStpE+l8D0UWF3s1mewYFIIwflG5vdyAmqR/dr9/UWIps1sSPi0Yzzg C7hL1CAV+Qva5yVLEmkUjrkgssZA01wXeUYMY0cRoFaSlxPrG3Z8xIyqI OyYeQyoLm8oqnHY7mi9wIhKnWs1Kgc98C+d0yHyK9szF1jKWl8JvTDsLv 6u3Sf50Ir4VqLwxZZbYCe/FU0ckaU+6b9aAIE8+t84qF+w/mmrf2ScTEM R2cjvqond3KPrm1wRNulDfEwvu38Ug0W9qw0hTUGd8jgs3RnzFw+MfvHC cadBJO2aQnf+Xmce0/0JlXHO02APIz4JrSP+PjITr5amw7bFe3tRiB90W w==; X-CSE-ConnectionGUID: WAgP6VHoS3mzJRAPv3GCHg== X-CSE-MsgGUID: RzShWxy4Rw2Kymnz8/bW4A== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="38837139" X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="38837139" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2024 10:04:49 -0800 X-CSE-ConnectionGUID: MGtuB2LUTCCR05d8D3dukw== X-CSE-MsgGUID: /gUJNDdHRaqYGTXt2X2j7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,242,1728975600"; d="scan'208";a="102442784" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa004.fm.intel.com with ESMTP; 17 Dec 2024 10:04:48 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com Subject: [RFC v2 1/6] drm/i915/scaler: Add and compute scaling factors Date: Tue, 17 Dec 2024 23:37:05 +0530 Message-ID: <20241217180710.1048355-2-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241217180710.1048355-1-mitulkumar.ajitkumar.golani@intel.com> References: <20241217180710.1048355-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 b71416ff5b7f..28b2861df42b 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -710,6 +710,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 11f73659c1b6..e00c6830ef65 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -423,6 +423,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 Tue Dec 17 18:07:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mitul Golani X-Patchwork-Id: 13912368 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 E496BE7717F for ; Tue, 17 Dec 2024 18:04:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8AED010EA4D; Tue, 17 Dec 2024 18:04:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="D7p7XQss"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BAB910EA4D; Tue, 17 Dec 2024 18:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734458691; x=1765994691; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W99d06rG3wDx+1fJUZxfy6ke6YTd1vYKG9wa0IyTl3M=; b=D7p7XQssTLngQXmOsO8g8QqPiQCoU3Ht0p5nqZ4N7bUkbn2EpgenNtNi 00ADCUvliYxAb3DjsAWkldBjS/8FAe/iA08okvoaaCTZmExNyZKEu5Too FquWBq1sxWBrv3sWOOqnX1FCiW6NeLw/GR2pPJj9W3lC4yiA/PANwjOsw DDvz6SbhH4RwDiVT5/DcIH9YXuL5b6aGH2x3l4BkuOv1dsjl0LG5jwSFF KLWiFVZdLcTY6Iq99ULrYmGUPgqaWRxb01dER+6EL3eRS3mPy0OVlUwiW LUvfPSl/h+vAsmCTlIylpcq9wRuVVrPfTTUnh/efs5ZA+11m3eI5tVcXU g==; X-CSE-ConnectionGUID: +Mfm1TH5RSaoe0ML8gnfKg== X-CSE-MsgGUID: cg425CWUT4qlpdDJ7wdHxg== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="38837141" X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="38837141" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2024 10:04:51 -0800 X-CSE-ConnectionGUID: 4bPPcUNiRI+Cl61+yEIqwA== X-CSE-MsgGUID: 2sT2a6/qQP2PUxedlvUxlQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,242,1728975600"; d="scan'208";a="102442803" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa004.fm.intel.com with ESMTP; 17 Dec 2024 10:04:50 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com Subject: [RFC v2 2/6] drm/i915/scaler: Add member to track scaler user Date: Tue, 17 Dec 2024 23:37:06 +0530 Message-ID: <20241217180710.1048355-3-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241217180710.1048355-1-mitulkumar.ajitkumar.golani@intel.com> References: <20241217180710.1048355-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 enum to track scaler user, this differenciates between the current user of scaler, either plane scaler/pipe scaler or in case no scaler is used. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/intel_display_types.h | 7 +++++++ drivers/gpu/drm/i915/display/skl_scaler.c | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 28b2861df42b..f39215c70ca7 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -707,11 +707,18 @@ struct intel_initial_plane_config { u8 rotation; }; +enum scaler_users { + SKL_NO_SCALER, + SKL_PIPE_SCALER, + SKL_PLANE_SCALER, +}; + struct intel_scaler { u32 mode; bool in_use; int hscale; int vscale; + int user; }; 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 e00c6830ef65..e113c6ba4de7 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -426,6 +426,7 @@ static int intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_stat scaler_state->scalers[*scaler_id].hscale = hscale; scaler_state->scalers[*scaler_id].vscale = vscale; + scaler_state->scalers[*scaler_id].user = SKL_PLANE_SCALER; } drm_dbg_kms(display->drm, "Attached scaler id %u.%u to %s:%d\n", From patchwork Tue Dec 17 18:07:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mitul Golani X-Patchwork-Id: 13912370 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 6F218E77188 for ; Tue, 17 Dec 2024 18:04:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B4F9F10EA51; Tue, 17 Dec 2024 18:04:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="jxtXVqFj"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D3B710EA4E; Tue, 17 Dec 2024 18:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734458692; x=1765994692; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rTUOzksdCwicb5EB9TRA+ogGqvNVlzBNWDw7+AUHDZE=; b=jxtXVqFjdqHZKXWagXF2Bm4N5syJ0PLXFKp+P/tqTekQ563SamknaNd6 PXEys6bqlPenuqC1GrM2lWEajfRGSmwQpZJ/xeCG7PBwj/dU9bus4X6GR uAlxWJleiH/M+UUs63LzdXc6aVee9IBxoV8mTjrVPxdCXlbp2aCfXQSXh jJI0X1Zkxwy+dKVjWZpb+FCrEKrLUuSOsyAdzVAP11rfnH8Yo+xeItA7Q klLrcoLJyfJag/iDOck37GY4jKQDfKfOdLgQoyAVUAS6lx0Jh2wPdHwV2 cfczMtmZ86CpV9TnTOefNrqyN1/blMhY8J6e5FU4dWl/djmwwPcpD3NCU g==; X-CSE-ConnectionGUID: 9dWmflKORjeXGIPMhCGyPA== X-CSE-MsgGUID: Zg6k8LhJQxS3CnBKMdH/Lg== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="38837144" X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="38837144" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2024 10:04:52 -0800 X-CSE-ConnectionGUID: XWzk+WXcSLKzPbb4kGu+qw== X-CSE-MsgGUID: +S3YdFBjTSO2rQMtJrHbuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,242,1728975600"; d="scan'208";a="102442820" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa004.fm.intel.com with ESMTP; 17 Dec 2024 10:04:51 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com Subject: [RFC v2 3/6] drm/i915/scaler: Use crtc_state to setup plane or pipe scaler Date: Tue, 17 Dec 2024 23:37:07 +0530 Message-ID: <20241217180710.1048355-4-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241217180710.1048355-1-mitulkumar.ajitkumar.golani@intel.com> References: <20241217180710.1048355-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" Parse crtc_state to intel_atomic_setup_scaler, this will help to check if pch_pfit enabled or not and also will be useful to parse scaler_state with the same. Signed-off-by: Mitul Golani --- 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 e113c6ba4de7..1c65b53b45f0 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -308,13 +308,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 Tue Dec 17 18:07:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mitul Golani X-Patchwork-Id: 13912373 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 83ECAE77189 for ; Tue, 17 Dec 2024 18:04:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FBEF10EA5E; Tue, 17 Dec 2024 18:04:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kYm68WvA"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2B97E10EA56; Tue, 17 Dec 2024 18:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734458694; x=1765994694; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4R68+5RHZQuv7LnKmDzBIDfbewT4I/ErGDWXY/+zb3Y=; b=kYm68WvAyNtdEmsFQsAW5PxD5BflekP9fpwTGYs7f7BfS8zWfQPIi3Oz ds8360DUpeYd7Uv/5cxKkcx4lS7h64GNR54Hf9vfa7/VrNCDizIfFNJfZ G8aDvTjnfNs5utmcLJKs0SmsDqOMRMsxJPijxBItxbv8UL1QHrfwI2YnY TfpNoxwvk3tOjlCryfy45G1OCF3h2B9cMNAsuiQrTX63Dd6y5WZTNYpOr VNZiRvB/QLDsu3Lojdho7PhgDjzC5PWqdRuoN6Fe+Xlff7XMc1IhewZ6C iaDkOOeM3QNRpY8fMeZW/mcm+5N55OeR/vB9duumo03D/azzQ7dFVZiZ5 Q==; X-CSE-ConnectionGUID: Tbnepj8fTl6yWi+Rg2qymA== X-CSE-MsgGUID: KOUbulqBQF+h8AdmP7rv0w== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="38837149" X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="38837149" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2024 10:04:54 -0800 X-CSE-ConnectionGUID: N+GakNiKSzaOzZ9c7szgCw== X-CSE-MsgGUID: hHuTVD9/SyiYGwVNDtZwkA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,242,1728975600"; d="scan'208";a="102442838" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa004.fm.intel.com with ESMTP; 17 Dec 2024 10:04:52 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com Subject: [RFC v2 4/6] drm/i915/scaler: Compute scling factors for pipe scaler Date: Tue, 17 Dec 2024 23:37:08 +0530 Message-ID: <20241217180710.1048355-5-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241217180710.1048355-1-mitulkumar.ajitkumar.golani@intel.com> References: <20241217180710.1048355-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 perticular scaler user is pipe scaler. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_scaler.c | 37 ++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c index 1c65b53b45f0..1a4aba434d8c 100644 --- a/drivers/gpu/drm/i915/display/skl_scaler.c +++ b/drivers/gpu/drm/i915/display/skl_scaler.c @@ -319,6 +319,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, user; if (*scaler_id < 0) *scaler_id = intel_allocate_scaler(scaler_state, crtc); @@ -375,7 +376,7 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, 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 +427,39 @@ static int intel_atomic_setup_scaler(struct intel_crtc_state *crtc_state, return -EINVAL; } - scaler_state->scalers[*scaler_id].hscale = hscale; - scaler_state->scalers[*scaler_id].vscale = vscale; - scaler_state->scalers[*scaler_id].user = SKL_PLANE_SCALER; + user = SKL_PLANE_SCALER; } + if (crtc_state->pch_pfit.enabled) { + struct drm_rect src; + int hscale, vscale; + + 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); + + if (hscale < 0 || vscale < 0) { + drm_dbg_kms(display->drm, + "Scaler %d doesn't support required plane scaling\n", + *scaler_id); + drm_rect_debug_print("src: ", &src, true); + drm_rect_debug_print("dst: ", &crtc_state->pch_pfit.dst, false); + + return -EINVAL; + } + + user = SKL_PIPE_SCALER; + } + + scaler_state->scalers[*scaler_id].hscale = hscale; + scaler_state->scalers[*scaler_id].vscale = vscale; + scaler_state->scalers[*scaler_id].user = user; + 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 Tue Dec 17 18:07:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mitul Golani X-Patchwork-Id: 13912371 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 423CAE77184 for ; Tue, 17 Dec 2024 18:04:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D31A910EA5D; Tue, 17 Dec 2024 18:04:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="hx9784ns"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C70310EA56; Tue, 17 Dec 2024 18:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734458695; x=1765994695; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WUfF+Wp1jpkG4YDv32NHd21ZpcpDpCZoxsFFP5YfHnU=; b=hx9784nsE0EFBKf83WANwnSPM+cSmp/sgK5p/Q69cmaE7bVcMspxxQ+l TtOFcAQCKUlifwRREdj2HIEM+Vev8LOlaz/22Ruu+KRUmLydZQw/36ZVG WCvDXygNvSwBR6YPHx2UEyo2G/3svV+nCysLxTVZdJOycjz1taNkEkEtz uxnxpbEYsBWhZhk82b+3eNyM9WzuBYCdPRFUaGDM89X6pLQjYSJtIuCw9 GRrHcJoKhZV/GJYU0O+TfUZIDgwLCi1+pfZhxTfIuq8u+1GaO1/Y/mUgM hXI+flEXRe7Vxg616egGwXbqPc1ghraxprQhQEQwNIlOPvmIgsrVBIpWk g==; X-CSE-ConnectionGUID: 41mj5ZgcRUevPjvlPnN+mQ== X-CSE-MsgGUID: ISzhABO3R5KQQXA6GDtwwQ== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="38837157" X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="38837157" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2024 10:04:55 -0800 X-CSE-ConnectionGUID: ba/pqFE/SM+8Stvj+nQYvw== X-CSE-MsgGUID: ElqSxc95Q6Gv2kq1Fbwp8w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,242,1728975600"; d="scan'208";a="102442855" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa004.fm.intel.com with ESMTP; 17 Dec 2024 10:04:54 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com Subject: [RFC v2 5/6] drm/i915/scaler: Check if vblank is sufficient for scaler Date: Tue, 17 Dec 2024 23:37:09 +0530 Message-ID: <20241217180710.1048355-6-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241217180710.1048355-1-mitulkumar.ajitkumar.golani@intel.com> References: <20241217180710.1048355-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. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_watermark.c | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index d3506e8ccd9b..a538e2b82c12 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2292,6 +2292,27 @@ static int icl_build_plane_wm(struct intel_crtc_state *crtc_state, return 0; } +static int +scaler_prefill_time(const struct intel_crtc_state *crtc_state) +{ + const struct intel_crtc_scaler_state *scaler_state = + &crtc_state->scaler_state; + int scaler_users = scaler_state->scaler_users; + int count = 0; + int hscale = scaler_state->scalers[0].hscale; + int vscale = scaler_state->scalers[0].vscale; + + while (scaler_users) { + count += scaler_users & 1; + scaler_users >>= 1; + } + + if (count > 1) + return (4 * crtc_state->linetime * hscale * vscale); + else + return (4 * crtc_state->linetime); +} + static bool skl_is_vblank_too_short(const struct intel_crtc_state *crtc_state, int wm0_lines, int latency) @@ -2302,6 +2323,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_time(crtc_state) + wm0_lines > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vblank_start; } From patchwork Tue Dec 17 18:07:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mitul Golani X-Patchwork-Id: 13912372 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 1695FE7717F for ; Tue, 17 Dec 2024 18:04:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1B7D10EA5B; Tue, 17 Dec 2024 18:04:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="b6JuJgVJ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC7B210EA5B; Tue, 17 Dec 2024 18:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734458697; x=1765994697; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Qy0DUOQ+tZsIpjAXYEO2tjz5wnGwa0SKRkOOvQfBn8c=; b=b6JuJgVJpJpbeaUj9GPXOf0EL62PsC+XSNpilq4oUSMkxv1bgH6cxVLV xAl2RlzSV8GPa0ycxHqnIvfP8uKVOkH+DDyLtRS+RFrYNHZjzklDUC4ls uflfLAqhqqlS+PuX94bjI6/qrYbjExcy3oVe/VMR160hvToLETu1SJRKS rvOdw2ljW2/bSAUtJfJ9YPOwu22TpBMcUX9IhsqQsSsiCFf3d9Zs/aJEU Nag1Lkqi+VDR5iWuoZ8ucg2GC2A1glkOLs9y96Gs9Bt74v1ujClypmrJs LqgvhlZjHVy5AEEExTh9B/Gql9kXUXAAVtT+2pwXJjYtQ7965AsI16QRo w==; X-CSE-ConnectionGUID: BOE7GjE5RU66aN6Cq2aPJw== X-CSE-MsgGUID: owErl2kITYuftP7VSwi/sg== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="38837166" X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="38837166" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2024 10:04:56 -0800 X-CSE-ConnectionGUID: i+Qjk+4wQZi9ZB17d/NPXg== X-CSE-MsgGUID: p1QGr7NgRBGBB0in4n5OMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,242,1728975600"; d="scan'208";a="102442871" Received: from mgolanimitul-x299-ud4-pro.iind.intel.com ([10.190.239.114]) by fmviesa004.fm.intel.com with ESMTP; 17 Dec 2024 10:04:55 -0800 From: Mitul Golani To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com Subject: [RFC v2 6/6] drm/i915/dsc: Check if dsc prefill sufficient for vblank Date: Tue, 17 Dec 2024 23:37:10 +0530 Message-ID: <20241217180710.1048355-7-mitulkumar.ajitkumar.golani@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241217180710.1048355-1-mitulkumar.ajitkumar.golani@intel.com> References: <20241217180710.1048355-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. Signed-off-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_watermark.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index a538e2b82c12..0f1ee755fd8a 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2292,6 +2292,25 @@ static int icl_build_plane_wm(struct intel_crtc_state *crtc_state, return 0; } +static int +skl_dsc_prefill_time(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) + return DIV_ROUND_UP(15 * crtc_state->linetime * hscale * vscale, 10); + + return 0; +} + static int scaler_prefill_time(const struct intel_crtc_state *crtc_state) { @@ -2324,6 +2343,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_time(crtc_state) + + skl_dsc_prefill_time(crtc_state) + wm0_lines > adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vblank_start; }