Merge tag 'drm-intel-next-2021-04-01' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
Features: - Add support for FBs requiring a power-of-two stride padding (Imre) Refactoring: - Disassociate display version from gen (Matt) - Refactor legacy DP and HDMI code to separate files (Ville) - Refactor FB plane code to a separate file (Imre) - Refactor VBT child device info parsing and usage (Jani) - Refactor KBL/TGL/ADL-S display and gt stepping schemes (Jani) Fixes: - DP Link-Training Tunable PHY Repeaters (LTTPR) fixes (Imre) - HDCP fixes (Anshuman) - DP 2.0 HDMI 2.1 PCON Fixed Rate Link (FRL) fixes (Ankit) - Set HDA link parameters in driver (Kai) - Fix enabled_planes bitmask (Ville) - Fix transposed arguments to skl_plane_wm_level() (Ville) - Stop adding planes to the commit needlessly (Ville) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/87v996ml17.fsf@intel.com
This commit is contained in:
commit
9c0fed84d5
@ -2635,14 +2635,16 @@ EXPORT_SYMBOL(drm_dp_pcon_is_frl_ready);
|
||||
* drm_dp_pcon_frl_configure_1() - Set HDMI LINK Configuration-Step1
|
||||
* @aux: DisplayPort AUX channel
|
||||
* @max_frl_gbps: maximum frl bw to be configured between PCON and HDMI sink
|
||||
* @concurrent_mode: true if concurrent mode or operation is required,
|
||||
* false otherwise.
|
||||
* @frl_mode: FRL Training mode, it can be either Concurrent or Sequential.
|
||||
* In Concurrent Mode, the FRL link bring up can be done along with
|
||||
* DP Link training. In Sequential mode, the FRL link bring up is done prior to
|
||||
* the DP Link training.
|
||||
*
|
||||
* Returns 0 if success, else returns negative error code.
|
||||
*/
|
||||
|
||||
int drm_dp_pcon_frl_configure_1(struct drm_dp_aux *aux, int max_frl_gbps,
|
||||
bool concurrent_mode)
|
||||
u8 frl_mode)
|
||||
{
|
||||
int ret;
|
||||
u8 buf;
|
||||
@ -2651,7 +2653,7 @@ int drm_dp_pcon_frl_configure_1(struct drm_dp_aux *aux, int max_frl_gbps,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (concurrent_mode)
|
||||
if (frl_mode == DP_PCON_ENABLE_CONCURRENT_LINK)
|
||||
buf |= DP_PCON_ENABLE_CONCURRENT_LINK;
|
||||
else
|
||||
buf &= ~DP_PCON_ENABLE_CONCURRENT_LINK;
|
||||
@ -2694,21 +2696,23 @@ EXPORT_SYMBOL(drm_dp_pcon_frl_configure_1);
|
||||
* drm_dp_pcon_frl_configure_2() - Set HDMI Link configuration Step-2
|
||||
* @aux: DisplayPort AUX channel
|
||||
* @max_frl_mask : Max FRL BW to be tried by the PCON with HDMI Sink
|
||||
* @extended_train_mode : true for Extended Mode, false for Normal Mode.
|
||||
* In Normal mode, the PCON tries each frl bw from the max_frl_mask starting
|
||||
* from min, and stops when link training is successful. In Extended mode, all
|
||||
* frl bw selected in the mask are trained by the PCON.
|
||||
* @frl_type : FRL training type, can be Extended, or Normal.
|
||||
* In Normal FRL training, the PCON tries each frl bw from the max_frl_mask
|
||||
* starting from min, and stops when link training is successful. In Extended
|
||||
* FRL training, all frl bw selected in the mask are trained by the PCON.
|
||||
*
|
||||
* Returns 0 if success, else returns negative error code.
|
||||
*/
|
||||
int drm_dp_pcon_frl_configure_2(struct drm_dp_aux *aux, int max_frl_mask,
|
||||
bool extended_train_mode)
|
||||
u8 frl_type)
|
||||
{
|
||||
int ret;
|
||||
u8 buf = max_frl_mask;
|
||||
|
||||
if (extended_train_mode)
|
||||
if (frl_type == DP_PCON_FRL_LINK_TRAIN_EXTENDED)
|
||||
buf |= DP_PCON_FRL_LINK_TRAIN_EXTENDED;
|
||||
else
|
||||
buf &= ~DP_PCON_FRL_LINK_TRAIN_EXTENDED;
|
||||
|
||||
ret = drm_dp_dpcd_writeb(aux, DP_PCON_HDMI_LINK_CONFIG_2, buf);
|
||||
if (ret < 0)
|
||||
|
@ -52,6 +52,7 @@ i915-y += i915_drv.o \
|
||||
intel_pm.o \
|
||||
intel_runtime_pm.o \
|
||||
intel_sideband.o \
|
||||
intel_step.o \
|
||||
intel_uncore.o \
|
||||
intel_wakeref.o \
|
||||
vlv_suspend.o
|
||||
@ -208,6 +209,7 @@ i915-y += \
|
||||
display/intel_dpll.o \
|
||||
display/intel_dpll_mgr.o \
|
||||
display/intel_dsb.o \
|
||||
display/intel_fb.o \
|
||||
display/intel_fbc.o \
|
||||
display/intel_fdi.o \
|
||||
display/intel_fifo_underrun.o \
|
||||
@ -239,6 +241,8 @@ i915-y += \
|
||||
display/dvo_ns2501.o \
|
||||
display/dvo_sil164.o \
|
||||
display/dvo_tfp410.o \
|
||||
display/g4x_dp.o \
|
||||
display/g4x_hdmi.o \
|
||||
display/icl_dsi.o \
|
||||
display/intel_crt.o \
|
||||
display/intel_ddi.o \
|
||||
|
1432
drivers/gpu/drm/i915/display/g4x_dp.c
Normal file
1432
drivers/gpu/drm/i915/display/g4x_dp.c
Normal file
File diff suppressed because it is too large
Load Diff
30
drivers/gpu/drm/i915/display/g4x_dp.h
Normal file
30
drivers/gpu/drm/i915/display/g4x_dp.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
/*
|
||||
* Copyright © 2020 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef _G4X_DP_H_
|
||||
#define _G4X_DP_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "i915_reg.h"
|
||||
|
||||
enum pipe;
|
||||
enum port;
|
||||
struct drm_i915_private;
|
||||
struct intel_crtc_state;
|
||||
struct intel_dp;
|
||||
struct intel_encoder;
|
||||
|
||||
const struct dpll *vlv_get_dpll(struct drm_i915_private *i915);
|
||||
enum pipe vlv_active_pipe(struct intel_dp *intel_dp);
|
||||
void g4x_dp_set_clock(struct intel_encoder *encoder,
|
||||
struct intel_crtc_state *pipe_config);
|
||||
bool g4x_dp_port_enabled(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t dp_reg, enum port port,
|
||||
enum pipe *pipe);
|
||||
bool g4x_dp_init(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t output_reg, enum port port);
|
||||
|
||||
#endif
|
616
drivers/gpu/drm/i915/display/g4x_hdmi.c
Normal file
616
drivers/gpu/drm/i915/display/g4x_hdmi.c
Normal file
@ -0,0 +1,616 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright © 2020 Intel Corporation
|
||||
*
|
||||
* HDMI support for G4x,ILK,SNB,IVB,VLV,CHV (HSW+ handled by the DDI code).
|
||||
*/
|
||||
|
||||
#include "g4x_hdmi.h"
|
||||
#include "intel_audio.h"
|
||||
#include "intel_connector.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_dpio_phy.h"
|
||||
#include "intel_fifo_underrun.h"
|
||||
#include "intel_hdmi.h"
|
||||
#include "intel_hotplug.h"
|
||||
#include "intel_sideband.h"
|
||||
#include "intel_sdvo.h"
|
||||
|
||||
static void intel_hdmi_prepare(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
|
||||
u32 hdmi_val;
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
|
||||
|
||||
hdmi_val = SDVO_ENCODING_HDMI;
|
||||
if (!HAS_PCH_SPLIT(dev_priv) && crtc_state->limited_color_range)
|
||||
hdmi_val |= HDMI_COLOR_RANGE_16_235;
|
||||
if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
|
||||
hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH;
|
||||
if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
|
||||
hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH;
|
||||
|
||||
if (crtc_state->pipe_bpp > 24)
|
||||
hdmi_val |= HDMI_COLOR_FORMAT_12bpc;
|
||||
else
|
||||
hdmi_val |= SDVO_COLOR_FORMAT_8bpc;
|
||||
|
||||
if (crtc_state->has_hdmi_sink)
|
||||
hdmi_val |= HDMI_MODE_SELECT_HDMI;
|
||||
|
||||
if (HAS_PCH_CPT(dev_priv))
|
||||
hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe);
|
||||
else if (IS_CHERRYVIEW(dev_priv))
|
||||
hdmi_val |= SDVO_PIPE_SEL_CHV(crtc->pipe);
|
||||
else
|
||||
hdmi_val |= SDVO_PIPE_SEL(crtc->pipe);
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, hdmi_val);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
}
|
||||
|
||||
static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
|
||||
enum pipe *pipe)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
intel_wakeref_t wakeref;
|
||||
bool ret;
|
||||
|
||||
wakeref = intel_display_power_get_if_enabled(dev_priv,
|
||||
encoder->power_domain);
|
||||
if (!wakeref)
|
||||
return false;
|
||||
|
||||
ret = intel_sdvo_port_enabled(dev_priv, intel_hdmi->hdmi_reg, pipe);
|
||||
|
||||
intel_display_power_put(dev_priv, encoder->power_domain, wakeref);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void intel_hdmi_get_config(struct intel_encoder *encoder,
|
||||
struct intel_crtc_state *pipe_config)
|
||||
{
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
u32 tmp, flags = 0;
|
||||
int dotclock;
|
||||
|
||||
pipe_config->output_types |= BIT(INTEL_OUTPUT_HDMI);
|
||||
|
||||
tmp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
if (tmp & SDVO_HSYNC_ACTIVE_HIGH)
|
||||
flags |= DRM_MODE_FLAG_PHSYNC;
|
||||
else
|
||||
flags |= DRM_MODE_FLAG_NHSYNC;
|
||||
|
||||
if (tmp & SDVO_VSYNC_ACTIVE_HIGH)
|
||||
flags |= DRM_MODE_FLAG_PVSYNC;
|
||||
else
|
||||
flags |= DRM_MODE_FLAG_NVSYNC;
|
||||
|
||||
if (tmp & HDMI_MODE_SELECT_HDMI)
|
||||
pipe_config->has_hdmi_sink = true;
|
||||
|
||||
pipe_config->infoframes.enable |=
|
||||
intel_hdmi_infoframes_enabled(encoder, pipe_config);
|
||||
|
||||
if (pipe_config->infoframes.enable)
|
||||
pipe_config->has_infoframe = true;
|
||||
|
||||
if (tmp & HDMI_AUDIO_ENABLE)
|
||||
pipe_config->has_audio = true;
|
||||
|
||||
if (!HAS_PCH_SPLIT(dev_priv) &&
|
||||
tmp & HDMI_COLOR_RANGE_16_235)
|
||||
pipe_config->limited_color_range = true;
|
||||
|
||||
pipe_config->hw.adjusted_mode.flags |= flags;
|
||||
|
||||
if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc)
|
||||
dotclock = pipe_config->port_clock * 2 / 3;
|
||||
else
|
||||
dotclock = pipe_config->port_clock;
|
||||
|
||||
if (pipe_config->pixel_multiplier)
|
||||
dotclock /= pipe_config->pixel_multiplier;
|
||||
|
||||
pipe_config->hw.adjusted_mode.crtc_clock = dotclock;
|
||||
|
||||
pipe_config->lane_count = 4;
|
||||
|
||||
intel_hdmi_read_gcp_infoframe(encoder, pipe_config);
|
||||
|
||||
intel_read_infoframe(encoder, pipe_config,
|
||||
HDMI_INFOFRAME_TYPE_AVI,
|
||||
&pipe_config->infoframes.avi);
|
||||
intel_read_infoframe(encoder, pipe_config,
|
||||
HDMI_INFOFRAME_TYPE_SPD,
|
||||
&pipe_config->infoframes.spd);
|
||||
intel_read_infoframe(encoder, pipe_config,
|
||||
HDMI_INFOFRAME_TYPE_VENDOR,
|
||||
&pipe_config->infoframes.hdmi);
|
||||
}
|
||||
|
||||
static void intel_enable_hdmi_audio(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(encoder->base.dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
|
||||
|
||||
drm_WARN_ON(&i915->drm, !pipe_config->has_hdmi_sink);
|
||||
drm_dbg_kms(&i915->drm, "Enabling HDMI audio on pipe %c\n",
|
||||
pipe_name(crtc->pipe));
|
||||
intel_audio_codec_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void g4x_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp |= SDVO_ENABLE;
|
||||
if (pipe_config->has_audio)
|
||||
temp |= HDMI_AUDIO_ENABLE;
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
if (pipe_config->has_audio)
|
||||
intel_enable_hdmi_audio(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void ibx_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp |= SDVO_ENABLE;
|
||||
if (pipe_config->has_audio)
|
||||
temp |= HDMI_AUDIO_ENABLE;
|
||||
|
||||
/*
|
||||
* HW workaround, need to write this twice for issue
|
||||
* that may result in first write getting masked.
|
||||
*/
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
/*
|
||||
* HW workaround, need to toggle enable bit off and on
|
||||
* for 12bpc with pixel repeat.
|
||||
*
|
||||
* FIXME: BSpec says this should be done at the end of
|
||||
* the modeset sequence, so not sure if this isn't too soon.
|
||||
*/
|
||||
if (pipe_config->pipe_bpp > 24 &&
|
||||
pipe_config->pixel_multiplier > 1) {
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg,
|
||||
temp & ~SDVO_ENABLE);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
/*
|
||||
* HW workaround, need to write this twice for issue
|
||||
* that may result in first write getting masked.
|
||||
*/
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
}
|
||||
|
||||
if (pipe_config->has_audio)
|
||||
intel_enable_hdmi_audio(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void cpt_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
enum pipe pipe = crtc->pipe;
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp |= SDVO_ENABLE;
|
||||
if (pipe_config->has_audio)
|
||||
temp |= HDMI_AUDIO_ENABLE;
|
||||
|
||||
/*
|
||||
* WaEnableHDMI8bpcBefore12bpc:snb,ivb
|
||||
*
|
||||
* The procedure for 12bpc is as follows:
|
||||
* 1. disable HDMI clock gating
|
||||
* 2. enable HDMI with 8bpc
|
||||
* 3. enable HDMI with 12bpc
|
||||
* 4. enable HDMI clock gating
|
||||
*/
|
||||
|
||||
if (pipe_config->pipe_bpp > 24) {
|
||||
intel_de_write(dev_priv, TRANS_CHICKEN1(pipe),
|
||||
intel_de_read(dev_priv, TRANS_CHICKEN1(pipe)) | TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE);
|
||||
|
||||
temp &= ~SDVO_COLOR_FORMAT_MASK;
|
||||
temp |= SDVO_COLOR_FORMAT_8bpc;
|
||||
}
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
if (pipe_config->pipe_bpp > 24) {
|
||||
temp &= ~SDVO_COLOR_FORMAT_MASK;
|
||||
temp |= HDMI_COLOR_FORMAT_12bpc;
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
intel_de_write(dev_priv, TRANS_CHICKEN1(pipe),
|
||||
intel_de_read(dev_priv, TRANS_CHICKEN1(pipe)) & ~TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE);
|
||||
}
|
||||
|
||||
if (pipe_config->has_audio)
|
||||
intel_enable_hdmi_audio(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void vlv_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
}
|
||||
|
||||
static void intel_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
struct intel_digital_port *dig_port =
|
||||
hdmi_to_dig_port(intel_hdmi);
|
||||
struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp &= ~(SDVO_ENABLE | HDMI_AUDIO_ENABLE);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
/*
|
||||
* HW workaround for IBX, we need to move the port
|
||||
* to transcoder A after disabling it to allow the
|
||||
* matching DP port to be enabled on transcoder A.
|
||||
*/
|
||||
if (HAS_PCH_IBX(dev_priv) && crtc->pipe == PIPE_B) {
|
||||
/*
|
||||
* We get CPU/PCH FIFO underruns on the other pipe when
|
||||
* doing the workaround. Sweep them under the rug.
|
||||
*/
|
||||
intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
|
||||
intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
|
||||
|
||||
temp &= ~SDVO_PIPE_SEL_MASK;
|
||||
temp |= SDVO_ENABLE | SDVO_PIPE_SEL(PIPE_A);
|
||||
/*
|
||||
* HW workaround, need to write this twice for issue
|
||||
* that may result in first write getting masked.
|
||||
*/
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp &= ~SDVO_ENABLE;
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
intel_wait_for_vblank_if_active(dev_priv, PIPE_A);
|
||||
intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
|
||||
intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
|
||||
}
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
false,
|
||||
old_crtc_state, old_conn_state);
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
|
||||
}
|
||||
|
||||
static void g4x_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
if (old_crtc_state->has_audio)
|
||||
intel_audio_codec_disable(encoder,
|
||||
old_crtc_state, old_conn_state);
|
||||
|
||||
intel_disable_hdmi(state, encoder, old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
||||
static void pch_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
if (old_crtc_state->has_audio)
|
||||
intel_audio_codec_disable(encoder,
|
||||
old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
||||
static void pch_post_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
intel_disable_hdmi(state, encoder, old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
||||
static void intel_hdmi_pre_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct intel_digital_port *dig_port =
|
||||
enc_to_dig_port(encoder);
|
||||
|
||||
intel_hdmi_prepare(encoder, pipe_config);
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
pipe_config->has_infoframe,
|
||||
pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void vlv_hdmi_pre_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
|
||||
vlv_phy_pre_encoder_enable(encoder, pipe_config);
|
||||
|
||||
/* HDMI 1.0V-2dB */
|
||||
vlv_set_phy_signal_level(encoder, pipe_config,
|
||||
0x2b245f5f, 0x00002000,
|
||||
0x5578b83a, 0x2b247878);
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
pipe_config->has_infoframe,
|
||||
pipe_config, conn_state);
|
||||
|
||||
g4x_enable_hdmi(state, encoder, pipe_config, conn_state);
|
||||
|
||||
vlv_wait_port_ready(dev_priv, dig_port, 0x0);
|
||||
}
|
||||
|
||||
static void vlv_hdmi_pre_pll_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
intel_hdmi_prepare(encoder, pipe_config);
|
||||
|
||||
vlv_phy_pre_pll_enable(encoder, pipe_config);
|
||||
}
|
||||
|
||||
static void chv_hdmi_pre_pll_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
intel_hdmi_prepare(encoder, pipe_config);
|
||||
|
||||
chv_phy_pre_pll_enable(encoder, pipe_config);
|
||||
}
|
||||
|
||||
static void chv_hdmi_post_pll_disable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
chv_phy_post_pll_disable(encoder, old_crtc_state);
|
||||
}
|
||||
|
||||
static void vlv_hdmi_post_disable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
/* Reset lanes to avoid HDMI flicker (VLV w/a) */
|
||||
vlv_phy_reset_lanes(encoder, old_crtc_state);
|
||||
}
|
||||
|
||||
static void chv_hdmi_post_disable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
|
||||
vlv_dpio_get(dev_priv);
|
||||
|
||||
/* Assert data lane reset */
|
||||
chv_data_lane_soft_reset(encoder, old_crtc_state, true);
|
||||
|
||||
vlv_dpio_put(dev_priv);
|
||||
}
|
||||
|
||||
static void chv_hdmi_pre_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
|
||||
chv_phy_pre_encoder_enable(encoder, pipe_config);
|
||||
|
||||
/* FIXME: Program the support xxx V-dB */
|
||||
/* Use 800mV-0dB */
|
||||
chv_set_phy_signal_level(encoder, pipe_config, 128, 102, false);
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
pipe_config->has_infoframe,
|
||||
pipe_config, conn_state);
|
||||
|
||||
g4x_enable_hdmi(state, encoder, pipe_config, conn_state);
|
||||
|
||||
vlv_wait_port_ready(dev_priv, dig_port, 0x0);
|
||||
|
||||
/* Second common lane will stay alive on its own now */
|
||||
chv_phy_release_cl2_override(encoder);
|
||||
}
|
||||
|
||||
static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
|
||||
.destroy = intel_encoder_destroy,
|
||||
};
|
||||
|
||||
static enum intel_hotplug_state
|
||||
intel_hdmi_hotplug(struct intel_encoder *encoder,
|
||||
struct intel_connector *connector)
|
||||
{
|
||||
enum intel_hotplug_state state;
|
||||
|
||||
state = intel_encoder_hotplug(encoder, connector);
|
||||
|
||||
/*
|
||||
* On many platforms the HDMI live state signal is known to be
|
||||
* unreliable, so we can't use it to detect if a sink is connected or
|
||||
* not. Instead we detect if it's connected based on whether we can
|
||||
* read the EDID or not. That in turn has a problem during disconnect,
|
||||
* since the HPD interrupt may be raised before the DDC lines get
|
||||
* disconnected (due to how the required length of DDC vs. HPD
|
||||
* connector pins are specified) and so we'll still be able to get a
|
||||
* valid EDID. To solve this schedule another detection cycle if this
|
||||
* time around we didn't detect any change in the sink's connection
|
||||
* status.
|
||||
*/
|
||||
if (state == INTEL_HOTPLUG_UNCHANGED && !connector->hotplug_retries)
|
||||
state = INTEL_HOTPLUG_RETRY;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void g4x_hdmi_init(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t hdmi_reg, enum port port)
|
||||
{
|
||||
struct intel_digital_port *dig_port;
|
||||
struct intel_encoder *intel_encoder;
|
||||
struct intel_connector *intel_connector;
|
||||
|
||||
dig_port = kzalloc(sizeof(*dig_port), GFP_KERNEL);
|
||||
if (!dig_port)
|
||||
return;
|
||||
|
||||
intel_connector = intel_connector_alloc();
|
||||
if (!intel_connector) {
|
||||
kfree(dig_port);
|
||||
return;
|
||||
}
|
||||
|
||||
intel_encoder = &dig_port->base;
|
||||
|
||||
mutex_init(&dig_port->hdcp_mutex);
|
||||
|
||||
drm_encoder_init(&dev_priv->drm, &intel_encoder->base,
|
||||
&intel_hdmi_enc_funcs, DRM_MODE_ENCODER_TMDS,
|
||||
"HDMI %c", port_name(port));
|
||||
|
||||
intel_encoder->hotplug = intel_hdmi_hotplug;
|
||||
intel_encoder->compute_config = intel_hdmi_compute_config;
|
||||
if (HAS_PCH_SPLIT(dev_priv)) {
|
||||
intel_encoder->disable = pch_disable_hdmi;
|
||||
intel_encoder->post_disable = pch_post_disable_hdmi;
|
||||
} else {
|
||||
intel_encoder->disable = g4x_disable_hdmi;
|
||||
}
|
||||
intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
|
||||
intel_encoder->get_config = intel_hdmi_get_config;
|
||||
if (IS_CHERRYVIEW(dev_priv)) {
|
||||
intel_encoder->pre_pll_enable = chv_hdmi_pre_pll_enable;
|
||||
intel_encoder->pre_enable = chv_hdmi_pre_enable;
|
||||
intel_encoder->enable = vlv_enable_hdmi;
|
||||
intel_encoder->post_disable = chv_hdmi_post_disable;
|
||||
intel_encoder->post_pll_disable = chv_hdmi_post_pll_disable;
|
||||
} else if (IS_VALLEYVIEW(dev_priv)) {
|
||||
intel_encoder->pre_pll_enable = vlv_hdmi_pre_pll_enable;
|
||||
intel_encoder->pre_enable = vlv_hdmi_pre_enable;
|
||||
intel_encoder->enable = vlv_enable_hdmi;
|
||||
intel_encoder->post_disable = vlv_hdmi_post_disable;
|
||||
} else {
|
||||
intel_encoder->pre_enable = intel_hdmi_pre_enable;
|
||||
if (HAS_PCH_CPT(dev_priv))
|
||||
intel_encoder->enable = cpt_enable_hdmi;
|
||||
else if (HAS_PCH_IBX(dev_priv))
|
||||
intel_encoder->enable = ibx_enable_hdmi;
|
||||
else
|
||||
intel_encoder->enable = g4x_enable_hdmi;
|
||||
}
|
||||
|
||||
intel_encoder->type = INTEL_OUTPUT_HDMI;
|
||||
intel_encoder->power_domain = intel_port_to_power_domain(port);
|
||||
intel_encoder->port = port;
|
||||
if (IS_CHERRYVIEW(dev_priv)) {
|
||||
if (port == PORT_D)
|
||||
intel_encoder->pipe_mask = BIT(PIPE_C);
|
||||
else
|
||||
intel_encoder->pipe_mask = BIT(PIPE_A) | BIT(PIPE_B);
|
||||
} else {
|
||||
intel_encoder->pipe_mask = ~0;
|
||||
}
|
||||
intel_encoder->cloneable = 1 << INTEL_OUTPUT_ANALOG;
|
||||
intel_encoder->hpd_pin = intel_hpd_pin_default(dev_priv, port);
|
||||
/*
|
||||
* BSpec is unclear about HDMI+HDMI cloning on g4x, but it seems
|
||||
* to work on real hardware. And since g4x can send infoframes to
|
||||
* only one port anyway, nothing is lost by allowing it.
|
||||
*/
|
||||
if (IS_G4X(dev_priv))
|
||||
intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
|
||||
|
||||
dig_port->hdmi.hdmi_reg = hdmi_reg;
|
||||
dig_port->dp.output_reg = INVALID_MMIO_REG;
|
||||
dig_port->max_lanes = 4;
|
||||
|
||||
intel_infoframe_init(dig_port);
|
||||
|
||||
dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
|
||||
intel_hdmi_init_connector(dig_port, intel_connector);
|
||||
}
|
19
drivers/gpu/drm/i915/display/g4x_hdmi.h
Normal file
19
drivers/gpu/drm/i915/display/g4x_hdmi.h
Normal file
@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
/*
|
||||
* Copyright © 2020 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef _G4X_HDMI_H_
|
||||
#define _G4X_HDMI_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "i915_reg.h"
|
||||
|
||||
enum port;
|
||||
struct drm_i915_private;
|
||||
|
||||
void g4x_hdmi_init(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t hdmi_reg, enum port port);
|
||||
|
||||
#endif
|
@ -11,6 +11,7 @@
|
||||
#include "intel_atomic.h"
|
||||
#include "intel_atomic_plane.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_fb.h"
|
||||
#include "intel_sprite.h"
|
||||
#include "i9xx_plane.h"
|
||||
|
||||
@ -128,7 +129,7 @@ static bool i9xx_plane_has_fbc(struct drm_i915_private *dev_priv,
|
||||
else if (IS_IVYBRIDGE(dev_priv))
|
||||
return i9xx_plane == PLANE_A || i9xx_plane == PLANE_B ||
|
||||
i9xx_plane == PLANE_C;
|
||||
else if (INTEL_GEN(dev_priv) >= 4)
|
||||
else if (DISPLAY_VER(dev_priv) >= 4)
|
||||
return i9xx_plane == PLANE_A || i9xx_plane == PLANE_B;
|
||||
else
|
||||
return i9xx_plane == PLANE_A;
|
||||
@ -141,9 +142,9 @@ static bool i9xx_plane_has_windowing(struct intel_plane *plane)
|
||||
|
||||
if (IS_CHERRYVIEW(dev_priv))
|
||||
return i9xx_plane == PLANE_B;
|
||||
else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
else if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
return false;
|
||||
else if (IS_GEN(dev_priv, 4))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 4))
|
||||
return i9xx_plane == PLANE_C;
|
||||
else
|
||||
return i9xx_plane == PLANE_B ||
|
||||
@ -161,8 +162,8 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
|
||||
|
||||
dspcntr = DISPLAY_PLANE_ENABLE;
|
||||
|
||||
if (IS_G4X(dev_priv) || IS_GEN(dev_priv, 5) ||
|
||||
IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv))
|
||||
if (IS_G4X(dev_priv) || IS_IRONLAKE(dev_priv) ||
|
||||
IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv))
|
||||
dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
|
||||
|
||||
switch (fb->format->format) {
|
||||
@ -210,7 +211,7 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 4 &&
|
||||
fb->modifier == I915_FORMAT_MOD_X_TILED)
|
||||
dspcntr |= DISPPLANE_TILED;
|
||||
|
||||
@ -249,7 +250,7 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
|
||||
|
||||
intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
|
||||
plane_state, 0);
|
||||
else
|
||||
@ -266,11 +267,11 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
|
||||
* Linear surfaces seem to work just fine, even on hsw/bdw
|
||||
* despite them not using the linear offset anymore.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 4 && fb->modifier == I915_FORMAT_MOD_X_TILED) {
|
||||
if (DISPLAY_VER(dev_priv) >= 4 && fb->modifier == I915_FORMAT_MOD_X_TILED) {
|
||||
u32 alignment = intel_surf_alignment(fb, 0);
|
||||
int cpp = fb->format->cpp[0];
|
||||
|
||||
while ((src_x + src_w) * cpp > plane_state->color_plane[0].stride) {
|
||||
while ((src_x + src_w) * cpp > plane_state->view.color_plane[0].stride) {
|
||||
if (offset == 0) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"Unable to find suitable display surface offset due to X-tiling\n");
|
||||
@ -305,14 +306,14 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
|
||||
|
||||
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
|
||||
drm_WARN_ON(&dev_priv->drm, src_x > 8191 || src_y > 4095);
|
||||
} else if (INTEL_GEN(dev_priv) >= 4 &&
|
||||
} else if (DISPLAY_VER(dev_priv) >= 4 &&
|
||||
fb->modifier == I915_FORMAT_MOD_X_TILED) {
|
||||
drm_WARN_ON(&dev_priv->drm, src_x > 4095 || src_y > 4095);
|
||||
}
|
||||
|
||||
plane_state->color_plane[0].offset = offset;
|
||||
plane_state->color_plane[0].x = src_x;
|
||||
plane_state->color_plane[0].y = src_y;
|
||||
plane_state->view.color_plane[0].offset = offset;
|
||||
plane_state->view.color_plane[0].x = src_x;
|
||||
plane_state->view.color_plane[0].y = src_y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -363,7 +364,7 @@ static u32 i9xx_plane_ctl_crtc(const struct intel_crtc_state *crtc_state)
|
||||
if (crtc_state->csc_enable)
|
||||
dspcntr |= DISPPLANE_PIPE_CSC_ENABLE;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 5)
|
||||
if (DISPLAY_VER(dev_priv) < 5)
|
||||
dspcntr |= DISPPLANE_SEL_PIPE(crtc->pipe);
|
||||
|
||||
return dspcntr;
|
||||
@ -423,8 +424,8 @@ static void i9xx_update_plane(struct intel_plane *plane,
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
|
||||
u32 linear_offset;
|
||||
int x = plane_state->color_plane[0].x;
|
||||
int y = plane_state->color_plane[0].y;
|
||||
int x = plane_state->view.color_plane[0].x;
|
||||
int y = plane_state->view.color_plane[0].y;
|
||||
int crtc_x = plane_state->uapi.dst.x1;
|
||||
int crtc_y = plane_state->uapi.dst.y1;
|
||||
int crtc_w = drm_rect_width(&plane_state->uapi.dst);
|
||||
@ -437,17 +438,17 @@ static void i9xx_update_plane(struct intel_plane *plane,
|
||||
|
||||
linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
dspaddr_offset = plane_state->color_plane[0].offset;
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
dspaddr_offset = plane_state->view.color_plane[0].offset;
|
||||
else
|
||||
dspaddr_offset = linear_offset;
|
||||
|
||||
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
|
||||
|
||||
intel_de_write_fw(dev_priv, DSPSTRIDE(i9xx_plane),
|
||||
plane_state->color_plane[0].stride);
|
||||
plane_state->view.color_plane[0].stride);
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 4) {
|
||||
if (DISPLAY_VER(dev_priv) < 4) {
|
||||
/*
|
||||
* PLANE_A doesn't actually have a full window
|
||||
* generator but let's assume we still need to
|
||||
@ -468,7 +469,7 @@ static void i9xx_update_plane(struct intel_plane *plane,
|
||||
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
|
||||
intel_de_write_fw(dev_priv, DSPOFFSET(i9xx_plane),
|
||||
(y << 16) | x);
|
||||
} else if (INTEL_GEN(dev_priv) >= 4) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
intel_de_write_fw(dev_priv, DSPLINOFF(i9xx_plane),
|
||||
linear_offset);
|
||||
intel_de_write_fw(dev_priv, DSPTILEOFF(i9xx_plane),
|
||||
@ -481,7 +482,7 @@ static void i9xx_update_plane(struct intel_plane *plane,
|
||||
* the control register just before the surface register.
|
||||
*/
|
||||
intel_de_write_fw(dev_priv, DSPCNTR(i9xx_plane), dspcntr);
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
intel_de_write_fw(dev_priv, DSPSURF(i9xx_plane),
|
||||
intel_plane_ggtt_offset(plane_state) + dspaddr_offset);
|
||||
else
|
||||
@ -514,7 +515,7 @@ static void i9xx_disable_plane(struct intel_plane *plane,
|
||||
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
|
||||
|
||||
intel_de_write_fw(dev_priv, DSPCNTR(i9xx_plane), dspcntr);
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
intel_de_write_fw(dev_priv, DSPSURF(i9xx_plane), 0);
|
||||
else
|
||||
intel_de_write_fw(dev_priv, DSPADDR(i9xx_plane), 0);
|
||||
@ -530,7 +531,7 @@ g4x_primary_async_flip(struct intel_plane *plane,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
u32 dspcntr = plane_state->ctl | i9xx_plane_ctl_crtc(crtc_state);
|
||||
u32 dspaddr_offset = plane_state->color_plane[0].offset;
|
||||
u32 dspaddr_offset = plane_state->view.color_plane[0].offset;
|
||||
enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
|
||||
unsigned long irqflags;
|
||||
|
||||
@ -551,7 +552,7 @@ vlv_primary_async_flip(struct intel_plane *plane,
|
||||
bool async_flip)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
u32 dspaddr_offset = plane_state->color_plane[0].offset;
|
||||
u32 dspaddr_offset = plane_state->view.color_plane[0].offset;
|
||||
enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
|
||||
unsigned long irqflags;
|
||||
|
||||
@ -669,7 +670,7 @@ static bool i9xx_plane_get_hw_state(struct intel_plane *plane,
|
||||
|
||||
ret = val & DISPLAY_PLANE_ENABLE;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5)
|
||||
if (DISPLAY_VER(dev_priv) >= 5)
|
||||
*pipe = plane->pipe;
|
||||
else
|
||||
*pipe = (val & DISPPLANE_SEL_PIPE_MASK) >>
|
||||
@ -729,7 +730,7 @@ i9xx_plane_max_stride(struct intel_plane *plane,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 3) {
|
||||
if (DISPLAY_VER(dev_priv) >= 3) {
|
||||
if (modifier == I915_FORMAT_MOD_X_TILED)
|
||||
return 8*1024;
|
||||
else
|
||||
@ -779,7 +780,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
* On gen2/3 only plane A can do FBC, but the panel fitter and LVDS
|
||||
* port is hooked to pipe B. Hence we want plane A feeding pipe B.
|
||||
*/
|
||||
if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4 &&
|
||||
if (HAS_FBC(dev_priv) && DISPLAY_VER(dev_priv) < 4 &&
|
||||
INTEL_NUM_PIPES(dev_priv) == 2)
|
||||
plane->i9xx_plane = (enum i9xx_plane_id) !pipe;
|
||||
else
|
||||
@ -797,7 +798,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
|
||||
formats = vlv_primary_formats;
|
||||
num_formats = ARRAY_SIZE(vlv_primary_formats);
|
||||
} else if (INTEL_GEN(dev_priv) >= 4) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
/*
|
||||
* WaFP16GammaEnabling:ivb
|
||||
* "Workaround : When using the 64-bit format, the plane
|
||||
@ -823,7 +824,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
num_formats = ARRAY_SIZE(i8xx_primary_formats);
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
plane_funcs = &i965_plane_funcs;
|
||||
else
|
||||
plane_funcs = &i8xx_plane_funcs;
|
||||
@ -838,7 +839,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
plane->min_cdclk = i9xx_plane_min_cdclk;
|
||||
|
||||
if (HAS_GMCH(dev_priv)) {
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
plane->max_stride = i965_plane_max_stride;
|
||||
else
|
||||
plane->max_stride = i9xx_plane_max_stride;
|
||||
@ -863,17 +864,17 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
plane->async_flip = g4x_primary_async_flip;
|
||||
plane->enable_flip_done = bdw_primary_enable_flip_done;
|
||||
plane->disable_flip_done = bdw_primary_disable_flip_done;
|
||||
} else if (INTEL_GEN(dev_priv) >= 7) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 7) {
|
||||
plane->async_flip = g4x_primary_async_flip;
|
||||
plane->enable_flip_done = ivb_primary_enable_flip_done;
|
||||
plane->disable_flip_done = ivb_primary_disable_flip_done;
|
||||
} else if (INTEL_GEN(dev_priv) >= 5) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 5) {
|
||||
plane->async_flip = g4x_primary_async_flip;
|
||||
plane->enable_flip_done = ilk_primary_enable_flip_done;
|
||||
plane->disable_flip_done = ilk_primary_disable_flip_done;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
|
||||
0, plane_funcs,
|
||||
formats, num_formats,
|
||||
@ -895,14 +896,14 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
supported_rotations =
|
||||
DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 |
|
||||
DRM_MODE_REFLECT_X;
|
||||
} else if (INTEL_GEN(dev_priv) >= 4) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
supported_rotations =
|
||||
DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180;
|
||||
} else {
|
||||
supported_rotations = DRM_MODE_ROTATE_0;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
drm_plane_create_rotation_property(&plane->base,
|
||||
DRM_MODE_ROTATE_0,
|
||||
supported_rotations);
|
||||
@ -985,7 +986,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
|
||||
|
||||
val = intel_de_read(dev_priv, DSPCNTR(i9xx_plane));
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4) {
|
||||
if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
if (val & DISPPLANE_TILED) {
|
||||
plane_config->tiling = I915_TILING_X;
|
||||
fb->modifier = I915_FORMAT_MOD_X_TILED;
|
||||
@ -1006,7 +1007,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
|
||||
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
|
||||
offset = intel_de_read(dev_priv, DSPOFFSET(i9xx_plane));
|
||||
base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & 0xfffff000;
|
||||
} else if (INTEL_GEN(dev_priv) >= 4) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
if (plane_config->tiling)
|
||||
offset = intel_de_read(dev_priv,
|
||||
DSPTILEOFF(i9xx_plane));
|
||||
|
@ -457,7 +457,7 @@ static void gen11_dsi_config_phy_lanes_sequence(struct intel_encoder *encoder)
|
||||
intel_de_write(dev_priv, ICL_PORT_TX_DW2_GRP(phy), tmp);
|
||||
|
||||
/* For EHL, TGL, set latency optimization for PCS_DW1 lanes */
|
||||
if (IS_JSL_EHL(dev_priv) || (INTEL_GEN(dev_priv) >= 12)) {
|
||||
if (IS_JSL_EHL(dev_priv) || (DISPLAY_VER(dev_priv) >= 12)) {
|
||||
tmp = intel_de_read(dev_priv,
|
||||
ICL_PORT_PCS_DW1_AUX(phy));
|
||||
tmp &= ~LATENCY_OPTIM_MASK;
|
||||
@ -592,7 +592,7 @@ gen11_dsi_setup_dphy_timings(struct intel_encoder *encoder,
|
||||
* a value '0' inside TA_PARAM_REGISTERS otherwise
|
||||
* leave all fields at HW default values.
|
||||
*/
|
||||
if (IS_GEN(dev_priv, 11)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 11)) {
|
||||
if (afe_clk(encoder, crtc_state) <= 800000) {
|
||||
for_each_dsi_port(port, intel_dsi->ports) {
|
||||
tmp = intel_de_read(dev_priv,
|
||||
@ -692,7 +692,7 @@ static void gen11_dsi_map_pll(struct intel_encoder *encoder,
|
||||
intel_de_write(dev_priv, ICL_DPCLKA_CFGCR0, val);
|
||||
|
||||
for_each_dsi_phy(phy, intel_dsi->phys) {
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
val |= ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy);
|
||||
else
|
||||
val &= ~ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy);
|
||||
@ -774,7 +774,7 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder,
|
||||
}
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
if (is_vid_mode(intel_dsi))
|
||||
tmp |= BLANKING_PACKET_ENABLE;
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ gen11_dsi_set_transcoder_timings(struct intel_encoder *encoder,
|
||||
}
|
||||
|
||||
/* program TRANS_VBLANK register, should be same as vtotal programmed */
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
for_each_dsi_port(port, intel_dsi->ports) {
|
||||
dsi_trans = dsi_port_to_transcoder(port);
|
||||
intel_de_write(dev_priv, VBLANK(dsi_trans),
|
||||
@ -1158,7 +1158,7 @@ gen11_dsi_enable_port_and_phy(struct intel_encoder *encoder,
|
||||
gen11_dsi_configure_transcoder(encoder, crtc_state);
|
||||
|
||||
/* Step 4l: Gate DDI clocks */
|
||||
if (IS_GEN(dev_priv, 11))
|
||||
if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
gen11_dsi_gate_clocks(encoder);
|
||||
}
|
||||
|
||||
@ -1534,7 +1534,7 @@ static int gen11_dsi_dsc_compute_config(struct intel_encoder *encoder,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config;
|
||||
int dsc_max_bpc = INTEL_GEN(dev_priv) >= 12 ? 12 : 10;
|
||||
int dsc_max_bpc = DISPLAY_VER(dev_priv) >= 12 ? 12 : 10;
|
||||
bool use_dsc;
|
||||
int ret;
|
||||
|
||||
|
@ -332,8 +332,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
|
||||
plane_state->hw.fb->format->is_yuv &&
|
||||
plane_state->hw.fb->format->num_planes > 1) {
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
if (IS_GEN(dev_priv, 9) &&
|
||||
!IS_GEMINILAKE(dev_priv)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 9)) {
|
||||
mode = SKL_PS_SCALER_MODE_NV12;
|
||||
} else if (icl_is_hdr_plane(dev_priv, plane->id)) {
|
||||
/*
|
||||
@ -351,7 +350,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
|
||||
if (linked)
|
||||
mode |= PS_PLANE_Y_SEL(linked->id);
|
||||
}
|
||||
} else if (INTEL_GEN(dev_priv) > 9 || IS_GEMINILAKE(dev_priv)) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 10) {
|
||||
mode = PS_SCALER_MODE_NORMAL;
|
||||
} else if (num_scalers_need == 1 && intel_crtc->num_scalers > 1) {
|
||||
/*
|
||||
@ -460,7 +459,7 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
|
||||
* isn't necessary to change between HQ and dyn mode
|
||||
* on those platforms.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
continue;
|
||||
|
||||
plane = drm_plane_from_index(&dev_priv->drm, i);
|
||||
|
@ -317,12 +317,13 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
|
||||
if (!new_plane_state->hw.crtc && !old_plane_state->hw.crtc)
|
||||
return 0;
|
||||
|
||||
new_crtc_state->enabled_planes |= BIT(plane->id);
|
||||
|
||||
ret = plane->check_plane(new_crtc_state, new_plane_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (fb)
|
||||
new_crtc_state->enabled_planes |= BIT(plane->id);
|
||||
|
||||
/* FIXME pre-g4x don't work like this */
|
||||
if (new_plane_state->uapi.visible)
|
||||
new_crtc_state->active_planes |= BIT(plane->id);
|
||||
|
@ -248,7 +248,7 @@ static u32 audio_config_hdmi_pixel_clock(const struct intel_crtc_state *crtc_sta
|
||||
break;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12 && adjusted_mode->crtc_clock > 148500)
|
||||
if (DISPLAY_VER(dev_priv) < 12 && adjusted_mode->crtc_clock > 148500)
|
||||
i = ARRAY_SIZE(hdmi_audio_clock);
|
||||
|
||||
if (i == ARRAY_SIZE(hdmi_audio_clock)) {
|
||||
@ -586,14 +586,14 @@ static void enable_audio_dsc_wa(struct intel_encoder *encoder,
|
||||
unsigned int hblank_early_prog, samples_room;
|
||||
unsigned int val;
|
||||
|
||||
if (INTEL_GEN(i915) < 11)
|
||||
if (DISPLAY_VER(i915) < 11)
|
||||
return;
|
||||
|
||||
val = intel_de_read(i915, AUD_CONFIG_BE);
|
||||
|
||||
if (INTEL_GEN(i915) == 11)
|
||||
if (IS_DISPLAY_VER(i915, 11))
|
||||
val |= HBLANK_EARLY_ENABLE_ICL(pipe);
|
||||
else if (INTEL_GEN(i915) >= 12)
|
||||
else if (DISPLAY_VER(i915) >= 12)
|
||||
val |= HBLANK_EARLY_ENABLE_TGL(pipe);
|
||||
|
||||
if (crtc_state->dsc.compression_enable &&
|
||||
@ -933,7 +933,7 @@ void intel_init_audio_hooks(struct drm_i915_private *dev_priv)
|
||||
} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
|
||||
dev_priv->display.audio_codec_enable = ilk_audio_codec_enable;
|
||||
dev_priv->display.audio_codec_disable = ilk_audio_codec_disable;
|
||||
} else if (IS_HASWELL(dev_priv) || INTEL_GEN(dev_priv) >= 8) {
|
||||
} else if (IS_HASWELL(dev_priv) || DISPLAY_VER(dev_priv) >= 8) {
|
||||
dev_priv->display.audio_codec_enable = hsw_audio_codec_enable;
|
||||
dev_priv->display.audio_codec_disable = hsw_audio_codec_disable;
|
||||
} else if (HAS_PCH_SPLIT(dev_priv)) {
|
||||
@ -1010,7 +1010,7 @@ static unsigned long i915_audio_component_get_power(struct device *kdev)
|
||||
ret = intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
|
||||
|
||||
if (dev_priv->audio_power_refcount++ == 0) {
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
if (DISPLAY_VER(dev_priv) >= 9) {
|
||||
intel_de_write(dev_priv, AUD_FREQ_CNTRL,
|
||||
dev_priv->audio_freq_cntrl);
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
@ -1022,7 +1022,7 @@ static unsigned long i915_audio_component_get_power(struct device *kdev)
|
||||
if (IS_GEMINILAKE(dev_priv))
|
||||
glk_force_audio_cdclk(dev_priv, true);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
intel_de_write(dev_priv, AUD_PIN_BUF_CTL,
|
||||
(intel_de_read(dev_priv, AUD_PIN_BUF_CTL) | AUD_PIN_BUF_ENABLE));
|
||||
}
|
||||
@ -1050,7 +1050,7 @@ static void i915_audio_component_codec_wake_override(struct device *kdev,
|
||||
unsigned long cookie;
|
||||
u32 tmp;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 9)
|
||||
if (DISPLAY_VER(dev_priv) < 9)
|
||||
return;
|
||||
|
||||
cookie = i915_audio_component_get_power(kdev);
|
||||
@ -1266,6 +1266,15 @@ static const struct component_ops i915_audio_component_bind_ops = {
|
||||
.unbind = i915_audio_component_unbind,
|
||||
};
|
||||
|
||||
#define AUD_FREQ_TMODE_SHIFT 14
|
||||
#define AUD_FREQ_4T 0
|
||||
#define AUD_FREQ_8T (2 << AUD_FREQ_TMODE_SHIFT)
|
||||
#define AUD_FREQ_PULLCLKS(x) (((x) & 0x3) << 11)
|
||||
#define AUD_FREQ_BCLK_96M BIT(4)
|
||||
|
||||
#define AUD_FREQ_GEN12 (AUD_FREQ_8T | AUD_FREQ_PULLCLKS(0) | AUD_FREQ_BCLK_96M)
|
||||
#define AUD_FREQ_TGL_BROKEN (AUD_FREQ_8T | AUD_FREQ_PULLCLKS(2) | AUD_FREQ_BCLK_96M)
|
||||
|
||||
/**
|
||||
* i915_audio_component_init - initialize and register the audio component
|
||||
* @dev_priv: i915 device instance
|
||||
@ -1284,6 +1293,7 @@ static const struct component_ops i915_audio_component_bind_ops = {
|
||||
*/
|
||||
static void i915_audio_component_init(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
u32 aud_freq, aud_freq_init;
|
||||
int ret;
|
||||
|
||||
ret = component_add_typed(dev_priv->drm.dev,
|
||||
@ -1296,12 +1306,22 @@ static void i915_audio_component_init(struct drm_i915_private *dev_priv)
|
||||
return;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
dev_priv->audio_freq_cntrl = intel_de_read(dev_priv,
|
||||
AUD_FREQ_CNTRL);
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"init value of AUD_FREQ_CNTRL of 0x%x\n",
|
||||
dev_priv->audio_freq_cntrl);
|
||||
if (DISPLAY_VER(dev_priv) >= 9) {
|
||||
aud_freq_init = intel_de_read(dev_priv, AUD_FREQ_CNTRL);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
aud_freq = AUD_FREQ_GEN12;
|
||||
else
|
||||
aud_freq = aud_freq_init;
|
||||
|
||||
/* use BIOS provided value for TGL unless it is a known bad value */
|
||||
if (IS_TIGERLAKE(dev_priv) && aud_freq_init != AUD_FREQ_TGL_BROKEN)
|
||||
aud_freq = aud_freq_init;
|
||||
|
||||
drm_dbg_kms(&dev_priv->drm, "use AUD_FREQ_CNTRL of 0x%x (init value 0x%x)\n",
|
||||
aud_freq, aud_freq_init);
|
||||
|
||||
dev_priv->audio_freq_cntrl = aud_freq;
|
||||
}
|
||||
|
||||
dev_priv->audio_component_registered = true;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@
|
||||
#include <linux/types.h>
|
||||
|
||||
struct drm_i915_private;
|
||||
struct intel_bios_encoder_data;
|
||||
struct intel_crtc_state;
|
||||
struct intel_encoder;
|
||||
enum port;
|
||||
@ -249,14 +250,20 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
|
||||
int dsc_max_bpc);
|
||||
int intel_bios_max_tmds_clock(struct intel_encoder *encoder);
|
||||
int intel_bios_hdmi_level_shift(struct intel_encoder *encoder);
|
||||
int intel_bios_dp_boost_level(struct intel_encoder *encoder);
|
||||
int intel_bios_hdmi_boost_level(struct intel_encoder *encoder);
|
||||
int intel_bios_dp_max_link_rate(struct intel_encoder *encoder);
|
||||
int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder);
|
||||
bool intel_bios_port_supports_dvi(struct drm_i915_private *i915, enum port port);
|
||||
bool intel_bios_port_supports_hdmi(struct drm_i915_private *i915, enum port port);
|
||||
bool intel_bios_port_supports_dp(struct drm_i915_private *i915, enum port port);
|
||||
bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port port);
|
||||
bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port);
|
||||
|
||||
const struct intel_bios_encoder_data *
|
||||
intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port);
|
||||
|
||||
bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
|
||||
bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
|
||||
bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
|
||||
bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata);
|
||||
bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata);
|
||||
int intel_bios_encoder_dp_boost_level(const struct intel_bios_encoder_data *devdata);
|
||||
int intel_bios_encoder_hdmi_boost_level(const struct intel_bios_encoder_data *devdata);
|
||||
|
||||
#endif /* _INTEL_BIOS_H_ */
|
||||
|
@ -77,7 +77,7 @@ static int icl_get_qgv_points(struct drm_i915_private *dev_priv,
|
||||
|
||||
qi->num_points = dram_info->num_qgv_points;
|
||||
|
||||
if (IS_GEN(dev_priv, 12))
|
||||
if (IS_DISPLAY_VER(dev_priv, 12))
|
||||
switch (dram_info->type) {
|
||||
case INTEL_DRAM_DDR4:
|
||||
qi->t_bl = 4;
|
||||
@ -89,7 +89,7 @@ static int icl_get_qgv_points(struct drm_i915_private *dev_priv,
|
||||
qi->t_bl = 16;
|
||||
break;
|
||||
}
|
||||
else if (IS_GEN(dev_priv, 11))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 8;
|
||||
|
||||
if (drm_WARN_ON(&dev_priv->drm,
|
||||
@ -271,9 +271,9 @@ void intel_bw_init_hw(struct drm_i915_private *dev_priv)
|
||||
icl_get_bw_info(dev_priv, &adls_sa_info);
|
||||
else if (IS_ROCKETLAKE(dev_priv))
|
||||
icl_get_bw_info(dev_priv, &rkl_sa_info);
|
||||
else if (IS_GEN(dev_priv, 12))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 12))
|
||||
icl_get_bw_info(dev_priv, &tgl_sa_info);
|
||||
else if (IS_GEN(dev_priv, 11))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
icl_get_bw_info(dev_priv, &icl_sa_info);
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ int intel_bw_atomic_check(struct intel_atomic_state *state)
|
||||
u32 mask = (1 << num_qgv_points) - 1;
|
||||
|
||||
/* FIXME earlier gens need some checks too */
|
||||
if (INTEL_GEN(dev_priv) < 11)
|
||||
if (DISPLAY_VER(dev_priv) < 11)
|
||||
return 0;
|
||||
|
||||
for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
|
||||
|
@ -1375,7 +1375,7 @@ static void bxt_de_pll_readout(struct drm_i915_private *dev_priv,
|
||||
{
|
||||
u32 val, ratio;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
icl_readout_refclk(dev_priv, cdclk_config);
|
||||
else if (IS_CANNONLAKE(dev_priv))
|
||||
cnl_readout_refclk(dev_priv, cdclk_config);
|
||||
@ -1397,7 +1397,7 @@ static void bxt_de_pll_readout(struct drm_i915_private *dev_priv,
|
||||
* CNL+ have the ratio directly in the PLL enable register, gen9lp had
|
||||
* it in a separate PLL control register.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
ratio = val & CNL_CDCLK_PLL_RATIO_MASK;
|
||||
else
|
||||
ratio = intel_de_read(dev_priv, BXT_DE_PLL_CTL) & BXT_DE_PLL_RATIO_MASK;
|
||||
@ -1413,9 +1413,9 @@ static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
|
||||
|
||||
bxt_de_pll_readout(dev_priv, cdclk_config);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
cdclk_config->bypass = cdclk_config->ref / 2;
|
||||
else if (INTEL_GEN(dev_priv) >= 11)
|
||||
else if (DISPLAY_VER(dev_priv) >= 11)
|
||||
cdclk_config->bypass = 50000;
|
||||
else
|
||||
cdclk_config->bypass = cdclk_config->ref;
|
||||
@ -1433,7 +1433,7 @@ static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
|
||||
break;
|
||||
case BXT_CDCLK_CD2X_DIV_SEL_1_5:
|
||||
drm_WARN(&dev_priv->drm,
|
||||
IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10,
|
||||
DISPLAY_VER(dev_priv) >= 10,
|
||||
"Unsupported divider\n");
|
||||
div = 3;
|
||||
break;
|
||||
@ -1441,7 +1441,8 @@ static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
|
||||
div = 4;
|
||||
break;
|
||||
case BXT_CDCLK_CD2X_DIV_SEL_4:
|
||||
drm_WARN(&dev_priv->drm, INTEL_GEN(dev_priv) >= 10,
|
||||
drm_WARN(&dev_priv->drm,
|
||||
DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv),
|
||||
"Unsupported divider\n");
|
||||
div = 8;
|
||||
break;
|
||||
@ -1530,12 +1531,12 @@ static void cnl_cdclk_pll_enable(struct drm_i915_private *dev_priv, int vco)
|
||||
|
||||
static u32 bxt_cdclk_cd2x_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
if (pipe == INVALID_PIPE)
|
||||
return TGL_CDCLK_CD2X_PIPE_NONE;
|
||||
else
|
||||
return TGL_CDCLK_CD2X_PIPE(pipe);
|
||||
} else if (INTEL_GEN(dev_priv) >= 11) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
if (pipe == INVALID_PIPE)
|
||||
return ICL_CDCLK_CD2X_PIPE_NONE;
|
||||
else
|
||||
@ -1558,7 +1559,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
int ret;
|
||||
|
||||
/* Inform power controller of upcoming frequency change. */
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
ret = skl_pcode_request(dev_priv, SKL_PCODE_CDCLK_CONTROL,
|
||||
SKL_CDCLK_PREPARE_FOR_CHANGE,
|
||||
SKL_CDCLK_READY_FOR_CHANGE,
|
||||
@ -1591,7 +1592,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
break;
|
||||
case 3:
|
||||
drm_WARN(&dev_priv->drm,
|
||||
IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10,
|
||||
DISPLAY_VER(dev_priv) >= 10,
|
||||
"Unsupported divider\n");
|
||||
divider = BXT_CDCLK_CD2X_DIV_SEL_1_5;
|
||||
break;
|
||||
@ -1599,13 +1600,14 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
divider = BXT_CDCLK_CD2X_DIV_SEL_2;
|
||||
break;
|
||||
case 8:
|
||||
drm_WARN(&dev_priv->drm, INTEL_GEN(dev_priv) >= 10,
|
||||
drm_WARN(&dev_priv->drm,
|
||||
DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv),
|
||||
"Unsupported divider\n");
|
||||
divider = BXT_CDCLK_CD2X_DIV_SEL_4;
|
||||
break;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)) {
|
||||
if (dev_priv->cdclk.hw.vco != 0 &&
|
||||
dev_priv->cdclk.hw.vco != vco)
|
||||
cnl_cdclk_pll_disable(dev_priv);
|
||||
@ -1636,7 +1638,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
if (pipe != INVALID_PIPE)
|
||||
intel_wait_for_vblank(dev_priv, pipe);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)) {
|
||||
ret = sandybridge_pcode_write(dev_priv, SKL_PCODE_CDCLK_CONTROL,
|
||||
cdclk_config->voltage_level);
|
||||
} else {
|
||||
@ -1661,7 +1663,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
|
||||
|
||||
intel_update_cdclk(dev_priv);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
/*
|
||||
* Can't read out the voltage level :(
|
||||
* Let's just assume everything is as expected.
|
||||
@ -1795,7 +1797,7 @@ static void bxt_cdclk_uninit_hw(struct drm_i915_private *dev_priv)
|
||||
*/
|
||||
void intel_cdclk_init_hw(struct drm_i915_private *i915)
|
||||
{
|
||||
if (IS_GEN9_LP(i915) || INTEL_GEN(i915) >= 10)
|
||||
if (IS_GEN9_LP(i915) || DISPLAY_VER(i915) >= 10)
|
||||
bxt_cdclk_init_hw(i915);
|
||||
else if (IS_GEN9_BC(i915))
|
||||
skl_cdclk_init_hw(i915);
|
||||
@ -1810,7 +1812,7 @@ void intel_cdclk_init_hw(struct drm_i915_private *i915)
|
||||
*/
|
||||
void intel_cdclk_uninit_hw(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 10 || IS_GEN9_LP(i915))
|
||||
if (DISPLAY_VER(i915) >= 10 || IS_GEN9_LP(i915))
|
||||
bxt_cdclk_uninit_hw(i915);
|
||||
else if (IS_GEN9_BC(i915))
|
||||
skl_cdclk_uninit_hw(i915);
|
||||
@ -1850,7 +1852,7 @@ static bool intel_cdclk_can_cd2x_update(struct drm_i915_private *dev_priv,
|
||||
const struct intel_cdclk_config *b)
|
||||
{
|
||||
/* Older hw doesn't have the capability */
|
||||
if (INTEL_GEN(dev_priv) < 10 && !IS_GEN9_LP(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) < 10 && !IS_GEN9_LP(dev_priv))
|
||||
return false;
|
||||
|
||||
return a->cdclk != b->cdclk &&
|
||||
@ -1998,9 +2000,9 @@ static int intel_pixel_rate_to_cdclk(const struct intel_crtc_state *crtc_state)
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
int pixel_rate = crtc_state->pixel_rate;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
return DIV_ROUND_UP(pixel_rate, 2);
|
||||
else if (IS_GEN(dev_priv, 9) ||
|
||||
else if (IS_DISPLAY_VER(dev_priv, 9) ||
|
||||
IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))
|
||||
return pixel_rate;
|
||||
else if (IS_CHERRYVIEW(dev_priv))
|
||||
@ -2048,10 +2050,10 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
|
||||
crtc_state->has_audio &&
|
||||
crtc_state->port_clock >= 540000 &&
|
||||
crtc_state->lane_count == 4) {
|
||||
if (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 10)) {
|
||||
/* Display WA #1145: glk,cnl */
|
||||
min_cdclk = max(316800, min_cdclk);
|
||||
} else if (IS_GEN(dev_priv, 9) || IS_BROADWELL(dev_priv)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 9) || IS_BROADWELL(dev_priv)) {
|
||||
/* Display WA #1144: skl,bxt */
|
||||
min_cdclk = max(432000, min_cdclk);
|
||||
}
|
||||
@ -2061,7 +2063,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
|
||||
* According to BSpec, "The CD clock frequency must be at least twice
|
||||
* the frequency of the Azalia BCLK." and BCLK is 96 MHz by default.
|
||||
*/
|
||||
if (crtc_state->has_audio && INTEL_GEN(dev_priv) >= 9)
|
||||
if (crtc_state->has_audio && DISPLAY_VER(dev_priv) >= 9)
|
||||
min_cdclk = max(2 * 96000, min_cdclk);
|
||||
|
||||
/*
|
||||
@ -2588,14 +2590,14 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
int max_cdclk_freq = dev_priv->max_cdclk_freq;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
return 2 * max_cdclk_freq;
|
||||
else if (IS_GEN(dev_priv, 9) ||
|
||||
else if (IS_DISPLAY_VER(dev_priv, 9) ||
|
||||
IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))
|
||||
return max_cdclk_freq;
|
||||
else if (IS_CHERRYVIEW(dev_priv))
|
||||
return max_cdclk_freq*95/100;
|
||||
else if (INTEL_GEN(dev_priv) < 4)
|
||||
else if (DISPLAY_VER(dev_priv) < 4)
|
||||
return 2*max_cdclk_freq*90/100;
|
||||
else
|
||||
return max_cdclk_freq*90/100;
|
||||
@ -2616,7 +2618,7 @@ void intel_update_max_cdclk(struct drm_i915_private *dev_priv)
|
||||
dev_priv->max_cdclk_freq = 552000;
|
||||
else
|
||||
dev_priv->max_cdclk_freq = 556800;
|
||||
} else if (INTEL_GEN(dev_priv) >= 11) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
if (dev_priv->cdclk.hw.ref == 24000)
|
||||
dev_priv->max_cdclk_freq = 648000;
|
||||
else
|
||||
@ -2831,7 +2833,7 @@ u32 intel_read_rawclk(struct drm_i915_private *dev_priv)
|
||||
freq = pch_rawclk(dev_priv);
|
||||
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
|
||||
freq = vlv_hrawclk(dev_priv);
|
||||
else if (INTEL_GEN(dev_priv) >= 3)
|
||||
else if (DISPLAY_VER(dev_priv) >= 3)
|
||||
freq = i9xx_hrawclk(dev_priv);
|
||||
else
|
||||
/* no rawclk on other platforms, or no need to know it */
|
||||
@ -2852,7 +2854,7 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv)
|
||||
dev_priv->display.modeset_calc_cdclk = bxt_modeset_calc_cdclk;
|
||||
dev_priv->display.calc_voltage_level = tgl_calc_voltage_level;
|
||||
dev_priv->cdclk.table = rkl_cdclk_table;
|
||||
} else if (INTEL_GEN(dev_priv) >= 12) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
dev_priv->display.set_cdclk = bxt_set_cdclk;
|
||||
dev_priv->display.bw_calc_min_cdclk = skl_bw_calc_min_cdclk;
|
||||
dev_priv->display.modeset_calc_cdclk = bxt_modeset_calc_cdclk;
|
||||
@ -2864,7 +2866,7 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv)
|
||||
dev_priv->display.modeset_calc_cdclk = bxt_modeset_calc_cdclk;
|
||||
dev_priv->display.calc_voltage_level = ehl_calc_voltage_level;
|
||||
dev_priv->cdclk.table = icl_cdclk_table;
|
||||
} else if (INTEL_GEN(dev_priv) >= 11) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
dev_priv->display.set_cdclk = bxt_set_cdclk;
|
||||
dev_priv->display.bw_calc_min_cdclk = skl_bw_calc_min_cdclk;
|
||||
dev_priv->display.modeset_calc_cdclk = bxt_modeset_calc_cdclk;
|
||||
@ -2906,7 +2908,7 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv)
|
||||
dev_priv->display.modeset_calc_cdclk = fixed_modeset_calc_cdclk;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEN9_LP(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10 || IS_GEN9_LP(dev_priv))
|
||||
dev_priv->display.get_cdclk = bxt_get_cdclk;
|
||||
else if (IS_GEN9_BC(dev_priv))
|
||||
dev_priv->display.get_cdclk = skl_get_cdclk;
|
||||
@ -2916,9 +2918,9 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv)
|
||||
dev_priv->display.get_cdclk = hsw_get_cdclk;
|
||||
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
|
||||
dev_priv->display.get_cdclk = vlv_get_cdclk;
|
||||
else if (IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv))
|
||||
else if (IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv))
|
||||
dev_priv->display.get_cdclk = fixed_400mhz_get_cdclk;
|
||||
else if (IS_GEN(dev_priv, 5))
|
||||
else if (IS_IRONLAKE(dev_priv))
|
||||
dev_priv->display.get_cdclk = fixed_450mhz_get_cdclk;
|
||||
else if (IS_GM45(dev_priv))
|
||||
dev_priv->display.get_cdclk = gm45_get_cdclk;
|
||||
|
@ -173,7 +173,7 @@ static void ilk_update_pipe_csc(struct intel_crtc *crtc,
|
||||
coeff[6] << 16 | coeff[7]);
|
||||
intel_de_write(dev_priv, PIPE_CSC_COEFF_BV(pipe), coeff[8] << 16);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 7) {
|
||||
if (DISPLAY_VER(dev_priv) >= 7) {
|
||||
intel_de_write(dev_priv, PIPE_CSC_POSTOFF_HI(pipe),
|
||||
postoff[0]);
|
||||
intel_de_write(dev_priv, PIPE_CSC_POSTOFF_ME(pipe),
|
||||
@ -225,7 +225,7 @@ static bool ilk_csc_limited_range(const struct intel_crtc_state *crtc_state)
|
||||
*/
|
||||
return crtc_state->limited_color_range &&
|
||||
(IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv) ||
|
||||
IS_GEN_RANGE(dev_priv, 9, 10));
|
||||
IS_DISPLAY_RANGE(dev_priv, 9, 10));
|
||||
}
|
||||
|
||||
static void ilk_csc_convert_ctm(const struct intel_crtc_state *crtc_state,
|
||||
@ -530,7 +530,7 @@ static void skl_color_commit(const struct intel_crtc_state *crtc_state)
|
||||
intel_de_write(dev_priv, GAMMA_MODE(crtc->pipe),
|
||||
crtc_state->gamma_mode);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
icl_load_csc_matrix(crtc_state);
|
||||
else
|
||||
ilk_load_csc_matrix(crtc_state);
|
||||
@ -737,7 +737,7 @@ static void ivb_load_lut_ext_max(const struct intel_crtc_state *crtc_state)
|
||||
* ToDo: Extend the ABI to be able to program values
|
||||
* from 3.0 to 7.0
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
|
||||
if (DISPLAY_VER(dev_priv) >= 10) {
|
||||
intel_dsb_reg_write(crtc_state, PREC_PAL_EXT2_GC_MAX(pipe, 0),
|
||||
1 << 16);
|
||||
intel_dsb_reg_write(crtc_state, PREC_PAL_EXT2_GC_MAX(pipe, 1),
|
||||
@ -1222,7 +1222,7 @@ static bool need_plane_update(struct intel_plane *plane,
|
||||
* We have to reconfigure that even if the plane is inactive.
|
||||
*/
|
||||
return crtc_state->active_planes & BIT(plane->id) ||
|
||||
(INTEL_GEN(dev_priv) < 9 &&
|
||||
(DISPLAY_VER(dev_priv) < 9 &&
|
||||
plane->id == PLANE_PRIMARY);
|
||||
}
|
||||
|
||||
@ -1709,9 +1709,9 @@ int intel_color_get_gamma_bit_precision(const struct intel_crtc_state *crtc_stat
|
||||
else
|
||||
return i9xx_gamma_precision(crtc_state);
|
||||
} else {
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
return icl_gamma_precision(crtc_state);
|
||||
else if (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 10))
|
||||
return glk_gamma_precision(crtc_state);
|
||||
else if (IS_IRONLAKE(dev_priv))
|
||||
return ilk_gamma_precision(crtc_state);
|
||||
@ -2105,7 +2105,7 @@ void intel_color_init(struct intel_crtc *crtc)
|
||||
dev_priv->display.color_commit = i9xx_color_commit;
|
||||
dev_priv->display.load_luts = chv_load_luts;
|
||||
dev_priv->display.read_luts = chv_read_luts;
|
||||
} else if (INTEL_GEN(dev_priv) >= 4) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
dev_priv->display.color_check = i9xx_color_check;
|
||||
dev_priv->display.color_commit = i9xx_color_commit;
|
||||
dev_priv->display.load_luts = i965_load_luts;
|
||||
@ -2117,31 +2117,31 @@ void intel_color_init(struct intel_crtc *crtc)
|
||||
dev_priv->display.read_luts = i9xx_read_luts;
|
||||
}
|
||||
} else {
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
dev_priv->display.color_check = icl_color_check;
|
||||
else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
else if (DISPLAY_VER(dev_priv) >= 10)
|
||||
dev_priv->display.color_check = glk_color_check;
|
||||
else if (INTEL_GEN(dev_priv) >= 7)
|
||||
else if (DISPLAY_VER(dev_priv) >= 7)
|
||||
dev_priv->display.color_check = ivb_color_check;
|
||||
else
|
||||
dev_priv->display.color_check = ilk_color_check;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
dev_priv->display.color_commit = skl_color_commit;
|
||||
else if (IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))
|
||||
dev_priv->display.color_commit = hsw_color_commit;
|
||||
else
|
||||
dev_priv->display.color_commit = ilk_color_commit;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
dev_priv->display.load_luts = icl_load_luts;
|
||||
dev_priv->display.read_luts = icl_read_luts;
|
||||
} else if (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 10)) {
|
||||
dev_priv->display.load_luts = glk_load_luts;
|
||||
dev_priv->display.read_luts = glk_read_luts;
|
||||
} else if (INTEL_GEN(dev_priv) >= 8) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 8) {
|
||||
dev_priv->display.load_luts = bdw_load_luts;
|
||||
} else if (INTEL_GEN(dev_priv) >= 7) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 7) {
|
||||
dev_priv->display.load_luts = ivb_load_luts;
|
||||
} else {
|
||||
dev_priv->display.load_luts = ilk_load_luts;
|
||||
|
@ -278,7 +278,7 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
|
||||
if (!icl_combo_phy_enabled(dev_priv, phy))
|
||||
return false;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
ret &= check_phy_reg(dev_priv, phy, ICL_PORT_TX_DW8_LN0(phy),
|
||||
ICL_PORT_TX_DW8_ODCC_CLK_SEL |
|
||||
ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK,
|
||||
@ -401,7 +401,7 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv)
|
||||
intel_de_write(dev_priv, ICL_PHY_MISC(phy), val);
|
||||
|
||||
skip_phy_misc:
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
val = intel_de_read(dev_priv, ICL_PORT_TX_DW8_LN0(phy));
|
||||
val &= ~ICL_PORT_TX_DW8_ODCC_CLK_DIV_SEL_MASK;
|
||||
val |= ICL_PORT_TX_DW8_ODCC_CLK_SEL;
|
||||
@ -473,7 +473,7 @@ skip_phy_misc:
|
||||
|
||||
void intel_combo_phy_init(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 11)
|
||||
if (DISPLAY_VER(i915) >= 11)
|
||||
icl_combo_phys_init(i915);
|
||||
else if (IS_CANNONLAKE(i915))
|
||||
cnl_combo_phys_init(i915);
|
||||
@ -481,7 +481,7 @@ void intel_combo_phy_init(struct drm_i915_private *i915)
|
||||
|
||||
void intel_combo_phy_uninit(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 11)
|
||||
if (DISPLAY_VER(i915) >= 11)
|
||||
icl_combo_phys_uninit(i915);
|
||||
else if (IS_CANNONLAKE(i915))
|
||||
cnl_combo_phys_uninit(i915);
|
||||
|
@ -165,7 +165,7 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder,
|
||||
const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
|
||||
u32 adpa;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5)
|
||||
if (DISPLAY_VER(dev_priv) >= 5)
|
||||
adpa = ADPA_HOTPLUG_BITS;
|
||||
else
|
||||
adpa = 0;
|
||||
@ -356,7 +356,7 @@ intel_crt_mode_valid(struct drm_connector *connector,
|
||||
* DAC limit supposedly 355 MHz.
|
||||
*/
|
||||
max_clock = 270000;
|
||||
else if (IS_GEN_RANGE(dev_priv, 3, 4))
|
||||
else if (IS_DISPLAY_RANGE(dev_priv, 3, 4))
|
||||
max_clock = 400000;
|
||||
else
|
||||
max_clock = 350000;
|
||||
@ -711,7 +711,7 @@ intel_crt_load_detect(struct intel_crt *crt, u32 pipe)
|
||||
/* Set the border color to purple. */
|
||||
intel_uncore_write(uncore, bclrpat_reg, 0x500050);
|
||||
|
||||
if (!IS_GEN(dev_priv, 2)) {
|
||||
if (!IS_DISPLAY_VER(dev_priv, 2)) {
|
||||
u32 pipeconf = intel_uncore_read(uncore, pipeconf_reg);
|
||||
intel_uncore_write(uncore,
|
||||
pipeconf_reg,
|
||||
@ -890,7 +890,7 @@ load_detect:
|
||||
if (ret > 0) {
|
||||
if (intel_crt_detect_ddc(connector))
|
||||
status = connector_status_connected;
|
||||
else if (INTEL_GEN(dev_priv) < 4)
|
||||
else if (DISPLAY_VER(dev_priv) < 4)
|
||||
status = intel_crt_load_detect(crt,
|
||||
to_intel_crtc(connector->state->crtc)->pipe);
|
||||
else if (dev_priv->params.load_detect_test)
|
||||
@ -949,7 +949,7 @@ void intel_crt_reset(struct drm_encoder *encoder)
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->dev);
|
||||
struct intel_crt *crt = intel_encoder_to_crt(to_intel_encoder(encoder));
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5) {
|
||||
if (DISPLAY_VER(dev_priv) >= 5) {
|
||||
u32 adpa;
|
||||
|
||||
adpa = intel_de_read(dev_priv, crt->adpa_reg);
|
||||
@ -1047,7 +1047,7 @@ void intel_crt_init(struct drm_i915_private *dev_priv)
|
||||
else
|
||||
crt->base.pipe_mask = ~0;
|
||||
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
connector->interlace_allowed = 0;
|
||||
else
|
||||
connector->interlace_allowed = 1;
|
||||
|
@ -11,7 +11,6 @@
|
||||
enum pipe;
|
||||
struct drm_encoder;
|
||||
struct drm_i915_private;
|
||||
struct drm_i915_private;
|
||||
|
||||
bool intel_crt_port_enabled(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t adpa_reg, enum pipe *pipe);
|
||||
|
@ -70,9 +70,9 @@ u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state)
|
||||
(crtc_state->output_types & BIT(INTEL_OUTPUT_TVOUT)))
|
||||
return 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
return 0xffffffff; /* full 32 bit counter */
|
||||
else if (INTEL_GEN(dev_priv) >= 3)
|
||||
else if (DISPLAY_VER(dev_priv) >= 3)
|
||||
return 0xffffff; /* only 24 bits of frame count */
|
||||
else
|
||||
return 0; /* Gen2 doesn't have a hardware frame counter */
|
||||
@ -265,7 +265,7 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
crtc->pipe = pipe;
|
||||
crtc->num_scalers = RUNTIME_INFO(dev_priv)->num_scalers[pipe];
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
primary = skl_universal_plane_create(dev_priv, pipe,
|
||||
PLANE_PRIMARY);
|
||||
else
|
||||
@ -279,7 +279,7 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
for_each_sprite(dev_priv, pipe, sprite) {
|
||||
struct intel_plane *plane;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
plane = skl_universal_plane_create(dev_priv, pipe,
|
||||
PLANE_SPRITE0 + sprite);
|
||||
else
|
||||
@ -302,16 +302,16 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
if (IS_CHERRYVIEW(dev_priv) ||
|
||||
IS_VALLEYVIEW(dev_priv) || IS_G4X(dev_priv))
|
||||
funcs = &g4x_crtc_funcs;
|
||||
else if (IS_GEN(dev_priv, 4))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 4))
|
||||
funcs = &i965_crtc_funcs;
|
||||
else if (IS_I945GM(dev_priv) || IS_I915GM(dev_priv))
|
||||
funcs = &i915gm_crtc_funcs;
|
||||
else if (IS_GEN(dev_priv, 3))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 3))
|
||||
funcs = &i915_crtc_funcs;
|
||||
else
|
||||
funcs = &i8xx_crtc_funcs;
|
||||
} else {
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
funcs = &bdw_crtc_funcs;
|
||||
else
|
||||
funcs = &ilk_crtc_funcs;
|
||||
@ -327,7 +327,7 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
dev_priv->pipe_to_crtc_mapping[pipe] != NULL);
|
||||
dev_priv->pipe_to_crtc_mapping[pipe] = crtc;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 9) {
|
||||
if (DISPLAY_VER(dev_priv) < 9) {
|
||||
enum i9xx_plane_id i9xx_plane = primary->i9xx_plane;
|
||||
|
||||
BUG_ON(i9xx_plane >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
|
||||
@ -335,7 +335,7 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
drm_crtc_create_scaling_filter_property(&crtc->base,
|
||||
BIT(DRM_SCALING_FILTER_DEFAULT) |
|
||||
BIT(DRM_SCALING_FILTER_NEAREST_NEIGHBOR));
|
||||
@ -546,7 +546,7 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
|
||||
* Incase of mipi dsi command mode, we need to set frame update
|
||||
* request for every commit.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 11 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 11 &&
|
||||
intel_crtc_has_type(new_crtc_state, INTEL_OUTPUT_DSI))
|
||||
icl_dsi_frame_update(new_crtc_state);
|
||||
|
||||
|
@ -705,11 +705,11 @@ void intel_csr_ucode_init(struct drm_i915_private *dev_priv)
|
||||
csr->fw_path = RKL_CSR_PATH;
|
||||
csr->required_version = RKL_CSR_VERSION_REQUIRED;
|
||||
csr->max_fw_size = GEN12_CSR_MAX_FW_SIZE;
|
||||
} else if (INTEL_GEN(dev_priv) >= 12) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
csr->fw_path = TGL_CSR_PATH;
|
||||
csr->required_version = TGL_CSR_VERSION_REQUIRED;
|
||||
csr->max_fw_size = GEN12_CSR_MAX_FW_SIZE;
|
||||
} else if (IS_GEN(dev_priv, 11)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 11)) {
|
||||
csr->fw_path = ICL_CSR_PATH;
|
||||
csr->required_version = ICL_CSR_VERSION_REQUIRED;
|
||||
csr->max_fw_size = ICL_CSR_MAX_FW_SIZE;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "intel_cursor.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_display.h"
|
||||
#include "intel_fb.h"
|
||||
|
||||
#include "intel_frontbuffer.h"
|
||||
#include "intel_pm.h"
|
||||
@ -44,7 +45,7 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
|
||||
else
|
||||
base = intel_plane_ggtt_offset(plane_state);
|
||||
|
||||
return base + plane_state->color_plane[0].offset;
|
||||
return base + plane_state->view.color_plane[0].offset;
|
||||
}
|
||||
|
||||
static u32 intel_cursor_position(const struct intel_plane_state *plane_state)
|
||||
@ -124,9 +125,9 @@ static int intel_cursor_check_surface(struct intel_plane_state *plane_state)
|
||||
offset += (src_h * src_w - 1) * fb->format->cpp[0];
|
||||
}
|
||||
|
||||
plane_state->color_plane[0].offset = offset;
|
||||
plane_state->color_plane[0].x = src_x;
|
||||
plane_state->color_plane[0].y = src_y;
|
||||
plane_state->view.color_plane[0].offset = offset;
|
||||
plane_state->view.color_plane[0].x = src_x;
|
||||
plane_state->view.color_plane[0].y = src_y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -193,7 +194,7 @@ static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state,
|
||||
{
|
||||
return CURSOR_ENABLE |
|
||||
CURSOR_FORMAT_ARGB |
|
||||
CURSOR_STRIDE(plane_state->color_plane[0].stride);
|
||||
CURSOR_STRIDE(plane_state->view.color_plane[0].stride);
|
||||
}
|
||||
|
||||
static bool i845_cursor_size_ok(const struct intel_plane_state *plane_state)
|
||||
@ -232,7 +233,7 @@ static int i845_check_cursor(struct intel_crtc_state *crtc_state,
|
||||
}
|
||||
|
||||
drm_WARN_ON(&i915->drm, plane_state->uapi.visible &&
|
||||
plane_state->color_plane[0].stride != fb->pitches[0]);
|
||||
plane_state->view.color_plane[0].stride != fb->pitches[0]);
|
||||
|
||||
switch (fb->pitches[0]) {
|
||||
case 256:
|
||||
@ -338,7 +339,7 @@ static u32 i9xx_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state)
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
u32 cntl = 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
return cntl;
|
||||
|
||||
if (crtc_state->gamma_enable)
|
||||
@ -347,7 +348,7 @@ static u32 i9xx_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state)
|
||||
if (crtc_state->csc_enable)
|
||||
cntl |= MCURSOR_PIPE_CSC_ENABLE;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) < 5 && !IS_G4X(dev_priv))
|
||||
cntl |= MCURSOR_PIPE_SELECT(crtc->pipe);
|
||||
|
||||
return cntl;
|
||||
@ -360,7 +361,7 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
|
||||
to_i915(plane_state->uapi.plane->dev);
|
||||
u32 cntl = 0;
|
||||
|
||||
if (IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv))
|
||||
if (IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv))
|
||||
cntl |= MCURSOR_TRICKLE_FEED_DISABLE;
|
||||
|
||||
switch (drm_rect_width(&plane_state->uapi.dst)) {
|
||||
@ -449,7 +450,7 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
|
||||
}
|
||||
|
||||
drm_WARN_ON(&dev_priv->drm, plane_state->uapi.visible &&
|
||||
plane_state->color_plane[0].stride != fb->pitches[0]);
|
||||
plane_state->view.color_plane[0].stride != fb->pitches[0]);
|
||||
|
||||
if (fb->pitches[0] !=
|
||||
drm_rect_width(&plane_state->uapi.dst) * fb->format->cpp[0]) {
|
||||
@ -527,7 +528,7 @@ static void i9xx_update_cursor(struct intel_plane *plane,
|
||||
* the CURCNTR write arms the update.
|
||||
*/
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
skl_write_cursor_wm(plane, crtc_state);
|
||||
|
||||
if (!intel_crtc_needs_modeset(crtc_state))
|
||||
@ -583,7 +584,7 @@ static bool i9xx_cursor_get_hw_state(struct intel_plane *plane,
|
||||
|
||||
ret = val & MCURSOR_MODE;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
*pipe = plane->pipe;
|
||||
else
|
||||
*pipe = (val & MCURSOR_PIPE_SELECT_MASK) >>
|
||||
@ -783,7 +784,7 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv,
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
drm_plane_create_rotation_property(&cursor->base,
|
||||
DRM_MODE_ROTATE_0,
|
||||
DRM_MODE_ROTATE_0 |
|
||||
@ -792,7 +793,7 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv,
|
||||
zpos = RUNTIME_INFO(dev_priv)->num_sprites[pipe] + 1;
|
||||
drm_plane_create_zpos_immutable_property(&cursor->base, zpos);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
drm_plane_enable_fb_damage_clips(&cursor->base);
|
||||
|
||||
drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs);
|
||||
|
@ -113,7 +113,7 @@ void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder,
|
||||
&n_entries);
|
||||
|
||||
/* If we're boosting the current, set bit 31 of trans1 */
|
||||
if (IS_GEN9_BC(dev_priv) && intel_bios_dp_boost_level(encoder))
|
||||
if (IS_GEN9_BC(dev_priv) && intel_bios_encoder_dp_boost_level(encoder->devdata))
|
||||
iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE;
|
||||
|
||||
for (i = 0; i < n_entries; i++) {
|
||||
@ -146,7 +146,7 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder,
|
||||
level = n_entries - 1;
|
||||
|
||||
/* If we're boosting the current, set bit 31 of trans1 */
|
||||
if (IS_GEN9_BC(dev_priv) && intel_bios_hdmi_boost_level(encoder))
|
||||
if (IS_GEN9_BC(dev_priv) && intel_bios_encoder_hdmi_boost_level(encoder->devdata))
|
||||
iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE;
|
||||
|
||||
/* Entry 9 is for HDMI: */
|
||||
@ -174,7 +174,7 @@ static void intel_wait_ddi_buf_active(struct drm_i915_private *dev_priv,
|
||||
enum port port)
|
||||
{
|
||||
/* Wait > 518 usecs for DDI_BUF_CTL to be non idle */
|
||||
if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) {
|
||||
if (DISPLAY_VER(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) {
|
||||
usleep_range(518, 1000);
|
||||
return;
|
||||
}
|
||||
@ -390,7 +390,7 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder,
|
||||
|
||||
/* Enable TRANS_DDI_FUNC_CTL for the pipe to work in HDMI mode */
|
||||
temp = TRANS_DDI_FUNC_ENABLE;
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
temp |= TGL_TRANS_DDI_SELECT_PORT(port);
|
||||
else
|
||||
temp |= TRANS_DDI_SELECT_PORT(port);
|
||||
@ -458,7 +458,7 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder,
|
||||
temp |= TRANS_DDI_MODE_SELECT_DP_MST;
|
||||
temp |= DDI_PORT_WIDTH(crtc_state->lane_count);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
enum transcoder master;
|
||||
|
||||
master = crtc_state->mst_master_transcoder;
|
||||
@ -471,7 +471,7 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder,
|
||||
temp |= DDI_PORT_WIDTH(crtc_state->lane_count);
|
||||
}
|
||||
|
||||
if (IS_GEN_RANGE(dev_priv, 8, 10) &&
|
||||
if (IS_DISPLAY_RANGE(dev_priv, 8, 10) &&
|
||||
crtc_state->master_transcoder != INVALID_TRANSCODER) {
|
||||
u8 master_select =
|
||||
bdw_trans_port_sync_master_select(crtc_state->master_transcoder);
|
||||
@ -490,7 +490,7 @@ void intel_ddi_enable_transcoder_func(struct intel_encoder *encoder,
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
enum transcoder master_transcoder = crtc_state->master_transcoder;
|
||||
u32 ctl2 = 0;
|
||||
|
||||
@ -536,7 +536,7 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state
|
||||
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
|
||||
u32 ctl;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
intel_de_write(dev_priv,
|
||||
TRANS_DDI_FUNC_CTL2(cpu_transcoder), 0);
|
||||
|
||||
@ -546,11 +546,11 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state
|
||||
|
||||
ctl &= ~TRANS_DDI_FUNC_ENABLE;
|
||||
|
||||
if (IS_GEN_RANGE(dev_priv, 8, 10))
|
||||
if (IS_DISPLAY_RANGE(dev_priv, 8, 10))
|
||||
ctl &= ~(TRANS_DDI_PORT_SYNC_ENABLE |
|
||||
TRANS_DDI_PORT_SYNC_MASTER_SELECT_MASK);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
if (!intel_dp_mst_is_master_trans(crtc_state)) {
|
||||
ctl &= ~(TGL_TRANS_DDI_PORT_MASK |
|
||||
TRANS_DDI_MODE_SELECT_MASK);
|
||||
@ -714,7 +714,7 @@ static void intel_ddi_get_encoder_pipes(struct intel_encoder *encoder,
|
||||
if (!trans_wakeref)
|
||||
continue;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
port_mask = TGL_TRANS_DDI_PORT_MASK;
|
||||
ddi_select = TGL_TRANS_DDI_SELECT_PORT(port);
|
||||
} else {
|
||||
@ -854,7 +854,7 @@ void intel_ddi_enable_pipe_clock(struct intel_encoder *encoder,
|
||||
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
|
||||
|
||||
if (cpu_transcoder != TRANSCODER_EDP) {
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
intel_de_write(dev_priv,
|
||||
TRANS_CLK_SEL(cpu_transcoder),
|
||||
TGL_TRANS_CLK_SEL_PORT(port));
|
||||
@ -871,7 +871,7 @@ void intel_ddi_disable_pipe_clock(const struct intel_crtc_state *crtc_state)
|
||||
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
|
||||
|
||||
if (cpu_transcoder != TRANSCODER_EDP) {
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
intel_de_write(dev_priv,
|
||||
TRANS_CLK_SEL(cpu_transcoder),
|
||||
TGL_TRANS_CLK_SEL_DISABLED);
|
||||
@ -905,9 +905,9 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder,
|
||||
u8 iboost;
|
||||
|
||||
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
|
||||
iboost = intel_bios_hdmi_boost_level(encoder);
|
||||
iboost = intel_bios_encoder_hdmi_boost_level(encoder->devdata);
|
||||
else
|
||||
iboost = intel_bios_dp_boost_level(encoder);
|
||||
iboost = intel_bios_encoder_dp_boost_level(encoder->devdata);
|
||||
|
||||
if (iboost == 0) {
|
||||
const struct ddi_buf_trans *ddi_translations;
|
||||
@ -971,12 +971,12 @@ static u8 intel_ddi_dp_voltage_max(struct intel_dp *intel_dp,
|
||||
enum phy phy = intel_port_to_phy(dev_priv, port);
|
||||
int n_entries;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
if (intel_phy_is_combo(dev_priv, phy))
|
||||
tgl_get_combo_buf_trans(encoder, crtc_state, &n_entries);
|
||||
else
|
||||
tgl_get_dkl_buf_trans(encoder, crtc_state, &n_entries);
|
||||
} else if (INTEL_GEN(dev_priv) == 11) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 11)) {
|
||||
if (IS_PLATFORM(dev_priv, INTEL_JASPERLAKE))
|
||||
jsl_get_combo_buf_trans(encoder, crtc_state, &n_entries);
|
||||
else if (IS_PLATFORM(dev_priv, INTEL_ELKHARTLAKE))
|
||||
@ -1147,7 +1147,7 @@ static void icl_ddi_combo_vswing_program(struct intel_encoder *encoder,
|
||||
int n_entries, ln;
|
||||
u32 val;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
ddi_translations = tgl_get_combo_buf_trans(encoder, crtc_state, &n_entries);
|
||||
else if (IS_PLATFORM(dev_priv, INTEL_JASPERLAKE))
|
||||
ddi_translations = jsl_get_combo_buf_trans(encoder, crtc_state, &n_entries);
|
||||
@ -2210,7 +2210,7 @@ icl_program_mg_dp_mode(struct intel_digital_port *dig_port,
|
||||
dig_port->tc_mode == TC_PORT_TBT_ALT)
|
||||
return;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
intel_de_write(dev_priv, HIP_INDEX_REG(tc_port),
|
||||
HIP_INDEX_VAL(tc_port, 0x0));
|
||||
ln0 = intel_de_read(dev_priv, DKL_DP_MODE(tc_port));
|
||||
@ -2276,7 +2276,7 @@ icl_program_mg_dp_mode(struct intel_digital_port *dig_port,
|
||||
MISSING_CASE(pin_assignment);
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
intel_de_write(dev_priv, HIP_INDEX_REG(tc_port),
|
||||
HIP_INDEX_VAL(tc_port, 0x0));
|
||||
intel_de_write(dev_priv, DKL_DP_MODE(tc_port), ln0);
|
||||
@ -2303,7 +2303,7 @@ i915_reg_t dp_tp_ctl_reg(struct intel_encoder *encoder,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
return TGL_DP_TP_CTL(tgl_dp_tp_transcoder(crtc_state));
|
||||
else
|
||||
return DP_TP_CTL(encoder->port);
|
||||
@ -2314,7 +2314,7 @@ i915_reg_t dp_tp_status_reg(struct intel_encoder *encoder,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
return TGL_DP_TP_STATUS(tgl_dp_tp_transcoder(crtc_state));
|
||||
else
|
||||
return DP_TP_STATUS(encoder->port);
|
||||
@ -2621,7 +2621,7 @@ static void hsw_ddi_pre_enable_dp(struct intel_atomic_state *state,
|
||||
bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);
|
||||
int level = intel_ddi_dp_level(intel_dp);
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 11)
|
||||
if (DISPLAY_VER(dev_priv) < 11)
|
||||
drm_WARN_ON(&dev_priv->drm,
|
||||
is_mst && (port == PORT_A || port == PORT_E));
|
||||
else
|
||||
@ -2644,7 +2644,7 @@ static void hsw_ddi_pre_enable_dp(struct intel_atomic_state *state,
|
||||
|
||||
icl_program_mg_dp_mode(dig_port, crtc_state);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
icl_ddi_vswing_sequence(encoder, crtc_state, level);
|
||||
else if (IS_CANNONLAKE(dev_priv))
|
||||
cnl_ddi_vswing_sequence(encoder, crtc_state, level);
|
||||
@ -2663,7 +2663,7 @@ static void hsw_ddi_pre_enable_dp(struct intel_atomic_state *state,
|
||||
true);
|
||||
intel_dp_sink_set_fec_ready(intel_dp, crtc_state);
|
||||
intel_dp_start_link_train(intel_dp, crtc_state);
|
||||
if ((port != PORT_A || INTEL_GEN(dev_priv) >= 9) &&
|
||||
if ((port != PORT_A || DISPLAY_VER(dev_priv) >= 9) &&
|
||||
!is_trans_port_sync_mode(crtc_state))
|
||||
intel_dp_stop_link_train(intel_dp, crtc_state);
|
||||
|
||||
@ -2683,7 +2683,7 @@ static void intel_ddi_pre_enable_dp(struct intel_atomic_state *state,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
tgl_ddi_pre_enable_dp(state, encoder, crtc_state, conn_state);
|
||||
else
|
||||
hsw_ddi_pre_enable_dp(state, encoder, crtc_state, conn_state);
|
||||
@ -2818,7 +2818,7 @@ static void intel_ddi_post_disable_dp(struct intel_atomic_state *state,
|
||||
*/
|
||||
intel_dp_set_power(intel_dp, DP_SET_POWER_D3);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
if (is_mst) {
|
||||
enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;
|
||||
u32 val;
|
||||
@ -2843,7 +2843,7 @@ static void intel_ddi_post_disable_dp(struct intel_atomic_state *state,
|
||||
* Configure Transcoder Clock select to direct no clock to the
|
||||
* transcoder"
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
intel_ddi_disable_pipe_clock(old_crtc_state);
|
||||
|
||||
intel_pps_vdd_on(intel_dp);
|
||||
@ -2904,7 +2904,7 @@ static void intel_ddi_post_disable(struct intel_atomic_state *state,
|
||||
|
||||
intel_dsc_disable(old_crtc_state);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
skl_scaler_disable(old_crtc_state);
|
||||
else
|
||||
ilk_pfit_disable(old_crtc_state);
|
||||
@ -3035,7 +3035,7 @@ static void intel_enable_ddi_dp(struct intel_atomic_state *state,
|
||||
struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
|
||||
enum port port = encoder->port;
|
||||
|
||||
if (port == PORT_A && INTEL_GEN(dev_priv) < 9)
|
||||
if (port == PORT_A && DISPLAY_VER(dev_priv) < 9)
|
||||
intel_dp_stop_link_train(intel_dp, crtc_state);
|
||||
|
||||
intel_edp_backlight_on(crtc_state, conn_state);
|
||||
@ -3064,7 +3064,7 @@ gen9_chicken_trans_reg_by_port(struct drm_i915_private *dev_priv,
|
||||
[PORT_E] = TRANSCODER_A,
|
||||
};
|
||||
|
||||
drm_WARN_ON(&dev_priv->drm, INTEL_GEN(dev_priv) < 9);
|
||||
drm_WARN_ON(&dev_priv->drm, DISPLAY_VER(dev_priv) < 9);
|
||||
|
||||
if (drm_WARN_ON(&dev_priv->drm, port < PORT_A || port > PORT_E))
|
||||
port = PORT_A;
|
||||
@ -3090,9 +3090,9 @@ static void intel_enable_ddi_hdmi(struct intel_atomic_state *state,
|
||||
"[CONNECTOR:%d:%s] Failed to configure sink scrambling/TMDS bit clock ratio\n",
|
||||
connector->base.id, connector->name);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
tgl_ddi_vswing_sequence(encoder, crtc_state, level);
|
||||
else if (INTEL_GEN(dev_priv) == 11)
|
||||
else if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
icl_ddi_vswing_sequence(encoder, crtc_state, level);
|
||||
else if (IS_CANNONLAKE(dev_priv))
|
||||
cnl_ddi_vswing_sequence(encoder, crtc_state, level);
|
||||
@ -3424,7 +3424,7 @@ static void intel_ddi_set_idle_link_train(struct intel_dp *intel_dp,
|
||||
* In this case there is requirement to wait for a minimum number of
|
||||
* idle patterns to be sent.
|
||||
*/
|
||||
if (port == PORT_A && INTEL_GEN(dev_priv) < 12)
|
||||
if (port == PORT_A && DISPLAY_VER(dev_priv) < 12)
|
||||
return;
|
||||
|
||||
if (intel_de_wait_for_set(dev_priv,
|
||||
@ -3450,11 +3450,11 @@ static bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
|
||||
void intel_ddi_compute_min_voltage_level(struct drm_i915_private *dev_priv,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 12 && crtc_state->port_clock > 594000)
|
||||
if (DISPLAY_VER(dev_priv) >= 12 && crtc_state->port_clock > 594000)
|
||||
crtc_state->min_voltage_level = 2;
|
||||
else if (IS_JSL_EHL(dev_priv) && crtc_state->port_clock > 594000)
|
||||
crtc_state->min_voltage_level = 3;
|
||||
else if (INTEL_GEN(dev_priv) >= 11 && crtc_state->port_clock > 594000)
|
||||
else if (DISPLAY_VER(dev_priv) >= 11 && crtc_state->port_clock > 594000)
|
||||
crtc_state->min_voltage_level = 1;
|
||||
else if (IS_CANNONLAKE(dev_priv) && crtc_state->port_clock > 594000)
|
||||
crtc_state->min_voltage_level = 2;
|
||||
@ -3465,7 +3465,7 @@ static enum transcoder bdw_transcoder_master_readout(struct drm_i915_private *de
|
||||
{
|
||||
u32 master_select;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
u32 ctl2 = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL2(cpu_transcoder));
|
||||
|
||||
if ((ctl2 & PORT_SYNC_MODE_ENABLE) == 0)
|
||||
@ -3589,7 +3589,7 @@ static void intel_ddi_read_func_ctl(struct intel_encoder *encoder,
|
||||
((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
|
||||
intel_dp_get_m_n(intel_crtc, pipe_config);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
i915_reg_t dp_tp_ctl = dp_tp_ctl_reg(encoder, pipe_config);
|
||||
|
||||
pipe_config->fec_enable =
|
||||
@ -3613,7 +3613,7 @@ static void intel_ddi_read_func_ctl(struct intel_encoder *encoder,
|
||||
pipe_config->lane_count =
|
||||
((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
pipe_config->mst_master_transcoder =
|
||||
REG_FIELD_GET(TRANS_DDI_MST_TRANSPORT_SELECT_MASK, temp);
|
||||
|
||||
@ -3700,7 +3700,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder,
|
||||
HDMI_INFOFRAME_TYPE_DRM,
|
||||
&pipe_config->infoframes.drm);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
bdw_get_trans_port_sync_config(pipe_config);
|
||||
|
||||
intel_read_dp_sdp(encoder, pipe_config, HDMI_PACKET_TYPE_GAMUT_METADATA);
|
||||
@ -3943,7 +3943,7 @@ intel_ddi_port_sync_transcoders(const struct intel_crtc_state *ref_crtc_state,
|
||||
* We don't enable port sync on BDW due to missing w/as and
|
||||
* due to not having adjusted the modeset sequence appropriately.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) < 9)
|
||||
if (DISPLAY_VER(dev_priv) < 9)
|
||||
return 0;
|
||||
|
||||
if (!intel_crtc_has_type(ref_crtc_state, INTEL_OUTPUT_DP))
|
||||
@ -4017,8 +4017,17 @@ static void intel_ddi_encoder_destroy(struct drm_encoder *encoder)
|
||||
kfree(dig_port);
|
||||
}
|
||||
|
||||
static void intel_ddi_encoder_reset(struct drm_encoder *encoder)
|
||||
{
|
||||
struct intel_dp *intel_dp = enc_to_intel_dp(to_intel_encoder(encoder));
|
||||
|
||||
intel_dp->reset_link_params = true;
|
||||
|
||||
intel_pps_encoder_reset(intel_dp);
|
||||
}
|
||||
|
||||
static const struct drm_encoder_funcs intel_ddi_funcs = {
|
||||
.reset = intel_dp_encoder_reset,
|
||||
.reset = intel_ddi_encoder_reset,
|
||||
.destroy = intel_ddi_encoder_destroy,
|
||||
};
|
||||
|
||||
@ -4038,9 +4047,9 @@ intel_ddi_init_dp_connector(struct intel_digital_port *dig_port)
|
||||
dig_port->dp.set_link_train = intel_ddi_set_link_train;
|
||||
dig_port->dp.set_idle_link_train = intel_ddi_set_idle_link_train;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
dig_port->dp.set_signal_levels = tgl_set_signal_levels;
|
||||
else if (INTEL_GEN(dev_priv) >= 11)
|
||||
else if (DISPLAY_VER(dev_priv) >= 11)
|
||||
dig_port->dp.set_signal_levels = icl_set_signal_levels;
|
||||
else if (IS_CANNONLAKE(dev_priv))
|
||||
dig_port->dp.set_signal_levels = cnl_set_signal_levels;
|
||||
@ -4309,7 +4318,7 @@ intel_ddi_max_lanes(struct intel_digital_port *dig_port)
|
||||
enum port port = dig_port->base.port;
|
||||
int max_lanes = 4;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
return max_lanes;
|
||||
|
||||
if (port == PORT_A || port == PORT_E) {
|
||||
@ -4411,9 +4420,9 @@ static enum hpd_pin skl_hpd_pin(struct drm_i915_private *dev_priv, enum port por
|
||||
|
||||
static bool intel_ddi_is_tc(struct drm_i915_private *i915, enum port port)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 12)
|
||||
if (DISPLAY_VER(i915) >= 12)
|
||||
return port >= PORT_TC1;
|
||||
else if (INTEL_GEN(i915) >= 11)
|
||||
else if (DISPLAY_VER(i915) >= 11)
|
||||
return port >= PORT_C;
|
||||
else
|
||||
return false;
|
||||
@ -4426,6 +4435,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
{
|
||||
struct intel_digital_port *dig_port;
|
||||
struct intel_encoder *encoder;
|
||||
const struct intel_bios_encoder_data *devdata;
|
||||
bool init_hdmi, init_dp;
|
||||
enum phy phy = intel_port_to_phy(dev_priv, port);
|
||||
|
||||
@ -4441,9 +4451,17 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
return;
|
||||
}
|
||||
|
||||
init_hdmi = intel_bios_port_supports_dvi(dev_priv, port) ||
|
||||
intel_bios_port_supports_hdmi(dev_priv, port);
|
||||
init_dp = intel_bios_port_supports_dp(dev_priv, port);
|
||||
devdata = intel_bios_encoder_data_lookup(dev_priv, port);
|
||||
if (!devdata) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"VBT says port %c is not present\n",
|
||||
port_name(port));
|
||||
return;
|
||||
}
|
||||
|
||||
init_hdmi = intel_bios_encoder_supports_dvi(devdata) ||
|
||||
intel_bios_encoder_supports_hdmi(devdata);
|
||||
init_dp = intel_bios_encoder_supports_dp(devdata);
|
||||
|
||||
if (intel_bios_is_lspcon_present(dev_priv, port)) {
|
||||
/*
|
||||
@ -4469,8 +4487,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
return;
|
||||
|
||||
encoder = &dig_port->base;
|
||||
encoder->devdata = devdata;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
|
||||
|
||||
drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
|
||||
@ -4480,7 +4499,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
port >= PORT_TC1 ? port_tc_name(port) : port_name(port),
|
||||
tc_port != TC_PORT_NONE ? "TC" : "",
|
||||
tc_port != TC_PORT_NONE ? tc_port_name(tc_port) : phy_name(phy));
|
||||
} else if (INTEL_GEN(dev_priv) >= 11) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
|
||||
|
||||
drm_encoder_init(&dev_priv->drm, &encoder->base, &intel_ddi_funcs,
|
||||
@ -4549,7 +4568,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
encoder->is_clock_enabled = icl_ddi_combo_is_clock_enabled;
|
||||
encoder->get_config = icl_ddi_combo_get_config;
|
||||
}
|
||||
} else if (INTEL_GEN(dev_priv) >= 11) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
if (intel_ddi_is_tc(dev_priv, port)) {
|
||||
encoder->enable_clock = icl_ddi_tc_enable_clock;
|
||||
encoder->disable_clock = icl_ddi_tc_disable_clock;
|
||||
@ -4585,20 +4604,20 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
encoder->hpd_pin = dg1_hpd_pin(dev_priv, port);
|
||||
else if (IS_ROCKETLAKE(dev_priv))
|
||||
encoder->hpd_pin = rkl_hpd_pin(dev_priv, port);
|
||||
else if (INTEL_GEN(dev_priv) >= 12)
|
||||
else if (DISPLAY_VER(dev_priv) >= 12)
|
||||
encoder->hpd_pin = tgl_hpd_pin(dev_priv, port);
|
||||
else if (IS_JSL_EHL(dev_priv))
|
||||
encoder->hpd_pin = ehl_hpd_pin(dev_priv, port);
|
||||
else if (IS_GEN(dev_priv, 11))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
encoder->hpd_pin = icl_hpd_pin(dev_priv, port);
|
||||
else if (IS_GEN(dev_priv, 10))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 10))
|
||||
encoder->hpd_pin = cnl_hpd_pin(dev_priv, port);
|
||||
else if (IS_GEN(dev_priv, 9))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 9))
|
||||
encoder->hpd_pin = skl_hpd_pin(dev_priv, port);
|
||||
else
|
||||
encoder->hpd_pin = intel_hpd_pin_default(dev_priv, port);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
dig_port->saved_port_bits =
|
||||
intel_de_read(dev_priv, DDI_BUF_CTL(port))
|
||||
& DDI_BUF_PORT_REVERSAL;
|
||||
@ -4616,8 +4635,8 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
|
||||
if (intel_phy_is_tc(dev_priv, phy)) {
|
||||
bool is_legacy =
|
||||
!intel_bios_port_supports_typec_usb(dev_priv, port) &&
|
||||
!intel_bios_port_supports_tbt(dev_priv, port);
|
||||
!intel_bios_encoder_supports_typec_usb(devdata) &&
|
||||
!intel_bios_encoder_supports_tbt(devdata);
|
||||
|
||||
intel_tc_port_init(dig_port, is_legacy);
|
||||
|
||||
@ -4647,12 +4666,12 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
if (intel_phy_is_tc(dev_priv, phy))
|
||||
dig_port->connected = intel_tc_port_connected;
|
||||
else
|
||||
dig_port->connected = lpt_digital_port_connected;
|
||||
} else if (INTEL_GEN(dev_priv) >= 8) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 8) {
|
||||
if (port == PORT_A || IS_GEN9_LP(dev_priv))
|
||||
dig_port->connected = bdw_digital_port_connected;
|
||||
else
|
||||
|
@ -1355,13 +1355,13 @@ int intel_ddi_hdmi_num_entries(struct intel_encoder *encoder,
|
||||
enum phy phy = intel_port_to_phy(dev_priv, encoder->port);
|
||||
int n_entries;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
if (intel_phy_is_combo(dev_priv, phy))
|
||||
tgl_get_combo_buf_trans_hdmi(encoder, crtc_state, &n_entries);
|
||||
else
|
||||
tgl_get_dkl_buf_trans_hdmi(encoder, crtc_state, &n_entries);
|
||||
*default_entry = n_entries - 1;
|
||||
} else if (INTEL_GEN(dev_priv) == 11) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 11)) {
|
||||
if (intel_phy_is_combo(dev_priv, phy))
|
||||
icl_get_combo_buf_trans_hdmi(encoder, crtc_state, &n_entries);
|
||||
else
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -48,7 +48,6 @@ struct i915_ggtt_view;
|
||||
struct intel_atomic_state;
|
||||
struct intel_crtc;
|
||||
struct intel_crtc_state;
|
||||
struct intel_crtc_state;
|
||||
struct intel_digital_port;
|
||||
struct intel_dp;
|
||||
struct intel_encoder;
|
||||
@ -515,7 +514,6 @@ void intel_link_compute_m_n(u16 bpp, int nlanes,
|
||||
void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv);
|
||||
u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
|
||||
u32 pixel_format, u64 modifier);
|
||||
bool intel_plane_can_remap(const struct intel_plane_state *plane_state);
|
||||
enum drm_mode_status
|
||||
intel_mode_valid_max_plane_size(struct drm_i915_private *dev_priv,
|
||||
const struct drm_display_mode *mode,
|
||||
@ -627,10 +625,6 @@ bool
|
||||
intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
|
||||
u64 modifier);
|
||||
|
||||
int intel_plane_compute_gtt(struct intel_plane_state *plane_state);
|
||||
u32 intel_plane_compute_aligned_offset(int *x, int *y,
|
||||
const struct intel_plane_state *state,
|
||||
int color_plane);
|
||||
int intel_plane_pin_fb(struct intel_plane_state *plane_state);
|
||||
void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state);
|
||||
struct intel_encoder *
|
||||
@ -639,15 +633,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
|
||||
|
||||
unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
|
||||
int color_plane);
|
||||
void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
|
||||
const struct drm_framebuffer *fb,
|
||||
int color_plane);
|
||||
u32 intel_plane_adjust_aligned_offset(int *x, int *y,
|
||||
const struct intel_plane_state *state,
|
||||
int color_plane,
|
||||
u32 old_offset, u32 new_offset);
|
||||
unsigned int intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane);
|
||||
unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane);
|
||||
|
||||
void intel_display_driver_register(struct drm_i915_private *i915);
|
||||
void intel_display_driver_unregister(struct drm_i915_private *i915);
|
||||
|
@ -58,11 +58,11 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
|
||||
if (intel_fbc_is_active(dev_priv)) {
|
||||
u32 mask;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
mask = intel_de_read(dev_priv, IVB_FBC_STATUS2) & BDW_FBC_COMP_SEG_MASK;
|
||||
else if (INTEL_GEN(dev_priv) >= 7)
|
||||
else if (DISPLAY_VER(dev_priv) >= 7)
|
||||
mask = intel_de_read(dev_priv, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK;
|
||||
else if (INTEL_GEN(dev_priv) >= 5)
|
||||
else if (DISPLAY_VER(dev_priv) >= 5)
|
||||
mask = intel_de_read(dev_priv, ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK;
|
||||
else if (IS_G4X(dev_priv))
|
||||
mask = intel_de_read(dev_priv, DPFC_STATUS) & DPFC_COMP_SEG_MASK;
|
||||
@ -83,7 +83,7 @@ static int i915_fbc_false_color_get(void *data, u64 *val)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = data;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 7 || !HAS_FBC(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) < 7 || !HAS_FBC(dev_priv))
|
||||
return -ENODEV;
|
||||
|
||||
*val = dev_priv->fbc.false_color;
|
||||
@ -96,7 +96,7 @@ static int i915_fbc_false_color_set(void *data, u64 val)
|
||||
struct drm_i915_private *dev_priv = data;
|
||||
u32 reg;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 7 || !HAS_FBC(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) < 7 || !HAS_FBC(dev_priv))
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev_priv->fbc.lock);
|
||||
@ -128,7 +128,7 @@ static int i915_ips_status(struct seq_file *m, void *unused)
|
||||
seq_printf(m, "Enabled by kernel parameter: %s\n",
|
||||
yesno(dev_priv->params.enable_ips));
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 8) {
|
||||
if (DISPLAY_VER(dev_priv) >= 8) {
|
||||
seq_puts(m, "Currently: unknown\n");
|
||||
} else {
|
||||
if (intel_de_read(dev_priv, IPS_CTL) & IPS_ENABLE)
|
||||
@ -150,7 +150,7 @@ static int i915_sr_status(struct seq_file *m, void *unused)
|
||||
|
||||
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_INIT);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
/* no global SR status; inspect per-plane WM */;
|
||||
else if (HAS_PCH_SPLIT(dev_priv))
|
||||
sr_enabled = intel_de_read(dev_priv, WM1_LP_ILK) & WM1_LP_SR_EN;
|
||||
@ -550,7 +550,7 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
|
||||
seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version),
|
||||
CSR_VERSION_MINOR(csr->version));
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
if (IS_DGFX(dev_priv)) {
|
||||
dc5_reg = DG1_DMC_DEBUG_DC5_COUNT;
|
||||
} else {
|
||||
@ -1190,7 +1190,7 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
|
||||
struct skl_ddb_entry *entry;
|
||||
struct intel_crtc *crtc;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 9)
|
||||
if (DISPLAY_VER(dev_priv) < 9)
|
||||
return -ENODEV;
|
||||
|
||||
drm_modeset_lock_all(dev);
|
||||
@ -1339,7 +1339,7 @@ static int i915_lpsp_status(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct drm_i915_private *i915 = node_to_i915(m->private);
|
||||
|
||||
switch (INTEL_GEN(i915)) {
|
||||
switch (DISPLAY_VER(i915)) {
|
||||
case 12:
|
||||
case 11:
|
||||
LPSP_STATUS(!intel_lpsp_power_well_enabled(i915, ICL_DISP_PW_3));
|
||||
@ -1616,7 +1616,7 @@ static void wm_latency_show(struct seq_file *m, const u16 wm[8])
|
||||
* - WM1+ latency values in 0.5us units
|
||||
* - latencies are in us on gen9/vlv/chv
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 9 ||
|
||||
if (DISPLAY_VER(dev_priv) >= 9 ||
|
||||
IS_VALLEYVIEW(dev_priv) ||
|
||||
IS_CHERRYVIEW(dev_priv) ||
|
||||
IS_G4X(dev_priv))
|
||||
@ -1636,7 +1636,7 @@ static int pri_wm_latency_show(struct seq_file *m, void *data)
|
||||
struct drm_i915_private *dev_priv = m->private;
|
||||
const u16 *latencies;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
latencies = dev_priv->wm.skl_latency;
|
||||
else
|
||||
latencies = dev_priv->wm.pri_latency;
|
||||
@ -1651,7 +1651,7 @@ static int spr_wm_latency_show(struct seq_file *m, void *data)
|
||||
struct drm_i915_private *dev_priv = m->private;
|
||||
const u16 *latencies;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
latencies = dev_priv->wm.skl_latency;
|
||||
else
|
||||
latencies = dev_priv->wm.spr_latency;
|
||||
@ -1666,7 +1666,7 @@ static int cur_wm_latency_show(struct seq_file *m, void *data)
|
||||
struct drm_i915_private *dev_priv = m->private;
|
||||
const u16 *latencies;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
latencies = dev_priv->wm.skl_latency;
|
||||
else
|
||||
latencies = dev_priv->wm.cur_latency;
|
||||
@ -1680,7 +1680,7 @@ static int pri_wm_latency_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = inode->i_private;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) < 5 && !IS_G4X(dev_priv))
|
||||
return -ENODEV;
|
||||
|
||||
return single_open(file, pri_wm_latency_show, dev_priv);
|
||||
@ -1759,7 +1759,7 @@ static ssize_t pri_wm_latency_write(struct file *file, const char __user *ubuf,
|
||||
struct drm_i915_private *dev_priv = m->private;
|
||||
u16 *latencies;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
latencies = dev_priv->wm.skl_latency;
|
||||
else
|
||||
latencies = dev_priv->wm.pri_latency;
|
||||
@ -1774,7 +1774,7 @@ static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf,
|
||||
struct drm_i915_private *dev_priv = m->private;
|
||||
u16 *latencies;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
latencies = dev_priv->wm.skl_latency;
|
||||
else
|
||||
latencies = dev_priv->wm.spr_latency;
|
||||
@ -1789,7 +1789,7 @@ static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf,
|
||||
struct drm_i915_private *dev_priv = m->private;
|
||||
u16 *latencies;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
latencies = dev_priv->wm.skl_latency;
|
||||
else
|
||||
latencies = dev_priv->wm.cur_latency;
|
||||
@ -1986,7 +1986,7 @@ static int i915_drrs_ctl_set(void *data, u64 val)
|
||||
struct drm_device *dev = &dev_priv->drm;
|
||||
struct intel_crtc *crtc;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 7)
|
||||
if (DISPLAY_VER(dev_priv) < 7)
|
||||
return -ENODEV;
|
||||
|
||||
for_each_intel_crtc(dev, crtc) {
|
||||
@ -2244,7 +2244,7 @@ static int i915_lpsp_capability_show(struct seq_file *m, void *data)
|
||||
if (connector->status != connector_status_connected)
|
||||
return -ENODEV;
|
||||
|
||||
switch (INTEL_GEN(i915)) {
|
||||
switch (DISPLAY_VER(i915)) {
|
||||
case 12:
|
||||
/*
|
||||
* Actually TGL can drive LPSP on port till DDI_C
|
||||
@ -2416,15 +2416,12 @@ int intel_connector_debugfs_add(struct drm_connector *connector)
|
||||
connector, &i915_hdcp_sink_capability_fops);
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 &&
|
||||
((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort &&
|
||||
!to_intel_connector(connector)->mst_port) ||
|
||||
connector->connector_type == DRM_MODE_CONNECTOR_eDP))
|
||||
if ((DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)) && ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && !to_intel_connector(connector)->mst_port) || connector->connector_type == DRM_MODE_CONNECTOR_eDP))
|
||||
debugfs_create_file("i915_dsc_fec_support", S_IRUGO, root,
|
||||
connector, &i915_dsc_fec_support_fops);
|
||||
|
||||
/* Legacy panels doesn't lpsp on any platform */
|
||||
if ((INTEL_GEN(dev_priv) >= 9 || IS_HASWELL(dev_priv) ||
|
||||
if ((DISPLAY_VER(dev_priv) >= 9 || IS_HASWELL(dev_priv) ||
|
||||
IS_BROADWELL(dev_priv)) &&
|
||||
(connector->connector_type == DRM_MODE_CONNECTOR_DSI ||
|
||||
connector->connector_type == DRM_MODE_CONNECTOR_eDP ||
|
||||
|
@ -408,7 +408,7 @@ static void hsw_power_well_enable(struct drm_i915_private *dev_priv,
|
||||
if (power_well->desc->hsw.has_fuses) {
|
||||
enum skl_power_gate pg;
|
||||
|
||||
pg = INTEL_GEN(dev_priv) >= 11 ? ICL_PW_CTL_IDX_TO_PG(pw_idx) :
|
||||
pg = DISPLAY_VER(dev_priv) >= 11 ? ICL_PW_CTL_IDX_TO_PG(pw_idx) :
|
||||
SKL_PW_CTL_IDX_TO_PG(pw_idx);
|
||||
/*
|
||||
* For PW1 we have to wait both for the PW0/PG0 fuse state
|
||||
@ -441,7 +441,7 @@ static void hsw_power_well_enable(struct drm_i915_private *dev_priv,
|
||||
if (power_well->desc->hsw.has_fuses) {
|
||||
enum skl_power_gate pg;
|
||||
|
||||
pg = INTEL_GEN(dev_priv) >= 11 ? ICL_PW_CTL_IDX_TO_PG(pw_idx) :
|
||||
pg = DISPLAY_VER(dev_priv) >= 11 ? ICL_PW_CTL_IDX_TO_PG(pw_idx) :
|
||||
SKL_PW_CTL_IDX_TO_PG(pw_idx);
|
||||
gen9_wait_for_power_well_fuses(dev_priv, pg);
|
||||
}
|
||||
@ -484,7 +484,7 @@ icl_combo_phy_aux_power_well_enable(struct drm_i915_private *dev_priv,
|
||||
intel_de_write(dev_priv, regs->driver,
|
||||
val | HSW_PWR_WELL_CTL_REQ(pw_idx));
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12) {
|
||||
if (DISPLAY_VER(dev_priv) < 12) {
|
||||
val = intel_de_read(dev_priv, ICL_PORT_CL_DW12(phy));
|
||||
intel_de_write(dev_priv, ICL_PORT_CL_DW12(phy),
|
||||
val | ICL_LANE_ENABLE_AUX);
|
||||
@ -550,7 +550,7 @@ static void icl_tc_port_assert_ref_held(struct drm_i915_private *dev_priv,
|
||||
if (drm_WARN_ON(&dev_priv->drm, !dig_port))
|
||||
return;
|
||||
|
||||
if (INTEL_GEN(dev_priv) == 11 && dig_port->tc_legacy_port)
|
||||
if (IS_DISPLAY_VER(dev_priv, 11) && dig_port->tc_legacy_port)
|
||||
return;
|
||||
|
||||
drm_WARN_ON(&dev_priv->drm, !intel_tc_port_ref_held(dig_port));
|
||||
@ -619,14 +619,14 @@ icl_tc_phy_aux_power_well_enable(struct drm_i915_private *dev_priv,
|
||||
* exit sequence.
|
||||
*/
|
||||
timeout_expected = is_tbt;
|
||||
if (INTEL_GEN(dev_priv) == 11 && dig_port->tc_legacy_port) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 11) && dig_port->tc_legacy_port) {
|
||||
icl_tc_cold_exit(dev_priv);
|
||||
timeout_expected = true;
|
||||
}
|
||||
|
||||
hsw_wait_for_power_well_enable(dev_priv, power_well, timeout_expected);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12 && !is_tbt) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12 && !is_tbt) {
|
||||
enum tc_port tc_port;
|
||||
|
||||
tc_port = TGL_AUX_PW_TO_TC_PORT(power_well->desc->hsw.idx);
|
||||
@ -709,7 +709,7 @@ static bool hsw_power_well_enabled(struct drm_i915_private *dev_priv,
|
||||
* BIOS's own request bits, which are forced-on for these power wells
|
||||
* when exiting DC5/6.
|
||||
*/
|
||||
if (IS_GEN(dev_priv, 9) && !IS_GEN9_LP(dev_priv) &&
|
||||
if (IS_DISPLAY_VER(dev_priv, 9) && !IS_GEN9_LP(dev_priv) &&
|
||||
(id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO))
|
||||
val |= intel_de_read(dev_priv, regs->bios);
|
||||
|
||||
@ -804,10 +804,10 @@ static u32 gen9_dc_mask(struct drm_i915_private *dev_priv)
|
||||
|
||||
mask = DC_STATE_EN_UPTO_DC5;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
mask |= DC_STATE_EN_DC3CO | DC_STATE_EN_UPTO_DC6
|
||||
| DC_STATE_EN_DC9;
|
||||
else if (IS_GEN(dev_priv, 11))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
mask |= DC_STATE_EN_UPTO_DC6 | DC_STATE_EN_DC9;
|
||||
else if (IS_GEN9_LP(dev_priv))
|
||||
mask |= DC_STATE_EN_DC9;
|
||||
@ -1035,7 +1035,7 @@ static void assert_can_enable_dc5(struct drm_i915_private *dev_priv)
|
||||
enum i915_power_well_id high_pg;
|
||||
|
||||
/* Power wells at this level and above must be disabled for DC5 entry */
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
high_pg = ICL_DISP_PW_3;
|
||||
else
|
||||
high_pg = SKL_DISP_PW_2;
|
||||
@ -1192,7 +1192,7 @@ static void gen9_disable_dc_states(struct drm_i915_private *dev_priv)
|
||||
if (IS_GEN9_LP(dev_priv))
|
||||
bxt_verify_ddi_phy_power_wells(dev_priv);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
/*
|
||||
* DMC retains HW context only for port A, the other combo
|
||||
* PHY's HW context for port B is lost after DC transitions,
|
||||
@ -4535,9 +4535,9 @@ static u32 get_allowed_dc_mask(const struct drm_i915_private *dev_priv,
|
||||
|
||||
if (IS_DG1(dev_priv))
|
||||
max_dc = 3;
|
||||
else if (INTEL_GEN(dev_priv) >= 12)
|
||||
else if (DISPLAY_VER(dev_priv) >= 12)
|
||||
max_dc = 4;
|
||||
else if (INTEL_GEN(dev_priv) >= 10 || IS_GEN9_BC(dev_priv))
|
||||
else if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv) || IS_GEN9_BC(dev_priv))
|
||||
max_dc = 2;
|
||||
else if (IS_GEN9_LP(dev_priv))
|
||||
max_dc = 1;
|
||||
@ -4549,7 +4549,7 @@ static u32 get_allowed_dc_mask(const struct drm_i915_private *dev_priv,
|
||||
* not depending on the DMC firmware. It's needed by system
|
||||
* suspend/resume, so allow it unconditionally.
|
||||
*/
|
||||
mask = IS_GEN9_LP(dev_priv) || INTEL_GEN(dev_priv) >= 11 ?
|
||||
mask = IS_GEN9_LP(dev_priv) || DISPLAY_VER(dev_priv) >= 11 ?
|
||||
DC_STATE_EN_DC9 : 0;
|
||||
|
||||
if (!dev_priv->params.disable_power_well)
|
||||
@ -4678,9 +4678,9 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
|
||||
BIT_ULL(TGL_DISP_PW_TC_COLD_OFF));
|
||||
} else if (IS_ROCKETLAKE(dev_priv)) {
|
||||
err = set_power_wells(power_domains, rkl_power_wells);
|
||||
} else if (IS_GEN(dev_priv, 12)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 12)) {
|
||||
err = set_power_wells(power_domains, tgl_power_wells);
|
||||
} else if (IS_GEN(dev_priv, 11)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 11)) {
|
||||
err = set_power_wells(power_domains, icl_power_wells);
|
||||
} else if (IS_CNL_WITH_PORT_F(dev_priv)) {
|
||||
err = set_power_wells(power_domains, cnl_power_wells);
|
||||
@ -4837,7 +4837,7 @@ static void icl_mbus_init(struct drm_i915_private *dev_priv)
|
||||
* expect us to program the abox_ctl0 register as well, even though
|
||||
* we don't have to program other instance-0 registers like BW_BUDDY.
|
||||
*/
|
||||
if (IS_GEN(dev_priv, 12))
|
||||
if (IS_DISPLAY_VER(dev_priv, 12))
|
||||
abox_regs |= BIT(0);
|
||||
|
||||
for_each_set_bit(i, &abox_regs, sizeof(abox_regs))
|
||||
@ -5333,7 +5333,7 @@ static void tgl_bw_buddy_init(struct drm_i915_private *dev_priv)
|
||||
|
||||
if (IS_ALDERLAKE_S(dev_priv) ||
|
||||
IS_DG1_REVID(dev_priv, DG1_REVID_A0, DG1_REVID_A0) ||
|
||||
IS_TGL_DISP_STEPPING(dev_priv, STEP_A0, STEP_B0))
|
||||
IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
|
||||
/* Wa_1409767108:tgl,dg1,adl-s */
|
||||
table = wa_1409767108_buddy_page_masks;
|
||||
else
|
||||
@ -5396,7 +5396,7 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,
|
||||
/* 4. Enable CDCLK. */
|
||||
intel_cdclk_init_hw(dev_priv);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
gen12_dbuf_slices_config(dev_priv);
|
||||
|
||||
/* 5. Enable DBUF. */
|
||||
@ -5406,14 +5406,14 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,
|
||||
icl_mbus_init(dev_priv);
|
||||
|
||||
/* 7. Program arbiter BW_BUDDY registers */
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
tgl_bw_buddy_init(dev_priv);
|
||||
|
||||
if (resume && dev_priv->csr.dmc_payload)
|
||||
intel_csr_load_program(dev_priv);
|
||||
|
||||
/* Wa_14011508470 */
|
||||
if (IS_GEN(dev_priv, 12)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 12)) {
|
||||
val = DCPR_CLEAR_MEMSTAT_DIS | DCPR_SEND_RESP_IMM |
|
||||
DCPR_MASK_LPMODE | DCPR_MASK_MAXLATENCY_MEMUP_CLR;
|
||||
intel_uncore_rmw(&dev_priv->uncore, GEN11_CHICKEN_DCPR_2, 0, val);
|
||||
@ -5619,7 +5619,7 @@ void intel_power_domains_init_hw(struct drm_i915_private *i915, bool resume)
|
||||
|
||||
power_domains->initializing = true;
|
||||
|
||||
if (INTEL_GEN(i915) >= 11) {
|
||||
if (DISPLAY_VER(i915) >= 11) {
|
||||
icl_display_core_init(i915, resume);
|
||||
} else if (IS_CANNONLAKE(i915)) {
|
||||
cnl_display_core_init(i915, resume);
|
||||
@ -5780,7 +5780,7 @@ void intel_power_domains_suspend(struct drm_i915_private *i915,
|
||||
intel_display_power_flush_work(i915);
|
||||
intel_power_domains_verify_state(i915);
|
||||
|
||||
if (INTEL_GEN(i915) >= 11)
|
||||
if (DISPLAY_VER(i915) >= 11)
|
||||
icl_display_core_uninit(i915);
|
||||
else if (IS_CANNONLAKE(i915))
|
||||
cnl_display_core_uninit(i915);
|
||||
@ -5908,7 +5908,7 @@ static void intel_power_domains_verify_state(struct drm_i915_private *i915)
|
||||
|
||||
void intel_display_power_suspend_late(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 11 || IS_GEN9_LP(i915)) {
|
||||
if (DISPLAY_VER(i915) >= 11 || IS_GEN9_LP(i915)) {
|
||||
bxt_enable_dc9(i915);
|
||||
/* Tweaked Wa_14010685332:icp,jsp,mcc */
|
||||
if (INTEL_PCH_TYPE(i915) >= PCH_ICP && INTEL_PCH_TYPE(i915) <= PCH_MCC)
|
||||
@ -5921,7 +5921,7 @@ void intel_display_power_suspend_late(struct drm_i915_private *i915)
|
||||
|
||||
void intel_display_power_resume_early(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 11 || IS_GEN9_LP(i915)) {
|
||||
if (DISPLAY_VER(i915) >= 11 || IS_GEN9_LP(i915)) {
|
||||
gen9_sanitize_dc_state(i915);
|
||||
bxt_disable_dc9(i915);
|
||||
/* Tweaked Wa_14010685332:icp,jsp,mcc */
|
||||
@ -5935,7 +5935,7 @@ void intel_display_power_resume_early(struct drm_i915_private *i915)
|
||||
|
||||
void intel_display_power_suspend(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 11) {
|
||||
if (DISPLAY_VER(i915) >= 11) {
|
||||
icl_display_core_uninit(i915);
|
||||
bxt_enable_dc9(i915);
|
||||
} else if (IS_GEN9_LP(i915)) {
|
||||
@ -5948,7 +5948,7 @@ void intel_display_power_suspend(struct drm_i915_private *i915)
|
||||
|
||||
void intel_display_power_resume(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 11) {
|
||||
if (DISPLAY_VER(i915) >= 11) {
|
||||
bxt_disable_dc9(i915);
|
||||
icl_display_core_init(i915, true);
|
||||
if (i915->csr.dmc_payload) {
|
||||
|
@ -85,20 +85,50 @@ enum intel_broadcast_rgb {
|
||||
INTEL_BROADCAST_RGB_LIMITED,
|
||||
};
|
||||
|
||||
struct intel_fb_view {
|
||||
/*
|
||||
* The remap information used in the remapped and rotated views to
|
||||
* create the DMA scatter-gather list for each FB color plane. This sg
|
||||
* list is created along with the view type (gtt.type) specific
|
||||
* i915_vma object and contains the list of FB object pages (reordered
|
||||
* in the rotated view) that are visible in the view.
|
||||
* In the normal view the FB object's backing store sg list is used
|
||||
* directly and hence the remap information here is not used.
|
||||
*/
|
||||
struct i915_ggtt_view gtt;
|
||||
|
||||
/*
|
||||
* The GTT view (gtt.type) specific information for each FB color
|
||||
* plane. In the normal GTT view all formats (up to 4 color planes),
|
||||
* in the rotated and remapped GTT view all no-CCS formats (up to 2
|
||||
* color planes) are supported.
|
||||
*
|
||||
* TODO: add support for CCS formats in the remapped GTT view.
|
||||
*
|
||||
* The view information shared by all FB color planes in the FB,
|
||||
* like dst x/y and src/dst width, is stored separately in
|
||||
* intel_plane_state.
|
||||
*/
|
||||
struct i915_color_plane_view {
|
||||
u32 offset;
|
||||
unsigned int x, y;
|
||||
/*
|
||||
* Plane stride in:
|
||||
* bytes for 0/180 degree rotation
|
||||
* pixels for 90/270 degree rotation
|
||||
*/
|
||||
unsigned int stride;
|
||||
} color_plane[4];
|
||||
};
|
||||
|
||||
struct intel_framebuffer {
|
||||
struct drm_framebuffer base;
|
||||
struct intel_frontbuffer *frontbuffer;
|
||||
struct intel_rotation_info rot_info;
|
||||
|
||||
/* for each plane in the normal GTT view */
|
||||
struct {
|
||||
unsigned int x, y;
|
||||
} normal[4];
|
||||
/* for each plane in the rotated GTT view for no-CCS formats */
|
||||
struct {
|
||||
unsigned int x, y;
|
||||
unsigned int pitch; /* pixels */
|
||||
} rotated[2];
|
||||
/* Params to remap the FB pages and program the plane registers in each view. */
|
||||
struct intel_fb_view normal_view;
|
||||
struct intel_fb_view rotated_view;
|
||||
struct intel_fb_view remapped_view;
|
||||
};
|
||||
|
||||
struct intel_fbdev {
|
||||
@ -234,6 +264,9 @@ struct intel_encoder {
|
||||
enum intel_display_power_domain power_domain;
|
||||
/* for communication with audio component; protected by av_mutex */
|
||||
const struct drm_connector *audio_connector;
|
||||
|
||||
/* VBT information for this encoder (may be NULL for older platforms) */
|
||||
const struct intel_bios_encoder_data *devdata;
|
||||
};
|
||||
|
||||
struct intel_panel_bl_funcs {
|
||||
@ -384,6 +417,10 @@ struct intel_hdcp_shim {
|
||||
int (*hdcp_2_2_capable)(struct intel_digital_port *dig_port,
|
||||
bool *capable);
|
||||
|
||||
/* Detects whether a HDCP 1.4 sink connected in MST topology */
|
||||
int (*streams_type1_capable)(struct intel_connector *connector,
|
||||
bool *capable);
|
||||
|
||||
/* Write HDCP2.2 messages */
|
||||
int (*write_2_2_msg)(struct intel_digital_port *dig_port,
|
||||
void *buf, size_t size);
|
||||
@ -574,21 +611,11 @@ struct intel_plane_state {
|
||||
enum drm_scaling_filter scaling_filter;
|
||||
} hw;
|
||||
|
||||
struct i915_ggtt_view view;
|
||||
struct i915_vma *vma;
|
||||
unsigned long flags;
|
||||
#define PLANE_HAS_FENCE BIT(0)
|
||||
|
||||
struct {
|
||||
u32 offset;
|
||||
/*
|
||||
* Plane stride in:
|
||||
* bytes for 0/180 degree rotation
|
||||
* pixels for 90/270 degree rotation
|
||||
*/
|
||||
u32 stride;
|
||||
int x, y;
|
||||
} color_plane[4];
|
||||
struct intel_fb_view view;
|
||||
|
||||
/* plane control register */
|
||||
u32 ctl;
|
||||
@ -1767,6 +1794,18 @@ intel_attached_dig_port(struct intel_connector *connector)
|
||||
return enc_to_dig_port(intel_attached_encoder(connector));
|
||||
}
|
||||
|
||||
static inline struct intel_hdmi *
|
||||
enc_to_intel_hdmi(struct intel_encoder *encoder)
|
||||
{
|
||||
return &enc_to_dig_port(encoder)->hdmi;
|
||||
}
|
||||
|
||||
static inline struct intel_hdmi *
|
||||
intel_attached_hdmi(struct intel_connector *connector)
|
||||
{
|
||||
return enc_to_intel_hdmi(intel_attached_encoder(connector));
|
||||
}
|
||||
|
||||
static inline struct intel_dp *enc_to_intel_dp(struct intel_encoder *encoder)
|
||||
{
|
||||
return &enc_to_dig_port(encoder)->dp;
|
||||
@ -1976,14 +2015,6 @@ static inline bool is_ccs_modifier(u64 modifier)
|
||||
modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
|
||||
}
|
||||
|
||||
static inline bool is_ccs_plane(const struct drm_framebuffer *fb, int plane)
|
||||
{
|
||||
if (!is_ccs_modifier(fb->modifier))
|
||||
return false;
|
||||
|
||||
return plane >= fb->format->num_planes / 2;
|
||||
}
|
||||
|
||||
static inline bool is_gen12_ccs_modifier(u64 modifier)
|
||||
{
|
||||
return modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ||
|
||||
@ -1991,15 +2022,4 @@ static inline bool is_gen12_ccs_modifier(u64 modifier)
|
||||
modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS;
|
||||
}
|
||||
|
||||
static inline bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane)
|
||||
{
|
||||
return is_gen12_ccs_modifier(fb->modifier) && is_ccs_plane(fb, plane);
|
||||
}
|
||||
|
||||
static inline bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane)
|
||||
{
|
||||
return fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC &&
|
||||
plane == 2;
|
||||
}
|
||||
|
||||
#endif /* __INTEL_DISPLAY_TYPES_H__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -37,11 +37,6 @@ void intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
|
||||
bool intel_dp_limited_color_range(const struct intel_crtc_state *crtc_state,
|
||||
const struct drm_connector_state *conn_state);
|
||||
int intel_dp_min_bpp(enum intel_output_format output_format);
|
||||
bool intel_dp_port_enabled(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t dp_reg, enum port port,
|
||||
enum pipe *pipe);
|
||||
bool intel_dp_init(struct drm_i915_private *dev_priv, i915_reg_t output_reg,
|
||||
enum port port);
|
||||
bool intel_dp_init_connector(struct intel_digital_port *dig_port,
|
||||
struct intel_connector *intel_connector);
|
||||
void intel_dp_set_link_params(struct intel_dp *intel_dp,
|
||||
@ -56,7 +51,6 @@ void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp,
|
||||
void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
bool enable);
|
||||
void intel_dp_encoder_reset(struct drm_encoder *encoder);
|
||||
void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
|
||||
void intel_dp_encoder_shutdown(struct intel_encoder *intel_encoder);
|
||||
void intel_dp_encoder_flush_work(struct drm_encoder *encoder);
|
||||
@ -87,10 +81,6 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
|
||||
void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
|
||||
unsigned int frontbuffer_bits);
|
||||
|
||||
void
|
||||
intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
u8 dp_train_pat);
|
||||
void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
|
||||
u8 *link_bw, u8 *rate_select);
|
||||
bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
|
||||
@ -136,7 +126,6 @@ bool intel_dp_initial_fastset_check(struct intel_encoder *encoder,
|
||||
struct intel_crtc_state *crtc_state);
|
||||
void intel_dp_sync_state(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *crtc_state);
|
||||
const struct dpll *vlv_get_dpll(struct drm_i915_private *i915);
|
||||
|
||||
void intel_dp_check_frl_training(struct intel_dp *intel_dp);
|
||||
void intel_dp_pcon_dsc_configure(struct intel_dp *intel_dp,
|
||||
|
@ -128,11 +128,12 @@ static u32 g4x_get_aux_send_ctl(struct intel_dp *intel_dp,
|
||||
to_i915(dig_port->base.base.dev);
|
||||
u32 precharge, timeout;
|
||||
|
||||
if (IS_GEN(dev_priv, 6))
|
||||
if (IS_SANDYBRIDGE(dev_priv))
|
||||
precharge = 3;
|
||||
else
|
||||
precharge = 5;
|
||||
|
||||
/* Max timeout value on G4x-BDW: 1.6ms */
|
||||
if (IS_BROADWELL(dev_priv))
|
||||
timeout = DP_AUX_CH_CTL_TIME_OUT_600us;
|
||||
else
|
||||
@ -159,6 +160,12 @@ static u32 skl_get_aux_send_ctl(struct intel_dp *intel_dp,
|
||||
enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
|
||||
u32 ret;
|
||||
|
||||
/*
|
||||
* Max timeout values:
|
||||
* SKL-GLK: 1.6ms
|
||||
* CNL: 3.2ms
|
||||
* ICL+: 4ms
|
||||
*/
|
||||
ret = DP_AUX_CH_CTL_SEND_BUSY |
|
||||
DP_AUX_CH_CTL_DONE |
|
||||
DP_AUX_CH_CTL_INTERRUPT |
|
||||
@ -647,10 +654,10 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
|
||||
struct intel_encoder *encoder = &dig_port->base;
|
||||
enum aux_ch aux_ch = dig_port->aux_ch;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
intel_dp->aux_ch_ctl_reg = tgl_aux_ctl_reg;
|
||||
intel_dp->aux_ch_data_reg = tgl_aux_data_reg;
|
||||
} else if (INTEL_GEN(dev_priv) >= 9) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 9) {
|
||||
intel_dp->aux_ch_ctl_reg = skl_aux_ctl_reg;
|
||||
intel_dp->aux_ch_data_reg = skl_aux_data_reg;
|
||||
} else if (HAS_PCH_SPLIT(dev_priv)) {
|
||||
@ -661,7 +668,7 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
|
||||
intel_dp->aux_ch_data_reg = g4x_aux_data_reg;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider;
|
||||
else if (IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))
|
||||
intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider;
|
||||
@ -670,7 +677,7 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
|
||||
else
|
||||
intel_dp->get_aux_clock_divider = g4x_get_aux_clock_divider;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl;
|
||||
else
|
||||
intel_dp->get_aux_send_ctl = g4x_get_aux_send_ctl;
|
||||
@ -678,7 +685,7 @@ void intel_dp_aux_init(struct intel_dp *intel_dp)
|
||||
drm_dp_aux_init(&intel_dp->aux);
|
||||
|
||||
/* Failure to allocate our preferred name is not critical */
|
||||
if (INTEL_GEN(dev_priv) >= 12 && aux_ch >= AUX_CH_USBC1)
|
||||
if (DISPLAY_VER(dev_priv) >= 12 && aux_ch >= AUX_CH_USBC1)
|
||||
intel_dp->aux.name = kasprintf(GFP_KERNEL, "AUX USBC%c/%s",
|
||||
aux_ch - AUX_CH_USBC1 + '1',
|
||||
encoder->base.name);
|
||||
|
@ -294,37 +294,39 @@ struct hdcp2_dp_msg_data {
|
||||
bool msg_detectable;
|
||||
u32 timeout;
|
||||
u32 timeout2; /* Added for non_paired situation */
|
||||
/* Timeout to read entire msg */
|
||||
u32 msg_read_timeout;
|
||||
};
|
||||
|
||||
static const struct hdcp2_dp_msg_data hdcp2_dp_msg_data[] = {
|
||||
{ HDCP_2_2_AKE_INIT, DP_HDCP_2_2_AKE_INIT_OFFSET, false, 0, 0 },
|
||||
{ HDCP_2_2_AKE_INIT, DP_HDCP_2_2_AKE_INIT_OFFSET, false, 0, 0, 0},
|
||||
{ HDCP_2_2_AKE_SEND_CERT, DP_HDCP_2_2_AKE_SEND_CERT_OFFSET,
|
||||
false, HDCP_2_2_CERT_TIMEOUT_MS, 0 },
|
||||
false, HDCP_2_2_CERT_TIMEOUT_MS, 0, HDCP_2_2_DP_CERT_READ_TIMEOUT_MS},
|
||||
{ HDCP_2_2_AKE_NO_STORED_KM, DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET,
|
||||
false, 0, 0 },
|
||||
false, 0, 0, 0 },
|
||||
{ HDCP_2_2_AKE_STORED_KM, DP_HDCP_2_2_AKE_STORED_KM_OFFSET,
|
||||
false, 0, 0 },
|
||||
false, 0, 0, 0 },
|
||||
{ HDCP_2_2_AKE_SEND_HPRIME, DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET,
|
||||
true, HDCP_2_2_HPRIME_PAIRED_TIMEOUT_MS,
|
||||
HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT_MS },
|
||||
HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT_MS, HDCP_2_2_DP_HPRIME_READ_TIMEOUT_MS},
|
||||
{ HDCP_2_2_AKE_SEND_PAIRING_INFO,
|
||||
DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET, true,
|
||||
HDCP_2_2_PAIRING_TIMEOUT_MS, 0 },
|
||||
{ HDCP_2_2_LC_INIT, DP_HDCP_2_2_LC_INIT_OFFSET, false, 0, 0 },
|
||||
HDCP_2_2_PAIRING_TIMEOUT_MS, 0, HDCP_2_2_DP_PAIRING_READ_TIMEOUT_MS },
|
||||
{ HDCP_2_2_LC_INIT, DP_HDCP_2_2_LC_INIT_OFFSET, false, 0, 0, 0 },
|
||||
{ HDCP_2_2_LC_SEND_LPRIME, DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET,
|
||||
false, HDCP_2_2_DP_LPRIME_TIMEOUT_MS, 0 },
|
||||
false, HDCP_2_2_DP_LPRIME_TIMEOUT_MS, 0, 0 },
|
||||
{ HDCP_2_2_SKE_SEND_EKS, DP_HDCP_2_2_SKE_SEND_EKS_OFFSET, false,
|
||||
0, 0 },
|
||||
0, 0, 0 },
|
||||
{ HDCP_2_2_REP_SEND_RECVID_LIST,
|
||||
DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET, true,
|
||||
HDCP_2_2_RECVID_LIST_TIMEOUT_MS, 0 },
|
||||
HDCP_2_2_RECVID_LIST_TIMEOUT_MS, 0, 0 },
|
||||
{ HDCP_2_2_REP_SEND_ACK, DP_HDCP_2_2_REP_SEND_ACK_OFFSET, false,
|
||||
0, 0 },
|
||||
0, 0, 0 },
|
||||
{ HDCP_2_2_REP_STREAM_MANAGE,
|
||||
DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET, false,
|
||||
0, 0 },
|
||||
0, 0, 0},
|
||||
{ HDCP_2_2_REP_STREAM_READY, DP_HDCP_2_2_REP_STREAM_READY_OFFSET,
|
||||
false, HDCP_2_2_STREAM_READY_TIMEOUT_MS, 0 },
|
||||
false, HDCP_2_2_STREAM_READY_TIMEOUT_MS, 0, 0 },
|
||||
/* local define to shovel this through the write_2_2 interface */
|
||||
#define HDCP_2_2_ERRATA_DP_STREAM_TYPE 50
|
||||
{ HDCP_2_2_ERRATA_DP_STREAM_TYPE,
|
||||
@ -478,6 +480,23 @@ int intel_dp_hdcp2_write_msg(struct intel_digital_port *dig_port,
|
||||
return size;
|
||||
}
|
||||
|
||||
static int
|
||||
get_rxinfo_hdcp_1_dev_downstream(struct intel_digital_port *dig_port, bool *hdcp_1_x)
|
||||
{
|
||||
u8 rx_info[HDCP_2_2_RXINFO_LEN];
|
||||
int ret;
|
||||
|
||||
ret = drm_dp_dpcd_read(&dig_port->dp.aux,
|
||||
DP_HDCP_2_2_REG_RXINFO_OFFSET,
|
||||
(void *)rx_info, HDCP_2_2_RXINFO_LEN);
|
||||
|
||||
if (ret != HDCP_2_2_RXINFO_LEN)
|
||||
return ret >= 0 ? -EIO : ret;
|
||||
|
||||
*hdcp_1_x = HDCP_2_2_HDCP1_DEVICE_CONNECTED(rx_info[1]) ? true : false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
ssize_t get_receiver_id_list_size(struct intel_digital_port *dig_port)
|
||||
{
|
||||
@ -513,6 +532,8 @@ int intel_dp_hdcp2_read_msg(struct intel_digital_port *dig_port,
|
||||
u8 *byte = buf;
|
||||
ssize_t ret, bytes_to_recv, len;
|
||||
const struct hdcp2_dp_msg_data *hdcp2_msg_data;
|
||||
ktime_t msg_end;
|
||||
bool msg_expired;
|
||||
|
||||
hdcp2_msg_data = get_hdcp2_dp_msg_data(msg_id);
|
||||
if (!hdcp2_msg_data)
|
||||
@ -539,6 +560,11 @@ int intel_dp_hdcp2_read_msg(struct intel_digital_port *dig_port,
|
||||
len = bytes_to_recv > DP_AUX_MAX_PAYLOAD_BYTES ?
|
||||
DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_recv;
|
||||
|
||||
/* Entire msg read timeout since initiate of msg read */
|
||||
if (bytes_to_recv == size - 1 && hdcp2_msg_data->msg_read_timeout > 0)
|
||||
msg_end = ktime_add_ms(ktime_get_raw(),
|
||||
hdcp2_msg_data->msg_read_timeout);
|
||||
|
||||
ret = drm_dp_dpcd_read(&dig_port->dp.aux, offset,
|
||||
(void *)byte, len);
|
||||
if (ret < 0) {
|
||||
@ -551,6 +577,16 @@ int intel_dp_hdcp2_read_msg(struct intel_digital_port *dig_port,
|
||||
byte += ret;
|
||||
offset += ret;
|
||||
}
|
||||
|
||||
if (hdcp2_msg_data->msg_read_timeout > 0) {
|
||||
msg_expired = ktime_after(ktime_get_raw(), msg_end);
|
||||
if (msg_expired) {
|
||||
drm_dbg_kms(&i915->drm, "msg_id %d, entire msg read timeout(mSec): %d\n",
|
||||
msg_id, hdcp2_msg_data->msg_read_timeout);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
}
|
||||
|
||||
byte = buf;
|
||||
*byte = msg_id;
|
||||
|
||||
@ -626,6 +662,27 @@ int intel_dp_hdcp2_capable(struct intel_digital_port *dig_port,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int intel_dp_mst_streams_type1_capable(struct intel_connector *connector,
|
||||
bool *capable)
|
||||
{
|
||||
struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
|
||||
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
|
||||
int ret;
|
||||
bool hdcp_1_x;
|
||||
|
||||
ret = get_rxinfo_hdcp_1_dev_downstream(dig_port, &hdcp_1_x);
|
||||
if (ret) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"[%s:%d] failed to read RxInfo ret=%d\n",
|
||||
connector->base.name, connector->base.base.id, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*capable = !hdcp_1_x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
|
||||
.write_an_aksv = intel_dp_hdcp_write_an_aksv,
|
||||
.read_bksv = intel_dp_hdcp_read_bksv,
|
||||
@ -774,6 +831,7 @@ static const struct intel_hdcp_shim intel_dp_mst_hdcp_shim = {
|
||||
.stream_2_2_encryption = intel_dp_mst_hdcp2_stream_encryption,
|
||||
.check_2_2_link = intel_dp_mst_hdcp2_check_link,
|
||||
.hdcp_2_2_capable = intel_dp_hdcp2_capable,
|
||||
.streams_type1_capable = intel_dp_mst_streams_type1_capable,
|
||||
.protocol = HDCP_PROTOCOL_DP,
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,11 @@ intel_dp_dump_link_status(struct drm_device *drm,
|
||||
link_status[3], link_status[4], link_status[5]);
|
||||
}
|
||||
|
||||
static void intel_dp_reset_lttpr_common_caps(struct intel_dp *intel_dp)
|
||||
{
|
||||
memset(&intel_dp->lttpr_common_caps, 0, sizeof(intel_dp->lttpr_common_caps));
|
||||
}
|
||||
|
||||
static void intel_dp_reset_lttpr_count(struct intel_dp *intel_dp)
|
||||
{
|
||||
intel_dp->lttpr_common_caps[DP_PHY_REPEATER_CNT -
|
||||
@ -82,19 +87,36 @@ static void intel_dp_read_lttpr_phy_caps(struct intel_dp *intel_dp,
|
||||
|
||||
static bool intel_dp_read_lttpr_common_caps(struct intel_dp *intel_dp)
|
||||
{
|
||||
if (drm_dp_read_lttpr_common_caps(&intel_dp->aux,
|
||||
intel_dp->lttpr_common_caps) < 0) {
|
||||
memset(intel_dp->lttpr_common_caps, 0,
|
||||
sizeof(intel_dp->lttpr_common_caps));
|
||||
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
|
||||
|
||||
if (intel_dp_is_edp(intel_dp))
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detecting LTTPRs must be avoided on platforms with an AUX timeout
|
||||
* period < 3.2ms. (see DP Standard v2.0, 2.11.2, 3.6.6.1).
|
||||
*/
|
||||
if (DISPLAY_VER(i915) < 10)
|
||||
return false;
|
||||
|
||||
if (drm_dp_read_lttpr_common_caps(&intel_dp->aux,
|
||||
intel_dp->lttpr_common_caps) < 0)
|
||||
goto reset_caps;
|
||||
|
||||
drm_dbg_kms(&dp_to_i915(intel_dp)->drm,
|
||||
"LTTPR common capabilities: %*ph\n",
|
||||
(int)sizeof(intel_dp->lttpr_common_caps),
|
||||
intel_dp->lttpr_common_caps);
|
||||
|
||||
/* The minimum value of LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV is 1.4 */
|
||||
if (intel_dp->lttpr_common_caps[0] < 0x14)
|
||||
goto reset_caps;
|
||||
|
||||
return true;
|
||||
|
||||
reset_caps:
|
||||
intel_dp_reset_lttpr_common_caps(intel_dp);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -107,33 +129,49 @@ intel_dp_set_lttpr_transparent_mode(struct intel_dp *intel_dp, bool enable)
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_dp_lttpr_init - detect LTTPRs and init the LTTPR link training mode
|
||||
* intel_dp_init_lttpr_and_dprx_caps - detect LTTPR and DPRX caps, init the LTTPR link training mode
|
||||
* @intel_dp: Intel DP struct
|
||||
*
|
||||
* Read the LTTPR common capabilities, switch to non-transparent link training
|
||||
* mode if any is detected and read the PHY capabilities for all detected
|
||||
* LTTPRs. In case of an LTTPR detection error or if the number of
|
||||
* Read the LTTPR common and DPRX capabilities and switch to non-transparent
|
||||
* link training mode if any is detected and read the PHY capabilities for all
|
||||
* detected LTTPRs. In case of an LTTPR detection error or if the number of
|
||||
* LTTPRs is more than is supported (8), fall back to the no-LTTPR,
|
||||
* transparent mode link training mode.
|
||||
*
|
||||
* Returns:
|
||||
* >0 if LTTPRs were detected and the non-transparent LT mode was set
|
||||
* >0 if LTTPRs were detected and the non-transparent LT mode was set. The
|
||||
* DPRX capabilities are read out.
|
||||
* 0 if no LTTPRs or more than 8 LTTPRs were detected or in case of a
|
||||
* detection failure and the transparent LT mode was set
|
||||
* detection failure and the transparent LT mode was set. The DPRX
|
||||
* capabilities are read out.
|
||||
* <0 Reading out the DPRX capabilities failed.
|
||||
*/
|
||||
int intel_dp_lttpr_init(struct intel_dp *intel_dp)
|
||||
int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp)
|
||||
{
|
||||
int lttpr_count;
|
||||
bool ret;
|
||||
int i;
|
||||
|
||||
if (intel_dp_is_edp(intel_dp))
|
||||
return 0;
|
||||
|
||||
ret = intel_dp_read_lttpr_common_caps(intel_dp);
|
||||
|
||||
/* The DPTX shall read the DPRX caps after LTTPR detection. */
|
||||
if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd)) {
|
||||
intel_dp_reset_lttpr_common_caps(intel_dp);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The 0xF0000-0xF02FF range is only valid if the DPCD revision is
|
||||
* at least 1.4.
|
||||
*/
|
||||
if (intel_dp->dpcd[DP_DPCD_REV] < 0x14) {
|
||||
intel_dp_reset_lttpr_common_caps(intel_dp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lttpr_count = drm_dp_lttpr_count(intel_dp->lttpr_common_caps);
|
||||
/*
|
||||
* Prevent setting LTTPR transparent mode explicitly if no LTTPRs are
|
||||
@ -173,7 +211,7 @@ int intel_dp_lttpr_init(struct intel_dp *intel_dp)
|
||||
|
||||
return lttpr_count;
|
||||
}
|
||||
EXPORT_SYMBOL(intel_dp_lttpr_init);
|
||||
EXPORT_SYMBOL(intel_dp_init_lttpr_and_dprx_caps);
|
||||
|
||||
static u8 dp_voltage_max(u8 preemph)
|
||||
{
|
||||
@ -329,6 +367,39 @@ intel_dp_set_link_train(struct intel_dp *intel_dp,
|
||||
return drm_dp_dpcd_write(&intel_dp->aux, reg, buf, len) == len;
|
||||
}
|
||||
|
||||
static char dp_training_pattern_name(u8 train_pat)
|
||||
{
|
||||
switch (train_pat) {
|
||||
case DP_TRAINING_PATTERN_1:
|
||||
case DP_TRAINING_PATTERN_2:
|
||||
case DP_TRAINING_PATTERN_3:
|
||||
return '0' + train_pat;
|
||||
case DP_TRAINING_PATTERN_4:
|
||||
return '4';
|
||||
default:
|
||||
MISSING_CASE(train_pat);
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
u8 dp_train_pat)
|
||||
{
|
||||
struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
u8 train_pat = intel_dp_training_pattern_symbol(dp_train_pat);
|
||||
|
||||
if (train_pat != DP_TRAINING_PATTERN_DISABLE)
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"[ENCODER:%d:%s] Using DP training pattern TPS%c\n",
|
||||
encoder->base.base.id, encoder->base.name,
|
||||
dp_training_pattern_name(train_pat));
|
||||
|
||||
intel_dp->set_link_train(intel_dp, crtc_state, dp_train_pat);
|
||||
}
|
||||
|
||||
void intel_dp_set_signal_levels(struct intel_dp *intel_dp,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
enum drm_dp_phy dp_phy)
|
||||
@ -808,7 +879,10 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp,
|
||||
* TODO: Reiniting LTTPRs here won't be needed once proper connector
|
||||
* HW state readout is added.
|
||||
*/
|
||||
int lttpr_count = intel_dp_lttpr_init(intel_dp);
|
||||
int lttpr_count = intel_dp_init_lttpr_and_dprx_caps(intel_dp);
|
||||
|
||||
if (lttpr_count < 0)
|
||||
return;
|
||||
|
||||
if (!intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count))
|
||||
intel_dp_schedule_fallback_link_training(intel_dp, crtc_state);
|
||||
|
@ -11,12 +11,15 @@
|
||||
struct intel_crtc_state;
|
||||
struct intel_dp;
|
||||
|
||||
int intel_dp_lttpr_init(struct intel_dp *intel_dp);
|
||||
int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp);
|
||||
|
||||
void intel_dp_get_adjust_train(struct intel_dp *intel_dp,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
enum drm_dp_phy dp_phy,
|
||||
const u8 link_status[DP_LINK_STATUS_SIZE]);
|
||||
void intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
u8 dp_train_pat);
|
||||
void intel_dp_set_signal_levels(struct intel_dp *intel_dp,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
enum drm_dp_phy dp_phy);
|
||||
|
@ -177,7 +177,7 @@ intel_dp_mst_transcoder_mask(struct intel_atomic_state *state,
|
||||
u8 transcoders = 0;
|
||||
int i;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12)
|
||||
if (DISPLAY_VER(dev_priv) < 12)
|
||||
return 0;
|
||||
|
||||
for_each_new_intel_connector_in_state(state, connector, conn_state, i) {
|
||||
@ -228,7 +228,7 @@ intel_dp_mst_atomic_master_trans_check(struct intel_connector *connector,
|
||||
struct drm_connector_list_iter connector_list_iter;
|
||||
struct intel_connector *connector_iter;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12)
|
||||
if (DISPLAY_VER(dev_priv) < 12)
|
||||
return 0;
|
||||
|
||||
if (!intel_connector_needs_modeset(state, &connector->base))
|
||||
@ -390,7 +390,7 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state,
|
||||
intel_dp->active_mst_links--;
|
||||
last_mst_stream = intel_dp->active_mst_links == 0;
|
||||
drm_WARN_ON(&dev_priv->drm,
|
||||
INTEL_GEN(dev_priv) >= 12 && last_mst_stream &&
|
||||
DISPLAY_VER(dev_priv) >= 12 && last_mst_stream &&
|
||||
!intel_dp_mst_is_master_trans(old_crtc_state));
|
||||
|
||||
intel_crtc_vblank_off(old_crtc_state);
|
||||
@ -414,7 +414,7 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state,
|
||||
|
||||
intel_ddi_disable_transcoder_func(old_crtc_state);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
skl_scaler_disable(old_crtc_state);
|
||||
else
|
||||
ilk_pfit_disable(old_crtc_state);
|
||||
@ -440,7 +440,7 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state,
|
||||
* From older GENs spec: "Configure Transcoder Clock Select to direct
|
||||
* no clock to the transcoder"
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) < 12 || !last_mst_stream)
|
||||
if (DISPLAY_VER(dev_priv) < 12 || !last_mst_stream)
|
||||
intel_ddi_disable_pipe_clock(old_crtc_state);
|
||||
|
||||
|
||||
@ -488,7 +488,7 @@ static void intel_mst_pre_enable_dp(struct intel_atomic_state *state,
|
||||
intel_mst->connector = connector;
|
||||
first_mst_stream = intel_dp->active_mst_links == 0;
|
||||
drm_WARN_ON(&dev_priv->drm,
|
||||
INTEL_GEN(dev_priv) >= 12 && first_mst_stream &&
|
||||
DISPLAY_VER(dev_priv) >= 12 && first_mst_stream &&
|
||||
!intel_dp_mst_is_master_trans(pipe_config));
|
||||
|
||||
drm_dbg_kms(&dev_priv->drm, "active links %d\n",
|
||||
@ -521,7 +521,7 @@ static void intel_mst_pre_enable_dp(struct intel_atomic_state *state,
|
||||
* first MST stream, so it's done on the DDI for the first stream and
|
||||
* here for the following ones.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) < 12 || !first_mst_stream)
|
||||
if (DISPLAY_VER(dev_priv) < 12 || !first_mst_stream)
|
||||
intel_ddi_enable_pipe_clock(encoder, pipe_config);
|
||||
|
||||
intel_ddi_set_dp_msa(pipe_config, conn_state);
|
||||
@ -831,7 +831,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
|
||||
intel_attach_force_audio_property(connector);
|
||||
intel_attach_broadcast_rgb_property(connector);
|
||||
|
||||
if (INTEL_GEN(dev_priv) <= 12) {
|
||||
if (DISPLAY_VER(dev_priv) <= 12) {
|
||||
ret = intel_dp_init_hdcp(dig_port, intel_connector);
|
||||
if (ret)
|
||||
drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP MST init failed, skipping.\n",
|
||||
@ -945,10 +945,10 @@ intel_dp_mst_encoder_init(struct intel_digital_port *dig_port, int conn_base_id)
|
||||
if (!HAS_DP_MST(i915) || intel_dp_is_edp(intel_dp))
|
||||
return 0;
|
||||
|
||||
if (INTEL_GEN(i915) < 12 && port == PORT_A)
|
||||
if (DISPLAY_VER(i915) < 12 && port == PORT_A)
|
||||
return 0;
|
||||
|
||||
if (INTEL_GEN(i915) < 11 && port == PORT_E)
|
||||
if (DISPLAY_VER(i915) < 11 && port == PORT_E)
|
||||
return 0;
|
||||
|
||||
intel_dp->mst_mgr.cbs = &mst_cbs;
|
||||
|
@ -847,7 +847,7 @@ static void i9xx_compute_dpll(struct intel_crtc *crtc,
|
||||
dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14;
|
||||
break;
|
||||
}
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT);
|
||||
|
||||
if (crtc_state->sdvo_tv_clock)
|
||||
@ -861,7 +861,7 @@ static void i9xx_compute_dpll(struct intel_crtc *crtc,
|
||||
dpll |= DPLL_VCO_ENABLE;
|
||||
crtc_state->dpll_hw_state.dpll = dpll;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4) {
|
||||
if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
u32 dpll_md = (crtc_state->pixel_multiplier - 1)
|
||||
<< DPLL_MD_UDI_MULTIPLIER_SHIFT;
|
||||
crtc_state->dpll_hw_state.dpll_md = dpll_md;
|
||||
@ -926,7 +926,7 @@ static int hsw_crtc_compute_clock(struct intel_crtc *crtc,
|
||||
to_intel_atomic_state(crtc_state->uapi.state);
|
||||
|
||||
if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DSI) ||
|
||||
INTEL_GEN(dev_priv) >= 11) {
|
||||
DISPLAY_VER(dev_priv) >= 11) {
|
||||
struct intel_encoder *encoder =
|
||||
intel_get_crtc_new_encoder(state, crtc_state);
|
||||
|
||||
@ -1346,7 +1346,7 @@ static int i8xx_crtc_compute_clock(struct intel_crtc *crtc,
|
||||
void
|
||||
intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 9 || HAS_DDI(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 9 || HAS_DDI(dev_priv))
|
||||
dev_priv->display.crtc_compute_clock = hsw_crtc_compute_clock;
|
||||
else if (HAS_PCH_SPLIT(dev_priv))
|
||||
dev_priv->display.crtc_compute_clock = ilk_crtc_compute_clock;
|
||||
@ -1358,7 +1358,7 @@ intel_dpll_init_clock_hook(struct drm_i915_private *dev_priv)
|
||||
dev_priv->display.crtc_compute_clock = g4x_crtc_compute_clock;
|
||||
else if (IS_PINEVIEW(dev_priv))
|
||||
dev_priv->display.crtc_compute_clock = pnv_crtc_compute_clock;
|
||||
else if (!IS_GEN(dev_priv, 2))
|
||||
else if (!IS_DISPLAY_VER(dev_priv, 2))
|
||||
dev_priv->display.crtc_compute_clock = i9xx_crtc_compute_clock;
|
||||
else
|
||||
dev_priv->display.crtc_compute_clock = i8xx_crtc_compute_clock;
|
||||
@ -1398,7 +1398,7 @@ void i9xx_enable_pll(struct intel_crtc *crtc,
|
||||
intel_de_posting_read(dev_priv, reg);
|
||||
udelay(150);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4) {
|
||||
if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
intel_de_write(dev_priv, DPLL_MD(crtc->pipe),
|
||||
crtc_state->dpll_hw_state.dpll_md);
|
||||
} else {
|
||||
|
@ -247,7 +247,7 @@ void intel_disable_shared_dpll(const struct intel_crtc_state *crtc_state)
|
||||
unsigned int pipe_mask = BIT(crtc->pipe);
|
||||
|
||||
/* PCH only available on ILK+ */
|
||||
if (INTEL_GEN(dev_priv) < 5)
|
||||
if (DISPLAY_VER(dev_priv) < 5)
|
||||
return;
|
||||
|
||||
if (pll == NULL)
|
||||
@ -3017,7 +3017,7 @@ static bool icl_calc_tbt_pll(struct intel_crtc_state *crtc_state,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
switch (dev_priv->dpll.ref_clks.nssc) {
|
||||
default:
|
||||
MISSING_CASE(dev_priv->dpll.ref_clks.nssc);
|
||||
@ -3112,7 +3112,7 @@ static void icl_calc_dpll_state(struct drm_i915_private *i915,
|
||||
DPLL_CFGCR1_KDIV(pll_params->kdiv) |
|
||||
DPLL_CFGCR1_PDIV(pll_params->pdiv);
|
||||
|
||||
if (INTEL_GEN(i915) >= 12)
|
||||
if (DISPLAY_VER(i915) >= 12)
|
||||
pll_state->cfgcr1 |= TGL_DPLL_CFGCR1_CFSELOVRD_NORMAL_XTAL;
|
||||
else
|
||||
pll_state->cfgcr1 |= DPLL_CFGCR1_CENTRAL_FREQ_8400;
|
||||
@ -3222,7 +3222,7 @@ static bool icl_calc_mg_pll_state(struct intel_crtc_state *crtc_state,
|
||||
u64 tmp;
|
||||
bool use_ssc = false;
|
||||
bool is_dp = !intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI);
|
||||
bool is_dkl = INTEL_GEN(dev_priv) >= 12;
|
||||
bool is_dkl = DISPLAY_VER(dev_priv) >= 12;
|
||||
|
||||
memset(pll_state, 0, sizeof(*pll_state));
|
||||
|
||||
@ -3422,7 +3422,7 @@ static int icl_ddi_mg_pll_get_freq(struct drm_i915_private *dev_priv,
|
||||
|
||||
ref_clock = dev_priv->dpll.ref_clks.nssc;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
m1 = pll_state->mg_pll_div0 & DKL_PLL_DIV0_FBPREDIV_MASK;
|
||||
m1 = m1 >> DKL_PLL_DIV0_FBPREDIV_SHIFT;
|
||||
m2_int = pll_state->mg_pll_div0 & DKL_PLL_DIV0_FBDIV_INT_MASK;
|
||||
@ -3884,7 +3884,7 @@ static bool icl_pll_get_hw_state(struct drm_i915_private *dev_priv,
|
||||
RKL_DPLL_CFGCR0(id));
|
||||
hw_state->cfgcr1 = intel_de_read(dev_priv,
|
||||
RKL_DPLL_CFGCR1(id));
|
||||
} else if (INTEL_GEN(dev_priv) >= 12) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
hw_state->cfgcr0 = intel_de_read(dev_priv,
|
||||
TGL_DPLL_CFGCR0(id));
|
||||
hw_state->cfgcr1 = intel_de_read(dev_priv,
|
||||
@ -3941,7 +3941,7 @@ static void icl_dpll_write(struct drm_i915_private *dev_priv,
|
||||
} else if (IS_ROCKETLAKE(dev_priv)) {
|
||||
cfgcr0_reg = RKL_DPLL_CFGCR0(id);
|
||||
cfgcr1_reg = RKL_DPLL_CFGCR1(id);
|
||||
} else if (INTEL_GEN(dev_priv) >= 12) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
cfgcr0_reg = TGL_DPLL_CFGCR0(id);
|
||||
cfgcr1_reg = TGL_DPLL_CFGCR1(id);
|
||||
} else {
|
||||
@ -4172,7 +4172,7 @@ static void mg_pll_enable(struct drm_i915_private *dev_priv,
|
||||
|
||||
icl_pll_power_enable(dev_priv, pll, enable_reg);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
dkl_pll_write(dev_priv, pll);
|
||||
else
|
||||
icl_mg_pll_write(dev_priv, pll);
|
||||
@ -4199,7 +4199,7 @@ static void icl_pll_disable(struct drm_i915_private *dev_priv,
|
||||
/*
|
||||
* DVFS pre sequence would be here, but in our driver the cdclk code
|
||||
* paths should already be setting the appropriate voltage, hence we do
|
||||
* nothign here.
|
||||
* nothing here.
|
||||
*/
|
||||
|
||||
val = intel_de_read(dev_priv, enable_reg);
|
||||
@ -4433,11 +4433,11 @@ void intel_shared_dpll_init(struct drm_device *dev)
|
||||
dpll_mgr = &dg1_pll_mgr;
|
||||
else if (IS_ROCKETLAKE(dev_priv))
|
||||
dpll_mgr = &rkl_pll_mgr;
|
||||
else if (INTEL_GEN(dev_priv) >= 12)
|
||||
else if (DISPLAY_VER(dev_priv) >= 12)
|
||||
dpll_mgr = &tgl_pll_mgr;
|
||||
else if (IS_JSL_EHL(dev_priv))
|
||||
dpll_mgr = &ehl_pll_mgr;
|
||||
else if (INTEL_GEN(dev_priv) >= 11)
|
||||
else if (DISPLAY_VER(dev_priv) >= 11)
|
||||
dpll_mgr = &icl_pll_mgr;
|
||||
else if (IS_CANNONLAKE(dev_priv))
|
||||
dpll_mgr = &cnl_pll_mgr;
|
||||
|
@ -203,7 +203,7 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
|
||||
break;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 11)
|
||||
if (DISPLAY_VER(dev_priv) < 11)
|
||||
vlv_dsi_wait_for_fifo_empty(intel_dsi, port);
|
||||
|
||||
out:
|
||||
@ -380,7 +380,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
|
||||
/* pull up/down */
|
||||
value = *data++ & 1;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
icl_exec_gpio(dev_priv, gpio_source, gpio_index, value);
|
||||
else if (IS_VALLEYVIEW(dev_priv))
|
||||
vlv_exec_gpio(dev_priv, gpio_source, gpio_number, value);
|
||||
|
962
drivers/gpu/drm/i915/display/intel_fb.c
Normal file
962
drivers/gpu/drm/i915/display/intel_fb.c
Normal file
@ -0,0 +1,962 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright © 2021 Intel Corporation
|
||||
*/
|
||||
|
||||
#include <drm/drm_framebuffer.h>
|
||||
|
||||
#include "intel_display.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_fb.h"
|
||||
|
||||
#define check_array_bounds(i915, a, i) drm_WARN_ON(&(i915)->drm, (i) >= ARRAY_SIZE(a))
|
||||
|
||||
bool is_ccs_plane(const struct drm_framebuffer *fb, int plane)
|
||||
{
|
||||
if (!is_ccs_modifier(fb->modifier))
|
||||
return false;
|
||||
|
||||
return plane >= fb->format->num_planes / 2;
|
||||
}
|
||||
|
||||
bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane)
|
||||
{
|
||||
return is_gen12_ccs_modifier(fb->modifier) && is_ccs_plane(fb, plane);
|
||||
}
|
||||
|
||||
bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane)
|
||||
{
|
||||
return fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC &&
|
||||
plane == 2;
|
||||
}
|
||||
|
||||
bool is_aux_plane(const struct drm_framebuffer *fb, int plane)
|
||||
{
|
||||
if (is_ccs_modifier(fb->modifier))
|
||||
return is_ccs_plane(fb, plane);
|
||||
|
||||
return plane == 1;
|
||||
}
|
||||
|
||||
bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane)
|
||||
{
|
||||
return intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier) &&
|
||||
color_plane == 1;
|
||||
}
|
||||
|
||||
bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane)
|
||||
{
|
||||
return fb->modifier == DRM_FORMAT_MOD_LINEAR ||
|
||||
is_gen12_ccs_plane(fb, color_plane);
|
||||
}
|
||||
|
||||
int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane)
|
||||
{
|
||||
drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
|
||||
(main_plane && main_plane >= fb->format->num_planes / 2));
|
||||
|
||||
return fb->format->num_planes / 2 + main_plane;
|
||||
}
|
||||
|
||||
int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane)
|
||||
{
|
||||
drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
|
||||
ccs_plane < fb->format->num_planes / 2);
|
||||
|
||||
if (is_gen12_ccs_cc_plane(fb, ccs_plane))
|
||||
return 0;
|
||||
|
||||
return ccs_plane - fb->format->num_planes / 2;
|
||||
}
|
||||
|
||||
int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->dev);
|
||||
|
||||
if (is_ccs_modifier(fb->modifier))
|
||||
return main_to_ccs_plane(fb, main_plane);
|
||||
else if (DISPLAY_VER(i915) < 11 &&
|
||||
intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int intel_tile_size(const struct drm_i915_private *i915)
|
||||
{
|
||||
return IS_DISPLAY_VER(i915, 2) ? 2048 : 4096;
|
||||
}
|
||||
|
||||
unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane)
|
||||
{
|
||||
if (is_gen12_ccs_plane(fb, color_plane))
|
||||
return 1;
|
||||
|
||||
return intel_tile_size(to_i915(fb->dev)) /
|
||||
intel_tile_width_bytes(fb, color_plane);
|
||||
}
|
||||
|
||||
/* Return the tile dimensions in pixel units */
|
||||
static void intel_tile_dims(const struct drm_framebuffer *fb, int color_plane,
|
||||
unsigned int *tile_width,
|
||||
unsigned int *tile_height)
|
||||
{
|
||||
unsigned int tile_width_bytes = intel_tile_width_bytes(fb, color_plane);
|
||||
unsigned int cpp = fb->format->cpp[color_plane];
|
||||
|
||||
*tile_width = tile_width_bytes / cpp;
|
||||
*tile_height = intel_tile_height(fb, color_plane);
|
||||
}
|
||||
|
||||
unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_plane)
|
||||
{
|
||||
unsigned int tile_width, tile_height;
|
||||
|
||||
intel_tile_dims(fb, color_plane, &tile_width, &tile_height);
|
||||
|
||||
return fb->pitches[color_plane] * tile_height;
|
||||
}
|
||||
|
||||
unsigned int intel_cursor_alignment(const struct drm_i915_private *i915)
|
||||
{
|
||||
if (IS_I830(i915))
|
||||
return 16 * 1024;
|
||||
else if (IS_I85X(i915))
|
||||
return 256;
|
||||
else if (IS_I845G(i915) || IS_I865G(i915))
|
||||
return 32;
|
||||
else
|
||||
return 4 * 1024;
|
||||
}
|
||||
|
||||
void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
|
||||
const struct drm_framebuffer *fb,
|
||||
int color_plane)
|
||||
{
|
||||
int main_plane;
|
||||
|
||||
if (color_plane == 0) {
|
||||
*hsub = 1;
|
||||
*vsub = 1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: Deduct the subsampling from the char block for all CCS
|
||||
* formats and planes.
|
||||
*/
|
||||
if (!is_gen12_ccs_plane(fb, color_plane)) {
|
||||
*hsub = fb->format->hsub;
|
||||
*vsub = fb->format->vsub;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
main_plane = skl_ccs_to_main_plane(fb, color_plane);
|
||||
*hsub = drm_format_info_block_width(fb->format, color_plane) /
|
||||
drm_format_info_block_width(fb->format, main_plane);
|
||||
|
||||
/*
|
||||
* The min stride check in the core framebuffer_check() function
|
||||
* assumes that format->hsub applies to every plane except for the
|
||||
* first plane. That's incorrect for the CCS AUX plane of the first
|
||||
* plane, but for the above check to pass we must define the block
|
||||
* width with that subsampling applied to it. Adjust the width here
|
||||
* accordingly, so we can calculate the actual subsampling factor.
|
||||
*/
|
||||
if (main_plane == 0)
|
||||
*hsub *= fb->format->hsub;
|
||||
|
||||
*vsub = 32;
|
||||
}
|
||||
|
||||
static void intel_fb_plane_dims(int *w, int *h, struct drm_framebuffer *fb, int color_plane)
|
||||
{
|
||||
int main_plane = is_ccs_plane(fb, color_plane) ?
|
||||
skl_ccs_to_main_plane(fb, color_plane) : 0;
|
||||
int main_hsub, main_vsub;
|
||||
int hsub, vsub;
|
||||
|
||||
intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, fb, main_plane);
|
||||
intel_fb_plane_get_subsampling(&hsub, &vsub, fb, color_plane);
|
||||
*w = fb->width / main_hsub / hsub;
|
||||
*h = fb->height / main_vsub / vsub;
|
||||
}
|
||||
|
||||
static u32 intel_adjust_tile_offset(int *x, int *y,
|
||||
unsigned int tile_width,
|
||||
unsigned int tile_height,
|
||||
unsigned int tile_size,
|
||||
unsigned int pitch_tiles,
|
||||
u32 old_offset,
|
||||
u32 new_offset)
|
||||
{
|
||||
unsigned int pitch_pixels = pitch_tiles * tile_width;
|
||||
unsigned int tiles;
|
||||
|
||||
WARN_ON(old_offset & (tile_size - 1));
|
||||
WARN_ON(new_offset & (tile_size - 1));
|
||||
WARN_ON(new_offset > old_offset);
|
||||
|
||||
tiles = (old_offset - new_offset) / tile_size;
|
||||
|
||||
*y += tiles / pitch_tiles * tile_height;
|
||||
*x += tiles % pitch_tiles * tile_width;
|
||||
|
||||
/* minimize x in case it got needlessly big */
|
||||
*y += *x / pitch_pixels * tile_height;
|
||||
*x %= pitch_pixels;
|
||||
|
||||
return new_offset;
|
||||
}
|
||||
|
||||
static u32 intel_adjust_aligned_offset(int *x, int *y,
|
||||
const struct drm_framebuffer *fb,
|
||||
int color_plane,
|
||||
unsigned int rotation,
|
||||
unsigned int pitch,
|
||||
u32 old_offset, u32 new_offset)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->dev);
|
||||
unsigned int cpp = fb->format->cpp[color_plane];
|
||||
|
||||
drm_WARN_ON(&i915->drm, new_offset > old_offset);
|
||||
|
||||
if (!is_surface_linear(fb, color_plane)) {
|
||||
unsigned int tile_size, tile_width, tile_height;
|
||||
unsigned int pitch_tiles;
|
||||
|
||||
tile_size = intel_tile_size(i915);
|
||||
intel_tile_dims(fb, color_plane, &tile_width, &tile_height);
|
||||
|
||||
if (drm_rotation_90_or_270(rotation)) {
|
||||
pitch_tiles = pitch / tile_height;
|
||||
swap(tile_width, tile_height);
|
||||
} else {
|
||||
pitch_tiles = pitch / (tile_width * cpp);
|
||||
}
|
||||
|
||||
intel_adjust_tile_offset(x, y, tile_width, tile_height,
|
||||
tile_size, pitch_tiles,
|
||||
old_offset, new_offset);
|
||||
} else {
|
||||
old_offset += *y * pitch + *x * cpp;
|
||||
|
||||
*y = (old_offset - new_offset) / pitch;
|
||||
*x = ((old_offset - new_offset) - *y * pitch) / cpp;
|
||||
}
|
||||
|
||||
return new_offset;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adjust the tile offset by moving the difference into
|
||||
* the x/y offsets.
|
||||
*/
|
||||
u32 intel_plane_adjust_aligned_offset(int *x, int *y,
|
||||
const struct intel_plane_state *state,
|
||||
int color_plane,
|
||||
u32 old_offset, u32 new_offset)
|
||||
{
|
||||
return intel_adjust_aligned_offset(x, y, state->hw.fb, color_plane,
|
||||
state->hw.rotation,
|
||||
state->view.color_plane[color_plane].stride,
|
||||
old_offset, new_offset);
|
||||
}
|
||||
|
||||
/*
|
||||
* Computes the aligned offset to the base tile and adjusts
|
||||
* x, y. bytes per pixel is assumed to be a power-of-two.
|
||||
*
|
||||
* In the 90/270 rotated case, x and y are assumed
|
||||
* to be already rotated to match the rotated GTT view, and
|
||||
* pitch is the tile_height aligned framebuffer height.
|
||||
*
|
||||
* This function is used when computing the derived information
|
||||
* under intel_framebuffer, so using any of that information
|
||||
* here is not allowed. Anything under drm_framebuffer can be
|
||||
* used. This is why the user has to pass in the pitch since it
|
||||
* is specified in the rotated orientation.
|
||||
*/
|
||||
static u32 intel_compute_aligned_offset(struct drm_i915_private *i915,
|
||||
int *x, int *y,
|
||||
const struct drm_framebuffer *fb,
|
||||
int color_plane,
|
||||
unsigned int pitch,
|
||||
unsigned int rotation,
|
||||
u32 alignment)
|
||||
{
|
||||
unsigned int cpp = fb->format->cpp[color_plane];
|
||||
u32 offset, offset_aligned;
|
||||
|
||||
if (!is_surface_linear(fb, color_plane)) {
|
||||
unsigned int tile_size, tile_width, tile_height;
|
||||
unsigned int tile_rows, tiles, pitch_tiles;
|
||||
|
||||
tile_size = intel_tile_size(i915);
|
||||
intel_tile_dims(fb, color_plane, &tile_width, &tile_height);
|
||||
|
||||
if (drm_rotation_90_or_270(rotation)) {
|
||||
pitch_tiles = pitch / tile_height;
|
||||
swap(tile_width, tile_height);
|
||||
} else {
|
||||
pitch_tiles = pitch / (tile_width * cpp);
|
||||
}
|
||||
|
||||
tile_rows = *y / tile_height;
|
||||
*y %= tile_height;
|
||||
|
||||
tiles = *x / tile_width;
|
||||
*x %= tile_width;
|
||||
|
||||
offset = (tile_rows * pitch_tiles + tiles) * tile_size;
|
||||
|
||||
offset_aligned = offset;
|
||||
if (alignment)
|
||||
offset_aligned = rounddown(offset_aligned, alignment);
|
||||
|
||||
intel_adjust_tile_offset(x, y, tile_width, tile_height,
|
||||
tile_size, pitch_tiles,
|
||||
offset, offset_aligned);
|
||||
} else {
|
||||
offset = *y * pitch + *x * cpp;
|
||||
offset_aligned = offset;
|
||||
if (alignment) {
|
||||
offset_aligned = rounddown(offset_aligned, alignment);
|
||||
*y = (offset % alignment) / pitch;
|
||||
*x = ((offset % alignment) - *y * pitch) / cpp;
|
||||
} else {
|
||||
*y = *x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return offset_aligned;
|
||||
}
|
||||
|
||||
u32 intel_plane_compute_aligned_offset(int *x, int *y,
|
||||
const struct intel_plane_state *state,
|
||||
int color_plane)
|
||||
{
|
||||
struct intel_plane *intel_plane = to_intel_plane(state->uapi.plane);
|
||||
struct drm_i915_private *i915 = to_i915(intel_plane->base.dev);
|
||||
const struct drm_framebuffer *fb = state->hw.fb;
|
||||
unsigned int rotation = state->hw.rotation;
|
||||
int pitch = state->view.color_plane[color_plane].stride;
|
||||
u32 alignment;
|
||||
|
||||
if (intel_plane->id == PLANE_CURSOR)
|
||||
alignment = intel_cursor_alignment(i915);
|
||||
else
|
||||
alignment = intel_surf_alignment(fb, color_plane);
|
||||
|
||||
return intel_compute_aligned_offset(i915, x, y, fb, color_plane,
|
||||
pitch, rotation, alignment);
|
||||
}
|
||||
|
||||
/* Convert the fb->offset[] into x/y offsets */
|
||||
static int intel_fb_offset_to_xy(int *x, int *y,
|
||||
const struct drm_framebuffer *fb,
|
||||
int color_plane)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->dev);
|
||||
unsigned int height;
|
||||
u32 alignment;
|
||||
|
||||
if (DISPLAY_VER(i915) >= 12 &&
|
||||
is_semiplanar_uv_plane(fb, color_plane))
|
||||
alignment = intel_tile_row_size(fb, color_plane);
|
||||
else if (fb->modifier != DRM_FORMAT_MOD_LINEAR)
|
||||
alignment = intel_tile_size(i915);
|
||||
else
|
||||
alignment = 0;
|
||||
|
||||
if (alignment != 0 && fb->offsets[color_plane] % alignment) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"Misaligned offset 0x%08x for color plane %d\n",
|
||||
fb->offsets[color_plane], color_plane);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
height = drm_framebuffer_plane_height(fb->height, fb, color_plane);
|
||||
height = ALIGN(height, intel_tile_height(fb, color_plane));
|
||||
|
||||
/* Catch potential overflows early */
|
||||
if (add_overflows_t(u32, mul_u32_u32(height, fb->pitches[color_plane]),
|
||||
fb->offsets[color_plane])) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"Bad offset 0x%08x or pitch %d for color plane %d\n",
|
||||
fb->offsets[color_plane], fb->pitches[color_plane],
|
||||
color_plane);
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
|
||||
intel_adjust_aligned_offset(x, y,
|
||||
fb, color_plane, DRM_MODE_ROTATE_0,
|
||||
fb->pitches[color_plane],
|
||||
fb->offsets[color_plane], 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intel_fb_check_ccs_xy(const struct drm_framebuffer *fb, int ccs_plane, int x, int y)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->dev);
|
||||
const struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
|
||||
int main_plane;
|
||||
int hsub, vsub;
|
||||
int tile_width, tile_height;
|
||||
int ccs_x, ccs_y;
|
||||
int main_x, main_y;
|
||||
|
||||
if (!is_ccs_plane(fb, ccs_plane) || is_gen12_ccs_cc_plane(fb, ccs_plane))
|
||||
return 0;
|
||||
|
||||
intel_tile_dims(fb, ccs_plane, &tile_width, &tile_height);
|
||||
intel_fb_plane_get_subsampling(&hsub, &vsub, fb, ccs_plane);
|
||||
|
||||
tile_width *= hsub;
|
||||
tile_height *= vsub;
|
||||
|
||||
ccs_x = (x * hsub) % tile_width;
|
||||
ccs_y = (y * vsub) % tile_height;
|
||||
|
||||
main_plane = skl_ccs_to_main_plane(fb, ccs_plane);
|
||||
main_x = intel_fb->normal_view.color_plane[main_plane].x % tile_width;
|
||||
main_y = intel_fb->normal_view.color_plane[main_plane].y % tile_height;
|
||||
|
||||
/*
|
||||
* CCS doesn't have its own x/y offset register, so the intra CCS tile
|
||||
* x/y offsets must match between CCS and the main surface.
|
||||
*/
|
||||
if (main_x != ccs_x || main_y != ccs_y) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"Bad CCS x/y (main %d,%d ccs %d,%d) full (main %d,%d ccs %d,%d)\n",
|
||||
main_x, main_y,
|
||||
ccs_x, ccs_y,
|
||||
intel_fb->normal_view.color_plane[main_plane].x,
|
||||
intel_fb->normal_view.color_plane[main_plane].y,
|
||||
x, y);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool intel_plane_can_remap(const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
struct drm_i915_private *i915 = to_i915(plane->base.dev);
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
int i;
|
||||
|
||||
/* We don't want to deal with remapping with cursors */
|
||||
if (plane->id == PLANE_CURSOR)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* The display engine limits already match/exceed the
|
||||
* render engine limits, so not much point in remapping.
|
||||
* Would also need to deal with the fence POT alignment
|
||||
* and gen2 2KiB GTT tile size.
|
||||
*/
|
||||
if (DISPLAY_VER(i915) < 4)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* The new CCS hash mode isn't compatible with remapping as
|
||||
* the virtual address of the pages affects the compressed data.
|
||||
*/
|
||||
if (is_ccs_modifier(fb->modifier))
|
||||
return false;
|
||||
|
||||
/* Linear needs a page aligned stride for remapping */
|
||||
if (fb->modifier == DRM_FORMAT_MOD_LINEAR) {
|
||||
unsigned int alignment = intel_tile_size(i915) - 1;
|
||||
|
||||
for (i = 0; i < fb->format->num_planes; i++) {
|
||||
if (fb->pitches[i] & alignment)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool intel_fb_needs_pot_stride_remap(const struct intel_framebuffer *fb)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static int intel_fb_pitch(const struct intel_framebuffer *fb, int color_plane, unsigned int rotation)
|
||||
{
|
||||
if (drm_rotation_90_or_270(rotation))
|
||||
return fb->rotated_view.color_plane[color_plane].stride;
|
||||
else if (intel_fb_needs_pot_stride_remap(fb))
|
||||
return fb->remapped_view.color_plane[color_plane].stride;
|
||||
else
|
||||
return fb->normal_view.color_plane[color_plane].stride;
|
||||
}
|
||||
|
||||
static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
const struct intel_framebuffer *fb = to_intel_framebuffer(plane_state->hw.fb);
|
||||
unsigned int rotation = plane_state->hw.rotation;
|
||||
u32 stride, max_stride;
|
||||
|
||||
/*
|
||||
* No remapping for invisible planes since we don't have
|
||||
* an actual source viewport to remap.
|
||||
*/
|
||||
if (!plane_state->uapi.visible)
|
||||
return false;
|
||||
|
||||
if (!intel_plane_can_remap(plane_state))
|
||||
return false;
|
||||
|
||||
/*
|
||||
* FIXME: aux plane limits on gen9+ are
|
||||
* unclear in Bspec, for now no checking.
|
||||
*/
|
||||
stride = intel_fb_pitch(fb, 0, rotation);
|
||||
max_stride = plane->max_stride(plane, fb->base.format->format,
|
||||
fb->base.modifier, rotation);
|
||||
|
||||
return stride > max_stride;
|
||||
}
|
||||
|
||||
static int convert_plane_offset_to_xy(const struct intel_framebuffer *fb, int color_plane,
|
||||
int plane_width, int *x, int *y)
|
||||
{
|
||||
struct drm_i915_gem_object *obj = intel_fb_obj(&fb->base);
|
||||
int ret;
|
||||
|
||||
ret = intel_fb_offset_to_xy(x, y, &fb->base, color_plane);
|
||||
if (ret) {
|
||||
drm_dbg_kms(fb->base.dev,
|
||||
"bad fb plane %d offset: 0x%x\n",
|
||||
color_plane, fb->base.offsets[color_plane]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = intel_fb_check_ccs_xy(&fb->base, color_plane, *x, *y);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* The fence (if used) is aligned to the start of the object
|
||||
* so having the framebuffer wrap around across the edge of the
|
||||
* fenced region doesn't really work. We have no API to configure
|
||||
* the fence start offset within the object (nor could we probably
|
||||
* on gen2/3). So it's just easier if we just require that the
|
||||
* fb layout agrees with the fence layout. We already check that the
|
||||
* fb stride matches the fence stride elsewhere.
|
||||
*/
|
||||
if (color_plane == 0 && i915_gem_object_is_tiled(obj) &&
|
||||
(*x + plane_width) * fb->base.format->cpp[color_plane] > fb->base.pitches[color_plane]) {
|
||||
drm_dbg_kms(fb->base.dev,
|
||||
"bad fb plane %d offset: 0x%x\n",
|
||||
color_plane, fb->base.offsets[color_plane]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 calc_plane_aligned_offset(const struct intel_framebuffer *fb, int color_plane, int *x, int *y)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->base.dev);
|
||||
unsigned int tile_size = intel_tile_size(i915);
|
||||
u32 offset;
|
||||
|
||||
offset = intel_compute_aligned_offset(i915, x, y, &fb->base, color_plane,
|
||||
fb->base.pitches[color_plane],
|
||||
DRM_MODE_ROTATE_0,
|
||||
tile_size);
|
||||
|
||||
return offset / tile_size;
|
||||
}
|
||||
|
||||
struct fb_plane_view_dims {
|
||||
unsigned int width, height;
|
||||
unsigned int tile_width, tile_height;
|
||||
};
|
||||
|
||||
static void init_plane_view_dims(const struct intel_framebuffer *fb, int color_plane,
|
||||
unsigned int width, unsigned int height,
|
||||
struct fb_plane_view_dims *dims)
|
||||
{
|
||||
dims->width = width;
|
||||
dims->height = height;
|
||||
|
||||
intel_tile_dims(&fb->base, color_plane, &dims->tile_width, &dims->tile_height);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
plane_view_src_stride_tiles(const struct intel_framebuffer *fb, int color_plane,
|
||||
const struct fb_plane_view_dims *dims)
|
||||
{
|
||||
return DIV_ROUND_UP(fb->base.pitches[color_plane],
|
||||
dims->tile_width * fb->base.format->cpp[color_plane]);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
plane_view_dst_stride_tiles(const struct intel_framebuffer *fb, int color_plane,
|
||||
unsigned int pitch_tiles)
|
||||
{
|
||||
if (intel_fb_needs_pot_stride_remap(fb))
|
||||
return roundup_pow_of_two(pitch_tiles);
|
||||
else
|
||||
return pitch_tiles;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
plane_view_width_tiles(const struct intel_framebuffer *fb, int color_plane,
|
||||
const struct fb_plane_view_dims *dims,
|
||||
int x)
|
||||
{
|
||||
return DIV_ROUND_UP(x + dims->width, dims->tile_width);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
plane_view_height_tiles(const struct intel_framebuffer *fb, int color_plane,
|
||||
const struct fb_plane_view_dims *dims,
|
||||
int y)
|
||||
{
|
||||
return DIV_ROUND_UP(y + dims->height, dims->tile_height);
|
||||
}
|
||||
|
||||
#define assign_chk_ovf(i915, var, val) ({ \
|
||||
drm_WARN_ON(&(i915)->drm, overflows_type(val, var)); \
|
||||
(var) = (val); \
|
||||
})
|
||||
|
||||
static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_plane,
|
||||
const struct fb_plane_view_dims *dims,
|
||||
u32 obj_offset, u32 gtt_offset, int x, int y,
|
||||
struct intel_fb_view *view)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->base.dev);
|
||||
struct intel_remapped_plane_info *remap_info = &view->gtt.remapped.plane[color_plane];
|
||||
struct i915_color_plane_view *color_plane_info = &view->color_plane[color_plane];
|
||||
unsigned int tile_width = dims->tile_width;
|
||||
unsigned int tile_height = dims->tile_height;
|
||||
unsigned int tile_size = intel_tile_size(i915);
|
||||
struct drm_rect r;
|
||||
u32 size;
|
||||
|
||||
assign_chk_ovf(i915, remap_info->offset, obj_offset);
|
||||
assign_chk_ovf(i915, remap_info->src_stride, plane_view_src_stride_tiles(fb, color_plane, dims));
|
||||
assign_chk_ovf(i915, remap_info->width, plane_view_width_tiles(fb, color_plane, dims, x));
|
||||
assign_chk_ovf(i915, remap_info->height, plane_view_height_tiles(fb, color_plane, dims, y));
|
||||
|
||||
if (view->gtt.type == I915_GGTT_VIEW_ROTATED) {
|
||||
check_array_bounds(i915, view->gtt.rotated.plane, color_plane);
|
||||
|
||||
assign_chk_ovf(i915, remap_info->dst_stride,
|
||||
plane_view_dst_stride_tiles(fb, color_plane, remap_info->height));
|
||||
|
||||
/* rotate the x/y offsets to match the GTT view */
|
||||
drm_rect_init(&r, x, y, dims->width, dims->height);
|
||||
drm_rect_rotate(&r,
|
||||
remap_info->width * tile_width,
|
||||
remap_info->height * tile_height,
|
||||
DRM_MODE_ROTATE_270);
|
||||
|
||||
color_plane_info->x = r.x1;
|
||||
color_plane_info->y = r.y1;
|
||||
|
||||
color_plane_info->stride = remap_info->dst_stride * tile_height;
|
||||
|
||||
size = remap_info->dst_stride * remap_info->width;
|
||||
|
||||
/* rotate the tile dimensions to match the GTT view */
|
||||
swap(tile_width, tile_height);
|
||||
} else {
|
||||
drm_WARN_ON(&i915->drm, view->gtt.type != I915_GGTT_VIEW_REMAPPED);
|
||||
|
||||
check_array_bounds(i915, view->gtt.remapped.plane, color_plane);
|
||||
|
||||
assign_chk_ovf(i915, remap_info->dst_stride,
|
||||
plane_view_dst_stride_tiles(fb, color_plane, remap_info->width));
|
||||
|
||||
color_plane_info->x = x;
|
||||
color_plane_info->y = y;
|
||||
|
||||
color_plane_info->stride = remap_info->dst_stride * tile_width *
|
||||
fb->base.format->cpp[color_plane];
|
||||
|
||||
size = remap_info->dst_stride * remap_info->height;
|
||||
}
|
||||
|
||||
/*
|
||||
* We only keep the x/y offsets, so push all of the gtt offset into
|
||||
* the x/y offsets. x,y will hold the first pixel of the framebuffer
|
||||
* plane from the start of the remapped/rotated gtt mapping.
|
||||
*/
|
||||
intel_adjust_tile_offset(&color_plane_info->x, &color_plane_info->y,
|
||||
tile_width, tile_height,
|
||||
tile_size, remap_info->dst_stride,
|
||||
gtt_offset * tile_size, 0);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
#undef assign_chk_ovf
|
||||
|
||||
/* Return number of tiles @color_plane needs. */
|
||||
static unsigned int
|
||||
calc_plane_normal_size(const struct intel_framebuffer *fb, int color_plane,
|
||||
const struct fb_plane_view_dims *dims,
|
||||
int x, int y)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->base.dev);
|
||||
unsigned int tiles;
|
||||
|
||||
if (is_surface_linear(&fb->base, color_plane)) {
|
||||
unsigned int size;
|
||||
|
||||
size = (y + dims->height) * fb->base.pitches[color_plane] +
|
||||
x * fb->base.format->cpp[color_plane];
|
||||
tiles = DIV_ROUND_UP(size, intel_tile_size(i915));
|
||||
} else {
|
||||
tiles = plane_view_src_stride_tiles(fb, color_plane, dims) *
|
||||
plane_view_height_tiles(fb, color_plane, dims, y);
|
||||
/*
|
||||
* If the plane isn't horizontally tile aligned,
|
||||
* we need one more tile.
|
||||
*/
|
||||
if (x != 0)
|
||||
tiles++;
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
static void intel_fb_view_init(struct intel_fb_view *view, enum i915_ggtt_view_type view_type)
|
||||
{
|
||||
memset(view, 0, sizeof(*view));
|
||||
view->gtt.type = view_type;
|
||||
}
|
||||
|
||||
int intel_fill_fb_info(struct drm_i915_private *i915, struct drm_framebuffer *fb)
|
||||
{
|
||||
struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
|
||||
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
||||
u32 gtt_offset_rotated = 0;
|
||||
u32 gtt_offset_remapped = 0;
|
||||
unsigned int max_size = 0;
|
||||
int i, num_planes = fb->format->num_planes;
|
||||
unsigned int tile_size = intel_tile_size(i915);
|
||||
|
||||
intel_fb_view_init(&intel_fb->normal_view, I915_GGTT_VIEW_NORMAL);
|
||||
intel_fb_view_init(&intel_fb->rotated_view, I915_GGTT_VIEW_ROTATED);
|
||||
intel_fb_view_init(&intel_fb->remapped_view, I915_GGTT_VIEW_REMAPPED);
|
||||
|
||||
for (i = 0; i < num_planes; i++) {
|
||||
struct fb_plane_view_dims view_dims;
|
||||
unsigned int width, height;
|
||||
unsigned int cpp, size;
|
||||
u32 offset;
|
||||
int x, y;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Plane 2 of Render Compression with Clear Color fb modifier
|
||||
* is consumed by the driver and not passed to DE. Skip the
|
||||
* arithmetic related to alignment and offset calculation.
|
||||
*/
|
||||
if (is_gen12_ccs_cc_plane(fb, i)) {
|
||||
if (IS_ALIGNED(fb->offsets[i], PAGE_SIZE))
|
||||
continue;
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cpp = fb->format->cpp[i];
|
||||
intel_fb_plane_dims(&width, &height, fb, i);
|
||||
|
||||
ret = convert_plane_offset_to_xy(intel_fb, i, width, &x, &y);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
init_plane_view_dims(intel_fb, i, width, height, &view_dims);
|
||||
|
||||
/*
|
||||
* First pixel of the framebuffer from
|
||||
* the start of the normal gtt mapping.
|
||||
*/
|
||||
intel_fb->normal_view.color_plane[i].x = x;
|
||||
intel_fb->normal_view.color_plane[i].y = y;
|
||||
intel_fb->normal_view.color_plane[i].stride = intel_fb->base.pitches[i];
|
||||
|
||||
offset = calc_plane_aligned_offset(intel_fb, i, &x, &y);
|
||||
|
||||
/* Y or Yf modifiers required for 90/270 rotation */
|
||||
if (fb->modifier == I915_FORMAT_MOD_Y_TILED ||
|
||||
fb->modifier == I915_FORMAT_MOD_Yf_TILED)
|
||||
gtt_offset_rotated += calc_plane_remap_info(intel_fb, i, &view_dims,
|
||||
offset, gtt_offset_rotated, x, y,
|
||||
&intel_fb->rotated_view);
|
||||
|
||||
if (intel_fb_needs_pot_stride_remap(intel_fb))
|
||||
gtt_offset_remapped += calc_plane_remap_info(intel_fb, i, &view_dims,
|
||||
offset, gtt_offset_remapped, x, y,
|
||||
&intel_fb->remapped_view);
|
||||
|
||||
size = calc_plane_normal_size(intel_fb, i, &view_dims, x, y);
|
||||
/* how many tiles in total needed in the bo */
|
||||
max_size = max(max_size, offset + size);
|
||||
}
|
||||
|
||||
if (mul_u32_u32(max_size, tile_size) > obj->base.size) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"fb too big for bo (need %llu bytes, have %zu bytes)\n",
|
||||
mul_u32_u32(max_size, tile_size), obj->base.size);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void intel_plane_remap_gtt(struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct drm_i915_private *i915 =
|
||||
to_i915(plane_state->uapi.plane->dev);
|
||||
struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
|
||||
unsigned int rotation = plane_state->hw.rotation;
|
||||
int i, num_planes = fb->format->num_planes;
|
||||
unsigned int src_x, src_y;
|
||||
unsigned int src_w, src_h;
|
||||
u32 gtt_offset = 0;
|
||||
|
||||
intel_fb_view_init(&plane_state->view,
|
||||
drm_rotation_90_or_270(rotation) ? I915_GGTT_VIEW_ROTATED :
|
||||
I915_GGTT_VIEW_REMAPPED);
|
||||
|
||||
src_x = plane_state->uapi.src.x1 >> 16;
|
||||
src_y = plane_state->uapi.src.y1 >> 16;
|
||||
src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
|
||||
|
||||
drm_WARN_ON(&i915->drm, is_ccs_modifier(fb->modifier));
|
||||
|
||||
/* Make src coordinates relative to the viewport */
|
||||
drm_rect_translate(&plane_state->uapi.src,
|
||||
-(src_x << 16), -(src_y << 16));
|
||||
|
||||
/* Rotate src coordinates to match rotated GTT view */
|
||||
if (drm_rotation_90_or_270(rotation))
|
||||
drm_rect_rotate(&plane_state->uapi.src,
|
||||
src_w << 16, src_h << 16,
|
||||
DRM_MODE_ROTATE_270);
|
||||
|
||||
for (i = 0; i < num_planes; i++) {
|
||||
unsigned int hsub = i ? fb->format->hsub : 1;
|
||||
unsigned int vsub = i ? fb->format->vsub : 1;
|
||||
struct fb_plane_view_dims view_dims;
|
||||
unsigned int width, height;
|
||||
unsigned int x, y;
|
||||
u32 offset;
|
||||
|
||||
x = src_x / hsub;
|
||||
y = src_y / vsub;
|
||||
width = src_w / hsub;
|
||||
height = src_h / vsub;
|
||||
|
||||
init_plane_view_dims(intel_fb, i, width, height, &view_dims);
|
||||
|
||||
/*
|
||||
* First pixel of the src viewport from the
|
||||
* start of the normal gtt mapping.
|
||||
*/
|
||||
x += intel_fb->normal_view.color_plane[i].x;
|
||||
y += intel_fb->normal_view.color_plane[i].y;
|
||||
|
||||
offset = calc_plane_aligned_offset(intel_fb, i, &x, &y);
|
||||
|
||||
gtt_offset += calc_plane_remap_info(intel_fb, i, &view_dims,
|
||||
offset, gtt_offset, x, y,
|
||||
&plane_state->view);
|
||||
}
|
||||
}
|
||||
|
||||
void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
|
||||
struct intel_fb_view *view)
|
||||
{
|
||||
if (drm_rotation_90_or_270(rotation))
|
||||
*view = fb->rotated_view;
|
||||
else if (intel_fb_needs_pot_stride_remap(fb))
|
||||
*view = fb->remapped_view;
|
||||
else
|
||||
*view = fb->normal_view;
|
||||
}
|
||||
|
||||
static int intel_plane_check_stride(const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
unsigned int rotation = plane_state->hw.rotation;
|
||||
u32 stride, max_stride;
|
||||
|
||||
/*
|
||||
* We ignore stride for all invisible planes that
|
||||
* can be remapped. Otherwise we could end up
|
||||
* with a false positive when the remapping didn't
|
||||
* kick in due the plane being invisible.
|
||||
*/
|
||||
if (intel_plane_can_remap(plane_state) &&
|
||||
!plane_state->uapi.visible)
|
||||
return 0;
|
||||
|
||||
/* FIXME other color planes? */
|
||||
stride = plane_state->view.color_plane[0].stride;
|
||||
max_stride = plane->max_stride(plane, fb->format->format,
|
||||
fb->modifier, rotation);
|
||||
|
||||
if (stride > max_stride) {
|
||||
DRM_DEBUG_KMS("[FB:%d] stride (%d) exceeds [PLANE:%d:%s] max stride (%d)\n",
|
||||
fb->base.id, stride,
|
||||
plane->base.base.id, plane->base.name, max_stride);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int intel_plane_compute_gtt(struct intel_plane_state *plane_state)
|
||||
{
|
||||
const struct intel_framebuffer *fb =
|
||||
to_intel_framebuffer(plane_state->hw.fb);
|
||||
unsigned int rotation = plane_state->hw.rotation;
|
||||
|
||||
if (!fb)
|
||||
return 0;
|
||||
|
||||
if (intel_plane_needs_remap(plane_state)) {
|
||||
intel_plane_remap_gtt(plane_state);
|
||||
|
||||
/*
|
||||
* Sometimes even remapping can't overcome
|
||||
* the stride limitations :( Can happen with
|
||||
* big plane sizes and suitably misaligned
|
||||
* offsets.
|
||||
*/
|
||||
return intel_plane_check_stride(plane_state);
|
||||
}
|
||||
|
||||
intel_fb_fill_view(fb, rotation, &plane_state->view);
|
||||
|
||||
/* Rotate src coordinates to match rotated GTT view */
|
||||
if (drm_rotation_90_or_270(rotation))
|
||||
drm_rect_rotate(&plane_state->uapi.src,
|
||||
fb->base.width << 16, fb->base.height << 16,
|
||||
DRM_MODE_ROTATE_270);
|
||||
|
||||
return intel_plane_check_stride(plane_state);
|
||||
}
|
54
drivers/gpu/drm/i915/display/intel_fb.h
Normal file
54
drivers/gpu/drm/i915/display/intel_fb.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
/*
|
||||
* Copyright © 2020-2021 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef __INTEL_FB_H__
|
||||
#define __INTEL_FB_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct drm_framebuffer;
|
||||
|
||||
struct drm_i915_private;
|
||||
|
||||
struct intel_fb_view;
|
||||
struct intel_framebuffer;
|
||||
struct intel_plane_state;
|
||||
|
||||
bool is_ccs_plane(const struct drm_framebuffer *fb, int plane);
|
||||
bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane);
|
||||
bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane);
|
||||
bool is_aux_plane(const struct drm_framebuffer *fb, int plane);
|
||||
bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane);
|
||||
|
||||
bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane);
|
||||
|
||||
int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane);
|
||||
int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane);
|
||||
int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane);
|
||||
|
||||
unsigned int intel_tile_size(const struct drm_i915_private *i915);
|
||||
unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane);
|
||||
unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_plane);
|
||||
|
||||
unsigned int intel_cursor_alignment(const struct drm_i915_private *i915);
|
||||
|
||||
void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
|
||||
const struct drm_framebuffer *fb,
|
||||
int color_plane);
|
||||
|
||||
u32 intel_plane_adjust_aligned_offset(int *x, int *y,
|
||||
const struct intel_plane_state *state,
|
||||
int color_plane,
|
||||
u32 old_offset, u32 new_offset);
|
||||
u32 intel_plane_compute_aligned_offset(int *x, int *y,
|
||||
const struct intel_plane_state *state,
|
||||
int color_plane);
|
||||
|
||||
int intel_fill_fb_info(struct drm_i915_private *i915, struct drm_framebuffer *fb);
|
||||
void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
|
||||
struct intel_fb_view *view);
|
||||
int intel_plane_compute_gtt(struct intel_plane_state *plane_state);
|
||||
|
||||
#endif /* __INTEL_FB_H__ */
|
@ -67,9 +67,9 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
|
||||
int lines;
|
||||
|
||||
intel_fbc_get_plane_source_size(cache, NULL, &lines);
|
||||
if (IS_GEN(dev_priv, 7))
|
||||
if (IS_DISPLAY_VER(dev_priv, 7))
|
||||
lines = min(lines, 2048);
|
||||
else if (INTEL_GEN(dev_priv) >= 8)
|
||||
else if (DISPLAY_VER(dev_priv) >= 8)
|
||||
lines = min(lines, 2560);
|
||||
|
||||
/* Hardware needs the full buffer stride, not just the active area. */
|
||||
@ -109,7 +109,7 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv)
|
||||
cfb_pitch = params->fb.stride;
|
||||
|
||||
/* FBC_CTL wants 32B or 64B units */
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
cfb_pitch = (cfb_pitch / 32) - 1;
|
||||
else
|
||||
cfb_pitch = (cfb_pitch / 64) - 1;
|
||||
@ -118,7 +118,7 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv)
|
||||
for (i = 0; i < (FBC_LL_SIZE / 32) + 1; i++)
|
||||
intel_de_write(dev_priv, FBC_TAG(i), 0);
|
||||
|
||||
if (IS_GEN(dev_priv, 4)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 4)) {
|
||||
u32 fbc_ctl2;
|
||||
|
||||
/* Set it up... */
|
||||
@ -222,9 +222,9 @@ static void snb_fbc_recompress(struct drm_i915_private *dev_priv)
|
||||
|
||||
static void intel_fbc_recompress(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 6)
|
||||
if (DISPLAY_VER(dev_priv) >= 6)
|
||||
snb_fbc_recompress(dev_priv);
|
||||
else if (INTEL_GEN(dev_priv) >= 4)
|
||||
else if (DISPLAY_VER(dev_priv) >= 4)
|
||||
i965_fbc_recompress(dev_priv);
|
||||
else
|
||||
i8xx_fbc_recompress(dev_priv);
|
||||
@ -255,16 +255,16 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv)
|
||||
|
||||
if (params->fence_id >= 0) {
|
||||
dpfc_ctl |= DPFC_CTL_FENCE_EN;
|
||||
if (IS_GEN(dev_priv, 5))
|
||||
if (IS_IRONLAKE(dev_priv))
|
||||
dpfc_ctl |= params->fence_id;
|
||||
if (IS_GEN(dev_priv, 6)) {
|
||||
if (IS_SANDYBRIDGE(dev_priv)) {
|
||||
intel_de_write(dev_priv, SNB_DPFC_CTL_SA,
|
||||
SNB_CPU_FENCE_ENABLE | params->fence_id);
|
||||
intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET,
|
||||
params->fence_y_offset);
|
||||
}
|
||||
} else {
|
||||
if (IS_GEN(dev_priv, 6)) {
|
||||
if (IS_SANDYBRIDGE(dev_priv)) {
|
||||
intel_de_write(dev_priv, SNB_DPFC_CTL_SA, 0);
|
||||
intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, 0);
|
||||
}
|
||||
@ -354,7 +354,7 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv)
|
||||
|
||||
static bool intel_fbc_hw_is_active(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 5)
|
||||
if (DISPLAY_VER(dev_priv) >= 5)
|
||||
return ilk_fbc_is_active(dev_priv);
|
||||
else if (IS_GM45(dev_priv))
|
||||
return g4x_fbc_is_active(dev_priv);
|
||||
@ -371,9 +371,9 @@ static void intel_fbc_hw_activate(struct drm_i915_private *dev_priv)
|
||||
fbc->active = true;
|
||||
fbc->activated = true;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 7)
|
||||
if (DISPLAY_VER(dev_priv) >= 7)
|
||||
gen7_fbc_activate(dev_priv);
|
||||
else if (INTEL_GEN(dev_priv) >= 5)
|
||||
else if (DISPLAY_VER(dev_priv) >= 5)
|
||||
ilk_fbc_activate(dev_priv);
|
||||
else if (IS_GM45(dev_priv))
|
||||
g4x_fbc_activate(dev_priv);
|
||||
@ -389,7 +389,7 @@ static void intel_fbc_hw_deactivate(struct drm_i915_private *dev_priv)
|
||||
|
||||
fbc->active = false;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5)
|
||||
if (DISPLAY_VER(dev_priv) >= 5)
|
||||
ilk_fbc_deactivate(dev_priv);
|
||||
else if (IS_GM45(dev_priv))
|
||||
g4x_fbc_deactivate(dev_priv);
|
||||
@ -426,7 +426,7 @@ static void intel_fbc_deactivate(struct drm_i915_private *dev_priv,
|
||||
|
||||
static u64 intel_fbc_cfb_base_max(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 5 || IS_G4X(i915))
|
||||
if (DISPLAY_VER(i915) >= 5 || IS_G4X(i915))
|
||||
return BIT_ULL(28);
|
||||
else
|
||||
return BIT_ULL(32);
|
||||
@ -473,7 +473,7 @@ again:
|
||||
|
||||
ret = i915_gem_stolen_insert_node_in_range(dev_priv, node, size >>= 1,
|
||||
4096, 0, end);
|
||||
if (ret && INTEL_GEN(dev_priv) <= 4) {
|
||||
if (ret && DISPLAY_VER(dev_priv) <= 4) {
|
||||
return 0;
|
||||
} else if (ret) {
|
||||
compression_threshold <<= 1;
|
||||
@ -504,7 +504,7 @@ static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv,
|
||||
|
||||
fbc->threshold = ret;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5)
|
||||
if (DISPLAY_VER(dev_priv) >= 5)
|
||||
intel_de_write(dev_priv, ILK_DPFC_CB_BASE,
|
||||
fbc->compressed_fb.start);
|
||||
else if (IS_GM45(dev_priv)) {
|
||||
@ -590,14 +590,14 @@ static bool stride_is_valid(struct drm_i915_private *dev_priv,
|
||||
if (stride < 512)
|
||||
return false;
|
||||
|
||||
if (IS_GEN(dev_priv, 2) || IS_GEN(dev_priv, 3))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2) || IS_DISPLAY_VER(dev_priv, 3))
|
||||
return stride == 4096 || stride == 8192;
|
||||
|
||||
if (IS_GEN(dev_priv, 4) && !IS_G4X(dev_priv) && stride < 2048)
|
||||
if (IS_DISPLAY_VER(dev_priv, 4) && !IS_G4X(dev_priv) && stride < 2048)
|
||||
return false;
|
||||
|
||||
/* Display WA #1105: skl,bxt,kbl,cfl,glk */
|
||||
if (IS_GEN(dev_priv, 9) &&
|
||||
if (IS_DISPLAY_VER(dev_priv, 9) &&
|
||||
modifier == DRM_FORMAT_MOD_LINEAR && stride & 511)
|
||||
return false;
|
||||
|
||||
@ -617,7 +617,7 @@ static bool pixel_format_is_valid(struct drm_i915_private *dev_priv,
|
||||
case DRM_FORMAT_XRGB1555:
|
||||
case DRM_FORMAT_RGB565:
|
||||
/* 16bpp not supported on gen2 */
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
return false;
|
||||
/* WaFbcOnly1to1Ratio:ctg */
|
||||
if (IS_G4X(dev_priv))
|
||||
@ -631,10 +631,10 @@ static bool pixel_format_is_valid(struct drm_i915_private *dev_priv,
|
||||
static bool rotation_is_valid(struct drm_i915_private *dev_priv,
|
||||
u32 pixel_format, unsigned int rotation)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 9 && pixel_format == DRM_FORMAT_RGB565 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 9 && pixel_format == DRM_FORMAT_RGB565 &&
|
||||
drm_rotation_90_or_270(rotation))
|
||||
return false;
|
||||
else if (INTEL_GEN(dev_priv) <= 4 && !IS_G4X(dev_priv) &&
|
||||
else if (DISPLAY_VER(dev_priv) <= 4 && !IS_G4X(dev_priv) &&
|
||||
rotation != DRM_MODE_ROTATE_0)
|
||||
return false;
|
||||
|
||||
@ -653,13 +653,13 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc)
|
||||
struct intel_fbc *fbc = &dev_priv->fbc;
|
||||
unsigned int effective_w, effective_h, max_w, max_h;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
|
||||
if (DISPLAY_VER(dev_priv) >= 10) {
|
||||
max_w = 5120;
|
||||
max_h = 4096;
|
||||
} else if (INTEL_GEN(dev_priv) >= 8 || IS_HASWELL(dev_priv)) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 8 || IS_HASWELL(dev_priv)) {
|
||||
max_w = 4096;
|
||||
max_h = 4096;
|
||||
} else if (IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5) {
|
||||
} else if (IS_G4X(dev_priv) || DISPLAY_VER(dev_priv) >= 5) {
|
||||
max_w = 4096;
|
||||
max_h = 2048;
|
||||
} else {
|
||||
@ -680,7 +680,7 @@ static bool tiling_is_valid(struct drm_i915_private *dev_priv,
|
||||
{
|
||||
switch (modifier) {
|
||||
case DRM_FORMAT_MOD_LINEAR:
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
return true;
|
||||
return false;
|
||||
case I915_FORMAT_MOD_X_TILED:
|
||||
@ -716,8 +716,8 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
|
||||
*/
|
||||
cache->plane.src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
cache->plane.src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
|
||||
cache->plane.adjusted_x = plane_state->color_plane[0].x;
|
||||
cache->plane.adjusted_y = plane_state->color_plane[0].y;
|
||||
cache->plane.adjusted_x = plane_state->view.color_plane[0].x;
|
||||
cache->plane.adjusted_y = plane_state->view.color_plane[0].y;
|
||||
|
||||
cache->plane.pixel_blend_mode = plane_state->hw.pixel_blend_mode;
|
||||
|
||||
@ -725,7 +725,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
|
||||
cache->fb.modifier = fb->modifier;
|
||||
|
||||
/* FIXME is this correct? */
|
||||
cache->fb.stride = plane_state->color_plane[0].stride;
|
||||
cache->fb.stride = plane_state->view.color_plane[0].stride;
|
||||
if (drm_rotation_90_or_270(plane_state->hw.rotation))
|
||||
cache->fb.stride *= fb->format->cpp[0];
|
||||
|
||||
@ -844,7 +844,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
|
||||
* For now this will effectively disable FBC with 90/270 degree
|
||||
* rotation.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) < 9 && cache->fence_id < 0) {
|
||||
if (DISPLAY_VER(dev_priv) < 9 && cache->fence_id < 0) {
|
||||
fbc->no_fbc_reason = "framebuffer not tiled or fenced";
|
||||
return false;
|
||||
}
|
||||
@ -903,14 +903,14 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
|
||||
* having a Y offset that isn't divisible by 4 causes FIFO underrun
|
||||
* and screen flicker.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 9 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 9 &&
|
||||
(fbc->state_cache.plane.adjusted_y & 3)) {
|
||||
fbc->no_fbc_reason = "plane Y offset is misaligned";
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Wa_22010751166: icl, ehl, tgl, dg1, rkl */
|
||||
if (INTEL_GEN(dev_priv) >= 11 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 11 &&
|
||||
(cache->plane.src_h + cache->plane.adjusted_y) % 4) {
|
||||
fbc->no_fbc_reason = "plane height + offset is non-modulo of 4";
|
||||
return false;
|
||||
@ -1036,7 +1036,7 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state,
|
||||
* if at least one frame has already passed.
|
||||
*/
|
||||
if (fbc->activated &&
|
||||
(INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
|
||||
DISPLAY_VER(dev_priv) >= 10)
|
||||
need_vblank_wait = true;
|
||||
fbc->activated = false;
|
||||
}
|
||||
@ -1445,7 +1445,7 @@ static int intel_sanitize_fbc_option(struct drm_i915_private *dev_priv)
|
||||
if (!HAS_FBC(dev_priv))
|
||||
return 0;
|
||||
|
||||
if (IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9)
|
||||
if (IS_BROADWELL(dev_priv) || DISPLAY_VER(dev_priv) >= 9)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -373,7 +373,7 @@ static void gen6_fdi_link_train(struct intel_crtc *crtc,
|
||||
temp = intel_de_read(dev_priv, reg);
|
||||
temp &= ~FDI_LINK_TRAIN_NONE;
|
||||
temp |= FDI_LINK_TRAIN_PATTERN_2;
|
||||
if (IS_GEN(dev_priv, 6)) {
|
||||
if (IS_SANDYBRIDGE(dev_priv)) {
|
||||
temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
|
||||
/* SNB-B */
|
||||
temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B;
|
||||
@ -810,9 +810,9 @@ void ilk_fdi_disable(struct intel_crtc *crtc)
|
||||
void
|
||||
intel_fdi_init_hook(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (IS_GEN(dev_priv, 5)) {
|
||||
if (IS_IRONLAKE(dev_priv)) {
|
||||
dev_priv->display.fdi_link_train = ilk_fdi_link_train;
|
||||
} else if (IS_GEN(dev_priv, 6)) {
|
||||
} else if (IS_SANDYBRIDGE(dev_priv)) {
|
||||
dev_priv->display.fdi_link_train = gen6_fdi_link_train;
|
||||
} else if (IS_IVYBRIDGE(dev_priv)) {
|
||||
/* FIXME: detect B0+ stepping and use auto training */
|
||||
|
@ -269,11 +269,11 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
|
||||
|
||||
if (HAS_GMCH(dev_priv))
|
||||
i9xx_set_fifo_underrun_reporting(dev, pipe, enable, old);
|
||||
else if (IS_GEN_RANGE(dev_priv, 5, 6))
|
||||
else if (IS_IRONLAKE(dev_priv) || IS_SANDYBRIDGE(dev_priv))
|
||||
ilk_set_fifo_underrun_reporting(dev, pipe, enable);
|
||||
else if (IS_GEN(dev_priv, 7))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 7))
|
||||
ivb_set_fifo_underrun_reporting(dev, pipe, enable, old);
|
||||
else if (INTEL_GEN(dev_priv) >= 8)
|
||||
else if (DISPLAY_VER(dev_priv) >= 8)
|
||||
bdw_set_fifo_underrun_reporting(dev, pipe, enable);
|
||||
|
||||
return old;
|
||||
@ -432,7 +432,7 @@ void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv)
|
||||
|
||||
if (HAS_GMCH(dev_priv))
|
||||
i9xx_check_fifo_underruns(crtc);
|
||||
else if (IS_GEN(dev_priv, 7))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 7))
|
||||
ivb_check_fifo_underruns(crtc);
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv)
|
||||
|
||||
static unsigned int gmbus_max_xfer_size(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return INTEL_GEN(dev_priv) >= 9 ? GEN9_GMBUS_BYTE_COUNT_MAX :
|
||||
return DISPLAY_VER(dev_priv) >= 9 ? GEN9_GMBUS_BYTE_COUNT_MAX :
|
||||
GMBUS_BYTE_COUNT_MAX;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,21 @@ static int intel_conn_to_vcpi(struct intel_connector *connector)
|
||||
return connector->port ? connector->port->vcpi.vcpi : 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
intel_streams_type1_capable(struct intel_connector *connector)
|
||||
{
|
||||
const struct intel_hdcp_shim *shim = connector->hdcp.shim;
|
||||
bool capable = false;
|
||||
|
||||
if (!shim)
|
||||
return capable;
|
||||
|
||||
if (shim->streams_type1_capable)
|
||||
shim->streams_type1_capable(connector, &capable);
|
||||
|
||||
return capable;
|
||||
}
|
||||
|
||||
/*
|
||||
* intel_hdcp_required_content_stream selects the most highest common possible HDCP
|
||||
* content_type for all streams in DP MST topology because security f/w doesn't
|
||||
@ -70,7 +85,7 @@ intel_hdcp_required_content_stream(struct intel_digital_port *dig_port)
|
||||
if (conn_dig_port != dig_port)
|
||||
continue;
|
||||
|
||||
if (!enforce_type0 && !intel_hdcp2_capable(connector))
|
||||
if (!enforce_type0 && !intel_streams_type1_capable(connector))
|
||||
enforce_type0 = true;
|
||||
|
||||
data->streams[data->k].stream_id = intel_conn_to_vcpi(connector);
|
||||
@ -318,7 +333,7 @@ static
|
||||
u32 intel_hdcp_get_repeater_ctl(struct drm_i915_private *dev_priv,
|
||||
enum transcoder cpu_transcoder, enum port port)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
switch (cpu_transcoder) {
|
||||
case TRANSCODER_A:
|
||||
return HDCP_TRANSA_REP_PRESENT |
|
||||
@ -1089,7 +1104,7 @@ static void intel_hdcp_prop_work(struct work_struct *work)
|
||||
bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port)
|
||||
{
|
||||
return INTEL_INFO(dev_priv)->display.has_hdcp &&
|
||||
(INTEL_GEN(dev_priv) >= 12 || port < PORT_E);
|
||||
(DISPLAY_VER(dev_priv) >= 12 || port < PORT_E);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1706,6 +1721,7 @@ static int hdcp2_enable_stream_encryption(struct intel_connector *connector)
|
||||
{
|
||||
struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
|
||||
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
|
||||
struct hdcp_port_data *data = &dig_port->hdcp_port_data;
|
||||
struct intel_hdcp *hdcp = &connector->hdcp;
|
||||
enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
|
||||
enum port port = dig_port->base.port;
|
||||
@ -1715,7 +1731,8 @@ static int hdcp2_enable_stream_encryption(struct intel_connector *connector)
|
||||
LINK_ENCRYPTION_STATUS)) {
|
||||
drm_err(&dev_priv->drm, "[%s:%d] HDCP 2.2 Link is not encrypted\n",
|
||||
connector->base.name, connector->base.base.id);
|
||||
return -EPERM;
|
||||
ret = -EPERM;
|
||||
goto link_recover;
|
||||
}
|
||||
|
||||
if (hdcp->shim->stream_2_2_encryption) {
|
||||
@ -1729,6 +1746,15 @@ static int hdcp2_enable_stream_encryption(struct intel_connector *connector)
|
||||
transcoder_name(hdcp->stream_transcoder));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
link_recover:
|
||||
if (hdcp2_deauthenticate_port(connector) < 0)
|
||||
drm_dbg_kms(&dev_priv->drm, "Port deauth failed.\n");
|
||||
|
||||
dig_port->hdcp_auth_status = false;
|
||||
data->k = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1885,7 +1911,8 @@ static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector)
|
||||
}
|
||||
}
|
||||
|
||||
ret = hdcp2_enable_stream_encryption(connector);
|
||||
if (!ret)
|
||||
ret = hdcp2_enable_stream_encryption(connector);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1927,7 +1954,8 @@ static int _intel_hdcp2_enable(struct intel_connector *connector)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _intel_hdcp2_disable(struct intel_connector *connector)
|
||||
static int
|
||||
_intel_hdcp2_disable(struct intel_connector *connector, bool hdcp2_link_recovery)
|
||||
{
|
||||
struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
|
||||
struct drm_i915_private *i915 = to_i915(connector->base.dev);
|
||||
@ -1948,7 +1976,7 @@ static int _intel_hdcp2_disable(struct intel_connector *connector)
|
||||
drm_dbg_kms(&i915->drm, "HDCP 2.2 transcoder: %s stream encryption disabled\n",
|
||||
transcoder_name(hdcp->stream_transcoder));
|
||||
|
||||
if (dig_port->num_hdcp_streams > 0)
|
||||
if (dig_port->num_hdcp_streams > 0 && !hdcp2_link_recovery)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1991,6 +2019,7 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
|
||||
"HDCP2.2 link stopped the encryption, %x\n",
|
||||
intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)));
|
||||
ret = -ENXIO;
|
||||
_intel_hdcp2_disable(connector, true);
|
||||
intel_hdcp_update_value(connector,
|
||||
DRM_MODE_CONTENT_PROTECTION_DESIRED,
|
||||
true);
|
||||
@ -2030,7 +2059,7 @@ static int intel_hdcp2_check_link(struct intel_connector *connector)
|
||||
connector->base.name, connector->base.base.id);
|
||||
}
|
||||
|
||||
ret = _intel_hdcp2_disable(connector);
|
||||
ret = _intel_hdcp2_disable(connector, true);
|
||||
if (ret) {
|
||||
drm_err(&dev_priv->drm,
|
||||
"[%s:%d] Failed to disable hdcp2.2 (%d)\n",
|
||||
@ -2137,7 +2166,7 @@ static int initialize_hdcp_port_data(struct intel_connector *connector,
|
||||
struct intel_hdcp *hdcp = &connector->hdcp;
|
||||
enum port port = dig_port->base.port;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12)
|
||||
if (DISPLAY_VER(dev_priv) < 12)
|
||||
data->fw_ddi = intel_get_mei_fw_ddi_index(port);
|
||||
else
|
||||
/*
|
||||
@ -2176,8 +2205,7 @@ static bool is_hdcp2_supported(struct drm_i915_private *dev_priv)
|
||||
if (!IS_ENABLED(CONFIG_INTEL_MEI_HDCP))
|
||||
return false;
|
||||
|
||||
return (INTEL_GEN(dev_priv) >= 10 ||
|
||||
IS_GEMINILAKE(dev_priv) ||
|
||||
return (DISPLAY_VER(dev_priv) >= 10 ||
|
||||
IS_KABYLAKE(dev_priv) ||
|
||||
IS_COFFEELAKE(dev_priv) ||
|
||||
IS_COMETLAKE(dev_priv));
|
||||
@ -2288,7 +2316,7 @@ int intel_hdcp_enable(struct intel_connector *connector,
|
||||
hdcp->stream_transcoder = INVALID_TRANSCODER;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
dig_port->hdcp_port_data.fw_tc = intel_get_mei_fw_tc(hdcp->cpu_transcoder);
|
||||
|
||||
/*
|
||||
@ -2340,7 +2368,7 @@ int intel_hdcp_disable(struct intel_connector *connector)
|
||||
intel_hdcp_update_value(connector,
|
||||
DRM_MODE_CONTENT_PROTECTION_UNDESIRED, false);
|
||||
if (hdcp->hdcp2_encrypted)
|
||||
ret = _intel_hdcp2_disable(connector);
|
||||
ret = _intel_hdcp2_disable(connector, false);
|
||||
else if (hdcp->hdcp_encrypted)
|
||||
ret = _intel_hdcp_disable(connector);
|
||||
|
||||
|
@ -41,21 +41,15 @@
|
||||
#include "i915_debugfs.h"
|
||||
#include "i915_drv.h"
|
||||
#include "intel_atomic.h"
|
||||
#include "intel_audio.h"
|
||||
#include "intel_connector.h"
|
||||
#include "intel_ddi.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_dp.h"
|
||||
#include "intel_dpio_phy.h"
|
||||
#include "intel_fifo_underrun.h"
|
||||
#include "intel_gmbus.h"
|
||||
#include "intel_hdcp.h"
|
||||
#include "intel_hdmi.h"
|
||||
#include "intel_hotplug.h"
|
||||
#include "intel_lspcon.h"
|
||||
#include "intel_panel.h"
|
||||
#include "intel_sdvo.h"
|
||||
#include "intel_sideband.h"
|
||||
|
||||
static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi)
|
||||
{
|
||||
@ -86,19 +80,6 @@ assert_hdmi_transcoder_func_disabled(struct drm_i915_private *dev_priv,
|
||||
"HDMI transcoder function enabled, expecting disabled\n");
|
||||
}
|
||||
|
||||
struct intel_hdmi *enc_to_intel_hdmi(struct intel_encoder *encoder)
|
||||
{
|
||||
struct intel_digital_port *dig_port =
|
||||
container_of(&encoder->base, struct intel_digital_port,
|
||||
base.base);
|
||||
return &dig_port->hdmi;
|
||||
}
|
||||
|
||||
static struct intel_hdmi *intel_attached_hdmi(struct intel_connector *connector)
|
||||
{
|
||||
return enc_to_intel_hdmi(intel_attached_encoder(connector));
|
||||
}
|
||||
|
||||
static u32 g4x_infoframe_index(unsigned int type)
|
||||
{
|
||||
switch (type) {
|
||||
@ -200,7 +181,7 @@ static int hsw_dip_data_size(struct drm_i915_private *dev_priv,
|
||||
case DP_SDP_PPS:
|
||||
return VIDEO_DIP_PPS_DATA_SIZE;
|
||||
case HDMI_PACKET_TYPE_GAMUT_METADATA:
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
return VIDEO_DIP_GMP_DATA_SIZE;
|
||||
else
|
||||
return VIDEO_DIP_DATA_SIZE;
|
||||
@ -583,7 +564,7 @@ static u32 hsw_infoframes_enabled(struct intel_encoder *encoder,
|
||||
VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
|
||||
VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
mask |= VIDEO_DIP_ENABLE_DRM_GLK;
|
||||
|
||||
return val & mask;
|
||||
@ -839,7 +820,7 @@ intel_hdmi_compute_drm_infoframe(struct intel_encoder *encoder,
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
int ret;
|
||||
|
||||
if (!(INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)))
|
||||
if (DISPLAY_VER(dev_priv) < 10)
|
||||
return true;
|
||||
|
||||
if (!crtc_state->has_infoframe)
|
||||
@ -1789,379 +1770,16 @@ static const struct intel_hdcp_shim intel_hdmi_hdcp_shim = {
|
||||
.protocol = HDCP_PROTOCOL_HDMI,
|
||||
};
|
||||
|
||||
static void intel_hdmi_prepare(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
|
||||
u32 hdmi_val;
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
|
||||
|
||||
hdmi_val = SDVO_ENCODING_HDMI;
|
||||
if (!HAS_PCH_SPLIT(dev_priv) && crtc_state->limited_color_range)
|
||||
hdmi_val |= HDMI_COLOR_RANGE_16_235;
|
||||
if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
|
||||
hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH;
|
||||
if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
|
||||
hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH;
|
||||
|
||||
if (crtc_state->pipe_bpp > 24)
|
||||
hdmi_val |= HDMI_COLOR_FORMAT_12bpc;
|
||||
else
|
||||
hdmi_val |= SDVO_COLOR_FORMAT_8bpc;
|
||||
|
||||
if (crtc_state->has_hdmi_sink)
|
||||
hdmi_val |= HDMI_MODE_SELECT_HDMI;
|
||||
|
||||
if (HAS_PCH_CPT(dev_priv))
|
||||
hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe);
|
||||
else if (IS_CHERRYVIEW(dev_priv))
|
||||
hdmi_val |= SDVO_PIPE_SEL_CHV(crtc->pipe);
|
||||
else
|
||||
hdmi_val |= SDVO_PIPE_SEL(crtc->pipe);
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, hdmi_val);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
}
|
||||
|
||||
static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
|
||||
enum pipe *pipe)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
intel_wakeref_t wakeref;
|
||||
bool ret;
|
||||
|
||||
wakeref = intel_display_power_get_if_enabled(dev_priv,
|
||||
encoder->power_domain);
|
||||
if (!wakeref)
|
||||
return false;
|
||||
|
||||
ret = intel_sdvo_port_enabled(dev_priv, intel_hdmi->hdmi_reg, pipe);
|
||||
|
||||
intel_display_power_put(dev_priv, encoder->power_domain, wakeref);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void intel_hdmi_get_config(struct intel_encoder *encoder,
|
||||
struct intel_crtc_state *pipe_config)
|
||||
{
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
u32 tmp, flags = 0;
|
||||
int dotclock;
|
||||
|
||||
pipe_config->output_types |= BIT(INTEL_OUTPUT_HDMI);
|
||||
|
||||
tmp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
if (tmp & SDVO_HSYNC_ACTIVE_HIGH)
|
||||
flags |= DRM_MODE_FLAG_PHSYNC;
|
||||
else
|
||||
flags |= DRM_MODE_FLAG_NHSYNC;
|
||||
|
||||
if (tmp & SDVO_VSYNC_ACTIVE_HIGH)
|
||||
flags |= DRM_MODE_FLAG_PVSYNC;
|
||||
else
|
||||
flags |= DRM_MODE_FLAG_NVSYNC;
|
||||
|
||||
if (tmp & HDMI_MODE_SELECT_HDMI)
|
||||
pipe_config->has_hdmi_sink = true;
|
||||
|
||||
pipe_config->infoframes.enable |=
|
||||
intel_hdmi_infoframes_enabled(encoder, pipe_config);
|
||||
|
||||
if (pipe_config->infoframes.enable)
|
||||
pipe_config->has_infoframe = true;
|
||||
|
||||
if (tmp & HDMI_AUDIO_ENABLE)
|
||||
pipe_config->has_audio = true;
|
||||
|
||||
if (!HAS_PCH_SPLIT(dev_priv) &&
|
||||
tmp & HDMI_COLOR_RANGE_16_235)
|
||||
pipe_config->limited_color_range = true;
|
||||
|
||||
pipe_config->hw.adjusted_mode.flags |= flags;
|
||||
|
||||
if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc)
|
||||
dotclock = pipe_config->port_clock * 2 / 3;
|
||||
else
|
||||
dotclock = pipe_config->port_clock;
|
||||
|
||||
if (pipe_config->pixel_multiplier)
|
||||
dotclock /= pipe_config->pixel_multiplier;
|
||||
|
||||
pipe_config->hw.adjusted_mode.crtc_clock = dotclock;
|
||||
|
||||
pipe_config->lane_count = 4;
|
||||
|
||||
intel_hdmi_read_gcp_infoframe(encoder, pipe_config);
|
||||
|
||||
intel_read_infoframe(encoder, pipe_config,
|
||||
HDMI_INFOFRAME_TYPE_AVI,
|
||||
&pipe_config->infoframes.avi);
|
||||
intel_read_infoframe(encoder, pipe_config,
|
||||
HDMI_INFOFRAME_TYPE_SPD,
|
||||
&pipe_config->infoframes.spd);
|
||||
intel_read_infoframe(encoder, pipe_config,
|
||||
HDMI_INFOFRAME_TYPE_VENDOR,
|
||||
&pipe_config->infoframes.hdmi);
|
||||
}
|
||||
|
||||
static void intel_enable_hdmi_audio(struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(encoder->base.dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
|
||||
|
||||
drm_WARN_ON(&i915->drm, !pipe_config->has_hdmi_sink);
|
||||
drm_dbg_kms(&i915->drm, "Enabling HDMI audio on pipe %c\n",
|
||||
pipe_name(crtc->pipe));
|
||||
intel_audio_codec_enable(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void g4x_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp |= SDVO_ENABLE;
|
||||
if (pipe_config->has_audio)
|
||||
temp |= HDMI_AUDIO_ENABLE;
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
if (pipe_config->has_audio)
|
||||
intel_enable_hdmi_audio(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void ibx_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp |= SDVO_ENABLE;
|
||||
if (pipe_config->has_audio)
|
||||
temp |= HDMI_AUDIO_ENABLE;
|
||||
|
||||
/*
|
||||
* HW workaround, need to write this twice for issue
|
||||
* that may result in first write getting masked.
|
||||
*/
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
/*
|
||||
* HW workaround, need to toggle enable bit off and on
|
||||
* for 12bpc with pixel repeat.
|
||||
*
|
||||
* FIXME: BSpec says this should be done at the end of
|
||||
* of the modeset sequence, so not sure if this isn't too soon.
|
||||
*/
|
||||
if (pipe_config->pipe_bpp > 24 &&
|
||||
pipe_config->pixel_multiplier > 1) {
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg,
|
||||
temp & ~SDVO_ENABLE);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
/*
|
||||
* HW workaround, need to write this twice for issue
|
||||
* that may result in first write getting masked.
|
||||
*/
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
}
|
||||
|
||||
if (pipe_config->has_audio)
|
||||
intel_enable_hdmi_audio(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void cpt_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
enum pipe pipe = crtc->pipe;
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp |= SDVO_ENABLE;
|
||||
if (pipe_config->has_audio)
|
||||
temp |= HDMI_AUDIO_ENABLE;
|
||||
|
||||
/*
|
||||
* WaEnableHDMI8bpcBefore12bpc:snb,ivb
|
||||
*
|
||||
* The procedure for 12bpc is as follows:
|
||||
* 1. disable HDMI clock gating
|
||||
* 2. enable HDMI with 8bpc
|
||||
* 3. enable HDMI with 12bpc
|
||||
* 4. enable HDMI clock gating
|
||||
*/
|
||||
|
||||
if (pipe_config->pipe_bpp > 24) {
|
||||
intel_de_write(dev_priv, TRANS_CHICKEN1(pipe),
|
||||
intel_de_read(dev_priv, TRANS_CHICKEN1(pipe)) | TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE);
|
||||
|
||||
temp &= ~SDVO_COLOR_FORMAT_MASK;
|
||||
temp |= SDVO_COLOR_FORMAT_8bpc;
|
||||
}
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
if (pipe_config->pipe_bpp > 24) {
|
||||
temp &= ~SDVO_COLOR_FORMAT_MASK;
|
||||
temp |= HDMI_COLOR_FORMAT_12bpc;
|
||||
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
intel_de_write(dev_priv, TRANS_CHICKEN1(pipe),
|
||||
intel_de_read(dev_priv, TRANS_CHICKEN1(pipe)) & ~TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE);
|
||||
}
|
||||
|
||||
if (pipe_config->has_audio)
|
||||
intel_enable_hdmi_audio(encoder, pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void vlv_enable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
}
|
||||
|
||||
static void intel_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
struct intel_digital_port *dig_port =
|
||||
hdmi_to_dig_port(intel_hdmi);
|
||||
struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
|
||||
u32 temp;
|
||||
|
||||
temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp &= ~(SDVO_ENABLE | HDMI_AUDIO_ENABLE);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
/*
|
||||
* HW workaround for IBX, we need to move the port
|
||||
* to transcoder A after disabling it to allow the
|
||||
* matching DP port to be enabled on transcoder A.
|
||||
*/
|
||||
if (HAS_PCH_IBX(dev_priv) && crtc->pipe == PIPE_B) {
|
||||
/*
|
||||
* We get CPU/PCH FIFO underruns on the other pipe when
|
||||
* doing the workaround. Sweep them under the rug.
|
||||
*/
|
||||
intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
|
||||
intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
|
||||
|
||||
temp &= ~SDVO_PIPE_SEL_MASK;
|
||||
temp |= SDVO_ENABLE | SDVO_PIPE_SEL(PIPE_A);
|
||||
/*
|
||||
* HW workaround, need to write this twice for issue
|
||||
* that may result in first write getting masked.
|
||||
*/
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
temp &= ~SDVO_ENABLE;
|
||||
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
|
||||
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
|
||||
|
||||
intel_wait_for_vblank_if_active(dev_priv, PIPE_A);
|
||||
intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
|
||||
intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
|
||||
}
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
false,
|
||||
old_crtc_state, old_conn_state);
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
|
||||
}
|
||||
|
||||
static void g4x_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
if (old_crtc_state->has_audio)
|
||||
intel_audio_codec_disable(encoder,
|
||||
old_crtc_state, old_conn_state);
|
||||
|
||||
intel_disable_hdmi(state, encoder, old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
||||
static void pch_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
if (old_crtc_state->has_audio)
|
||||
intel_audio_codec_disable(encoder,
|
||||
old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
||||
static void pch_post_disable_hdmi(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
intel_disable_hdmi(state, encoder, old_crtc_state, old_conn_state);
|
||||
}
|
||||
|
||||
static int intel_hdmi_source_max_tmds_clock(struct intel_encoder *encoder)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
int max_tmds_clock, vbt_max_tmds_clock;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
max_tmds_clock = 594000;
|
||||
else if (INTEL_GEN(dev_priv) >= 8 || IS_HASWELL(dev_priv))
|
||||
else if (DISPLAY_VER(dev_priv) >= 8 || IS_HASWELL(dev_priv))
|
||||
max_tmds_clock = 300000;
|
||||
else if (INTEL_GEN(dev_priv) >= 5)
|
||||
else if (DISPLAY_VER(dev_priv) >= 5)
|
||||
max_tmds_clock = 225000;
|
||||
else
|
||||
max_tmds_clock = 165000;
|
||||
@ -2284,7 +1902,7 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
|
||||
true, has_hdmi_sink);
|
||||
|
||||
/* if we can't do 8,12bpc we may still be able to do 10bpc */
|
||||
if (status != MODE_OK && INTEL_GEN(dev_priv) >= 11)
|
||||
if (status != MODE_OK && DISPLAY_VER(dev_priv) >= 11)
|
||||
status = hdmi_port_clock_valid(hdmi, intel_hdmi_port_clock(clock, 10),
|
||||
true, has_hdmi_sink);
|
||||
}
|
||||
@ -2347,7 +1965,7 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state,
|
||||
if (HAS_GMCH(dev_priv))
|
||||
return false;
|
||||
|
||||
if (bpc == 10 && INTEL_GEN(dev_priv) < 11)
|
||||
if (bpc == 10 && DISPLAY_VER(dev_priv) < 11)
|
||||
return false;
|
||||
|
||||
/*
|
||||
@ -2359,7 +1977,7 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state,
|
||||
|
||||
/* Display Wa_1405510057:icl,ehl */
|
||||
if (crtc_state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 &&
|
||||
bpc == 10 && IS_GEN(dev_priv, 11) &&
|
||||
bpc == 10 && IS_DISPLAY_VER(dev_priv, 11) &&
|
||||
(adjusted_mode->crtc_hblank_end -
|
||||
adjusted_mode->crtc_hblank_start) % 8 == 2)
|
||||
return false;
|
||||
@ -2546,8 +2164,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
|
||||
|
||||
pipe_config->lane_count = 4;
|
||||
|
||||
if (scdc->scrambling.supported && (INTEL_GEN(dev_priv) >= 10 ||
|
||||
IS_GEMINILAKE(dev_priv))) {
|
||||
if (scdc->scrambling.supported && DISPLAY_VER(dev_priv) >= 10) {
|
||||
if (scdc->scrambling.low_rates)
|
||||
pipe_config->hdmi_scrambling = true;
|
||||
|
||||
@ -2705,7 +2322,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
|
||||
|
||||
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 11 &&
|
||||
!intel_digital_port_connected(encoder))
|
||||
goto out;
|
||||
|
||||
@ -2756,125 +2373,6 @@ static int intel_hdmi_get_modes(struct drm_connector *connector)
|
||||
return intel_connector_update_modes(connector, edid);
|
||||
}
|
||||
|
||||
static void intel_hdmi_pre_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct intel_digital_port *dig_port =
|
||||
enc_to_dig_port(encoder);
|
||||
|
||||
intel_hdmi_prepare(encoder, pipe_config);
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
pipe_config->has_infoframe,
|
||||
pipe_config, conn_state);
|
||||
}
|
||||
|
||||
static void vlv_hdmi_pre_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
|
||||
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
|
||||
|
||||
vlv_phy_pre_encoder_enable(encoder, pipe_config);
|
||||
|
||||
/* HDMI 1.0V-2dB */
|
||||
vlv_set_phy_signal_level(encoder, pipe_config,
|
||||
0x2b245f5f, 0x00002000,
|
||||
0x5578b83a, 0x2b247878);
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
pipe_config->has_infoframe,
|
||||
pipe_config, conn_state);
|
||||
|
||||
g4x_enable_hdmi(state, encoder, pipe_config, conn_state);
|
||||
|
||||
vlv_wait_port_ready(dev_priv, dig_port, 0x0);
|
||||
}
|
||||
|
||||
static void vlv_hdmi_pre_pll_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
intel_hdmi_prepare(encoder, pipe_config);
|
||||
|
||||
vlv_phy_pre_pll_enable(encoder, pipe_config);
|
||||
}
|
||||
|
||||
static void chv_hdmi_pre_pll_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
intel_hdmi_prepare(encoder, pipe_config);
|
||||
|
||||
chv_phy_pre_pll_enable(encoder, pipe_config);
|
||||
}
|
||||
|
||||
static void chv_hdmi_post_pll_disable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
chv_phy_post_pll_disable(encoder, old_crtc_state);
|
||||
}
|
||||
|
||||
static void vlv_hdmi_post_disable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
/* Reset lanes to avoid HDMI flicker (VLV w/a) */
|
||||
vlv_phy_reset_lanes(encoder, old_crtc_state);
|
||||
}
|
||||
|
||||
static void chv_hdmi_post_disable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *old_crtc_state,
|
||||
const struct drm_connector_state *old_conn_state)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
|
||||
vlv_dpio_get(dev_priv);
|
||||
|
||||
/* Assert data lane reset */
|
||||
chv_data_lane_soft_reset(encoder, old_crtc_state, true);
|
||||
|
||||
vlv_dpio_put(dev_priv);
|
||||
}
|
||||
|
||||
static void chv_hdmi_pre_enable(struct intel_atomic_state *state,
|
||||
struct intel_encoder *encoder,
|
||||
const struct intel_crtc_state *pipe_config,
|
||||
const struct drm_connector_state *conn_state)
|
||||
{
|
||||
struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
|
||||
chv_phy_pre_encoder_enable(encoder, pipe_config);
|
||||
|
||||
/* FIXME: Program the support xxx V-dB */
|
||||
/* Use 800mV-0dB */
|
||||
chv_set_phy_signal_level(encoder, pipe_config, 128, 102, false);
|
||||
|
||||
dig_port->set_infoframes(encoder,
|
||||
pipe_config->has_infoframe,
|
||||
pipe_config, conn_state);
|
||||
|
||||
g4x_enable_hdmi(state, encoder, pipe_config, conn_state);
|
||||
|
||||
vlv_wait_port_ready(dev_priv, dig_port, 0x0);
|
||||
|
||||
/* Second common lane will stay alive on its own now */
|
||||
chv_phy_release_cl2_override(encoder);
|
||||
}
|
||||
|
||||
static struct i2c_adapter *
|
||||
intel_hdmi_get_i2c_adapter(struct drm_connector *connector)
|
||||
{
|
||||
@ -2949,10 +2447,6 @@ static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs
|
||||
.atomic_check = intel_digital_connector_atomic_check,
|
||||
};
|
||||
|
||||
static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
|
||||
.destroy = intel_encoder_destroy,
|
||||
};
|
||||
|
||||
static void
|
||||
intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
|
||||
{
|
||||
@ -2965,7 +2459,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
|
||||
intel_attach_hdmi_colorspace_property(connector);
|
||||
drm_connector_attach_content_type_property(connector);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
drm_object_attach_property(&connector->base,
|
||||
connector->dev->mode_config.hdr_output_metadata_property, 0);
|
||||
|
||||
@ -3298,7 +2792,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
|
||||
"Adding HDMI connector on [ENCODER:%d:%s]\n",
|
||||
intel_encoder->base.base.id, intel_encoder->base.name);
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12 && drm_WARN_ON(dev, port == PORT_A))
|
||||
if (DISPLAY_VER(dev_priv) < 12 && drm_WARN_ON(dev, port == PORT_A))
|
||||
return;
|
||||
|
||||
if (drm_WARN(dev, dig_port->max_lanes < 4,
|
||||
@ -3320,7 +2814,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
|
||||
connector->doublescan_allowed = 0;
|
||||
connector->stereo_allowed = 1;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
connector->ycbcr_420_allowed = true;
|
||||
|
||||
intel_connector->polled = DRM_CONNECTOR_POLL_HPD;
|
||||
@ -3362,119 +2856,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
|
||||
drm_dbg_kms(&dev_priv->drm, "CEC notifier get failed\n");
|
||||
}
|
||||
|
||||
static enum intel_hotplug_state
|
||||
intel_hdmi_hotplug(struct intel_encoder *encoder,
|
||||
struct intel_connector *connector)
|
||||
{
|
||||
enum intel_hotplug_state state;
|
||||
|
||||
state = intel_encoder_hotplug(encoder, connector);
|
||||
|
||||
/*
|
||||
* On many platforms the HDMI live state signal is known to be
|
||||
* unreliable, so we can't use it to detect if a sink is connected or
|
||||
* not. Instead we detect if it's connected based on whether we can
|
||||
* read the EDID or not. That in turn has a problem during disconnect,
|
||||
* since the HPD interrupt may be raised before the DDC lines get
|
||||
* disconnected (due to how the required length of DDC vs. HPD
|
||||
* connector pins are specified) and so we'll still be able to get a
|
||||
* valid EDID. To solve this schedule another detection cycle if this
|
||||
* time around we didn't detect any change in the sink's connection
|
||||
* status.
|
||||
*/
|
||||
if (state == INTEL_HOTPLUG_UNCHANGED && !connector->hotplug_retries)
|
||||
state = INTEL_HOTPLUG_RETRY;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void intel_hdmi_init(struct drm_i915_private *dev_priv,
|
||||
i915_reg_t hdmi_reg, enum port port)
|
||||
{
|
||||
struct intel_digital_port *dig_port;
|
||||
struct intel_encoder *intel_encoder;
|
||||
struct intel_connector *intel_connector;
|
||||
|
||||
dig_port = kzalloc(sizeof(*dig_port), GFP_KERNEL);
|
||||
if (!dig_port)
|
||||
return;
|
||||
|
||||
intel_connector = intel_connector_alloc();
|
||||
if (!intel_connector) {
|
||||
kfree(dig_port);
|
||||
return;
|
||||
}
|
||||
|
||||
intel_encoder = &dig_port->base;
|
||||
|
||||
mutex_init(&dig_port->hdcp_mutex);
|
||||
|
||||
drm_encoder_init(&dev_priv->drm, &intel_encoder->base,
|
||||
&intel_hdmi_enc_funcs, DRM_MODE_ENCODER_TMDS,
|
||||
"HDMI %c", port_name(port));
|
||||
|
||||
intel_encoder->hotplug = intel_hdmi_hotplug;
|
||||
intel_encoder->compute_config = intel_hdmi_compute_config;
|
||||
if (HAS_PCH_SPLIT(dev_priv)) {
|
||||
intel_encoder->disable = pch_disable_hdmi;
|
||||
intel_encoder->post_disable = pch_post_disable_hdmi;
|
||||
} else {
|
||||
intel_encoder->disable = g4x_disable_hdmi;
|
||||
}
|
||||
intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
|
||||
intel_encoder->get_config = intel_hdmi_get_config;
|
||||
if (IS_CHERRYVIEW(dev_priv)) {
|
||||
intel_encoder->pre_pll_enable = chv_hdmi_pre_pll_enable;
|
||||
intel_encoder->pre_enable = chv_hdmi_pre_enable;
|
||||
intel_encoder->enable = vlv_enable_hdmi;
|
||||
intel_encoder->post_disable = chv_hdmi_post_disable;
|
||||
intel_encoder->post_pll_disable = chv_hdmi_post_pll_disable;
|
||||
} else if (IS_VALLEYVIEW(dev_priv)) {
|
||||
intel_encoder->pre_pll_enable = vlv_hdmi_pre_pll_enable;
|
||||
intel_encoder->pre_enable = vlv_hdmi_pre_enable;
|
||||
intel_encoder->enable = vlv_enable_hdmi;
|
||||
intel_encoder->post_disable = vlv_hdmi_post_disable;
|
||||
} else {
|
||||
intel_encoder->pre_enable = intel_hdmi_pre_enable;
|
||||
if (HAS_PCH_CPT(dev_priv))
|
||||
intel_encoder->enable = cpt_enable_hdmi;
|
||||
else if (HAS_PCH_IBX(dev_priv))
|
||||
intel_encoder->enable = ibx_enable_hdmi;
|
||||
else
|
||||
intel_encoder->enable = g4x_enable_hdmi;
|
||||
}
|
||||
|
||||
intel_encoder->type = INTEL_OUTPUT_HDMI;
|
||||
intel_encoder->power_domain = intel_port_to_power_domain(port);
|
||||
intel_encoder->port = port;
|
||||
if (IS_CHERRYVIEW(dev_priv)) {
|
||||
if (port == PORT_D)
|
||||
intel_encoder->pipe_mask = BIT(PIPE_C);
|
||||
else
|
||||
intel_encoder->pipe_mask = BIT(PIPE_A) | BIT(PIPE_B);
|
||||
} else {
|
||||
intel_encoder->pipe_mask = ~0;
|
||||
}
|
||||
intel_encoder->cloneable = 1 << INTEL_OUTPUT_ANALOG;
|
||||
intel_encoder->hpd_pin = intel_hpd_pin_default(dev_priv, port);
|
||||
/*
|
||||
* BSpec is unclear about HDMI+HDMI cloning on g4x, but it seems
|
||||
* to work on real hardware. And since g4x can send infoframes to
|
||||
* only one port anyway, nothing is lost by allowing it.
|
||||
*/
|
||||
if (IS_G4X(dev_priv))
|
||||
intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
|
||||
|
||||
dig_port->hdmi.hdmi_reg = hdmi_reg;
|
||||
dig_port->dp.output_reg = INVALID_MMIO_REG;
|
||||
dig_port->max_lanes = 4;
|
||||
|
||||
intel_infoframe_init(dig_port);
|
||||
|
||||
dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
|
||||
intel_hdmi_init_connector(dig_port, intel_connector);
|
||||
}
|
||||
|
||||
/*
|
||||
* intel_hdmi_dsc_get_slice_height - get the dsc slice_height
|
||||
* @vactive: Vactive of a display mode
|
||||
|
@ -23,11 +23,8 @@ struct drm_connector_state;
|
||||
union hdmi_infoframe;
|
||||
enum port;
|
||||
|
||||
void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg,
|
||||
enum port port);
|
||||
void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
|
||||
struct intel_connector *intel_connector);
|
||||
struct intel_hdmi *enc_to_intel_hdmi(struct intel_encoder *encoder);
|
||||
int intel_hdmi_compute_config(struct intel_encoder *encoder,
|
||||
struct intel_crtc_state *pipe_config,
|
||||
struct drm_connector_state *conn_state);
|
||||
|
@ -136,12 +136,12 @@ static void intel_lvds_get_config(struct intel_encoder *encoder,
|
||||
|
||||
pipe_config->hw.adjusted_mode.flags |= flags;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 5)
|
||||
if (DISPLAY_VER(dev_priv) < 5)
|
||||
pipe_config->gmch_pfit.lvds_border_bits =
|
||||
tmp & LVDS_BORDER_ENABLE;
|
||||
|
||||
/* gen2/3 store dither state in pfit control, needs to match */
|
||||
if (INTEL_GEN(dev_priv) < 4) {
|
||||
if (DISPLAY_VER(dev_priv) < 4) {
|
||||
tmp = intel_de_read(dev_priv, PFIT_CONTROL);
|
||||
|
||||
pipe_config->gmch_pfit.control |= tmp & PANEL_8TO6_DITHER_ENABLE;
|
||||
@ -179,7 +179,7 @@ static void intel_lvds_pps_get_hw_state(struct drm_i915_private *dev_priv,
|
||||
/* Convert from 100ms to 100us units */
|
||||
pps->t4 = val * 1000;
|
||||
|
||||
if (INTEL_GEN(dev_priv) <= 4 &&
|
||||
if (DISPLAY_VER(dev_priv) <= 4 &&
|
||||
pps->t1_t2 == 0 && pps->t5 == 0 && pps->t3 == 0 && pps->tx == 0) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"Panel power timings uninitialized, "
|
||||
@ -280,7 +280,7 @@ static void intel_pre_enable_lvds(struct intel_atomic_state *state,
|
||||
* special lvds dither control bit on pch-split platforms, dithering is
|
||||
* only controlled through the PIPECONF reg.
|
||||
*/
|
||||
if (IS_GEN(dev_priv, 4)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 4)) {
|
||||
/*
|
||||
* Bspec wording suggests that LVDS port dithering only exists
|
||||
* for 18bpp panels.
|
||||
@ -415,7 +415,7 @@ static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
|
||||
int ret;
|
||||
|
||||
/* Should never happen!! */
|
||||
if (INTEL_GEN(dev_priv) < 4 && intel_crtc->pipe == 0) {
|
||||
if (DISPLAY_VER(dev_priv) < 4 && intel_crtc->pipe == 0) {
|
||||
drm_err(&dev_priv->drm, "Can't support LVDS on pipe A\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -915,7 +915,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
|
||||
intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER;
|
||||
intel_encoder->port = PORT_NONE;
|
||||
intel_encoder->cloneable = 0;
|
||||
if (INTEL_GEN(dev_priv) < 4)
|
||||
if (DISPLAY_VER(dev_priv) < 4)
|
||||
intel_encoder->pipe_mask = BIT(PIPE_B);
|
||||
else
|
||||
intel_encoder->pipe_mask = ~0;
|
||||
|
@ -550,7 +550,7 @@ static u32 calc_swidthsw(struct drm_i915_private *dev_priv, u32 offset, u32 widt
|
||||
{
|
||||
u32 sw;
|
||||
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
sw = ALIGN((offset & 31) + width, 32);
|
||||
else
|
||||
sw = ALIGN((offset & 63) + width, 64);
|
||||
@ -818,7 +818,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
|
||||
oconfig |= OCONF_CC_OUT_8BIT;
|
||||
if (crtc_state->gamma_enable)
|
||||
oconfig |= OCONF_GAMMA2_ENABLE;
|
||||
if (IS_GEN(dev_priv, 4))
|
||||
if (IS_DISPLAY_VER(dev_priv, 4))
|
||||
oconfig |= OCONF_CSC_MODE_BT709;
|
||||
oconfig |= pipe == 0 ?
|
||||
OCONF_PIPE_A : OCONF_PIPE_B;
|
||||
@ -937,7 +937,7 @@ static void update_pfit_vscale_ratio(struct intel_overlay *overlay)
|
||||
/* XXX: This is not the same logic as in the xorg driver, but more in
|
||||
* line with the intel documentation for the i965
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 4) {
|
||||
if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
/* 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;
|
||||
} else {
|
||||
@ -1052,7 +1052,7 @@ static int check_overlay_src(struct drm_i915_private *dev_priv,
|
||||
|
||||
if (rec->stride_Y & stride_mask || rec->stride_UV & stride_mask)
|
||||
return -EINVAL;
|
||||
if (IS_GEN(dev_priv, 4) && rec->stride_Y < 512)
|
||||
if (IS_DISPLAY_VER(dev_priv, 4) && rec->stride_Y < 512)
|
||||
return -EINVAL;
|
||||
|
||||
tmp = (rec->flags & I915_OVERLAY_TYPE_MASK) == I915_OVERLAY_YUV_PLANAR ?
|
||||
@ -1279,7 +1279,7 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,
|
||||
attrs->contrast = overlay->contrast;
|
||||
attrs->saturation = overlay->saturation;
|
||||
|
||||
if (!IS_GEN(dev_priv, 2)) {
|
||||
if (!IS_DISPLAY_VER(dev_priv, 2)) {
|
||||
attrs->gamma0 = intel_de_read(dev_priv, OGAMC0);
|
||||
attrs->gamma1 = intel_de_read(dev_priv, OGAMC1);
|
||||
attrs->gamma2 = intel_de_read(dev_priv, OGAMC2);
|
||||
@ -1303,7 +1303,7 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,
|
||||
update_reg_attrs(overlay, overlay->regs);
|
||||
|
||||
if (attrs->flags & I915_OVERLAY_UPDATE_GAMMA) {
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
goto out_unlock;
|
||||
|
||||
if (overlay->active) {
|
||||
|
@ -405,7 +405,7 @@ int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
|
||||
break;
|
||||
case DRM_MODE_SCALE_ASPECT:
|
||||
/* Scale but preserve the aspect ratio */
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
i965_scale_aspect(crtc_state, &pfit_control);
|
||||
else
|
||||
i9xx_scale_aspect(crtc_state, &pfit_control,
|
||||
@ -419,7 +419,7 @@ int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
|
||||
if (crtc_state->pipe_src_h != adjusted_mode->crtc_vdisplay ||
|
||||
crtc_state->pipe_src_w != adjusted_mode->crtc_hdisplay) {
|
||||
pfit_control |= PFIT_ENABLE;
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
pfit_control |= PFIT_SCALING_AUTO;
|
||||
else
|
||||
pfit_control |= (VERT_AUTO_SCALE |
|
||||
@ -435,7 +435,7 @@ int intel_gmch_panel_fitting(struct intel_crtc_state *crtc_state,
|
||||
|
||||
/* 965+ wants fuzzy fitting */
|
||||
/* FIXME: handle multiple panels by failing gracefully */
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
pfit_control |= PFIT_PIPE(crtc->pipe) | PFIT_FILTER_FUZZY;
|
||||
|
||||
out:
|
||||
@ -445,7 +445,7 @@ out:
|
||||
}
|
||||
|
||||
/* Make sure pre-965 set dither correctly for 18bpp panels. */
|
||||
if (INTEL_GEN(dev_priv) < 4 && crtc_state->pipe_bpp == 18)
|
||||
if (DISPLAY_VER(dev_priv) < 4 && crtc_state->pipe_bpp == 18)
|
||||
pfit_control |= PANEL_8TO6_DITHER_ENABLE;
|
||||
|
||||
crtc_state->gmch_pfit.control = pfit_control;
|
||||
@ -590,7 +590,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector, enum pipe unuse
|
||||
u32 val;
|
||||
|
||||
val = intel_de_read(dev_priv, BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
|
||||
if (INTEL_GEN(dev_priv) < 4)
|
||||
if (DISPLAY_VER(dev_priv) < 4)
|
||||
val >>= 1;
|
||||
|
||||
if (panel->backlight.combination_mode) {
|
||||
@ -667,7 +667,7 @@ static void i9xx_set_backlight(const struct drm_connector_state *conn_state, u32
|
||||
pci_write_config_byte(to_pci_dev(dev_priv->drm.dev), LBPC, lbpc);
|
||||
}
|
||||
|
||||
if (IS_GEN(dev_priv, 4)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 4)) {
|
||||
mask = BACKLIGHT_DUTY_CYCLE_MASK;
|
||||
} else {
|
||||
level <<= 1;
|
||||
@ -1040,7 +1040,7 @@ static void i9xx_enable_backlight(const struct intel_crtc_state *crtc_state,
|
||||
* 855gm only, but checking for gen2 is safe, as 855gm is the only gen2
|
||||
* that has backlight.
|
||||
*/
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
intel_de_write(dev_priv, BLC_HIST_CTL, BLM_HISTOGRAM_ENABLE);
|
||||
}
|
||||
|
||||
@ -1728,7 +1728,7 @@ static int i9xx_setup_backlight(struct intel_connector *connector, enum pipe unu
|
||||
|
||||
ctl = intel_de_read(dev_priv, BLC_PWM_CTL);
|
||||
|
||||
if (IS_GEN(dev_priv, 2) || IS_I915GM(dev_priv) || IS_I945GM(dev_priv))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2) || IS_I915GM(dev_priv) || IS_I945GM(dev_priv))
|
||||
panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE;
|
||||
|
||||
if (IS_PINEVIEW(dev_priv))
|
||||
@ -2178,7 +2178,7 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel)
|
||||
} else {
|
||||
panel->backlight.pwm_funcs = &vlv_pwm_funcs;
|
||||
}
|
||||
} else if (IS_GEN(dev_priv, 4)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 4)) {
|
||||
panel->backlight.pwm_funcs = &i965_pwm_funcs;
|
||||
} else {
|
||||
panel->backlight.pwm_funcs = &i9xx_pwm_funcs;
|
||||
|
@ -409,15 +409,15 @@ static int get_new_crc_ctl_reg(struct drm_i915_private *dev_priv,
|
||||
enum pipe pipe,
|
||||
enum intel_pipe_crc_source *source, u32 *val)
|
||||
{
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
return i8xx_pipe_crc_ctl_reg(source, val);
|
||||
else if (INTEL_GEN(dev_priv) < 5)
|
||||
else if (DISPLAY_VER(dev_priv) < 5)
|
||||
return i9xx_pipe_crc_ctl_reg(dev_priv, pipe, source, val);
|
||||
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
|
||||
return vlv_pipe_crc_ctl_reg(dev_priv, pipe, source, val);
|
||||
else if (IS_GEN_RANGE(dev_priv, 5, 6))
|
||||
else if (IS_IRONLAKE(dev_priv) || IS_SANDYBRIDGE(dev_priv))
|
||||
return ilk_pipe_crc_ctl_reg(source, val);
|
||||
else if (INTEL_GEN(dev_priv) < 9)
|
||||
else if (DISPLAY_VER(dev_priv) < 9)
|
||||
return ivb_pipe_crc_ctl_reg(dev_priv, pipe, source, val);
|
||||
else
|
||||
return skl_pipe_crc_ctl_reg(dev_priv, pipe, source, val);
|
||||
@ -539,15 +539,15 @@ static int
|
||||
intel_is_valid_crc_source(struct drm_i915_private *dev_priv,
|
||||
const enum intel_pipe_crc_source source)
|
||||
{
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
return i8xx_crc_source_valid(dev_priv, source);
|
||||
else if (INTEL_GEN(dev_priv) < 5)
|
||||
else if (DISPLAY_VER(dev_priv) < 5)
|
||||
return i9xx_crc_source_valid(dev_priv, source);
|
||||
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
|
||||
return vlv_crc_source_valid(dev_priv, source);
|
||||
else if (IS_GEN_RANGE(dev_priv, 5, 6))
|
||||
else if (IS_IRONLAKE(dev_priv) || IS_SANDYBRIDGE(dev_priv))
|
||||
return ilk_crc_source_valid(dev_priv, source);
|
||||
else if (INTEL_GEN(dev_priv) < 9)
|
||||
else if (DISPLAY_VER(dev_priv) < 9)
|
||||
return ivb_crc_source_valid(dev_priv, source);
|
||||
else
|
||||
return skl_crc_source_valid(dev_priv, source);
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Copyright © 2020 Intel Corporation
|
||||
*/
|
||||
|
||||
#include "g4x_dp.h"
|
||||
#include "i915_drv.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_dp.h"
|
||||
@ -777,7 +778,7 @@ void intel_pps_on_unlocked(struct intel_dp *intel_dp)
|
||||
|
||||
pp_ctrl_reg = _pp_ctrl_reg(intel_dp);
|
||||
pp = ilk_get_pp_control(intel_dp);
|
||||
if (IS_GEN(dev_priv, 5)) {
|
||||
if (IS_IRONLAKE(dev_priv)) {
|
||||
/* ILK workaround: disable reset around power sequence */
|
||||
pp &= ~PANEL_POWER_RESET;
|
||||
intel_de_write(dev_priv, pp_ctrl_reg, pp);
|
||||
@ -785,7 +786,7 @@ void intel_pps_on_unlocked(struct intel_dp *intel_dp)
|
||||
}
|
||||
|
||||
pp |= PANEL_POWER_ON;
|
||||
if (!IS_GEN(dev_priv, 5))
|
||||
if (!IS_IRONLAKE(dev_priv))
|
||||
pp |= PANEL_POWER_RESET;
|
||||
|
||||
intel_de_write(dev_priv, pp_ctrl_reg, pp);
|
||||
@ -794,7 +795,7 @@ void intel_pps_on_unlocked(struct intel_dp *intel_dp)
|
||||
wait_panel_on(intel_dp);
|
||||
intel_dp->pps.last_power_on = jiffies;
|
||||
|
||||
if (IS_GEN(dev_priv, 5)) {
|
||||
if (IS_IRONLAKE(dev_priv)) {
|
||||
pp |= PANEL_POWER_RESET; /* restore panel reset bit */
|
||||
intel_de_write(dev_priv, pp_ctrl_reg, pp);
|
||||
intel_de_posting_read(dev_priv, pp_ctrl_reg);
|
||||
|
@ -118,7 +118,7 @@ static void psr_irq_control(struct intel_dp *intel_dp)
|
||||
* using the same bit definition: handle it as TRANSCODER_EDP to force
|
||||
* 0 shift in bit definition
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
trans_shift = 0;
|
||||
imr_reg = TRANS_PSR_IMR(intel_dp->psr.transcoder);
|
||||
} else {
|
||||
@ -184,7 +184,7 @@ void intel_psr_irq_handler(struct intel_dp *intel_dp, u32 psr_iir)
|
||||
enum transcoder trans_shift;
|
||||
i915_reg_t imr_reg;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
trans_shift = 0;
|
||||
imr_reg = TRANS_PSR_IMR(intel_dp->psr.transcoder);
|
||||
} else {
|
||||
@ -205,7 +205,7 @@ void intel_psr_irq_handler(struct intel_dp *intel_dp, u32 psr_iir)
|
||||
"[transcoder %s] PSR exit completed\n",
|
||||
transcoder_name(cpu_transcoder));
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
if (DISPLAY_VER(dev_priv) >= 9) {
|
||||
u32 val = intel_de_read(dev_priv,
|
||||
PSR_EVENT(cpu_transcoder));
|
||||
bool psr2_enabled = intel_dp->psr.psr2_enabled;
|
||||
@ -321,7 +321,7 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
|
||||
intel_dp->psr.sink_sync_latency =
|
||||
intel_dp_get_sink_sync_latency(intel_dp);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 9 &&
|
||||
(intel_dp->psr_dpcd[0] == DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) {
|
||||
bool y_req = intel_dp->psr_dpcd[1] &
|
||||
DP_PSR2_SU_Y_COORDINATE_REQUIRED;
|
||||
@ -402,7 +402,7 @@ static void intel_psr_enable_sink(struct intel_dp *intel_dp)
|
||||
if (intel_dp->psr.link_standby)
|
||||
dpcd_val |= DP_PSR_MAIN_LINK_ACTIVE;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
dpcd_val |= DP_PSR_CRC_VERIFICATION;
|
||||
}
|
||||
|
||||
@ -416,7 +416,7 @@ static u32 intel_psr1_get_tp_time(struct intel_dp *intel_dp)
|
||||
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
|
||||
u32 val = 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
val |= EDP_PSR_TP4_TIME_0US;
|
||||
|
||||
if (dev_priv->params.psr_safest_params) {
|
||||
@ -487,7 +487,7 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
|
||||
|
||||
val |= intel_psr1_get_tp_time(intel_dp);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
val |= EDP_PSR_CRC_ENABLE;
|
||||
|
||||
val |= (intel_de_read(dev_priv, EDP_PSR_CTL(intel_dp->psr.transcoder)) &
|
||||
@ -524,13 +524,13 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
|
||||
val = psr_compute_idle_frames(intel_dp) << EDP_PSR2_IDLE_FRAME_SHIFT;
|
||||
|
||||
val |= EDP_PSR2_ENABLE | EDP_SU_TRACK_ENABLE;
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
val |= EDP_Y_COORDINATE_ENABLE;
|
||||
|
||||
val |= EDP_PSR2_FRAME_BEFORE_SU(intel_dp->psr.sink_sync_latency + 1);
|
||||
val |= intel_psr2_get_tp_time(intel_dp);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
/*
|
||||
* TODO: 7 lines of IO_BUFFER_WAKE and FAST_WAKE are default
|
||||
* values from BSpec. In order to setting an optimal power
|
||||
@ -541,14 +541,14 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
|
||||
val |= TGL_EDP_PSR2_BLOCK_COUNT_NUM_2;
|
||||
val |= TGL_EDP_PSR2_IO_BUFFER_WAKE(7);
|
||||
val |= TGL_EDP_PSR2_FAST_WAKE(7);
|
||||
} else if (INTEL_GEN(dev_priv) >= 9) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 9) {
|
||||
val |= EDP_PSR2_IO_BUFFER_WAKE(7);
|
||||
val |= EDP_PSR2_FAST_WAKE(7);
|
||||
}
|
||||
|
||||
if (intel_dp->psr.psr2_sel_fetch_enabled) {
|
||||
/* WA 1408330847 */
|
||||
if (IS_TGL_DISP_STEPPING(dev_priv, STEP_A0, STEP_A0) ||
|
||||
if (IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_A0) ||
|
||||
IS_RKL_REVID(dev_priv, RKL_REVID_A0, RKL_REVID_A0))
|
||||
intel_de_rmw(dev_priv, CHICKEN_PAR1_1,
|
||||
DIS_RAM_BYPASS_PSR2_MAN_TRACK,
|
||||
@ -574,9 +574,9 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
|
||||
static bool
|
||||
transcoder_has_psr2(struct drm_i915_private *dev_priv, enum transcoder trans)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) < 9)
|
||||
if (DISPLAY_VER(dev_priv) < 9)
|
||||
return false;
|
||||
else if (INTEL_GEN(dev_priv) >= 12)
|
||||
else if (DISPLAY_VER(dev_priv) >= 12)
|
||||
return trans == TRANSCODER_A;
|
||||
else
|
||||
return trans == TRANSCODER_EDP;
|
||||
@ -761,15 +761,15 @@ static bool intel_psr2_config_valid(struct intel_dp *intel_dp,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
psr_max_h = 5120;
|
||||
psr_max_v = 3200;
|
||||
max_bpp = 30;
|
||||
} else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 10) {
|
||||
psr_max_h = 4096;
|
||||
psr_max_v = 2304;
|
||||
max_bpp = 24;
|
||||
} else if (IS_GEN(dev_priv, 9)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 9)) {
|
||||
psr_max_h = 3640;
|
||||
psr_max_v = 2304;
|
||||
max_bpp = 24;
|
||||
@ -909,8 +909,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
|
||||
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
|
||||
hsw_psr_setup_aux(intel_dp);
|
||||
|
||||
if (intel_dp->psr.psr2_enabled && (IS_GEN(dev_priv, 9) &&
|
||||
!IS_GEMINILAKE(dev_priv))) {
|
||||
if (intel_dp->psr.psr2_enabled && IS_DISPLAY_VER(dev_priv, 9)) {
|
||||
i915_reg_t reg = CHICKEN_TRANS(cpu_transcoder);
|
||||
u32 chicken = intel_de_read(dev_priv, reg);
|
||||
|
||||
@ -930,7 +929,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
|
||||
EDP_PSR_DEBUG_MASK_LPSP |
|
||||
EDP_PSR_DEBUG_MASK_MAX_SLEEP;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 11)
|
||||
if (DISPLAY_VER(dev_priv) < 11)
|
||||
mask |= EDP_PSR_DEBUG_MASK_DISP_REG_WRITE;
|
||||
|
||||
intel_de_write(dev_priv, EDP_PSR_DEBUG(intel_dp->psr.transcoder),
|
||||
@ -987,7 +986,7 @@ static void intel_psr_enable_locked(struct intel_dp *intel_dp,
|
||||
* first time that PSR HW tries to activate so lets keep PSR disabled
|
||||
* to avoid any rendering problems.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
val = intel_de_read(dev_priv,
|
||||
TRANS_PSR_IIR(intel_dp->psr.transcoder));
|
||||
val &= EDP_PSR_ERROR(0);
|
||||
@ -1110,7 +1109,7 @@ static void intel_psr_disable_locked(struct intel_dp *intel_dp)
|
||||
|
||||
/* WA 1408330847 */
|
||||
if (intel_dp->psr.psr2_sel_fetch_enabled &&
|
||||
(IS_TGL_DISP_STEPPING(dev_priv, STEP_A0, STEP_A0) ||
|
||||
(IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_A0) ||
|
||||
IS_RKL_REVID(dev_priv, RKL_REVID_A0, RKL_REVID_A0)))
|
||||
intel_de_rmw(dev_priv, CHICKEN_PAR1_1,
|
||||
DIS_RAM_BYPASS_PSR2_MAN_TRACK, 0);
|
||||
@ -1169,7 +1168,7 @@ static void psr_force_hw_tracking_exit(struct intel_dp *intel_dp)
|
||||
* and a better fix is found.
|
||||
*/
|
||||
intel_psr_exit(intel_dp);
|
||||
else if (INTEL_GEN(dev_priv) >= 9)
|
||||
else if (DISPLAY_VER(dev_priv) >= 9)
|
||||
/*
|
||||
* Display WA #0884: skl+
|
||||
* This documented WA for bxt can be safely applied
|
||||
@ -1451,7 +1450,7 @@ void intel_psr_update(struct intel_dp *intel_dp,
|
||||
/* Force a PSR exit when enabling CRC to avoid CRC timeouts */
|
||||
if (crtc_state->crc_enabled && psr->enabled)
|
||||
psr_force_hw_tracking_exit(intel_dp);
|
||||
else if (INTEL_GEN(dev_priv) < 9 && psr->enabled) {
|
||||
else if (DISPLAY_VER(dev_priv) < 9 && psr->enabled) {
|
||||
/*
|
||||
* Activate PSR again after a force exit when enabling
|
||||
* CRC in older gens
|
||||
@ -1855,7 +1854,7 @@ void intel_psr_init(struct intel_dp *intel_dp)
|
||||
* So lets keep it hardcoded to PORT_A for BDW, GEN9 and GEN11.
|
||||
* But GEN12 supports a instance of PSR registers per transcoder.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) < 12 && dig_port->base.port != PORT_A) {
|
||||
if (DISPLAY_VER(dev_priv) < 12 && dig_port->base.port != PORT_A) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"PSR condition failed: Port not supported\n");
|
||||
return;
|
||||
@ -1872,14 +1871,14 @@ void intel_psr_init(struct intel_dp *intel_dp)
|
||||
dev_priv->hsw_psr_mmio_adjust = _SRD_CTL_EDP - _HSW_EDP_PSR_BASE;
|
||||
|
||||
if (dev_priv->params.enable_psr == -1)
|
||||
if (INTEL_GEN(dev_priv) < 9 || !dev_priv->vbt.psr.enable)
|
||||
if (DISPLAY_VER(dev_priv) < 9 || !dev_priv->vbt.psr.enable)
|
||||
dev_priv->params.enable_psr = 0;
|
||||
|
||||
/* Set link_standby x link_off defaults */
|
||||
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
|
||||
/* HSW and BDW require workarounds that we don't implement. */
|
||||
intel_dp->psr.link_standby = false;
|
||||
else if (INTEL_GEN(dev_priv) < 12)
|
||||
else if (DISPLAY_VER(dev_priv) < 12)
|
||||
/* For new platforms up to TGL let's respect VBT back again */
|
||||
intel_dp->psr.link_standby = dev_priv->vbt.psr.full_link;
|
||||
|
||||
|
@ -1540,11 +1540,11 @@ static void intel_sdvo_pre_enable(struct intel_atomic_state *state,
|
||||
return;
|
||||
|
||||
/* Set the SDVO control regs. */
|
||||
if (INTEL_GEN(dev_priv) >= 4) {
|
||||
if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
/* The real mode polarity is set by the SDVO commands, using
|
||||
* struct intel_sdvo_dtd. */
|
||||
sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH;
|
||||
if (INTEL_GEN(dev_priv) < 5)
|
||||
if (DISPLAY_VER(dev_priv) < 5)
|
||||
sdvox |= SDVO_BORDER_ENABLE;
|
||||
} else {
|
||||
sdvox = intel_de_read(dev_priv, intel_sdvo->sdvo_reg);
|
||||
@ -1560,7 +1560,7 @@ static void intel_sdvo_pre_enable(struct intel_atomic_state *state,
|
||||
else
|
||||
sdvox |= SDVO_PIPE_SEL(crtc->pipe);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4) {
|
||||
if (DISPLAY_VER(dev_priv) >= 4) {
|
||||
/* done in crtc_mode_set as the dpll_md reg must be written early */
|
||||
} else if (IS_I945G(dev_priv) || IS_I945GM(dev_priv) ||
|
||||
IS_G33(dev_priv) || IS_PINEVIEW(dev_priv)) {
|
||||
@ -1571,7 +1571,7 @@ static void intel_sdvo_pre_enable(struct intel_atomic_state *state,
|
||||
}
|
||||
|
||||
if (input_dtd.part2.sdvo_flags & SDVO_NEED_TO_STALL &&
|
||||
INTEL_GEN(dev_priv) < 5)
|
||||
DISPLAY_VER(dev_priv) < 5)
|
||||
sdvox |= SDVO_STALL_SELECT;
|
||||
intel_sdvo_write_sdvox(intel_sdvo, sdvox);
|
||||
}
|
||||
|
@ -49,38 +49,6 @@
|
||||
#include "i9xx_plane.h"
|
||||
#include "intel_vrr.h"
|
||||
|
||||
int intel_plane_check_stride(const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
unsigned int rotation = plane_state->hw.rotation;
|
||||
u32 stride, max_stride;
|
||||
|
||||
/*
|
||||
* We ignore stride for all invisible planes that
|
||||
* can be remapped. Otherwise we could end up
|
||||
* with a false positive when the remapping didn't
|
||||
* kick in due the plane being invisible.
|
||||
*/
|
||||
if (intel_plane_can_remap(plane_state) &&
|
||||
!plane_state->uapi.visible)
|
||||
return 0;
|
||||
|
||||
/* FIXME other color planes? */
|
||||
stride = plane_state->color_plane[0].stride;
|
||||
max_stride = plane->max_stride(plane, fb->format->format,
|
||||
fb->modifier, rotation);
|
||||
|
||||
if (stride > max_stride) {
|
||||
DRM_DEBUG_KMS("[FB:%d] stride (%d) exceeds [PLANE:%d:%s] max stride (%d)\n",
|
||||
fb->base.id, stride,
|
||||
plane->base.base.id, plane->base.name, max_stride);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
|
||||
{
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
@ -455,15 +423,15 @@ vlv_update_plane(struct intel_plane *plane,
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
enum pipe pipe = plane->pipe;
|
||||
enum plane_id plane_id = plane->id;
|
||||
u32 sprsurf_offset = plane_state->color_plane[0].offset;
|
||||
u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
|
||||
u32 linear_offset;
|
||||
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
|
||||
int crtc_x = plane_state->uapi.dst.x1;
|
||||
int crtc_y = plane_state->uapi.dst.y1;
|
||||
u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
|
||||
u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
|
||||
u32 x = plane_state->color_plane[0].x;
|
||||
u32 y = plane_state->color_plane[0].y;
|
||||
u32 x = plane_state->view.color_plane[0].x;
|
||||
u32 y = plane_state->view.color_plane[0].y;
|
||||
unsigned long irqflags;
|
||||
u32 sprctl;
|
||||
|
||||
@ -478,7 +446,7 @@ vlv_update_plane(struct intel_plane *plane,
|
||||
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
|
||||
|
||||
intel_de_write_fw(dev_priv, SPSTRIDE(pipe, plane_id),
|
||||
plane_state->color_plane[0].stride);
|
||||
plane_state->view.color_plane[0].stride);
|
||||
intel_de_write_fw(dev_priv, SPPOS(pipe, plane_id),
|
||||
(crtc_y << 16) | crtc_x);
|
||||
intel_de_write_fw(dev_priv, SPSIZE(pipe, plane_id),
|
||||
@ -872,15 +840,15 @@ ivb_update_plane(struct intel_plane *plane,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
enum pipe pipe = plane->pipe;
|
||||
u32 sprsurf_offset = plane_state->color_plane[0].offset;
|
||||
u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
|
||||
u32 linear_offset;
|
||||
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
|
||||
int crtc_x = plane_state->uapi.dst.x1;
|
||||
int crtc_y = plane_state->uapi.dst.y1;
|
||||
u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
|
||||
u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
|
||||
u32 x = plane_state->color_plane[0].x;
|
||||
u32 y = plane_state->color_plane[0].y;
|
||||
u32 x = plane_state->view.color_plane[0].x;
|
||||
u32 y = plane_state->view.color_plane[0].y;
|
||||
u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
|
||||
u32 sprctl, sprscale = 0;
|
||||
@ -902,7 +870,7 @@ ivb_update_plane(struct intel_plane *plane,
|
||||
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
|
||||
|
||||
intel_de_write_fw(dev_priv, SPRSTRIDE(pipe),
|
||||
plane_state->color_plane[0].stride);
|
||||
plane_state->view.color_plane[0].stride);
|
||||
intel_de_write_fw(dev_priv, SPRPOS(pipe), (crtc_y << 16) | crtc_x);
|
||||
intel_de_write_fw(dev_priv, SPRSIZE(pipe), (crtc_h << 16) | crtc_w);
|
||||
if (IS_IVYBRIDGE(dev_priv))
|
||||
@ -1078,7 +1046,7 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state,
|
||||
|
||||
dvscntr = DVS_ENABLE;
|
||||
|
||||
if (IS_GEN(dev_priv, 6))
|
||||
if (IS_SANDYBRIDGE(dev_priv))
|
||||
dvscntr |= DVS_TRICKLE_FEED_DISABLE;
|
||||
|
||||
switch (fb->format->format) {
|
||||
@ -1200,15 +1168,15 @@ g4x_update_plane(struct intel_plane *plane,
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
enum pipe pipe = plane->pipe;
|
||||
u32 dvssurf_offset = plane_state->color_plane[0].offset;
|
||||
u32 dvssurf_offset = plane_state->view.color_plane[0].offset;
|
||||
u32 linear_offset;
|
||||
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
|
||||
int crtc_x = plane_state->uapi.dst.x1;
|
||||
int crtc_y = plane_state->uapi.dst.y1;
|
||||
u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
|
||||
u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
|
||||
u32 x = plane_state->color_plane[0].x;
|
||||
u32 y = plane_state->color_plane[0].y;
|
||||
u32 x = plane_state->view.color_plane[0].x;
|
||||
u32 y = plane_state->view.color_plane[0].y;
|
||||
u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
|
||||
u32 dvscntr, dvsscale = 0;
|
||||
@ -1230,7 +1198,7 @@ g4x_update_plane(struct intel_plane *plane,
|
||||
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
|
||||
|
||||
intel_de_write_fw(dev_priv, DVSSTRIDE(pipe),
|
||||
plane_state->color_plane[0].stride);
|
||||
plane_state->view.color_plane[0].stride);
|
||||
intel_de_write_fw(dev_priv, DVSPOS(pipe), (crtc_y << 16) | crtc_x);
|
||||
intel_de_write_fw(dev_priv, DVSSIZE(pipe), (crtc_h << 16) | crtc_w);
|
||||
intel_de_write_fw(dev_priv, DVSSCALE(pipe), dvsscale);
|
||||
@ -1330,7 +1298,7 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state,
|
||||
int src_x, src_w, src_h, crtc_w, crtc_h;
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc_state->hw.adjusted_mode;
|
||||
unsigned int stride = plane_state->color_plane[0].stride;
|
||||
unsigned int stride = plane_state->view.color_plane[0].stride;
|
||||
unsigned int cpp = fb->format->cpp[0];
|
||||
unsigned int width_bytes;
|
||||
int min_width, min_height;
|
||||
@ -1392,7 +1360,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
|
||||
int ret;
|
||||
|
||||
if (g4x_fb_scalable(plane_state->hw.fb)) {
|
||||
if (INTEL_GEN(dev_priv) < 7) {
|
||||
if (DISPLAY_VER(dev_priv) < 7) {
|
||||
min_scale = 1;
|
||||
max_scale = 16 << 16;
|
||||
} else if (IS_IVYBRIDGE(dev_priv)) {
|
||||
@ -1421,7 +1389,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 7)
|
||||
if (DISPLAY_VER(dev_priv) >= 7)
|
||||
plane_state->ctl = ivb_sprite_ctl(crtc_state, plane_state);
|
||||
else
|
||||
plane_state->ctl = g4x_sprite_ctl(crtc_state, plane_state);
|
||||
@ -1482,7 +1450,7 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
|
||||
|
||||
static bool has_dst_key_in_primary_plane(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return INTEL_GEN(dev_priv) >= 9;
|
||||
return DISPLAY_VER(dev_priv) >= 9;
|
||||
}
|
||||
|
||||
static void intel_plane_set_ckey(struct intel_plane_state *plane_state,
|
||||
@ -1506,7 +1474,7 @@ static void intel_plane_set_ckey(struct intel_plane_state *plane_state,
|
||||
* On SKL+ we want dst key enabled on
|
||||
* the primary and not on the sprite.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 9 && plane->id != PLANE_PRIMARY &&
|
||||
if (DISPLAY_VER(dev_priv) >= 9 && plane->id != PLANE_PRIMARY &&
|
||||
set->flags & I915_SET_COLORKEY_DESTINATION)
|
||||
key->flags = 0;
|
||||
}
|
||||
@ -1545,7 +1513,7 @@ int intel_sprite_set_colorkey_ioctl(struct drm_device *dev, void *data,
|
||||
* Also multiple planes can't do destination keying on the same
|
||||
* pipe simultaneously.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 9 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 9 &&
|
||||
to_intel_plane(plane)->id >= PLANE_SPRITE1 &&
|
||||
set->flags & I915_SET_COLORKEY_DESTINATION)
|
||||
return -EINVAL;
|
||||
@ -1810,7 +1778,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
|
||||
modifiers = i9xx_plane_format_modifiers;
|
||||
|
||||
plane_funcs = &vlv_sprite_funcs;
|
||||
} else if (INTEL_GEN(dev_priv) >= 7) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 7) {
|
||||
plane->update_plane = ivb_update_plane;
|
||||
plane->disable_plane = ivb_disable_plane;
|
||||
plane->get_hw_state = ivb_plane_get_hw_state;
|
||||
@ -1838,7 +1806,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
|
||||
plane->min_cdclk = g4x_sprite_min_cdclk;
|
||||
|
||||
modifiers = i9xx_plane_format_modifiers;
|
||||
if (IS_GEN(dev_priv, 6)) {
|
||||
if (IS_SANDYBRIDGE(dev_priv)) {
|
||||
formats = snb_plane_formats;
|
||||
num_formats = ARRAY_SIZE(snb_plane_formats);
|
||||
|
||||
|
@ -35,7 +35,6 @@ int intel_sprite_set_colorkey_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state);
|
||||
void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state);
|
||||
int intel_plane_check_stride(const struct intel_plane_state *plane_state);
|
||||
int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state);
|
||||
int chv_plane_check_rotation(const struct intel_plane_state *plane_state);
|
||||
|
||||
|
@ -28,7 +28,7 @@ tc_cold_get_power_domain(struct intel_digital_port *dig_port)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
|
||||
|
||||
if (INTEL_GEN(i915) == 11)
|
||||
if (IS_DISPLAY_VER(i915, 11))
|
||||
return intel_legacy_aux_to_power_domain(dig_port->aux_ch);
|
||||
else
|
||||
return POWER_DOMAIN_TC_COLD_OFF;
|
||||
@ -40,7 +40,7 @@ tc_cold_block(struct intel_digital_port *dig_port)
|
||||
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
|
||||
enum intel_display_power_domain domain;
|
||||
|
||||
if (INTEL_GEN(i915) == 11 && !dig_port->tc_legacy_port)
|
||||
if (IS_DISPLAY_VER(i915, 11) && !dig_port->tc_legacy_port)
|
||||
return 0;
|
||||
|
||||
domain = tc_cold_get_power_domain(dig_port);
|
||||
@ -71,7 +71,7 @@ assert_tc_cold_blocked(struct intel_digital_port *dig_port)
|
||||
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
|
||||
bool enabled;
|
||||
|
||||
if (INTEL_GEN(i915) == 11 && !dig_port->tc_legacy_port)
|
||||
if (IS_DISPLAY_VER(i915, 11) && !dig_port->tc_legacy_port)
|
||||
return;
|
||||
|
||||
enabled = intel_display_power_is_enabled(i915,
|
||||
@ -455,7 +455,7 @@ static void intel_tc_port_reset_mode(struct intel_digital_port *dig_port,
|
||||
enum tc_port_mode old_tc_mode = dig_port->tc_mode;
|
||||
|
||||
intel_display_power_flush_work(i915);
|
||||
if (INTEL_GEN(i915) != 11 || !dig_port->tc_legacy_port) {
|
||||
if (DISPLAY_VER(i915) != 11 || !dig_port->tc_legacy_port) {
|
||||
enum intel_display_power_domain aux_domain;
|
||||
bool aux_powered;
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ intel_tv_get_config(struct intel_encoder *encoder,
|
||||
static bool intel_tv_source_too_wide(struct drm_i915_private *dev_priv,
|
||||
int hdisplay)
|
||||
{
|
||||
return IS_GEN(dev_priv, 3) && hdisplay > 1024;
|
||||
return IS_DISPLAY_VER(dev_priv, 3) && hdisplay > 1024;
|
||||
}
|
||||
|
||||
static bool intel_tv_vert_scaling(const struct drm_display_mode *tv_mode,
|
||||
@ -1519,7 +1519,7 @@ static void intel_tv_pre_enable(struct intel_atomic_state *state,
|
||||
|
||||
set_color_conversion(dev_priv, color_conversion);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
intel_de_write(dev_priv, TV_CLR_KNOBS, 0x00404000);
|
||||
else
|
||||
intel_de_write(dev_priv, TV_CLR_KNOBS, 0x00606000);
|
||||
@ -1789,7 +1789,7 @@ intel_tv_get_modes(struct drm_connector *connector)
|
||||
continue;
|
||||
|
||||
/* no vertical scaling with wide sources on gen3 */
|
||||
if (IS_GEN(dev_priv, 3) && input->w > 1024 &&
|
||||
if (IS_DISPLAY_VER(dev_priv, 3) && input->w > 1024 &&
|
||||
input->h > intel_tv_mode_vdisplay(tv_mode))
|
||||
continue;
|
||||
|
||||
@ -1978,7 +1978,7 @@ intel_tv_init(struct drm_i915_private *dev_priv)
|
||||
/* Create TV properties then attach current values */
|
||||
for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
|
||||
/* 1080p50/1080p60 not supported on gen3 */
|
||||
if (IS_GEN(dev_priv, 3) &&
|
||||
if (IS_DISPLAY_VER(dev_priv, 3) &&
|
||||
tv_modes[i].oversample == 1)
|
||||
break;
|
||||
|
||||
|
@ -343,14 +343,10 @@ bool intel_dsc_source_support(const struct intel_crtc_state *crtc_state)
|
||||
return false;
|
||||
|
||||
/* On TGL, DSC is supported on all Pipes */
|
||||
if (INTEL_GEN(i915) >= 12)
|
||||
if (DISPLAY_VER(i915) >= 12)
|
||||
return true;
|
||||
|
||||
if (INTEL_GEN(i915) >= 10 &&
|
||||
(pipe != PIPE_A ||
|
||||
(cpu_transcoder == TRANSCODER_EDP ||
|
||||
cpu_transcoder == TRANSCODER_DSI_0 ||
|
||||
cpu_transcoder == TRANSCODER_DSI_1)))
|
||||
if ((DISPLAY_VER(i915) >= 11 || IS_CANNONLAKE(i915)) && (pipe != PIPE_A || (cpu_transcoder == TRANSCODER_EDP || cpu_transcoder == TRANSCODER_DSI_0 || cpu_transcoder == TRANSCODER_DSI_1)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -362,7 +358,7 @@ static bool is_pipe_dsc(const struct intel_crtc_state *crtc_state)
|
||||
const struct drm_i915_private *i915 = to_i915(crtc->base.dev);
|
||||
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
|
||||
|
||||
if (INTEL_GEN(i915) >= 12)
|
||||
if (DISPLAY_VER(i915) >= 12)
|
||||
return true;
|
||||
|
||||
if (cpu_transcoder == TRANSCODER_EDP ||
|
||||
@ -479,7 +475,7 @@ intel_dsc_power_domain(const struct intel_crtc_state *crtc_state)
|
||||
* the pipe in use. Hence another reference on the pipe power domain
|
||||
* will suffice. (Except no VDSC/joining on ICL pipe A.)
|
||||
*/
|
||||
if (INTEL_GEN(i915) >= 12 && !IS_ROCKETLAKE(i915) && pipe == PIPE_A)
|
||||
if (DISPLAY_VER(i915) >= 12 && !IS_ROCKETLAKE(i915) && pipe == PIPE_A)
|
||||
return POWER_DOMAIN_TRANSCODER_VDSC_PW2;
|
||||
else if (is_pipe_dsc(crtc_state))
|
||||
return POWER_DOMAIN_PIPE(pipe);
|
||||
@ -1014,20 +1010,14 @@ static i915_reg_t dss_ctl1_reg(const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe;
|
||||
|
||||
if (crtc_state->cpu_transcoder == TRANSCODER_EDP)
|
||||
return DSS_CTL1;
|
||||
|
||||
return ICL_PIPE_DSS_CTL1(pipe);
|
||||
return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL1(pipe) : DSS_CTL1;
|
||||
}
|
||||
|
||||
static i915_reg_t dss_ctl2_reg(const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
enum pipe pipe = to_intel_crtc(crtc_state->uapi.crtc)->pipe;
|
||||
|
||||
if (crtc_state->cpu_transcoder == TRANSCODER_EDP)
|
||||
return DSS_CTL2;
|
||||
|
||||
return ICL_PIPE_DSS_CTL2(pipe);
|
||||
return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL2(pipe) : DSS_CTL2;
|
||||
}
|
||||
|
||||
void intel_dsc_enable(struct intel_encoder *encoder,
|
||||
|
@ -16,7 +16,7 @@ static i915_reg_t intel_vga_cntrl_reg(struct drm_i915_private *i915)
|
||||
{
|
||||
if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
|
||||
return VLV_VGACNTRL;
|
||||
else if (INTEL_GEN(i915) >= 5)
|
||||
else if (DISPLAY_VER(i915) >= 5)
|
||||
return CPU_VGACNTRL;
|
||||
else
|
||||
return VGACNTRL;
|
||||
@ -96,7 +96,7 @@ void intel_vga_reset_io_mem(struct drm_i915_private *i915)
|
||||
static int
|
||||
intel_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
|
||||
{
|
||||
unsigned int reg = INTEL_GEN(i915) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
|
||||
unsigned int reg = DISPLAY_VER(i915) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
|
||||
u16 gmch_ctrl;
|
||||
|
||||
if (pci_read_config_word(i915->bridge_dev, reg, &gmch_ctrl)) {
|
||||
|
@ -15,7 +15,6 @@ struct intel_crtc;
|
||||
struct intel_crtc_state;
|
||||
struct intel_dp;
|
||||
struct intel_encoder;
|
||||
struct intel_crtc;
|
||||
|
||||
bool intel_vrr_is_capable(struct drm_connector *connector);
|
||||
void intel_vrr_check_modeset(struct intel_atomic_state *state);
|
||||
|
@ -115,7 +115,7 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
|
||||
* Once NV12 is enabled, handle it here while allocating scaler
|
||||
* for NV12.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 9 && crtc_state->hw.enable &&
|
||||
if (DISPLAY_VER(dev_priv) >= 9 && crtc_state->hw.enable &&
|
||||
need_scaler && adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"Pipe/Plane scaling not supported with IF-ID mode\n");
|
||||
@ -157,10 +157,10 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
|
||||
/* range checks */
|
||||
if (src_w < SKL_MIN_SRC_W || src_h < SKL_MIN_SRC_H ||
|
||||
dst_w < SKL_MIN_DST_W || dst_h < SKL_MIN_DST_H ||
|
||||
(INTEL_GEN(dev_priv) >= 11 &&
|
||||
(DISPLAY_VER(dev_priv) >= 11 &&
|
||||
(src_w > ICL_MAX_SRC_W || src_h > ICL_MAX_SRC_H ||
|
||||
dst_w > ICL_MAX_DST_W || dst_h > ICL_MAX_DST_H)) ||
|
||||
(INTEL_GEN(dev_priv) < 11 &&
|
||||
(DISPLAY_VER(dev_priv) < 11 &&
|
||||
(src_w > SKL_MAX_SRC_W || src_h > SKL_MAX_SRC_H ||
|
||||
dst_w > SKL_MAX_DST_W || dst_h > SKL_MAX_DST_H))) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
@ -280,7 +280,7 @@ int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
|
||||
case DRM_FORMAT_ABGR16161616F:
|
||||
case DRM_FORMAT_XRGB16161616F:
|
||||
case DRM_FORMAT_ARGB16161616F:
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
break;
|
||||
fallthrough;
|
||||
default:
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "i915_drv.h"
|
||||
#include "intel_atomic_plane.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_fb.h"
|
||||
#include "intel_pm.h"
|
||||
#include "intel_psr.h"
|
||||
#include "intel_sprite.h"
|
||||
@ -275,13 +276,13 @@ static u8 icl_nv12_y_plane_mask(struct drm_i915_private *i915)
|
||||
bool icl_is_nv12_y_plane(struct drm_i915_private *dev_priv,
|
||||
enum plane_id plane_id)
|
||||
{
|
||||
return INTEL_GEN(dev_priv) >= 11 &&
|
||||
return DISPLAY_VER(dev_priv) >= 11 &&
|
||||
icl_nv12_y_plane_mask(dev_priv) & BIT(plane_id);
|
||||
}
|
||||
|
||||
bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id)
|
||||
{
|
||||
return INTEL_GEN(dev_priv) >= 11 &&
|
||||
return DISPLAY_VER(dev_priv) >= 11 &&
|
||||
icl_hdr_plane_mask() & BIT(plane_id);
|
||||
}
|
||||
|
||||
@ -294,7 +295,7 @@ skl_plane_ratio(const struct intel_crtc_state *crtc_state,
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
|
||||
if (fb->format->cpp[0] == 8) {
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
|
||||
if (DISPLAY_VER(dev_priv) >= 10) {
|
||||
*num = 10;
|
||||
*den = 8;
|
||||
} else {
|
||||
@ -317,7 +318,7 @@ static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
|
||||
skl_plane_ratio(crtc_state, plane_state, &num, &den);
|
||||
|
||||
/* two pixels per clock on glk+ */
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
den *= 2;
|
||||
|
||||
return DIV_ROUND_UP(pixel_rate * num, den);
|
||||
@ -561,12 +562,6 @@ icl_program_input_csc(struct intel_plane *plane,
|
||||
PLANE_INPUT_CSC_POSTOFF(pipe, plane_id, 2), 0x0);
|
||||
}
|
||||
|
||||
static bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane)
|
||||
{
|
||||
return fb->modifier == DRM_FORMAT_MOD_LINEAR ||
|
||||
is_gen12_ccs_plane(fb, color_plane);
|
||||
}
|
||||
|
||||
static unsigned int skl_plane_stride_mult(const struct drm_framebuffer *fb,
|
||||
int color_plane, unsigned int rotation)
|
||||
{
|
||||
@ -587,7 +582,7 @@ static u32 skl_plane_stride(const struct intel_plane_state *plane_state,
|
||||
{
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
unsigned int rotation = plane_state->hw.rotation;
|
||||
u32 stride = plane_state->color_plane[color_plane].stride;
|
||||
u32 stride = plane_state->view.color_plane[color_plane].stride;
|
||||
|
||||
if (color_plane >= fb->format->num_planes)
|
||||
return 0;
|
||||
@ -810,7 +805,7 @@ static u32 skl_plane_ctl_crtc(const struct intel_crtc_state *crtc_state)
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
u32 plane_ctl = 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
return plane_ctl;
|
||||
|
||||
if (crtc_state->gamma_enable)
|
||||
@ -834,7 +829,7 @@ static u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
|
||||
|
||||
plane_ctl = PLANE_CTL_ENABLE;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) {
|
||||
if (DISPLAY_VER(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) {
|
||||
plane_ctl |= skl_plane_ctl_alpha(plane_state);
|
||||
plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE;
|
||||
|
||||
@ -849,7 +844,7 @@ static u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
|
||||
plane_ctl |= skl_plane_ctl_tiling(fb->modifier);
|
||||
plane_ctl |= skl_plane_ctl_rotate(rotation & DRM_MODE_ROTATE_MASK);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
plane_ctl |= cnl_plane_ctl_flip(rotation &
|
||||
DRM_MODE_REFLECT_MASK);
|
||||
|
||||
@ -866,7 +861,7 @@ static u32 glk_plane_color_ctl_crtc(const struct intel_crtc_state *crtc_state)
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
u32 plane_color_ctl = 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
return plane_color_ctl;
|
||||
|
||||
if (crtc_state->gamma_enable)
|
||||
@ -914,40 +909,6 @@ static u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
|
||||
return plane_color_ctl;
|
||||
}
|
||||
|
||||
static int
|
||||
main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane)
|
||||
{
|
||||
drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
|
||||
(main_plane && main_plane >= fb->format->num_planes / 2));
|
||||
|
||||
return fb->format->num_planes / 2 + main_plane;
|
||||
}
|
||||
|
||||
int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane)
|
||||
{
|
||||
drm_WARN_ON(fb->dev, !is_ccs_modifier(fb->modifier) ||
|
||||
ccs_plane < fb->format->num_planes / 2);
|
||||
|
||||
if (is_gen12_ccs_cc_plane(fb, ccs_plane))
|
||||
return 0;
|
||||
|
||||
return ccs_plane - fb->format->num_planes / 2;
|
||||
}
|
||||
|
||||
static int
|
||||
skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(fb->dev);
|
||||
|
||||
if (is_ccs_modifier(fb->modifier))
|
||||
return main_to_ccs_plane(fb, main_plane);
|
||||
else if (INTEL_GEN(i915) < 11 &&
|
||||
intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
skl_program_plane(struct intel_plane *plane,
|
||||
const struct intel_crtc_state *crtc_state,
|
||||
@ -958,14 +919,14 @@ skl_program_plane(struct intel_plane *plane,
|
||||
enum plane_id plane_id = plane->id;
|
||||
enum pipe pipe = plane->pipe;
|
||||
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
|
||||
u32 surf_addr = plane_state->color_plane[color_plane].offset;
|
||||
u32 surf_addr = plane_state->view.color_plane[color_plane].offset;
|
||||
u32 stride = skl_plane_stride(plane_state, color_plane);
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
int aux_plane = skl_main_to_aux_plane(fb, color_plane);
|
||||
int crtc_x = plane_state->uapi.dst.x1;
|
||||
int crtc_y = plane_state->uapi.dst.y1;
|
||||
u32 x = plane_state->color_plane[color_plane].x;
|
||||
u32 y = plane_state->color_plane[color_plane].y;
|
||||
u32 x = plane_state->view.color_plane[color_plane].x;
|
||||
u32 y = plane_state->view.color_plane[color_plane].y;
|
||||
u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
|
||||
u8 alpha = plane_state->hw.alpha >> 8;
|
||||
@ -976,7 +937,7 @@ skl_program_plane(struct intel_plane *plane,
|
||||
|
||||
plane_ctl |= skl_plane_ctl_crtc(crtc_state);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
plane_color_ctl = plane_state->color_ctl |
|
||||
glk_plane_color_ctl_crtc(crtc_state);
|
||||
|
||||
@ -997,9 +958,9 @@ skl_program_plane(struct intel_plane *plane,
|
||||
}
|
||||
|
||||
if (aux_plane) {
|
||||
aux_dist = plane_state->color_plane[aux_plane].offset - surf_addr;
|
||||
aux_dist = plane_state->view.color_plane[aux_plane].offset - surf_addr;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12)
|
||||
if (DISPLAY_VER(dev_priv) < 12)
|
||||
aux_dist |= skl_plane_stride(plane_state, aux_plane);
|
||||
}
|
||||
|
||||
@ -1017,7 +978,7 @@ skl_program_plane(struct intel_plane *plane,
|
||||
intel_de_write_fw(dev_priv, PLANE_CUS_CTL(pipe, plane_id),
|
||||
plane_state->cus_ctl);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
intel_de_write_fw(dev_priv, PLANE_COLOR_CTL(pipe, plane_id),
|
||||
plane_color_ctl);
|
||||
|
||||
@ -1038,9 +999,10 @@ skl_program_plane(struct intel_plane *plane,
|
||||
intel_de_write_fw(dev_priv, PLANE_OFFSET(pipe, plane_id),
|
||||
(y << 16) | x);
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 11)
|
||||
if (DISPLAY_VER(dev_priv) < 11)
|
||||
intel_de_write_fw(dev_priv, PLANE_AUX_OFFSET(pipe, plane_id),
|
||||
(plane_state->color_plane[1].y << 16) | plane_state->color_plane[1].x);
|
||||
(plane_state->view.color_plane[1].y << 16) |
|
||||
plane_state->view.color_plane[1].x);
|
||||
|
||||
if (!drm_atomic_crtc_needs_modeset(&crtc_state->uapi))
|
||||
intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, color_plane);
|
||||
@ -1070,7 +1032,7 @@ skl_plane_async_flip(struct intel_plane *plane,
|
||||
unsigned long irqflags;
|
||||
enum plane_id plane_id = plane->id;
|
||||
enum pipe pipe = plane->pipe;
|
||||
u32 surf_addr = plane_state->color_plane[0].offset;
|
||||
u32 surf_addr = plane_state->view.color_plane[0].offset;
|
||||
u32 plane_ctl = plane_state->ctl;
|
||||
|
||||
plane_ctl |= skl_plane_ctl_crtc(crtc_state);
|
||||
@ -1154,7 +1116,7 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
|
||||
*/
|
||||
switch (fb->format->format) {
|
||||
case DRM_FORMAT_RGB565:
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
break;
|
||||
fallthrough;
|
||||
case DRM_FORMAT_C8:
|
||||
@ -1222,7 +1184,7 @@ static int skl_plane_check_dst_coordinates(const struct intel_crtc_state *crtc_s
|
||||
* than the cursor ending less than 4 pixels from the left edge of the
|
||||
* screen may cause FIFO underflow and display corruption.
|
||||
*/
|
||||
if ((IS_GEMINILAKE(dev_priv) || IS_CANNONLAKE(dev_priv)) &&
|
||||
if (IS_DISPLAY_VER(dev_priv, 10) &&
|
||||
(crtc_x + crtc_w < 4 || crtc_x > pipe_src_w - 4)) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"requested plane X %s position %d invalid (valid range %d-%d)\n",
|
||||
@ -1262,7 +1224,7 @@ static int skl_plane_max_scale(struct drm_i915_private *dev_priv,
|
||||
* the best case.
|
||||
* FIXME need to properly check this later.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) ||
|
||||
if (DISPLAY_VER(dev_priv) >= 10 ||
|
||||
!intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
|
||||
return 0x30000 - 1;
|
||||
else
|
||||
@ -1308,9 +1270,9 @@ skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state,
|
||||
int ccs_plane)
|
||||
{
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
int aux_x = plane_state->color_plane[ccs_plane].x;
|
||||
int aux_y = plane_state->color_plane[ccs_plane].y;
|
||||
u32 aux_offset = plane_state->color_plane[ccs_plane].offset;
|
||||
int aux_x = plane_state->view.color_plane[ccs_plane].x;
|
||||
int aux_y = plane_state->view.color_plane[ccs_plane].y;
|
||||
u32 aux_offset = plane_state->view.color_plane[ccs_plane].offset;
|
||||
u32 alignment = intel_surf_alignment(fb, ccs_plane);
|
||||
int hsub;
|
||||
int vsub;
|
||||
@ -1340,9 +1302,9 @@ skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state,
|
||||
if (aux_x != main_x || aux_y != main_y)
|
||||
return false;
|
||||
|
||||
plane_state->color_plane[ccs_plane].offset = aux_offset;
|
||||
plane_state->color_plane[ccs_plane].x = aux_x;
|
||||
plane_state->color_plane[ccs_plane].y = aux_y;
|
||||
plane_state->view.color_plane[ccs_plane].offset = aux_offset;
|
||||
plane_state->view.color_plane[ccs_plane].x = aux_x;
|
||||
plane_state->view.color_plane[ccs_plane].y = aux_y;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1355,7 +1317,7 @@ int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
const int aux_plane = skl_main_to_aux_plane(fb, 0);
|
||||
const u32 aux_offset = plane_state->color_plane[aux_plane].offset;
|
||||
const u32 aux_offset = plane_state->view.color_plane[aux_plane].offset;
|
||||
const u32 alignment = intel_surf_alignment(fb, 0);
|
||||
const int w = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
|
||||
@ -1383,7 +1345,7 @@ int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
|
||||
if (fb->modifier == I915_FORMAT_MOD_X_TILED) {
|
||||
int cpp = fb->format->cpp[0];
|
||||
|
||||
while ((*x + w) * cpp > plane_state->color_plane[0].stride) {
|
||||
while ((*x + w) * cpp > plane_state->view.color_plane[0].stride) {
|
||||
if (*offset == 0) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"Unable to find suitable display surface offset due to X-tiling\n");
|
||||
@ -1442,8 +1404,8 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
|
||||
offset, offset - alignment);
|
||||
}
|
||||
|
||||
if (x != plane_state->color_plane[aux_plane].x ||
|
||||
y != plane_state->color_plane[aux_plane].y) {
|
||||
if (x != plane_state->view.color_plane[aux_plane].x ||
|
||||
y != plane_state->view.color_plane[aux_plane].y) {
|
||||
drm_dbg_kms(&dev_priv->drm,
|
||||
"Unable to find suitable display surface offset due to CCS\n");
|
||||
return -EINVAL;
|
||||
@ -1452,9 +1414,9 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
|
||||
|
||||
drm_WARN_ON(&dev_priv->drm, x > 8191 || y > 8191);
|
||||
|
||||
plane_state->color_plane[0].offset = offset;
|
||||
plane_state->color_plane[0].x = x;
|
||||
plane_state->color_plane[0].y = y;
|
||||
plane_state->view.color_plane[0].offset = offset;
|
||||
plane_state->view.color_plane[0].x = x;
|
||||
plane_state->view.color_plane[0].y = y;
|
||||
|
||||
/*
|
||||
* Put the final coordinates back so that the src
|
||||
@ -1495,7 +1457,7 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state)
|
||||
|
||||
if (is_ccs_modifier(fb->modifier)) {
|
||||
int ccs_plane = main_to_ccs_plane(fb, uv_plane);
|
||||
u32 aux_offset = plane_state->color_plane[ccs_plane].offset;
|
||||
u32 aux_offset = plane_state->view.color_plane[ccs_plane].offset;
|
||||
u32 alignment = intel_surf_alignment(fb, uv_plane);
|
||||
|
||||
if (offset > aux_offset)
|
||||
@ -1516,8 +1478,8 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state)
|
||||
offset, offset - alignment);
|
||||
}
|
||||
|
||||
if (x != plane_state->color_plane[ccs_plane].x ||
|
||||
y != plane_state->color_plane[ccs_plane].y) {
|
||||
if (x != plane_state->view.color_plane[ccs_plane].x ||
|
||||
y != plane_state->view.color_plane[ccs_plane].y) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"Unable to find suitable display surface offset due to CCS\n");
|
||||
return -EINVAL;
|
||||
@ -1526,9 +1488,9 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state)
|
||||
|
||||
drm_WARN_ON(&i915->drm, x > 8191 || y > 8191);
|
||||
|
||||
plane_state->color_plane[uv_plane].offset = offset;
|
||||
plane_state->color_plane[uv_plane].x = x;
|
||||
plane_state->color_plane[uv_plane].y = y;
|
||||
plane_state->view.color_plane[uv_plane].offset = offset;
|
||||
plane_state->view.color_plane[uv_plane].x = x;
|
||||
plane_state->view.color_plane[uv_plane].y = y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1565,13 +1527,9 @@ static int skl_check_ccs_aux_surface(struct intel_plane_state *plane_state)
|
||||
plane_state,
|
||||
ccs_plane);
|
||||
|
||||
plane_state->color_plane[ccs_plane].offset = offset;
|
||||
plane_state->color_plane[ccs_plane].x = (x * hsub +
|
||||
src_x % hsub) /
|
||||
main_hsub;
|
||||
plane_state->color_plane[ccs_plane].y = (y * vsub +
|
||||
src_y % vsub) /
|
||||
main_vsub;
|
||||
plane_state->view.color_plane[ccs_plane].offset = offset;
|
||||
plane_state->view.color_plane[ccs_plane].x = (x * hsub + src_x % hsub) / main_hsub;
|
||||
plane_state->view.color_plane[ccs_plane].y = (y * vsub + src_y % vsub) / main_vsub;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1580,7 +1538,7 @@ static int skl_check_ccs_aux_surface(struct intel_plane_state *plane_state)
|
||||
static int skl_check_plane_surface(struct intel_plane_state *plane_state)
|
||||
{
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
int ret, i;
|
||||
int ret;
|
||||
|
||||
ret = intel_plane_compute_gtt(plane_state);
|
||||
if (ret)
|
||||
@ -1606,12 +1564,6 @@ static int skl_check_plane_surface(struct intel_plane_state *plane_state)
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = fb->format->num_planes; i < ARRAY_SIZE(plane_state->color_plane); i++) {
|
||||
plane_state->color_plane[i].offset = 0;
|
||||
plane_state->color_plane[i].x = 0;
|
||||
plane_state->color_plane[i].y = 0;
|
||||
}
|
||||
|
||||
ret = skl_check_main_surface(plane_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -1631,7 +1583,7 @@ static bool skl_fb_scalable(const struct drm_framebuffer *fb)
|
||||
case DRM_FORMAT_ARGB16161616F:
|
||||
case DRM_FORMAT_XBGR16161616F:
|
||||
case DRM_FORMAT_ABGR16161616F:
|
||||
return INTEL_GEN(to_i915(fb->dev)) >= 11;
|
||||
return DISPLAY_VER(to_i915(fb->dev)) >= 11;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
@ -1687,7 +1639,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
|
||||
|
||||
plane_state->ctl = skl_plane_ctl(crtc_state, plane_state);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
plane_state->color_ctl = glk_plane_color_ctl(crtc_state,
|
||||
plane_state);
|
||||
|
||||
@ -1719,7 +1671,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
|
||||
if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
|
||||
return false;
|
||||
|
||||
if (IS_GEN(dev_priv, 9) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
|
||||
if (IS_DISPLAY_VER(dev_priv, 9) && pipe == PIPE_C)
|
||||
return false;
|
||||
|
||||
if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
|
||||
@ -1776,7 +1728,7 @@ static bool skl_plane_has_ccs(struct drm_i915_private *dev_priv,
|
||||
if (plane_id == PLANE_CURSOR)
|
||||
return false;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
return true;
|
||||
|
||||
if (IS_GEMINILAKE(dev_priv))
|
||||
@ -1858,7 +1810,7 @@ static bool gen12_plane_supports_mc_ccs(struct drm_i915_private *dev_priv,
|
||||
{
|
||||
/* Wa_14010477008:tgl[a0..c0],rkl[all],dg1[all] */
|
||||
if (IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv) ||
|
||||
IS_TGL_DISP_STEPPING(dev_priv, STEP_A0, STEP_C0))
|
||||
IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_C0))
|
||||
return false;
|
||||
|
||||
return plane_id < PLANE_SPRITE4;
|
||||
@ -2009,11 +1961,11 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
|
||||
fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
plane->min_width = icl_plane_min_width;
|
||||
plane->max_width = icl_plane_max_width;
|
||||
plane->max_height = icl_plane_max_height;
|
||||
} else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 10) {
|
||||
plane->max_width = glk_plane_max_width;
|
||||
plane->max_height = skl_plane_max_height;
|
||||
} else {
|
||||
@ -2029,16 +1981,17 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
|
||||
plane->min_cdclk = skl_plane_min_cdclk;
|
||||
|
||||
if (plane_id == PLANE_PRIMARY) {
|
||||
plane->need_async_flip_disable_wa = IS_GEN_RANGE(dev_priv, 9, 10);
|
||||
plane->need_async_flip_disable_wa = IS_DISPLAY_RANGE(dev_priv,
|
||||
9, 10);
|
||||
plane->async_flip = skl_plane_async_flip;
|
||||
plane->enable_flip_done = skl_plane_enable_flip_done;
|
||||
plane->disable_flip_done = skl_plane_disable_flip_done;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
formats = icl_get_plane_formats(dev_priv, pipe,
|
||||
plane_id, &num_formats);
|
||||
else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
else if (DISPLAY_VER(dev_priv) >= 10)
|
||||
formats = glk_get_plane_formats(dev_priv, pipe,
|
||||
plane_id, &num_formats);
|
||||
else
|
||||
@ -2046,7 +1999,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
|
||||
plane_id, &num_formats);
|
||||
|
||||
plane->has_ccs = skl_plane_has_ccs(dev_priv, pipe, plane_id);
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
modifiers = gen12_get_plane_modifiers(dev_priv, plane_id);
|
||||
plane_funcs = &gen12_plane_funcs;
|
||||
} else {
|
||||
@ -2075,7 +2028,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
|
||||
DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
|
||||
DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
supported_rotations |= DRM_MODE_REFLECT_X;
|
||||
|
||||
drm_plane_create_rotation_property(&plane->base,
|
||||
@ -2084,7 +2037,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
|
||||
|
||||
supported_csc = BIT(DRM_COLOR_YCBCR_BT601) | BIT(DRM_COLOR_YCBCR_BT709);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
supported_csc |= BIT(DRM_COLOR_YCBCR_BT2020);
|
||||
|
||||
drm_plane_create_color_properties(&plane->base,
|
||||
@ -2102,10 +2055,10 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
|
||||
|
||||
drm_plane_create_zpos_immutable_property(&plane->base, plane_id);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
drm_plane_enable_fb_damage_clips(&plane->base);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10)
|
||||
if (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv))
|
||||
drm_plane_create_scaling_filter_property(&plane->base,
|
||||
BIT(DRM_SCALING_FILTER_DEFAULT) |
|
||||
BIT(DRM_SCALING_FILTER_NEAREST_NEIGHBOR));
|
||||
@ -2159,12 +2112,12 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
|
||||
|
||||
val = intel_de_read(dev_priv, PLANE_CTL(pipe, plane_id));
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
pixel_format = val & ICL_PLANE_CTL_FORMAT_MASK;
|
||||
else
|
||||
pixel_format = val & PLANE_CTL_FORMAT_MASK;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
|
||||
if (DISPLAY_VER(dev_priv) >= 10) {
|
||||
alpha = intel_de_read(dev_priv,
|
||||
PLANE_COLOR_CTL(pipe, plane_id));
|
||||
alpha &= PLANE_COLOR_ALPHA_MASK;
|
||||
@ -2188,7 +2141,7 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
|
||||
case PLANE_CTL_TILED_Y:
|
||||
plane_config->tiling = I915_TILING_Y;
|
||||
if (val & PLANE_CTL_RENDER_DECOMPRESSION_ENABLE)
|
||||
fb->modifier = INTEL_GEN(dev_priv) >= 12 ?
|
||||
fb->modifier = DISPLAY_VER(dev_priv) >= 12 ?
|
||||
I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS :
|
||||
I915_FORMAT_MOD_Y_TILED_CCS;
|
||||
else if (val & PLANE_CTL_MEDIA_DECOMPRESSION_ENABLE)
|
||||
@ -2226,8 +2179,7 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
|
||||
break;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 &&
|
||||
val & PLANE_CTL_FLIP_HORIZONTAL)
|
||||
if ((DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)) && val & PLANE_CTL_FLIP_HORIZONTAL)
|
||||
plane_config->rotation |= DRM_MODE_REFLECT_X;
|
||||
|
||||
/* 90/270 degree rotation would require extra work */
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct drm_framebuffer;
|
||||
struct drm_i915_private;
|
||||
struct intel_crtc;
|
||||
struct intel_initial_plane_config;
|
||||
@ -26,7 +25,6 @@ void skl_get_initial_plane_config(struct intel_crtc *crtc,
|
||||
|
||||
int skl_format_to_fourcc(int format, bool rgb_order, bool alpha);
|
||||
|
||||
int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane);
|
||||
int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
|
||||
int *x, int *y, u32 *offset);
|
||||
|
||||
|
@ -42,7 +42,7 @@ int gen8_emit_flush_rcs(struct i915_request *rq, u32 mode)
|
||||
vf_flush_wa = true;
|
||||
|
||||
/* WaForGAMHang:kbl */
|
||||
if (IS_KBL_GT_REVID(rq->engine->i915, 0, KBL_REVID_B0))
|
||||
if (IS_KBL_GT_STEP(rq->engine->i915, 0, STEP_B0))
|
||||
dc_flush_wa = true;
|
||||
}
|
||||
|
||||
|
@ -1267,14 +1267,16 @@ void i915_ggtt_resume(struct i915_ggtt *ggtt)
|
||||
static struct scatterlist *
|
||||
rotate_pages(struct drm_i915_gem_object *obj, unsigned int offset,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int stride,
|
||||
unsigned int src_stride, unsigned int dst_stride,
|
||||
struct sg_table *st, struct scatterlist *sg)
|
||||
{
|
||||
unsigned int column, row;
|
||||
unsigned int src_idx;
|
||||
|
||||
for (column = 0; column < width; column++) {
|
||||
src_idx = stride * (height - 1) + column + offset;
|
||||
unsigned int left;
|
||||
|
||||
src_idx = src_stride * (height - 1) + column + offset;
|
||||
for (row = 0; row < height; row++) {
|
||||
st->nents++;
|
||||
/*
|
||||
@ -1287,8 +1289,25 @@ rotate_pages(struct drm_i915_gem_object *obj, unsigned int offset,
|
||||
i915_gem_object_get_dma_address(obj, src_idx);
|
||||
sg_dma_len(sg) = I915_GTT_PAGE_SIZE;
|
||||
sg = sg_next(sg);
|
||||
src_idx -= stride;
|
||||
src_idx -= src_stride;
|
||||
}
|
||||
|
||||
left = (dst_stride - height) * I915_GTT_PAGE_SIZE;
|
||||
|
||||
if (!left)
|
||||
continue;
|
||||
|
||||
st->nents++;
|
||||
|
||||
/*
|
||||
* The DE ignores the PTEs for the padding tiles, the sg entry
|
||||
* here is just a conenience to indicate how many padding PTEs
|
||||
* to insert at this spot.
|
||||
*/
|
||||
sg_set_page(sg, NULL, left, 0);
|
||||
sg_dma_address(sg) = 0;
|
||||
sg_dma_len(sg) = left;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
|
||||
return sg;
|
||||
@ -1317,11 +1336,12 @@ intel_rotate_pages(struct intel_rotation_info *rot_info,
|
||||
st->nents = 0;
|
||||
sg = st->sgl;
|
||||
|
||||
for (i = 0 ; i < ARRAY_SIZE(rot_info->plane); i++) {
|
||||
for (i = 0 ; i < ARRAY_SIZE(rot_info->plane); i++)
|
||||
sg = rotate_pages(obj, rot_info->plane[i].offset,
|
||||
rot_info->plane[i].width, rot_info->plane[i].height,
|
||||
rot_info->plane[i].stride, st, sg);
|
||||
}
|
||||
rot_info->plane[i].src_stride,
|
||||
rot_info->plane[i].dst_stride,
|
||||
st, sg);
|
||||
|
||||
return st;
|
||||
|
||||
@ -1339,7 +1359,7 @@ err_st_alloc:
|
||||
static struct scatterlist *
|
||||
remap_pages(struct drm_i915_gem_object *obj, unsigned int offset,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int stride,
|
||||
unsigned int src_stride, unsigned int dst_stride,
|
||||
struct sg_table *st, struct scatterlist *sg)
|
||||
{
|
||||
unsigned int row;
|
||||
@ -1372,7 +1392,24 @@ remap_pages(struct drm_i915_gem_object *obj, unsigned int offset,
|
||||
left -= length;
|
||||
}
|
||||
|
||||
offset += stride - width;
|
||||
offset += src_stride - width;
|
||||
|
||||
left = (dst_stride - width) * I915_GTT_PAGE_SIZE;
|
||||
|
||||
if (!left)
|
||||
continue;
|
||||
|
||||
st->nents++;
|
||||
|
||||
/*
|
||||
* The DE ignores the PTEs for the padding tiles, the sg entry
|
||||
* here is just a conenience to indicate how many padding PTEs
|
||||
* to insert at this spot.
|
||||
*/
|
||||
sg_set_page(sg, NULL, left, 0);
|
||||
sg_dma_address(sg) = 0;
|
||||
sg_dma_len(sg) = left;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
|
||||
return sg;
|
||||
@ -1404,7 +1441,8 @@ intel_remap_pages(struct intel_remapped_info *rem_info,
|
||||
for (i = 0 ; i < ARRAY_SIZE(rem_info->plane); i++) {
|
||||
sg = remap_pages(obj, rem_info->plane[i].offset,
|
||||
rem_info->plane[i].width, rem_info->plane[i].height,
|
||||
rem_info->plane[i].stride, st, sg);
|
||||
rem_info->plane[i].src_stride, rem_info->plane[i].dst_stride,
|
||||
st, sg);
|
||||
}
|
||||
|
||||
i915_sg_trim(st);
|
||||
|
@ -298,7 +298,18 @@ void i915_vma_revoke_fence(struct i915_vma *vma)
|
||||
WRITE_ONCE(fence->vma, NULL);
|
||||
vma->fence = NULL;
|
||||
|
||||
with_intel_runtime_pm_if_in_use(fence_to_uncore(fence)->rpm, wakeref)
|
||||
/*
|
||||
* Skip the write to HW if and only if the device is currently
|
||||
* suspended.
|
||||
*
|
||||
* If the driver does not currently hold a wakeref (if_in_use == 0),
|
||||
* the device may currently be runtime suspended, or it may be woken
|
||||
* up before the suspend takes place. If the device is not suspended
|
||||
* (powered down) and we skip clearing the fence register, the HW is
|
||||
* left in an undefined state where we may end up with multiple
|
||||
* registers overlapping.
|
||||
*/
|
||||
with_intel_runtime_pm_if_active(fence_to_uncore(fence)->rpm, wakeref)
|
||||
fence_write(fence);
|
||||
}
|
||||
|
||||
|
@ -52,45 +52,6 @@
|
||||
* - Public functions to init or apply the given workaround type.
|
||||
*/
|
||||
|
||||
/*
|
||||
* KBL revision ID ordering is bizarre; higher revision ID's map to lower
|
||||
* steppings in some cases. So rather than test against the revision ID
|
||||
* directly, let's map that into our own range of increasing ID's that we
|
||||
* can test against in a regular manner.
|
||||
*/
|
||||
|
||||
const struct i915_rev_steppings kbl_revids[] = {
|
||||
[0] = { .gt_stepping = KBL_REVID_A0, .disp_stepping = KBL_REVID_A0 },
|
||||
[1] = { .gt_stepping = KBL_REVID_B0, .disp_stepping = KBL_REVID_B0 },
|
||||
[2] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B0 },
|
||||
[3] = { .gt_stepping = KBL_REVID_D0, .disp_stepping = KBL_REVID_B0 },
|
||||
[4] = { .gt_stepping = KBL_REVID_F0, .disp_stepping = KBL_REVID_C0 },
|
||||
[5] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B1 },
|
||||
[6] = { .gt_stepping = KBL_REVID_D1, .disp_stepping = KBL_REVID_B1 },
|
||||
[7] = { .gt_stepping = KBL_REVID_G0, .disp_stepping = KBL_REVID_C0 },
|
||||
};
|
||||
|
||||
const struct i915_rev_steppings tgl_uy_revid_step_tbl[] = {
|
||||
[0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A0 },
|
||||
[1] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_C0 },
|
||||
[2] = { .gt_stepping = STEP_B1, .disp_stepping = STEP_C0 },
|
||||
[3] = { .gt_stepping = STEP_C0, .disp_stepping = STEP_D0 },
|
||||
};
|
||||
|
||||
/* Same GT stepping between tgl_uy_revids and tgl_revids don't mean the same HW */
|
||||
const struct i915_rev_steppings tgl_revid_step_tbl[] = {
|
||||
[0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_B0 },
|
||||
[1] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_D0 },
|
||||
};
|
||||
|
||||
const struct i915_rev_steppings adls_revid_step_tbl[] = {
|
||||
[0x0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A0 },
|
||||
[0x1] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A2 },
|
||||
[0x4] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_B0 },
|
||||
[0x8] = { .gt_stepping = STEP_C0, .disp_stepping = STEP_B0 },
|
||||
[0xC] = { .gt_stepping = STEP_D0, .disp_stepping = STEP_C0 },
|
||||
};
|
||||
|
||||
static void wa_init_start(struct i915_wa_list *wal, const char *name, const char *engine_name)
|
||||
{
|
||||
wal->name = name;
|
||||
@ -520,7 +481,7 @@ static void kbl_ctx_workarounds_init(struct intel_engine_cs *engine,
|
||||
gen9_ctx_workarounds_init(engine, wal);
|
||||
|
||||
/* WaToEnableHwFixForPushConstHWBug:kbl */
|
||||
if (IS_KBL_GT_REVID(i915, KBL_REVID_C0, REVID_FOREVER))
|
||||
if (IS_KBL_GT_STEP(i915, STEP_C0, STEP_FOREVER))
|
||||
wa_masked_en(wal, COMMON_SLICE_CHICKEN2,
|
||||
GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION);
|
||||
|
||||
@ -938,7 +899,7 @@ kbl_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal)
|
||||
gen9_gt_workarounds_init(i915, wal);
|
||||
|
||||
/* WaDisableDynamicCreditSharing:kbl */
|
||||
if (IS_KBL_GT_REVID(i915, 0, KBL_REVID_B0))
|
||||
if (IS_KBL_GT_STEP(i915, 0, STEP_B0))
|
||||
wa_write_or(wal,
|
||||
GAMT_CHKN_BIT_REG,
|
||||
GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING);
|
||||
@ -1130,19 +1091,19 @@ tgl_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal)
|
||||
gen12_gt_workarounds_init(i915, wal);
|
||||
|
||||
/* Wa_1409420604:tgl */
|
||||
if (IS_TGL_UY_GT_STEPPING(i915, STEP_A0, STEP_A0))
|
||||
if (IS_TGL_UY_GT_STEP(i915, STEP_A0, STEP_A0))
|
||||
wa_write_or(wal,
|
||||
SUBSLICE_UNIT_LEVEL_CLKGATE2,
|
||||
CPSSUNIT_CLKGATE_DIS);
|
||||
|
||||
/* Wa_1607087056:tgl also know as BUG:1409180338 */
|
||||
if (IS_TGL_UY_GT_STEPPING(i915, STEP_A0, STEP_A0))
|
||||
if (IS_TGL_UY_GT_STEP(i915, STEP_A0, STEP_A0))
|
||||
wa_write_or(wal,
|
||||
SLICE_UNIT_LEVEL_CLKGATE,
|
||||
L3_CLKGATE_DIS | L3_CR2X_CLKGATE_DIS);
|
||||
|
||||
/* Wa_1408615072:tgl[a0] */
|
||||
if (IS_TGL_UY_GT_STEPPING(i915, STEP_A0, STEP_A0))
|
||||
if (IS_TGL_UY_GT_STEP(i915, STEP_A0, STEP_A0))
|
||||
wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2,
|
||||
VSUNIT_CLKGATE_DIS_TGL);
|
||||
}
|
||||
@ -1620,7 +1581,7 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal)
|
||||
struct drm_i915_private *i915 = engine->i915;
|
||||
|
||||
if (IS_DG1_REVID(i915, DG1_REVID_A0, DG1_REVID_A0) ||
|
||||
IS_TGL_UY_GT_STEPPING(i915, STEP_A0, STEP_A0)) {
|
||||
IS_TGL_UY_GT_STEP(i915, STEP_A0, STEP_A0)) {
|
||||
/*
|
||||
* Wa_1607138336:tgl[a0],dg1[a0]
|
||||
* Wa_1607063988:tgl[a0],dg1[a0]
|
||||
@ -1630,7 +1591,7 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal)
|
||||
GEN12_DISABLE_POSH_BUSY_FF_DOP_CG);
|
||||
}
|
||||
|
||||
if (IS_TGL_UY_GT_STEPPING(i915, STEP_A0, STEP_A0)) {
|
||||
if (IS_TGL_UY_GT_STEP(i915, STEP_A0, STEP_A0)) {
|
||||
/*
|
||||
* Wa_1606679103:tgl
|
||||
* (see also Wa_1606682166:icl)
|
||||
@ -2059,7 +2020,7 @@ xcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal)
|
||||
struct drm_i915_private *i915 = engine->i915;
|
||||
|
||||
/* WaKBLVECSSemaphoreWaitPoll:kbl */
|
||||
if (IS_KBL_GT_REVID(i915, KBL_REVID_A0, KBL_REVID_E0)) {
|
||||
if (IS_KBL_GT_STEP(i915, STEP_A0, STEP_E0)) {
|
||||
wa_write(wal,
|
||||
RING_SEMA_WAIT_POLL(engine->mmio_base),
|
||||
1);
|
||||
|
@ -173,26 +173,30 @@ i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
|
||||
break;
|
||||
|
||||
case I915_GGTT_VIEW_ROTATED:
|
||||
seq_printf(m, ", rotated [(%ux%u, stride=%u, offset=%u), (%ux%u, stride=%u, offset=%u)]",
|
||||
seq_printf(m, ", rotated [(%ux%u, src_stride=%u, dst_stride=%u, offset=%u), (%ux%u, src_stride=%u, dst_stride=%u, offset=%u)]",
|
||||
vma->ggtt_view.rotated.plane[0].width,
|
||||
vma->ggtt_view.rotated.plane[0].height,
|
||||
vma->ggtt_view.rotated.plane[0].stride,
|
||||
vma->ggtt_view.rotated.plane[0].src_stride,
|
||||
vma->ggtt_view.rotated.plane[0].dst_stride,
|
||||
vma->ggtt_view.rotated.plane[0].offset,
|
||||
vma->ggtt_view.rotated.plane[1].width,
|
||||
vma->ggtt_view.rotated.plane[1].height,
|
||||
vma->ggtt_view.rotated.plane[1].stride,
|
||||
vma->ggtt_view.rotated.plane[1].src_stride,
|
||||
vma->ggtt_view.rotated.plane[1].dst_stride,
|
||||
vma->ggtt_view.rotated.plane[1].offset);
|
||||
break;
|
||||
|
||||
case I915_GGTT_VIEW_REMAPPED:
|
||||
seq_printf(m, ", remapped [(%ux%u, stride=%u, offset=%u), (%ux%u, stride=%u, offset=%u)]",
|
||||
seq_printf(m, ", remapped [(%ux%u, src_stride=%u, dst_stride=%u, offset=%u), (%ux%u, src_stride=%u, dst_stride=%u, offset=%u)]",
|
||||
vma->ggtt_view.remapped.plane[0].width,
|
||||
vma->ggtt_view.remapped.plane[0].height,
|
||||
vma->ggtt_view.remapped.plane[0].stride,
|
||||
vma->ggtt_view.remapped.plane[0].src_stride,
|
||||
vma->ggtt_view.remapped.plane[0].dst_stride,
|
||||
vma->ggtt_view.remapped.plane[0].offset,
|
||||
vma->ggtt_view.remapped.plane[1].width,
|
||||
vma->ggtt_view.remapped.plane[1].height,
|
||||
vma->ggtt_view.remapped.plane[1].stride,
|
||||
vma->ggtt_view.remapped.plane[1].src_stride,
|
||||
vma->ggtt_view.remapped.plane[1].dst_stride,
|
||||
vma->ggtt_view.remapped.plane[1].offset);
|
||||
break;
|
||||
|
||||
|
@ -272,7 +272,7 @@ static void intel_detect_preproduction_hw(struct drm_i915_private *dev_priv)
|
||||
pre |= IS_HSW_EARLY_SDV(dev_priv);
|
||||
pre |= IS_SKL_REVID(dev_priv, 0, SKL_REVID_F0);
|
||||
pre |= IS_BXT_REVID(dev_priv, 0, BXT_REVID_B_LAST);
|
||||
pre |= IS_KBL_GT_REVID(dev_priv, 0, KBL_REVID_A0);
|
||||
pre |= IS_KBL_GT_STEP(dev_priv, 0, STEP_A0);
|
||||
pre |= IS_GLK_REVID(dev_priv, 0, GLK_REVID_A2);
|
||||
|
||||
if (pre) {
|
||||
@ -306,6 +306,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
|
||||
return -ENODEV;
|
||||
|
||||
intel_device_info_subplatform_init(dev_priv);
|
||||
intel_step_init(dev_priv);
|
||||
|
||||
intel_uncore_mmio_debug_init_early(&dev_priv->mmio_debug);
|
||||
intel_uncore_init_early(&dev_priv->uncore, dev_priv);
|
||||
|
@ -86,9 +86,10 @@
|
||||
#include "gt/uc/intel_uc.h"
|
||||
|
||||
#include "intel_device_info.h"
|
||||
#include "intel_memory_region.h"
|
||||
#include "intel_pch.h"
|
||||
#include "intel_runtime_pm.h"
|
||||
#include "intel_memory_region.h"
|
||||
#include "intel_step.h"
|
||||
#include "intel_uncore.h"
|
||||
#include "intel_wakeref.h"
|
||||
#include "intel_wopcm.h"
|
||||
@ -583,7 +584,7 @@ i915_fence_timeout(const struct drm_i915_private *i915)
|
||||
|
||||
struct ddi_vbt_port_info {
|
||||
/* Non-NULL if port present. */
|
||||
const struct child_device_config *child;
|
||||
struct intel_bios_encoder_data *devdata;
|
||||
|
||||
int max_tmds_clock;
|
||||
|
||||
@ -591,18 +592,9 @@ struct ddi_vbt_port_info {
|
||||
u8 hdmi_level_shift;
|
||||
u8 hdmi_level_shift_set:1;
|
||||
|
||||
u8 supports_dvi:1;
|
||||
u8 supports_hdmi:1;
|
||||
u8 supports_dp:1;
|
||||
u8 supports_edp:1;
|
||||
u8 supports_typec_usb:1;
|
||||
u8 supports_tbt:1;
|
||||
|
||||
u8 alternate_aux_channel;
|
||||
u8 alternate_ddc_pin;
|
||||
|
||||
u8 dp_boost_level;
|
||||
u8 hdmi_boost_level;
|
||||
int dp_max_link_rate; /* 0 for not limited by VBT */
|
||||
};
|
||||
|
||||
@ -614,6 +606,9 @@ enum psr_lines_to_wait {
|
||||
};
|
||||
|
||||
struct intel_vbt_data {
|
||||
/* bdb version */
|
||||
u16 version;
|
||||
|
||||
struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
|
||||
struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
|
||||
|
||||
@ -1242,6 +1237,11 @@ static inline struct drm_i915_private *pdev_to_i915(struct pci_dev *pdev)
|
||||
#define INTEL_GEN(dev_priv) (INTEL_INFO(dev_priv)->gen)
|
||||
#define INTEL_DEVID(dev_priv) (RUNTIME_INFO(dev_priv)->device_id)
|
||||
|
||||
#define DISPLAY_VER(i915) (INTEL_INFO(i915)->display.version)
|
||||
#define IS_DISPLAY_RANGE(i915, from, until) \
|
||||
(DISPLAY_VER(i915) >= (from) && DISPLAY_VER(i915) <= (until))
|
||||
#define IS_DISPLAY_VER(i915, v) (DISPLAY_VER(i915) == (v))
|
||||
|
||||
#define REVID_FOREVER 0xff
|
||||
#define INTEL_REVID(dev_priv) (to_pci_dev((dev_priv)->drm.dev)->revision)
|
||||
|
||||
@ -1268,6 +1268,17 @@ static inline struct drm_i915_private *pdev_to_i915(struct pci_dev *pdev)
|
||||
#define IS_REVID(p, since, until) \
|
||||
(INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
|
||||
|
||||
#define INTEL_DISPLAY_STEP(__i915) (RUNTIME_INFO(__i915)->step.display_step)
|
||||
#define INTEL_GT_STEP(__i915) (RUNTIME_INFO(__i915)->step.gt_step)
|
||||
|
||||
#define IS_DISPLAY_STEP(__i915, since, until) \
|
||||
(drm_WARN_ON(&(__i915)->drm, INTEL_DISPLAY_STEP(__i915) == STEP_NONE), \
|
||||
INTEL_DISPLAY_STEP(__i915) >= (since) && INTEL_DISPLAY_STEP(__i915) <= (until))
|
||||
|
||||
#define IS_GT_STEP(__i915, since, until) \
|
||||
(drm_WARN_ON(&(__i915)->drm, INTEL_GT_STEP(__i915) == STEP_NONE), \
|
||||
INTEL_GT_STEP(__i915) >= (since) && INTEL_GT_STEP(__i915) <= (until))
|
||||
|
||||
static __always_inline unsigned int
|
||||
__platform_mask_index(const struct intel_runtime_info *info,
|
||||
enum intel_platform p)
|
||||
@ -1351,6 +1362,7 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
|
||||
#define IS_IRONLAKE(dev_priv) IS_PLATFORM(dev_priv, INTEL_IRONLAKE)
|
||||
#define IS_IRONLAKE_M(dev_priv) \
|
||||
(IS_PLATFORM(dev_priv, INTEL_IRONLAKE) && IS_MOBILE(dev_priv))
|
||||
#define IS_SANDYBRIDGE(dev_priv) IS_PLATFORM(dev_priv, INTEL_SANDYBRIDGE)
|
||||
#define IS_IVYBRIDGE(dev_priv) IS_PLATFORM(dev_priv, INTEL_IVYBRIDGE)
|
||||
#define IS_IVB_GT1(dev_priv) (IS_IVYBRIDGE(dev_priv) && \
|
||||
INTEL_INFO(dev_priv)->gt == 1)
|
||||
@ -1454,34 +1466,10 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
|
||||
#define IS_BXT_REVID(dev_priv, since, until) \
|
||||
(IS_BROXTON(dev_priv) && IS_REVID(dev_priv, since, until))
|
||||
|
||||
enum {
|
||||
KBL_REVID_A0,
|
||||
KBL_REVID_B0,
|
||||
KBL_REVID_B1,
|
||||
KBL_REVID_C0,
|
||||
KBL_REVID_D0,
|
||||
KBL_REVID_D1,
|
||||
KBL_REVID_E0,
|
||||
KBL_REVID_F0,
|
||||
KBL_REVID_G0,
|
||||
};
|
||||
|
||||
struct i915_rev_steppings {
|
||||
u8 gt_stepping;
|
||||
u8 disp_stepping;
|
||||
};
|
||||
|
||||
/* Defined in intel_workarounds.c */
|
||||
extern const struct i915_rev_steppings kbl_revids[];
|
||||
|
||||
#define IS_KBL_GT_REVID(dev_priv, since, until) \
|
||||
(IS_KABYLAKE(dev_priv) && \
|
||||
kbl_revids[INTEL_REVID(dev_priv)].gt_stepping >= since && \
|
||||
kbl_revids[INTEL_REVID(dev_priv)].gt_stepping <= until)
|
||||
#define IS_KBL_DISP_REVID(dev_priv, since, until) \
|
||||
(IS_KABYLAKE(dev_priv) && \
|
||||
kbl_revids[INTEL_REVID(dev_priv)].disp_stepping >= since && \
|
||||
kbl_revids[INTEL_REVID(dev_priv)].disp_stepping <= until)
|
||||
#define IS_KBL_GT_STEP(dev_priv, since, until) \
|
||||
(IS_KABYLAKE(dev_priv) && IS_GT_STEP(dev_priv, since, until))
|
||||
#define IS_KBL_DISPLAY_STEP(dev_priv, since, until) \
|
||||
(IS_KABYLAKE(dev_priv) && IS_DISPLAY_STEP(dev_priv, since, until))
|
||||
|
||||
#define GLK_REVID_A0 0x0
|
||||
#define GLK_REVID_A1 0x1
|
||||
@ -1513,61 +1501,17 @@ extern const struct i915_rev_steppings kbl_revids[];
|
||||
#define IS_JSL_EHL_REVID(p, since, until) \
|
||||
(IS_JSL_EHL(p) && IS_REVID(p, since, until))
|
||||
|
||||
enum {
|
||||
STEP_A0,
|
||||
STEP_A2,
|
||||
STEP_B0,
|
||||
STEP_B1,
|
||||
STEP_C0,
|
||||
STEP_D0,
|
||||
};
|
||||
#define IS_TGL_DISPLAY_STEP(__i915, since, until) \
|
||||
(IS_TIGERLAKE(__i915) && \
|
||||
IS_DISPLAY_STEP(__i915, since, until))
|
||||
|
||||
#define TGL_UY_REVID_STEP_TBL_SIZE 4
|
||||
#define TGL_REVID_STEP_TBL_SIZE 2
|
||||
#define ADLS_REVID_STEP_TBL_SIZE 13
|
||||
#define IS_TGL_UY_GT_STEP(__i915, since, until) \
|
||||
((IS_TGL_U(__i915) || IS_TGL_Y(__i915)) && \
|
||||
IS_GT_STEP(__i915, since, until))
|
||||
|
||||
extern const struct i915_rev_steppings tgl_uy_revid_step_tbl[TGL_UY_REVID_STEP_TBL_SIZE];
|
||||
extern const struct i915_rev_steppings tgl_revid_step_tbl[TGL_REVID_STEP_TBL_SIZE];
|
||||
extern const struct i915_rev_steppings adls_revid_step_tbl[ADLS_REVID_STEP_TBL_SIZE];
|
||||
|
||||
static inline const struct i915_rev_steppings *
|
||||
tgl_stepping_get(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
u8 revid = INTEL_REVID(dev_priv);
|
||||
u8 size;
|
||||
const struct i915_rev_steppings *revid_step_tbl;
|
||||
|
||||
if (IS_ALDERLAKE_S(dev_priv)) {
|
||||
revid_step_tbl = adls_revid_step_tbl;
|
||||
size = ARRAY_SIZE(adls_revid_step_tbl);
|
||||
} else if (IS_TGL_U(dev_priv) || IS_TGL_Y(dev_priv)) {
|
||||
revid_step_tbl = tgl_uy_revid_step_tbl;
|
||||
size = ARRAY_SIZE(tgl_uy_revid_step_tbl);
|
||||
} else {
|
||||
revid_step_tbl = tgl_revid_step_tbl;
|
||||
size = ARRAY_SIZE(tgl_revid_step_tbl);
|
||||
}
|
||||
|
||||
revid = min_t(u8, revid, size - 1);
|
||||
|
||||
return &revid_step_tbl[revid];
|
||||
}
|
||||
|
||||
#define IS_TGL_DISP_STEPPING(p, since, until) \
|
||||
(IS_TIGERLAKE(p) && \
|
||||
tgl_stepping_get(p)->disp_stepping >= (since) && \
|
||||
tgl_stepping_get(p)->disp_stepping <= (until))
|
||||
|
||||
#define IS_TGL_UY_GT_STEPPING(p, since, until) \
|
||||
((IS_TGL_U(p) || IS_TGL_Y(p)) && \
|
||||
tgl_stepping_get(p)->gt_stepping >= (since) && \
|
||||
tgl_stepping_get(p)->gt_stepping <= (until))
|
||||
|
||||
#define IS_TGL_GT_STEPPING(p, since, until) \
|
||||
(IS_TIGERLAKE(p) && \
|
||||
!(IS_TGL_U(p) || IS_TGL_Y(p)) && \
|
||||
tgl_stepping_get(p)->gt_stepping >= (since) && \
|
||||
tgl_stepping_get(p)->gt_stepping <= (until))
|
||||
#define IS_TGL_GT_STEP(__i915, since, until) \
|
||||
(IS_TIGERLAKE(__i915) && !(IS_TGL_U(__i915) || IS_TGL_Y(__i915)) && \
|
||||
IS_GT_STEP(__i915, since, until))
|
||||
|
||||
#define RKL_REVID_A0 0x0
|
||||
#define RKL_REVID_B0 0x1
|
||||
@ -1582,21 +1526,13 @@ tgl_stepping_get(struct drm_i915_private *dev_priv)
|
||||
#define IS_DG1_REVID(p, since, until) \
|
||||
(IS_DG1(p) && IS_REVID(p, since, until))
|
||||
|
||||
#define ADLS_REVID_A0 0x0
|
||||
#define ADLS_REVID_A2 0x1
|
||||
#define ADLS_REVID_B0 0x4
|
||||
#define ADLS_REVID_G0 0x8
|
||||
#define ADLS_REVID_C0 0xC /*Same as H0 ADLS SOC stepping*/
|
||||
#define IS_ADLS_DISPLAY_STEP(__i915, since, until) \
|
||||
(IS_ALDERLAKE_S(__i915) && \
|
||||
IS_DISPLAY_STEP(__i915, since, until))
|
||||
|
||||
#define IS_ADLS_DISP_STEPPING(p, since, until) \
|
||||
(IS_ALDERLAKE_S(p) && \
|
||||
tgl_stepping_get(p)->disp_stepping >= (since) && \
|
||||
tgl_stepping_get(p)->disp_stepping <= (until))
|
||||
|
||||
#define IS_ADLS_GT_STEPPING(p, since, until) \
|
||||
(IS_ALDERLAKE_S(p) && \
|
||||
tgl_stepping_get(p)->gt_stepping >= (since) && \
|
||||
tgl_stepping_get(p)->gt_stepping <= (until))
|
||||
#define IS_ADLS_GT_STEP(__i915, since, until) \
|
||||
(IS_ALDERLAKE_S(__i915) && \
|
||||
IS_GT_STEP(__i915, since, until))
|
||||
|
||||
#define IS_LP(dev_priv) (INTEL_INFO(dev_priv)->is_lp)
|
||||
#define IS_GEN9_LP(dev_priv) (IS_GEN(dev_priv, 9) && IS_LP(dev_priv))
|
||||
|
@ -192,13 +192,13 @@ static void intel_hpd_init_pins(struct drm_i915_private *dev_priv)
|
||||
return;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
hpd->hpd = hpd_gen11;
|
||||
else if (IS_GEN9_LP(dev_priv))
|
||||
hpd->hpd = hpd_bxt;
|
||||
else if (INTEL_GEN(dev_priv) >= 8)
|
||||
else if (DISPLAY_VER(dev_priv) >= 8)
|
||||
hpd->hpd = hpd_bdw;
|
||||
else if (INTEL_GEN(dev_priv) >= 7)
|
||||
else if (DISPLAY_VER(dev_priv) >= 7)
|
||||
hpd->hpd = hpd_ivb;
|
||||
else
|
||||
hpd->hpd = hpd_ilk;
|
||||
@ -477,7 +477,7 @@ u32 i915_pipestat_enable_mask(struct drm_i915_private *dev_priv,
|
||||
|
||||
lockdep_assert_held(&dev_priv->irq_lock);
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 5)
|
||||
if (DISPLAY_VER(dev_priv) < 5)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
@ -579,7 +579,7 @@ static void i915_enable_asle_pipestat(struct drm_i915_private *dev_priv)
|
||||
spin_lock_irq(&dev_priv->irq_lock);
|
||||
|
||||
i915_enable_pipestat(dev_priv, PIPE_B, PIPE_LEGACY_BLC_EVENT_STATUS);
|
||||
if (INTEL_GEN(dev_priv) >= 4)
|
||||
if (DISPLAY_VER(dev_priv) >= 4)
|
||||
i915_enable_pipestat(dev_priv, PIPE_A,
|
||||
PIPE_LEGACY_BLC_EVENT_STATUS);
|
||||
|
||||
@ -806,7 +806,7 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
|
||||
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
|
||||
vtotal /= 2;
|
||||
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
position = intel_de_read_fw(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN2;
|
||||
else
|
||||
position = intel_de_read_fw(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3;
|
||||
@ -856,8 +856,8 @@ static bool i915_get_crtc_scanoutpos(struct drm_crtc *_crtc,
|
||||
int position;
|
||||
int vbl_start, vbl_end, hsync_start, htotal, vtotal;
|
||||
unsigned long irqflags;
|
||||
bool use_scanline_counter = INTEL_GEN(dev_priv) >= 5 ||
|
||||
IS_G4X(dev_priv) || IS_GEN(dev_priv, 2) ||
|
||||
bool use_scanline_counter = DISPLAY_VER(dev_priv) >= 5 ||
|
||||
IS_G4X(dev_priv) || IS_DISPLAY_VER(dev_priv, 2) ||
|
||||
crtc->mode_flags & I915_MODE_FLAG_USE_SCANLINE_COUNTER;
|
||||
|
||||
if (drm_WARN_ON(&dev_priv->drm, !mode->crtc_clock)) {
|
||||
@ -1304,7 +1304,7 @@ static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
|
||||
* don't trust that one either.
|
||||
*/
|
||||
if (pipe_crc->skipped <= 0 ||
|
||||
(INTEL_GEN(dev_priv) >= 8 && pipe_crc->skipped == 1)) {
|
||||
(DISPLAY_VER(dev_priv) >= 8 && pipe_crc->skipped == 1)) {
|
||||
pipe_crc->skipped++;
|
||||
spin_unlock(&pipe_crc->lock);
|
||||
return;
|
||||
@ -1366,12 +1366,12 @@ static void i9xx_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
|
||||
{
|
||||
u32 res1, res2;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 3)
|
||||
if (DISPLAY_VER(dev_priv) >= 3)
|
||||
res1 = intel_uncore_read(&dev_priv->uncore, PIPE_CRC_RES_RES1_I915(pipe));
|
||||
else
|
||||
res1 = 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
|
||||
res2 = intel_uncore_read(&dev_priv->uncore, PIPE_CRC_RES_RES2_G4X(pipe));
|
||||
else
|
||||
res2 = 0;
|
||||
@ -2077,7 +2077,7 @@ static void ilk_display_irq_handler(struct drm_i915_private *dev_priv,
|
||||
intel_uncore_write(&dev_priv->uncore, SDEIIR, pch_iir);
|
||||
}
|
||||
|
||||
if (IS_GEN(dev_priv, 5) && de_iir & DE_PCU_EVENT)
|
||||
if (IS_DISPLAY_VER(dev_priv, 5) && de_iir & DE_PCU_EVENT)
|
||||
gen5_rps_irq_handler(&dev_priv->gt.rps);
|
||||
}
|
||||
|
||||
@ -2184,7 +2184,7 @@ static irqreturn_t ilk_irq_handler(int irq, void *arg)
|
||||
de_iir = raw_reg_read(regs, DEIIR);
|
||||
if (de_iir) {
|
||||
raw_reg_write(regs, DEIIR, de_iir);
|
||||
if (INTEL_GEN(i915) >= 7)
|
||||
if (DISPLAY_VER(i915) >= 7)
|
||||
ivb_display_irq_handler(i915, de_iir);
|
||||
else
|
||||
ilk_display_irq_handler(i915, de_iir);
|
||||
@ -2269,7 +2269,7 @@ static u32 gen8_de_port_aux_mask(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
u32 mask;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
return TGL_DE_PORT_AUX_DDIA |
|
||||
TGL_DE_PORT_AUX_DDIB |
|
||||
TGL_DE_PORT_AUX_DDIC |
|
||||
@ -2282,15 +2282,15 @@ static u32 gen8_de_port_aux_mask(struct drm_i915_private *dev_priv)
|
||||
|
||||
|
||||
mask = GEN8_AUX_CHANNEL_A;
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
mask |= GEN9_AUX_CHANNEL_B |
|
||||
GEN9_AUX_CHANNEL_C |
|
||||
GEN9_AUX_CHANNEL_D;
|
||||
|
||||
if (IS_CNL_WITH_PORT_F(dev_priv) || IS_GEN(dev_priv, 11))
|
||||
if (IS_CNL_WITH_PORT_F(dev_priv) || IS_DISPLAY_VER(dev_priv, 11))
|
||||
mask |= CNL_AUX_CHANNEL_F;
|
||||
|
||||
if (IS_GEN(dev_priv, 11))
|
||||
if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
mask |= ICL_AUX_CHANNEL_E;
|
||||
|
||||
return mask;
|
||||
@ -2300,9 +2300,9 @@ static u32 gen8_de_pipe_fault_mask(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (HAS_D12_PLANE_MINIMIZATION(dev_priv))
|
||||
return RKL_DE_PIPE_IRQ_FAULT_ERRORS;
|
||||
else if (INTEL_GEN(dev_priv) >= 11)
|
||||
else if (DISPLAY_VER(dev_priv) >= 11)
|
||||
return GEN11_DE_PIPE_IRQ_FAULT_ERRORS;
|
||||
else if (INTEL_GEN(dev_priv) >= 9)
|
||||
else if (DISPLAY_VER(dev_priv) >= 9)
|
||||
return GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
|
||||
else
|
||||
return GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
|
||||
@ -2326,7 +2326,7 @@ gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
|
||||
for_each_intel_encoder_with_psr(&dev_priv->drm, encoder) {
|
||||
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
iir_reg = TRANS_PSR_IIR(intel_dp->psr.transcoder);
|
||||
else
|
||||
iir_reg = EDP_PSR_IIR;
|
||||
@ -2340,7 +2340,7 @@ gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
|
||||
intel_psr_irq_handler(intel_dp, psr_iir);
|
||||
|
||||
/* prior GEN12 only have one EDP PSR */
|
||||
if (INTEL_GEN(dev_priv) < 12)
|
||||
if (DISPLAY_VER(dev_priv) < 12)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2408,7 +2408,7 @@ static void gen11_dsi_te_interrupt_handler(struct drm_i915_private *dev_priv,
|
||||
|
||||
static u32 gen8_de_pipe_flip_done_mask(struct drm_i915_private *i915)
|
||||
{
|
||||
if (INTEL_GEN(i915) >= 9)
|
||||
if (DISPLAY_VER(i915) >= 9)
|
||||
return GEN9_PIPE_PLANE1_FLIP_DONE;
|
||||
else
|
||||
return GEN8_PIPE_PRIMARY_FLIP_DONE;
|
||||
@ -2433,7 +2433,7 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
|
||||
}
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11 && (master_ctl & GEN11_DE_HPD_IRQ)) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11 && (master_ctl & GEN11_DE_HPD_IRQ)) {
|
||||
iir = intel_uncore_read(&dev_priv->uncore, GEN11_DE_HPD_IIR);
|
||||
if (iir) {
|
||||
intel_uncore_write(&dev_priv->uncore, GEN11_DE_HPD_IIR, iir);
|
||||
@ -2479,7 +2479,7 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
u32 te_trigger = iir & (DSI0_TE | DSI1_TE);
|
||||
|
||||
if (te_trigger) {
|
||||
@ -2809,7 +2809,7 @@ int ilk_enable_vblank(struct drm_crtc *crtc)
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->dev);
|
||||
enum pipe pipe = to_intel_crtc(crtc)->pipe;
|
||||
unsigned long irqflags;
|
||||
u32 bit = INTEL_GEN(dev_priv) >= 7 ?
|
||||
u32 bit = DISPLAY_VER(dev_priv) >= 7 ?
|
||||
DE_PIPE_VBLANK_IVB(pipe) : DE_PIPE_VBLANK(pipe);
|
||||
|
||||
spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
|
||||
@ -2920,7 +2920,7 @@ void ilk_disable_vblank(struct drm_crtc *crtc)
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->dev);
|
||||
enum pipe pipe = to_intel_crtc(crtc)->pipe;
|
||||
unsigned long irqflags;
|
||||
u32 bit = INTEL_GEN(dev_priv) >= 7 ?
|
||||
u32 bit = DISPLAY_VER(dev_priv) >= 7 ?
|
||||
DE_PIPE_VBLANK_IVB(pipe) : DE_PIPE_VBLANK(pipe);
|
||||
|
||||
spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
|
||||
@ -3094,7 +3094,7 @@ static void gen11_display_irq_reset(struct drm_i915_private *dev_priv)
|
||||
|
||||
intel_uncore_write(uncore, GEN11_DISPLAY_INT_CTL, 0);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
enum transcoder trans;
|
||||
|
||||
for_each_cpu_transcoder_masked(dev_priv, trans, trans_mask) {
|
||||
@ -3523,7 +3523,7 @@ static void ilk_hpd_irq_setup(struct drm_i915_private *dev_priv)
|
||||
enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->hotplug.hpd);
|
||||
hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->hotplug.hpd);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
bdw_update_port_irq(dev_priv, hotplug_irqs, enabled_irqs);
|
||||
else
|
||||
ilk_update_display_irq(dev_priv, hotplug_irqs, enabled_irqs);
|
||||
@ -3714,13 +3714,13 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
|
||||
BIT(TRANSCODER_C) | BIT(TRANSCODER_D);
|
||||
enum pipe pipe;
|
||||
|
||||
if (INTEL_GEN(dev_priv) <= 10)
|
||||
if (DISPLAY_VER(dev_priv) <= 10)
|
||||
de_misc_masked |= GEN8_DE_MISC_GSE;
|
||||
|
||||
if (IS_GEN9_LP(dev_priv))
|
||||
de_port_masked |= BXT_DE_PORT_GMBUS;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
enum port port;
|
||||
|
||||
if (intel_bios_is_dsi_present(dev_priv, &port))
|
||||
@ -3737,7 +3737,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
|
||||
else if (IS_BROADWELL(dev_priv))
|
||||
de_port_enables |= BDW_DE_PORT_HOTPLUG_MASK;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
enum transcoder trans;
|
||||
|
||||
for_each_cpu_transcoder_masked(dev_priv, trans, trans_mask) {
|
||||
@ -3766,7 +3766,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
|
||||
GEN3_IRQ_INIT(uncore, GEN8_DE_PORT_, ~de_port_masked, de_port_enables);
|
||||
GEN3_IRQ_INIT(uncore, GEN8_DE_MISC_, ~de_misc_masked, de_misc_masked);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
u32 de_hpd_masked = 0;
|
||||
u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK |
|
||||
GEN11_DE_TBT_HOTPLUG_MASK;
|
||||
@ -4315,7 +4315,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
|
||||
} else {
|
||||
if (HAS_PCH_DG1(dev_priv))
|
||||
dev_priv->display.hpd_irq_setup = dg1_hpd_irq_setup;
|
||||
else if (INTEL_GEN(dev_priv) >= 11)
|
||||
else if (DISPLAY_VER(dev_priv) >= 11)
|
||||
dev_priv->display.hpd_irq_setup = gen11_hpd_irq_setup;
|
||||
else if (IS_GEN9_LP(dev_priv))
|
||||
dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "i915_selftest.h"
|
||||
|
||||
#define PLATFORM(x) .platform = (x)
|
||||
#define GEN(x) .gen = (x), .gen_mask = BIT((x) - 1)
|
||||
#define GEN(x) .gen = (x), .gen_mask = BIT((x) - 1), .display.version = (x)
|
||||
|
||||
#define I845_PIPE_OFFSETS \
|
||||
.pipe_offsets = { \
|
||||
@ -723,6 +723,7 @@ static const struct intel_device_info bxt_info = {
|
||||
static const struct intel_device_info glk_info = {
|
||||
GEN9_LP_FEATURES,
|
||||
PLATFORM(INTEL_GEMINILAKE),
|
||||
.display.version = 10,
|
||||
.ddb_size = 1024,
|
||||
GLK_COLORS,
|
||||
};
|
||||
|
@ -97,12 +97,16 @@ enum i915_cache_level;
|
||||
|
||||
struct intel_remapped_plane_info {
|
||||
/* in gtt pages */
|
||||
unsigned int width, height, stride, offset;
|
||||
u32 offset;
|
||||
u16 width;
|
||||
u16 height;
|
||||
u16 src_stride;
|
||||
u16 dst_stride;
|
||||
} __packed;
|
||||
|
||||
struct intel_remapped_info {
|
||||
struct intel_remapped_plane_info plane[2];
|
||||
unsigned int unused_mbz;
|
||||
u32 unused_mbz;
|
||||
} __packed;
|
||||
|
||||
struct intel_rotation_info {
|
||||
@ -123,9 +127,9 @@ enum i915_ggtt_view_type {
|
||||
|
||||
static inline void assert_i915_gem_gtt_types(void)
|
||||
{
|
||||
BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 8*sizeof(unsigned int));
|
||||
BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 2 * sizeof(u32) + 8 * sizeof(u16));
|
||||
BUILD_BUG_ON(sizeof(struct intel_partial_info) != sizeof(u64) + sizeof(unsigned int));
|
||||
BUILD_BUG_ON(sizeof(struct intel_remapped_info) != 9*sizeof(unsigned int));
|
||||
BUILD_BUG_ON(sizeof(struct intel_remapped_info) != 3 * sizeof(u32) + 8 * sizeof(u16));
|
||||
|
||||
/* Check that rotation/remapped shares offsets for simplicity */
|
||||
BUILD_BUG_ON(offsetof(struct intel_remapped_info, plane[0]) !=
|
||||
|
@ -251,7 +251,7 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
|
||||
enum pipe pipe;
|
||||
|
||||
/* Wa_14011765242: adl-s A0 */
|
||||
if (IS_ADLS_DISP_STEPPING(dev_priv, STEP_A0, STEP_A0))
|
||||
if (IS_ADLS_DISPLAY_STEP(dev_priv, STEP_A0, STEP_A0))
|
||||
for_each_pipe(dev_priv, pipe)
|
||||
runtime->num_scalers[pipe] = 0;
|
||||
else if (INTEL_GEN(dev_priv) >= 10) {
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include <uapi/drm/i915_drm.h>
|
||||
|
||||
#include "intel_step.h"
|
||||
|
||||
#include "display/intel_display.h"
|
||||
|
||||
#include "gt/intel_engine_types.h"
|
||||
@ -187,6 +189,8 @@ struct intel_device_info {
|
||||
#undef DEFINE_FLAG
|
||||
|
||||
struct {
|
||||
u8 version;
|
||||
|
||||
#define DEFINE_FLAG(name) u8 name:1
|
||||
DEV_INFO_DISPLAY_FOR_EACH_FLAG(DEFINE_FLAG);
|
||||
#undef DEFINE_FLAG
|
||||
@ -225,6 +229,8 @@ struct intel_runtime_info {
|
||||
u8 num_scalers[I915_MAX_PIPES];
|
||||
|
||||
u32 rawclk_freq;
|
||||
|
||||
struct intel_step_info step;
|
||||
};
|
||||
|
||||
struct intel_driver_caps {
|
||||
|
@ -2339,7 +2339,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
|
||||
|
||||
if (IS_I945GM(dev_priv))
|
||||
wm_info = &i945_wm_info;
|
||||
else if (!IS_GEN(dev_priv, 2))
|
||||
else if (!IS_DISPLAY_VER(dev_priv, 2))
|
||||
wm_info = &i915_wm_info;
|
||||
else
|
||||
wm_info = &i830_a_wm_info;
|
||||
@ -2353,7 +2353,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
|
||||
crtc->base.primary->state->fb;
|
||||
int cpp;
|
||||
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
cpp = 4;
|
||||
else
|
||||
cpp = fb->format->cpp[0];
|
||||
@ -2368,7 +2368,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
|
||||
planea_wm = wm_info->max_wm;
|
||||
}
|
||||
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
wm_info = &i830_bc_wm_info;
|
||||
|
||||
fifo_size = dev_priv->display.get_fifo_size(dev_priv, PLANE_B);
|
||||
@ -2380,7 +2380,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
|
||||
crtc->base.primary->state->fb;
|
||||
int cpp;
|
||||
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
if (IS_DISPLAY_VER(dev_priv, 2))
|
||||
cpp = 4;
|
||||
else
|
||||
cpp = fb->format->cpp[0];
|
||||
@ -2652,9 +2652,9 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state,
|
||||
static unsigned int
|
||||
ilk_display_fifo_size(const struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
return 3072;
|
||||
else if (INTEL_GEN(dev_priv) >= 7)
|
||||
else if (DISPLAY_VER(dev_priv) >= 7)
|
||||
return 768;
|
||||
else
|
||||
return 512;
|
||||
@ -2664,10 +2664,10 @@ static unsigned int
|
||||
ilk_plane_wm_reg_max(const struct drm_i915_private *dev_priv,
|
||||
int level, bool is_sprite)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
/* BDW primary/sprite plane watermarks */
|
||||
return level == 0 ? 255 : 2047;
|
||||
else if (INTEL_GEN(dev_priv) >= 7)
|
||||
else if (DISPLAY_VER(dev_priv) >= 7)
|
||||
/* IVB/HSW primary/sprite plane watermarks */
|
||||
return level == 0 ? 127 : 1023;
|
||||
else if (!is_sprite)
|
||||
@ -2681,7 +2681,7 @@ ilk_plane_wm_reg_max(const struct drm_i915_private *dev_priv,
|
||||
static unsigned int
|
||||
ilk_cursor_wm_reg_max(const struct drm_i915_private *dev_priv, int level)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 7)
|
||||
if (DISPLAY_VER(dev_priv) >= 7)
|
||||
return level == 0 ? 63 : 255;
|
||||
else
|
||||
return level == 0 ? 31 : 63;
|
||||
@ -2689,7 +2689,7 @@ ilk_cursor_wm_reg_max(const struct drm_i915_private *dev_priv, int level)
|
||||
|
||||
static unsigned int ilk_fbc_wm_reg_max(const struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
return 31;
|
||||
else
|
||||
return 15;
|
||||
@ -2717,7 +2717,7 @@ static unsigned int ilk_plane_wm_max(const struct drm_i915_private *dev_priv,
|
||||
* FIFO size is only half of the self
|
||||
* refresh FIFO size on ILK/SNB.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) <= 6)
|
||||
if (DISPLAY_VER(dev_priv) <= 6)
|
||||
fifo_size /= 2;
|
||||
}
|
||||
|
||||
@ -2852,7 +2852,7 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv,
|
||||
{
|
||||
struct intel_uncore *uncore = &dev_priv->uncore;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
if (DISPLAY_VER(dev_priv) >= 9) {
|
||||
u32 val;
|
||||
int ret, i;
|
||||
int level, max_level = ilk_wm_max_level(dev_priv);
|
||||
@ -2944,14 +2944,14 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv,
|
||||
wm[2] = (sskpd >> 12) & 0xFF;
|
||||
wm[3] = (sskpd >> 20) & 0x1FF;
|
||||
wm[4] = (sskpd >> 32) & 0x1FF;
|
||||
} else if (INTEL_GEN(dev_priv) >= 6) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 6) {
|
||||
u32 sskpd = intel_uncore_read(uncore, MCH_SSKPD);
|
||||
|
||||
wm[0] = (sskpd >> SSKPD_WM0_SHIFT) & SSKPD_WM_MASK;
|
||||
wm[1] = (sskpd >> SSKPD_WM1_SHIFT) & SSKPD_WM_MASK;
|
||||
wm[2] = (sskpd >> SSKPD_WM2_SHIFT) & SSKPD_WM_MASK;
|
||||
wm[3] = (sskpd >> SSKPD_WM3_SHIFT) & SSKPD_WM_MASK;
|
||||
} else if (INTEL_GEN(dev_priv) >= 5) {
|
||||
} else if (DISPLAY_VER(dev_priv) >= 5) {
|
||||
u32 mltr = intel_uncore_read(uncore, MLTR_ILK);
|
||||
|
||||
/* ILK primary LP0 latency is 700 ns */
|
||||
@ -2967,7 +2967,7 @@ static void intel_fixup_spr_wm_latency(struct drm_i915_private *dev_priv,
|
||||
u16 wm[5])
|
||||
{
|
||||
/* ILK sprite LP0 latency is 1300 ns */
|
||||
if (IS_GEN(dev_priv, 5))
|
||||
if (IS_DISPLAY_VER(dev_priv, 5))
|
||||
wm[0] = 13;
|
||||
}
|
||||
|
||||
@ -2975,18 +2975,18 @@ static void intel_fixup_cur_wm_latency(struct drm_i915_private *dev_priv,
|
||||
u16 wm[5])
|
||||
{
|
||||
/* ILK cursor LP0 latency is 1300 ns */
|
||||
if (IS_GEN(dev_priv, 5))
|
||||
if (IS_DISPLAY_VER(dev_priv, 5))
|
||||
wm[0] = 13;
|
||||
}
|
||||
|
||||
int ilk_wm_max_level(const struct drm_i915_private *dev_priv)
|
||||
{
|
||||
/* how many WM levels are we expecting */
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
return 7;
|
||||
else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
|
||||
return 4;
|
||||
else if (INTEL_GEN(dev_priv) >= 6)
|
||||
else if (DISPLAY_VER(dev_priv) >= 6)
|
||||
return 3;
|
||||
else
|
||||
return 2;
|
||||
@ -3012,7 +3012,7 @@ static void intel_print_wm_latency(struct drm_i915_private *dev_priv,
|
||||
* - latencies are in us on gen9.
|
||||
* - before then, WM1+ latency values are in 0.5us units
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) >= 9)
|
||||
if (DISPLAY_VER(dev_priv) >= 9)
|
||||
latency *= 10;
|
||||
else if (level > 0)
|
||||
latency *= 5;
|
||||
@ -3105,7 +3105,7 @@ static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv)
|
||||
intel_print_wm_latency(dev_priv, "Sprite", dev_priv->wm.spr_latency);
|
||||
intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency);
|
||||
|
||||
if (IS_GEN(dev_priv, 6)) {
|
||||
if (IS_DISPLAY_VER(dev_priv, 6)) {
|
||||
snb_wm_latency_quirk(dev_priv);
|
||||
snb_wm_lp3_irq_quirk(dev_priv);
|
||||
}
|
||||
@ -3176,7 +3176,7 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
usable_level = max_level;
|
||||
|
||||
/* ILK/SNB: LP2+ watermarks only w/o sprites */
|
||||
if (INTEL_GEN(dev_priv) <= 6 && pipe_wm->sprites_enabled)
|
||||
if (DISPLAY_VER(dev_priv) <= 6 && pipe_wm->sprites_enabled)
|
||||
usable_level = 1;
|
||||
|
||||
/* ILK/SNB/IVB: LP1+ watermarks only w/o scaling */
|
||||
@ -3318,12 +3318,12 @@ static void ilk_wm_merge(struct drm_i915_private *dev_priv,
|
||||
int last_enabled_level = max_level;
|
||||
|
||||
/* ILK/SNB/IVB: LP1+ watermarks only w/ single pipe */
|
||||
if ((INTEL_GEN(dev_priv) <= 6 || IS_IVYBRIDGE(dev_priv)) &&
|
||||
if ((DISPLAY_VER(dev_priv) <= 6 || IS_IVYBRIDGE(dev_priv)) &&
|
||||
config->num_pipes_active > 1)
|
||||
last_enabled_level = 0;
|
||||
|
||||
/* ILK: FBC WM must be disabled always */
|
||||
merged->fbc_wm_enabled = INTEL_GEN(dev_priv) >= 6;
|
||||
merged->fbc_wm_enabled = DISPLAY_VER(dev_priv) >= 6;
|
||||
|
||||
/* merge each WM1+ level */
|
||||
for (level = 1; level <= max_level; level++) {
|
||||
@ -3354,7 +3354,7 @@ static void ilk_wm_merge(struct drm_i915_private *dev_priv,
|
||||
* What we should check here is whether FBC can be
|
||||
* enabled sometime later.
|
||||
*/
|
||||
if (IS_GEN(dev_priv, 5) && !merged->fbc_wm_enabled &&
|
||||
if (IS_DISPLAY_VER(dev_priv, 5) && !merged->fbc_wm_enabled &&
|
||||
intel_fbc_is_active(dev_priv)) {
|
||||
for (level = 2; level <= max_level; level++) {
|
||||
struct intel_wm_level *wm = &merged->wm[level];
|
||||
@ -3411,7 +3411,7 @@ static void ilk_compute_wm_results(struct drm_i915_private *dev_priv,
|
||||
if (r->enable)
|
||||
results->wm_lp[wm_lp - 1] |= WM1_LP_SR_EN;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
if (DISPLAY_VER(dev_priv) >= 8)
|
||||
results->wm_lp[wm_lp - 1] |=
|
||||
r->fbc_val << WM1_LP_FBC_SHIFT_BDW;
|
||||
else
|
||||
@ -3422,7 +3422,7 @@ static void ilk_compute_wm_results(struct drm_i915_private *dev_priv,
|
||||
* Always set WM1S_LP_EN when spr_val != 0, even if the
|
||||
* level is disabled. Doing otherwise could cause underruns.
|
||||
*/
|
||||
if (INTEL_GEN(dev_priv) <= 6 && r->spr_val) {
|
||||
if (DISPLAY_VER(dev_priv) <= 6 && r->spr_val) {
|
||||
drm_WARN_ON(&dev_priv->drm, wm_lp != 1);
|
||||
results->wm_lp_spr[wm_lp - 1] = WM1S_LP_EN | r->spr_val;
|
||||
} else
|
||||
@ -3612,7 +3612,7 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv,
|
||||
previous->wm_lp_spr[0] != results->wm_lp_spr[0])
|
||||
intel_uncore_write(&dev_priv->uncore, WM1S_LP_ILK, results->wm_lp_spr[0]);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 7) {
|
||||
if (DISPLAY_VER(dev_priv) >= 7) {
|
||||
if (dirty & WM_DIRTY_LP(2) && previous->wm_lp_spr[1] != results->wm_lp_spr[1])
|
||||
intel_uncore_write(&dev_priv->uncore, WM2S_LP_IVB, results->wm_lp_spr[1]);
|
||||
if (dirty & WM_DIRTY_LP(3) && previous->wm_lp_spr[2] != results->wm_lp_spr[2])
|
||||
@ -3660,14 +3660,14 @@ static bool skl_needs_memory_bw_wa(struct drm_i915_private *dev_priv)
|
||||
static bool
|
||||
intel_has_sagv(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
return (IS_GEN9_BC(dev_priv) || INTEL_GEN(dev_priv) >= 10) &&
|
||||
return (IS_GEN9_BC(dev_priv) || DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)) &&
|
||||
dev_priv->sagv_status != I915_SAGV_NOT_CONTROLLED;
|
||||
}
|
||||
|
||||
static void
|
||||
skl_setup_sagv_block_time(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
u32 val = 0;
|
||||
int ret;
|
||||
|
||||
@ -3680,17 +3680,17 @@ skl_setup_sagv_block_time(struct drm_i915_private *dev_priv)
|
||||
}
|
||||
|
||||
drm_dbg(&dev_priv->drm, "Couldn't read SAGV block time!\n");
|
||||
} else if (IS_GEN(dev_priv, 11)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 11)) {
|
||||
dev_priv->sagv_block_time_us = 10;
|
||||
return;
|
||||
} else if (IS_GEN(dev_priv, 10)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 10)) {
|
||||
dev_priv->sagv_block_time_us = 20;
|
||||
return;
|
||||
} else if (IS_GEN(dev_priv, 9)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 9)) {
|
||||
dev_priv->sagv_block_time_us = 30;
|
||||
return;
|
||||
} else {
|
||||
MISSING_CASE(INTEL_GEN(dev_priv));
|
||||
MISSING_CASE(DISPLAY_VER(dev_priv));
|
||||
}
|
||||
|
||||
/* Default to an unusable block time */
|
||||
@ -3797,7 +3797,7 @@ void intel_sagv_pre_plane_update(struct intel_atomic_state *state)
|
||||
if (!new_bw_state)
|
||||
return;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 11 && !intel_can_enable_sagv(dev_priv, new_bw_state)) {
|
||||
if (DISPLAY_VER(dev_priv) < 11 && !intel_can_enable_sagv(dev_priv, new_bw_state)) {
|
||||
intel_disable_sagv(dev_priv);
|
||||
return;
|
||||
}
|
||||
@ -3848,7 +3848,7 @@ void intel_sagv_post_plane_update(struct intel_atomic_state *state)
|
||||
if (!new_bw_state)
|
||||
return;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 11 && intel_can_enable_sagv(dev_priv, new_bw_state)) {
|
||||
if (DISPLAY_VER(dev_priv) < 11 && intel_can_enable_sagv(dev_priv, new_bw_state)) {
|
||||
intel_enable_sagv(dev_priv);
|
||||
return;
|
||||
}
|
||||
@ -3948,7 +3948,7 @@ static bool intel_crtc_can_enable_sagv(const 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);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12)
|
||||
if (DISPLAY_VER(dev_priv) >= 12)
|
||||
return tgl_crtc_can_enable_sagv(crtc_state);
|
||||
else
|
||||
return skl_crtc_can_enable_sagv(crtc_state);
|
||||
@ -3957,7 +3957,7 @@ static bool intel_crtc_can_enable_sagv(const struct intel_crtc_state *crtc_state
|
||||
bool intel_can_enable_sagv(struct drm_i915_private *dev_priv,
|
||||
const struct intel_bw_state *bw_state)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) < 11 &&
|
||||
if (DISPLAY_VER(dev_priv) < 11 &&
|
||||
bw_state->active_pipes && !is_power_of_2(bw_state->active_pipes))
|
||||
return false;
|
||||
|
||||
@ -4010,7 +4010,7 @@ static int intel_compute_sagv_mask(struct intel_atomic_state *state)
|
||||
* latter from the plane commit hooks (especially in the legacy
|
||||
* cursor case)
|
||||
*/
|
||||
pipe_wm->use_sagv_wm = INTEL_GEN(dev_priv) >= 12 &&
|
||||
pipe_wm->use_sagv_wm = DISPLAY_VER(dev_priv) >= 12 &&
|
||||
intel_can_enable_sagv(dev_priv, new_bw_state);
|
||||
}
|
||||
|
||||
@ -4034,7 +4034,7 @@ static int intel_dbuf_size(struct drm_i915_private *dev_priv)
|
||||
|
||||
drm_WARN_ON(&dev_priv->drm, ddb_size == 0);
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 11)
|
||||
if (DISPLAY_VER(dev_priv) < 11)
|
||||
return ddb_size - 4; /* 4 blocks for bypass path allocation */
|
||||
|
||||
return ddb_size;
|
||||
@ -4289,7 +4289,7 @@ skl_ddb_get_hw_plane_state(struct drm_i915_private *dev_priv,
|
||||
val & PLANE_CTL_ORDER_RGBX,
|
||||
val & PLANE_CTL_ALPHA_MASK);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
val = intel_uncore_read(&dev_priv->uncore, PLANE_BUF_CFG(pipe, plane_id));
|
||||
skl_ddb_entry_init_from_hw(dev_priv, ddb_y, val);
|
||||
} else {
|
||||
@ -4613,9 +4613,9 @@ static u8 skl_compute_dbuf_slices(struct intel_crtc *crtc, u8 active_pipes)
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
enum pipe pipe = crtc->pipe;
|
||||
|
||||
if (IS_GEN(dev_priv, 12))
|
||||
if (IS_DISPLAY_VER(dev_priv, 12))
|
||||
return tgl_compute_dbuf_slices(pipe, active_pipes);
|
||||
else if (IS_GEN(dev_priv, 11))
|
||||
else if (IS_DISPLAY_VER(dev_priv, 11))
|
||||
return icl_compute_dbuf_slices(pipe, active_pipes);
|
||||
/*
|
||||
* For anything else just return one slice yet.
|
||||
@ -4838,7 +4838,7 @@ skl_allocate_plane_ddb(struct intel_atomic_state *state,
|
||||
if (!crtc_state->hw.active)
|
||||
return 0;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
total_data_rate =
|
||||
icl_get_total_relative_data_rate(state, crtc);
|
||||
else
|
||||
@ -4952,7 +4952,7 @@ skl_allocate_plane_ddb(struct intel_atomic_state *state,
|
||||
|
||||
/* Gen11+ uses a separate plane for UV watermarks */
|
||||
drm_WARN_ON(&dev_priv->drm,
|
||||
INTEL_GEN(dev_priv) >= 11 && uv_total[plane_id]);
|
||||
DISPLAY_VER(dev_priv) >= 11 && uv_total[plane_id]);
|
||||
|
||||
/* Leave disabled planes at (0,0) */
|
||||
if (total[plane_id]) {
|
||||
@ -4986,7 +4986,7 @@ skl_allocate_plane_ddb(struct intel_atomic_state *state,
|
||||
* Wa_1408961008:icl, ehl
|
||||
* Underruns with WM1+ disabled
|
||||
*/
|
||||
if (IS_GEN(dev_priv, 11) &&
|
||||
if (IS_DISPLAY_VER(dev_priv, 11) &&
|
||||
level == 1 && wm->wm[0].enable) {
|
||||
wm->wm[level].blocks = wm->wm[0].blocks;
|
||||
wm->wm[level].lines = wm->wm[0].lines;
|
||||
@ -5030,7 +5030,7 @@ skl_wm_method1(const struct drm_i915_private *dev_priv, u32 pixel_rate,
|
||||
wm_intermediate_val = latency * pixel_rate * cpp;
|
||||
ret = div_fixed16(wm_intermediate_val, 1000 * dbuf_block_size);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
ret = add_fixed16_u32(ret, 1);
|
||||
|
||||
return ret;
|
||||
@ -5110,7 +5110,7 @@ skl_compute_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
wp->cpp = format->cpp[color_plane];
|
||||
wp->plane_pixel_rate = plane_pixel_rate;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 11 &&
|
||||
modifier == I915_FORMAT_MOD_Yf_TILED && wp->cpp == 1)
|
||||
wp->dbuf_block_size = 256;
|
||||
else
|
||||
@ -5144,7 +5144,7 @@ skl_compute_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
wp->y_min_scanlines,
|
||||
wp->dbuf_block_size);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
interm_pbpl++;
|
||||
|
||||
wp->plane_blocks_per_line = div_fixed16(interm_pbpl,
|
||||
@ -5153,8 +5153,7 @@ skl_compute_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
interm_pbpl = DIV_ROUND_UP(wp->plane_bytes_per_line,
|
||||
wp->dbuf_block_size);
|
||||
|
||||
if (!wp->x_tiled ||
|
||||
INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (!wp->x_tiled || DISPLAY_VER(dev_priv) >= 10)
|
||||
interm_pbpl++;
|
||||
|
||||
wp->plane_blocks_per_line = u32_to_fixed16(interm_pbpl);
|
||||
@ -5193,7 +5192,7 @@ skl_compute_plane_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
|
||||
static bool skl_wm_has_lines(struct drm_i915_private *dev_priv, int level)
|
||||
{
|
||||
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
||||
if (DISPLAY_VER(dev_priv) >= 10)
|
||||
return true;
|
||||
|
||||
/* The number of lines are ignored for the level 0 watermark. */
|
||||
@ -5246,8 +5245,7 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state,
|
||||
(wp->plane_bytes_per_line / wp->dbuf_block_size < 1)) {
|
||||
selected_result = method2;
|
||||
} else if (latency >= wp->linetime_us) {
|
||||
if (IS_GEN(dev_priv, 9) &&
|
||||
!IS_GEMINILAKE(dev_priv))
|
||||
if (IS_DISPLAY_VER(dev_priv, 9))
|
||||
selected_result = min_fixed16(method1, method2);
|
||||
else
|
||||
selected_result = method2;
|
||||
@ -5285,7 +5283,7 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state,
|
||||
}
|
||||
}
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
if (wp->y_tiled) {
|
||||
int extra_lines;
|
||||
|
||||
@ -5323,7 +5321,7 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state,
|
||||
result->min_ddb_alloc = max(min_ddb_alloc, blocks) + 1;
|
||||
result->enable = true;
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 12)
|
||||
if (DISPLAY_VER(dev_priv) < 12)
|
||||
result->can_sagv = latency >= dev_priv->sagv_block_time_us;
|
||||
}
|
||||
|
||||
@ -5380,13 +5378,13 @@ static void skl_compute_transition_wm(struct drm_i915_private *dev_priv,
|
||||
if (IS_GEN9_BC(dev_priv) || IS_BROXTON(dev_priv))
|
||||
return;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
trans_min = 4;
|
||||
else
|
||||
trans_min = 14;
|
||||
|
||||
/* Display WA #1140: glk,cnl */
|
||||
if (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv))
|
||||
if (IS_DISPLAY_VER(dev_priv, 10))
|
||||
trans_amount = 0;
|
||||
else
|
||||
trans_amount = 10; /* This is configurable amount */
|
||||
@ -5444,7 +5442,7 @@ static int skl_build_plane_wm_single(struct intel_crtc_state *crtc_state,
|
||||
skl_compute_transition_wm(dev_priv, &wm->trans_wm,
|
||||
&wm->wm[0], &wm_params);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
tgl_compute_sagv_wm(crtc_state, &wm_params, wm);
|
||||
|
||||
skl_compute_transition_wm(dev_priv, &wm->sagv.trans_wm,
|
||||
@ -5566,7 +5564,7 @@ static int skl_build_pipe_wm(struct intel_atomic_state *state,
|
||||
if (plane->pipe != crtc->pipe)
|
||||
continue;
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11)
|
||||
if (DISPLAY_VER(dev_priv) >= 11)
|
||||
ret = icl_build_plane_wm(crtc_state, plane_state);
|
||||
else
|
||||
ret = skl_build_plane_wm(crtc_state, plane_state);
|
||||
@ -5627,7 +5625,7 @@ void skl_write_plane_wm(struct intel_plane *plane,
|
||||
skl_write_wm_level(dev_priv, PLANE_WM_TRANS(pipe, plane_id),
|
||||
skl_plane_trans_wm(pipe_wm, plane_id));
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 11) {
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
skl_ddb_entry_write(dev_priv,
|
||||
PLANE_BUF_CFG(pipe, plane_id), ddb_y);
|
||||
return;
|
||||
@ -6019,8 +6017,8 @@ static bool skl_plane_selected_wm_equals(struct intel_plane *plane,
|
||||
* use it. It only gets used for calculating the required
|
||||
* ddb allocation.
|
||||
*/
|
||||
if (!skl_wm_level_equals(skl_plane_wm_level(old_pipe_wm, level, plane->id),
|
||||
skl_plane_wm_level(new_pipe_wm, level, plane->id)))
|
||||
if (!skl_wm_level_equals(skl_plane_wm_level(old_pipe_wm, plane->id, level),
|
||||
skl_plane_wm_level(new_pipe_wm, plane->id, level)))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -6157,7 +6155,7 @@ static void ilk_program_watermarks(struct drm_i915_private *dev_priv)
|
||||
ilk_wm_merge(dev_priv, &config, &max, &lp_wm_1_2);
|
||||
|
||||
/* 5/6 split only in single pipe config on IVB+ */
|
||||
if (INTEL_GEN(dev_priv) >= 7 &&
|
||||
if (DISPLAY_VER(dev_priv) >= 7 &&
|
||||
config.num_pipes_active == 1 && config.sprites_enabled) {
|
||||
ilk_compute_wm_maximums(dev_priv, 1, &config, INTEL_DDB_PART_5_6, &max);
|
||||
ilk_wm_merge(dev_priv, &config, &max, &lp_wm_5_6);
|
||||
@ -6243,7 +6241,7 @@ void skl_pipe_wm_get_hw_state(struct intel_crtc *crtc,
|
||||
|
||||
skl_wm_level_from_reg_val(val, &wm->trans_wm);
|
||||
|
||||
if (INTEL_GEN(dev_priv) >= 12) {
|
||||
if (DISPLAY_VER(dev_priv) >= 12) {
|
||||
wm->sagv.wm0 = wm->wm[0];
|
||||
wm->sagv.trans_wm = wm->trans_wm;
|
||||
}
|
||||
@ -6770,7 +6768,7 @@ void ilk_wm_get_hw_state(struct drm_i915_private *dev_priv)
|
||||
hw->wm_lp[2] = intel_uncore_read(&dev_priv->uncore, WM3_LP_ILK);
|
||||
|
||||
hw->wm_lp_spr[0] = intel_uncore_read(&dev_priv->uncore, WM1S_LP_ILK);
|
||||
if (INTEL_GEN(dev_priv) >= 7) {
|
||||
if (DISPLAY_VER(dev_priv) >= 7) {
|
||||
hw->wm_lp_spr[1] = intel_uncore_read(&dev_priv->uncore, WM2S_LP_IVB);
|
||||
hw->wm_lp_spr[2] = intel_uncore_read(&dev_priv->uncore, WM3S_LP_IVB);
|
||||
}
|
||||
@ -7136,7 +7134,7 @@ static void gen12lp_init_clock_gating(struct drm_i915_private *dev_priv)
|
||||
ILK_DPFC_CHICKEN_COMP_DUMMY_PIXEL);
|
||||
|
||||
/* Wa_1409825376:tgl (pre-prod)*/
|
||||
if (IS_TGL_DISP_STEPPING(dev_priv, STEP_A0, STEP_B1))
|
||||
if (IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B1))
|
||||
intel_uncore_write(&dev_priv->uncore, GEN9_CLKGATE_DIS_3, intel_uncore_read(&dev_priv->uncore, GEN9_CLKGATE_DIS_3) |
|
||||
TGL_VRH_GATING_DIS);
|
||||
|
||||
@ -7235,12 +7233,12 @@ static void kbl_init_clock_gating(struct drm_i915_private *dev_priv)
|
||||
FBC_LLC_FULLY_OPEN);
|
||||
|
||||
/* WaDisableSDEUnitClockGating:kbl */
|
||||
if (IS_KBL_GT_REVID(dev_priv, 0, KBL_REVID_B0))
|
||||
if (IS_KBL_GT_STEP(dev_priv, 0, STEP_B0))
|
||||
intel_uncore_write(&dev_priv->uncore, GEN8_UCGCTL6, intel_uncore_read(&dev_priv->uncore, GEN8_UCGCTL6) |
|
||||
GEN8_SDEUNIT_CLOCK_GATE_DISABLE);
|
||||
|
||||
/* WaDisableGamClockGating:kbl */
|
||||
if (IS_KBL_GT_REVID(dev_priv, 0, KBL_REVID_B0))
|
||||
if (IS_KBL_GT_STEP(dev_priv, 0, STEP_B0))
|
||||
intel_uncore_write(&dev_priv->uncore, GEN6_UCGCTL1, intel_uncore_read(&dev_priv->uncore, GEN6_UCGCTL1) |
|
||||
GEN6_GAMUNIT_CLOCK_GATE_DISABLE);
|
||||
|
||||
@ -7685,15 +7683,15 @@ void intel_init_pm(struct drm_i915_private *dev_priv)
|
||||
skl_setup_sagv_block_time(dev_priv);
|
||||
|
||||
/* For FIFO watermark updates */
|
||||
if (INTEL_GEN(dev_priv) >= 9) {
|
||||
if (DISPLAY_VER(dev_priv) >= 9) {
|
||||
skl_setup_wm_latency(dev_priv);
|
||||
dev_priv->display.compute_global_watermarks = skl_compute_wm;
|
||||
} else if (HAS_PCH_SPLIT(dev_priv)) {
|
||||
ilk_setup_wm_latency(dev_priv);
|
||||
|
||||
if ((IS_GEN(dev_priv, 5) && dev_priv->wm.pri_latency[1] &&
|
||||
if ((IS_DISPLAY_VER(dev_priv, 5) && dev_priv->wm.pri_latency[1] &&
|
||||
dev_priv->wm.spr_latency[1] && dev_priv->wm.cur_latency[1]) ||
|
||||
(!IS_GEN(dev_priv, 5) && dev_priv->wm.pri_latency[0] &&
|
||||
(!IS_DISPLAY_VER(dev_priv, 5) && dev_priv->wm.pri_latency[0] &&
|
||||
dev_priv->wm.spr_latency[0] && dev_priv->wm.cur_latency[0])) {
|
||||
dev_priv->display.compute_pipe_wm = ilk_compute_pipe_wm;
|
||||
dev_priv->display.compute_intermediate_wm =
|
||||
@ -7736,12 +7734,12 @@ void intel_init_pm(struct drm_i915_private *dev_priv)
|
||||
dev_priv->display.update_wm = NULL;
|
||||
} else
|
||||
dev_priv->display.update_wm = pnv_update_wm;
|
||||
} else if (IS_GEN(dev_priv, 4)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 4)) {
|
||||
dev_priv->display.update_wm = i965_update_wm;
|
||||
} else if (IS_GEN(dev_priv, 3)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 3)) {
|
||||
dev_priv->display.update_wm = i9xx_update_wm;
|
||||
dev_priv->display.get_fifo_size = i9xx_get_fifo_size;
|
||||
} else if (IS_GEN(dev_priv, 2)) {
|
||||
} else if (IS_DISPLAY_VER(dev_priv, 2)) {
|
||||
if (INTEL_NUM_PIPES(dev_priv) == 1) {
|
||||
dev_priv->display.update_wm = i845_update_wm;
|
||||
dev_priv->display.get_fifo_size = i845_get_fifo_size;
|
||||
|
@ -412,12 +412,20 @@ intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm)
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_runtime_pm_get_if_in_use - grab a runtime pm reference if device in use
|
||||
* __intel_runtime_pm_get_if_active - grab a runtime pm reference if device is active
|
||||
* @rpm: the intel_runtime_pm structure
|
||||
* @ignore_usecount: get a ref even if dev->power.usage_count is 0
|
||||
*
|
||||
* This function grabs a device-level runtime pm reference if the device is
|
||||
* already in use and ensures that it is powered up. It is illegal to try
|
||||
* and access the HW should intel_runtime_pm_get_if_in_use() report failure.
|
||||
* already active and ensures that it is powered up. It is illegal to try
|
||||
* and access the HW should intel_runtime_pm_get_if_active() report failure.
|
||||
*
|
||||
* If @ignore_usecount is true, a reference will be acquired even if there is no
|
||||
* user requiring the device to be powered up (dev->power.usage_count == 0).
|
||||
* If the function returns false in this case then it's guaranteed that the
|
||||
* device's runtime suspend hook has been called already or that it will be
|
||||
* called (and hence it's also guaranteed that the device's runtime resume
|
||||
* hook will be called eventually).
|
||||
*
|
||||
* Any runtime pm reference obtained by this function must have a symmetric
|
||||
* call to intel_runtime_pm_put() to release the reference again.
|
||||
@ -425,7 +433,8 @@ intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm)
|
||||
* Returns: the wakeref cookie to pass to intel_runtime_pm_put(), evaluates
|
||||
* as True if the wakeref was acquired, or False otherwise.
|
||||
*/
|
||||
intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm)
|
||||
static intel_wakeref_t __intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm,
|
||||
bool ignore_usecount)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_PM)) {
|
||||
/*
|
||||
@ -434,7 +443,7 @@ intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm)
|
||||
* function, since the power state is undefined. This applies
|
||||
* atm to the late/early system suspend/resume handlers.
|
||||
*/
|
||||
if (pm_runtime_get_if_in_use(rpm->kdev) <= 0)
|
||||
if (pm_runtime_get_if_active(rpm->kdev, ignore_usecount) <= 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -443,6 +452,16 @@ intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm)
|
||||
return track_intel_runtime_pm_wakeref(rpm);
|
||||
}
|
||||
|
||||
intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm)
|
||||
{
|
||||
return __intel_runtime_pm_get_if_active(rpm, false);
|
||||
}
|
||||
|
||||
intel_wakeref_t intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm)
|
||||
{
|
||||
return __intel_runtime_pm_get_if_active(rpm, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_runtime_pm_get_noresume - grab a runtime pm reference
|
||||
* @rpm: the intel_runtime_pm structure
|
||||
|
@ -177,6 +177,7 @@ void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm);
|
||||
|
||||
intel_wakeref_t intel_runtime_pm_get(struct intel_runtime_pm *rpm);
|
||||
intel_wakeref_t intel_runtime_pm_get_if_in_use(struct intel_runtime_pm *rpm);
|
||||
intel_wakeref_t intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm);
|
||||
intel_wakeref_t intel_runtime_pm_get_noresume(struct intel_runtime_pm *rpm);
|
||||
intel_wakeref_t intel_runtime_pm_get_raw(struct intel_runtime_pm *rpm);
|
||||
|
||||
@ -188,6 +189,10 @@ intel_wakeref_t intel_runtime_pm_get_raw(struct intel_runtime_pm *rpm);
|
||||
for ((wf) = intel_runtime_pm_get_if_in_use(rpm); (wf); \
|
||||
intel_runtime_pm_put((rpm), (wf)), (wf) = 0)
|
||||
|
||||
#define with_intel_runtime_pm_if_active(rpm, wf) \
|
||||
for ((wf) = intel_runtime_pm_get_if_active(rpm); (wf); \
|
||||
intel_runtime_pm_put((rpm), (wf)), (wf) = 0)
|
||||
|
||||
void intel_runtime_pm_put_unchecked(struct intel_runtime_pm *rpm);
|
||||
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
|
||||
void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref);
|
||||
|
106
drivers/gpu/drm/i915/intel_step.c
Normal file
106
drivers/gpu/drm/i915/intel_step.c
Normal file
@ -0,0 +1,106 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright © 2020,2021 Intel Corporation
|
||||
*/
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "intel_step.h"
|
||||
|
||||
/*
|
||||
* KBL revision ID ordering is bizarre; higher revision ID's map to lower
|
||||
* steppings in some cases. So rather than test against the revision ID
|
||||
* directly, let's map that into our own range of increasing ID's that we
|
||||
* can test against in a regular manner.
|
||||
*/
|
||||
|
||||
|
||||
/* FIXME: what about REVID_E0 */
|
||||
static const struct intel_step_info kbl_revids[] = {
|
||||
[0] = { .gt_step = STEP_A0, .display_step = STEP_A0 },
|
||||
[1] = { .gt_step = STEP_B0, .display_step = STEP_B0 },
|
||||
[2] = { .gt_step = STEP_C0, .display_step = STEP_B0 },
|
||||
[3] = { .gt_step = STEP_D0, .display_step = STEP_B0 },
|
||||
[4] = { .gt_step = STEP_F0, .display_step = STEP_C0 },
|
||||
[5] = { .gt_step = STEP_C0, .display_step = STEP_B1 },
|
||||
[6] = { .gt_step = STEP_D1, .display_step = STEP_B1 },
|
||||
[7] = { .gt_step = STEP_G0, .display_step = STEP_C0 },
|
||||
};
|
||||
|
||||
static const struct intel_step_info tgl_uy_revid_step_tbl[] = {
|
||||
[0] = { .gt_step = STEP_A0, .display_step = STEP_A0 },
|
||||
[1] = { .gt_step = STEP_B0, .display_step = STEP_C0 },
|
||||
[2] = { .gt_step = STEP_B1, .display_step = STEP_C0 },
|
||||
[3] = { .gt_step = STEP_C0, .display_step = STEP_D0 },
|
||||
};
|
||||
|
||||
/* Same GT stepping between tgl_uy_revids and tgl_revids don't mean the same HW */
|
||||
static const struct intel_step_info tgl_revid_step_tbl[] = {
|
||||
[0] = { .gt_step = STEP_A0, .display_step = STEP_B0 },
|
||||
[1] = { .gt_step = STEP_B0, .display_step = STEP_D0 },
|
||||
};
|
||||
|
||||
static const struct intel_step_info adls_revid_step_tbl[] = {
|
||||
[0x0] = { .gt_step = STEP_A0, .display_step = STEP_A0 },
|
||||
[0x1] = { .gt_step = STEP_A0, .display_step = STEP_A2 },
|
||||
[0x4] = { .gt_step = STEP_B0, .display_step = STEP_B0 },
|
||||
[0x8] = { .gt_step = STEP_C0, .display_step = STEP_B0 },
|
||||
[0xC] = { .gt_step = STEP_D0, .display_step = STEP_C0 },
|
||||
};
|
||||
|
||||
void intel_step_init(struct drm_i915_private *i915)
|
||||
{
|
||||
const struct intel_step_info *revids = NULL;
|
||||
int size = 0;
|
||||
int revid = INTEL_REVID(i915);
|
||||
struct intel_step_info step = {};
|
||||
|
||||
if (IS_ALDERLAKE_S(i915)) {
|
||||
revids = adls_revid_step_tbl;
|
||||
size = ARRAY_SIZE(adls_revid_step_tbl);
|
||||
} else if (IS_TGL_U(i915) || IS_TGL_Y(i915)) {
|
||||
revids = tgl_uy_revid_step_tbl;
|
||||
size = ARRAY_SIZE(tgl_uy_revid_step_tbl);
|
||||
} else if (IS_TIGERLAKE(i915)) {
|
||||
revids = tgl_revid_step_tbl;
|
||||
size = ARRAY_SIZE(tgl_revid_step_tbl);
|
||||
} else if (IS_KABYLAKE(i915)) {
|
||||
revids = kbl_revids;
|
||||
size = ARRAY_SIZE(kbl_revids);
|
||||
}
|
||||
|
||||
/* Not using the stepping scheme for the platform yet. */
|
||||
if (!revids)
|
||||
return;
|
||||
|
||||
if (revid < size && revids[revid].gt_step != STEP_NONE) {
|
||||
step = revids[revid];
|
||||
} else {
|
||||
drm_warn(&i915->drm, "Unknown revid 0x%02x\n", revid);
|
||||
|
||||
/*
|
||||
* If we hit a gap in the revid array, use the information for
|
||||
* the next revid.
|
||||
*
|
||||
* This may be wrong in all sorts of ways, especially if the
|
||||
* steppings in the array are not monotonically increasing, but
|
||||
* it's better than defaulting to 0.
|
||||
*/
|
||||
while (revid < size && revids[revid].gt_step == STEP_NONE)
|
||||
revid++;
|
||||
|
||||
if (revid < size) {
|
||||
drm_dbg(&i915->drm, "Using steppings for revid 0x%02x\n",
|
||||
revid);
|
||||
step = revids[revid];
|
||||
} else {
|
||||
drm_dbg(&i915->drm, "Using future steppings\n");
|
||||
step.gt_step = STEP_FUTURE;
|
||||
step.display_step = STEP_FUTURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (drm_WARN_ON(&i915->drm, step.gt_step == STEP_NONE))
|
||||
return;
|
||||
|
||||
RUNTIME_INFO(i915)->step = step;
|
||||
}
|
40
drivers/gpu/drm/i915/intel_step.h
Normal file
40
drivers/gpu/drm/i915/intel_step.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
/*
|
||||
* Copyright © 2020,2021 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef __INTEL_STEP_H__
|
||||
#define __INTEL_STEP_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct drm_i915_private;
|
||||
|
||||
struct intel_step_info {
|
||||
u8 gt_step;
|
||||
u8 display_step;
|
||||
};
|
||||
|
||||
/*
|
||||
* Symbolic steppings that do not match the hardware. These are valid both as gt
|
||||
* and display steppings as symbolic names.
|
||||
*/
|
||||
enum intel_step {
|
||||
STEP_NONE = 0,
|
||||
STEP_A0,
|
||||
STEP_A2,
|
||||
STEP_B0,
|
||||
STEP_B1,
|
||||
STEP_C0,
|
||||
STEP_D0,
|
||||
STEP_D1,
|
||||
STEP_E0,
|
||||
STEP_F0,
|
||||
STEP_G0,
|
||||
STEP_FUTURE,
|
||||
STEP_FOREVER,
|
||||
};
|
||||
|
||||
void intel_step_init(struct drm_i915_private *i915);
|
||||
|
||||
#endif /* __INTEL_STEP_H__ */
|
@ -361,7 +361,7 @@ static unsigned long rotated_index(const struct intel_rotation_info *r,
|
||||
unsigned int x,
|
||||
unsigned int y)
|
||||
{
|
||||
return (r->plane[n].stride * (r->plane[n].height - y - 1) +
|
||||
return (r->plane[n].src_stride * (r->plane[n].height - y - 1) +
|
||||
r->plane[n].offset + x);
|
||||
}
|
||||
|
||||
@ -373,6 +373,8 @@ assert_rotated(struct drm_i915_gem_object *obj,
|
||||
unsigned int x, y;
|
||||
|
||||
for (x = 0; x < r->plane[n].width; x++) {
|
||||
unsigned int left;
|
||||
|
||||
for (y = 0; y < r->plane[n].height; y++) {
|
||||
unsigned long src_idx;
|
||||
dma_addr_t src;
|
||||
@ -401,6 +403,31 @@ assert_rotated(struct drm_i915_gem_object *obj,
|
||||
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
|
||||
left = (r->plane[n].dst_stride - y) * PAGE_SIZE;
|
||||
|
||||
if (!left)
|
||||
continue;
|
||||
|
||||
if (!sg) {
|
||||
pr_err("Invalid sg table: too short at plane %d, (%d, %d)!\n",
|
||||
n, x, y);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (sg_dma_len(sg) != left) {
|
||||
pr_err("Invalid sg.length, found %d, expected %u for rotated page (%d, %d)\n",
|
||||
sg_dma_len(sg), left, x, y);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (sg_dma_address(sg) != 0) {
|
||||
pr_err("Invalid address, found %pad, expected 0 for remapped page (%d, %d)\n",
|
||||
&sg_dma_address(sg), x, y);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
|
||||
return sg;
|
||||
@ -411,7 +438,7 @@ static unsigned long remapped_index(const struct intel_remapped_info *r,
|
||||
unsigned int x,
|
||||
unsigned int y)
|
||||
{
|
||||
return (r->plane[n].stride * y +
|
||||
return (r->plane[n].src_stride * y +
|
||||
r->plane[n].offset + x);
|
||||
}
|
||||
|
||||
@ -462,15 +489,55 @@ assert_remapped(struct drm_i915_gem_object *obj,
|
||||
if (!left)
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
|
||||
if (left) {
|
||||
pr_err("Unexpected sg tail with %d size for remapped page (%d, %d)\n",
|
||||
left,
|
||||
x, y);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
left = (r->plane[n].dst_stride - r->plane[n].width) * PAGE_SIZE;
|
||||
|
||||
if (!left)
|
||||
continue;
|
||||
|
||||
if (!sg) {
|
||||
pr_err("Invalid sg table: too short at plane %d, (%d, %d)!\n",
|
||||
n, x, y);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (sg_dma_len(sg) != left) {
|
||||
pr_err("Invalid sg.length, found %u, expected %u for remapped page (%d, %d)\n",
|
||||
sg_dma_len(sg), left,
|
||||
x, y);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
if (sg_dma_address(sg) != 0) {
|
||||
pr_err("Invalid address, found %pad, expected 0 for remapped page (%d, %d)\n",
|
||||
&sg_dma_address(sg),
|
||||
x, y);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
sg = sg_next(sg);
|
||||
left = 0;
|
||||
}
|
||||
|
||||
return sg;
|
||||
}
|
||||
|
||||
static unsigned int rotated_size(const struct intel_remapped_plane_info *a,
|
||||
const struct intel_remapped_plane_info *b)
|
||||
static unsigned int remapped_size(enum i915_ggtt_view_type view_type,
|
||||
const struct intel_remapped_plane_info *a,
|
||||
const struct intel_remapped_plane_info *b)
|
||||
{
|
||||
return a->width * a->height + b->width * b->height;
|
||||
|
||||
if (view_type == I915_GGTT_VIEW_ROTATED)
|
||||
return a->dst_stride * a->width + b->dst_stride * b->width;
|
||||
else
|
||||
return a->dst_stride * a->height + b->dst_stride * b->height;
|
||||
}
|
||||
|
||||
static int igt_vma_rotate_remap(void *arg)
|
||||
@ -479,21 +546,26 @@ static int igt_vma_rotate_remap(void *arg)
|
||||
struct i915_address_space *vm = &ggtt->vm;
|
||||
struct drm_i915_gem_object *obj;
|
||||
const struct intel_remapped_plane_info planes[] = {
|
||||
{ .width = 1, .height = 1, .stride = 1 },
|
||||
{ .width = 2, .height = 2, .stride = 2 },
|
||||
{ .width = 4, .height = 4, .stride = 4 },
|
||||
{ .width = 8, .height = 8, .stride = 8 },
|
||||
{ .width = 1, .height = 1, .src_stride = 1 },
|
||||
{ .width = 2, .height = 2, .src_stride = 2 },
|
||||
{ .width = 4, .height = 4, .src_stride = 4 },
|
||||
{ .width = 8, .height = 8, .src_stride = 8 },
|
||||
|
||||
{ .width = 3, .height = 5, .stride = 3 },
|
||||
{ .width = 3, .height = 5, .stride = 4 },
|
||||
{ .width = 3, .height = 5, .stride = 5 },
|
||||
{ .width = 3, .height = 5, .src_stride = 3 },
|
||||
{ .width = 3, .height = 5, .src_stride = 4 },
|
||||
{ .width = 3, .height = 5, .src_stride = 5 },
|
||||
|
||||
{ .width = 5, .height = 3, .stride = 5 },
|
||||
{ .width = 5, .height = 3, .stride = 7 },
|
||||
{ .width = 5, .height = 3, .stride = 9 },
|
||||
{ .width = 5, .height = 3, .src_stride = 5 },
|
||||
{ .width = 5, .height = 3, .src_stride = 7 },
|
||||
{ .width = 5, .height = 3, .src_stride = 9 },
|
||||
|
||||
{ .width = 4, .height = 6, .src_stride = 6 },
|
||||
{ .width = 6, .height = 4, .src_stride = 6 },
|
||||
|
||||
{ .width = 2, .height = 2, .src_stride = 2, .dst_stride = 2 },
|
||||
{ .width = 3, .height = 3, .src_stride = 3, .dst_stride = 4 },
|
||||
{ .width = 5, .height = 6, .src_stride = 7, .dst_stride = 8 },
|
||||
|
||||
{ .width = 4, .height = 6, .stride = 6 },
|
||||
{ .width = 6, .height = 4, .stride = 6 },
|
||||
{ }
|
||||
}, *a, *b;
|
||||
enum i915_ggtt_view_type types[] = {
|
||||
@ -515,22 +587,33 @@ static int igt_vma_rotate_remap(void *arg)
|
||||
for (t = types; *t; t++) {
|
||||
for (a = planes; a->width; a++) {
|
||||
for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) {
|
||||
struct i915_ggtt_view view;
|
||||
struct i915_ggtt_view view = {
|
||||
.type = *t,
|
||||
.remapped.plane[0] = *a,
|
||||
.remapped.plane[1] = *b,
|
||||
};
|
||||
struct intel_remapped_plane_info *plane_info = view.remapped.plane;
|
||||
unsigned int n, max_offset;
|
||||
|
||||
max_offset = max(a->stride * a->height,
|
||||
b->stride * b->height);
|
||||
max_offset = max(plane_info[0].src_stride * plane_info[0].height,
|
||||
plane_info[1].src_stride * plane_info[1].height);
|
||||
GEM_BUG_ON(max_offset > max_pages);
|
||||
max_offset = max_pages - max_offset;
|
||||
|
||||
view.type = *t;
|
||||
view.rotated.plane[0] = *a;
|
||||
view.rotated.plane[1] = *b;
|
||||
if (!plane_info[0].dst_stride)
|
||||
plane_info[0].dst_stride = view.type == I915_GGTT_VIEW_ROTATED ?
|
||||
plane_info[0].height :
|
||||
plane_info[0].width;
|
||||
if (!plane_info[1].dst_stride)
|
||||
plane_info[1].dst_stride = view.type == I915_GGTT_VIEW_ROTATED ?
|
||||
plane_info[1].height :
|
||||
plane_info[1].width;
|
||||
|
||||
for_each_prime_number_from(view.rotated.plane[0].offset, 0, max_offset) {
|
||||
for_each_prime_number_from(view.rotated.plane[1].offset, 0, max_offset) {
|
||||
for_each_prime_number_from(plane_info[0].offset, 0, max_offset) {
|
||||
for_each_prime_number_from(plane_info[1].offset, 0, max_offset) {
|
||||
struct scatterlist *sg;
|
||||
struct i915_vma *vma;
|
||||
unsigned int expected_pages;
|
||||
|
||||
vma = checked_vma_instance(obj, vm, &view);
|
||||
if (IS_ERR(vma)) {
|
||||
@ -544,25 +627,27 @@ static int igt_vma_rotate_remap(void *arg)
|
||||
goto out_object;
|
||||
}
|
||||
|
||||
expected_pages = remapped_size(view.type, &plane_info[0], &plane_info[1]);
|
||||
|
||||
if (view.type == I915_GGTT_VIEW_ROTATED &&
|
||||
vma->size != rotated_size(a, b) * PAGE_SIZE) {
|
||||
vma->size != expected_pages * PAGE_SIZE) {
|
||||
pr_err("VMA is wrong size, expected %lu, found %llu\n",
|
||||
PAGE_SIZE * rotated_size(a, b), vma->size);
|
||||
PAGE_SIZE * expected_pages, vma->size);
|
||||
err = -EINVAL;
|
||||
goto out_object;
|
||||
}
|
||||
|
||||
if (view.type == I915_GGTT_VIEW_REMAPPED &&
|
||||
vma->size > rotated_size(a, b) * PAGE_SIZE) {
|
||||
vma->size > expected_pages * PAGE_SIZE) {
|
||||
pr_err("VMA is wrong size, expected %lu, found %llu\n",
|
||||
PAGE_SIZE * rotated_size(a, b), vma->size);
|
||||
PAGE_SIZE * expected_pages, vma->size);
|
||||
err = -EINVAL;
|
||||
goto out_object;
|
||||
}
|
||||
|
||||
if (vma->pages->nents > rotated_size(a, b)) {
|
||||
if (vma->pages->nents > expected_pages) {
|
||||
pr_err("sg table is wrong sizeo, expected %u, found %u nents\n",
|
||||
rotated_size(a, b), vma->pages->nents);
|
||||
expected_pages, vma->pages->nents);
|
||||
err = -EINVAL;
|
||||
goto out_object;
|
||||
}
|
||||
@ -587,17 +672,19 @@ static int igt_vma_rotate_remap(void *arg)
|
||||
else
|
||||
sg = assert_remapped(obj, &view.remapped, n, sg);
|
||||
if (IS_ERR(sg)) {
|
||||
pr_err("Inconsistent %s VMA pages for plane %d: [(%d, %d, %d, %d), (%d, %d, %d, %d)]\n",
|
||||
pr_err("Inconsistent %s VMA pages for plane %d: [(%d, %d, %d, %d, %d), (%d, %d, %d, %d, %d)]\n",
|
||||
view.type == I915_GGTT_VIEW_ROTATED ?
|
||||
"rotated" : "remapped", n,
|
||||
view.rotated.plane[0].width,
|
||||
view.rotated.plane[0].height,
|
||||
view.rotated.plane[0].stride,
|
||||
view.rotated.plane[0].offset,
|
||||
view.rotated.plane[1].width,
|
||||
view.rotated.plane[1].height,
|
||||
view.rotated.plane[1].stride,
|
||||
view.rotated.plane[1].offset);
|
||||
plane_info[0].width,
|
||||
plane_info[0].height,
|
||||
plane_info[0].src_stride,
|
||||
plane_info[0].dst_stride,
|
||||
plane_info[0].offset,
|
||||
plane_info[1].width,
|
||||
plane_info[1].height,
|
||||
plane_info[1].src_stride,
|
||||
plane_info[1].dst_stride,
|
||||
plane_info[1].offset);
|
||||
err = -EINVAL;
|
||||
goto out_object;
|
||||
}
|
||||
@ -849,21 +936,26 @@ static int igt_vma_remapped_gtt(void *arg)
|
||||
{
|
||||
struct drm_i915_private *i915 = arg;
|
||||
const struct intel_remapped_plane_info planes[] = {
|
||||
{ .width = 1, .height = 1, .stride = 1 },
|
||||
{ .width = 2, .height = 2, .stride = 2 },
|
||||
{ .width = 4, .height = 4, .stride = 4 },
|
||||
{ .width = 8, .height = 8, .stride = 8 },
|
||||
{ .width = 1, .height = 1, .src_stride = 1 },
|
||||
{ .width = 2, .height = 2, .src_stride = 2 },
|
||||
{ .width = 4, .height = 4, .src_stride = 4 },
|
||||
{ .width = 8, .height = 8, .src_stride = 8 },
|
||||
|
||||
{ .width = 3, .height = 5, .stride = 3 },
|
||||
{ .width = 3, .height = 5, .stride = 4 },
|
||||
{ .width = 3, .height = 5, .stride = 5 },
|
||||
{ .width = 3, .height = 5, .src_stride = 3 },
|
||||
{ .width = 3, .height = 5, .src_stride = 4 },
|
||||
{ .width = 3, .height = 5, .src_stride = 5 },
|
||||
|
||||
{ .width = 5, .height = 3, .stride = 5 },
|
||||
{ .width = 5, .height = 3, .stride = 7 },
|
||||
{ .width = 5, .height = 3, .stride = 9 },
|
||||
{ .width = 5, .height = 3, .src_stride = 5 },
|
||||
{ .width = 5, .height = 3, .src_stride = 7 },
|
||||
{ .width = 5, .height = 3, .src_stride = 9 },
|
||||
|
||||
{ .width = 4, .height = 6, .src_stride = 6 },
|
||||
{ .width = 6, .height = 4, .src_stride = 6 },
|
||||
|
||||
{ .width = 2, .height = 2, .src_stride = 2, .dst_stride = 2 },
|
||||
{ .width = 3, .height = 3, .src_stride = 3, .dst_stride = 4 },
|
||||
{ .width = 5, .height = 6, .src_stride = 7, .dst_stride = 8 },
|
||||
|
||||
{ .width = 4, .height = 6, .stride = 6 },
|
||||
{ .width = 6, .height = 4, .stride = 6 },
|
||||
{ }
|
||||
}, *p;
|
||||
enum i915_ggtt_view_type types[] = {
|
||||
@ -887,10 +979,10 @@ static int igt_vma_remapped_gtt(void *arg)
|
||||
.type = *t,
|
||||
.rotated.plane[0] = *p,
|
||||
};
|
||||
struct intel_remapped_plane_info *plane_info = view.rotated.plane;
|
||||
struct i915_vma *vma;
|
||||
u32 __iomem *map;
|
||||
unsigned int x, y;
|
||||
int err;
|
||||
|
||||
i915_gem_object_lock(obj, NULL);
|
||||
err = i915_gem_object_set_to_gtt_domain(obj, true);
|
||||
@ -898,6 +990,10 @@ static int igt_vma_remapped_gtt(void *arg)
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
if (!plane_info[0].dst_stride)
|
||||
plane_info[0].dst_stride = *t == I915_GGTT_VIEW_ROTATED ?
|
||||
p->height : p->width;
|
||||
|
||||
vma = i915_gem_object_ggtt_pin(obj, &view, 0, 0, PIN_MAPPABLE);
|
||||
if (IS_ERR(vma)) {
|
||||
err = PTR_ERR(vma);
|
||||
@ -913,15 +1009,15 @@ static int igt_vma_remapped_gtt(void *arg)
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (y = 0 ; y < p->height; y++) {
|
||||
for (x = 0 ; x < p->width; x++) {
|
||||
for (y = 0 ; y < plane_info[0].height; y++) {
|
||||
for (x = 0 ; x < plane_info[0].width; x++) {
|
||||
unsigned int offset;
|
||||
u32 val = y << 16 | x;
|
||||
|
||||
if (*t == I915_GGTT_VIEW_ROTATED)
|
||||
offset = (x * p->height + y) * PAGE_SIZE;
|
||||
offset = (x * plane_info[0].dst_stride + y) * PAGE_SIZE;
|
||||
else
|
||||
offset = (y * p->width + x) * PAGE_SIZE;
|
||||
offset = (y * plane_info[0].dst_stride + x) * PAGE_SIZE;
|
||||
|
||||
iowrite32(val, &map[offset / sizeof(*map)]);
|
||||
}
|
||||
@ -944,8 +1040,8 @@ static int igt_vma_remapped_gtt(void *arg)
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (y = 0 ; y < p->height; y++) {
|
||||
for (x = 0 ; x < p->width; x++) {
|
||||
for (y = 0 ; y < plane_info[0].height; y++) {
|
||||
for (x = 0 ; x < plane_info[0].width; x++) {
|
||||
unsigned int offset, src_idx;
|
||||
u32 exp = y << 16 | x;
|
||||
u32 val;
|
||||
@ -960,8 +1056,9 @@ static int igt_vma_remapped_gtt(void *arg)
|
||||
if (val != exp) {
|
||||
pr_err("%s VMA write test failed, expected 0x%x, found 0x%x\n",
|
||||
*t == I915_GGTT_VIEW_ROTATED ? "Rotated" : "Remapped",
|
||||
val, exp);
|
||||
exp, val);
|
||||
i915_vma_unpin_iomap(vma);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
@ -1176,6 +1176,7 @@ struct drm_device;
|
||||
# define DP_PCON_ENABLE_MAX_BW_48GBPS 6
|
||||
# define DP_PCON_ENABLE_SOURCE_CTL_MODE (1 << 3)
|
||||
# define DP_PCON_ENABLE_CONCURRENT_LINK (1 << 4)
|
||||
# define DP_PCON_ENABLE_SEQUENTIAL_LINK (0 << 4)
|
||||
# define DP_PCON_ENABLE_LINK_FRL_MODE (1 << 5)
|
||||
# define DP_PCON_ENABLE_HPD_READY (1 << 6)
|
||||
# define DP_PCON_ENABLE_HDMI_LINK (1 << 7)
|
||||
@ -1190,6 +1191,7 @@ struct drm_device;
|
||||
# define DP_PCON_FRL_BW_MASK_40GBPS (1 << 4)
|
||||
# define DP_PCON_FRL_BW_MASK_48GBPS (1 << 5)
|
||||
# define DP_PCON_FRL_LINK_TRAIN_EXTENDED (1 << 6)
|
||||
# define DP_PCON_FRL_LINK_TRAIN_NORMAL (0 << 6)
|
||||
|
||||
/* PCON HDMI LINK STATUS */
|
||||
#define DP_PCON_HDMI_TX_LINK_STATUS 0x303B
|
||||
@ -2154,9 +2156,9 @@ int drm_dp_get_pcon_max_frl_bw(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
|
||||
int drm_dp_pcon_frl_prepare(struct drm_dp_aux *aux, bool enable_frl_ready_hpd);
|
||||
bool drm_dp_pcon_is_frl_ready(struct drm_dp_aux *aux);
|
||||
int drm_dp_pcon_frl_configure_1(struct drm_dp_aux *aux, int max_frl_gbps,
|
||||
bool concurrent_mode);
|
||||
u8 frl_mode);
|
||||
int drm_dp_pcon_frl_configure_2(struct drm_dp_aux *aux, int max_frl_mask,
|
||||
bool extended_train_mode);
|
||||
u8 frl_type);
|
||||
int drm_dp_pcon_reset_frl_config(struct drm_dp_aux *aux);
|
||||
int drm_dp_pcon_frl_enable(struct drm_dp_aux *aux);
|
||||
|
||||
|
@ -224,11 +224,14 @@ struct hdcp2_rep_stream_ready {
|
||||
|
||||
/* HDCP2.2 TIMEOUTs in mSec */
|
||||
#define HDCP_2_2_CERT_TIMEOUT_MS 100
|
||||
#define HDCP_2_2_DP_CERT_READ_TIMEOUT_MS 110
|
||||
#define HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT_MS 1000
|
||||
#define HDCP_2_2_HPRIME_PAIRED_TIMEOUT_MS 200
|
||||
#define HDCP_2_2_DP_HPRIME_READ_TIMEOUT_MS 7
|
||||
#define HDCP_2_2_PAIRING_TIMEOUT_MS 200
|
||||
#define HDCP_2_2_DP_PAIRING_READ_TIMEOUT_MS 5
|
||||
#define HDCP_2_2_HDMI_LPRIME_TIMEOUT_MS 20
|
||||
#define HDCP_2_2_DP_LPRIME_TIMEOUT_MS 7
|
||||
#define HDCP_2_2_DP_LPRIME_TIMEOUT_MS 16
|
||||
#define HDCP_2_2_RECVID_LIST_TIMEOUT_MS 3000
|
||||
#define HDCP_2_2_STREAM_READY_TIMEOUT_MS 100
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user