mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-30 13:38:40 +00:00
drm/i915: Ensure the HW is powered during display pipe HW readout
The assumption when adding the intel_display_power_is_enabled() checks
was that if it returns success the power can't be turned off afterwards
during the HW access, which is guaranteed by modeset locks. This isn't
always true, so make sure we hold a dedicated reference for the time of
the access.
Signed-off-by: Imre Deak <imre.deak@intel.com>
Revieved-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1455296121-4742-3-git-send-email-imre.deak@intel.com
(cherry picked from commit 1729050eb4
)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
parent
5af9a45476
commit
9fb84d5a92
@ -8171,18 +8171,22 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
|
||||
{
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
enum intel_display_power_domain power_domain;
|
||||
uint32_t tmp;
|
||||
bool ret;
|
||||
|
||||
if (!intel_display_power_is_enabled(dev_priv,
|
||||
POWER_DOMAIN_PIPE(crtc->pipe)))
|
||||
power_domain = POWER_DOMAIN_PIPE(crtc->pipe);
|
||||
if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
|
||||
return false;
|
||||
|
||||
pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe;
|
||||
pipe_config->shared_dpll = DPLL_ID_PRIVATE;
|
||||
|
||||
ret = false;
|
||||
|
||||
tmp = I915_READ(PIPECONF(crtc->pipe));
|
||||
if (!(tmp & PIPECONF_ENABLE))
|
||||
return false;
|
||||
goto out;
|
||||
|
||||
if (IS_G4X(dev) || IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) {
|
||||
switch (tmp & PIPECONF_BPC_MASK) {
|
||||
@ -8262,7 +8266,12 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
|
||||
pipe_config->base.adjusted_mode.crtc_clock =
|
||||
pipe_config->port_clock / pipe_config->pixel_multiplier;
|
||||
|
||||
return true;
|
||||
ret = true;
|
||||
|
||||
out:
|
||||
intel_display_power_put(dev_priv, power_domain);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ironlake_init_pch_refclk(struct drm_device *dev)
|
||||
@ -9366,18 +9375,21 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc,
|
||||
{
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
enum intel_display_power_domain power_domain;
|
||||
uint32_t tmp;
|
||||
bool ret;
|
||||
|
||||
if (!intel_display_power_is_enabled(dev_priv,
|
||||
POWER_DOMAIN_PIPE(crtc->pipe)))
|
||||
power_domain = POWER_DOMAIN_PIPE(crtc->pipe);
|
||||
if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
|
||||
return false;
|
||||
|
||||
pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe;
|
||||
pipe_config->shared_dpll = DPLL_ID_PRIVATE;
|
||||
|
||||
ret = false;
|
||||
tmp = I915_READ(PIPECONF(crtc->pipe));
|
||||
if (!(tmp & PIPECONF_ENABLE))
|
||||
return false;
|
||||
goto out;
|
||||
|
||||
switch (tmp & PIPECONF_BPC_MASK) {
|
||||
case PIPECONF_6BPC:
|
||||
@ -9440,7 +9452,12 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc,
|
||||
|
||||
ironlake_get_pfit_config(crtc, pipe_config);
|
||||
|
||||
return true;
|
||||
ret = true;
|
||||
|
||||
out:
|
||||
intel_display_power_put(dev_priv, power_domain);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv)
|
||||
@ -9950,12 +9967,17 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
|
||||
{
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
enum intel_display_power_domain pfit_domain;
|
||||
enum intel_display_power_domain power_domain;
|
||||
unsigned long power_domain_mask;
|
||||
uint32_t tmp;
|
||||
bool ret;
|
||||
|
||||
if (!intel_display_power_is_enabled(dev_priv,
|
||||
POWER_DOMAIN_PIPE(crtc->pipe)))
|
||||
power_domain = POWER_DOMAIN_PIPE(crtc->pipe);
|
||||
if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
|
||||
return false;
|
||||
power_domain_mask = BIT(power_domain);
|
||||
|
||||
ret = false;
|
||||
|
||||
pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe;
|
||||
pipe_config->shared_dpll = DPLL_ID_PRIVATE;
|
||||
@ -9982,13 +10004,14 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
|
||||
pipe_config->cpu_transcoder = TRANSCODER_EDP;
|
||||
}
|
||||
|
||||
if (!intel_display_power_is_enabled(dev_priv,
|
||||
POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
|
||||
return false;
|
||||
power_domain = POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder);
|
||||
if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
|
||||
goto out;
|
||||
power_domain_mask |= BIT(power_domain);
|
||||
|
||||
tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
|
||||
if (!(tmp & PIPECONF_ENABLE))
|
||||
return false;
|
||||
goto out;
|
||||
|
||||
haswell_get_ddi_port_state(crtc, pipe_config);
|
||||
|
||||
@ -9998,14 +10021,14 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
|
||||
skl_init_scalers(dev, crtc, pipe_config);
|
||||
}
|
||||
|
||||
pfit_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
|
||||
|
||||
if (INTEL_INFO(dev)->gen >= 9) {
|
||||
pipe_config->scaler_state.scaler_id = -1;
|
||||
pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX);
|
||||
}
|
||||
|
||||
if (intel_display_power_is_enabled(dev_priv, pfit_domain)) {
|
||||
power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
|
||||
if (intel_display_power_get_if_enabled(dev_priv, power_domain)) {
|
||||
power_domain_mask |= BIT(power_domain);
|
||||
if (INTEL_INFO(dev)->gen >= 9)
|
||||
skylake_get_pfit_config(crtc, pipe_config);
|
||||
else
|
||||
@ -10023,7 +10046,13 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
|
||||
pipe_config->pixel_multiplier = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
ret = true;
|
||||
|
||||
out:
|
||||
for_each_power_domain(power_domain, power_domain_mask)
|
||||
intel_display_power_put(dev_priv, power_domain);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void i845_update_cursor(struct drm_crtc *crtc, u32 base, bool on)
|
||||
|
Loading…
Reference in New Issue
Block a user