From patchwork Wed Nov 20 05:38:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nemesa Garg X-Patchwork-Id: 13880699 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 E221BD6E2BA for ; Wed, 20 Nov 2024 05:37:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8657E10E386; Wed, 20 Nov 2024 05:37:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="RuDQKZ4b"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A10C10E386; Wed, 20 Nov 2024 05:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732081050; x=1763617050; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wl4TMLDN9lE72zXqezGck4NFV8tWfBeDeFqs0+g1mjI=; b=RuDQKZ4bfWUrr+1nIZucg6heTfmmDr1r3m2N5Q668Qcp8D8cwhrVtUW1 UnDBQn7eo/nEsLIq6RcCUE6e6Bgc4UqHK6Ab3XCbcVNS/GCOjNvbLGETj GIl1dyyEY8eFfBOe5aFf2QCRYst9On1Doh52pSTVDb/hpB6veA5muslSk N9K1cXCdLOox7kzEvxvazjTcvOMxI5nQgGJ/KoLbkCCoOcCcnVM+YlU9f YQhuLRpsi25V4oEnEedjcba7y1yTmgYorUVfOe6DoDK0RcoD196D4FVt8 WFoC9X1GsH07VLyDr6mTPRYY3nzI9MIn/t5Sx7jZ4RABLS3VBGCzGw/0n Q==; X-CSE-ConnectionGUID: uiCY9SouTsSodCKZGuWm7Q== X-CSE-MsgGUID: 1AdkXTtASEidsC+Wn69NXg== X-IronPort-AV: E=McAfee;i="6700,10204,11261"; a="32179431" X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="32179431" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2024 21:37:30 -0800 X-CSE-ConnectionGUID: 4PDuqunzQceYZ/0ZT1nf2g== X-CSE-MsgGUID: Ay23HVfFTk6/rplIuTKShQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="120748929" Received: from nemesa.iind.intel.com ([10.190.239.22]) by fmviesa001.fm.intel.com with ESMTP; 19 Nov 2024 21:37:29 -0800 From: Nemesa Garg To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Nemesa Garg Subject: [PATCH 1/6] drm/i915/display: Disable joiner and pfit Date: Wed, 20 Nov 2024 11:08:33 +0530 Message-Id: <20241120053838.3794419-2-nemesa.garg@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241120053838.3794419-1-nemesa.garg@intel.com> References: <20241120053838.3794419-1-nemesa.garg@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" Disable panel fitting if joiner is enabled as backporting of joiner part is required in case of pfit. Signed-off-by: Nemesa Garg --- drivers/gpu/drm/i915/display/intel_pfit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_pfit.c b/drivers/gpu/drm/i915/display/intel_pfit.c index 50861aa78a89..e214e19f8174 100644 --- a/drivers/gpu/drm/i915/display/intel_pfit.c +++ b/drivers/gpu/drm/i915/display/intel_pfit.c @@ -187,6 +187,9 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state, int pipe_src_h = drm_rect_height(&crtc_state->pipe_src); int ret, x, y, width, height; + if (crtc_state->joiner_pipes) + return 0; + /* Native modes don't need fitting */ if (adjusted_mode->crtc_hdisplay == pipe_src_w && adjusted_mode->crtc_vdisplay == pipe_src_h && From patchwork Wed Nov 20 05:38:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nemesa Garg X-Patchwork-Id: 13880700 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 02EEDD6E2BC for ; Wed, 20 Nov 2024 05:37:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A022110E388; Wed, 20 Nov 2024 05:37:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="C4R4yEN3"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69D7810E388; Wed, 20 Nov 2024 05:37: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=1732081052; x=1763617052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SodqNQkygMJVP8ixIYgvCMg8l0cI2pCT9TWvXlwGr9k=; b=C4R4yEN3sVP9jVciXOdM8ODC1y4SYlD96oeCw6alfbNbfc3C9uaoJ9qq Uuc5MTU3RFHlkK5XI1vtRzsxbiY8JwAY7taVzOMQi5uJXmmbcfMSTr068 x2Hif7y2eQvi1P3h1bYTy6HT0lv3zl/dLm3x6KMZcmrELBxMzWTiPZ6Vj /W3IXn0z1oLMLKpImTzGWlTEJwHq1JjU4eIpwWrRCdco+eyZO9bOLijpV S5AVPv6oguS9XQjh3jnx/4TWClvA7FC1rvcLxHoQor22F3jfPdJH1RQnq etITiJS+qJrSBgY5GIpHPXDkN3kgtohkqGRZUaryoZYYBVu0S2hJhXvRw Q==; X-CSE-ConnectionGUID: POcgyjPfTxWXVFR6R8D66w== X-CSE-MsgGUID: foTCqQUSTnaBZyYucxahug== X-IronPort-AV: E=McAfee;i="6700,10204,11261"; a="32179433" X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="32179433" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2024 21:37:32 -0800 X-CSE-ConnectionGUID: hHBLG2CZRmKmb3VCuPrp/Q== X-CSE-MsgGUID: 6lcUQ7K2TtynSRjyE46KKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="120748936" Received: from nemesa.iind.intel.com ([10.190.239.22]) by fmviesa001.fm.intel.com with ESMTP; 19 Nov 2024 21:37:31 -0800 From: Nemesa Garg To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Nemesa Garg Subject: [PATCH v5 2/6] drm/i915/display: Add gmch_panel_fitting in all encoders Date: Wed, 20 Nov 2024 11:08:34 +0530 Message-Id: <20241120053838.3794419-3-nemesa.garg@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241120053838.3794419-1-nemesa.garg@intel.com> References: <20241120053838.3794419-1-nemesa.garg@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" For all encoders add gmch_panel_fitting and remove pch_panel_fitting as it will be called from pipe_config after joiner calculation is done. -v5: Nuke GMCH check from few places [Ville] Signed-off-by: Nemesa Garg --- drivers/gpu/drm/i915/display/icl_dsi.c | 4 ---- drivers/gpu/drm/i915/display/intel_dp.c | 6 +++--- drivers/gpu/drm/i915/display/intel_hdmi.c | 6 ------ drivers/gpu/drm/i915/display/intel_lvds.c | 10 ++++++---- drivers/gpu/drm/i915/display/intel_pfit.c | 15 ++++++++------- drivers/gpu/drm/i915/display/intel_pfit.h | 6 ++++-- drivers/gpu/drm/i915/display/vlv_dsi.c | 9 ++++++--- 7 files changed, 27 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 74ab3d1a1622..30c2393d9f30 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -1651,10 +1651,6 @@ static int gen11_dsi_compute_config(struct intel_encoder *encoder, if (ret) return ret; - ret = intel_panel_fitting(pipe_config, conn_state); - if (ret) - return ret; - adjusted_mode->flags = 0; /* Dual link goes to trancoder DSI'0' */ diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 053a9a4182e7..0b1ff6291e74 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -3090,6 +3090,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config, struct drm_connector_state *conn_state) { + struct intel_display *display = to_intel_display(encoder); struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); struct intel_atomic_state *state = to_intel_atomic_state(conn_state->state); struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode; @@ -3131,9 +3132,8 @@ intel_dp_compute_config(struct intel_encoder *encoder, if (ret) return ret; - if ((intel_dp_is_edp(intel_dp) && fixed_mode) || - pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) { - ret = intel_panel_fitting(pipe_config, conn_state); + if (HAS_GMCH(display)) { + ret = intel_gmch_panel_fitting(pipe_config, conn_state); if (ret) return ret; } diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 23c270a8c4aa..20fb1bd44b4f 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -2374,12 +2374,6 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder, return ret; } - if (intel_hdmi_is_ycbcr420(pipe_config)) { - ret = intel_panel_fitting(pipe_config, conn_state); - if (ret) - return ret; - } - pipe_config->limited_color_range = intel_hdmi_limited_color_range(pipe_config, conn_state); diff --git a/drivers/gpu/drm/i915/display/intel_lvds.c b/drivers/gpu/drm/i915/display/intel_lvds.c index 6d7637ad980a..92f0b7b76cc7 100644 --- a/drivers/gpu/drm/i915/display/intel_lvds.c +++ b/drivers/gpu/drm/i915/display/intel_lvds.c @@ -416,6 +416,7 @@ static int intel_lvds_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct intel_display *display = to_intel_display(encoder); struct drm_i915_private *i915 = to_i915(encoder->base.dev); struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(encoder); struct intel_connector *connector = lvds_encoder->attached_connector; @@ -465,10 +466,11 @@ static int intel_lvds_compute_config(struct intel_encoder *encoder, if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) return -EINVAL; - ret = intel_panel_fitting(crtc_state, conn_state); - if (ret) - return ret; - + if (HAS_GMCH(display)) { + ret = intel_gmch_panel_fitting(crtc_state, conn_state); + if (ret) + return ret; + } /* * XXX: It would be nice to support lower refresh rates on the * panels to reduce power consumption, and perhaps match the diff --git a/drivers/gpu/drm/i915/display/intel_pfit.c b/drivers/gpu/drm/i915/display/intel_pfit.c index e214e19f8174..fb6387b537b7 100644 --- a/drivers/gpu/drm/i915/display/intel_pfit.c +++ b/drivers/gpu/drm/i915/display/intel_pfit.c @@ -545,13 +545,14 @@ static int gmch_panel_fitting(struct intel_crtc_state *crtc_state, return intel_gmch_pfit_check_timings(crtc_state); } -int intel_panel_fitting(struct intel_crtc_state *crtc_state, - const struct drm_connector_state *conn_state) +int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state) { - struct intel_display *display = to_intel_display(crtc_state); + return gmch_panel_fitting(crtc_state, conn_state); +} - if (HAS_GMCH(display)) - return gmch_panel_fitting(crtc_state, conn_state); - else - return pch_panel_fitting(crtc_state, conn_state); +int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state) +{ + return pch_panel_fitting(crtc_state, conn_state); } diff --git a/drivers/gpu/drm/i915/display/intel_pfit.h b/drivers/gpu/drm/i915/display/intel_pfit.h index add8d78de2c9..1365ab86c89c 100644 --- a/drivers/gpu/drm/i915/display/intel_pfit.h +++ b/drivers/gpu/drm/i915/display/intel_pfit.h @@ -9,7 +9,9 @@ struct drm_connector_state; struct intel_crtc_state; -int intel_panel_fitting(struct intel_crtc_state *crtc_state, - const struct drm_connector_state *conn_state); +int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state); +int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state); #endif /* __INTEL_PFIT_H__ */ diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c index d49e9b3c7627..6de10f5722b4 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -269,6 +269,7 @@ static int intel_dsi_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config, struct drm_connector_state *conn_state) { + struct intel_display *display = to_intel_display(encoder); struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder); struct intel_connector *intel_connector = intel_dsi->attached_connector; @@ -283,9 +284,11 @@ static int intel_dsi_compute_config(struct intel_encoder *encoder, if (ret) return ret; - ret = intel_panel_fitting(pipe_config, conn_state); - if (ret) - return ret; + if (HAS_GMCH(display)) { + ret = intel_gmch_panel_fitting(pipe_config, conn_state); + if (ret) + return ret; + } if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) return -EINVAL; From patchwork Wed Nov 20 05:38:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nemesa Garg X-Patchwork-Id: 13880701 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 E2F60D6E2B9 for ; Wed, 20 Nov 2024 05:37:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8312310E389; Wed, 20 Nov 2024 05:37:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="L2s++SLq"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id D510610E389; Wed, 20 Nov 2024 05:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732081055; x=1763617055; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aG4+RreF/+ksPqP6xBUVVs286sSs20EeOg7lFBu2y5E=; b=L2s++SLqimmDD87kX8NEySTMv9OT1YcNTqGfcT9zamqTouKBS9Uwh1LK QQd9kshqCjg+5FBIWlMye08EUW1KRb9Ya/eegVTsThyyAxPT6e7O2Xn6O Y/W84iFpIxSTssnR2bZtGGpQg15do4dzjz84IpGsp6W7C8fBJOUrGBPfI o+aEccGn7RyNzCMu1ZVzJM8grKT+i7ktSFijZa+cyJJ02wNOn0mVDihmA ij0bHbzzEiIbYnN4lRoiypQw62dxgxsIWFu3JkNZqiHmraWziT+EdqGdk ORNKm/S90NBYFexXHYONIC73RyJkJOjYeXVNaR+Ch8uV4rQgmvj9i6HvM Q==; X-CSE-ConnectionGUID: eefoH9y6TOOMGwEH5DbikQ== X-CSE-MsgGUID: 6+5Mm91kQGWmdW+39TmYrA== X-IronPort-AV: E=McAfee;i="6700,10204,11261"; a="32179441" X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="32179441" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2024 21:37:35 -0800 X-CSE-ConnectionGUID: 7LDI+gw1TUSZ6QVBzKTyLQ== X-CSE-MsgGUID: v/xEZDMqQQidrMWhSzQSBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="120748952" Received: from nemesa.iind.intel.com ([10.190.239.22]) by fmviesa001.fm.intel.com with ESMTP; 19 Nov 2024 21:37:33 -0800 From: Nemesa Garg To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Nemesa Garg Subject: [PATCH 3/6] drm/i915/display: Replace adjusted mode with pipe mode Date: Wed, 20 Nov 2024 11:08:35 +0530 Message-Id: <20241120053838.3794419-4-nemesa.garg@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241120053838.3794419-1-nemesa.garg@intel.com> References: <20241120053838.3794419-1-nemesa.garg@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" Replace adjusted_mode with pipe_mode in pch_panel_fitting so as to that final pipe src width and height is used after joiner calculation. De-couple the current intel_panel_fitting function, one pre-ilk and one post-ilk, as post-ilk pch_panel_fitting is called from pipe_config. Signed-off-by: Nemesa Garg --- drivers/gpu/drm/i915/display/intel_display.c | 7 +++ drivers/gpu/drm/i915/display/intel_pfit.c | 59 +++++++++++++------- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 9db255bb1230..6ad47cf0d419 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -4865,6 +4865,13 @@ copy_joiner_crtc_state_modeset(struct intel_atomic_state *state, drm_dp_tunnel_ref_get(primary_crtc_state->dp_tunnel_ref.tunnel, &secondary_crtc_state->dp_tunnel_ref); + if (secondary_crtc_state->pch_pfit.enabled) { + struct drm_rect *dst = &secondary_crtc_state->pch_pfit.dst; + int y = dst->y1; + + drm_rect_translate_to(dst, 0, y); + } + copy_joiner_crtc_state_nomodeset(state, secondary_crtc); secondary_crtc_state->uapi.mode_changed = primary_crtc_state->uapi.mode_changed; diff --git a/drivers/gpu/drm/i915/display/intel_pfit.c b/drivers/gpu/drm/i915/display/intel_pfit.c index fb6387b537b7..b2619e1c4021 100644 --- a/drivers/gpu/drm/i915/display/intel_pfit.c +++ b/drivers/gpu/drm/i915/display/intel_pfit.c @@ -181,18 +181,19 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state) { struct intel_display *display = to_intel_display(crtc_state); - const struct drm_display_mode *adjusted_mode = - &crtc_state->hw.adjusted_mode; + const struct drm_display_mode *pipe_mode = + &crtc_state->hw.pipe_mode; int pipe_src_w = drm_rect_width(&crtc_state->pipe_src); int pipe_src_h = drm_rect_height(&crtc_state->pipe_src); - int ret, x, y, width, height; + int num_pipes = intel_crtc_num_joined_pipes(crtc_state); + int ret, x, y, width, height, hdisplay_full, src_w_full; if (crtc_state->joiner_pipes) return 0; /* Native modes don't need fitting */ - if (adjusted_mode->crtc_hdisplay == pipe_src_w && - adjusted_mode->crtc_vdisplay == pipe_src_h && + if (pipe_mode->crtc_hdisplay == pipe_src_w && + pipe_mode->crtc_vdisplay == pipe_src_h && crtc_state->output_format != INTEL_OUTPUT_FORMAT_YCBCR420) return 0; @@ -200,46 +201,66 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state, case DRM_MODE_SCALE_CENTER: width = pipe_src_w; height = pipe_src_h; - x = (adjusted_mode->crtc_hdisplay - width + 1)/2; - y = (adjusted_mode->crtc_vdisplay - height + 1)/2; + x = (pipe_mode->crtc_hdisplay - width + 1) / 2; + y = (pipe_mode->crtc_vdisplay - height + 1) / 2; + /* + * The x-coordinate for Primary should be calculated in such a way + * that it remains consistent whether the pipes are joined or not. + * This means we need to consider the full width of the display even + * when the pipes are joined. The x-coordinate for secondaries is 0 + * because it starts at the leftmost point of its own display area, + * ensuring that the framebuffer is centered within Pipe B’s portion + * of the overall display. + */ + if (intel_crtc_is_joiner_primary(crtc_state)) { + hdisplay_full = pipe_mode->crtc_hdisplay * num_pipes; + src_w_full = width * num_pipes; + x = (hdisplay_full - src_w_full + 1) / 2; + } break; case DRM_MODE_SCALE_ASPECT: /* Scale but preserve the aspect ratio */ { - u32 scaled_width = adjusted_mode->crtc_hdisplay * pipe_src_h; - u32 scaled_height = pipe_src_w * adjusted_mode->crtc_vdisplay; + u32 scaled_width = pipe_mode->crtc_hdisplay * pipe_src_h; + u32 scaled_height = pipe_src_w * pipe_mode->crtc_vdisplay; if (scaled_width > scaled_height) { /* pillar */ width = scaled_height / pipe_src_h; if (width & 1) width++; - x = (adjusted_mode->crtc_hdisplay - width + 1) / 2; + x = (pipe_mode->crtc_hdisplay - width + 1) / 2; y = 0; - height = adjusted_mode->crtc_vdisplay; + height = pipe_mode->crtc_vdisplay; + if (intel_crtc_is_joiner_primary(crtc_state)) { + hdisplay_full = pipe_mode->crtc_hdisplay * num_pipes; + src_w_full = width * num_pipes; + x = (hdisplay_full - src_w_full + 1) / 2; + } } else if (scaled_width < scaled_height) { /* letter */ height = scaled_width / pipe_src_w; if (height & 1) height++; - y = (adjusted_mode->crtc_vdisplay - height + 1) / 2; + y = (pipe_mode->crtc_vdisplay - height + 1) / 2; x = 0; - width = adjusted_mode->crtc_hdisplay; + width = pipe_mode->crtc_hdisplay; + } else { x = y = 0; - width = adjusted_mode->crtc_hdisplay; - height = adjusted_mode->crtc_vdisplay; + width = pipe_mode->crtc_hdisplay; + height = pipe_mode->crtc_vdisplay; } } break; case DRM_MODE_SCALE_NONE: - WARN_ON(adjusted_mode->crtc_hdisplay != pipe_src_w); - WARN_ON(adjusted_mode->crtc_vdisplay != pipe_src_h); + WARN_ON(pipe_mode->crtc_hdisplay != pipe_src_w); + WARN_ON(pipe_mode->crtc_vdisplay != pipe_src_h); fallthrough; case DRM_MODE_SCALE_FULLSCREEN: x = y = 0; - width = adjusted_mode->crtc_hdisplay; - height = adjusted_mode->crtc_vdisplay; + width = pipe_mode->crtc_hdisplay; + height = pipe_mode->crtc_vdisplay; break; default: From patchwork Wed Nov 20 05:38:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nemesa Garg X-Patchwork-Id: 13880702 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 7B2A0D6E2BB for ; Wed, 20 Nov 2024 05:37:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0274410E2C9; Wed, 20 Nov 2024 05:37:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="BgYvdGeV"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id A3E7D10E393; Wed, 20 Nov 2024 05:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732081057; x=1763617057; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GoAw6LqPg7thB1qSKmtkz2lbQFhLe+T8gvJlKf/wQTA=; b=BgYvdGeV477/AzZfbPQAlygZIEj1qo2ymhxxqG8kAwyP43OYokoV4XQd ycIXK11eWYusix7tvzaXSZtSYFISP9L2lZj6fDst139JcLjNJucExLqYp GVwOnVXRQzDzQd2QNjdcn6dDCxnc+OJ5wQzDAN5N02r2VAfc2suRILrfq ho1GBCuKoj5bZnJ5Tg+OTAfZBPVKf0AnJ9ySnj1RKTtku2ESRhc8JUjZB vf5wD3kxbEW2Am8jZomNWru1KI1R6483yVzMTwQ/S1txrnNmZ2+Yct59/ Ic3Lshn3+VEmDWDkW+R4SPSpyKAdZbEQIxb4yJxb0VscrahcoZ3CxSCa4 g==; X-CSE-ConnectionGUID: E50+egHSQS+1O2INNGHXNA== X-CSE-MsgGUID: 4ZRxj9+oSiGlak5hLMurKQ== X-IronPort-AV: E=McAfee;i="6700,10204,11261"; a="32179447" X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="32179447" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2024 21:37:36 -0800 X-CSE-ConnectionGUID: kGdoojkASVagiqS/Xwc1mQ== X-CSE-MsgGUID: sYCnCUmMS2yrYlaOSbQCSg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="120748980" Received: from nemesa.iind.intel.com ([10.190.239.22]) by fmviesa001.fm.intel.com with ESMTP; 19 Nov 2024 21:37:35 -0800 From: Nemesa Garg To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Nemesa Garg Subject: [PATCH v5 4/6] drm/i915/display: Call panel_fitting from pipe_config Date: Wed, 20 Nov 2024 11:08:36 +0530 Message-Id: <20241120053838.3794419-5-nemesa.garg@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241120053838.3794419-1-nemesa.garg@intel.com> References: <20241120053838.3794419-1-nemesa.garg@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" In panel fitter/pipe scaler scenario the pch_pfit configuration currently takes place before accounting for pipe_src width for joiner. This causes issue when pch_pfit and joiner get enabled together. Call panel_fitting from pipe_config once pipe src is computed. -v5: Add GMCH check [Ville] Signed-off-by: Nemesa Garg --- drivers/gpu/drm/i915/display/intel_display.c | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 6ad47cf0d419..c58897cddde1 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -104,6 +104,7 @@ #include "intel_pch_display.h" #include "intel_pch_refclk.h" #include "intel_pcode.h" +#include "intel_pfit.h" #include "intel_pipe_crc.h" #include "intel_plane_initial.h" #include "intel_pmdemand.h" @@ -2563,6 +2564,25 @@ static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state) return 0; } +static void intel_crtc_compute_pfit(struct intel_atomic_state *state, + struct intel_crtc_state *crtc_state) +{ + struct intel_display *display = to_intel_display(crtc_state); + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + struct drm_connector *connector; + struct drm_connector_state *connector_state; + int i; + + for_each_new_connector_in_state(&state->base, connector, + connector_state, i) { + if (connector_state->crtc != &crtc->base) + continue; + + if (!HAS_GMCH(display)) + intel_pch_panel_fitting(crtc_state, connector_state); + } +} + static int intel_crtc_compute_pipe_mode(struct intel_crtc_state *crtc_state) { struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); @@ -2645,6 +2665,8 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state, if (ret) return ret; + intel_crtc_compute_pfit(state, crtc_state); + intel_crtc_compute_pixel_rate(crtc_state); if (crtc_state->has_pch_encoder) From patchwork Wed Nov 20 05:38:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nemesa Garg X-Patchwork-Id: 13880703 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 9AF55D6E2BC for ; Wed, 20 Nov 2024 05:37:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 426F510E393; Wed, 20 Nov 2024 05:37:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="U5a5pnfw"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 080C310E391; Wed, 20 Nov 2024 05:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732081059; x=1763617059; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=btz8L2jO/9sLIO+Ahnak6syj4RpmViGG34Pldww+PBw=; b=U5a5pnfw1Y2vg9Qz4aUe81Ib6kDxsDX4XZe7ckM1nTcspypjltGS+yNC OZO3FivgC6T+JCauBa03qiyNqu8H2ADZcI41QctGlRnafFCTFdw57yiHb HFLRd6tZLm7KY+c+2seiFfJTQoFYfsvqN8KlKGsOs0haVAFuPzNRMmb8G 4DEYdS5i+1Yy1KFxVOmYWzhsF2XLifGRShQ3FWRl35XlWpYey0wzKwaq1 iTZV/oWRmvunv22VzfliUkuZ+ePbTYyzhl8Ioo+dIUbm3zGxjJFaB44Io 5EWMY3sUmW21y/thlHUsrKhl1R1+TDaEO2NokgnYlcwv3EKchsXDZUYHS Q==; X-CSE-ConnectionGUID: arqfQcJ4R7O9j1tFDvRQMA== X-CSE-MsgGUID: AaLBBJCNRcWoNUu60FscoA== X-IronPort-AV: E=McAfee;i="6700,10204,11261"; a="32179456" X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="32179456" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2024 21:37:39 -0800 X-CSE-ConnectionGUID: xbOY8PQdQiKSDfDUYko3nw== X-CSE-MsgGUID: MdJUmSEFSMSXpENzR8Ijsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="120748997" Received: from nemesa.iind.intel.com ([10.190.239.22]) by fmviesa001.fm.intel.com with ESMTP; 19 Nov 2024 21:37:38 -0800 From: Nemesa Garg To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Nemesa Garg Subject: [PATCH 5/6] drm/i915/dispaly: Allow joiner and pfit Date: Wed, 20 Nov 2024 11:08:37 +0530 Message-Id: <20241120053838.3794419-6-nemesa.garg@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241120053838.3794419-1-nemesa.garg@intel.com> References: <20241120053838.3794419-1-nemesa.garg@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" Allow joiner for pfit after taking into account the joiner part and making all the adjustments related to it. Signed-off-by: Nemesa Garg --- drivers/gpu/drm/i915/display/intel_pfit.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_pfit.c b/drivers/gpu/drm/i915/display/intel_pfit.c index b2619e1c4021..5bf1dcbbe658 100644 --- a/drivers/gpu/drm/i915/display/intel_pfit.c +++ b/drivers/gpu/drm/i915/display/intel_pfit.c @@ -188,9 +188,6 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state, int num_pipes = intel_crtc_num_joined_pipes(crtc_state); int ret, x, y, width, height, hdisplay_full, src_w_full; - if (crtc_state->joiner_pipes) - return 0; - /* Native modes don't need fitting */ if (pipe_mode->crtc_hdisplay == pipe_src_w && pipe_mode->crtc_vdisplay == pipe_src_h && From patchwork Wed Nov 20 05:38:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nemesa Garg X-Patchwork-Id: 13880704 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 3CED4D6E2BD for ; Wed, 20 Nov 2024 05:37:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E03E710E394; Wed, 20 Nov 2024 05:37:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mFLXU3wb"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1841A10E394; Wed, 20 Nov 2024 05:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732081061; x=1763617061; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=49VBwPcTx7yhn2YKiS3RauLM+4af9vP28czEi52OhjE=; b=mFLXU3wbC31laz8b1jPJVtqqQTUtILt1uckivZOv6fhXNDa2mb0gjzH9 Z1P5PA8JajockpNOb3FVyB8u2D/qiWvpFttsBq2HQj1P+3zInmqGspMvH tB21WfFwCJPFIdJjHizTp8eVleZS5wVi3wzMCg7hktwCDeBuXRO6U9j/S cqYctsZlglqRK1GsnG7QTGl4kNEcdlSIeJmLeO2yvPQVaC13pb0kkpuX1 LSwr1sGZFrTmJZSEYIQPxXhFD3E2PIf3y4lhunf81sAwZ/0Sl/4lyG+qT t7RlUNw3rlVoMdQgifITmtWSPUogjoLx3dudUaLiZYu7XedZmu52vjN1l g==; X-CSE-ConnectionGUID: 3S9WTCqSS0+hM0CP9a5Qyw== X-CSE-MsgGUID: 4idvg8HMRiOG86XtqEZ/Ew== X-IronPort-AV: E=McAfee;i="6700,10204,11261"; a="32179459" X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="32179459" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2024 21:37:41 -0800 X-CSE-ConnectionGUID: qfQwRquURDqRacgB+3IjIA== X-CSE-MsgGUID: UaUe2Zs4SxurXl9kbMGDQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,168,1728975600"; d="scan'208";a="120749015" Received: from nemesa.iind.intel.com ([10.190.239.22]) by fmviesa001.fm.intel.com with ESMTP; 19 Nov 2024 21:37:40 -0800 From: Nemesa Garg To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Nemesa Garg Subject: [PATCH 6/6] drm/i915/display: Initialize pipe_src in compute stage Date: Wed, 20 Nov 2024 11:08:38 +0530 Message-Id: <20241120053838.3794419-7-nemesa.garg@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241120053838.3794419-1-nemesa.garg@intel.com> References: <20241120053838.3794419-1-nemesa.garg@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add early pipe src initialization for gmch and later initialize the pipe src during compute_pipe_src. Signed-off-by: Nemesa Garg --- drivers/gpu/drm/i915/display/intel_display.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index c58897cddde1..6d157767ad3b 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -2535,6 +2535,13 @@ static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state) { struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_i915_private *i915 = to_i915(crtc->base.dev); + int pipe_src_w, pipe_src_h; + + drm_mode_get_hv_timing(&crtc_state->hw.mode, + &pipe_src_w, &pipe_src_h); + + drm_rect_init(&crtc_state->pipe_src, 0, 0, + pipe_src_w, pipe_src_h); intel_joiner_compute_pipe_src(crtc_state); @@ -5004,10 +5011,12 @@ intel_modeset_pipe_config(struct intel_atomic_state *state, * computation to clearly distinguish it from the adjusted mode, which * can be changed by the connectors in the below retry loop. */ - drm_mode_get_hv_timing(&crtc_state->hw.mode, - &pipe_src_w, &pipe_src_h); - drm_rect_init(&crtc_state->pipe_src, 0, 0, - pipe_src_w, pipe_src_h); + if (HAS_GMCH(i915)) { + drm_mode_get_hv_timing(&crtc_state->hw.mode, + &pipe_src_w, &pipe_src_h); + drm_rect_init(&crtc_state->pipe_src, 0, 0, + pipe_src_w, pipe_src_h); + } for_each_new_connector_in_state(&state->base, connector, connector_state, i) { struct intel_encoder *encoder =