intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2]  Consider joiner calculation for panel fitting
@ 2024-12-12 14:33 Nemesa Garg
  2024-12-12 14:33 ` [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst Nemesa Garg
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Nemesa Garg @ 2024-12-12 14:33 UTC (permalink / raw)
  To: intel-gfx, intel-xe; +Cc: Nemesa Garg

 There is an issue when pch_pfit and joiner gets enabled together.
Compute final pfit dst after pipe_src width is adjusted for joiner.

Nemesa Garg (2):
  drm/i915/display: After joiner compute pfit_dst
  drm/i915/display: Initialize pipe_src in compute stage

 drivers/gpu/drm/i915/display/intel_display.c | 58 ++++++++++++++++++--
 1 file changed, 54 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
  2024-12-12 14:33 [PATCH 0/2] Consider joiner calculation for panel fitting Nemesa Garg
@ 2024-12-12 14:33 ` Nemesa Garg
  2024-12-12 15:54   ` Cavitt, Jonathan
  2024-12-19 16:02   ` Ville Syrjälä
  2024-12-12 14:33 ` [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage Nemesa Garg
  2024-12-12 15:52 ` ✗ i915.CI.BAT: failure for Consider joiner calculation for panel fitting (rev6) Patchwork
  2 siblings, 2 replies; 12+ messages in thread
From: Nemesa Garg @ 2024-12-12 14:33 UTC (permalink / raw)
  To: intel-gfx, intel-xe; +Cc: Nemesa Garg

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2873 bytes --]

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.So once pipe src is computed adjust the pfit_dst.
It can be done by computing per pipe output area first and then
and then find the intersection of above area with pfit_dst and
then adjust the coordinates.

Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 21319f753a34..7be2ea11b8b0 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2563,6 +2563,36 @@ static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state)
 	return 0;
 }
 
+/*
+ * 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.
+ */
+static int intel_crtc_compute_pfit(struct intel_atomic_state *state,
+				   struct intel_crtc_state *crtc_state)
+{
+	struct drm_display_mode *mode = &crtc_state->hw.pipe_mode;
+	struct drm_rect area;
+
+	if (!crtc_state->pch_pfit.enabled)
+		return 0;
+
+	drm_rect_init(&area, 0, 0,
+		      mode->crtc_hdisplay,
+		      mode->crtc_vdisplay);
+
+	if (!drm_rect_intersect(&crtc_state->pch_pfit.dst, &area))
+		return -EINVAL;
+
+	drm_rect_translate(&crtc_state->pch_pfit.dst, -area.x1, -area.y1);
+
+	return 0;
+}
+
 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 +2675,10 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state,
 	if (ret)
 		return ret;
 
+	ret = intel_crtc_compute_pfit(state, crtc_state);
+	if (ret)
+		return ret;
+
 	intel_crtc_compute_pixel_rate(crtc_state);
 
 	if (crtc_state->has_pch_encoder)
@@ -4865,6 +4899,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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage
  2024-12-12 14:33 [PATCH 0/2] Consider joiner calculation for panel fitting Nemesa Garg
  2024-12-12 14:33 ` [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst Nemesa Garg
@ 2024-12-12 14:33 ` Nemesa Garg
  2024-12-12 15:54   ` Cavitt, Jonathan
  2024-12-12 15:52 ` ✗ i915.CI.BAT: failure for Consider joiner calculation for panel fitting (rev6) Patchwork
  2 siblings, 1 reply; 12+ messages in thread
From: Nemesa Garg @ 2024-12-12 14:33 UTC (permalink / raw)
  To: intel-gfx, intel-xe; +Cc: Nemesa Garg

Add early pipe src initialization for gmch and later
initialize the pipe src during compute_pipe_src.

Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
---
 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 7be2ea11b8b0..50693b6ca58c 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2534,6 +2534,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);
 
