mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-08 12:52:40 -04:00
drm/i915/pfit: Check pfit destination window on ILK-BDW
The ILK-BDW panel fitter has several restrictions on the destination window size. Check for those and reject the configuration if things aren't entirely proper. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241016143134.26903-7-ville.syrjala@linux.intel.com Acked-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
@@ -383,6 +383,57 @@ void intel_panel_add_encoder_fixed_mode(struct intel_connector *connector,
|
||||
"current (BIOS)");
|
||||
}
|
||||
|
||||
static int intel_pch_pfit_check_dst_window(const 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);
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc_state->hw.adjusted_mode;
|
||||
const struct drm_rect *dst = &crtc_state->pch_pfit.dst;
|
||||
int width = drm_rect_width(dst);
|
||||
int height = drm_rect_height(dst);
|
||||
int x = dst->x1;
|
||||
int y = dst->y1;
|
||||
|
||||
if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE &&
|
||||
(y & 1 || height & 1)) {
|
||||
drm_dbg_kms(display->drm,
|
||||
"[CRTC:%d:%s] pfit window (" DRM_RECT_FMT ") misaligned for interlaced output\n",
|
||||
crtc->base.base.id, crtc->base.name, DRM_RECT_ARG(dst));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* "Restriction : When pipe scaling is enabled, the scaled
|
||||
* output must equal the pipe active area, so Pipe active
|
||||
* size = (2 * PF window position) + PF window size."
|
||||
*
|
||||
* The vertical direction seems more forgiving than the
|
||||
* horizontal direction, but still has some issues so
|
||||
* let's follow the same hard rule for both.
|
||||
*/
|
||||
if (adjusted_mode->crtc_hdisplay != 2 * x + width ||
|
||||
adjusted_mode->crtc_vdisplay != 2 * y + height) {
|
||||
drm_dbg_kms(display->drm,
|
||||
"[CRTC:%d:%s] pfit window (" DRM_RECT_FMT ") not centered\n",
|
||||
crtc->base.base.id, crtc->base.name, DRM_RECT_ARG(dst));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* "Restriction : The X position must not be programmed
|
||||
* to be 1 (28:16=0 0000 0000 0001b)."
|
||||
*/
|
||||
if (x == 1) {
|
||||
drm_dbg_kms(display->drm,
|
||||
"[CRTC:%d:%s] pfit window (" DRM_RECT_FMT ") badly positioned\n",
|
||||
crtc->base.base.id, crtc->base.name, DRM_RECT_ARG(dst));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intel_pch_pfit_check_src_size(const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_display *display = to_intel_display(crtc_state);
|
||||
@@ -575,6 +626,10 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
|
||||
if (DISPLAY_VER(display) >= 9)
|
||||
return 0;
|
||||
|
||||
ret = intel_pch_pfit_check_dst_window(crtc_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = intel_pch_pfit_check_src_size(crtc_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user