From patchwork Tue Dec 10 21:09:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902064 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 5708DE77182 for ; Tue, 10 Dec 2024 21:10:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D724F10E3F4; Tue, 10 Dec 2024 21:10:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="JJ4R1ctT"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id C793B10E3D0 for ; Tue, 10 Dec 2024 21:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865013; x=1765401013; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=AqyOaYJAQ71MzyoPrWcOfUlOSxk0wfRAzLREmfR++uo=; b=JJ4R1ctTTpqjTFUe4SRStDcKKizzm4rSbyvpCS2TCBIedYZ7n1spvli8 pViOaGy2wgeEb5dOGwiaaYleE1LWU1zg2zxaGAOoJ/UFvnOjgnsG6cnX2 bUF7++cqAMEBfwCxblwbuXg5r3+zOk/hDYtjPm6hZCfMsQQ6ok7ZXQ2z0 JrrVxA2oEaN7ULnXOIo77/zcJh2itHd+PlTu+5LOXuJ1FzSln/co5HKQ+ B3BMgkXg3EK6u+HHisSWceEtxELUX1YCx9cAOOQo8bMLFHNiHWR9PPnGH C/HdI8BGfw4QvdbgQjMck6JZX/I4+0DF4BOaDtKzSk0HUh/fPmuEyUL01 g==; X-CSE-ConnectionGUID: 9Fz2z4MHTfCW3NvX/KOBkg== X-CSE-MsgGUID: w8joXCKMQsuzYi1dQNiePw== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620160" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620160" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:13 -0800 X-CSE-ConnectionGUID: mzIO6mbcTQ2n6xezA/nnuQ== X-CSE-MsgGUID: TY2ZUto2Tu2mYQkt8rY7Mg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735025" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:11 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:10 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 01/18] drm/i915: Extract intel_crtc_vblank_delay() Date: Tue, 10 Dec 2024 23:09:50 +0200 Message-ID: <20241210211007.5976-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Pull the vblank delay computation into a separate function. We'll need more logic here soon and we don't want to pollute intel_crtc_compute_config() with low level details. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 8e90e99a25d6..ff907afa6451 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -2610,16 +2610,29 @@ static int intel_crtc_compute_pipe_mode(struct intel_crtc_state *crtc_state) return 0; } -static bool intel_crtc_needs_wa_14015401596(struct intel_crtc_state *crtc_state) +static bool intel_crtc_needs_wa_14015401596(const struct intel_crtc_state *crtc_state) { struct intel_display *display = to_intel_display(crtc_state); - const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; return intel_vrr_possible(crtc_state) && crtc_state->has_psr && - adjusted_mode->crtc_vblank_start == adjusted_mode->crtc_vdisplay && IS_DISPLAY_VER(display, 13, 14); } +static int intel_crtc_vblank_delay(const struct intel_crtc_state *crtc_state) +{ + struct intel_display *display = to_intel_display(crtc_state); + int vblank_delay = 0; + + if (!HAS_DSB(display)) + return 0; + + /* Wa_14015401596 */ + if (intel_crtc_needs_wa_14015401596(crtc_state)) + vblank_delay = max(vblank_delay, 1); + + return vblank_delay; +} + static int intel_crtc_compute_config(struct intel_atomic_state *state, struct intel_crtc *crtc) { @@ -2629,9 +2642,8 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state, &crtc_state->hw.adjusted_mode; int ret; - /* Wa_14015401596 */ - if (intel_crtc_needs_wa_14015401596(crtc_state)) - adjusted_mode->crtc_vblank_start += 1; + adjusted_mode->crtc_vblank_start += + intel_crtc_vblank_delay(crtc_state); ret = intel_dpll_crtc_compute_clock(state, crtc); if (ret) From patchwork Tue Dec 10 21:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902065 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 4422BE77180 for ; Tue, 10 Dec 2024 21:10:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4C1B10E5C2; Tue, 10 Dec 2024 21:10:16 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="UA5fAGs2"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8493310E5C2 for ; Tue, 10 Dec 2024 21:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865016; x=1765401016; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=/JXyHYP0PNfKdCUrp0sRJ+Iditlw+3VlZGhPoBPvD8M=; b=UA5fAGs2pFUCI+gCEnqKF95ii7lw80kWQ/78eaBTJoy1tRWq0uewZK9z z0ILKykY9qBYWbZVEX24Tf61CuakuPDyPZD6VTKd+TsaaX68IqrQ1JgyY 8w9ARmDORbeb5UJv9w4HvNpu+GCoIHd4ccI1O3aa0k86tYoG3up2Hx9en 5UFdKkFOKUQgR80CXjI64HDub0ZpsBL+VHvUDIidfYIc5kVHqMMr+xQeK YPTT0IS3Il0juiL9zkY4CwhUiN/OJbP+YCjyrLviQEZl7VxtwXSurXGSz MIH/m3FTDZh7Bigy/HkV0J3EP3bx4c9WVnHG7hFD0u59mIWbCOiRhDyqp w==; X-CSE-ConnectionGUID: qFIAFTBJTXuuUKgkNkrYWQ== X-CSE-MsgGUID: rWtAq+byTEysQDFGE/HUNQ== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620166" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620166" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:15 -0800 X-CSE-ConnectionGUID: V6+UeIfDTw6f/v8o7aDi7w== X-CSE-MsgGUID: dgqPbbQmT4uUspp3sNzIUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735043" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:14 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:12 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 02/18] drm/i915: Check vblank delay validity Date: Tue, 10 Dec 2024 23:09:51 +0200 Message-ID: <20241210211007.5976-3-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Make sure we have enough vblank for the computed vblank delay. Supposedly we'd reject things anyway later if this gets violated, but it seems niver to do some basic sanity checks early just so we can't be sure the basic relationship vblank_end > vblank_start always holds. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 31 +++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index ff907afa6451..22b5eacda0f0 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -2633,17 +2633,40 @@ static int intel_crtc_vblank_delay(const struct intel_crtc_state *crtc_state) return vblank_delay; } -static int intel_crtc_compute_config(struct intel_atomic_state *state, - struct intel_crtc *crtc) +static int intel_crtc_compute_vblank_delay(struct intel_atomic_state *state, + struct intel_crtc *crtc) { + struct intel_display *display = to_intel_display(state); struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc); struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; + int vblank_delay, max_vblank_delay; + + vblank_delay = intel_crtc_vblank_delay(crtc_state); + max_vblank_delay = adjusted_mode->crtc_vblank_end - adjusted_mode->crtc_vblank_start - 1; + + if (vblank_delay > max_vblank_delay) { + drm_dbg_kms(display->drm, "[CRTC:%d:%s] vblank delay (%d) exceeds max (%d)\n", + crtc->base.base.id, crtc->base.name, vblank_delay, max_vblank_delay); + return -EINVAL; + } + + adjusted_mode->crtc_vblank_start += vblank_delay; + + return 0; +} + +static int intel_crtc_compute_config(struct intel_atomic_state *state, + struct intel_crtc *crtc) +{ + struct intel_crtc_state *crtc_state = + intel_atomic_get_new_crtc_state(state, crtc); int ret; - adjusted_mode->crtc_vblank_start += - intel_crtc_vblank_delay(crtc_state); + ret = intel_crtc_compute_vblank_delay(state, crtc); + if (ret) + return ret; ret = intel_dpll_crtc_compute_clock(state, crtc); if (ret) From patchwork Tue Dec 10 21:09:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902066 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 29216E77180 for ; Tue, 10 Dec 2024 21:10:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA48E10E5CD; Tue, 10 Dec 2024 21:10:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="CLy/1FlS"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FBCC10E5CD for ; Tue, 10 Dec 2024 21:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865018; x=1765401018; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=TLMGZ6hVaEFwyyeVVY7s09hsuV9aTuIHMBaphoL/SYw=; b=CLy/1FlSTL84+hSm0fy6ZXL+TtlaZE2TBaLO2Wwai5JDULZCRnIQs0rE ZpMMQGza8wcCKydofAA3d8e7WR6519+WS1FO/byzkW+ngaZUhmKhdqs33 R6DwjkpzNdpfnRKwj15kT1XBmabDFKIzge8+9YYD6Ik83CX/eodaZXJvY cTIPt9Z3KrpcMZ7NsJMSQde6pIID061KtvLt5YsKsys4MG3p5uRXX9BfV Rb8b4mgjQqSXBTljzZtk4V9QmL/u4q4M0mVEa64RV5M0QmCYBKgGATxZg WMOt0jtUZWUKMKaxz9pdll3NUw+6lAFM5NEYucEgRSgwt8mp2tI6mu6X5 g==; X-CSE-ConnectionGUID: 242KB7ZlS+2bPRKlleoQbw== X-CSE-MsgGUID: SfkFaku1TS+M0MObdfA98Q== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620170" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620170" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:18 -0800 X-CSE-ConnectionGUID: rhpwr1CyRCmfMhq8L0G5RQ== X-CSE-MsgGUID: qU9r1a3vQqKj/Dxqih8qmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735055" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:17 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:15 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 03/18] drm/i915: Fix include order Date: Tue, 10 Dec 2024 23:09:52 +0200 Message-ID: <20241210211007.5976-4-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Include the headers in the correct alphabetical order. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_vrr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index b386e62d1664..1b0a8e001141 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -8,9 +8,9 @@ #include "i915_reg.h" #include "intel_de.h" #include "intel_display_types.h" +#include "intel_dp.h" #include "intel_vrr.h" #include "intel_vrr_regs.h" -#include "intel_dp.h" #define FIXED_POINT_PRECISION 100 #define CMRR_PRECISION_TOLERANCE 10 From patchwork Tue Dec 10 21:09:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902067 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 98D1CE77180 for ; Tue, 10 Dec 2024 21:10:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1567E10E5CF; Tue, 10 Dec 2024 21:10:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="cDkMnVwm"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 237B310E5CF for ; Tue, 10 Dec 2024 21:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865021; x=1765401021; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=6HEWeejxFl2/YMzG+1vCuusw2aMVVFyuY6qQrsuw9Vs=; b=cDkMnVwmr+zlkS8k1YXmyNPtlY65U0u1HjTJErN6qfYlWJvwWBGzO+w1 CmL389UDWFoWr81SgH2uu/OXx1AXNm0Z5fhj38BshldAhAPGQdXRENK5f NJo9jawiGxhSHg+7LnhI96M0NeyYa8mHKH4jpGdxpEhmlKCckGxVUhNTz ZwQ5PwWq7Q5sZDOWozKSlk/wIQ06fOv4kt8wXNUhExPfU61+gzl3XJyaM o4+QNVl5WofqVcqhHg6Lp637Bc7qj70RmSvkvVBmY24iIAZEQpWxnUzZs w4rVXW1M6DWKyGIYdb0Y3nc7eU3V+sSUZWp5Haa1454wuUsJGlKyYX4jT Q==; X-CSE-ConnectionGUID: UoAXm/S0RreUpm1yABcKlA== X-CSE-MsgGUID: oHLjQWkrQvyyJnq62OD/jg== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620171" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620171" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:21 -0800 X-CSE-ConnectionGUID: K8LlaIvCTqyv1B5zXng+NQ== X-CSE-MsgGUID: /33b+jVTTiSZ/bJNkgm5Sg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735062" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:20 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:18 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 04/18] drm/i915: Introduce intel_vrr_{vmin,vmax}_vtotal() Date: Tue, 10 Dec 2024 23:09:53 +0200 Message-ID: <20241210211007.5976-5-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä On ICL/TGL vmin/vmax/flipline won't actually match the vtotal valeues (currently they do, but that is wrong and needs to be fixed). Add a few helpers that will compute the actual vtotal values for us. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_dsb.c | 2 +- drivers/gpu/drm/i915/display/intel_vblank.c | 4 ++-- drivers/gpu/drm/i915/display/intel_vrr.c | 11 +++++++++++ drivers/gpu/drm/i915/display/intel_vrr.h | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c index e6f8fc743fb4..fcb8bf9cb313 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -140,7 +140,7 @@ static int dsb_vtotal(struct intel_atomic_state *state, const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc); if (pre_commit_is_vrr_active(state, crtc)) - return crtc_state->vrr.vmax; + return intel_vrr_vmax_vtotal(crtc_state); else return intel_mode_vtotal(&crtc_state->hw.adjusted_mode); } diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c index a95fb3349eba..6f0e0c64187d 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -523,8 +523,8 @@ void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state, drm_WARN_ON(display->drm, (mode_flags & I915_MODE_FLAG_VRR) == 0); - adjusted_mode.crtc_vtotal = crtc_state->vrr.vmax; - adjusted_mode.crtc_vblank_end = crtc_state->vrr.vmax; + adjusted_mode.crtc_vtotal = intel_vrr_vmax_vtotal(crtc_state); + adjusted_mode.crtc_vblank_end = intel_vrr_vmax_vtotal(crtc_state); adjusted_mode.crtc_vblank_start = intel_vrr_vmin_vblank_start(crtc_state); vmax_vblank_start = intel_vrr_vmax_vblank_start(crtc_state); } else { diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index 1b0a8e001141..0d40402fe043 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -103,6 +103,17 @@ static int intel_vrr_vblank_exit_length(const struct intel_crtc_state *crtc_stat return crtc_state->vrr.pipeline_full + crtc_state->framestart_delay + 1; } +int intel_vrr_vmin_vtotal(const struct intel_crtc_state *crtc_state) +{ + /* Min vblank actually determined by flipline that is always >=vmin+1 */ + return crtc_state->vrr.vmin + 1; +} + +int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state) +{ + return crtc_state->vrr.vmax; +} + int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state) { /* Min vblank actually determined by flipline that is always >=vmin+1 */ diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h index b3b45c675020..75db88ae9cc4 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.h +++ b/drivers/gpu/drm/i915/display/intel_vrr.h @@ -26,6 +26,8 @@ void intel_vrr_send_push(const struct intel_crtc_state *crtc_state); bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state); void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state); void intel_vrr_get_config(struct intel_crtc_state *crtc_state); +int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state); +int intel_vrr_vmin_vtotal(const struct intel_crtc_state *crtc_state); int intel_vrr_vmax_vblank_start(const struct intel_crtc_state *crtc_state); int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state); From patchwork Tue Dec 10 21:09:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902068 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 B5BA8E7717F for ; Tue, 10 Dec 2024 21:10:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63BE910E5D1; Tue, 10 Dec 2024 21:10:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="jt01yDxc"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04ABA10E3D0 for ; Tue, 10 Dec 2024 21:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865024; x=1765401024; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=0TX5dvVsfjkpHsantJlU9LYpWGtt2CDsngm1tv1lCI0=; b=jt01yDxcLnOTZ18BVsBDQ+U8eLsTQuCXbellHyNB3tWRaJbIF+4xBW7F rpykQuXyK3JdIPTK91nTrxjbCazDVklGnBewV+fxap2V065JFhu1s1qxk JTdyI6leYRRHN4OB/QervK9ydQdhdwXXs2IVCGaJtNH7ooVSzKUwLb9jj 1au20Eb4aVnbdU2zzZ81Zew+BxSe1mX6hXwYnA2nlAJQBf0ExypNqgCt3 4e3Sy/LxY30a4tqU2HCkW0fR7+wXU8lvzGZpGd6+Oe/yvadlqsLGE5RVZ GfkDwgoyf2j4+9WQOBvyDcTEyb5Ljk6bOJ9KUTsZW/ivPGJjjLSDOMzFS Q==; X-CSE-ConnectionGUID: D6wehB3nQDGnDBI18OfsIQ== X-CSE-MsgGUID: +g3pp1kMTVu40yJkQ8uEyg== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620175" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620175" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:24 -0800 X-CSE-ConnectionGUID: UiydJaGQQ8inSwXzgf4/hQ== X-CSE-MsgGUID: zuisg0zuRomqOY3eetslBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735068" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:22 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:21 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 05/18] drm/i915: Move framestart/etc. state dump to a better spot Date: Tue, 10 Dec 2024 23:09:54 +0200 Message-ID: <20241210211007.5976-6-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Try to dump all the important stuff relating to the display timings in one spot. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_crtc_state_dump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c index 1faef60be472..9d930ff862cf 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -250,9 +250,6 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, str_enabled_disabled(pipe_config->enable_psr2_sel_fetch)); } - drm_printf(&p, "framestart delay: %d, MSA timing delay: %d\n", - pipe_config->framestart_delay, pipe_config->msa_timing_delay); - drm_printf(&p, "audio: %i, infoframes: %i, infoframes enabled: 0x%x\n", pipe_config->has_audio, pipe_config->has_infoframe, pipe_config->infoframes.enable); @@ -286,6 +283,9 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, drm_print_hex_dump(&p, "ELD: ", pipe_config->eld, drm_eld_size(pipe_config->eld)); + drm_printf(&p, "framestart delay: %d, MSA timing delay: %d\n", + pipe_config->framestart_delay, pipe_config->msa_timing_delay); + drm_printf(&p, "vrr: %s, vmin: %d, vmax: %d, pipeline full: %d, guardband: %d flipline: %d, vmin vblank: %d, vmax vblank: %d\n", str_yes_no(pipe_config->vrr.enable), pipe_config->vrr.vmin, pipe_config->vrr.vmax, From patchwork Tue Dec 10 21:09:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902069 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 45309E7717F for ; Tue, 10 Dec 2024 21:10:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC83F10E3D0; Tue, 10 Dec 2024 21:10:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="LPQpgQmP"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id ACB2D10E3D0 for ; Tue, 10 Dec 2024 21:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865027; x=1765401027; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Hu4YYAAZWCcB0q+MTP7SuEnGgHY5UDo7yaEmJN5BDVg=; b=LPQpgQmPsEMZoCILgCtsNMoYmLr5SE3VykyT0S8LHVbwtwTGhxmohBL/ nWylqvT0Mtqno/HDc3LPn8UMWaWbK7FpGopjZaWYnYlFBIfqYdfgD04i0 I0zazXjfh8RWM2frJXDb3EwWRADFj4MTTZ15k0GEVvmG9e4BnkzBpmOJE V0mQhIRHP1p8GNfyClCW1wXI31jlPpQgr9UEDnF7v0y6w8ENNnq6O07ut sBz84g4De+L8IwGcf+A5VoUum8oExjGm9Z6FBSV1fPeAzlW6xRpOvcWHC VdNP0gZMvoNso5mIa+ETeBYGmtlSq3pKaObQeBIkkmlvSifVX9Ys2p86W g==; X-CSE-ConnectionGUID: gdL1gqkCT221l5qaV6/07A== X-CSE-MsgGUID: iLquHyrNTBO21azM/kSSzA== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620181" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620181" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:27 -0800 X-CSE-ConnectionGUID: XI7glWTKSXyhcRFCobFS4A== X-CSE-MsgGUID: H+EWS1ABTkKJFX2hFeVksQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735079" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:25 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:24 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 06/18] drm/i915: Include the vblank delay in the state dump Date: Tue, 10 Dec 2024 23:09:55 +0200 Message-ID: <20241210211007.5976-7-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä While one can look at the crtc timings to determine the actual vblank dealy, it seems nicer to provide a more human readable dump of it to ease our lives. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_crtc_state_dump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c index 9d930ff862cf..27ce34df8482 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -283,7 +283,9 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, drm_print_hex_dump(&p, "ELD: ", pipe_config->eld, drm_eld_size(pipe_config->eld)); - drm_printf(&p, "framestart delay: %d, MSA timing delay: %d\n", + drm_printf(&p, "vblank delay: %d, framestart delay: %d, MSA timing delay: %d\n", + pipe_config->hw.adjusted_mode.crtc_vblank_start - + pipe_config->hw.adjusted_mode.crtc_vdisplay, pipe_config->framestart_delay, pipe_config->msa_timing_delay); drm_printf(&p, "vrr: %s, vmin: %d, vmax: %d, pipeline full: %d, guardband: %d flipline: %d, vmin vblank: %d, vmax vblank: %d\n", From patchwork Tue Dec 10 21:09:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902070 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 5B98FE77182 for ; Tue, 10 Dec 2024 21:10:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07AFD10E5D5; Tue, 10 Dec 2024 21:10:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="KNUEpIb3"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B2F810E5E1 for ; Tue, 10 Dec 2024 21:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865029; x=1765401029; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=KlltM/VsvKRgcEiEf+tGNR7Yd0LfvqJCEHqRjFNWAUs=; b=KNUEpIb316zOOQUzmYwKmDyckgYLONRXq1R2fgao2dLAFWMvxqjxLHOm nKXS7/EW493gL0PCdAhnnLdGg0RBS1ImjygVmaWG+kTcZdqNQTXh9wwfr zle32SemwqyuQbTgWmndGPOjlfF7q4VBRl78dlUWTMiZrN7/hsEovCkl8 GvjEZW2NiIefegA3DAW8XIYHonoYqTfyWl8ZBd7rip/rGcyRtsksHjTKg tzxEbq5pbrhUDhbGdKwak5cueWBK2LfBhCgPtrEhT+f31KgoBUaJB7wIr 05pADBWnIglUCnu+UY7NgG5Tq/6qz6EZykDwrMUlzCAyvxcdWLKM+SXpW Q==; X-CSE-ConnectionGUID: Z4wzf906RLufDr5Tf3GrAA== X-CSE-MsgGUID: QNNM9AHWTced44bZhTqphQ== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620186" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620186" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:29 -0800 X-CSE-ConnectionGUID: v1YzQGJvRfKZjKhoUxd+6g== X-CSE-MsgGUID: sjayJ8ACSwSAkzspM/8jMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735090" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:28 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:26 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 07/18] drm/i915/vrr: Improve VRR state dump Date: Tue, 10 Dec 2024 23:09:56 +0200 Message-ID: <20241210211007.5976-8-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Dump the calculated vmin/vmax vtotal values in addition to the raw vmin/vmax/flipline values. Makes it much easier to see what kind of scanline values we should be expecting from the hardware. Signed-off-by: Ville Syrjälä --- .../gpu/drm/i915/display/intel_crtc_state_dump.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c index 27ce34df8482..97e3cdccda01 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -288,13 +288,14 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, pipe_config->hw.adjusted_mode.crtc_vdisplay, pipe_config->framestart_delay, pipe_config->msa_timing_delay); - drm_printf(&p, "vrr: %s, vmin: %d, vmax: %d, pipeline full: %d, guardband: %d flipline: %d, vmin vblank: %d, vmax vblank: %d\n", + drm_printf(&p, "vrr: %s, vmin: %d, vmax: %d, flipline: %d, pipeline full: %d, guardband: %d\n", str_yes_no(pipe_config->vrr.enable), - pipe_config->vrr.vmin, pipe_config->vrr.vmax, - pipe_config->vrr.pipeline_full, pipe_config->vrr.guardband, - pipe_config->vrr.flipline, - intel_vrr_vmin_vblank_start(pipe_config), - intel_vrr_vmax_vblank_start(pipe_config)); + pipe_config->vrr.vmin, pipe_config->vrr.vmax, pipe_config->vrr.flipline, + pipe_config->vrr.pipeline_full, pipe_config->vrr.guardband); + + drm_printf(&p, "vrr: vmin vblank: %d, vmax vblank: %d, vmin vtotal: %d, vmax vtotal: %d\n", + intel_vrr_vmin_vblank_start(pipe_config), intel_vrr_vmax_vblank_start(pipe_config), + intel_vrr_vmin_vtotal(pipe_config), intel_vrr_vmax_vtotal(pipe_config)); drm_printf(&p, "requested mode: " DRM_MODE_FMT "\n", DRM_MODE_ARG(&pipe_config->hw.mode)); From patchwork Tue Dec 10 21:09:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902071 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 47918E77180 for ; Tue, 10 Dec 2024 21:10:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E383010E5E1; Tue, 10 Dec 2024 21:10:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="lmVq31sZ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A1C410E5E1 for ; Tue, 10 Dec 2024 21:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865032; x=1765401032; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=AnSUA0YKPX2HzW9FVhCnEY4mMw3ndvBv+cJ9qUmSiZk=; b=lmVq31sZfhamDX1CDAcUUC5bRrBS/e2h6xAPkYns+mJD9+2oaWHvRigS owBbSpYz9XuK59/uiPRjVHQQFbOkvQVwyhY8WDGqaNZcOGLG6oGi5cyi+ rlOc660l+I7yoVw8LYYgLyHHyX8NDektLMV/n5LDtUFRkwIJhk48HcZsY JWiyvZoJeWU0De90UM2Qm+sI4NUkNomKspAKL9N5y2INqbDCBguX9+3xd 9W5R7KpO9ub8U40/yDU10/SSavV3TOJg49duqja+kRYws+t/3wMzCiB1W DQsemWh9XdZIie9KEHhA/AWMX+2SL1cOS7lQY2Hr1yaRvD+fS0PloQSeN g==; X-CSE-ConnectionGUID: 0NmC/48ORMKlUx+M7b57tQ== X-CSE-MsgGUID: LigXdN7MRjmb9qWaTjFWTg== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620191" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620191" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:32 -0800 X-CSE-ConnectionGUID: 50qYavR7Rv6b3TzYkhbaYw== X-CSE-MsgGUID: 4yfxdzDCQCCx/SXNyveYCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735102" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:31 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:29 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 08/18] drm/i915: Include the scanline offset in the state dump Date: Tue, 10 Dec 2024 23:09:57 +0200 Message-ID: <20241210211007.5976-9-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä When looking at raw hardware scanline numbers it's helpful to remember what the offset between the hardware values and our more human readable numbers should be. Include that in the state dump. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_crtc_state_dump.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c index 97e3cdccda01..1fbaa67e2fea 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -10,6 +10,7 @@ #include "intel_crtc_state_dump.h" #include "intel_display_types.h" #include "intel_hdmi.h" +#include "intel_vblank.h" #include "intel_vdsc.h" #include "intel_vrr.h" @@ -283,6 +284,9 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, drm_print_hex_dump(&p, "ELD: ", pipe_config->eld, drm_eld_size(pipe_config->eld)); + drm_printf(&p, "scanline offset: %d\n", + intel_crtc_scanline_offset(pipe_config)); + drm_printf(&p, "vblank delay: %d, framestart delay: %d, MSA timing delay: %d\n", pipe_config->hw.adjusted_mode.crtc_vblank_start - pipe_config->hw.adjusted_mode.crtc_vdisplay, From patchwork Tue Dec 10 21:09:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902072 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 E5D14E77182 for ; Tue, 10 Dec 2024 21:10:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5071D10E5D3; Tue, 10 Dec 2024 21:10:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="LtMFVvrf"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1ECF410E974 for ; Tue, 10 Dec 2024 21:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865035; x=1765401035; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ypyA6fUIHti/sTzksh4+UziyyRt51CeXyu8JSGKms0g=; b=LtMFVvrfYswdO625JPdUZzgNV991RWiyc9ZqIb7o4I+RQjuRt6be8jJK 5KW+k5AZMINdkRiy+TuATndT9QC5esp+wkzHR/eSshzgHlfluJ26Cv20v 82LnCc76BOP7BAKHH2/Yig+a85zalpwhTr2k8myePgScsC760D9dALqKF IRr1RhyOgKk4pXHimKaWmyJwII64ngJV71rp7JEpxfu/IvtFeELXwf8Rm mqTEhABISWd6O1rdj7HwJ3aDFXQLE7qwRS3ZETJ5W864/4Iqyu8MniCEE Zq5yiOKgUwpvWrqbq4pDbugqK00XKhWTjbgWGMaYnA3OMwiAMQbjLswRL g==; X-CSE-ConnectionGUID: n5OWLCOZQwK6e3VvlopC2g== X-CSE-MsgGUID: 5WcNJLiDSsOmPGQG+lrjfw== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620196" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620196" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:35 -0800 X-CSE-ConnectionGUID: +AYejqyFSXWG83cHYiSopg== X-CSE-MsgGUID: AR8Z/pKWSk23z7mjJeZx3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735107" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:34 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:32 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 09/18] drm/i915: Extract intel_mode_vblank_delay() Date: Tue, 10 Dec 2024 23:09:58 +0200 Message-ID: <20241210211007.5976-10-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Extract the code that computes the hardware centric view of the vblank delay into a helper. We;ll need a slightly different variant for VRR soon. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_dsb.c | 3 +-- drivers/gpu/drm/i915/display/intel_vblank.c | 8 ++++++-- drivers/gpu/drm/i915/display/intel_vblank.h | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c index fcb8bf9cb313..d755825edb35 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -130,8 +130,7 @@ pre_commit_crtc_state(struct intel_atomic_state *state, static int dsb_vblank_delay(const struct intel_crtc_state *crtc_state) { - return intel_mode_vblank_start(&crtc_state->hw.adjusted_mode) - - intel_mode_vdisplay(&crtc_state->hw.adjusted_mode); + return intel_mode_vblank_delay(&crtc_state->hw.adjusted_mode); } static int dsb_vtotal(struct intel_atomic_state *state, diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c index 6f0e0c64187d..ee33a49d9873 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -597,6 +597,11 @@ int intel_mode_vtotal(const struct drm_display_mode *mode) return vtotal; } +int intel_mode_vblank_delay(const struct drm_display_mode *mode) +{ + return intel_mode_vblank_start(mode) - intel_mode_vdisplay(mode); +} + void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, const struct intel_crtc_state *new_crtc_state, struct intel_vblank_evade_ctx *evade) @@ -653,8 +658,7 @@ void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, */ if (intel_color_uses_dsb(new_crtc_state) || new_crtc_state->update_m_n || new_crtc_state->update_lrr) - evade->min -= intel_mode_vblank_start(adjusted_mode) - - intel_mode_vdisplay(adjusted_mode); + evade->min -= intel_mode_vblank_delay(adjusted_mode); } /* must be called with vblank interrupt already enabled! */ diff --git a/drivers/gpu/drm/i915/display/intel_vblank.h b/drivers/gpu/drm/i915/display/intel_vblank.h index 6d7336256982..12c8e1f829a4 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.h +++ b/drivers/gpu/drm/i915/display/intel_vblank.h @@ -24,6 +24,7 @@ int intel_mode_vdisplay(const struct drm_display_mode *mode); int intel_mode_vblank_start(const struct drm_display_mode *mode); int intel_mode_vblank_end(const struct drm_display_mode *mode); int intel_mode_vtotal(const struct drm_display_mode *mode); +int intel_mode_vblank_delay(const struct drm_display_mode *mode); void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, const struct intel_crtc_state *new_crtc_state, From patchwork Tue Dec 10 21:09:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902073 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 7EC64E77180 for ; Tue, 10 Dec 2024 21:10:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B4F310E974; Tue, 10 Dec 2024 21:10:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="N4tykMgM"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC90B10E974 for ; Tue, 10 Dec 2024 21:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865038; x=1765401038; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=zBktAs00ETIvCf24NO+7CX+8HB3SZlWem0437tBFud4=; b=N4tykMgMeQtfQQHthNng0LKBE4yQoNR51yuiOV7taWFmtK+x8+V+tzqt LRjjXcHVFbU2wtXip51LKMtjUrRoPfzna7QC5aRax0ttqd8KX2w/TRaJr /fseNbTtQ2o4XgltBE91k72u+mm66VzDSAeTf0nJZ8wtq31ZbTovgKxXW vXv7Ck88KXUo2I8ns17TlV4Y7pFAy53wnUdk2tMyXLvKsTFhUX4Yg8bWj mEawwUlTkGPmzwO9fkFzEJDaUNtx1Z8grhS91afmoZzD7xt/hjkDg12fH 86bsQEykmCMhp0r0Mhyz8SnqZoxRDen14py7Ma/tR+nEEh7GrIvrGrpJY Q==; X-CSE-ConnectionGUID: fFkIBtyBTdu5roScsByoqQ== X-CSE-MsgGUID: iN+MdH9LRXqpiAcSwRNN9w== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620199" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620199" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:38 -0800 X-CSE-ConnectionGUID: nCJdGr+fQ+uMefKeRmwomA== X-CSE-MsgGUID: K4jroIAUTcqM/Dug4pEjgg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735117" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:36 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:35 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 10/18] drm/i915: Consolidate intel_pre_commit_crtc_state() Date: Tue, 10 Dec 2024 23:09:59 +0200 Message-ID: <20241210211007.5976-11-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä We have approximately two copies of pre_commit_crtc_state(), one in the DSB code, the other in the vblank evasion code. Combine them into one. The slight difference between the two is that vblank evasion doesn't have a full atomic state (when called from the legacy cursor code), so it gets the old and new crtc state passed in by hand. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_dsb.c | 37 +++++++------------- drivers/gpu/drm/i915/display/intel_vblank.c | 38 +++++++++++++++------ drivers/gpu/drm/i915/display/intel_vblank.h | 5 +++ 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c index d755825edb35..673f75703785 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -109,25 +109,6 @@ static bool pre_commit_is_vrr_active(struct intel_atomic_state *state, return old_crtc_state->vrr.enable && !intel_crtc_vrr_disabling(state, crtc); } -static const struct intel_crtc_state * -pre_commit_crtc_state(struct intel_atomic_state *state, - struct intel_crtc *crtc) -{ - const struct intel_crtc_state *old_crtc_state = - intel_atomic_get_old_crtc_state(state, crtc); - const struct intel_crtc_state *new_crtc_state = - intel_atomic_get_new_crtc_state(state, crtc); - - /* - * During fastsets/etc. the transcoder is still - * running with the old timings at this point. - */ - if (intel_crtc_needs_modeset(new_crtc_state)) - return new_crtc_state; - else - return old_crtc_state; -} - static int dsb_vblank_delay(const struct intel_crtc_state *crtc_state) { return intel_mode_vblank_delay(&crtc_state->hw.adjusted_mode); @@ -136,7 +117,8 @@ static int dsb_vblank_delay(const struct intel_crtc_state *crtc_state) static int dsb_vtotal(struct intel_atomic_state *state, struct intel_crtc *crtc) { - const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc); + const struct intel_crtc_state *crtc_state = + intel_pre_commit_crtc_state(state, crtc); if (pre_commit_is_vrr_active(state, crtc)) return intel_vrr_vmax_vtotal(crtc_state); @@ -147,7 +129,8 @@ static int dsb_vtotal(struct intel_atomic_state *state, static int dsb_dewake_scanline_start(struct intel_atomic_state *state, struct intel_crtc *crtc) { - const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc); + const struct intel_crtc_state *crtc_state = + intel_pre_commit_crtc_state(state, crtc); struct drm_i915_private *i915 = to_i915(state->base.dev); unsigned int latency = skl_watermark_max_latency(i915, 0); @@ -158,7 +141,8 @@ static int dsb_dewake_scanline_start(struct intel_atomic_state *state, static int dsb_dewake_scanline_end(struct intel_atomic_state *state, struct intel_crtc *crtc) { - const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc); + const struct intel_crtc_state *crtc_state = + intel_pre_commit_crtc_state(state, crtc); return intel_mode_vdisplay(&crtc_state->hw.adjusted_mode); } @@ -166,7 +150,8 @@ static int dsb_dewake_scanline_end(struct intel_atomic_state *state, static int dsb_scanline_to_hw(struct intel_atomic_state *state, struct intel_crtc *crtc, int scanline) { - const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc); + const struct intel_crtc_state *crtc_state = + intel_pre_commit_crtc_state(state, crtc); int vtotal = dsb_vtotal(state, crtc); return (scanline + vtotal - intel_crtc_scanline_offset(crtc_state)) % vtotal; @@ -531,7 +516,8 @@ void intel_dsb_vblank_evade(struct intel_atomic_state *state, struct intel_dsb *dsb) { struct intel_crtc *crtc = dsb->crtc; - const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc); + const struct intel_crtc_state *crtc_state = + intel_pre_commit_crtc_state(state, crtc); /* FIXME calibrate sensibly */ int latency = intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode, 20); int vblank_delay = dsb_vblank_delay(crtc_state); @@ -623,7 +609,8 @@ void intel_dsb_wait_vblank_delay(struct intel_atomic_state *state, struct intel_dsb *dsb) { struct intel_crtc *crtc = dsb->crtc; - const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc); + const struct intel_crtc_state *crtc_state = + intel_pre_commit_crtc_state(state, crtc); int usecs = intel_scanlines_to_usecs(&crtc_state->hw.adjusted_mode, dsb_vblank_delay(crtc_state)) + 1; diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c index ee33a49d9873..3cf3cff0687a 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -602,6 +602,32 @@ int intel_mode_vblank_delay(const struct drm_display_mode *mode) return intel_mode_vblank_start(mode) - intel_mode_vdisplay(mode); } +static const struct intel_crtc_state * +pre_commit_crtc_state(const struct intel_crtc_state *old_crtc_state, + const struct intel_crtc_state *new_crtc_state) +{ + /* + * During fastsets/etc. the transcoder is still + * running with the old timings at this point. + */ + if (intel_crtc_needs_modeset(new_crtc_state)) + return new_crtc_state; + else + return old_crtc_state; +} + +const struct intel_crtc_state * +intel_pre_commit_crtc_state(struct intel_atomic_state *state, + struct intel_crtc *crtc) +{ + const struct intel_crtc_state *old_crtc_state = + intel_atomic_get_old_crtc_state(state, crtc); + const struct intel_crtc_state *new_crtc_state = + intel_atomic_get_new_crtc_state(state, crtc); + + return pre_commit_crtc_state(old_crtc_state, new_crtc_state); +} + void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, const struct intel_crtc_state *new_crtc_state, struct intel_vblank_evade_ctx *evade) @@ -617,16 +643,8 @@ void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, display->platform.cherryview) && intel_crtc_has_type(new_crtc_state, INTEL_OUTPUT_DSI); - /* - * During fastsets/etc. the transcoder is still - * running with the old timings at this point. - * - * TODO: maybe just use the active timings here? - */ - if (intel_crtc_needs_modeset(new_crtc_state)) - crtc_state = new_crtc_state; - else - crtc_state = old_crtc_state; + /* TODO: maybe just use the active timings here? */ + crtc_state = pre_commit_crtc_state(old_crtc_state, new_crtc_state); adjusted_mode = &crtc_state->hw.adjusted_mode; diff --git a/drivers/gpu/drm/i915/display/intel_vblank.h b/drivers/gpu/drm/i915/display/intel_vblank.h index 12c8e1f829a4..21fbb08d61d5 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.h +++ b/drivers/gpu/drm/i915/display/intel_vblank.h @@ -11,6 +11,7 @@ struct drm_crtc; struct drm_display_mode; +struct intel_atomic_state; struct intel_crtc; struct intel_crtc_state; @@ -43,4 +44,8 @@ void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state, bool vrr_enable); int intel_crtc_scanline_offset(const struct intel_crtc_state *crtc_state); +const struct intel_crtc_state * +intel_pre_commit_crtc_state(struct intel_atomic_state *state, + struct intel_crtc *crtc); + #endif /* __INTEL_VBLANK_H__ */ From patchwork Tue Dec 10 21:10:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902074 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 B0C70E7717F for ; Tue, 10 Dec 2024 21:10:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B38410E975; Tue, 10 Dec 2024 21:10:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dRLln4tJ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8FBDE10E977 for ; Tue, 10 Dec 2024 21:10: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=1733865041; x=1765401041; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=y5zKX4SLvnaWEsCD1Mn05mtkNPd3y1RKMd7o7snKAeg=; b=dRLln4tJxaLFOUYV6p3fIOm45McHl3lug26OjX1fRP6+LnDZWRslc3Rh ROH03ssLsGTe1MxWnyYgllwdkcHVL7xRHhuqTNtabJvnVc7dnb7F9YAtx b9Ok9g1cy9i1BGApSdOWeo+/2EiYkE5k9YWQjirEGsonyM1D3omjFsnrZ nxecZ9bGBM7bQL3Zfy/Z+56ayr3M7w/VHLIcyOgVye2GSQk9ouokyKv+k bmD3zkhR4ff0K/HwZEFGj6NTN5kTgCN1JLau+GkdRJMEefAGO/BJupSMU BPnPmiABRBJag28MgSvewsKhWQIjxBmGpFJc6hiP3lLfkYlri+Hb6j2YN Q==; X-CSE-ConnectionGUID: Ql2acPGKTAObjVrxfoSMwA== X-CSE-MsgGUID: uZcScVEOSGSmLQrHieZ75A== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620204" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620204" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:40 -0800 X-CSE-ConnectionGUID: ZiPgWmQsS+22stX35W/EKg== X-CSE-MsgGUID: ZQUhtnGNTEmLYHGFLsof/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735122" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:39 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:37 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 11/18] drm/i915: Extract intel_crtc_active_timings() Date: Tue, 10 Dec 2024 23:10:00 +0200 Message-ID: <20241210211007.5976-12-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Declutter intel_crtc_update_active_timings() a bit by moving the code that determines the timings into a separate function. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_vblank.c | 33 ++++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c index 3cf3cff0687a..2a99bde457db 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -507,6 +507,23 @@ void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc) wait_for_pipe_scanline_moving(crtc, true); } +static void intel_crtc_active_timings(struct drm_display_mode *mode, + int *vmax_vblank_start, + const struct intel_crtc_state *crtc_state, + bool vrr_enable) +{ + drm_mode_init(mode, &crtc_state->hw.adjusted_mode); + *vmax_vblank_start = 0; + + if (!vrr_enable) + return; + + mode->crtc_vtotal = intel_vrr_vmax_vtotal(crtc_state); + mode->crtc_vblank_end = intel_vrr_vmax_vtotal(crtc_state); + mode->crtc_vblank_start = intel_vrr_vmin_vblank_start(crtc_state); + *vmax_vblank_start = intel_vrr_vmax_vblank_start(crtc_state); +} + void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state, bool vrr_enable) { @@ -517,19 +534,13 @@ void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state, int vmax_vblank_start = 0; unsigned long irqflags; - drm_mode_init(&adjusted_mode, &crtc_state->hw.adjusted_mode); + intel_crtc_active_timings(&adjusted_mode, &vmax_vblank_start, + crtc_state, vrr_enable); - if (vrr_enable) { - drm_WARN_ON(display->drm, - (mode_flags & I915_MODE_FLAG_VRR) == 0); - - adjusted_mode.crtc_vtotal = intel_vrr_vmax_vtotal(crtc_state); - adjusted_mode.crtc_vblank_end = intel_vrr_vmax_vtotal(crtc_state); - adjusted_mode.crtc_vblank_start = intel_vrr_vmin_vblank_start(crtc_state); - vmax_vblank_start = intel_vrr_vmax_vblank_start(crtc_state); - } else { + if (vrr_enable) + drm_WARN_ON(display->drm, (mode_flags & I915_MODE_FLAG_VRR) == 0); + else mode_flags &= ~I915_MODE_FLAG_VRR; - } /* * Belts and suspenders locking to guarantee everyone sees 100% From patchwork Tue Dec 10 21:10:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902075 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 8B61BE7717F for ; Tue, 10 Dec 2024 21:10:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 23ECE10E977; Tue, 10 Dec 2024 21:10:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="c7SMO6v4"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B18310E977 for ; Tue, 10 Dec 2024 21:10:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865043; x=1765401043; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HSeoJHTxXZLAG4M+S9EQ5PQd3kF43sMLTZd56oZu77A=; b=c7SMO6v464CrfkVoRvWOrqClfc1uz6InXtjIbBQzT5WfS6cuuSAA+jAG d8P4INKPPKLfxxM+p2Fzw51yTxw+ZxpUcIfY6+dqJ9Qn+CpQ28AeMW8/C PRREURwgmE+oMSUPvrH59f+OrG6kyjaYkCHXgTncfBbqzixXvfoHugFfV s1gKT0iWbc9iiLjXMTfcNYFjOIW7Q+yX3fM0ZImvi/bqoW13ZR7RuSrX9 e+szqpywjflfLV5Escpuw7sjIJDFIPsuJIRr7/PWYVJ0DzA7oYe76WAV7 BYqviMq1Mzyft2OgX3MZUlbXhRtg3vAZsaLg/KhEq8ty6mGIfOd5w12/4 g==; X-CSE-ConnectionGUID: h/LNYyKaRAamL2tNGX/zPQ== X-CSE-MsgGUID: +5H6gv7vSz2MJPM0uquw+Q== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620209" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620209" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:43 -0800 X-CSE-ConnectionGUID: 3Zmhw0TpSGOyvM9rCUgv8g== X-CSE-MsgGUID: 85uvoZq4Q4WKHey8QRZ7mA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735124" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:42 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:40 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 12/18] drm/i915/vrr: Introduce intel_vrr_vblank_delay() Date: Tue, 10 Dec 2024 23:10:01 +0200 Message-ID: <20241210211007.5976-13-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Introduce a VRR specific function for determining the current vblank delay. Currently thus will give the same answer as intel_mode_vblank_delay() but that will change later. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_dsb.c | 18 ++++++++++++++---- drivers/gpu/drm/i915/display/intel_vblank.c | 7 ++++++- drivers/gpu/drm/i915/display/intel_vrr.c | 6 ++++++ drivers/gpu/drm/i915/display/intel_vrr.h | 1 + 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c index 673f75703785..89d3496bcbdb 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -109,9 +109,16 @@ static bool pre_commit_is_vrr_active(struct intel_atomic_state *state, return old_crtc_state->vrr.enable && !intel_crtc_vrr_disabling(state, crtc); } -static int dsb_vblank_delay(const struct intel_crtc_state *crtc_state) +static int dsb_vblank_delay(struct intel_atomic_state *state, + struct intel_crtc *crtc) { - return intel_mode_vblank_delay(&crtc_state->hw.adjusted_mode); + const struct intel_crtc_state *crtc_state = + intel_pre_commit_crtc_state(state, crtc); + + if (pre_commit_is_vrr_active(state, crtc)) + return intel_vrr_vblank_delay(crtc_state); + else + return intel_mode_vblank_delay(&crtc_state->hw.adjusted_mode); } static int dsb_vtotal(struct intel_atomic_state *state, @@ -520,10 +527,11 @@ void intel_dsb_vblank_evade(struct intel_atomic_state *state, intel_pre_commit_crtc_state(state, crtc); /* FIXME calibrate sensibly */ int latency = intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode, 20); - int vblank_delay = dsb_vblank_delay(crtc_state); int start, end; if (pre_commit_is_vrr_active(state, crtc)) { + int vblank_delay = intel_vrr_vblank_delay(crtc_state); + end = intel_vrr_vmin_vblank_start(crtc_state); start = end - vblank_delay - latency; intel_dsb_wait_scanline_out(state, dsb, start, end); @@ -532,6 +540,8 @@ void intel_dsb_vblank_evade(struct intel_atomic_state *state, start = end - vblank_delay - latency; intel_dsb_wait_scanline_out(state, dsb, start, end); } else { + int vblank_delay = intel_mode_vblank_delay(&crtc_state->hw.adjusted_mode); + end = intel_mode_vblank_start(&crtc_state->hw.adjusted_mode); start = end - vblank_delay - latency; intel_dsb_wait_scanline_out(state, dsb, start, end); @@ -612,7 +622,7 @@ void intel_dsb_wait_vblank_delay(struct intel_atomic_state *state, const struct intel_crtc_state *crtc_state = intel_pre_commit_crtc_state(state, crtc); int usecs = intel_scanlines_to_usecs(&crtc_state->hw.adjusted_mode, - dsb_vblank_delay(crtc_state)) + 1; + dsb_vblank_delay(state, crtc)) + 1; intel_dsb_wait_usec(dsb, usecs); } diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c index 2a99bde457db..fb80e0bef08a 100644 --- a/drivers/gpu/drm/i915/display/intel_vblank.c +++ b/drivers/gpu/drm/i915/display/intel_vblank.c @@ -647,6 +647,7 @@ void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc); const struct intel_crtc_state *crtc_state; const struct drm_display_mode *adjusted_mode; + int vblank_delay; evade->crtc = crtc; @@ -668,8 +669,12 @@ void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, evade->vblank_start = intel_vrr_vmin_vblank_start(crtc_state); else evade->vblank_start = intel_vrr_vmax_vblank_start(crtc_state); + + vblank_delay = intel_vrr_vblank_delay(crtc_state); } else { evade->vblank_start = intel_mode_vblank_start(adjusted_mode); + + vblank_delay = intel_mode_vblank_delay(adjusted_mode); } /* FIXME needs to be calibrated sensibly */ @@ -687,7 +692,7 @@ void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, */ if (intel_color_uses_dsb(new_crtc_state) || new_crtc_state->update_m_n || new_crtc_state->update_lrr) - evade->min -= intel_mode_vblank_delay(adjusted_mode); + evade->min -= vblank_delay; } /* must be called with vblank interrupt already enabled! */ diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index 0d40402fe043..a0ddc288c1a3 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -76,6 +76,12 @@ intel_vrr_check_modeset(struct intel_atomic_state *state) } } +int intel_vrr_vblank_delay(const struct intel_crtc_state *crtc_state) +{ + return crtc_state->hw.adjusted_mode.crtc_vblank_start - + crtc_state->hw.adjusted_mode.crtc_vdisplay; +} + /* * Without VRR registers get latched at: * vblank_start diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h index 75db88ae9cc4..8e8961adce39 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.h +++ b/drivers/gpu/drm/i915/display/intel_vrr.h @@ -30,5 +30,6 @@ int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state); int intel_vrr_vmin_vtotal(const struct intel_crtc_state *crtc_state); int intel_vrr_vmax_vblank_start(const struct intel_crtc_state *crtc_state); int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state); +int intel_vrr_vblank_delay(const struct intel_crtc_state *crtc_state); #endif /* __INTEL_VRR_H__ */ From patchwork Tue Dec 10 21:10:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902076 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 D0E1BE7717F for ; Tue, 10 Dec 2024 21:10:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7321B10E5D6; Tue, 10 Dec 2024 21:10:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="MdHwkBFp"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26FFD10E980 for ; Tue, 10 Dec 2024 21:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865046; x=1765401046; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=1cCvj4WRhPQM27IjuUk18tXSd+eeoMwhF9qOBtmvNTM=; b=MdHwkBFpad5zIwwGfkVoN/+l4MWPNXhwOAG/QGk7G+dm2/1OqknT4Sr5 3QKlM6iERumIuuEyZGeF29NEsrKapfKH+xAFNEseBRPCG9rPMBf1Qgn6G FPKuQPQfmObP0xH8LLZOzVAV180dY6IyVSNiDWQhKwi11Do/ZCcQyJXuq 4Ptb1AG3/NbI4dDrOptlPaTMuyct4hTCcS6wP7lqLLCqMAtvVTllAvLoc TPD7YcO6frt7KXGe9i44TXvPZSXlxgeqFYHpBkG1iAsRq/pivsBShBVnP 0rOpT7cl3Zmi/wM5/4wBfz8t2hTD+uCV0pqdeshKKLctTMN/MNN40X7AS Q==; X-CSE-ConnectionGUID: hkR+BJSySceszu/DWUG1dg== X-CSE-MsgGUID: kFOGDFl7QBShTto8aXpjsQ== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620211" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620211" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:46 -0800 X-CSE-ConnectionGUID: 4pZ1Sb7vQJ2B8kscNBXGvA== X-CSE-MsgGUID: 8Lc0edANQnS59JPoIeG2rw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735129" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:45 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:43 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 13/18] drm/i915/vrr: Drop the extra vmin adjustment for ADL+ Date: Tue, 10 Dec 2024 23:10:02 +0200 Message-ID: <20241210211007.5976-14-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Apparently on ICL/TGL need the annoying vmin adjustemnt. On ADL+ we can program flipling==vmin and the hardware actually respects that properly. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_vrr.c | 39 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index a0ddc288c1a3..15017254d250 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -82,6 +82,19 @@ int intel_vrr_vblank_delay(const struct intel_crtc_state *crtc_state) crtc_state->hw.adjusted_mode.crtc_vdisplay; } +static int intel_vrr_flipline_offset(struct intel_display *display) +{ + /* ICL/TGL hardware imposes flipline>=vmin+1 */ + return DISPLAY_VER(display) < 13 ? 1 : 0; +} + +static int intel_vrr_vmin_flipline(const struct intel_crtc_state *crtc_state) +{ + struct intel_display *display = to_intel_display(crtc_state); + + return crtc_state->vrr.vmin + intel_vrr_flipline_offset(display); +} + /* * Without VRR registers get latched at: * vblank_start @@ -111,8 +124,8 @@ static int intel_vrr_vblank_exit_length(const struct intel_crtc_state *crtc_stat int intel_vrr_vmin_vtotal(const struct intel_crtc_state *crtc_state) { - /* Min vblank actually determined by flipline that is always >=vmin+1 */ - return crtc_state->vrr.vmin + 1; + /* Min vblank actually determined by flipline */ + return intel_vrr_vmin_flipline(crtc_state); } int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state) @@ -122,8 +135,8 @@ int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state) int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state) { - /* Min vblank actually determined by flipline that is always >=vmin+1 */ - return crtc_state->vrr.vmin + 1 - intel_vrr_vblank_exit_length(crtc_state); + /* Min vblank actually determined by flipline */ + return intel_vrr_vmin_flipline(crtc_state) - intel_vrr_vblank_exit_length(crtc_state); } int intel_vrr_vmax_vblank_start(const struct intel_crtc_state *crtc_state) @@ -220,15 +233,17 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state, if (vmin >= vmax) return; - /* - * flipline determines the min vblank length the hardware will - * generate, and flipline>=vmin+1, hence we reduce vmin by one - * to make sure we can get the actual min vblank length. - */ - crtc_state->vrr.vmin = vmin - 1; + crtc_state->vrr.vmin = vmin; crtc_state->vrr.vmax = vmax; - crtc_state->vrr.flipline = crtc_state->vrr.vmin + 1; + crtc_state->vrr.flipline = crtc_state->vrr.vmin; + + /* + * flipline determines the min vblank length the hardware will + * generate, and on ICL/TGL flipline>=vmin+1, hence we reduce + * vmin by one to make sure we can get the actual min vblank length. + */ + crtc_state->vrr.vmin -= intel_vrr_flipline_offset(display); /* * When panel is VRR capable and userspace has @@ -273,7 +288,7 @@ void intel_vrr_compute_config_late(struct intel_crtc_state *crtc_state) if (DISPLAY_VER(display) >= 13) { crtc_state->vrr.guardband = - crtc_state->vrr.vmin + 1 - adjusted_mode->crtc_vblank_start; + crtc_state->vrr.vmin - adjusted_mode->crtc_vblank_start; } else { crtc_state->vrr.pipeline_full = min(255, crtc_state->vrr.vmin - adjusted_mode->crtc_vblank_start - From patchwork Tue Dec 10 21:10:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902077 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 0D9E7E77180 for ; Tue, 10 Dec 2024 21:10:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A3E0810E97A; Tue, 10 Dec 2024 21:10:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="ktMkx9wD"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id CAE2310E97B for ; Tue, 10 Dec 2024 21:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865049; x=1765401049; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=wG0NKo0/w57AS7FNY9pE2ND8EkUJRb5eB4h1V/XbbW4=; b=ktMkx9wDOf5QSf3A5eTdhDgud6IYVSyHmXgyn91CN9NTu6U6+E/yqGqb Bc3TVB1rowJqteSE+Kj+Tud1ZwXq2I6QYx5UHtgEIB+zYRiOlIK2pymgM 1fPVlc7EWwtVtT9hoiOEd6xzyr49ifR0hCIpAIg33nASC9I4BuzXJ3Q72 ReRzjEKIpSZe6xW8YcHc6GjbfUIVJngVxg0L8l7fkHic3svj3cFbi2xp8 v8WhulpaL3XI00JegQnW/OqSj9eynMBEt9i/vg2hBp8LgNeMHNnD1IMv5 705v3qzHPfF+Uk+pJWx2FXxFJ9xLkL7ADabKb0438sKinidjJyzoQvmh8 g==; X-CSE-ConnectionGUID: egHIcgBjR1C3h8BdP5IlhQ== X-CSE-MsgGUID: VD1TBOD6T7GOlgCne2f8EA== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620214" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620214" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:49 -0800 X-CSE-ConnectionGUID: LZ40biTDSiydreR4DPeD9A== X-CSE-MsgGUID: O4iF+7IoTCaKJeUYyuHLEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735132" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:47 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:46 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 14/18] drm/i915/vrr: Fix vmin/vmax/flipline on TGL when using vblank delay Date: Tue, 10 Dec 2024 23:10:03 +0200 Message-ID: <20241210211007.5976-15-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Turns out that TGL needs its vmin/vmax/flipling adjusted based on the vblank delay, otherwise the hardware pushes the vtotals fiurther out. Make it so. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_vrr.c | 32 +++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index 15017254d250..c08dd1e5cffc 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -118,30 +118,41 @@ static int intel_vrr_vblank_exit_length(const struct intel_crtc_state *crtc_stat if (DISPLAY_VER(display) >= 13) return crtc_state->vrr.guardband; else - /* The hw imposes the extra scanline before frame start */ + /* hardware imposes one extra scanline somewhere */ return crtc_state->vrr.pipeline_full + crtc_state->framestart_delay + 1; } int intel_vrr_vmin_vtotal(const struct intel_crtc_state *crtc_state) { + struct intel_display *display = to_intel_display(crtc_state); + /* Min vblank actually determined by flipline */ - return intel_vrr_vmin_flipline(crtc_state); + if (DISPLAY_VER(display) >= 13) + return intel_vrr_vmin_flipline(crtc_state); + else + return intel_vrr_vmin_flipline(crtc_state) + + intel_vrr_vblank_delay(crtc_state); } int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state) { - return crtc_state->vrr.vmax; + struct intel_display *display = to_intel_display(crtc_state); + + if (DISPLAY_VER(display) >= 13) + return crtc_state->vrr.vmax; + else + return crtc_state->vrr.vmax + + intel_vrr_vblank_delay(crtc_state); } int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state) { - /* Min vblank actually determined by flipline */ - return intel_vrr_vmin_flipline(crtc_state) - intel_vrr_vblank_exit_length(crtc_state); + return intel_vrr_vmin_vtotal(crtc_state) - intel_vrr_vblank_exit_length(crtc_state); } int intel_vrr_vmax_vblank_start(const struct intel_crtc_state *crtc_state) { - return crtc_state->vrr.vmax - intel_vrr_vblank_exit_length(crtc_state); + return intel_vrr_vmax_vtotal(crtc_state) - intel_vrr_vblank_exit_length(crtc_state); } static bool @@ -290,9 +301,18 @@ void intel_vrr_compute_config_late(struct intel_crtc_state *crtc_state) crtc_state->vrr.guardband = crtc_state->vrr.vmin - adjusted_mode->crtc_vblank_start; } else { + /* hardware imposes one extra scanline somewhere */ crtc_state->vrr.pipeline_full = min(255, crtc_state->vrr.vmin - adjusted_mode->crtc_vblank_start - crtc_state->framestart_delay - 1); + + /* + * vmin/vmax/flipline also need to be adjusted by + * the vblank delay to maintain correct vtotals. + */ + crtc_state->vrr.vmin -= intel_vrr_vblank_delay(crtc_state); + crtc_state->vrr.vmax -= intel_vrr_vblank_delay(crtc_state); + crtc_state->vrr.flipline -= intel_vrr_vblank_delay(crtc_state); } } From patchwork Tue Dec 10 21:10:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902078 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 41F7AE7717F for ; Tue, 10 Dec 2024 21:10:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D4C9E10E97C; Tue, 10 Dec 2024 21:10:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="a9AwZj+h"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 89EE510E97C for ; Tue, 10 Dec 2024 21:10: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=1733865052; x=1765401052; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=JeWF8rlH1xvOqPuectXPHir2zpCu5ulyJcn4a5Vpku4=; b=a9AwZj+hKEO5YqJLcsgWQ53NNqjHuG7EOuYVDO+3voirpUwUATjYN/1B IsmLa8OJfDNRecS8UZNfrOzcKHdiPmN+sdqhnVN79LImYPJJSDyp2h7lf GfI4haI8nMf19lxLG0SHqPV6AVfPqHPwyaFq3lS/hKgW3d7sQficsKKvc vKdwJpy2no+LAPPsDQsKUB/z1+R5IeeJeEh4T9RNFVfrn6R6YmHjXcNqz Q7GpdjOP10hn5pcBhEWOPaWd6z5vBHEtBq/sw2RU10tU8+oBMPGpxPO31 6s9uUEA+uyqVHiSK/bVag5dhqebk3OVH1I+Sk3TsMJ03d9ESYwPDt4oy2 w==; X-CSE-ConnectionGUID: eW+vmDobQzyhXOEDg3OuuA== X-CSE-MsgGUID: tW9dglM5Tn28GUU+IbbbzA== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620215" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620215" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:51 -0800 X-CSE-ConnectionGUID: q9wII1qQS06yrvkbI6hQhw== X-CSE-MsgGUID: XXNUKftaSOi/ybb0S8FOpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735136" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:50 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:48 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 15/18] drm/i915/vrr: Add extra vblank delay to estimates Date: Tue, 10 Dec 2024 23:10:04 +0200 Message-ID: <20241210211007.5976-16-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä On ICL/TGL the VRR hardware injects an extra scanline just after vactive. This essentically behaves the same as an extra line of vblank delay, except it only appears in this one specific spot. Considee our DSB interrupt signalling scheme: 1. arm the update 2. wait for undelayed vblank (or rather safe window with VRR) 3. wait for enough usecs to get past the delayed vblank 4. signal interrupt to indicate that arming has latched If step 2 waits for end of vactive step 3 needs to account for the extra one scanline, or else we risk signalling the interrupt before the delayed vblank has actuall elapsed. So include the extra scanline in our vblank delay estimates. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_vrr.c | 33 +++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index c08dd1e5cffc..98dd92316595 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -76,12 +76,33 @@ intel_vrr_check_modeset(struct intel_atomic_state *state) } } -int intel_vrr_vblank_delay(const struct intel_crtc_state *crtc_state) +static int intel_vrr_real_vblank_delay(const struct intel_crtc_state *crtc_state) { return crtc_state->hw.adjusted_mode.crtc_vblank_start - crtc_state->hw.adjusted_mode.crtc_vdisplay; } +static int intel_vrr_extra_vblank_delay(struct intel_display *display) +{ + /* + * On ICL/TGL VRR hardware inserts one extra scanline + * just after vactive, which pushes the vmin decision + * boundary ahead accordingly. We'll include the extra + * scanline in our vblank delay estimates to make sure + * that we never underestimate how long we have until + * the delayed vblank has passed. + */ + return DISPLAY_VER(display) < 13 ? 1 : 0; +} + +int intel_vrr_vblank_delay(const struct intel_crtc_state *crtc_state) +{ + struct intel_display *display = to_intel_display(crtc_state); + + return intel_vrr_real_vblank_delay(crtc_state) + + intel_vrr_extra_vblank_delay(display); +} + static int intel_vrr_flipline_offset(struct intel_display *display) { /* ICL/TGL hardware imposes flipline>=vmin+1 */ @@ -131,7 +152,7 @@ int intel_vrr_vmin_vtotal(const struct intel_crtc_state *crtc_state) return intel_vrr_vmin_flipline(crtc_state); else return intel_vrr_vmin_flipline(crtc_state) + - intel_vrr_vblank_delay(crtc_state); + intel_vrr_real_vblank_delay(crtc_state); } int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state) @@ -142,7 +163,7 @@ int intel_vrr_vmax_vtotal(const struct intel_crtc_state *crtc_state) return crtc_state->vrr.vmax; else return crtc_state->vrr.vmax + - intel_vrr_vblank_delay(crtc_state); + intel_vrr_real_vblank_delay(crtc_state); } int intel_vrr_vmin_vblank_start(const struct intel_crtc_state *crtc_state) @@ -310,9 +331,9 @@ void intel_vrr_compute_config_late(struct intel_crtc_state *crtc_state) * vmin/vmax/flipline also need to be adjusted by * the vblank delay to maintain correct vtotals. */ - crtc_state->vrr.vmin -= intel_vrr_vblank_delay(crtc_state); - crtc_state->vrr.vmax -= intel_vrr_vblank_delay(crtc_state); - crtc_state->vrr.flipline -= intel_vrr_vblank_delay(crtc_state); + crtc_state->vrr.vmin -= intel_vrr_real_vblank_delay(crtc_state); + crtc_state->vrr.vmax -= intel_vrr_real_vblank_delay(crtc_state); + crtc_state->vrr.flipline -= intel_vrr_real_vblank_delay(crtc_state); } } From patchwork Tue Dec 10 21:10:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902079 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 8AFA4E77182 for ; Tue, 10 Dec 2024 21:10:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 398CA10E97B; Tue, 10 Dec 2024 21:10:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="c143+cVK"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5588610E97E for ; Tue, 10 Dec 2024 21:10: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=1733865054; x=1765401054; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=j6u/cKqBxVI9hGnHZlyzGbb4y2xCsSdyNzfyW+CnY7k=; b=c143+cVKB1bS5JtmtOu47tVJYyD3YvYShEXmSBgjJGFgP0KskSDm03MA MtP0v+dBlnKzeu0SJ84i65lf7L7Uc/0PcvGy3ewCXvwV6OtBTQ34icW3G 8tVV9n2TdGa5s9BILySlP6zjd0Fs4k+Xb5AuWI/zCHXqI48OBbBv5UvjR Xa2cJNzTxLbUfRp95prPY9mPQd/yI264K24VI5t1tZf7Vyk+yiB8VqNAM sR24OtyU2IswNyuk7tr23ErDdNhJ4OXGUwwWT+LY8HV4MV6r3frMiTgpa mDQSm40MOOqUwl4Aol+XiDI1q59xBMuLWbzKYZMffjdBikdOICPGnDku4 A==; X-CSE-ConnectionGUID: Wb/znePyTLmoBc6ePhRc0A== X-CSE-MsgGUID: LR2qCTylSuGvb/P/F3ZFtA== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620216" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620216" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:54 -0800 X-CSE-ConnectionGUID: okf3sCJOTCWAGSUNZCuP/A== X-CSE-MsgGUID: +iYME41IRIyLGc7g46o0Eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735157" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:53 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:51 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 16/18] drm/i915/vrr: Plumb the DSB into intel_vrr_send_push() Date: Tue, 10 Dec 2024 23:10:05 +0200 Message-ID: <20241210211007.5976-17-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Plumb the DSB down into intel_vrr_send_push() so that we can perform the opration on the DSB. TRANS_PUSH, being a transcoder register, needs non-posted writes to make it through. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_crtc.c | 2 +- drivers/gpu/drm/i915/display/intel_vrr.c | 14 +++++++++++--- drivers/gpu/drm/i915/display/intel_vrr.h | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c index a2c528d707f4..3bb57a74b333 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc.c +++ b/drivers/gpu/drm/i915/display/intel_crtc.c @@ -713,7 +713,7 @@ void intel_pipe_update_end(struct intel_atomic_state *state, * which would cause the next frame to terminate already at vmin * vblank start instead of vmax vblank start. */ - intel_vrr_send_push(new_crtc_state); + intel_vrr_send_push(NULL, new_crtc_state); local_irq_enable(); diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c index 98dd92316595..d589a62fcfed 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.c +++ b/drivers/gpu/drm/i915/display/intel_vrr.c @@ -391,7 +391,8 @@ void intel_vrr_set_transcoder_timings(const struct intel_crtc_state *crtc_state) crtc_state->vrr.flipline - 1); } -void intel_vrr_send_push(const struct intel_crtc_state *crtc_state) +void intel_vrr_send_push(struct intel_dsb *dsb, + const struct intel_crtc_state *crtc_state) { struct intel_display *display = to_intel_display(crtc_state); enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; @@ -399,8 +400,15 @@ void intel_vrr_send_push(const struct intel_crtc_state *crtc_state) if (!crtc_state->vrr.enable) return; - intel_de_write(display, TRANS_PUSH(display, cpu_transcoder), - TRANS_PUSH_EN | TRANS_PUSH_SEND); + if (dsb) + intel_dsb_nonpost_start(dsb); + + intel_de_write_dsb(display, dsb, + TRANS_PUSH(display, cpu_transcoder), + TRANS_PUSH_EN | TRANS_PUSH_SEND); + + if (dsb) + intel_dsb_nonpost_end(dsb); } bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state) diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h index 8e8961adce39..899cbf40f880 100644 --- a/drivers/gpu/drm/i915/display/intel_vrr.h +++ b/drivers/gpu/drm/i915/display/intel_vrr.h @@ -12,6 +12,7 @@ struct drm_connector_state; struct intel_atomic_state; struct intel_connector; struct intel_crtc_state; +struct intel_dsb; bool intel_vrr_is_capable(struct intel_connector *connector); bool intel_vrr_is_in_range(struct intel_connector *connector, int vrefresh); @@ -22,7 +23,8 @@ void intel_vrr_compute_config(struct intel_crtc_state *crtc_state, void intel_vrr_compute_config_late(struct intel_crtc_state *crtc_state); void intel_vrr_set_transcoder_timings(const struct intel_crtc_state *crtc_state); void intel_vrr_enable(const struct intel_crtc_state *crtc_state); -void intel_vrr_send_push(const struct intel_crtc_state *crtc_state); +void intel_vrr_send_push(struct intel_dsb *dsb, + const struct intel_crtc_state *crtc_state); bool intel_vrr_is_push_sent(const struct intel_crtc_state *crtc_state); void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state); void intel_vrr_get_config(struct intel_crtc_state *crtc_state); From patchwork Tue Dec 10 21:10:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902080 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 90E49E77182 for ; Tue, 10 Dec 2024 21:10:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE63210E98E; Tue, 10 Dec 2024 21:10:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="MfaMnvAw"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10BD610E98A for ; Tue, 10 Dec 2024 21:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865057; x=1765401057; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Tt44BQJrqupArjxUAHTn8yRV06ot1m2sy2wq9vj39+c=; b=MfaMnvAwFAxq8nRzzH1jkrouHaCzW7g2xRsTn6iZfGQf846IfvJDRkZm GK2iu4f8R2kUoS7wG+QmiV//svZZZuLT9rPklu4YxZ6YBQsMMKKUxOqKq 1yWDJs3y0K0j+azXQS2ObCiQKdX3wxWXZG6I3p5W4rVYSBFxsgux5buhr LCYmOYS6K+vmgYeJttgerf2lyCRqLCZshoHVNQqkgEIhWQqfRle1EPv8F MfOqaZO50Y4w9t8FHMxzwkCgVuaIy8sRoyud8pE26as6cEZLH6DZAFaOw iZ0AFIf53rw38HnT4gAwPIXJUSBCvrwPQZD3TJVApVIZXWnCSVc08wuOL A==; X-CSE-ConnectionGUID: RrIT1kGfTjutPhX5qT+iXQ== X-CSE-MsgGUID: uhGCntxbTjSkaaMMGrnGUA== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620222" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620222" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:10:57 -0800 X-CSE-ConnectionGUID: srD6HsigQym/5adIFtbAbg== X-CSE-MsgGUID: odyUsT6ZTIiHXVlAA1CK4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735161" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:56 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:54 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 17/18] drm/i915/dsb: Add support for triggering VRR push with DSB Date: Tue, 10 Dec 2024 23:10:06 +0200 Message-ID: <20241210211007.5976-18-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä We have at least two options for how to do the TRANS_PUSH_SEND + commit completion signalling with the DSB: Option A) 1. trigger TRANS_PUSH_SEND 2. wait for "safe window" 3. signal the interrupt In this cases step 2 should not do anything if we were already between vmin and vmax decision boundaries. Otherwise we'll wait until the next start of the vblank period. Option B) 1. wait for "safe window" 2. trigger TRANS_PUSH_SEND 3. signal the interrupt This option is perhaps a bit less racy, but if we do somehow screw up and the wait is a nop but the push gets deferred until the next frame then we'll end up completing the commit a frame too early. So for now I'm leaning towards option A since losing the race won't have any drastic consequences. To deal with the race we can give the DSB a bit more time to start step 2 before the hardware has started the vblank termination properly. Often times it seems to be fast enough to make it in time even without any extra vblank delay (the push is issued somewhere within a scanline and it latches on the next scanline). Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 22b5eacda0f0..4b3199dcbe7a 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -2630,6 +2630,14 @@ static int intel_crtc_vblank_delay(const struct intel_crtc_state *crtc_state) if (intel_crtc_needs_wa_14015401596(crtc_state)) vblank_delay = max(vblank_delay, 1); + /* + * Add a minimal vblank delay to make sure the push + * doesn't doesn't race with the "wait for safe + * window" we use for frame completion with DSB. + */ + if (HAS_VRR(display)) + vblank_delay = max(vblank_delay, 1); + return vblank_delay; } @@ -7725,6 +7733,8 @@ static void intel_atomic_dsb_finish(struct intel_atomic_state *state, intel_crtc_planes_update_arm(new_crtc_state->dsb_commit, state, crtc); + intel_vrr_send_push(new_crtc_state->dsb_commit, new_crtc_state); + if (!new_crtc_state->dsb_color_vblank) { intel_dsb_wait_vblanks(new_crtc_state->dsb_commit, 1); intel_dsb_wait_vblank_delay(state, new_crtc_state->dsb_commit); From patchwork Tue Dec 10 21:10:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13902081 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 0BE83E77180 for ; Tue, 10 Dec 2024 21:11:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BB5D10E98B; Tue, 10 Dec 2024 21:11:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="nyD621mJ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id E29F110E98A for ; Tue, 10 Dec 2024 21:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733865060; x=1765401060; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=pYKv7xZ6Zn7EBaQgM+ZPBkYQJ9M/0BlZz1eDh32rthg=; b=nyD621mJCl77zZp2IFZv74o0Dd3jwYANSxKsqsMCRBCVM+/QN3SrY+XZ 4zx+UBKbHAGmdbryPSKrPiNkh8ak/haB+TAvUEvDm/vraM32UPOENMo64 rBpjg5kGJGnCyZu1QA//LrtdYeZtWBTPYNIyxh9C8z7sVWmdRZq/ySBND T52QiMRhtYcGOWjL+MSnQ23g56Rv9w5rc3HIex0FKPI/1w6yk0UfyhddX T1g8Fi8isTGrl5h0f4Z7l0zwicl5c0BQbu1CiLqS0/1exhOp+wiIiDohq W82XGEtutZyQrHwCDfO+7iHD4Al1lay2AMtmlRAWfog+2uhvDdKKxtHMn Q==; X-CSE-ConnectionGUID: oPA4b2GHQU6jlXdbWf2bpQ== X-CSE-MsgGUID: roYzxQX/SiqLcp9ET4uO5w== X-IronPort-AV: E=McAfee;i="6700,10204,11282"; a="59620239" X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="59620239" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2024 13:11:00 -0800 X-CSE-ConnectionGUID: G5dDXYNqQY+4y+ezKODgIQ== X-CSE-MsgGUID: XdcnwGleQFSocUXyMstJ8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,223,1728975600"; d="scan'208";a="95735166" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by fmviesa008.fm.intel.com with SMTP; 10 Dec 2024 13:10:58 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 10 Dec 2024 23:10:57 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Subject: [PATCH 18/18] drm/i915/dsb: Allow DSB to perform commits when VRR is enabled Date: Tue, 10 Dec 2024 23:10:07 +0200 Message-ID: <20241210211007.5976-19-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241210211007.5976-1-ville.syrjala@linux.intel.com> References: <20241210211007.5976-1-ville.syrjala@linux.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" From: Ville Syrjälä Now that we know how to issue the push with the DSB we can allow the DSB to drive the commits even when VRR is active. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 4b3199dcbe7a..171f65e5be9d 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -7692,7 +7692,6 @@ static void intel_atomic_dsb_finish(struct intel_atomic_state *state, /* FIXME deal with everything */ new_crtc_state->use_dsb = new_crtc_state->update_planes && - !new_crtc_state->vrr.enable && !new_crtc_state->do_async_flip && !new_crtc_state->has_psr && !new_crtc_state->scaler_state.scaler_users &&