mirror of
https://github.com/torvalds/linux.git
synced 2026-05-02 05:22:49 -04:00
drm/i915: Use REG_BIT() & co for the pre-ilk pfit registers
Modernize the gmch pfit register definitions using REG_BIT/etc. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230418175528.13117-6-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
@@ -2749,6 +2749,7 @@ static void i9xx_get_pfit_config(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
enum pipe pipe;
|
||||
u32 tmp;
|
||||
|
||||
if (!i9xx_has_pfit(dev_priv))
|
||||
@@ -2759,13 +2760,13 @@ static void i9xx_get_pfit_config(struct intel_crtc_state *crtc_state)
|
||||
return;
|
||||
|
||||
/* Check whether the pfit is attached to our pipe. */
|
||||
if (DISPLAY_VER(dev_priv) < 4) {
|
||||
if (crtc->pipe != PIPE_B)
|
||||
return;
|
||||
} else {
|
||||
if ((tmp & PFIT_PIPE_MASK) != (crtc->pipe << PFIT_PIPE_SHIFT))
|
||||
return;
|
||||
}
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
pipe = REG_FIELD_GET(PFIT_PIPE_MASK, tmp);
|
||||
else
|
||||
pipe = PIPE_B;
|
||||
|
||||
if (pipe != crtc->pipe)
|
||||
return;
|
||||
|
||||
crtc_state->gmch_pfit.control = tmp;
|
||||
crtc_state->gmch_pfit.pgm_ratios =
|
||||
|
||||
@@ -935,21 +935,25 @@ static int check_overlay_possible_on_crtc(struct intel_overlay *overlay,
|
||||
static void update_pfit_vscale_ratio(struct intel_overlay *overlay)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = overlay->i915;
|
||||
u32 pfit_control = intel_de_read(dev_priv, PFIT_CONTROL);
|
||||
u32 ratio;
|
||||
|
||||
/* XXX: This is not the same logic as in the xorg driver, but more in
|
||||
* line with the intel documentation for the i965
|
||||
*/
|
||||
if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
u32 tmp = intel_de_read(dev_priv, PFIT_PGM_RATIOS);
|
||||
|
||||
/* on i965 use the PGM reg to read out the autoscaler values */
|
||||
ratio = intel_de_read(dev_priv, PFIT_PGM_RATIOS) >> PFIT_VERT_SCALE_SHIFT_965;
|
||||
ratio = REG_FIELD_GET(PFIT_VERT_SCALE_MASK_965, tmp);
|
||||
} else {
|
||||
if (pfit_control & VERT_AUTO_SCALE)
|
||||
ratio = intel_de_read(dev_priv, PFIT_AUTO_RATIOS);
|
||||
u32 tmp;
|
||||
|
||||
if (intel_de_read(dev_priv, PFIT_CONTROL) & VERT_AUTO_SCALE)
|
||||
tmp = intel_de_read(dev_priv, PFIT_AUTO_RATIOS);
|
||||
else
|
||||
ratio = intel_de_read(dev_priv, PFIT_PGM_RATIOS);
|
||||
ratio >>= PFIT_VERT_SCALE_SHIFT;
|
||||
tmp = intel_de_read(dev_priv, PFIT_PGM_RATIOS);
|
||||
|
||||
ratio = REG_FIELD_GET(PFIT_VERT_SCALE_MASK, tmp);
|
||||
}
|
||||
|
||||
overlay->pfit_vscale_ratio = ratio;
|
||||
|
||||
@@ -564,8 +564,8 @@ static void i9xx_scale_aspect(struct intel_crtc_state *crtc_state,
|
||||
bits = panel_fitter_scaling(pipe_src_h,
|
||||
adjusted_mode->crtc_vdisplay);
|
||||
|
||||
*pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT |
|
||||
bits << PFIT_VERT_SCALE_SHIFT);
|
||||
*pfit_pgm_ratios |= (PFIT_HORIZ_SCALE(bits) |
|
||||
PFIT_VERT_SCALE(bits));
|
||||
*pfit_control |= (PFIT_ENABLE |
|
||||
VERT_INTERP_BILINEAR |
|
||||
HORIZ_INTERP_BILINEAR);
|
||||
@@ -579,8 +579,8 @@ static void i9xx_scale_aspect(struct intel_crtc_state *crtc_state,
|
||||
bits = panel_fitter_scaling(pipe_src_w,
|
||||
adjusted_mode->crtc_hdisplay);
|
||||
|
||||
*pfit_pgm_ratios |= (bits << PFIT_HORIZ_SCALE_SHIFT |
|
||||
bits << PFIT_VERT_SCALE_SHIFT);
|
||||
*pfit_pgm_ratios |= (PFIT_HORIZ_SCALE(bits) |
|
||||
PFIT_VERT_SCALE(bits));
|
||||
*pfit_control |= (PFIT_ENABLE |
|
||||
VERT_INTERP_BILINEAR |
|
||||
HORIZ_INTERP_BILINEAR);
|
||||
|
||||
Reference in New Issue
Block a user