@@ -5016,10 +5023,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 =
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* ✗ i915.CI.BAT: failure for Consider joiner calculation for panel fitting (rev6)
  2024-12-12 14:33 [PATCH 0/2] Consider joiner calculation for panel fitting Nemesa Garg
  2024-12-12 14:33 ` [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst Nemesa Garg
  2024-12-12 14:33 ` [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage Nemesa Garg
@ 2024-12-12 15:52 ` Patchwork
  2 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2024-12-12 15:52 UTC (permalink / raw)
  To: Nemesa Garg; +Cc: intel-gfx

== Series Details ==

Series: Consider joiner calculation for panel fitting (rev6)
URL   : https://patchwork.freedesktop.org/series/136561/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_15831 -> Patchwork_136561v6
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_136561v6 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_136561v6, please notify your bug team (I915-ci-infra@lists.freedesktop.org) to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/index.html

Participating hosts (47 -> 45)
------------------------------

  Missing    (2): bat-adlp-6 fi-snb-2520m 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_136561v6:

### IGT changes ###

#### Possible regressions ####

  * igt@kms_flip@basic-flip-vs-wf_vblank@c-dp1:
    - bat-apl-1:          [PASS][1] -> [DMESG-WARN][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-apl-1/igt@kms_flip@basic-flip-vs-wf_vblank@c-dp1.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-apl-1/igt@kms_flip@basic-flip-vs-wf_vblank@c-dp1.html

  
Known issues
------------

  Here are the changes found in Patchwork_136561v6 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@debugfs_test@basic-hwmon:
    - fi-pnv-d510:        NOTRUN -> [SKIP][3] +3 other tests skip
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/fi-pnv-d510/igt@debugfs_test@basic-hwmon.html

  * igt@dmabuf@all-tests:
    - bat-apl-1:          [PASS][4] -> [INCOMPLETE][5] ([i915#12904]) +1 other test incomplete
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-apl-1/igt@dmabuf@all-tests.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-apl-1/igt@dmabuf@all-tests.html

  * igt@gem_exec_gttfill@basic:
    - fi-pnv-d510:        NOTRUN -> [ABORT][6] ([i915#13169])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/fi-pnv-d510/igt@gem_exec_gttfill@basic.html

  * igt@i915_selftest@live:
    - bat-twl-1:          [PASS][7] -> [ABORT][8] ([i915#12435] / [i915#12919])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-twl-1/igt@i915_selftest@live.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-twl-1/igt@i915_selftest@live.html

  * igt@i915_selftest@live@requests:
    - bat-twl-1:          [PASS][9] -> [ABORT][10] ([i915#12919])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-twl-1/igt@i915_selftest@live@requests.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-twl-1/igt@i915_selftest@live@requests.html

  * igt@kms_flip@basic-flip-vs-wf_vblank:
    - bat-apl-1:          [PASS][11] -> [DMESG-WARN][12] ([i915#1982])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-apl-1/igt@kms_flip@basic-flip-vs-wf_vblank.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-apl-1/igt@kms_flip@basic-flip-vs-wf_vblank.html

  
#### Possible fixes ####

  * igt@i915_module_load@load:
    - fi-pnv-d510:        [ABORT][13] ([i915#13203]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/fi-pnv-d510/igt@i915_module_load@load.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/fi-pnv-d510/igt@i915_module_load@load.html

  * igt@i915_pm_rpm@module-reload:
    - bat-dg1-7:          [FAIL][15] ([i915#12903]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-dg1-7/igt@i915_pm_rpm@module-reload.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-dg1-7/igt@i915_pm_rpm@module-reload.html
    - bat-rpls-4:         [FAIL][17] ([i915#12903]) -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-rpls-4/igt@i915_pm_rpm@module-reload.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-rpls-4/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live:
    - fi-hsw-4770:        [DMESG-WARN][19] ([i915#12806]) -> [PASS][20] +1 other test pass
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/fi-hsw-4770/igt@i915_selftest@live.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/fi-hsw-4770/igt@i915_selftest@live.html
    - bat-arlh-3:         [INCOMPLETE][21] ([i915#12435] / [i915#13194]) -> [PASS][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-arlh-3/igt@i915_selftest@live.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-arlh-3/igt@i915_selftest@live.html

  * igt@i915_selftest@live@execlists:
    - bat-arlh-3:         [INCOMPLETE][23] -> [PASS][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-arlh-3/igt@i915_selftest@live@execlists.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-arlh-3/igt@i915_selftest@live@execlists.html

  * igt@i915_selftest@live@mman:
    - bat-jsl-3:          [INCOMPLETE][25] ([i915#13241]) -> [PASS][26] +1 other test pass
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-jsl-3/igt@i915_selftest@live@mman.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-jsl-3/igt@i915_selftest@live@mman.html

  * igt@i915_selftest@live@workarounds:
    - bat-arls-5:         [ABORT][27] ([i915#12061]) -> [PASS][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-arls-5/igt@i915_selftest@live@workarounds.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-arls-5/igt@i915_selftest@live@workarounds.html

  * igt@kms_cursor_legacy@basic-flip-before-cursor-legacy:
    - bat-apl-1:          [DMESG-WARN][29] -> [PASS][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15831/bat-apl-1/igt@kms_cursor_legacy@basic-flip-before-cursor-legacy.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/bat-apl-1/igt@kms_cursor_legacy@basic-flip-before-cursor-legacy.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
  [i915#12435]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12435
  [i915#12806]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12806
  [i915#12903]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12903
  [i915#12904]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12904
  [i915#12919]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12919
  [i915#13169]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13169
  [i915#13194]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13194
  [i915#13203]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13203
  [i915#13241]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13241
  [i915#1982]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1982


Build changes
-------------

  * Linux: CI_DRM_15831 -> Patchwork_136561v6

  CI-20190529: 20190529
  CI_DRM_15831: f574af90d83d2d7bd4c99cdb79764dea5bf8b20c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_8150: 7812065f4aebab1629b570bd78ef71e09480b359 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_136561v6: f574af90d83d2d7bd4c99cdb79764dea5bf8b20c @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_136561v6/index.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
  2024-12-12 14:33 ` [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst Nemesa Garg
@ 2024-12-12 15:54   ` Cavitt, Jonathan
  2024-12-19 15:13     ` Garg, Nemesa
  2024-12-19 16:02   ` Ville Syrjälä
  1 sibling, 1 reply; 12+ messages in thread
From: Cavitt, Jonathan @ 2024-12-12 15:54 UTC (permalink / raw)
  To: Garg, Nemesa, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org
  Cc: Garg, Nemesa, Cavitt, Jonathan

-----Original Message-----
From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Nemesa Garg
Sent: Thursday, December 12, 2024 6:33 AM
To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
Cc: Garg, Nemesa <nemesa.garg@intel.com>
Subject: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
> 
> 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.So once pipe src is computed adjust the pfit_dst.
> It can be done by computing per pipe output area first and then
> and then find the intersection of above area with pfit_dst and
> then adjust the coordinates.

Maybe reword the commit message as such:

"""
In the panel fitter/pipe scaler scenario, the pch_pfit configuration
currently takes place before accounting for pipe_src width for
joiner.  This causes issues when pch_pfit and joiner get enabled
together.  So, once pipe_src is computed, adjust the pfit_dst.
This can be done by first computing per pipe output area, then
finding the intersection of above area with pfit_dst before
finally adjusting the coordinates.
"""

The above is just a suggested full revision.  The following
is all that's strictly necessary to fix:
s/together.So/together. So/
s/area first and then and then/area first and then/

> 
> Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 41 ++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 21319f753a34..7be2ea11b8b0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2563,6 +2563,36 @@ static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state)
>  	return 0;
>  }
>  
> +/*
> + * 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

Pipe B’s portion of the overall display?  This is probably just a corruption
in the email due to my mail viewer of choice, but if it's not, this needs to be
fixed before pushing.

> + * of the overall display.
> + */
> +static int intel_crtc_compute_pfit(struct intel_atomic_state *state,
> +				   struct intel_crtc_state *crtc_state)
> +{
> +	struct drm_display_mode *mode = &crtc_state->hw.pipe_mode;
> +	struct drm_rect area;
> +
> +	if (!crtc_state->pch_pfit.enabled)
> +		return 0;
> +
> +	drm_rect_init(&area, 0, 0,
> +		      mode->crtc_hdisplay,
> +		      mode->crtc_vdisplay);
> +
> +	if (!drm_rect_intersect(&crtc_state->pch_pfit.dst, &area))
> +		return -EINVAL;
> +
> +	drm_rect_translate(&crtc_state->pch_pfit.dst, -area.x1, -area.y1);
> +
> +	return 0;
> +}
> +
>  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 +2675,10 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state,
>  	if (ret)
>  		return ret;
>  
> +	ret = intel_crtc_compute_pfit(state, crtc_state);
> +	if (ret)
> +		return ret;
> +
>  	intel_crtc_compute_pixel_rate(crtc_state);
>  
>  	if (crtc_state->has_pch_encoder)
> @@ -4865,6 +4899,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);
> +	}
> +

Aside from the above minor grammatical issues:
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
-Jonathan Cavitt

>  	copy_joiner_crtc_state_nomodeset(state, secondary_crtc);
>  
>  	secondary_crtc_state->uapi.mode_changed = primary_crtc_state->uapi.mode_changed;
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage
  2024-12-12 14:33 ` [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage Nemesa Garg
@ 2024-12-12 15:54   ` Cavitt, Jonathan
  2024-12-19 15:15     ` Garg, Nemesa
  0 siblings, 1 reply; 12+ messages in thread
From: Cavitt, Jonathan @ 2024-12-12 15:54 UTC (permalink / raw)
  To: Garg, Nemesa, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org
  Cc: Garg, Nemesa, Cavitt, Jonathan

-----Original Message-----
From: Intel-xe <intel-xe-bounces@lists.freedesktop.org> On Behalf Of Nemesa Garg
Sent: Thursday, December 12, 2024 6:33 AM
To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
Cc: Garg, Nemesa <nemesa.garg@intel.com>
Subject: [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage
> 
> Add early pipe src initialization for gmch and later
> initialize the pipe src during compute_pipe_src.
> 
> Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>

LGTM.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
-Jonathan Cavitt

> ---
>  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 7be2ea11b8b0..50693b6ca58c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2534,6 +2534,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);
>  
> @@ -5016,10 +5023,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 =
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
  2024-12-12 15:54   ` Cavitt, Jonathan
@ 2024-12-19 15:13     ` Garg, Nemesa
  0 siblings, 0 replies; 12+ messages in thread
From: Garg, Nemesa @ 2024-12-19 15:13 UTC (permalink / raw)
  To: Cavitt, Jonathan, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org, Ville Syrjala



> -----Original Message-----
> From: Cavitt, Jonathan <jonathan.cavitt@intel.com>
> Sent: Thursday, December 12, 2024 9:24 PM
> To: Garg, Nemesa <nemesa.garg@intel.com>; intel-gfx@lists.freedesktop.org;
> intel-xe@lists.freedesktop.org
> Cc: Garg, Nemesa <nemesa.garg@intel.com>; Cavitt, Jonathan
> <jonathan.cavitt@intel.com>
> Subject: RE: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
> 
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of
> Nemesa Garg
> Sent: Thursday, December 12, 2024 6:33 AM
> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Cc: Garg, Nemesa <nemesa.garg@intel.com>
> Subject: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
> >
> > 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.So
> > once pipe src is computed adjust the pfit_dst.
> > It can be done by computing per pipe output area first and then and
> > then find the intersection of above area with pfit_dst and then adjust
> > the coordinates.
> 
> Maybe reword the commit message as such:
> 
> """
> In the panel fitter/pipe scaler scenario, the pch_pfit configuration currently
> takes place before accounting for pipe_src width for joiner.  This causes issues
> when pch_pfit and joiner get enabled together.  So, once pipe_src is
> computed, adjust the pfit_dst.
> This can be done by first computing per pipe output area, then finding the
> intersection of above area with pfit_dst before finally adjusting the
> coordinates.
> """
> 
> The above is just a suggested full revision.  The following is all that's strictly
> necessary to fix:
> s/together.So/together. So/
> s/area first and then and then/area first and then/
> 
> >
> > Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 41
> > ++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> > b/drivers/gpu/drm/i915/display/intel_display.c
> > index 21319f753a34..7be2ea11b8b0 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -2563,6 +2563,36 @@ static int intel_crtc_compute_pipe_src(struct
> intel_crtc_state *crtc_state)
> >  	return 0;
> >  }
> >
> > +/*
> > + * 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
> 
> Pipe B’s portion of the overall display?  This is probably just a corruption
> in the email due to my mail viewer of choice, but if it's not, this needs to be
> fixed before pushing.
> 
> > + * of the overall display.
> > + */
> > +static int intel_crtc_compute_pfit(struct intel_atomic_state *state,
> > +				   struct intel_crtc_state *crtc_state) {
> > +	struct drm_display_mode *mode = &crtc_state->hw.pipe_mode;
> > +	struct drm_rect area;
> > +
> > +	if (!crtc_state->pch_pfit.enabled)
> > +		return 0;
> > +
> > +	drm_rect_init(&area, 0, 0,
> > +		      mode->crtc_hdisplay,
> > +		      mode->crtc_vdisplay);
> > +
> > +	if (!drm_rect_intersect(&crtc_state->pch_pfit.dst, &area))
> > +		return -EINVAL;
> > +
> > +	drm_rect_translate(&crtc_state->pch_pfit.dst, -area.x1, -area.y1);
> > +
> > +	return 0;
> > +}
> > +
> >  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 +2675,10 @@ static int intel_crtc_compute_config(struct
> intel_atomic_state *state,
> >  	if (ret)
> >  		return ret;
> >
> > +	ret = intel_crtc_compute_pfit(state, crtc_state);
> > +	if (ret)
> > +		return ret;
> > +
> >  	intel_crtc_compute_pixel_rate(crtc_state);
> >
> >  	if (crtc_state->has_pch_encoder)
> > @@ -4865,6 +4899,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);
> > +	}
> > +
> 
> Aside from the above minor grammatical issues:
> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> -Jonathan Cavitt
> 
Thanks for review. I'll edit the commit message.

Regards,
Nemesa
> >  	copy_joiner_crtc_state_nomodeset(state, secondary_crtc);
> >
> >  	secondary_crtc_state->uapi.mode_changed =
> > primary_crtc_state->uapi.mode_changed;
> > --
> > 2.25.1
> >
> >

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage
  2024-12-12 15:54   ` Cavitt, Jonathan
@ 2024-12-19 15:15     ` Garg, Nemesa
  0 siblings, 0 replies; 12+ messages in thread
From: Garg, Nemesa @ 2024-12-19 15:15 UTC (permalink / raw)
  To: Cavitt, Jonathan, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org, Syrjala, Ville



> -----Original Message-----
> From: Cavitt, Jonathan <jonathan.cavitt@intel.com>
> Sent: Thursday, December 12, 2024 9:25 PM
> To: Garg, Nemesa <nemesa.garg@intel.com>; intel-gfx@lists.freedesktop.org;
> intel-xe@lists.freedesktop.org
> Cc: Garg, Nemesa <nemesa.garg@intel.com>; Cavitt, Jonathan
> <jonathan.cavitt@intel.com>
> Subject: RE: [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage
> 
> -----Original Message-----
> From: Intel-xe <intel-xe-bounces@lists.freedesktop.org> On Behalf Of
> Nemesa Garg
> Sent: Thursday, December 12, 2024 6:33 AM
> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Cc: Garg, Nemesa <nemesa.garg@intel.com>
> Subject: [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage
> >
> > Add early pipe src initialization for gmch and later initialize the
> > pipe src during compute_pipe_src.
> >
> > Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> 
> LGTM.
> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> -Jonathan Cavitt

Hi Ville,

Are these patches good for merge?

Regards,
Nemesa
> 
> > ---
> >  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 7be2ea11b8b0..50693b6ca58c 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -2534,6 +2534,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);
> >
> > @@ -5016,10 +5023,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 =
> > --
> > 2.25.1
> >
> >

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
  2024-12-12 14:33 ` [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst Nemesa Garg
  2024-12-12 15:54   ` Cavitt, Jonathan
@ 2024-12-19 16:02   ` Ville Syrjälä
  2024-12-20  6:07     ` Garg, Nemesa
  2024-12-20  9:04     ` Ville Syrjälä
  1 sibling, 2 replies; 12+ messages in thread
From: Ville Syrjälä @ 2024-12-19 16:02 UTC (permalink / raw)
  To: Nemesa Garg; +Cc: intel-gfx, intel-xe

On Thu, Dec 12, 2024 at 08:03:28PM +0530, Nemesa Garg wrote:
> 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.So once pipe src is computed adjust the pfit_dst.
> It can be done by computing per pipe output area first and then
> and then find the intersection of above area with pfit_dst and
> then adjust the coordinates.
> 
> Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 41 ++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 21319f753a34..7be2ea11b8b0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2563,6 +2563,36 @@ static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state)
>  	return 0;
>  }
>  
> +/*
> + * 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.
> + */
> +static int intel_crtc_compute_pfit(struct intel_atomic_state *state,
> +				   struct intel_crtc_state *crtc_state)
> +{
> +	struct drm_display_mode *mode = &crtc_state->hw.pipe_mode;

const struct drm_display_mode *pipe_mode = ...

> +	struct drm_rect area;
> +
> +	if (!crtc_state->pch_pfit.enabled)
> +		return 0;
> +
> +	drm_rect_init(&area, 0, 0,

This needs a proper x offset to match the pipe's positon in
the overall screen layout (can be determined similarly to
intel_joiner_adjust_pipe_src(), except using crtc_hdisplay
as the width instead of the pipe_src width).

> +		      mode->crtc_hdisplay,
> +		      mode->crtc_vdisplay);
> +
> +	if (!drm_rect_intersect(&crtc_state->pch_pfit.dst, &area))
> +		return -EINVAL;
> +
> +	drm_rect_translate(&crtc_state->pch_pfit.dst, -area.x1, -area.y1);

And this needs to remove the same offset we added originally.

> +
> +	return 0;
> +}
> +
>  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 +2675,10 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state,
>  	if (ret)
>  		return ret;
>  
> +	ret = intel_crtc_compute_pfit(state, crtc_state);
> +	if (ret)
> +		return ret;
> +
>  	intel_crtc_compute_pixel_rate(crtc_state);
>  
>  	if (crtc_state->has_pch_encoder)
> @@ -4865,6 +4899,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;
> -- 
> 2.25.1

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
  2024-12-19 16:02   ` Ville Syrjälä
@ 2024-12-20  6:07     ` Garg, Nemesa
  2024-12-20  9:04     ` Ville Syrjälä
  1 sibling, 0 replies; 12+ messages in thread
From: Garg, Nemesa @ 2024-12-20  6:07 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org



> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Thursday, December 19, 2024 9:32 PM
> To: Garg, Nemesa <nemesa.garg@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Subject: Re: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
> 
> On Thu, Dec 12, 2024 at 08:03:28PM +0530, Nemesa Garg wrote:
> > 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.So
> > once pipe src is computed adjust the pfit_dst.
> > It can be done by computing per pipe output area first and then and
> > then find the intersection of above area with pfit_dst and then adjust
> > the coordinates.
> >
> > Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 41
> > ++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> > b/drivers/gpu/drm/i915/display/intel_display.c
> > index 21319f753a34..7be2ea11b8b0 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -2563,6 +2563,36 @@ static int intel_crtc_compute_pipe_src(struct
> intel_crtc_state *crtc_state)
> >  	return 0;
> >  }
> >
> > +/*
> > + * 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.
> > + */
> > +static int intel_crtc_compute_pfit(struct intel_atomic_state *state,
> > +				   struct intel_crtc_state *crtc_state) {
> > +	struct drm_display_mode *mode = &crtc_state->hw.pipe_mode;
> 
> const struct drm_display_mode *pipe_mode = ...
> 
> > +	struct drm_rect area;
> > +
> > +	if (!crtc_state->pch_pfit.enabled)
> > +		return 0;
> > +
> > +	drm_rect_init(&area, 0, 0,
> 
> This needs a proper x offset to match the pipe's positon in the overall screen
> layout (can be determined similarly to intel_joiner_adjust_pipe_src(), except
> using crtc_hdisplay as the width instead of the pipe_src width).
> 
Thank you for the suggestion.  While implementing this code the problem was intel_crtc_compute_config() 
(intel_crtc_compute_pfit  is getting called from this) is getting called for primary pipe and not for secondary pipe so then I thought of finding a intersection point for primary pipe and then same thing can be translated for secondary pipe in copy_joiner_crtc_state_modeset(), but yes this will work for 2 pipes only, not for 4 pipes.

Regards,
Nemesa
> > +		      mode->crtc_hdisplay,
> > +		      mode->crtc_vdisplay);
> > +
> > +	if (!drm_rect_intersect(&crtc_state->pch_pfit.dst, &area))
> > +		return -EINVAL;
> > +
> > +	drm_rect_translate(&crtc_state->pch_pfit.dst, -area.x1, -area.y1);
> 
> And this needs to remove the same offset we added originally.
> 
> > +
> > +	return 0;
> > +}
> > +
> >  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 +2675,10 @@ static int intel_crtc_compute_config(struct
> intel_atomic_state *state,
> >  	if (ret)
> >  		return ret;
> >
> > +	ret = intel_crtc_compute_pfit(state, crtc_state);
> > +	if (ret)
> > +		return ret;
> > +
> >  	intel_crtc_compute_pixel_rate(crtc_state);
> >
> >  	if (crtc_state->has_pch_encoder)
> > @@ -4865,6 +4899,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;
> > --
> > 2.25.1
> 
> --
> Ville Syrjälä
> Intel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
  2024-12-19 16:02   ` Ville Syrjälä
  2024-12-20  6:07     ` Garg, Nemesa
@ 2024-12-20  9:04     ` Ville Syrjälä
  2025-01-29 12:54       ` Garg, Nemesa
  1 sibling, 1 reply; 12+ messages in thread
From: Ville Syrjälä @ 2024-12-20  9:04 UTC (permalink / raw)
  To: Nemesa Garg; +Cc: intel-gfx, intel-xe

On Thu, Dec 19, 2024 at 06:02:25PM +0200, Ville Syrjälä wrote:
> On Thu, Dec 12, 2024 at 08:03:28PM +0530, Nemesa Garg wrote:
> > 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.So once pipe src is computed adjust the pfit_dst.
> > It can be done by computing per pipe output area first and then
> > and then find the intersection of above area with pfit_dst and
> > then adjust the coordinates.
> > 
> > Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_display.c | 41 ++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 21319f753a34..7be2ea11b8b0 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -2563,6 +2563,36 @@ static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state)
> >  	return 0;
> >  }
> >  
> > +/*
> > + * 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.
> > + */
> > +static int intel_crtc_compute_pfit(struct intel_atomic_state *state,
> > +				   struct intel_crtc_state *crtc_state)
> > +{
> > +	struct drm_display_mode *mode = &crtc_state->hw.pipe_mode;
> 
> const struct drm_display_mode *pipe_mode = ...
> 
> > +	struct drm_rect area;
> > +
> > +	if (!crtc_state->pch_pfit.enabled)
> > +		return 0;
> > +
> > +	drm_rect_init(&area, 0, 0,
> 
> This needs a proper x offset to match the pipe's positon in
> the overall screen layout (can be determined similarly to
> intel_joiner_adjust_pipe_src(), except using crtc_hdisplay
> as the width instead of the pipe_src width).
> 
> > +		      mode->crtc_hdisplay,
> > +		      mode->crtc_vdisplay);
> > +
> > +	if (!drm_rect_intersect(&crtc_state->pch_pfit.dst, &area))
> > +		return -EINVAL;
> > +
> > +	drm_rect_translate(&crtc_state->pch_pfit.dst, -area.x1, -area.y1);
> 
> And this needs to remove the same offset we added originally.

Hmm. Now that I looked at this a bit I think we need a lot
more than this to make things actually work correctly.

I think what we need is roughly:
- move pipesrc/pfit.dst/pixel_rate calculations out from
  intel_crtc_compute_config() into some new function (could
  call it something like intel_crtc_compute_config_final(())
  which needs to be called after the joiner state copy has been
  performed (ie. where we now call intel_joiner_adjust_pipe_src()
  in intel_atomic_check()).
- redesign the pipesrc readout to iterate through all the joined
  pipes to accumulate the x offset for the pipes, since not all
  the joined pipes necessarily have the same pipesrc width
- reuse the same for the uapi.mode hdisplay/vdisplay fixup
- steal the scaled clipping code from
  intel_atomic_plane_check_clipping() to properly calculate
  both pipesrc and pfit.dst

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
  2024-12-20  9:04     ` Ville Syrjälä
@ 2025-01-29 12:54       ` Garg, Nemesa
  0 siblings, 0 replies; 12+ messages in thread
From: Garg, Nemesa @ 2025-01-29 12:54 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org



> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Friday, December 20, 2024 2:35 PM
> To: Garg, Nemesa <nemesa.garg@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
> Subject: Re: [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst
> 
> On Thu, Dec 19, 2024 at 06:02:25PM +0200, Ville Syrjälä wrote:
> > On Thu, Dec 12, 2024 at 08:03:28PM +0530, Nemesa Garg wrote:
> > > 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.So once pipe src is computed adjust the pfit_dst.
> > > It can be done by computing per pipe output area first and then and
> > > then find the intersection of above area with pfit_dst and then
> > > adjust the coordinates.
> > >
> > > Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_display.c | 41
> > > ++++++++++++++++++++
> > >  1 file changed, 41 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> > > b/drivers/gpu/drm/i915/display/intel_display.c
> > > index 21319f753a34..7be2ea11b8b0 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > @@ -2563,6 +2563,36 @@ static int intel_crtc_compute_pipe_src(struct
> intel_crtc_state *crtc_state)
> > >  	return 0;
> > >  }
> > >
> > > +/*
> > > + * 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.
> > > + */
> > > +static int intel_crtc_compute_pfit(struct intel_atomic_state *state,
> > > +				   struct intel_crtc_state *crtc_state) {
> > > +	struct drm_display_mode *mode = &crtc_state->hw.pipe_mode;
> >
> > const struct drm_display_mode *pipe_mode = ...
> >
> > > +	struct drm_rect area;
> > > +
> > > +	if (!crtc_state->pch_pfit.enabled)
> > > +		return 0;
> > > +
> > > +	drm_rect_init(&area, 0, 0,
> >
> > This needs a proper x offset to match the pipe's positon in the
> > overall screen layout (can be determined similarly to
> > intel_joiner_adjust_pipe_src(), except using crtc_hdisplay as the
> > width instead of the pipe_src width).
> >
> > > +		      mode->crtc_hdisplay,
> > > +		      mode->crtc_vdisplay);
> > > +
> > > +	if (!drm_rect_intersect(&crtc_state->pch_pfit.dst, &area))
> > > +		return -EINVAL;
> > > +
> > > +	drm_rect_translate(&crtc_state->pch_pfit.dst, -area.x1, -area.y1);
> >
> > And this needs to remove the same offset we added originally.
> 
> Hmm. Now that I looked at this a bit I think we need a lot more than this to
> make things actually work correctly.
> 
> I think what we need is roughly:
> - move pipesrc/pfit.dst/pixel_rate calculations out from
>   intel_crtc_compute_config() into some new function (could
>   call it something like intel_crtc_compute_config_final(())
>   which needs to be called after the joiner state copy has been
>   performed (ie. where we now call intel_joiner_adjust_pipe_src()
>   in intel_atomic_check()).
> - redesign the pipesrc readout to iterate through all the joined
>   pipes to accumulate the x offset for the pipes, since not all
>   the joined pipes necessarily have the same pipesrc width
> - reuse the same for the uapi.mode hdisplay/vdisplay fixup
> - steal the scaled clipping code from
>   intel_atomic_plane_check_clipping() to properly calculate
>   both pipesrc and pfit.dst
> 
Hi Ville,

Sorry for late reply. Agree it needs more work and I got your points. I will work on this and will send the new revision.

Thanks and Regards,
Nemesa
> --
> Ville Syrjälä
> Intel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-01-29 12:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 14:33 [PATCH 0/2] Consider joiner calculation for panel fitting Nemesa Garg
2024-12-12 14:33 ` [PATCH 1/2] drm/i915/display: After joiner compute pfit_dst Nemesa Garg
2024-12-12 15:54   ` Cavitt, Jonathan
2024-12-19 15:13     ` Garg, Nemesa
2024-12-19 16:02   ` Ville Syrjälä
2024-12-20  6:07     ` Garg, Nemesa
2024-12-20  9:04     ` Ville Syrjälä
2025-01-29 12:54       ` Garg, Nemesa
2024-12-12 14:33 ` [PATCH 2/2] drm/i915/display: Initialize pipe_src in compute stage Nemesa Garg
2024-12-12 15:54   ` Cavitt, Jonathan
2024-12-19 15:15     ` Garg, Nemesa
2024-12-12 15:52 ` ✗ i915.CI.BAT: failure for Consider joiner calculation for panel fitting (rev6) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).