Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/display: Configure the second scaler

Both sharpness and panel fitter use pipe scaler,
but only one can be enabled at a time. Furthermore
sharpness uses second scaler. So for CASF, check if
second scaler is available and make sure that only
either of panel fitter or sharpness is enabled at
a time.

v2: Add the panel fitting check before enabling sharpness
v3: Reframe commit message[Arun]
v4: Replace string based comparison with plane_state[Jani]
v5: Rebase
v6: Fix build issue
v7: Remove scaler id from verify_crtc_state[Ankit]
v8: Change the patch title. Add code comment.
Move the config part in patch#6. [Ankit]
v9: Refactor the patch[Ankit]
v10: Modify the header of patch[Ankit]

Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patch.msgid.link/20251028120747.3027332-8-ankit.k.nautiyal@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

authored by

Nemesa Garg and committed by
Jani Nikula
0672cf98 82860cba

+31 -7
+8
drivers/gpu/drm/i915/display/intel_casf.c
··· 156 156 } 157 157 } 158 158 159 + bool intel_casf_needs_scaler(const struct intel_crtc_state *crtc_state) 160 + { 161 + if (crtc_state->hw.casf_params.casf_enable) 162 + return true; 163 + 164 + return false; 165 + } 166 + 159 167 static int casf_coeff_tap(int i) 160 168 { 161 169 return i % SCALER_FILTER_NUM_TAPS;
+1
drivers/gpu/drm/i915/display/intel_casf.h
··· 16 16 void intel_casf_enable(struct intel_crtc_state *crtc_state); 17 17 void intel_casf_disable(const struct intel_crtc_state *crtc_state); 18 18 void intel_casf_scaler_compute_config(struct intel_crtc_state *crtc_state); 19 + bool intel_casf_needs_scaler(const struct intel_crtc_state *crtc_state); 19 20 20 21 #endif /* __INTEL_CASF_H__ */
+3 -1
drivers/gpu/drm/i915/display/intel_display.c
··· 60 60 #include "intel_audio.h" 61 61 #include "intel_bo.h" 62 62 #include "intel_bw.h" 63 + #include "intel_casf.h" 63 64 #include "intel_cdclk.h" 64 65 #include "intel_clock_gating.h" 65 66 #include "intel_color.h" ··· 4230 4229 4231 4230 if (DISPLAY_VER(display) >= 9) { 4232 4231 if (intel_crtc_needs_modeset(crtc_state) || 4233 - intel_crtc_needs_fastset(crtc_state)) { 4232 + intel_crtc_needs_fastset(crtc_state) || 4233 + intel_casf_needs_scaler(crtc_state)) { 4234 4234 ret = skl_update_scaler_crtc(crtc_state); 4235 4235 if (ret) 4236 4236 return ret;
+19 -6
drivers/gpu/drm/i915/display/skl_scaler.c
··· 6 6 #include <drm/drm_print.h> 7 7 8 8 #include "i915_utils.h" 9 + #include "intel_casf.h" 9 10 #include "intel_casf_regs.h" 10 11 #include "intel_de.h" 11 12 #include "intel_display_regs.h" ··· 284 283 drm_rect_width(&crtc_state->pipe_src), 285 284 drm_rect_height(&crtc_state->pipe_src), 286 285 width, height, NULL, 0, 287 - crtc_state->pch_pfit.enabled); 286 + crtc_state->pch_pfit.enabled || 287 + intel_casf_needs_scaler(crtc_state)); 288 288 } 289 289 290 290 /** ··· 324 322 } 325 323 326 324 static int intel_allocate_scaler(struct intel_crtc_scaler_state *scaler_state, 327 - struct intel_crtc *crtc) 325 + struct intel_crtc *crtc, 326 + struct intel_plane_state *plane_state, 327 + bool casf_scaler) 328 328 { 329 329 int i; 330 330 331 331 for (i = 0; i < crtc->num_scalers; i++) { 332 332 if (scaler_state->scalers[i].in_use) 333 + continue; 334 + 335 + /* CASF needs second scaler */ 336 + if (!plane_state && casf_scaler && i != 1) 333 337 continue; 334 338 335 339 scaler_state->scalers[i].in_use = true; ··· 388 380 int num_scalers_need, struct intel_crtc *crtc, 389 381 const char *name, int idx, 390 382 struct intel_plane_state *plane_state, 391 - int *scaler_id) 383 + int *scaler_id, bool casf_scaler) 392 384 { 393 385 struct intel_display *display = to_intel_display(crtc); 394 386 struct intel_crtc_scaler_state *scaler_state = &crtc_state->scaler_state; ··· 397 389 int vscale = 0; 398 390 399 391 if (*scaler_id < 0) 400 - *scaler_id = intel_allocate_scaler(scaler_state, crtc); 392 + *scaler_id = intel_allocate_scaler(scaler_state, crtc, plane_state, casf_scaler); 401 393 402 394 if (drm_WARN(display->drm, *scaler_id < 0, 403 395 "Cannot find scaler for %s:%d\n", name, idx)) ··· 529 521 struct intel_crtc_scaler_state *scaler_state = 530 522 &crtc_state->scaler_state; 531 523 524 + if (intel_casf_needs_scaler(crtc_state) && crtc_state->pch_pfit.enabled) 525 + return -EINVAL; 526 + 532 527 return intel_atomic_setup_scaler(crtc_state, 533 528 hweight32(scaler_state->scaler_users), 534 529 crtc, "CRTC", crtc->base.base.id, 535 - NULL, &scaler_state->scaler_id); 530 + NULL, &scaler_state->scaler_id, 531 + intel_casf_needs_scaler(crtc_state)); 536 532 } 537 533 538 534 static int setup_plane_scaler(struct intel_atomic_state *state, ··· 571 559 return intel_atomic_setup_scaler(crtc_state, 572 560 hweight32(scaler_state->scaler_users), 573 561 crtc, "PLANE", plane->base.base.id, 574 - plane_state, &plane_state->scaler_id); 562 + plane_state, &plane_state->scaler_id, 563 + false); 575 564 } 576 565 577 566 /**