|
@@ -1035,9 +1035,8 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
|
|
|
return crtc->config->cpu_transcoder;
|
|
|
}
|
|
|
|
|
|
-static bool pipe_dsl_stopped(struct drm_device *dev, enum pipe pipe)
|
|
|
+static bool pipe_dsl_stopped(struct drm_i915_private *dev_priv, enum pipe pipe)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
i915_reg_t reg = PIPEDSL(pipe);
|
|
|
u32 line1, line2;
|
|
|
u32 line_mask;
|
|
@@ -1072,12 +1071,11 @@ static bool pipe_dsl_stopped(struct drm_device *dev, enum pipe pipe)
|
|
|
*/
|
|
|
static void intel_wait_for_pipe_off(struct intel_crtc *crtc)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
|
|
|
enum pipe pipe = crtc->pipe;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
i915_reg_t reg = PIPECONF(cpu_transcoder);
|
|
|
|
|
|
/* Wait for the Pipe State to go off */
|
|
@@ -1087,7 +1085,7 @@ static void intel_wait_for_pipe_off(struct intel_crtc *crtc)
|
|
|
WARN(1, "pipe_off wait timed out\n");
|
|
|
} else {
|
|
|
/* Wait for the display line to settle */
|
|
|
- if (wait_for(pipe_dsl_stopped(dev, pipe), 100))
|
|
|
+ if (wait_for(pipe_dsl_stopped(dev_priv, pipe), 100))
|
|
|
WARN(1, "pipe_off wait timed out\n");
|
|
|
}
|
|
|
}
|
|
@@ -1293,11 +1291,10 @@ static void assert_plane(struct drm_i915_private *dev_priv,
|
|
|
static void assert_planes_disabled(struct drm_i915_private *dev_priv,
|
|
|
enum pipe pipe)
|
|
|
{
|
|
|
- struct drm_device *dev = &dev_priv->drm;
|
|
|
int i;
|
|
|
|
|
|
/* Primary planes are fixed to pipes on gen4+ */
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
u32 val = I915_READ(DSPCNTR(pipe));
|
|
|
I915_STATE_WARN(val & DISPLAY_PLANE_ENABLE,
|
|
|
"plane %c assertion failure, should be disabled but not\n",
|
|
@@ -1319,10 +1316,9 @@ static void assert_planes_disabled(struct drm_i915_private *dev_priv,
|
|
|
static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
|
|
|
enum pipe pipe)
|
|
|
{
|
|
|
- struct drm_device *dev = &dev_priv->drm;
|
|
|
int sprite;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 9) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9) {
|
|
|
for_each_sprite(dev_priv, pipe, sprite) {
|
|
|
u32 val = I915_READ(PLANE_CTL(pipe, sprite));
|
|
|
I915_STATE_WARN(val & PLANE_CTL_ENABLE,
|
|
@@ -1336,12 +1332,12 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
|
|
|
"sprite %c assertion failure, should be off on pipe %c but is still active\n",
|
|
|
sprite_name(pipe, sprite), pipe_name(pipe));
|
|
|
}
|
|
|
- } else if (INTEL_INFO(dev)->gen >= 7) {
|
|
|
+ } else if (INTEL_GEN(dev_priv) >= 7) {
|
|
|
u32 val = I915_READ(SPRCTL(pipe));
|
|
|
I915_STATE_WARN(val & SPRITE_ENABLE,
|
|
|
"sprite %c assertion failure, should be off on pipe %c but is still active\n",
|
|
|
plane_name(pipe), pipe_name(pipe));
|
|
|
- } else if (INTEL_INFO(dev)->gen >= 5) {
|
|
|
+ } else if (INTEL_GEN(dev_priv) >= 5) {
|
|
|
u32 val = I915_READ(DVSCNTR(pipe));
|
|
|
I915_STATE_WARN(val & DVS_ENABLE,
|
|
|
"sprite %c assertion failure, should be off on pipe %c but is still active\n",
|
|
@@ -1595,12 +1591,12 @@ static void chv_enable_pll(struct intel_crtc *crtc,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static int intel_num_dvo_pipes(struct drm_device *dev)
|
|
|
+static int intel_num_dvo_pipes(struct drm_i915_private *dev_priv)
|
|
|
{
|
|
|
struct intel_crtc *crtc;
|
|
|
int count = 0;
|
|
|
|
|
|
- for_each_intel_crtc(dev, crtc) {
|
|
|
+ for_each_intel_crtc(&dev_priv->drm, crtc) {
|
|
|
count += crtc->base.state->active &&
|
|
|
intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DVO);
|
|
|
}
|
|
@@ -1610,8 +1606,7 @@ static int intel_num_dvo_pipes(struct drm_device *dev)
|
|
|
|
|
|
static void i9xx_enable_pll(struct intel_crtc *crtc)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
i915_reg_t reg = DPLL(crtc->pipe);
|
|
|
u32 dpll = crtc->config->dpll_hw_state.dpll;
|
|
|
|
|
@@ -1622,7 +1617,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
|
|
|
assert_panel_unlocked(dev_priv, crtc->pipe);
|
|
|
|
|
|
/* Enable DVO 2x clock on both PLLs if necessary */
|
|
|
- if (IS_I830(dev_priv) && intel_num_dvo_pipes(dev) > 0) {
|
|
|
+ if (IS_I830(dev_priv) && intel_num_dvo_pipes(dev_priv) > 0) {
|
|
|
/*
|
|
|
* It appears to be important that we don't enable this
|
|
|
* for the current pipe before otherwise configuring the
|
|
@@ -1647,7 +1642,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
|
|
|
POSTING_READ(reg);
|
|
|
udelay(150);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
I915_WRITE(DPLL_MD(crtc->pipe),
|
|
|
crtc->config->dpll_hw_state.dpll_md);
|
|
|
} else {
|
|
@@ -1682,14 +1677,13 @@ static void i9xx_enable_pll(struct intel_crtc *crtc)
|
|
|
*/
|
|
|
static void i9xx_disable_pll(struct intel_crtc *crtc)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
enum pipe pipe = crtc->pipe;
|
|
|
|
|
|
/* Disable DVO 2x clock on both PLLs if necessary */
|
|
|
if (IS_I830(dev_priv) &&
|
|
|
intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DVO) &&
|
|
|
- !intel_num_dvo_pipes(dev)) {
|
|
|
+ !intel_num_dvo_pipes(dev_priv)) {
|
|
|
I915_WRITE(DPLL(PIPE_B),
|
|
|
I915_READ(DPLL(PIPE_B)) & ~DPLL_DVO_2X_MODE);
|
|
|
I915_WRITE(DPLL(PIPE_A),
|
|
@@ -3004,11 +2998,9 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
|
|
|
const struct intel_crtc_state *crtc_state,
|
|
|
const struct intel_plane_state *plane_state)
|
|
|
{
|
|
|
- struct drm_device *dev = primary->dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(primary->dev);
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
|
|
|
struct drm_framebuffer *fb = plane_state->base.fb;
|
|
|
- struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
|
|
int plane = intel_crtc->plane;
|
|
|
u32 linear_offset;
|
|
|
u32 dspcntr;
|
|
@@ -3021,7 +3013,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
|
|
|
|
|
|
dspcntr |= DISPLAY_PLANE_ENABLE;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen < 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 4) {
|
|
|
if (intel_crtc->pipe == PIPE_B)
|
|
|
dspcntr |= DISPPLANE_SEL_PIPE_B;
|
|
|
|
|
@@ -3070,25 +3062,31 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
|
|
|
fb->modifier[0] == I915_FORMAT_MOD_X_TILED)
|
|
|
dspcntr |= DISPPLANE_TILED;
|
|
|
|
|
|
+ if (rotation & DRM_ROTATE_180)
|
|
|
+ dspcntr |= DISPPLANE_ROTATE_180;
|
|
|
+
|
|
|
+ if (rotation & DRM_REFLECT_X)
|
|
|
+ dspcntr |= DISPPLANE_MIRROR;
|
|
|
+
|
|
|
if (IS_G4X(dev_priv))
|
|
|
dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
|
|
|
|
|
|
intel_add_fb_offsets(&x, &y, plane_state, 0);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 4)
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4)
|
|
|
intel_crtc->dspaddr_offset =
|
|
|
intel_compute_tile_offset(&x, &y, plane_state, 0);
|
|
|
|
|
|
- if (rotation == DRM_ROTATE_180) {
|
|
|
- dspcntr |= DISPPLANE_ROTATE_180;
|
|
|
-
|
|
|
- x += (crtc_state->pipe_src_w - 1);
|
|
|
- y += (crtc_state->pipe_src_h - 1);
|
|
|
+ if (rotation & DRM_ROTATE_180) {
|
|
|
+ x += crtc_state->pipe_src_w - 1;
|
|
|
+ y += crtc_state->pipe_src_h - 1;
|
|
|
+ } else if (rotation & DRM_REFLECT_X) {
|
|
|
+ x += crtc_state->pipe_src_w - 1;
|
|
|
}
|
|
|
|
|
|
linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen < 4)
|
|
|
+ if (INTEL_GEN(dev_priv) < 4)
|
|
|
intel_crtc->dspaddr_offset = linear_offset;
|
|
|
|
|
|
intel_crtc->adjusted_x = x;
|
|
@@ -3097,14 +3095,17 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
|
|
|
I915_WRITE(reg, dspcntr);
|
|
|
|
|
|
I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]);
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
I915_WRITE(DSPSURF(plane),
|
|
|
intel_fb_gtt_offset(fb, rotation) +
|
|
|
intel_crtc->dspaddr_offset);
|
|
|
I915_WRITE(DSPTILEOFF(plane), (y << 16) | x);
|
|
|
I915_WRITE(DSPLINOFF(plane), linear_offset);
|
|
|
- } else
|
|
|
- I915_WRITE(DSPADDR(plane), i915_gem_object_ggtt_offset(obj, NULL) + linear_offset);
|
|
|
+ } else {
|
|
|
+ I915_WRITE(DSPADDR(plane),
|
|
|
+ intel_fb_gtt_offset(fb, rotation) +
|
|
|
+ intel_crtc->dspaddr_offset);
|
|
|
+ }
|
|
|
POSTING_READ(reg);
|
|
|
}
|
|
|
|
|
@@ -3172,6 +3173,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
|
|
|
if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED)
|
|
|
dspcntr |= DISPPLANE_TILED;
|
|
|
|
|
|
+ if (rotation & DRM_ROTATE_180)
|
|
|
+ dspcntr |= DISPPLANE_ROTATE_180;
|
|
|
+
|
|
|
if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv))
|
|
|
dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
|
|
|
|
|
@@ -3180,13 +3184,11 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
|
|
|
intel_crtc->dspaddr_offset =
|
|
|
intel_compute_tile_offset(&x, &y, plane_state, 0);
|
|
|
|
|
|
- if (rotation == DRM_ROTATE_180) {
|
|
|
- dspcntr |= DISPPLANE_ROTATE_180;
|
|
|
-
|
|
|
- if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) {
|
|
|
- x += (crtc_state->pipe_src_w - 1);
|
|
|
- y += (crtc_state->pipe_src_h - 1);
|
|
|
- }
|
|
|
+ /* HSW+ does this automagically in hardware */
|
|
|
+ if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv) &&
|
|
|
+ rotation & DRM_ROTATE_180) {
|
|
|
+ x += crtc_state->pipe_src_w - 1;
|
|
|
+ y += crtc_state->pipe_src_h - 1;
|
|
|
}
|
|
|
|
|
|
linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
|
|
@@ -3376,9 +3378,6 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
|
|
|
struct drm_framebuffer *fb = plane_state->base.fb;
|
|
|
- const struct skl_wm_values *wm = &dev_priv->wm.skl_results;
|
|
|
- const struct skl_plane_wm *p_wm =
|
|
|
- &crtc_state->wm.skl.optimal.planes[0];
|
|
|
int pipe = intel_crtc->pipe;
|
|
|
u32 plane_ctl;
|
|
|
unsigned int rotation = plane_state->base.rotation;
|
|
@@ -3414,9 +3413,6 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
|
|
|
intel_crtc->adjusted_x = src_x;
|
|
|
intel_crtc->adjusted_y = src_y;
|
|
|
|
|
|
- if (wm->dirty_pipes & drm_crtc_mask(&intel_crtc->base))
|
|
|
- skl_write_plane_wm(intel_crtc, p_wm, &wm->ddb, 0);
|
|
|
-
|
|
|
I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl);
|
|
|
I915_WRITE(PLANE_OFFSET(pipe, 0), (src_y << 16) | src_x);
|
|
|
I915_WRITE(PLANE_STRIDE(pipe, 0), stride);
|
|
@@ -3449,18 +3445,8 @@ static void skylake_disable_primary_plane(struct drm_plane *primary,
|
|
|
struct drm_device *dev = crtc->dev;
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
- struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
|
|
|
- const struct skl_plane_wm *p_wm = &cstate->wm.skl.optimal.planes[0];
|
|
|
int pipe = intel_crtc->pipe;
|
|
|
|
|
|
- /*
|
|
|
- * We only populate skl_results on watermark updates, and if the
|
|
|
- * plane's visiblity isn't actually changing neither is its watermarks.
|
|
|
- */
|
|
|
- if (!crtc->primary->state->visible)
|
|
|
- skl_write_plane_wm(intel_crtc, p_wm,
|
|
|
- &dev_priv->wm.skl_results.ddb, 0);
|
|
|
-
|
|
|
I915_WRITE(PLANE_CTL(pipe, 0), 0);
|
|
|
I915_WRITE(PLANE_SURF(pipe, 0), 0);
|
|
|
POSTING_READ(PLANE_SURF(pipe, 0));
|
|
@@ -3510,7 +3496,7 @@ __intel_display_resume(struct drm_device *dev,
|
|
|
int i, ret;
|
|
|
|
|
|
intel_modeset_setup_hw_state(dev);
|
|
|
- i915_redisable_vga(dev);
|
|
|
+ i915_redisable_vga(to_i915(dev));
|
|
|
|
|
|
if (!state)
|
|
|
return 0;
|
|
@@ -3687,8 +3673,7 @@ static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
|
|
|
static void intel_update_pipe_config(struct intel_crtc *crtc,
|
|
|
struct intel_crtc_state *old_crtc_state)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
struct intel_crtc_state *pipe_config =
|
|
|
to_intel_crtc_state(crtc->base.state);
|
|
|
|
|
@@ -3713,7 +3698,7 @@ static void intel_update_pipe_config(struct intel_crtc *crtc,
|
|
|
(pipe_config->pipe_src_h - 1));
|
|
|
|
|
|
/* on skylake this is done by detaching scalers */
|
|
|
- if (INTEL_INFO(dev)->gen >= 9) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9) {
|
|
|
skl_detach_scalers(crtc);
|
|
|
|
|
|
if (pipe_config->pch_pfit.enabled)
|
|
@@ -4734,13 +4719,8 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
|
|
|
*/
|
|
|
int skl_update_scaler_crtc(struct intel_crtc_state *state)
|
|
|
{
|
|
|
- struct intel_crtc *intel_crtc = to_intel_crtc(state->base.crtc);
|
|
|
const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode;
|
|
|
|
|
|
- DRM_DEBUG_KMS("Updating scaler for [CRTC:%d:%s] scaler_user index %u.%u\n",
|
|
|
- intel_crtc->base.base.id, intel_crtc->base.name,
|
|
|
- intel_crtc->pipe, SKL_CRTC_INDEX);
|
|
|
-
|
|
|
return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
|
|
|
&state->scaler_state.scaler_id, DRM_ROTATE_0,
|
|
|
state->pipe_src_w, state->pipe_src_h,
|
|
@@ -4761,7 +4741,6 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
|
|
|
struct intel_plane_state *plane_state)
|
|
|
{
|
|
|
|
|
|
- struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
|
|
|
struct intel_plane *intel_plane =
|
|
|
to_intel_plane(plane_state->base.plane);
|
|
|
struct drm_framebuffer *fb = plane_state->base.fb;
|
|
@@ -4769,10 +4748,6 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
|
|
|
|
|
|
bool force_detach = !fb || !plane_state->base.visible;
|
|
|
|
|
|
- DRM_DEBUG_KMS("Updating scaler for [PLANE:%d:%s] scaler_user index %u.%u\n",
|
|
|
- intel_plane->base.base.id, intel_plane->base.name,
|
|
|
- intel_crtc->pipe, drm_plane_index(&intel_plane->base));
|
|
|
-
|
|
|
ret = skl_update_scaler(crtc_state, force_detach,
|
|
|
drm_plane_index(&intel_plane->base),
|
|
|
&plane_state->scaler_id,
|
|
@@ -5096,6 +5071,8 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state)
|
|
|
struct drm_plane_state *old_pri_state =
|
|
|
drm_atomic_get_existing_plane_state(old_state, primary);
|
|
|
bool modeset = needs_modeset(&pipe_config->base);
|
|
|
+ struct intel_atomic_state *old_intel_state =
|
|
|
+ to_intel_atomic_state(old_state);
|
|
|
|
|
|
if (old_pri_state) {
|
|
|
struct intel_plane_state *primary_state =
|
|
@@ -5163,7 +5140,8 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state)
|
|
|
* us to.
|
|
|
*/
|
|
|
if (dev_priv->display.initial_watermarks != NULL)
|
|
|
- dev_priv->display.initial_watermarks(pipe_config);
|
|
|
+ dev_priv->display.initial_watermarks(old_intel_state,
|
|
|
+ pipe_config);
|
|
|
else if (pipe_config->update_wm_pre)
|
|
|
intel_update_watermarks(crtc);
|
|
|
}
|
|
@@ -5319,6 +5297,8 @@ static void ironlake_crtc_enable(struct intel_crtc_state *pipe_config,
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
int pipe = intel_crtc->pipe;
|
|
|
+ struct intel_atomic_state *old_intel_state =
|
|
|
+ to_intel_atomic_state(old_state);
|
|
|
|
|
|
if (WARN_ON(intel_crtc->active))
|
|
|
return;
|
|
@@ -5377,7 +5357,7 @@ static void ironlake_crtc_enable(struct intel_crtc_state *pipe_config,
|
|
|
intel_color_load_luts(&pipe_config->base);
|
|
|
|
|
|
if (dev_priv->display.initial_watermarks != NULL)
|
|
|
- dev_priv->display.initial_watermarks(intel_crtc->config);
|
|
|
+ dev_priv->display.initial_watermarks(old_intel_state, intel_crtc->config);
|
|
|
intel_enable_pipe(intel_crtc);
|
|
|
|
|
|
if (intel_crtc->config->has_pch_encoder)
|
|
@@ -5408,11 +5388,12 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
|
|
|
struct drm_atomic_state *old_state)
|
|
|
{
|
|
|
struct drm_crtc *crtc = pipe_config->base.crtc;
|
|
|
- struct drm_device *dev = crtc->dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->dev);
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
int pipe = intel_crtc->pipe, hsw_workaround_pipe;
|
|
|
enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
|
|
|
+ struct intel_atomic_state *old_intel_state =
|
|
|
+ to_intel_atomic_state(old_state);
|
|
|
|
|
|
if (WARN_ON(intel_crtc->active))
|
|
|
return;
|
|
@@ -5467,7 +5448,7 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
|
|
|
if (!transcoder_is_dsi(cpu_transcoder))
|
|
|
intel_ddi_enable_pipe_clock(intel_crtc);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 9)
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9)
|
|
|
skylake_pfit_enable(intel_crtc);
|
|
|
else
|
|
|
ironlake_pfit_enable(intel_crtc);
|
|
@@ -5483,7 +5464,8 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
|
|
|
intel_ddi_enable_transcoder_func(crtc);
|
|
|
|
|
|
if (dev_priv->display.initial_watermarks != NULL)
|
|
|
- dev_priv->display.initial_watermarks(pipe_config);
|
|
|
+ dev_priv->display.initial_watermarks(old_intel_state,
|
|
|
+ pipe_config);
|
|
|
else
|
|
|
intel_update_watermarks(intel_crtc);
|
|
|
|
|
@@ -5494,7 +5476,7 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
|
|
|
if (intel_crtc->config->has_pch_encoder)
|
|
|
lpt_pch_enable(crtc);
|
|
|
|
|
|
- if (intel_crtc->config->dp_encoder_is_mst)
|
|
|
+ if (intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_DP_MST))
|
|
|
intel_ddi_set_vc_payload_alloc(crtc, true);
|
|
|
|
|
|
assert_vblank_disabled(crtc);
|
|
@@ -5599,8 +5581,7 @@ static void haswell_crtc_disable(struct intel_crtc_state *old_crtc_state,
|
|
|
struct drm_atomic_state *old_state)
|
|
|
{
|
|
|
struct drm_crtc *crtc = old_crtc_state->base.crtc;
|
|
|
- struct drm_device *dev = crtc->dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->dev);
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
|
|
|
|
|
@@ -5617,13 +5598,13 @@ static void haswell_crtc_disable(struct intel_crtc_state *old_crtc_state,
|
|
|
if (!transcoder_is_dsi(cpu_transcoder))
|
|
|
intel_disable_pipe(intel_crtc);
|
|
|
|
|
|
- if (intel_crtc->config->dp_encoder_is_mst)
|
|
|
+ if (intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_DP_MST))
|
|
|
intel_ddi_set_vc_payload_alloc(crtc, false);
|
|
|
|
|
|
if (!transcoder_is_dsi(cpu_transcoder))
|
|
|
intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 9)
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9)
|
|
|
skylake_scaler_disable(intel_crtc);
|
|
|
else
|
|
|
ironlake_pfit_disable(intel_crtc, false);
|
|
@@ -7051,7 +7032,7 @@ static int ironlake_check_fdi_lanes(struct drm_device *dev, enum pipe pipe,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (INTEL_INFO(dev)->num_pipes == 2)
|
|
|
+ if (INTEL_INFO(dev_priv)->num_pipes == 2)
|
|
|
return 0;
|
|
|
|
|
|
/* Ivybridge 3 pipe is really complicated */
|
|
@@ -7192,7 +7173,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
|
|
|
const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
|
|
|
int clock_limit = dev_priv->max_dotclk_freq;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen < 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 4) {
|
|
|
clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
|
|
|
|
|
|
/*
|
|
@@ -7786,12 +7767,11 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
|
|
|
struct intel_link_m_n *m_n,
|
|
|
struct intel_link_m_n *m2_n2)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
int pipe = crtc->pipe;
|
|
|
enum transcoder transcoder = crtc->config->cpu_transcoder;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 5) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 5) {
|
|
|
I915_WRITE(PIPE_DATA_M1(transcoder), TU_SIZE(m_n->tu) | m_n->gmch_m);
|
|
|
I915_WRITE(PIPE_DATA_N1(transcoder), m_n->gmch_n);
|
|
|
I915_WRITE(PIPE_LINK_M1(transcoder), m_n->link_m);
|
|
@@ -8245,8 +8225,7 @@ static void i8xx_compute_dpll(struct intel_crtc *crtc,
|
|
|
|
|
|
static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
|
|
|
{
|
|
|
- struct drm_device *dev = intel_crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
|
|
|
enum pipe pipe = intel_crtc->pipe;
|
|
|
enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
|
|
|
const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
|
|
@@ -8272,7 +8251,7 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
|
|
|
vsyncshift += adjusted_mode->crtc_htotal;
|
|
|
}
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen > 3)
|
|
|
+ if (INTEL_GEN(dev_priv) > 3)
|
|
|
I915_WRITE(VSYNCSHIFT(cpu_transcoder), vsyncshift);
|
|
|
|
|
|
I915_WRITE(HTOTAL(cpu_transcoder),
|
|
@@ -8395,8 +8374,7 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
|
|
|
|
|
|
static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
|
|
|
{
|
|
|
- struct drm_device *dev = intel_crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
|
|
|
uint32_t pipeconf;
|
|
|
|
|
|
pipeconf = 0;
|
|
@@ -8432,7 +8410,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (HAS_PIPE_CXSR(dev)) {
|
|
|
+ if (HAS_PIPE_CXSR(dev_priv)) {
|
|
|
if (intel_crtc->lowfreq_avail) {
|
|
|
DRM_DEBUG_KMS("enabling CxSR downclocking\n");
|
|
|
pipeconf |= PIPECONF_CXSR_DOWNCLOCK;
|
|
@@ -8442,7 +8420,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
|
|
|
}
|
|
|
|
|
|
if (intel_crtc->config->base.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) {
|
|
|
- if (INTEL_INFO(dev)->gen < 4 ||
|
|
|
+ if (INTEL_GEN(dev_priv) < 4 ||
|
|
|
intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_SDVO))
|
|
|
pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION;
|
|
|
else
|
|
@@ -8650,8 +8628,7 @@ static int vlv_crtc_compute_clock(struct intel_crtc *crtc,
|
|
|
static void i9xx_get_pfit_config(struct intel_crtc *crtc,
|
|
|
struct intel_crtc_state *pipe_config)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
uint32_t tmp;
|
|
|
|
|
|
if (INTEL_GEN(dev_priv) <= 3 &&
|
|
@@ -8663,7 +8640,7 @@ static void i9xx_get_pfit_config(struct intel_crtc *crtc,
|
|
|
return;
|
|
|
|
|
|
/* Check whether the pfit is attached to our pipe. */
|
|
|
- if (INTEL_INFO(dev)->gen < 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 4) {
|
|
|
if (crtc->pipe != PIPE_B)
|
|
|
return;
|
|
|
} else {
|
|
@@ -8727,7 +8704,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
|
|
|
|
|
|
fb = &intel_fb->base;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
if (val & DISPPLANE_TILED) {
|
|
|
plane_config->tiling = I915_TILING_X;
|
|
|
fb->modifier[0] = I915_FORMAT_MOD_X_TILED;
|
|
@@ -8739,7 +8716,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
|
|
|
fb->pixel_format = fourcc;
|
|
|
fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
if (plane_config->tiling)
|
|
|
offset = I915_READ(DSPTILEOFF(plane));
|
|
|
else
|
|
@@ -8808,8 +8785,7 @@ static void chv_crtc_clock_get(struct intel_crtc *crtc,
|
|
|
static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
|
|
|
struct intel_crtc_state *pipe_config)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
enum intel_display_power_domain power_domain;
|
|
|
uint32_t tmp;
|
|
|
bool ret;
|
|
@@ -8848,7 +8824,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
|
|
|
(tmp & PIPECONF_COLOR_RANGE_SELECT))
|
|
|
pipe_config->limited_color_range = true;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen < 4)
|
|
|
+ if (INTEL_GEN(dev_priv) < 4)
|
|
|
pipe_config->double_wide = tmp & PIPECONF_DOUBLE_WIDE;
|
|
|
|
|
|
intel_get_pipe_timings(crtc, pipe_config);
|
|
@@ -8856,7 +8832,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
|
|
|
|
|
|
i9xx_get_pfit_config(crtc, pipe_config);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
/* No way to read it out on pipes B and C */
|
|
|
if (IS_CHERRYVIEW(dev_priv) && crtc->pipe != PIPE_A)
|
|
|
tmp = dev_priv->chv_dpll_md[crtc->pipe];
|
|
@@ -9653,11 +9629,10 @@ static void intel_cpu_transcoder_get_m_n(struct intel_crtc *crtc,
|
|
|
struct intel_link_m_n *m_n,
|
|
|
struct intel_link_m_n *m2_n2)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
enum pipe pipe = crtc->pipe;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 5) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 5) {
|
|
|
m_n->link_m = I915_READ(PIPE_LINK_M1(transcoder));
|
|
|
m_n->link_n = I915_READ(PIPE_LINK_N1(transcoder));
|
|
|
m_n->gmch_m = I915_READ(PIPE_DATA_M1(transcoder))
|
|
@@ -9669,7 +9644,7 @@ static void intel_cpu_transcoder_get_m_n(struct intel_crtc *crtc,
|
|
|
* gen < 8) and if DRRS is supported (to make sure the
|
|
|
* registers are not unnecessarily read).
|
|
|
*/
|
|
|
- if (m2_n2 && INTEL_INFO(dev)->gen < 8 &&
|
|
|
+ if (m2_n2 && INTEL_GEN(dev_priv) < 8 &&
|
|
|
crtc->config->has_drrs) {
|
|
|
m2_n2->link_m = I915_READ(PIPE_LINK_M2(transcoder));
|
|
|
m2_n2->link_n = I915_READ(PIPE_LINK_N2(transcoder));
|
|
@@ -9871,7 +9846,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
|
|
|
|
|
|
fb = &intel_fb->base;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
if (val & DISPPLANE_TILED) {
|
|
|
plane_config->tiling = I915_TILING_X;
|
|
|
fb->modifier[0] = I915_FORMAT_MOD_X_TILED;
|
|
@@ -10661,8 +10636,7 @@ static bool bxt_get_dsi_transcoder_state(struct intel_crtc *crtc,
|
|
|
static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
|
|
|
struct intel_crtc_state *pipe_config)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
struct intel_shared_dpll *pll;
|
|
|
enum port port;
|
|
|
uint32_t tmp;
|
|
@@ -10689,7 +10663,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
|
|
|
* DDI E. So just check whether this pipe is wired to DDI E and whether
|
|
|
* the PCH transcoder is on.
|
|
|
*/
|
|
|
- if (INTEL_INFO(dev)->gen < 9 &&
|
|
|
+ if (INTEL_GEN(dev_priv) < 9 &&
|
|
|
(port == PORT_E) && I915_READ(LPT_TRANSCONF) & TRANS_ENABLE) {
|
|
|
pipe_config->has_pch_encoder = true;
|
|
|
|
|
@@ -10704,8 +10678,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
|
|
|
static bool haswell_get_pipe_config(struct intel_crtc *crtc,
|
|
|
struct intel_crtc_state *pipe_config)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
enum intel_display_power_domain power_domain;
|
|
|
unsigned long power_domain_mask;
|
|
|
bool active;
|
|
@@ -10738,7 +10711,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
|
|
|
pipe_config->gamma_mode =
|
|
|
I915_READ(GAMMA_MODE(crtc->pipe)) & GAMMA_MODE_MODE_MASK;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 9) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9) {
|
|
|
skl_init_scalers(dev_priv, crtc, pipe_config);
|
|
|
|
|
|
pipe_config->scaler_state.scaler_id = -1;
|
|
@@ -10748,7 +10721,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
|
|
|
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)
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9)
|
|
|
skylake_get_pfit_config(crtc, pipe_config);
|
|
|
else
|
|
|
ironlake_get_pfit_config(crtc, pipe_config);
|
|
@@ -10842,16 +10815,9 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base,
|
|
|
struct drm_device *dev = crtc->dev;
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
- struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
|
|
|
- const struct skl_wm_values *wm = &dev_priv->wm.skl_results;
|
|
|
- const struct skl_plane_wm *p_wm =
|
|
|
- &cstate->wm.skl.optimal.planes[PLANE_CURSOR];
|
|
|
int pipe = intel_crtc->pipe;
|
|
|
uint32_t cntl = 0;
|
|
|
|
|
|
- if (INTEL_GEN(dev_priv) >= 9 && wm->dirty_pipes & drm_crtc_mask(crtc))
|
|
|
- skl_write_cursor_wm(intel_crtc, p_wm, &wm->ddb);
|
|
|
-
|
|
|
if (plane_state && plane_state->base.visible) {
|
|
|
cntl = MCURSOR_GAMMA_ENABLE;
|
|
|
switch (plane_state->base.crtc_w) {
|
|
@@ -10873,7 +10839,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base,
|
|
|
if (HAS_DDI(dev_priv))
|
|
|
cntl |= CURSOR_PIPE_CSC_ENABLE;
|
|
|
|
|
|
- if (plane_state->base.rotation == DRM_ROTATE_180)
|
|
|
+ if (plane_state->base.rotation & DRM_ROTATE_180)
|
|
|
cntl |= CURSOR_ROTATE_180;
|
|
|
}
|
|
|
|
|
@@ -10919,7 +10885,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
|
|
|
|
|
|
/* ILK+ do this automagically */
|
|
|
if (HAS_GMCH_DISPLAY(dev_priv) &&
|
|
|
- plane_state->base.rotation == DRM_ROTATE_180) {
|
|
|
+ plane_state->base.rotation & DRM_ROTATE_180) {
|
|
|
base += (plane_state->base.crtc_h *
|
|
|
plane_state->base.crtc_w - 1) * 4;
|
|
|
}
|
|
@@ -12062,6 +12028,7 @@ static void intel_mmio_flip_work_func(struct work_struct *w)
|
|
|
to_intel_framebuffer(crtc->base.primary->fb);
|
|
|
struct drm_i915_gem_object *obj = intel_fb->obj;
|
|
|
|
|
|
+ i915_gem_object_wait_priority(obj, 0, I915_PRIORITY_DISPLAY);
|
|
|
WARN_ON(i915_gem_object_wait(obj, 0, MAX_SCHEDULE_TIMEOUT, NULL) < 0);
|
|
|
|
|
|
intel_pipe_update_start(crtc);
|
|
@@ -12186,7 +12153,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
|
|
|
* TILEOFF/LINOFF registers can't be changed via MI display flips.
|
|
|
* Note that pitch changes could also affect these register.
|
|
|
*/
|
|
|
- if (INTEL_INFO(dev)->gen > 3 &&
|
|
|
+ if (INTEL_GEN(dev_priv) > 3 &&
|
|
|
(fb->offsets[0] != crtc->primary->fb->offsets[0] ||
|
|
|
fb->pitches[0] != crtc->primary->fb->pitches[0]))
|
|
|
return -EINVAL;
|
|
@@ -12261,7 +12228,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
|
|
|
engine = NULL;
|
|
|
} else if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) {
|
|
|
engine = dev_priv->engine[BCS];
|
|
|
- } else if (INTEL_INFO(dev)->gen >= 7) {
|
|
|
+ } else if (INTEL_GEN(dev_priv) >= 7) {
|
|
|
engine = i915_gem_object_last_write_engine(obj);
|
|
|
if (engine == NULL || engine->id != RCS)
|
|
|
engine = dev_priv->engine[BCS];
|
|
@@ -12518,7 +12485,7 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
|
|
|
|
|
|
/* Pre-gen9 platforms need two-step watermark updates */
|
|
|
if ((pipe_config->update_wm_pre || pipe_config->update_wm_post) &&
|
|
|
- INTEL_INFO(dev)->gen < 9 && dev_priv->display.optimize_watermarks)
|
|
|
+ INTEL_GEN(dev_priv) < 9 && dev_priv->display.optimize_watermarks)
|
|
|
to_intel_crtc_state(crtc_state)->wm.need_postvbl_update = true;
|
|
|
|
|
|
if (visible || was_visible)
|
|
@@ -12623,7 +12590,7 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
|
|
|
* old state and the new state. We can program these
|
|
|
* immediately.
|
|
|
*/
|
|
|
- ret = dev_priv->display.compute_intermediate_wm(crtc->dev,
|
|
|
+ ret = dev_priv->display.compute_intermediate_wm(dev,
|
|
|
intel_crtc,
|
|
|
pipe_config);
|
|
|
if (ret) {
|
|
@@ -12635,7 +12602,7 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
|
|
|
pipe_config->wm.ilk.intermediate = pipe_config->wm.ilk.optimal;
|
|
|
}
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen >= 9) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9) {
|
|
|
if (mode_changed)
|
|
|
ret = skl_update_scaler_crtc(pipe_config);
|
|
|
|
|
@@ -12748,6 +12715,16 @@ static void intel_dump_crtc_timings(const struct drm_display_mode *mode)
|
|
|
mode->crtc_vsync_end, mode->crtc_vtotal, mode->type, mode->flags);
|
|
|
}
|
|
|
|
|
|
+static inline void
|
|
|
+intel_dump_m_n_config(struct intel_crtc_state *pipe_config, char *id,
|
|
|
+ unsigned int lane_count, struct intel_link_m_n *m_n)
|
|
|
+{
|
|
|
+ DRM_DEBUG_KMS("%s: lanes: %i; gmch_m: %u, gmch_n: %u, link_m: %u, link_n: %u, tu: %u\n",
|
|
|
+ id, lane_count,
|
|
|
+ m_n->gmch_m, m_n->gmch_n,
|
|
|
+ m_n->link_m, m_n->link_n, m_n->tu);
|
|
|
+}
|
|
|
+
|
|
|
static void intel_dump_pipe_config(struct intel_crtc *crtc,
|
|
|
struct intel_crtc_state *pipe_config,
|
|
|
const char *context)
|
|
@@ -12759,61 +12736,58 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
|
|
|
struct intel_plane_state *state;
|
|
|
struct drm_framebuffer *fb;
|
|
|
|
|
|
- DRM_DEBUG_KMS("[CRTC:%d:%s]%s config %p for pipe %c\n",
|
|
|
- crtc->base.base.id, crtc->base.name,
|
|
|
- context, pipe_config, pipe_name(crtc->pipe));
|
|
|
+ DRM_DEBUG_KMS("[CRTC:%d:%s]%s\n",
|
|
|
+ crtc->base.base.id, crtc->base.name, context);
|
|
|
|
|
|
- DRM_DEBUG_KMS("cpu_transcoder: %s\n", transcoder_name(pipe_config->cpu_transcoder));
|
|
|
- DRM_DEBUG_KMS("pipe bpp: %i, dithering: %i\n",
|
|
|
+ DRM_DEBUG_KMS("cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
|
|
|
+ transcoder_name(pipe_config->cpu_transcoder),
|
|
|
pipe_config->pipe_bpp, pipe_config->dither);
|
|
|
- DRM_DEBUG_KMS("fdi/pch: %i, lanes: %i, gmch_m: %u, gmch_n: %u, link_m: %u, link_n: %u, tu: %u\n",
|
|
|
- pipe_config->has_pch_encoder,
|
|
|
- pipe_config->fdi_lanes,
|
|
|
- pipe_config->fdi_m_n.gmch_m, pipe_config->fdi_m_n.gmch_n,
|
|
|
- pipe_config->fdi_m_n.link_m, pipe_config->fdi_m_n.link_n,
|
|
|
- pipe_config->fdi_m_n.tu);
|
|
|
- DRM_DEBUG_KMS("dp: %i, lanes: %i, gmch_m: %u, gmch_n: %u, link_m: %u, link_n: %u, tu: %u\n",
|
|
|
- intel_crtc_has_dp_encoder(pipe_config),
|
|
|
- pipe_config->lane_count,
|
|
|
- pipe_config->dp_m_n.gmch_m, pipe_config->dp_m_n.gmch_n,
|
|
|
- pipe_config->dp_m_n.link_m, pipe_config->dp_m_n.link_n,
|
|
|
- pipe_config->dp_m_n.tu);
|
|
|
-
|
|
|
- DRM_DEBUG_KMS("dp: %i, lanes: %i, gmch_m2: %u, gmch_n2: %u, link_m2: %u, link_n2: %u, tu2: %u\n",
|
|
|
- intel_crtc_has_dp_encoder(pipe_config),
|
|
|
- pipe_config->lane_count,
|
|
|
- pipe_config->dp_m2_n2.gmch_m,
|
|
|
- pipe_config->dp_m2_n2.gmch_n,
|
|
|
- pipe_config->dp_m2_n2.link_m,
|
|
|
- pipe_config->dp_m2_n2.link_n,
|
|
|
- pipe_config->dp_m2_n2.tu);
|
|
|
+
|
|
|
+ if (pipe_config->has_pch_encoder)
|
|
|
+ intel_dump_m_n_config(pipe_config, "fdi",
|
|
|
+ pipe_config->fdi_lanes,
|
|
|
+ &pipe_config->fdi_m_n);
|
|
|
+
|
|
|
+ if (intel_crtc_has_dp_encoder(pipe_config)) {
|
|
|
+ intel_dump_m_n_config(pipe_config, "dp m_n",
|
|
|
+ pipe_config->lane_count, &pipe_config->dp_m_n);
|
|
|
+ if (pipe_config->has_drrs)
|
|
|
+ intel_dump_m_n_config(pipe_config, "dp m2_n2",
|
|
|
+ pipe_config->lane_count,
|
|
|
+ &pipe_config->dp_m2_n2);
|
|
|
+ }
|
|
|
|
|
|
DRM_DEBUG_KMS("audio: %i, infoframes: %i\n",
|
|
|
- pipe_config->has_audio,
|
|
|
- pipe_config->has_infoframe);
|
|
|
+ pipe_config->has_audio, pipe_config->has_infoframe);
|
|
|
|
|
|
DRM_DEBUG_KMS("requested mode:\n");
|
|
|
drm_mode_debug_printmodeline(&pipe_config->base.mode);
|
|
|
DRM_DEBUG_KMS("adjusted mode:\n");
|
|
|
drm_mode_debug_printmodeline(&pipe_config->base.adjusted_mode);
|
|
|
intel_dump_crtc_timings(&pipe_config->base.adjusted_mode);
|
|
|
- DRM_DEBUG_KMS("port clock: %d\n", pipe_config->port_clock);
|
|
|
- DRM_DEBUG_KMS("pipe src size: %dx%d\n",
|
|
|
+ DRM_DEBUG_KMS("port clock: %d, pipe src size: %dx%d\n",
|
|
|
+ pipe_config->port_clock,
|
|
|
pipe_config->pipe_src_w, pipe_config->pipe_src_h);
|
|
|
- DRM_DEBUG_KMS("num_scalers: %d, scaler_users: 0x%x, scaler_id: %d\n",
|
|
|
- crtc->num_scalers,
|
|
|
- pipe_config->scaler_state.scaler_users,
|
|
|
- pipe_config->scaler_state.scaler_id);
|
|
|
- DRM_DEBUG_KMS("gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n",
|
|
|
- pipe_config->gmch_pfit.control,
|
|
|
- pipe_config->gmch_pfit.pgm_ratios,
|
|
|
- pipe_config->gmch_pfit.lvds_border_bits);
|
|
|
- DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x, %s\n",
|
|
|
- pipe_config->pch_pfit.pos,
|
|
|
- pipe_config->pch_pfit.size,
|
|
|
- pipe_config->pch_pfit.enabled ? "enabled" : "disabled");
|
|
|
- DRM_DEBUG_KMS("ips: %i\n", pipe_config->ips_enabled);
|
|
|
- DRM_DEBUG_KMS("double wide: %i\n", pipe_config->double_wide);
|
|
|
+
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9)
|
|
|
+ DRM_DEBUG_KMS("num_scalers: %d, scaler_users: 0x%x, scaler_id: %d\n",
|
|
|
+ crtc->num_scalers,
|
|
|
+ pipe_config->scaler_state.scaler_users,
|
|
|
+ pipe_config->scaler_state.scaler_id);
|
|
|
+
|
|
|
+ if (HAS_GMCH_DISPLAY(dev_priv))
|
|
|
+ DRM_DEBUG_KMS("gmch pfit: control: 0x%08x, ratios: 0x%08x, lvds border: 0x%08x\n",
|
|
|
+ pipe_config->gmch_pfit.control,
|
|
|
+ pipe_config->gmch_pfit.pgm_ratios,
|
|
|
+ pipe_config->gmch_pfit.lvds_border_bits);
|
|
|
+ else
|
|
|
+ DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x, %s\n",
|
|
|
+ pipe_config->pch_pfit.pos,
|
|
|
+ pipe_config->pch_pfit.size,
|
|
|
+ enableddisabled(pipe_config->pch_pfit.enabled));
|
|
|
+
|
|
|
+ DRM_DEBUG_KMS("ips: %i, double wide: %i\n",
|
|
|
+ pipe_config->ips_enabled, pipe_config->double_wide);
|
|
|
|
|
|
if (IS_BROXTON(dev_priv)) {
|
|
|
DRM_DEBUG_KMS("dpll_hw_state: ebb0: 0x%x, ebb4: 0x%x,"
|
|
@@ -12864,20 +12838,20 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- DRM_DEBUG_KMS("[PLANE:%d:%s] enabled",
|
|
|
- plane->base.id, plane->name);
|
|
|
- DRM_DEBUG_KMS("\tFB:%d, fb = %ux%u format = %s",
|
|
|
+ DRM_DEBUG_KMS("[PLANE:%d:%s] FB:%d, fb = %ux%u format = %s\n",
|
|
|
+ plane->base.id, plane->name,
|
|
|
fb->base.id, fb->width, fb->height,
|
|
|
drm_get_format_name(fb->pixel_format, &format_name));
|
|
|
- DRM_DEBUG_KMS("\tscaler:%d src %dx%d+%d+%d dst %dx%d+%d+%d\n",
|
|
|
- state->scaler_id,
|
|
|
- state->base.src.x1 >> 16,
|
|
|
- state->base.src.y1 >> 16,
|
|
|
- drm_rect_width(&state->base.src) >> 16,
|
|
|
- drm_rect_height(&state->base.src) >> 16,
|
|
|
- state->base.dst.x1, state->base.dst.y1,
|
|
|
- drm_rect_width(&state->base.dst),
|
|
|
- drm_rect_height(&state->base.dst));
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9)
|
|
|
+ DRM_DEBUG_KMS("\tscaler:%d src %dx%d+%d+%d dst %dx%d+%d+%d\n",
|
|
|
+ state->scaler_id,
|
|
|
+ state->base.src.x1 >> 16,
|
|
|
+ state->base.src.y1 >> 16,
|
|
|
+ drm_rect_width(&state->base.src) >> 16,
|
|
|
+ drm_rect_height(&state->base.src) >> 16,
|
|
|
+ state->base.dst.x1, state->base.dst.y1,
|
|
|
+ drm_rect_width(&state->base.dst),
|
|
|
+ drm_rect_height(&state->base.dst));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -13192,12 +13166,11 @@ intel_compare_link_m_n(const struct intel_link_m_n *m_n,
|
|
|
}
|
|
|
|
|
|
static bool
|
|
|
-intel_pipe_config_compare(struct drm_device *dev,
|
|
|
+intel_pipe_config_compare(struct drm_i915_private *dev_priv,
|
|
|
struct intel_crtc_state *current_config,
|
|
|
struct intel_crtc_state *pipe_config,
|
|
|
bool adjust)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
bool ret = true;
|
|
|
|
|
|
#define INTEL_ERR_OR_DBG_KMS(fmt, ...) \
|
|
@@ -13317,7 +13290,7 @@ intel_pipe_config_compare(struct drm_device *dev,
|
|
|
PIPE_CONF_CHECK_I(lane_count);
|
|
|
PIPE_CONF_CHECK_X(lane_lat_optim_mask);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen < 8) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 8) {
|
|
|
PIPE_CONF_CHECK_M_N(dp_m_n);
|
|
|
|
|
|
if (current_config->has_drrs)
|
|
@@ -13366,7 +13339,7 @@ intel_pipe_config_compare(struct drm_device *dev,
|
|
|
|
|
|
PIPE_CONF_CHECK_X(gmch_pfit.control);
|
|
|
/* pfit ratios are autocomputed by the hw on gen4+ */
|
|
|
- if (INTEL_INFO(dev)->gen < 4)
|
|
|
+ if (INTEL_GEN(dev_priv) < 4)
|
|
|
PIPE_CONF_CHECK_X(gmch_pfit.pgm_ratios);
|
|
|
PIPE_CONF_CHECK_X(gmch_pfit.lvds_border_bits);
|
|
|
|
|
@@ -13441,8 +13414,7 @@ static void intel_pipe_config_sanity_check(struct drm_i915_private *dev_priv,
|
|
|
static void verify_wm_state(struct drm_crtc *crtc,
|
|
|
struct drm_crtc_state *new_state)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->dev);
|
|
|
struct skl_ddb_allocation hw_ddb, *sw_ddb;
|
|
|
struct skl_pipe_wm hw_wm, *sw_wm;
|
|
|
struct skl_plane_wm *hw_plane_wm, *sw_plane_wm;
|
|
@@ -13451,7 +13423,7 @@ static void verify_wm_state(struct drm_crtc *crtc,
|
|
|
const enum pipe pipe = intel_crtc->pipe;
|
|
|
int plane, level, max_level = ilk_wm_max_level(dev_priv);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->gen < 9 || !new_state->active)
|
|
|
+ if (INTEL_GEN(dev_priv) < 9 || !new_state->active)
|
|
|
return;
|
|
|
|
|
|
skl_pipe_wm_get_hw_state(crtc, &hw_wm);
|
|
@@ -13557,11 +13529,15 @@ static void verify_wm_state(struct drm_crtc *crtc,
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-verify_connector_state(struct drm_device *dev, struct drm_crtc *crtc)
|
|
|
+verify_connector_state(struct drm_device *dev,
|
|
|
+ struct drm_atomic_state *state,
|
|
|
+ struct drm_crtc *crtc)
|
|
|
{
|
|
|
struct drm_connector *connector;
|
|
|
+ struct drm_connector_state *old_conn_state;
|
|
|
+ int i;
|
|
|
|
|
|
- drm_for_each_connector(connector, dev) {
|
|
|
+ for_each_connector_in_state(state, connector, old_conn_state, i) {
|
|
|
struct drm_encoder *encoder = connector->encoder;
|
|
|
struct drm_connector_state *state = connector->state;
|
|
|
|
|
@@ -13676,7 +13652,7 @@ verify_crtc_state(struct drm_crtc *crtc,
|
|
|
intel_pipe_config_sanity_check(dev_priv, pipe_config);
|
|
|
|
|
|
sw_config = to_intel_crtc_state(crtc->state);
|
|
|
- if (!intel_pipe_config_compare(dev, sw_config,
|
|
|
+ if (!intel_pipe_config_compare(dev_priv, sw_config,
|
|
|
pipe_config, false)) {
|
|
|
I915_STATE_WARN(1, "pipe state doesn't match!\n");
|
|
|
intel_dump_pipe_config(intel_crtc, pipe_config,
|
|
@@ -13769,15 +13745,16 @@ verify_shared_dpll_state(struct drm_device *dev, struct drm_crtc *crtc,
|
|
|
|
|
|
static void
|
|
|
intel_modeset_verify_crtc(struct drm_crtc *crtc,
|
|
|
- struct drm_crtc_state *old_state,
|
|
|
- struct drm_crtc_state *new_state)
|
|
|
+ struct drm_atomic_state *state,
|
|
|
+ struct drm_crtc_state *old_state,
|
|
|
+ struct drm_crtc_state *new_state)
|
|
|
{
|
|
|
if (!needs_modeset(new_state) &&
|
|
|
!to_intel_crtc_state(new_state)->update_pipe)
|
|
|
return;
|
|
|
|
|
|
verify_wm_state(crtc, new_state);
|
|
|
- verify_connector_state(crtc->dev, crtc);
|
|
|
+ verify_connector_state(crtc->dev, state, crtc);
|
|
|
verify_crtc_state(crtc, old_state, new_state);
|
|
|
verify_shared_dpll_state(crtc->dev, crtc, old_state, new_state);
|
|
|
}
|
|
@@ -13793,10 +13770,11 @@ verify_disabled_dpll_state(struct drm_device *dev)
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-intel_modeset_verify_disabled(struct drm_device *dev)
|
|
|
+intel_modeset_verify_disabled(struct drm_device *dev,
|
|
|
+ struct drm_atomic_state *state)
|
|
|
{
|
|
|
verify_encoder_state(dev);
|
|
|
- verify_connector_state(dev, NULL);
|
|
|
+ verify_connector_state(dev, state, NULL);
|
|
|
verify_disabled_dpll_state(dev);
|
|
|
}
|
|
|
|
|
@@ -14094,7 +14072,7 @@ static int intel_atomic_check(struct drm_device *dev,
|
|
|
}
|
|
|
|
|
|
if (i915.fastboot &&
|
|
|
- intel_pipe_config_compare(dev,
|
|
|
+ intel_pipe_config_compare(dev_priv,
|
|
|
to_intel_crtc_state(crtc->state),
|
|
|
pipe_config, true)) {
|
|
|
crtc_state->mode_changed = false;
|
|
@@ -14294,6 +14272,14 @@ static void skl_update_crtcs(struct drm_atomic_state *state,
|
|
|
unsigned int updated = 0;
|
|
|
bool progress;
|
|
|
enum pipe pipe;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ const struct skl_ddb_entry *entries[I915_MAX_PIPES] = {};
|
|
|
+
|
|
|
+ for_each_crtc_in_state(state, crtc, old_crtc_state, i)
|
|
|
+ /* ignore allocations for crtc's that have been turned off. */
|
|
|
+ if (crtc->state->active)
|
|
|
+ entries[i] = &to_intel_crtc_state(old_crtc_state)->wm.skl.ddb;
|
|
|
|
|
|
/*
|
|
|
* Whenever the number of active pipes changes, we need to make sure we
|
|
@@ -14302,7 +14288,6 @@ static void skl_update_crtcs(struct drm_atomic_state *state,
|
|
|
* cause pipe underruns and other bad stuff.
|
|
|
*/
|
|
|
do {
|
|
|
- int i;
|
|
|
progress = false;
|
|
|
|
|
|
for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
|
|
@@ -14313,12 +14298,14 @@ static void skl_update_crtcs(struct drm_atomic_state *state,
|
|
|
cstate = to_intel_crtc_state(crtc->state);
|
|
|
pipe = intel_crtc->pipe;
|
|
|
|
|
|
- if (updated & cmask || !crtc->state->active)
|
|
|
+ if (updated & cmask || !cstate->base.active)
|
|
|
continue;
|
|
|
- if (skl_ddb_allocation_overlaps(state, intel_crtc))
|
|
|
+
|
|
|
+ if (skl_ddb_allocation_overlaps(entries, &cstate->wm.skl.ddb, i))
|
|
|
continue;
|
|
|
|
|
|
updated |= cmask;
|
|
|
+ entries[i] = &cstate->wm.skl.ddb;
|
|
|
|
|
|
/*
|
|
|
* If this is an already active pipe, it's DDB changed,
|
|
@@ -14327,7 +14314,7 @@ static void skl_update_crtcs(struct drm_atomic_state *state,
|
|
|
* new ddb allocation to take effect.
|
|
|
*/
|
|
|
if (!skl_ddb_entry_equal(&cstate->wm.skl.ddb,
|
|
|
- &intel_crtc->hw_ddb) &&
|
|
|
+ &to_intel_crtc_state(old_crtc_state)->wm.skl.ddb) &&
|
|
|
!crtc->state->active_changed &&
|
|
|
intel_state->wm_results.dirty_pipes != updated)
|
|
|
vbl_wait = true;
|
|
@@ -14358,14 +14345,8 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
|
|
|
|
|
|
drm_atomic_helper_wait_for_dependencies(state);
|
|
|
|
|
|
- if (intel_state->modeset) {
|
|
|
- memcpy(dev_priv->min_pixclk, intel_state->min_pixclk,
|
|
|
- sizeof(intel_state->min_pixclk));
|
|
|
- dev_priv->active_crtcs = intel_state->active_crtcs;
|
|
|
- dev_priv->atomic_cdclk_freq = intel_state->cdclk;
|
|
|
-
|
|
|
+ if (intel_state->modeset)
|
|
|
intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET);
|
|
|
- }
|
|
|
|
|
|
for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
@@ -14398,8 +14379,17 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
|
|
|
intel_check_cpu_fifo_underruns(dev_priv);
|
|
|
intel_check_pch_fifo_underruns(dev_priv);
|
|
|
|
|
|
- if (!crtc->state->active)
|
|
|
- intel_update_watermarks(intel_crtc);
|
|
|
+ if (!crtc->state->active) {
|
|
|
+ /*
|
|
|
+ * Make sure we don't call initial_watermarks
|
|
|
+ * for ILK-style watermark updates.
|
|
|
+ */
|
|
|
+ if (dev_priv->display.atomic_update_watermarks)
|
|
|
+ dev_priv->display.initial_watermarks(intel_state,
|
|
|
+ to_intel_crtc_state(crtc->state));
|
|
|
+ else
|
|
|
+ intel_update_watermarks(intel_crtc);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -14422,7 +14412,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
|
|
|
if (!intel_can_enable_sagv(state))
|
|
|
intel_disable_sagv(dev_priv);
|
|
|
|
|
|
- intel_modeset_verify_disabled(dev);
|
|
|
+ intel_modeset_verify_disabled(dev, state);
|
|
|
}
|
|
|
|
|
|
/* Complete the events for pipes that have now been disabled */
|
|
@@ -14465,7 +14455,8 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
|
|
|
intel_cstate = to_intel_crtc_state(crtc->state);
|
|
|
|
|
|
if (dev_priv->display.optimize_watermarks)
|
|
|
- dev_priv->display.optimize_watermarks(intel_cstate);
|
|
|
+ dev_priv->display.optimize_watermarks(intel_state,
|
|
|
+ intel_cstate);
|
|
|
}
|
|
|
|
|
|
for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
|
|
@@ -14474,7 +14465,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
|
|
|
if (put_domains[i])
|
|
|
modeset_put_power_domains(dev_priv, put_domains[i]);
|
|
|
|
|
|
- intel_modeset_verify_crtc(crtc, old_crtc_state, crtc->state);
|
|
|
+ intel_modeset_verify_crtc(crtc, state, old_crtc_state, crtc->state);
|
|
|
}
|
|
|
|
|
|
if (intel_state->modeset && intel_can_enable_sagv(state))
|
|
@@ -14557,10 +14548,6 @@ static void intel_atomic_track_fbs(struct drm_atomic_state *state)
|
|
|
* This function commits a top-level state object that has been validated
|
|
|
* with drm_atomic_helper_check().
|
|
|
*
|
|
|
- * FIXME: Atomic modeset support for i915 is not yet complete. At the moment
|
|
|
- * nonblocking commits are only safe for pure plane updates. Everything else
|
|
|
- * should work though.
|
|
|
- *
|
|
|
* RETURNS
|
|
|
* Zero for success or -errno.
|
|
|
*/
|
|
@@ -14572,11 +14559,6 @@ static int intel_atomic_commit(struct drm_device *dev,
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
int ret = 0;
|
|
|
|
|
|
- if (intel_state->modeset && nonblock) {
|
|
|
- DRM_DEBUG_KMS("nonblocking commit for modeset not yet implemented.\n");
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
ret = drm_atomic_helper_setup_commit(state, nonblock);
|
|
|
if (ret)
|
|
|
return ret;
|
|
@@ -14594,10 +14576,16 @@ static int intel_atomic_commit(struct drm_device *dev,
|
|
|
|
|
|
drm_atomic_helper_swap_state(state, true);
|
|
|
dev_priv->wm.distrust_bios_wm = false;
|
|
|
- dev_priv->wm.skl_results = intel_state->wm_results;
|
|
|
intel_shared_dpll_commit(state);
|
|
|
intel_atomic_track_fbs(state);
|
|
|
|
|
|
+ if (intel_state->modeset) {
|
|
|
+ memcpy(dev_priv->min_pixclk, intel_state->min_pixclk,
|
|
|
+ sizeof(intel_state->min_pixclk));
|
|
|
+ dev_priv->active_crtcs = intel_state->active_crtcs;
|
|
|
+ dev_priv->atomic_cdclk_freq = intel_state->cdclk;
|
|
|
+ }
|
|
|
+
|
|
|
drm_atomic_state_get(state);
|
|
|
INIT_WORK(&state->commit_work,
|
|
|
nonblock ? intel_atomic_commit_work : NULL);
|
|
@@ -14720,8 +14708,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
|
|
|
{
|
|
|
struct intel_atomic_state *intel_state =
|
|
|
to_intel_atomic_state(new_state->state);
|
|
|
- struct drm_device *dev = plane->dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(plane->dev);
|
|
|
struct drm_framebuffer *fb = new_state->fb;
|
|
|
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
|
|
struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
|
|
@@ -14775,10 +14762,12 @@ intel_prepare_plane_fb(struct drm_plane *plane,
|
|
|
GFP_KERNEL);
|
|
|
if (ret < 0)
|
|
|
return ret;
|
|
|
+
|
|
|
+ i915_gem_object_wait_priority(obj, 0, I915_PRIORITY_DISPLAY);
|
|
|
}
|
|
|
|
|
|
if (plane->type == DRM_PLANE_TYPE_CURSOR &&
|
|
|
- INTEL_INFO(dev)->cursor_needs_physical) {
|
|
|
+ INTEL_INFO(dev_priv)->cursor_needs_physical) {
|
|
|
int align = IS_I830(dev_priv) ? 16 * 1024 : 256;
|
|
|
ret = i915_gem_object_attach_phys(obj, align);
|
|
|
if (ret) {
|
|
@@ -14811,7 +14800,7 @@ void
|
|
|
intel_cleanup_plane_fb(struct drm_plane *plane,
|
|
|
struct drm_plane_state *old_state)
|
|
|
{
|
|
|
- struct drm_device *dev = plane->dev;
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(plane->dev);
|
|
|
struct intel_plane_state *old_intel_state;
|
|
|
struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb);
|
|
|
struct drm_i915_gem_object *obj = intel_fb_obj(plane->state->fb);
|
|
@@ -14822,7 +14811,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
|
|
|
return;
|
|
|
|
|
|
if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||
|
|
|
- !INTEL_INFO(dev)->cursor_needs_physical))
|
|
|
+ !INTEL_INFO(dev_priv)->cursor_needs_physical))
|
|
|
intel_unpin_fb_obj(old_state->fb, old_state->rotation);
|
|
|
}
|
|
|
|
|
@@ -14900,30 +14889,32 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
struct intel_crtc_state *intel_cstate =
|
|
|
to_intel_crtc_state(crtc->state);
|
|
|
- struct intel_crtc_state *old_intel_state =
|
|
|
+ struct intel_crtc_state *old_intel_cstate =
|
|
|
to_intel_crtc_state(old_crtc_state);
|
|
|
+ struct intel_atomic_state *old_intel_state =
|
|
|
+ to_intel_atomic_state(old_crtc_state->state);
|
|
|
bool modeset = needs_modeset(crtc->state);
|
|
|
- enum pipe pipe = intel_crtc->pipe;
|
|
|
|
|
|
/* Perform vblank evasion around commit operation */
|
|
|
intel_pipe_update_start(intel_crtc);
|
|
|
|
|
|
if (modeset)
|
|
|
- return;
|
|
|
+ goto out;
|
|
|
|
|
|
if (crtc->state->color_mgmt_changed || to_intel_crtc_state(crtc->state)->update_pipe) {
|
|
|
intel_color_set_csc(crtc->state);
|
|
|
intel_color_load_luts(crtc->state);
|
|
|
}
|
|
|
|
|
|
- if (intel_cstate->update_pipe) {
|
|
|
- intel_update_pipe_config(intel_crtc, old_intel_state);
|
|
|
- } else if (INTEL_GEN(dev_priv) >= 9) {
|
|
|
+ if (intel_cstate->update_pipe)
|
|
|
+ intel_update_pipe_config(intel_crtc, old_intel_cstate);
|
|
|
+ else if (INTEL_GEN(dev_priv) >= 9)
|
|
|
skl_detach_scalers(intel_crtc);
|
|
|
|
|
|
- I915_WRITE(PIPE_WM_LINETIME(pipe),
|
|
|
- intel_cstate->wm.skl.optimal.linetime);
|
|
|
- }
|
|
|
+out:
|
|
|
+ if (dev_priv->display.atomic_update_watermarks)
|
|
|
+ dev_priv->display.atomic_update_watermarks(old_intel_state,
|
|
|
+ intel_cstate);
|
|
|
}
|
|
|
|
|
|
static void intel_finish_crtc_commit(struct drm_crtc *crtc,
|
|
@@ -14989,11 +14980,16 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
|
|
state->scaler_id = -1;
|
|
|
}
|
|
|
primary->pipe = pipe;
|
|
|
- primary->plane = 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)
|
|
|
+ primary->plane = (enum plane) !pipe;
|
|
|
+ else
|
|
|
+ primary->plane = (enum plane) pipe;
|
|
|
primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe);
|
|
|
primary->check_plane = intel_check_primary_plane;
|
|
|
- if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4)
|
|
|
- primary->plane = !pipe;
|
|
|
|
|
|
if (INTEL_GEN(dev_priv) >= 9) {
|
|
|
intel_primary_formats = skl_primary_formats;
|
|
@@ -15046,6 +15042,10 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
|
|
supported_rotations =
|
|
|
DRM_ROTATE_0 | DRM_ROTATE_90 |
|
|
|
DRM_ROTATE_180 | DRM_ROTATE_270;
|
|
|
+ } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
|
|
|
+ supported_rotations =
|
|
|
+ DRM_ROTATE_0 | DRM_ROTATE_180 |
|
|
|
+ DRM_REFLECT_X;
|
|
|
} else if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
supported_rotations =
|
|
|
DRM_ROTATE_0 | DRM_ROTATE_180;
|
|
@@ -15147,13 +15147,13 @@ intel_update_cursor_plane(struct drm_plane *plane,
|
|
|
{
|
|
|
struct drm_crtc *crtc = crtc_state->base.crtc;
|
|
|
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
|
|
- struct drm_device *dev = plane->dev;
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(plane->dev);
|
|
|
struct drm_i915_gem_object *obj = intel_fb_obj(state->base.fb);
|
|
|
uint32_t addr;
|
|
|
|
|
|
if (!obj)
|
|
|
addr = 0;
|
|
|
- else if (!INTEL_INFO(dev)->cursor_needs_physical)
|
|
|
+ else if (!INTEL_INFO(dev_priv)->cursor_needs_physical)
|
|
|
addr = i915_gem_object_ggtt_offset(obj, NULL);
|
|
|
else
|
|
|
addr = obj->phys_handle->busaddr;
|
|
@@ -15280,14 +15280,14 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
|
|
|
struct intel_plane *plane;
|
|
|
|
|
|
plane = intel_sprite_plane_create(dev_priv, pipe, sprite);
|
|
|
- if (!plane) {
|
|
|
+ if (IS_ERR(plane)) {
|
|
|
ret = PTR_ERR(plane);
|
|
|
goto fail;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
cursor = intel_cursor_plane_create(dev_priv, pipe);
|
|
|
- if (!cursor) {
|
|
|
+ if (IS_ERR(cursor)) {
|
|
|
ret = PTR_ERR(cursor);
|
|
|
goto fail;
|
|
|
}
|
|
@@ -15299,16 +15299,8 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
|
|
|
if (ret)
|
|
|
goto fail;
|
|
|
|
|
|
- /*
|
|
|
- * 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.
|
|
|
- */
|
|
|
intel_crtc->pipe = pipe;
|
|
|
- intel_crtc->plane = (enum plane) pipe;
|
|
|
- if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4) {
|
|
|
- DRM_DEBUG_KMS("swapping pipes & planes for FBC\n");
|
|
|
- intel_crtc->plane = !pipe;
|
|
|
- }
|
|
|
+ intel_crtc->plane = primary->plane;
|
|
|
|
|
|
intel_crtc->cursor_base = ~0;
|
|
|
intel_crtc->cursor_cntl = ~0;
|
|
@@ -15401,11 +15393,9 @@ static bool has_edp_a(struct drm_i915_private *dev_priv)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-static bool intel_crt_present(struct drm_device *dev)
|
|
|
+static bool intel_crt_present(struct drm_i915_private *dev_priv)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
-
|
|
|
- if (INTEL_INFO(dev)->gen >= 9)
|
|
|
+ if (INTEL_GEN(dev_priv) >= 9)
|
|
|
return false;
|
|
|
|
|
|
if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv))
|
|
@@ -15479,7 +15469,7 @@ static void intel_setup_outputs(struct drm_device *dev)
|
|
|
*/
|
|
|
intel_lvds_init(dev);
|
|
|
|
|
|
- if (intel_crt_present(dev))
|
|
|
+ if (intel_crt_present(dev_priv))
|
|
|
intel_crt_init(dev);
|
|
|
|
|
|
if (IS_BROXTON(dev_priv)) {
|
|
@@ -15527,7 +15517,7 @@ static void intel_setup_outputs(struct drm_device *dev)
|
|
|
|
|
|
} else if (HAS_PCH_SPLIT(dev_priv)) {
|
|
|
int found;
|
|
|
- dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
|
|
|
+ dpd_is_edp = intel_dp_is_edp(dev_priv, PORT_D);
|
|
|
|
|
|
if (has_edp_a(dev_priv))
|
|
|
intel_dp_init(dev, DP_A, PORT_A);
|
|
@@ -15570,14 +15560,14 @@ static void intel_setup_outputs(struct drm_device *dev)
|
|
|
* trust the port type the VBT declares as we've seen at least
|
|
|
* HDMI ports that the VBT claim are DP or eDP.
|
|
|
*/
|
|
|
- has_edp = intel_dp_is_edp(dev, PORT_B);
|
|
|
+ has_edp = intel_dp_is_edp(dev_priv, PORT_B);
|
|
|
has_port = intel_bios_is_port_present(dev_priv, PORT_B);
|
|
|
if (I915_READ(VLV_DP_B) & DP_DETECTED || has_port)
|
|
|
has_edp &= intel_dp_init(dev, VLV_DP_B, PORT_B);
|
|
|
if ((I915_READ(VLV_HDMIB) & SDVO_DETECTED || has_port) && !has_edp)
|
|
|
intel_hdmi_init(dev, VLV_HDMIB, PORT_B);
|
|
|
|
|
|
- has_edp = intel_dp_is_edp(dev, PORT_C);
|
|
|
+ has_edp = intel_dp_is_edp(dev_priv, PORT_C);
|
|
|
has_port = intel_bios_is_port_present(dev_priv, PORT_C);
|
|
|
if (I915_READ(VLV_DP_C) & DP_DETECTED || has_port)
|
|
|
has_edp &= intel_dp_init(dev, VLV_DP_C, PORT_C);
|
|
@@ -15634,7 +15624,7 @@ static void intel_setup_outputs(struct drm_device *dev)
|
|
|
} else if (IS_GEN2(dev_priv))
|
|
|
intel_dvo_init(dev);
|
|
|
|
|
|
- if (SUPPORTS_TV(dev))
|
|
|
+ if (SUPPORTS_TV(dev_priv))
|
|
|
intel_tv_init(dev);
|
|
|
|
|
|
intel_psr_init(dev);
|
|
@@ -15689,6 +15679,8 @@ static int intel_user_framebuffer_dirty(struct drm_framebuffer *fb,
|
|
|
struct drm_i915_gem_object *obj = intel_fb->obj;
|
|
|
|
|
|
mutex_lock(&dev->struct_mutex);
|
|
|
+ if (obj->pin_display && obj->cache_dirty)
|
|
|
+ i915_gem_clflush_object(obj, true);
|
|
|
intel_fb_obj_flush(obj, false, ORIGIN_DIRTYFB);
|
|
|
mutex_unlock(&dev->struct_mutex);
|
|
|
|
|
@@ -15769,7 +15761,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
|
|
|
switch (mode_cmd->modifier[0]) {
|
|
|
case I915_FORMAT_MOD_Y_TILED:
|
|
|
case I915_FORMAT_MOD_Yf_TILED:
|
|
|
- if (INTEL_INFO(dev)->gen < 9) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 9) {
|
|
|
DRM_DEBUG("Unsupported tiling 0x%llx!\n",
|
|
|
mode_cmd->modifier[0]);
|
|
|
return -EINVAL;
|
|
@@ -15832,7 +15824,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
|
|
|
case DRM_FORMAT_ARGB8888:
|
|
|
break;
|
|
|
case DRM_FORMAT_XRGB1555:
|
|
|
- if (INTEL_INFO(dev)->gen > 3) {
|
|
|
+ if (INTEL_GEN(dev_priv) > 3) {
|
|
|
DRM_DEBUG("unsupported pixel format: %s\n",
|
|
|
drm_get_format_name(mode_cmd->pixel_format, &format_name));
|
|
|
return -EINVAL;
|
|
@@ -15840,7 +15832,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
|
|
|
break;
|
|
|
case DRM_FORMAT_ABGR8888:
|
|
|
if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) &&
|
|
|
- INTEL_INFO(dev)->gen < 9) {
|
|
|
+ INTEL_GEN(dev_priv) < 9) {
|
|
|
DRM_DEBUG("unsupported pixel format: %s\n",
|
|
|
drm_get_format_name(mode_cmd->pixel_format, &format_name));
|
|
|
return -EINVAL;
|
|
@@ -15849,7 +15841,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
|
|
|
case DRM_FORMAT_XBGR8888:
|
|
|
case DRM_FORMAT_XRGB2101010:
|
|
|
case DRM_FORMAT_XBGR2101010:
|
|
|
- if (INTEL_INFO(dev)->gen < 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 4) {
|
|
|
DRM_DEBUG("unsupported pixel format: %s\n",
|
|
|
drm_get_format_name(mode_cmd->pixel_format, &format_name));
|
|
|
return -EINVAL;
|
|
@@ -15866,7 +15858,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
|
|
|
case DRM_FORMAT_UYVY:
|
|
|
case DRM_FORMAT_YVYU:
|
|
|
case DRM_FORMAT_VYUY:
|
|
|
- if (INTEL_INFO(dev)->gen < 5) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 5) {
|
|
|
DRM_DEBUG("unsupported pixel format: %s\n",
|
|
|
drm_get_format_name(mode_cmd->pixel_format, &format_name));
|
|
|
return -EINVAL;
|
|
@@ -16295,9 +16287,8 @@ static void intel_init_quirks(struct drm_device *dev)
|
|
|
}
|
|
|
|
|
|
/* Disable the VGA plane that we never use */
|
|
|
-static void i915_disable_vga(struct drm_device *dev)
|
|
|
+static void i915_disable_vga(struct drm_i915_private *dev_priv)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
struct pci_dev *pdev = dev_priv->drm.pdev;
|
|
|
u8 sr1;
|
|
|
i915_reg_t vga_reg = i915_vgacntrl_reg(dev_priv);
|
|
@@ -16339,6 +16330,7 @@ static void sanitize_watermarks(struct drm_device *dev)
|
|
|
{
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
struct drm_atomic_state *state;
|
|
|
+ struct intel_atomic_state *intel_state;
|
|
|
struct drm_crtc *crtc;
|
|
|
struct drm_crtc_state *cstate;
|
|
|
struct drm_modeset_acquire_ctx ctx;
|
|
@@ -16367,12 +16359,14 @@ retry:
|
|
|
if (WARN_ON(IS_ERR(state)))
|
|
|
goto fail;
|
|
|
|
|
|
+ intel_state = to_intel_atomic_state(state);
|
|
|
+
|
|
|
/*
|
|
|
* Hardware readout is the only time we don't want to calculate
|
|
|
* intermediate watermarks (since we don't trust the current
|
|
|
* watermarks).
|
|
|
*/
|
|
|
- to_intel_atomic_state(state)->skip_intermediate_wm = true;
|
|
|
+ intel_state->skip_intermediate_wm = true;
|
|
|
|
|
|
ret = intel_atomic_check(dev, state);
|
|
|
if (ret) {
|
|
@@ -16396,7 +16390,7 @@ retry:
|
|
|
struct intel_crtc_state *cs = to_intel_crtc_state(cstate);
|
|
|
|
|
|
cs->wm.need_postvbl_update = true;
|
|
|
- dev_priv->display.optimize_watermarks(cs);
|
|
|
+ dev_priv->display.optimize_watermarks(intel_state, cs);
|
|
|
}
|
|
|
|
|
|
put_state:
|
|
@@ -16429,7 +16423,7 @@ int intel_modeset_init(struct drm_device *dev)
|
|
|
|
|
|
intel_init_pm(dev_priv);
|
|
|
|
|
|
- if (INTEL_INFO(dev)->num_pipes == 0)
|
|
|
+ if (INTEL_INFO(dev_priv)->num_pipes == 0)
|
|
|
return 0;
|
|
|
|
|
|
/*
|
|
@@ -16475,8 +16469,8 @@ int intel_modeset_init(struct drm_device *dev)
|
|
|
dev->mode_config.fb_base = ggtt->mappable_base;
|
|
|
|
|
|
DRM_DEBUG_KMS("%d display pipe%s available.\n",
|
|
|
- INTEL_INFO(dev)->num_pipes,
|
|
|
- INTEL_INFO(dev)->num_pipes > 1 ? "s" : "");
|
|
|
+ INTEL_INFO(dev_priv)->num_pipes,
|
|
|
+ INTEL_INFO(dev_priv)->num_pipes > 1 ? "s" : "");
|
|
|
|
|
|
for_each_pipe(dev_priv, pipe) {
|
|
|
int ret;
|
|
@@ -16497,7 +16491,7 @@ int intel_modeset_init(struct drm_device *dev)
|
|
|
intel_update_max_cdclk(dev_priv);
|
|
|
|
|
|
/* Just disable it once at startup */
|
|
|
- i915_disable_vga(dev);
|
|
|
+ i915_disable_vga(dev_priv);
|
|
|
intel_setup_outputs(dev);
|
|
|
|
|
|
drm_modeset_lock_all(dev);
|
|
@@ -16564,11 +16558,10 @@ static void intel_enable_pipe_a(struct drm_device *dev)
|
|
|
static bool
|
|
|
intel_check_plane_mapping(struct intel_crtc *crtc)
|
|
|
{
|
|
|
- struct drm_device *dev = crtc->base.dev;
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
|
|
u32 val;
|
|
|
|
|
|
- if (INTEL_INFO(dev)->num_pipes == 1)
|
|
|
+ if (INTEL_INFO(dev_priv)->num_pipes == 1)
|
|
|
return true;
|
|
|
|
|
|
val = I915_READ(DSPCNTR(!crtc->plane));
|
|
@@ -16642,7 +16635,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
|
|
|
/* We need to sanitize the plane -> pipe mapping first because this will
|
|
|
* disable the crtc (and hence change the state) if it is wrong. Note
|
|
|
* that gen4+ has a fixed plane -> pipe mapping. */
|
|
|
- if (INTEL_INFO(dev)->gen < 4 && !intel_check_plane_mapping(crtc)) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 4 && !intel_check_plane_mapping(crtc)) {
|
|
|
bool plane;
|
|
|
|
|
|
DRM_DEBUG_KMS("[CRTC:%d:%s] wrong plane connection detected!\n",
|
|
@@ -16744,21 +16737,18 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
|
|
|
* the crtc fixup. */
|
|
|
}
|
|
|
|
|
|
-void i915_redisable_vga_power_on(struct drm_device *dev)
|
|
|
+void i915_redisable_vga_power_on(struct drm_i915_private *dev_priv)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
i915_reg_t vga_reg = i915_vgacntrl_reg(dev_priv);
|
|
|
|
|
|
if (!(I915_READ(vga_reg) & VGA_DISP_DISABLE)) {
|
|
|
DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
|
|
|
- i915_disable_vga(dev);
|
|
|
+ i915_disable_vga(dev_priv);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void i915_redisable_vga(struct drm_device *dev)
|
|
|
+void i915_redisable_vga(struct drm_i915_private *dev_priv)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
-
|
|
|
/* This function can be called both from intel_modeset_setup_hw_state or
|
|
|
* at a very early point in our resume sequence, where the power well
|
|
|
* structures are not yet restored. Since this function is at a very
|
|
@@ -16769,7 +16759,7 @@ void i915_redisable_vga(struct drm_device *dev)
|
|
|
if (!intel_display_power_get_if_enabled(dev_priv, POWER_DOMAIN_VGA))
|
|
|
return;
|
|
|
|
|
|
- i915_redisable_vga_power_on(dev);
|
|
|
+ i915_redisable_vga_power_on(dev_priv);
|
|
|
|
|
|
intel_display_power_put(dev_priv, POWER_DOMAIN_VGA);
|
|
|
}
|
|
@@ -16841,7 +16831,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
|
|
|
|
|
|
DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n",
|
|
|
crtc->base.base.id, crtc->base.name,
|
|
|
- crtc->active ? "enabled" : "disabled");
|
|
|
+ enableddisabled(crtc->active));
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < dev_priv->num_shared_dpll; i++) {
|
|
@@ -16874,9 +16864,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
|
|
|
}
|
|
|
|
|
|
DRM_DEBUG_KMS("[ENCODER:%d:%s] hw state readout: %s, pipe %c\n",
|
|
|
- encoder->base.base.id,
|
|
|
- encoder->base.name,
|
|
|
- encoder->base.crtc ? "enabled" : "disabled",
|
|
|
+ encoder->base.base.id, encoder->base.name,
|
|
|
+ enableddisabled(encoder->base.crtc),
|
|
|
pipe_name(pipe));
|
|
|
}
|
|
|
|
|
@@ -16905,9 +16894,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
|
|
|
connector->base.encoder = NULL;
|
|
|
}
|
|
|
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] hw state readout: %s\n",
|
|
|
- connector->base.base.id,
|
|
|
- connector->base.name,
|
|
|
- connector->base.encoder ? "enabled" : "disabled");
|
|
|
+ connector->base.base.id, connector->base.name,
|
|
|
+ enableddisabled(connector->base.encoder));
|
|
|
}
|
|
|
|
|
|
for_each_intel_crtc(dev, crtc) {
|
|
@@ -17155,10 +17143,9 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
|
|
|
/*
|
|
|
* set vga decode state - true == enable VGA decode
|
|
|
*/
|
|
|
-int intel_modeset_vga_set_state(struct drm_device *dev, bool state)
|
|
|
+int intel_modeset_vga_set_state(struct drm_i915_private *dev_priv, bool state)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
- unsigned reg = INTEL_INFO(dev)->gen >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
|
|
|
+ unsigned reg = INTEL_GEN(dev_priv) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
|
|
|
u16 gmch_ctrl;
|
|
|
|
|
|
if (pci_read_config_word(dev_priv->bridge_dev, reg, &gmch_ctrl)) {
|
|
@@ -17312,16 +17299,15 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv)
|
|
|
|
|
|
void
|
|
|
intel_display_print_error_state(struct drm_i915_error_state_buf *m,
|
|
|
- struct drm_device *dev,
|
|
|
+ struct drm_i915_private *dev_priv,
|
|
|
struct intel_display_error_state *error)
|
|
|
{
|
|
|
- struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
int i;
|
|
|
|
|
|
if (!error)
|
|
|
return;
|
|
|
|
|
|
- err_printf(m, "Num Pipes: %d\n", INTEL_INFO(dev)->num_pipes);
|
|
|
+ err_printf(m, "Num Pipes: %d\n", INTEL_INFO(dev_priv)->num_pipes);
|
|
|
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
|
|
|
err_printf(m, "PWR_WELL_CTL2: %08x\n",
|
|
|
error->power_well_driver);
|
|
@@ -17335,13 +17321,13 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m,
|
|
|
err_printf(m, "Plane [%d]:\n", i);
|
|
|
err_printf(m, " CNTR: %08x\n", error->plane[i].control);
|
|
|
err_printf(m, " STRIDE: %08x\n", error->plane[i].stride);
|
|
|
- if (INTEL_INFO(dev)->gen <= 3) {
|
|
|
+ if (INTEL_GEN(dev_priv) <= 3) {
|
|
|
err_printf(m, " SIZE: %08x\n", error->plane[i].size);
|
|
|
err_printf(m, " POS: %08x\n", error->plane[i].pos);
|
|
|
}
|
|
|
if (INTEL_GEN(dev_priv) <= 7 && !IS_HASWELL(dev_priv))
|
|
|
err_printf(m, " ADDR: %08x\n", error->plane[i].addr);
|
|
|
- if (INTEL_INFO(dev)->gen >= 4) {
|
|
|
+ if (INTEL_GEN(dev_priv) >= 4) {
|
|
|
err_printf(m, " SURF: %08x\n", error->plane[i].surface);
|
|
|
err_printf(m, " TILEOFF: %08x\n", error->plane[i].tile_offset);
|
|
|
}
|