From patchwork Tue Oct 29 11:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13854767 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 7B9DBD2AB1F for ; Tue, 29 Oct 2024 11:33:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8953110E635; Tue, 29 Oct 2024 11:33:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="R4CwbTR/"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id D956410E634; Tue, 29 Oct 2024 11:33:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730201582; x=1761737582; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A5SAkPEjvKF/S8qSBd5k/MLODacL5P0pht3IqsMDUwE=; b=R4CwbTR/iJhWHZP5QChmAIn18YITd55fMe3lmJ4RN0fbiv0f7Eul2+Nv W/bhKyWqhnbGtxjaa9wVALh1hECy1gaYabiq2aMSysTYaUWAXLpnco+xq b1balHajEEZ506As65sTqXHqQ2Z7i+UOjEee+386RUwE0SlUu45xc1vsx y2pKjEwsT0k7D7wR96KbsoQIUpO6GDHLXRvz5chQQMUtbTBCE1v8sZKsc me25cOZQdk+nVv92owqadJHNtAFJ5FTn/vbWI7PPYz6NKIndk8mU+YOmJ B8V+a+BZ00Gf7aafmiO8y+CC23I/nJ+wcGygUaEMzb01nFSpZrJldczMu w==; X-CSE-ConnectionGUID: czYo0Un+SXiGoCSli1wrCg== X-CSE-MsgGUID: fiEsJqIUQ1CjV6WHj1mUbg== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="33535753" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="33535753" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 04:33:02 -0700 X-CSE-ConnectionGUID: Xl8vIX9aQomkDkMluVT5qQ== X-CSE-MsgGUID: j/WmA+RpReGs6nCDsFhxng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,241,1725346800"; d="scan'208";a="86699639" Received: from bergbenj-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.69]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 04:32:59 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@intel.com, =?utf-8?q?Jouni_H=C3=B6gander?= , Suraj Kandpal Subject: [PATCH 1/3] drm/i915/psr: add LATENCY_REPORTING_REMOVED() register bit helper Date: Tue, 29 Oct 2024 13:32:48 +0200 Message-Id: <22934fee1ea37c777c35e4b520d5f11b6cd953d0.1730201504.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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" Drop the wa_16013835468_bit_get() function in favour of the register macro. It doesn't have to be so complicated, and we don't have to use the workaround name in everything that's related to it. Cc: Jouni Högander Cc: Suraj Kandpal Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_psr.c | 24 ++++-------------------- drivers/gpu/drm/i915/i915_reg.h | 13 +++++++++---- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index 880ea845207f..e018a0868009 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -1773,23 +1773,6 @@ static void intel_psr_activate(struct intel_dp *intel_dp) intel_dp->psr.active = true; } -static u32 wa_16013835468_bit_get(struct intel_dp *intel_dp) -{ - switch (intel_dp->psr.pipe) { - case PIPE_A: - return LATENCY_REPORTING_REMOVED_PIPE_A; - case PIPE_B: - return LATENCY_REPORTING_REMOVED_PIPE_B; - case PIPE_C: - return LATENCY_REPORTING_REMOVED_PIPE_C; - case PIPE_D: - return LATENCY_REPORTING_REMOVED_PIPE_D; - default: - MISSING_CASE(intel_dp->psr.pipe); - return 0; - } -} - /* * Wa_16013835468 * Wa_14015648006 @@ -1798,6 +1781,7 @@ static void wm_optimization_wa(struct intel_dp *intel_dp, const struct intel_crtc_state *crtc_state) { struct intel_display *display = to_intel_display(intel_dp); + enum pipe pipe = intel_dp->psr.pipe; bool set_wa_bit = false; /* Wa_14015648006 */ @@ -1811,10 +1795,10 @@ static void wm_optimization_wa(struct intel_dp *intel_dp, if (set_wa_bit) intel_de_rmw(display, GEN8_CHICKEN_DCPR_1, - 0, wa_16013835468_bit_get(intel_dp)); + 0, LATENCY_REPORTING_REMOVED(pipe)); else intel_de_rmw(display, GEN8_CHICKEN_DCPR_1, - wa_16013835468_bit_get(intel_dp), 0); + LATENCY_REPORTING_REMOVED(pipe), 0); } static void intel_psr_enable_source(struct intel_dp *intel_dp, @@ -2105,7 +2089,7 @@ static void intel_psr_disable_locked(struct intel_dp *intel_dp) */ if (DISPLAY_VER(display) >= 11) intel_de_rmw(display, GEN8_CHICKEN_DCPR_1, - wa_16013835468_bit_get(intel_dp), 0); + LATENCY_REPORTING_REMOVED(intel_dp->psr.pipe), 0); if (intel_dp->psr.sel_update_enabled) { /* Wa_16012604467:adlp,mtl[a0,b0] */ diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 405f409e9761..a51dab9c4978 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2861,11 +2861,16 @@ #define RESET_PCH_HANDSHAKE_ENABLE REG_BIT(4) #define GEN8_CHICKEN_DCPR_1 _MMIO(0x46430) -#define LATENCY_REPORTING_REMOVED_PIPE_D REG_BIT(31) +#define _LATENCY_REPORTING_REMOVED_PIPE_D REG_BIT(31) #define SKL_SELECT_ALTERNATE_DC_EXIT REG_BIT(30) -#define LATENCY_REPORTING_REMOVED_PIPE_C REG_BIT(25) -#define LATENCY_REPORTING_REMOVED_PIPE_B REG_BIT(24) -#define LATENCY_REPORTING_REMOVED_PIPE_A REG_BIT(23) +#define _LATENCY_REPORTING_REMOVED_PIPE_C REG_BIT(25) +#define _LATENCY_REPORTING_REMOVED_PIPE_B REG_BIT(24) +#define _LATENCY_REPORTING_REMOVED_PIPE_A REG_BIT(23) +#define LATENCY_REPORTING_REMOVED(pipe) _PICK((pipe), \ + _LATENCY_REPORTING_REMOVED_PIPE_A, \ + _LATENCY_REPORTING_REMOVED_PIPE_B, \ + _LATENCY_REPORTING_REMOVED_PIPE_C, \ + _LATENCY_REPORTING_REMOVED_PIPE_D) #define ICL_DELAY_PMRSP REG_BIT(22) #define DISABLE_FLR_SRC REG_BIT(15) #define MASK_WAKEMEM REG_BIT(13) From patchwork Tue Oct 29 11:32:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13854768 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 93F14D2AB20 for ; Tue, 29 Oct 2024 11:33:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 86D9310E637; Tue, 29 Oct 2024 11:33:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Vi4pNJ1n"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4788310E637; Tue, 29 Oct 2024 11:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730201588; x=1761737588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1yNhVENzWjqbuAg7/MpsAWhtvRVATN7eCmdNw5zqmoU=; b=Vi4pNJ1nATH69+6irzD3XM58SvJDNMQJXv/4X/SDW391yTs14O6HkEXh DKl37O2swoubE7RRoiimKoNHN9btPqTysZG6+zCwsU8hZ8St3e5yZqqGN o30vWBMtxisb94RcnvG0XTIQeYPFRegVeGDgv+OtfSF1fhKkyXxvjMj62 7Y2KsEEY7PGyJXrIVCs2z/K08pXZxSMuxx5vJrDBNCjJpRJwJBQheCAqX 5vfUdCdyZoCz7ysdehab9W/w02p6QUC/d9TYKTQLWWOaq5CDAULEIxNnN ZRFqqGFrTUxHTAEMKFh7eqsejl++ewKwaQpS0/p7HUeblu60oRU3B1BOX g==; X-CSE-ConnectionGUID: Jq0mguNmQcKxaZ1+qFVrBQ== X-CSE-MsgGUID: eFbdtw6WSQ2EWPRjvcj35w== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="33535764" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="33535764" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 04:33:07 -0700 X-CSE-ConnectionGUID: 3yR/Dg/IQ4SnoNmH/jsd6A== X-CSE-MsgGUID: hXMFs34kRgW33+prNcV2jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,241,1725346800"; d="scan'208";a="86699665" Received: from bergbenj-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.69]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 04:33:05 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@intel.com, =?utf-8?q?Jouni_H=C3=B6gander?= , Suraj Kandpal Subject: [PATCH 2/3] drm/i915/psr: stop using bitwise OR with booleans in wm_optimization_wa() Date: Tue, 29 Oct 2024 13:32:49 +0200 Message-Id: X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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" Bitwise OR for booleans is a bit of an abuse. We can trivially drop the usage. Cc: Jouni Högander Cc: Suraj Kandpal Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_psr.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index e018a0868009..02f31c7b254b 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -1782,18 +1782,19 @@ static void wm_optimization_wa(struct intel_dp *intel_dp, { struct intel_display *display = to_intel_display(intel_dp); enum pipe pipe = intel_dp->psr.pipe; - bool set_wa_bit = false; + bool activate = false; /* Wa_14015648006 */ - if (IS_DISPLAY_VER(display, 11, 14)) - set_wa_bit |= crtc_state->wm_level_disabled; + if (IS_DISPLAY_VER(display, 11, 14) && crtc_state->wm_level_disabled) + activate = true; /* Wa_16013835468 */ - if (DISPLAY_VER(display) == 12) - set_wa_bit |= crtc_state->hw.adjusted_mode.crtc_vblank_start != - crtc_state->hw.adjusted_mode.crtc_vdisplay; + if (DISPLAY_VER(display) == 12 && + crtc_state->hw.adjusted_mode.crtc_vblank_start != + crtc_state->hw.adjusted_mode.crtc_vdisplay) + activate = true; - if (set_wa_bit) + if (activate) intel_de_rmw(display, GEN8_CHICKEN_DCPR_1, 0, LATENCY_REPORTING_REMOVED(pipe)); else From patchwork Tue Oct 29 11:32:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13854769 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 98BA7D2AB20 for ; Tue, 29 Oct 2024 11:33:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C5CF10E638; Tue, 29 Oct 2024 11:33:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FeHlVPUa"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51AC310E638; Tue, 29 Oct 2024 11:33: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=1730201593; x=1761737593; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oSgxdArGT1jwZfCiC5Xv7S4xU6wwGT+rhvnWWccLchs=; b=FeHlVPUaeE0nmUC4BTa61228TB+3yHwZyTnoFxlYFW+N/uCStvP3O0Mr dobcdwXgID4zsloTl+xZNG0PF/Yr4wgEmYdmW4egE7xCM+2too6UIZR0t 8DuxnpNL3RpDAkNH+HUce5tppanH9b6nnjSqptuVOPw5SpmxWq2w9vjKR rIl3Ci/RF1Fs5caohpY+xvMQ13rHLKzoTPiXx2hc9VS9VuSEmH+LbOYq5 bohPXac7fNfq8HOyVIegZqn54gsD0HMX4ten1zs7iJPFNxfYEY8XoZ2xM VV1F+5TXbMU1WJEwR2wn8gqIr7CCv+g5RyfrswbrwemHrM/H15KJ0C/7T Q==; X-CSE-ConnectionGUID: hZVqznq3TROoZbu5s0oOAA== X-CSE-MsgGUID: 8kXwFpY6SrGSDWV0fzVqGA== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="40934532" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="40934532" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 04:33:12 -0700 X-CSE-ConnectionGUID: 0VnKeAi4QI2qg2MqsMQE/A== X-CSE-MsgGUID: AUAsswVpRjK6WFHM7oGPwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,241,1725346800"; d="scan'208";a="112736835" Received: from bergbenj-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.69]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 04:33:10 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@intel.com, =?utf-8?q?Jouni_H=C3=B6gander?= , Suraj Kandpal Subject: [PATCH 3/3] drm/i915/psr: clarify intel_psr_pre_plane_update() conditions Date: Tue, 29 Oct 2024 13:32:50 +0200 Message-Id: X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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" Make the conditions easier to follow. We don't do anything for !psr->enabled, so hoist psr->enabled check higher, avoiding all the checks when !psr->enabled. Stop the bitwise OR abuse on booleans by removing the temporary variable altogether. Cc: Jouni Högander Cc: Suraj Kandpal Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_psr.c | 45 ++++++++++++------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index 02f31c7b254b..80485828729f 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -2766,32 +2766,31 @@ void intel_psr_pre_plane_update(struct intel_atomic_state *state, old_crtc_state->uapi.encoder_mask) { struct intel_dp *intel_dp = enc_to_intel_dp(encoder); struct intel_psr *psr = &intel_dp->psr; - bool needs_to_disable = false; mutex_lock(&psr->lock); - /* - * Reasons to disable: - * - PSR disabled in new state - * - All planes will go inactive - * - Changing between PSR versions - * - Region Early Transport changing - * - Display WA #1136: skl, bxt - */ - needs_to_disable |= intel_crtc_needs_modeset(new_crtc_state); - needs_to_disable |= !new_crtc_state->has_psr; - needs_to_disable |= !new_crtc_state->active_planes; - needs_to_disable |= new_crtc_state->has_sel_update != psr->sel_update_enabled; - needs_to_disable |= new_crtc_state->enable_psr2_su_region_et != - psr->su_region_et_enabled; - needs_to_disable |= DISPLAY_VER(i915) < 11 && - new_crtc_state->wm_level_disabled; - - if (psr->enabled && needs_to_disable) - intel_psr_disable_locked(intel_dp); - else if (psr->enabled && new_crtc_state->wm_level_disabled) - /* Wa_14015648006 */ - wm_optimization_wa(intel_dp, new_crtc_state); + if (psr->enabled) { + /* + * Reasons to disable: + * - PSR disabled in new state + * - All planes will go inactive + * - Changing between PSR versions + * - Region Early Transport changing + * - Display WA #1136: skl, bxt + */ + if (intel_crtc_needs_modeset(new_crtc_state) || + !new_crtc_state->has_psr || + !new_crtc_state->active_planes || + new_crtc_state->has_sel_update != psr->sel_update_enabled || + new_crtc_state->enable_psr2_su_region_et != + psr->su_region_et_enabled || + (DISPLAY_VER(i915) < 11 && new_crtc_state->wm_level_disabled)) { + intel_psr_disable_locked(intel_dp); + } else if (new_crtc_state->wm_level_disabled) { + /* Wa_14015648006 */ + wm_optimization_wa(intel_dp, new_crtc_state); + } + } mutex_unlock(&psr->lock); }