Remaining patches for WM cleanup series
Subsystems (2)
cover Remaining patches for WM cleanup series
This series contains remaining two patches from wm cleanup series
https://patchwork.freedesktop.org/series/20152/
Initial 10 patches already got merged in tree so sending remaining 2 separately.
Kumar, Mahesh (2):
drm/i915/skl: New ddb allocation algorithm
drm/i915/skl+: consider max supported plane pixel rate while scaling
drivers/gpu/drm/i915/intel_display.c | 3 + drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_pm.c | 343 +++++++++++++++++++++++++---------- 3 files changed, 248 insertions(+), 100 deletions(-)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/2 drm/i915/skl: New ddb allocation algorithm
From: "Kumar, Mahesh" <[email protected]>
This patch implements new DDB allocation algorithm as per HW team recommendation. This algo takecare of scenario where we allocate less DDB for the planes with lower relative pixel rate, but they require more DDB to work.
It also takes care of enabling same watermark level for each plane in crtc, for efficient power saving.
Changes since v1:
- Rebase on top of Paulo's patch series
Changes since v2:
- Fix the for loop condition to enable WM
Changes since v3:
- Fix crash in cursor i-g-t reported by Maarten
- Rebase after addressing Paulo's comments
- Few other ULT fixes
Changes since v4:
- Rebase on drm-tip
- Added separate function to enable WM levels
Changes since v5:
- Fix a crash identified in skl-6770HQ system
Changes since v6:
- Address review comments from Matt
Changes since v7:
- Fix failure return in skl_compute_plane_wm (Matt)
- fix typo
--- drivers/gpu/drm/i915/intel_pm.c | 256 ++++++++++++++++++++++++---------------- 1 file changed, 156 insertions(+), 100 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +156 -100
@@ -4039,13 +4039,41 @@ skl_ddb_calc_min(const struct intel_crtc_state *cstate, int num_active, minimum[PLANE_CURSOR ] =skl_cursor_allocation (num_active); } +static void +skl_enable_plane_wm_levels (const struct drm_i915_private *dev_priv, +uint16_t plane_ddb, +uint16_t max_level, +struct skl_plane_wm *wm) +{ +int level; +/* +* Now enable all levels in WM structure which can be enabled +* using current DDB allocation +*/ +for (level =ilk_wm_max_level (dev_priv); level >=0 ; level--) { +struct skl_wm_level *level_wm = &wm->wm[level]; + +if (level > max_level || level_wm->plane_res_b ==0 + || level_wm->plane_res_l >=31 + || level_wm->plane_res_b >= plane_ddb) { + level_wm->plane_en = false; + level_wm->plane_res_b =0 ; + level_wm->plane_res_l =0 ; + }else { + level_wm->plane_en = true; + } + } +} +static int skl_allocate_pipe_ddb (struct intel_crtc_state *cstate, +struct skl_pipe_wm *pipe_wm,struct skl_ddb_allocation *ddb/* out */ ) {struct drm_atomic_state *state = cstate->base.state;struct drm_crtc *crtc = cstate->base.crtc;struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);enum pipe pipe = intel_crtc->pipe;struct skl_ddb_entry *alloc = &cstate->wm.skl.ddb;
@@ -4058,6 +4086,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,unsigned plane_data_rate[I915_MAX_PLANES ] = {};unsigned plane_y_data_rate[I915_MAX_PLANES ] = {};uint16_t total_min_blocks =0 ; +uint16_t total_level_ddb; +int max_level, level;/* Clear the partitioning for disabled planes. */ memset (ddb->plane[pipe],0 ,sizeof (ddb->plane[pipe]));
@@ -4096,10 +4126,48 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,return -EINVAL ; } - alloc_size -= total_min_blocks; - ddb->plane[pipe][PLANE_CURSOR ].start = alloc->end - minimum[PLANE_CURSOR ]; + alloc_size -= minimum[PLANE_CURSOR ]; + ddb->plane[pipe][PLANE_CURSOR ].start = alloc->end - + minimum[PLANE_CURSOR ]; ddb->plane[pipe][PLANE_CURSOR ].end = alloc->end; +for (level =ilk_wm_max_level (dev_priv); level >=0 ; level--) { + total_level_ddb =0 ; +for_each_plane_id_on_crtc (intel_crtc, plane_id) { +/* +* TODO: We should calculate watermark values for Y/UV +* plane both in case of NV12 format and use both values +* for ddb calculation. NV12 is disabled as of now, So +* using only single/UV plane value here. +*/ +struct skl_plane_wm *wm = &pipe_wm->planes[plane_id]; +uint16_t plane_res_b = wm->wm[level].plane_res_b; +uint16_t min = minimum[plane_id] + y_minimum[plane_id]; + +if (plane_id ==PLANE_CURSOR ) +continue ; + + total_level_ddb +=max (plane_res_b, min); + } + +/* +* If This level can successfully be enabled with the +* pipe's current DDB allocation, then all lower levels are +* guaranteed to succeed as well. +*/ +if (total_level_ddb <= alloc_size) +break ; + } + +if ((level <0 ) || (total_min_blocks > alloc_size)) { +DRM_DEBUG_KMS ("Requested display configuration exceeds system DDB limitations" ); +DRM_DEBUG_KMS ("minimum required %d/%d\n" , (level <0 ) ? + total_level_ddb : total_min_blocks, alloc_size); +return -EINVAL ; + } + max_level = level; + alloc_size -= total_level_ddb; +/* * 2. Distribute the remaining space in proportion to the amount of * data each plane needs to fetch from memory.
@@ -4115,10 +4183,17 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate, start = alloc->start;for_each_plane_id_on_crtc (intel_crtc, plane_id) {unsigned int data_rate, y_data_rate; -uint16_t plane_blocks, y_plane_blocks =0 ; - -if (plane_id ==PLANE_CURSOR ) +uint16_t plane_blocks =0 , y_plane_blocks =0 ; +struct skl_plane_wm *wm = &pipe_wm->planes[plane_id]; +uint16_t plane_res_b = wm->wm[max_level].plane_res_b; + +if (plane_id ==PLANE_CURSOR ) { + plane_blocks = +skl_ddb_entry_size (&ddb->plane[pipe][plane_id]); +skl_enable_plane_wm_levels (dev_priv, plane_blocks, + max_level, wm);continue ; + } data_rate = plane_data_rate[plane_id];
@@ -4127,33 +4202,36 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,* promote the expression to 64 bits to avoid overflowing, the * result is < available as data_rate / total_data_rate < 1 */ - plane_blocks = minimum[plane_id]; - plane_blocks +=div_u64 ((uint64_t )alloc_size * data_rate, - total_data_rate);/* Leave disabled planes at (0,0) */ if (data_rate) { + plane_blocks =max (minimum[plane_id], plane_res_b); + plane_blocks +=div_u64 ((uint64_t )alloc_size * + data_rate, total_data_rate); ddb->plane[pipe][plane_id].start = start; ddb->plane[pipe][plane_id].end = start + plane_blocks; + start += plane_blocks; } - start += plane_blocks; -/* * allocation for y_plane part of planar format: +* TODO: Once we start calculating watermark values for Y/UV +* plane both consider it for initial allowed wm blocks. */ y_data_rate = plane_y_data_rate[plane_id]; - y_plane_blocks = y_minimum[plane_id]; - y_plane_blocks +=div_u64 ((uint64_t )alloc_size * y_data_rate, - total_data_rate); -if (y_data_rate) { + y_plane_blocks = y_minimum[plane_id]; + y_plane_blocks +=div_u64 ((uint64_t )alloc_size * + y_data_rate, total_data_rate); ddb->y_plane[pipe][plane_id].start = start; ddb->y_plane[pipe][plane_id].end = start + y_plane_blocks; + start += y_plane_blocks; } - - start += y_plane_blocks; +skl_enable_plane_wm_levels (dev_priv, + plane_blocks, + max_level, + wm); }return 0 ;
@@ -4243,11 +4321,9 @@ skl_adjusted_plane_pixel_rate(const struct intel_crtc_state *cstate,static int skl_compute_plane_wm (const struct drm_i915_private *dev_priv,struct intel_crtc_state *cstate,const struct intel_plane_state *intel_pstate, -uint16_t ddb_allocation,int level,uint16_t *out_blocks,/* out */ -uint8_t *out_lines,/* out */ -bool *enabled/* out */ ) +uint8_t *out_lines/* out */ ) {struct intel_plane *plane =to_intel_plane (intel_pstate->base.plane);const struct drm_plane_state *pstate = &intel_pstate->base;
@@ -4270,10 +4346,8 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,bool y_tiled, x_tiled;if (latency ==0 || - !intel_wm_plane_visible (cstate, intel_pstate)) { - *enabled = false; + !intel_wm_plane_visible (cstate, intel_pstate))return 0 ; - } y_tiled = fb->modifier ==I915_FORMAT_MOD_Y_TILED || fb->modifier == I915_FORMAT_MOD_Yf_TILED;
@@ -4359,9 +4433,6 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,if ((cpp * cstate->base.adjusted_mode.crtc_htotal /512 <1 ) && (plane_bytes_per_line /512 <1 )) selected_result = method2; -else if ((ddb_allocation && ddb_allocation / -fixed_16_16_to_u32_round_up (plane_blocks_per_line)) >=1 ) - selected_result =min_fixed_16_16 (method1, method2);else if (latency >= linetime_us) selected_result =min_fixed_16_16 (method1, method2);else
@@ -4381,64 +4452,42 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv, } } -if (res_blocks >= ddb_allocation || res_lines >31 ) { - *enabled = false; +if (res_lines >=31 && level ==0 ) { +struct drm_plane *plane = pstate->plane; -/* -* If there are no valid level 0 watermarks, then we can't -* support this display configuration. -*/ -if (level) { -return 0 ; - }else { -struct drm_plane *plane = pstate->plane; - -DRM_DEBUG_KMS ("Requested display configuration exceeds system watermark limitations\n" ); -DRM_DEBUG_KMS ("[PLANE:%d:%s] blocks required = %u/%u, lines required = %u/31\n" , - plane->base.id, plane->name, - res_blocks, ddb_allocation, res_lines); -return -EINVAL ; - } +DRM_DEBUG_KMS ("Requested display configuration exceeds system watermark limitations\n" ); +DRM_DEBUG_KMS ("[PLANE:%d:%s] lines required = %u/31\n" , + plane->base.id, plane->name, res_lines); +return -EINVAL ; } *out_blocks = res_blocks; *out_lines = res_lines; - *enabled = true;return 0 ; }static int skl_compute_wm_levels (const struct drm_i915_private *dev_priv, -struct skl_ddb_allocation *ddb,struct intel_crtc_state *cstate,const struct intel_plane_state *intel_pstate,struct skl_plane_wm *wm) { -struct intel_crtc *intel_crtc =to_intel_crtc (cstate->base.crtc); -struct drm_plane *plane = intel_pstate->base.plane; -struct intel_plane *intel_plane =to_intel_plane (plane); -uint16_t ddb_blocks; -enum pipe pipe = intel_crtc->pipe;int level, max_level =ilk_wm_max_level (dev_priv);int ret;if (WARN_ON (!intel_pstate->base.fb))return -EINVAL ; - ddb_blocks =skl_ddb_entry_size (&ddb->plane[pipe][intel_plane->id]); -for (level =0 ; level <= max_level; level++) {struct skl_wm_level *result = &wm->wm[level]; ret =skl_compute_plane_wm (dev_priv, cstate, intel_pstate, - ddb_blocks, level, &result->plane_res_b, - &result->plane_res_l, - &result->plane_en); + &result->plane_res_l);if (ret)return ret; }
@@ -4504,8 +4553,7 @@ static int skl_build_pipe_wm(struct intel_crtc_state *cstate, wm = &pipe_wm->planes[plane_id]; - ret =skl_compute_wm_levels (dev_priv, ddb, cstate, - intel_pstate, wm); + ret =skl_compute_wm_levels (dev_priv, cstate, intel_pstate, wm);if (ret)return ret;skl_compute_transition_wm (cstate, &wm->trans_wm);
@@ -4618,6 +4666,45 @@ bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry **entries,return false; } +static int +skl_ddb_add_affected_planes (struct intel_crtc_state *cstate, +const struct skl_pipe_wm *old_pipe_wm, +const struct skl_pipe_wm *pipe_wm) +{ +struct drm_atomic_state *state = cstate->base.state; +struct drm_device *dev = state->dev; +struct drm_crtc *crtc = cstate->base.crtc; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_private *dev_priv =to_i915 (dev); +struct intel_atomic_state *intel_state =to_intel_atomic_state (state); +struct skl_ddb_allocation *new_ddb = &intel_state->wm_results.ddb; +struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb; +struct drm_plane_state *plane_state; +struct drm_plane *plane; +enum pipe pipe = intel_crtc->pipe; + +WARN_ON (!drm_atomic_get_existing_crtc_state (state, crtc)); + +drm_for_each_plane_mask (plane, dev, cstate->base.plane_mask) { +enum plane_id plane_id =to_intel_plane (plane)->id; +const struct skl_plane_wm *wm = &pipe_wm->planes[plane_id]; +const struct skl_plane_wm *old_wm = &old_pipe_wm->planes[plane_id]; + +if ((skl_ddb_entry_equal (&cur_ddb->plane[pipe][plane_id], + &new_ddb->plane[pipe][plane_id]) && +skl_ddb_entry_equal (&cur_ddb->y_plane[pipe][plane_id], + &new_ddb->y_plane[pipe][plane_id])) && + !memcmp (wm, old_wm,sizeof (struct skl_plane_wm ))) +continue ; + + plane_state =drm_atomic_get_plane_state (state, plane); +if (IS_ERR (plane_state)) +return PTR_ERR (plane_state); + } + +return 0 ; +} + static int skl_update_pipe_wm(struct drm_crtc_state *cstate, const struct skl_pipe_wm *old_pipe_wm, struct skl_pipe_wm *pipe_wm, /* out */
@@ -4631,6 +4718,17 @@ static int skl_update_pipe_wm(struct drm_crtc_state *cstate,if (ret)return ret; + ret =skl_allocate_pipe_ddb (intel_cstate, pipe_wm, ddb); +if (ret) +return ret; +/* +* TODO: Planes are included in state to arm WM registers. +* Scope to optimize further, by just rewriting plane surf register. +*/ + ret =skl_ddb_add_affected_planes (intel_cstate, old_pipe_wm, pipe_wm); +if (ret) +return ret; +if (!memcmp (old_pipe_wm, pipe_wm,sizeof (*pipe_wm))) *changed = false;else
@@ -4653,41 +4751,7 @@ pipes_modified(struct drm_atomic_state *state) }static int -skl_ddb_add_affected_planes (struct intel_crtc_state *cstate) -{ -struct drm_atomic_state *state = cstate->base.state; -struct drm_device *dev = state->dev; -struct drm_crtc *crtc = cstate->base.crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct drm_i915_private *dev_priv =to_i915 (dev); -struct intel_atomic_state *intel_state =to_intel_atomic_state (state); -struct skl_ddb_allocation *new_ddb = &intel_state->wm_results.ddb; -struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb; -struct drm_plane_state *plane_state; -struct drm_plane *plane; -enum pipe pipe = intel_crtc->pipe; - -WARN_ON (!drm_atomic_get_existing_crtc_state (state, crtc)); - -drm_for_each_plane_mask (plane, dev, cstate->base.plane_mask) { -enum plane_id plane_id =to_intel_plane (plane)->id; - -if (skl_ddb_entry_equal (&cur_ddb->plane[pipe][plane_id], - &new_ddb->plane[pipe][plane_id]) && -skl_ddb_entry_equal (&cur_ddb->y_plane[pipe][plane_id], - &new_ddb->y_plane[pipe][plane_id])) -continue ; - - plane_state =drm_atomic_get_plane_state (state, plane); -if (IS_ERR (plane_state)) -return PTR_ERR (plane_state); - } - -return 0 ; -} - -static int -skl_compute_ddb (struct drm_atomic_state *state) +skl_include_affected_crtcs (struct drm_atomic_state *state) {struct drm_device *dev = state->dev;struct drm_i915_private *dev_priv =to_i915 (dev);
@@ -4751,14 +4815,6 @@ skl_compute_ddb(struct drm_atomic_state *state) cstate =intel_atomic_get_crtc_state (state, intel_crtc);if (IS_ERR (cstate))return PTR_ERR (cstate); - - ret =skl_allocate_pipe_ddb (cstate, ddb); -if (ret) -return ret; - - ret =skl_ddb_add_affected_planes (cstate); -if (ret) -return ret; }return 0 ;
@@ -4839,7 +4895,7 @@ skl_compute_wm(struct drm_atomic_state *state)/* Clear all dirty flags */ results->dirty_pipes =0 ; - ret =skl_compute_ddb (state); + ret =skl_include_affected_crtcs (state);if (ret)return ret;
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/2] drm/i915/skl: New ddb allocation algorithm
Mahesh Kumar schreef op do 18-05-2017 om 15:39 [+0530]:
Quoted 32 lines
From: "Kumar, Mahesh" <[email protected]>
This patch implements new DDB allocation algorithm as per HW team recommendation. This algo takecare of scenario where we allocate less DDB
for the planes with lower relative pixel rate, but they require more DDB
to work.
It also takes care of enabling same watermark level for each plane in crtc, for efficient power saving.Changes since v1:
- Rebase on top of Paulo's patch seriesChanges since v2:
- Fix the for loop condition to enable WMChanges since v3:
- Fix crash in cursor i-g-t reported by Maarten
- Rebase after addressing Paulo's comments
- Few other ULT fixes
Changes since v4:
- Rebase on drm-tip
- Added separate function to enable WM levels Changes since v5:
- Fix a crash identified in skl-6770HQ system Changes since v6:
- Address review comments from Matt
Changes since v7:
- Fix failure return inskl_compute_plane_wm(Matt)
- fix typo
Quoted 2 lines
Signed-off-by Mahesh Kumar <[email protected]>Reviewed-by Maarten Lankhorst <[email protected]>
Hm just to be sure it works as intended I tested this against full kms, testsuite and it seems to cause FIFO underruns on my KBL with the kms_atomic_transition test.
I think we shouldn't merge this until all those fifo underruns have been fixed, especially because FIFO underruns may result in a complete lockup of the gpu.
Sorry for the bad news,
Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/2] drm/i915/skl: New ddb allocation algorithm
Hi,
Quoted 35 lines · Maarten
Mahesh Kumar schreef op do 18-05-2017 om 15:39 [+0530]:
Quoted 32 lines
From: "Kumar, Mahesh" <[email protected]>
This patch implements new DDB allocation algorithm as per HW team recommendation. This algo takecare of scenario where we allocate less DDB
for the planes with lower relative pixel rate, but they require more DDB
to work.
It also takes care of enabling same watermark level for each plane in crtc, for efficient power saving.Changes since v1:
- Rebase on top of Paulo's patch seriesChanges since v2:
- Fix the for loop condition to enable WMChanges since v3:
- Fix crash in cursor i-g-t reported by Maarten
- Rebase after addressing Paulo's comments
- Few other ULT fixes
Changes since v4:
- Rebase on drm-tip
- Added separate function to enable WM levels
Changes since v5:
- Fix a crash identified in skl-6770HQ system
Changes since v6:
- Address review comments from Matt
Changes since v7:
- Fix failure return inskl_compute_plane_wm(Matt)
- fix typoQuoted 2 lines
Signed-off-by Mahesh Kumar <[email protected]>Reviewed-by Maarten Lankhorst <[email protected]>
Quoted 7 lines
Hm just to be sure it works as intended I tested this against full kms, testsuite and it seems to cause FIFO underruns on my KBL with the
kms_atomic_transitiontest.I think we shouldn't merge this until all those fifo underruns have been fixed, especially because FIFO underruns may result in a complete lockup of the gpu.
Thanks for trying this out Maarten,
I don't have access to KBL board now. Will try to find one & debug this further.
-Mahesh
Quoted 2 lines
Sorry for the bad news,
Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/2] drm/i915/skl: New ddb allocation algorithm
In reply to Lankhorst, MaartenHi,
Quoted 35 lines · Maarten
Mahesh Kumar schreef op do 18-05-2017 om 15:39 [+0530]:
Quoted 32 lines
From: "Kumar, Mahesh" <[email protected]>
This patch implements new DDB allocation algorithm as per HW team recommendation. This algo takecare of scenario where we allocate less DDB
for the planes with lower relative pixel rate, but they require more DDB
to work.
It also takes care of enabling same watermark level for each plane in crtc, for efficient power saving.Changes since v1:
- Rebase on top of Paulo's patch seriesChanges since v2:
- Fix the for loop condition to enable WMChanges since v3:
- Fix crash in cursor i-g-t reported by Maarten
- Rebase after addressing Paulo's comments
- Few other ULT fixes
Changes since v4:
- Rebase on drm-tip
- Added separate function to enable WM levels
Changes since v5:
- Fix a crash identified in skl-6770HQ system
Changes since v6:
- Address review comments from Matt
Changes since v7:
- Fix failure return inskl_compute_plane_wm(Matt)
- fix typoQuoted 2 lines
Signed-off-by Mahesh Kumar <[email protected]>Reviewed-by Maarten Lankhorst <[email protected]>
Quoted 7 lines
Hm just to be sure it works as intended I tested this against full kms, testsuite and it seems to cause FIFO underruns on my KBL with the
kms_atomic_transitiontest.I think we shouldn't merge this until all those fifo underruns have been fixed, especially because FIFO underruns may result in a complete lockup of the gpu.
After debugging I found when, only cursor plane is enabled, that time total_data_rate is coming 0 because we don't include cursor for total_data_rate calculation.
And because of this we return from skl_allocate_pipe_ddb function without enabling WM levels for cursor plane. As a result cursor plane is enabled without WM getting enabled & resulting "fifo under-run" Fixing it by doing cursor_plane wm enable calculation irrespective of total_data_rate calculation.
-Mahesh
Quoted 3 lines
Sorry for the bad news,
Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915/skl+: consider max supported plane pixel rate while scaling
In reply to Mahesh KumarFrom: "Kumar, Mahesh" <[email protected]>
A display resolution is only supported if it meets all the restrictions below for Maximum Pipe Pixel Rate.
The display resolution must fit within the maximum pixel rate output from the pipe. Make sure that the display pipe is able to feed pixels at a rate required to support the desired resolution.
For each enabled plane on the pipe {
If plane scaling enabled {
Horizontal down scale amount = Maximum[1, plane horizontal size /
scaler horizontal window size]
Vertical down scale amount = Maximum[1, plane vertical size /
scaler vertical window size]
Plane down scale amount = Horizontal down scale amount *
Vertical down scale amount
Plane Ratio = 1 / Plane down scale amount
}
Else {
Plane Ratio = 1
}
If plane source pixel format is 64 bits per pixel {
Plane Ratio = Plane Ratio * 8/9
}
}
Pipe Ratio = Minimum Plane Ratio of all enabled planes on the pipe
If pipe scaling is enabled {
Horizontal down scale amount = Maximum[1, pipe horizontal source size /
scaler horizontal window size]
Vertical down scale amount = Maximum[1, pipe vertical source size /
scaler vertical window size]
Note: The progressive fetch - interlace display mode is equivalent to a
2.0 vertical down scale
Pipe down scale amount = Horizontal down scale amount *
Vertical down scale amount
Pipe Ratio = Pipe Ratio / Pipe down scale amount
}
Pipe maximum pixel rate = CDCLK frequency * Pipe Ratio
In this patch our calculation is based on pipe downscale amount (plane max downscale amount * pipe downscale amount) instead of Pipe Ratio. So,
max supported crtc clock with given scaling = CDCLK / pipe downscale. Flip will fail if,
current crtc clock > max supported crct clock with given scaling.
Changes since V1:
- separate out fixed_16_16 wrapper API definition
Changes since V2:
- Fix buggy crtc !active condition (Maarten)
- use intel_wm_plane_visible wrapper as per Maarten's suggestion
Changes since V3:
- Change failure return from ERANGE to EINVAL
Changes since V4:
- Rebase based on previous patch changes
Changes since V5:
- return EINVAL instead of continue (Maarten)
Changes since V6:
- Improve commit message
- Address review comment
--- drivers/gpu/drm/i915/intel_display.c | 3 ++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_pm.c | 87 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -11177,6 +11177,9 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc, ret =skl_update_scaler_crtc (pipe_config);if (!ret) + ret =skl_check_pipe_max_pixel_rate (intel_crtc, + pipe_config); +if (!ret) ret =intel_atomic_setup_scalers (dev_priv, intel_crtc, pipe_config); }
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1885,6 +1885,8 @@ bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry **entries, int ignore);bool ilk_disable_lp_wm (struct drm_device *dev);int sanitize_rc6_option (struct drm_i915_private *dev_priv,int enable_rc6); +int skl_check_pipe_max_pixel_rate (struct intel_crtc *intel_crtc, +struct intel_crtc_state *cstate);static inline int intel_enable_rc6 (void ) {return i915.enable_rc6;
drivers/gpu/drm/i915/intel_pm.c +87 -0
93 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915/skl+: consider max supported plane pixel rate while scaling
Mahesh Kumar schreef op do 18-05-2017 om 15:39 [+0530]:
Quoted 126 lines
From: "Kumar, Mahesh" <[email protected]>
A display resolution is only supported if it meets all the restrictions
below for Maximum Pipe Pixel Rate.The display resolution must fit within the maximum pixel rate output from the pipe. Make sure that the display pipe is able to feed pixels at
a rate required to support the desired resolution.
For each enabled plane on the pipe {
If plane scaling enabled {
Horizontal down scale amount = Maximum[1, plane horizontal size
/
scaler horizontal window size]
Vertical down scale amount = Maximum[1, plane vertical size /
scaler vertical window size]
Plane down scale amount = Horizontal down scale amount *
Vertical down scale amount
Plane Ratio = 1 / Plane down scale amount
}
Else {
Plane Ratio = 1
}
If plane source pixel format is 64 bits per pixel {
Plane Ratio = Plane Ratio * 8/9
}
}Pipe Ratio = Minimum Plane Ratio of all enabled planes on the pipe
If pipe scaling is enabled {
Horizontal down scale amount = Maximum[1, pipe horizontal source size /
scaler horizontal window size]
Vertical down scale amount = Maximum[1, pipe vertical source size /
scaler vertical window size]
Note: The progressive fetch - interlace display mode is equivalent to a
2.0 vertical down scale
Pipe down scale amount = Horizontal down scale amount *
Vertical down scale amount
Pipe Ratio = Pipe Ratio / Pipe down scale amount
}Pipe maximum pixel rate = CDCLK frequency * Pipe Ratio
In this patch our calculation is based on pipe downscale amount (plane max downscale amount * pipe downscale amount) instead of Pipe Ratio. So,
max supported crtc clock with given scaling = CDCLK / pipe downscale. Flip will fail if,
current crtc clock > max supported crct clock with given scaling.Changes since V1:
- separate outfixed_16_16wrapper API definition Changes since V2:
- Fix buggy crtc !active condition (Maarten)
- useintel_wm_plane_visiblewrapper as per Maarten's suggestion Changes since V3:
- Change failure return from ERANGE to EINVAL
Changes since V4:
- Rebase based on previous patch changes
Changes since V5:
- return EINVAL instead of continue (Maarten)
Changes since V6:
- Improve commit message
- Address review commentSigned-off-by Mahesh Kumar <[email protected]>Reviewed-by Matt Roper <[email protected]>Reviewed-by Maarten Lankhorst <[email protected]>---
drivers/gpu/drm/i915/intel_display.c | 3 ++
drivers/gpu/drm/i915/intel_drv.h | 2 +
drivers/gpu/drm/i915/intel_pm.c | 87
++++++++++++++++++++++++++++++++++++3 files changed, 92 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -11177,6 +11177,9 @@ static int intel_crtc_atomic_check(structdrm_crtc *crtc, ret = skl_update_scaler_crtc(pipe_config);
if (!ret)drivers/gpu/drm/i915/intel_display.c +1
-0+ ret =skl_check_pipe_max_pixel_rate(intel_crtc,
drivers/gpu/drm/i915/intel_display.c +1
-0+ pipe_config);
drivers/gpu/drm/i915/intel_display.c +1
-0+if (!ret)ret = intel_atomic_setup_scalers(dev_priv,
intel_crtc,
pipe_config );
}drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1885,6 +1885,8 @@ bool skl_ddb_allocation_overlaps(const structskl_ddb_entry **entries, int ignore); bool ilk_disable_lp_wm(struct drm_device *dev);int
sanitize_rc6_option(struct drm_i915_private *dev_priv, int enable_rc6);drivers/gpu/drm/i915/intel_drv.h +2
-0+int skl_check_pipe_max_pixel_rate (struct intel_crtc *intel_crtc, + struct intel_crtc_state *cstate);static inline int
intel_enable_rc6(void)
{
return i915.enable_rc6;drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -3863,6 +3863,93 @@ skl_plane_downscale_amount(const structintel_crtc_state *cstate, return mul_fixed16(downscale_w, downscale_h); }
drivers/gpu/drm/i915/intel_pm.c skl_plane_downscale_amount(const struct intel_crtc_state *cstate, · line 3872
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +7
-0+static uint_fixed_16_16_t +skl_pipe_downscale_amount (const struct intel_crtc_state *config) +{ +uint_fixed_16_16_t pipe_downscale =u32_to_fixed_16_16 (1 ); + +if (!config->base.active) +return pipe_downscale;
Sorry, just one more thing I failed to notice the first time around.
I think this should be config->base.enable, in case of !active the crtc is configured as if it's on, and it's ok to run scaling checks here. The existing code expects this as well.
config should probably be renamed to crtc_state, or pipe_config. :) Either is more consistent with current code.
Quoted 34 lines
drivers/gpu/drm/i915/intel_pm.c +18
-0+ +if (config->pch_pfit.enabled) { +uint32_t src_w, src_h, dst_w, dst_h; +uint32_t pfit_size = config->pch_pfit.size; +uint_fixed_16_16_t fp_w_ratio, fp_h_ratio; +uint_fixed_16_16_t downscale_h, downscale_w; + + src_w = config->pipe_src_w; + src_h = config->pipe_src_h; + dst_w = pfit_size >>16 ; + dst_h = pfit_size &0xffff ; + +if (!dst_w || !dst_h) +return pipe_downscale; + + fp_w_ratio =fixed_16_16_div (src_w, dst_w); + fp_h_ratio =fixed_16_16_div (src_h, dst_h); + downscale_w = max_fixed_16_16(fp_w_ratio,
u32_to_fixed_16_16(1));drivers/gpu/drm/i915/intel_pm.c +1
-0+ downscale_h = max_fixed_16_16(fp_h_ratio,
u32_to_fixed_16_16(1));drivers/gpu/drm/i915/intel_pm.c +2
-0+ + pipe_downscale = mul_fixed16(downscale_w,
downscale_h);drivers/gpu/drm/i915/intel_pm.c +10
-0+ } + +return pipe_downscale; +} + +int skl_check_pipe_max_pixel_rate (struct intel_crtc *intel_crtc, + struct intel_crtc_state *cstate) +{ +struct drm_crtc_state *crtc_state = &cstate->base; +struct drm_atomic_state *state = crtc_state->state;
drivers/gpu/drm/i915/intel_pm.c skl_plane_downscale_amount(const struct intel_crtc_state *cstate, · line 3913
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+struct drm_plane *plane; +const struct drm_plane_state *pstate; +struct intel_plane_state *intel_pstate; +int crtc_clock, cdclk; +uint32_t pipe_max_pixel_rate; +uint_fixed_16_16_t pipe_downscale; +uint_fixed_16_16_t max_downscale =u32_to_fixed_16_16 (1 ); + +if (!cstate->base.active) +return 0 ;
This one can be changed to enable as well I hope, though the FIXME in intel_wm_plane_visible applies.. :)
Quoted 46 lines
drivers/gpu/drm/i915/intel_pm.c +1
-0+ drm_atomic_crtc_state_for_each_plane_state(plane, pstate,
crtc_state) {drivers/gpu/drm/i915/intel_pm.c +2
-0+uint_fixed_16_16_t plane_downscale; + uint_fixed_16_16_t fp_9_div_8 = fixed_16_16_div(9,8);
drivers/gpu/drm/i915/intel_pm.c +4
-0+int bpp; + + if (!intel_wm_plane_visible(cstate, + to_intel_plane_state(pstate)))
drivers/gpu/drm/i915/intel_pm.c +8
-0+continue ; + +if (WARN_ON (!pstate->fb)) +return -EINVAL ; + + intel_pstate =to_intel_plane_state (pstate); + plane_downscale =skl_plane_downscale_amount (cstate, + intel_pstate);
drivers/gpu/drm/i915/intel_pm.c +3
-0+ bpp = pstate->fb->format->cpp[0 ] *8 ; +if (bpp ==64 ) + plane_downscale =mul_fixed16(plane_downscale,
drivers/gpu/drm/i915/intel_pm.c +3
-0+ fp_9_div_8); + + max_downscale = max_fixed_16_16(plane_downscale,
max_downscale);drivers/gpu/drm/i915/intel_pm.c +8
-0+ } + pipe_downscale =skl_pipe_downscale_amount (cstate); + + pipe_downscale =mul_fixed16 (pipe_downscale, max_downscale); + + crtc_clock = crtc_state->adjusted_mode.crtc_clock; + cdclk =to_intel_atomic_state (state)->cdclk.logical.cdclk; + pipe_max_pixel_rate = div_round_up_u32_fixed16(cdclk,
pipe_downscale);drivers/gpu/drm/i915/intel_pm.c +3
-0+ +if (pipe_max_pixel_rate < crtc_clock) { + DRM_ERROR("Max supported pixel clock with scalingexceeded\n");
drivers/gpu/drm/i915/intel_pm.c +6
-0+return -EINVAL ; + } + +return 0 ; +} +
Quoted 3 lines
static unsigned int
skl_plane_relative_data_rate(const structintel_crtc_state*cstate, const structdrm_plane_state*pstate,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Remaining patches for WM cleanup series
In reply to Mahesh Kumar== Series Details ==
== Series Details ==
Series: Remaining patches for WM cleanup series
URL : https://patchwork.freedesktop.org/series/24615/
State : success
== Summary ==
Series 24615v1 Remaining patches for WM cleanup series
https://patchwork.freedesktop.org/api/1.0/series/24615/revisions/1/mbox/
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:453s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:441s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:586s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:510s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:494s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:490s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:424s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:409s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:414s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:500s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:460s fi-kbl-7500u total:278 pass:255 dwarn:5 dfail:0 fail:0 skip:18 time:462s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:461s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time:583s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:474s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:506s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:438s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:539s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:400s
d89ce671546724cca610b42c95218532991a480c drm-tip: 2017y-05m-18d-12h-42m-48s UTC integration manifest 75a9815 drm/i915/skl+: consider max supported plane pixel rate while scaling
c1e30f9 drm/i915/skl: New ddb allocation algorithm
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4737/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx