Lines Matching refs:crtc
40 bool intel_pipe_has_type (struct drm_crtc *crtc, int type);
41 static void intel_crtc_update_cursor(struct drm_crtc *crtc, bool on);
331 static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
334 struct drm_device *dev = crtc->dev;
337 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
355 static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
357 struct drm_device *dev = crtc->dev;
360 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
365 } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI) ||
366 intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) {
368 } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO)) {
376 static const intel_limit_t *intel_limit(struct drm_crtc *crtc, int refclk)
378 struct drm_device *dev = crtc->dev;
382 limit = intel_ironlake_limit(crtc, refclk);
384 limit = intel_g4x_limit(crtc);
386 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
391 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG))
393 else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI))
398 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
403 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
436 bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
438 struct drm_device *dev = crtc->dev;
441 for_each_encoder_on_crtc(dev, crtc, encoder)
484 i9xx_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,
488 struct drm_device *dev = crtc->dev;
492 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
545 pnv_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,
549 struct drm_device *dev = crtc->dev;
553 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
604 g4x_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,
608 struct drm_device *dev = crtc->dev;
616 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
661 vlv_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,
731 struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
732 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
909 intel_crtc_to_shared_dpll(struct intel_crtc *crtc)
911 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
913 if (crtc->config.shared_dpll < 0)
916 return &dev_priv->shared_dplls[crtc->config.shared_dpll];
1397 static void ironlake_enable_shared_dpll(struct intel_crtc *crtc)
1399 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
1400 struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc);
1413 DRM_DEBUG_KMS("enable %s (active %d, on? %d)for crtc %d\n",
1415 crtc->base.base.id);
1429 static void intel_disable_shared_dpll(struct intel_crtc *crtc)
1431 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
1432 struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc);
1446 DRM_DEBUG_KMS("disable %s (active %d, on? %d) for crtc %d\n",
1448 crtc->base.base.id);
1469 struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
1470 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1509 intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO))
1869 static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1872 struct drm_device *dev = crtc->dev;
1874 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1969 static int ironlake_update_plane(struct drm_crtc *crtc,
1972 struct drm_device *dev = crtc->dev;
1974 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2062 intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
2065 struct drm_device *dev = crtc->dev;
2070 intel_increase_pllclock(crtc);
2072 return dev_priv->display.update_plane(crtc, fb, x, y);
2078 struct drm_crtc *crtc;
2090 * don't try to grab a crtc mutex before the
2094 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
2095 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2102 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
2103 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2105 mutex_lock(&crtc->mutex);
2107 dev_priv->display.update_plane(crtc, crtc->fb,
2108 crtc->x, crtc->y);
2109 mutex_unlock(&crtc->mutex);
2136 static void intel_crtc_update_sarea_pos(struct drm_crtc *crtc, int x, int y)
2138 struct drm_device *dev = crtc->dev;
2140 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2164 intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
2167 struct drm_device *dev = crtc->dev;
2169 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2180 DRM_ERROR("no plane for crtc: plane %c, num_pipes %d\n",
2196 ret = dev_priv->display.update_plane(crtc, fb, x, y);
2204 old_fb = crtc->fb;
2205 crtc->fb = fb;
2206 crtc->x = x;
2207 crtc->y = y;
2218 intel_crtc_update_sarea_pos(crtc, x, y);
2223 static void intel_fdi_normal_train(struct drm_crtc *crtc)
2225 struct drm_device *dev = crtc->dev;
2227 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2296 static void ironlake_fdi_link_train(struct drm_crtc *crtc)
2298 struct drm_device *dev = crtc->dev;
2300 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2398 static void gen6_fdi_link_train(struct drm_crtc *crtc)
2400 struct drm_device *dev = crtc->dev;
2402 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2530 static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
2532 struct drm_device *dev = crtc->dev;
2534 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2712 static void ironlake_fdi_disable(struct drm_crtc *crtc)
2714 struct drm_device *dev = crtc->dev;
2716 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2765 static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
2767 struct drm_device *dev = crtc->dev;
2769 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2778 pending = to_intel_crtc(crtc)->unpin_work != NULL;
2784 static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
2789 struct drm_device *dev = crtc->dev;
2792 if (crtc->fb == NULL)
2798 !intel_crtc_has_pending_flip(crtc));
2801 intel_finish_fb(crtc->fb);
2806 static void lpt_program_iclkip(struct drm_crtc *crtc)
2808 struct drm_device *dev = crtc->dev;
2827 if (crtc->mode.clock == 20000) {
2833 * but the crtc->mode.clock in in KHz. To get the divisors,
2842 desired_divisor = (iclk_virtual_root_freq / crtc->mode.clock);
2858 crtc->mode.clock,
2893 static void ironlake_pch_transcoder_set_timings(struct intel_crtc *crtc,
2896 struct drm_device *dev = crtc->base.dev;
2898 enum transcoder cpu_transcoder = crtc->config.cpu_transcoder;
2925 static void ironlake_pch_enable(struct drm_crtc *crtc)
2927 struct drm_device *dev = crtc->dev;
2929 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2941 dev_priv->display.fdi_link_train(crtc);
2969 intel_fdi_normal_train(crtc);
2973 (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
2974 intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
2985 if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC)
2987 if (crtc->mode.flags & DRM_MODE_FLAG_PVSYNC)
2990 switch (intel_trans_dp_port_sel(crtc)) {
3010 static void lpt_pch_enable(struct drm_crtc *crtc)
3012 struct drm_device *dev = crtc->dev;
3014 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3019 lpt_program_iclkip(crtc);
3027 static void intel_put_shared_dpll(struct intel_crtc *crtc)
3029 struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc);
3046 crtc->config.shared_dpll = DPLL_ID_PRIVATE;
3049 static struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, u32 dpll, u32 fp)
3051 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
3052 struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc);
3057 crtc->base.base.id, pll->name);
3058 intel_put_shared_dpll(crtc);
3063 i = (enum intel_dpll_id)crtc->pipe;
3067 crtc->base.base.id, pll->name);
3082 crtc->base.base.id,
3094 crtc->base.base.id, pll->name);
3102 crtc->config.shared_dpll = i;
3104 pipe_name(crtc->pipe));
3107 memcpy(&pll->hw_state, &crtc->config.dpll_hw_state,
3141 static void ironlake_pfit_enable(struct intel_crtc *crtc)
3143 struct drm_device *dev = crtc->base.dev;
3145 int pipe = crtc->pipe;
3147 if (crtc->config.pch_pfit.size) {
3157 I915_WRITE(PF_WIN_POS(pipe), crtc->config.pch_pfit.pos);
3158 I915_WRITE(PF_WIN_SZ(pipe), crtc->config.pch_pfit.size);
3162 static void intel_enable_planes(struct drm_crtc *crtc)
3164 struct drm_device *dev = crtc->dev;
3165 enum pipe pipe = to_intel_crtc(crtc)->pipe;
3173 static void intel_disable_planes(struct drm_crtc *crtc)
3175 struct drm_device *dev = crtc->dev;
3176 enum pipe pipe = to_intel_crtc(crtc)->pipe;
3184 static void ironlake_crtc_enable(struct drm_crtc *crtc)
3186 struct drm_device *dev = crtc->dev;
3188 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3194 WARN_ON(!crtc->enabled);
3206 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
3223 for_each_encoder_on_crtc(dev, crtc, encoder)
3233 intel_crtc_load_lut(crtc);
3238 intel_enable_planes(crtc);
3239 intel_crtc_update_cursor(crtc, true);
3242 ironlake_pch_enable(crtc);
3248 for_each_encoder_on_crtc(dev, crtc, encoder)
3266 static bool hsw_crtc_supports_ips(struct intel_crtc *crtc)
3268 return HAS_IPS(crtc->base.dev) && crtc->pipe == PIPE_A;
3271 static void hsw_enable_ips(struct intel_crtc *crtc)
3273 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
3275 if (!crtc->config.ips_enabled)
3282 assert_plane_enabled(dev_priv, crtc->plane);
3286 static void hsw_disable_ips(struct intel_crtc *crtc)
3288 struct drm_device *dev = crtc->base.dev;
3291 if (!crtc->config.ips_enabled)
3294 assert_plane_enabled(dev_priv, crtc->plane);
3298 intel_wait_for_vblank(dev, crtc->pipe);
3301 static void haswell_crtc_enable(struct drm_crtc *crtc)
3303 struct drm_device *dev = crtc->dev;
3305 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3310 WARN_ON(!crtc->enabled);
3324 dev_priv->display.fdi_link_train(crtc);
3326 for_each_encoder_on_crtc(dev, crtc, encoder)
3338 intel_crtc_load_lut(crtc);
3340 intel_ddi_set_pipe_settings(crtc);
3341 intel_ddi_enable_transcoder_func(crtc);
3346 intel_enable_planes(crtc);
3347 intel_crtc_update_cursor(crtc, true);
3352 lpt_pch_enable(crtc);
3358 for_each_encoder_on_crtc(dev, crtc, encoder)
3372 static void ironlake_pfit_disable(struct intel_crtc *crtc)
3374 struct drm_device *dev = crtc->base.dev;
3376 int pipe = crtc->pipe;
3380 if (crtc->config.pch_pfit.size) {
3387 static void ironlake_crtc_disable(struct drm_crtc *crtc)
3389 struct drm_device *dev = crtc->dev;
3391 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3401 for_each_encoder_on_crtc(dev, crtc, encoder)
3404 intel_crtc_wait_for_pending_flips(crtc);
3410 intel_crtc_update_cursor(crtc, false);
3411 intel_disable_planes(crtc);
3421 for_each_encoder_on_crtc(dev, crtc, encoder)
3426 ironlake_fdi_disable(crtc);
3460 static void haswell_crtc_disable(struct drm_crtc *crtc)
3462 struct drm_device *dev = crtc->dev;
3464 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3473 for_each_encoder_on_crtc(dev, crtc, encoder)
3476 intel_crtc_wait_for_pending_flips(crtc);
3485 intel_crtc_update_cursor(crtc, false);
3486 intel_disable_planes(crtc);
3499 for_each_encoder_on_crtc(dev, crtc, encoder)
3506 intel_ddi_fdi_disable(crtc);
3517 static void ironlake_crtc_off(struct drm_crtc *crtc)
3519 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3523 static void haswell_crtc_off(struct drm_crtc *crtc)
3525 intel_ddi_put_crtc_pll(crtc);
3570 static void i9xx_pfit_enable(struct intel_crtc *crtc)
3572 struct drm_device *dev = crtc->base.dev;
3574 struct intel_crtc_config *pipe_config = &crtc->config;
3576 if (!crtc->config.gmch_pfit.control)
3584 assert_pipe_disabled(dev_priv, crtc->pipe);
3591 I915_WRITE(BCLRPAT(crtc->pipe), 0);
3594 static void valleyview_crtc_enable(struct drm_crtc *crtc)
3596 struct drm_device *dev = crtc->dev;
3598 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3603 WARN_ON(!crtc->enabled);
3613 for_each_encoder_on_crtc(dev, crtc, encoder)
3619 for_each_encoder_on_crtc(dev, crtc, encoder)
3624 for_each_encoder_on_crtc(dev, crtc, encoder)
3629 intel_crtc_load_lut(crtc);
3633 intel_enable_planes(crtc);
3634 intel_crtc_update_cursor(crtc, true);
3641 static void i9xx_crtc_enable(struct drm_crtc *crtc)
3643 struct drm_device *dev = crtc->dev;
3645 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3650 WARN_ON(!crtc->enabled);
3660 for_each_encoder_on_crtc(dev, crtc, encoder)
3666 intel_crtc_load_lut(crtc);
3670 intel_enable_planes(crtc);
3674 intel_crtc_update_cursor(crtc, true);
3681 for_each_encoder_on_crtc(dev, crtc, encoder)
3685 static void i9xx_pfit_disable(struct intel_crtc *crtc)
3687 struct drm_device *dev = crtc->base.dev;
3690 if (!crtc->config.gmch_pfit.control)
3693 assert_pipe_disabled(dev_priv, crtc->pipe);
3700 static void i9xx_crtc_disable(struct drm_crtc *crtc)
3702 struct drm_device *dev = crtc->dev;
3704 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3712 for_each_encoder_on_crtc(dev, crtc, encoder)
3716 intel_crtc_wait_for_pending_flips(crtc);
3723 intel_crtc_update_cursor(crtc, false);
3724 intel_disable_planes(crtc);
3731 for_each_encoder_on_crtc(dev, crtc, encoder)
3742 static void i9xx_crtc_off(struct drm_crtc *crtc)
3746 static void intel_crtc_update_sarea(struct drm_crtc *crtc,
3749 struct drm_device *dev = crtc->dev;
3751 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3763 master_priv->sarea_priv->pipeA_w = enabled ? crtc->mode.hdisplay : 0;
3764 master_priv->sarea_priv->pipeA_h = enabled ? crtc->mode.vdisplay : 0;
3767 master_priv->sarea_priv->pipeB_w = enabled ? crtc->mode.hdisplay : 0;
3768 master_priv->sarea_priv->pipeB_h = enabled ? crtc->mode.vdisplay : 0;
3779 void intel_crtc_update_dpms(struct drm_crtc *crtc)
3781 struct drm_device *dev = crtc->dev;
3786 for_each_encoder_on_crtc(dev, crtc, intel_encoder)
3790 dev_priv->display.crtc_enable(crtc);
3792 dev_priv->display.crtc_disable(crtc);
3794 intel_crtc_update_sarea(crtc, enable);
3797 static void intel_crtc_disable(struct drm_crtc *crtc)
3799 struct drm_device *dev = crtc->dev;
3802 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3804 /* crtc should still be enabled when we disable it. */
3805 WARN_ON(!crtc->enabled);
3807 dev_priv->display.crtc_disable(crtc);
3809 intel_crtc_update_sarea(crtc, false);
3810 dev_priv->display.off(crtc);
3812 assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane);
3813 assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe);
3815 if (crtc->fb) {
3817 intel_unpin_fb_obj(to_intel_framebuffer(crtc->fb)->obj);
3819 crtc->fb = NULL;
3824 if (!connector->encoder || !connector->encoder->crtc)
3827 if (connector->encoder->crtc != crtc)
3837 struct drm_crtc *crtc;
3839 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
3840 if (crtc->enabled)
3841 intel_crtc_disable(crtc);
3861 intel_crtc_update_dpms(encoder->base.crtc);
3865 intel_crtc_update_dpms(encoder->base.crtc);
3875 struct drm_crtc *crtc;
3893 if (!encoder->base.crtc) {
3894 DRM_ERROR("crtc is NULL");
3898 crtc = encoder->base.crtc;
3900 if (!crtc->enabled)
3901 DRM_ERROR("crtc not enabled\n");
3902 if (!to_intel_crtc(crtc)->active)
3903 DRM_ERROR("crtc not active\n");
3904 if (pipe != to_intel_crtc(crtc)->pipe)
3925 if (encoder->base.crtc)
4058 static void hsw_compute_ips_config(struct intel_crtc *crtc,
4062 hsw_crtc_supports_ips(crtc) &&
4066 static int intel_crtc_compute_config(struct intel_crtc *crtc,
4069 struct drm_device *dev = crtc->base.dev;
4080 * that intel_lvds_mode_fixup does some funny tricks with the crtc
4101 hsw_compute_ips_config(crtc, pipe_config);
4106 pipe_config->shared_dpll = crtc->config.shared_dpll;
4109 return ironlake_fdi_compute_config(crtc, pipe_config);
4250 static int vlv_get_refclk(struct drm_crtc *crtc)
4253 struct drm_device *dev = crtc->dev;
4259 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) {
4261 } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
4266 } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) {
4273 static int i9xx_get_refclk(struct drm_crtc *crtc, int num_connectors)
4275 struct drm_device *dev = crtc->dev;
4280 refclk = vlv_get_refclk(crtc);
4281 } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
4305 static void i9xx_update_pll_dividers(struct intel_crtc *crtc,
4308 struct drm_device *dev = crtc->base.dev;
4310 int pipe = crtc->pipe;
4314 fp = pnv_dpll_compute_fp(&crtc->config.dpll);
4318 fp = i9xx_dpll_compute_fp(&crtc->config.dpll);
4325 crtc->lowfreq_avail = false;
4326 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) &&
4329 crtc->lowfreq_avail = true;
4363 static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
4366 struct drm_device *dev = crtc->base.dev;
4368 int pipe = crtc->pipe;
4376 static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
4379 struct drm_device *dev = crtc->base.dev;
4381 int pipe = crtc->pipe;
4382 enum transcoder transcoder = crtc->config.cpu_transcoder;
4397 static void intel_dp_set_m_n(struct intel_crtc *crtc)
4399 if (crtc->config.has_pch_encoder)
4400 intel_pch_transcoder_set_m_n(crtc, &crtc->config.dp_m_n);
4402 intel_cpu_transcoder_set_m_n(crtc, &crtc->config.dp_m_n);
4405 static void vlv_update_pll(struct intel_crtc *crtc)
4407 struct drm_device *dev = crtc->base.dev;
4410 int pipe = crtc->pipe;
4417 bestn = crtc->config.dpll.n;
4418 bestm1 = crtc->config.dpll.m1;
4419 bestm2 = crtc->config.dpll.m2;
4420 bestp1 = crtc->config.dpll.p1;
4421 bestp2 = crtc->config.dpll.p2;
4458 if (crtc->config.port_clock == 162000 ||
4459 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_ANALOG) ||
4460 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI))
4467 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP) ||
4468 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT)) {
4488 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT) ||
4489 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_EDP))
4495 for_each_encoder_on_crtc(dev, &crtc->base, encoder)
4513 dpll_md = (crtc->config.pixel_multiplier - 1)
4518 if (crtc->config.has_dp_encoder)
4519 intel_dp_set_m_n(crtc);
4524 static void i9xx_update_pll(struct intel_crtc *crtc,
4528 struct drm_device *dev = crtc->base.dev;
4531 int pipe = crtc->pipe;
4534 struct dpll *clock = &crtc->config.dpll;
4536 i9xx_update_pll_dividers(crtc, reduced_clock);
4538 is_sdvo = intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_SDVO) ||
4539 intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_HDMI);
4543 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS))
4549 dpll |= (crtc->config.pixel_multiplier - 1)
4556 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DISPLAYPORT))
4584 if (crtc->config.sdvo_tv_clock)
4586 else if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) &&
4597 for_each_encoder_on_crtc(dev, &crtc->base, encoder)
4601 if (crtc->config.has_dp_encoder)
4602 intel_dp_set_m_n(crtc);
4611 u32 dpll_md = (crtc->config.pixel_multiplier - 1)
4624 static void i8xx_update_pll(struct intel_crtc *crtc,
4628 struct drm_device *dev = crtc->base.dev;
4631 int pipe = crtc->pipe;
4633 struct dpll *clock = &crtc->config.dpll;
4635 i9xx_update_pll_dividers(crtc, reduced_clock);
4639 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS)) {
4650 if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) &&
4661 for_each_encoder_on_crtc(dev, &crtc->base, encoder)
4743 static void intel_get_pipe_timings(struct intel_crtc *crtc,
4746 struct drm_device *dev = crtc->base.dev;
4777 tmp = I915_READ(PIPESRC(crtc->pipe));
4847 static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
4851 struct drm_device *dev = crtc->dev;
4853 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4866 for_each_encoder_on_crtc(dev, crtc, encoder) {
4876 refclk = i9xx_get_refclk(crtc, num_connectors);
4883 limit = intel_limit(crtc, refclk);
4884 ok = dev_priv->display.find_dpll(limit, crtc,
4893 intel_crtc_update_cursor(crtc, true);
4903 dev_priv->display.find_dpll(limit, crtc,
4953 ret = intel_pipe_set_base(crtc, x, y, fb);
4960 static void i9xx_get_pfit_config(struct intel_crtc *crtc,
4963 struct drm_device *dev = crtc->base.dev;
4973 if (crtc->pipe != PIPE_B)
4976 if ((tmp & PFIT_PIPE_MASK) != (crtc->pipe << PFIT_PIPE_SHIFT))
4987 static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
4990 struct drm_device *dev = crtc->base.dev;
4994 pipe_config->cpu_transcoder = (enum transcoder)crtc->pipe;
4997 tmp = I915_READ(PIPECONF(crtc->pipe));
5001 intel_get_pipe_timings(crtc, pipe_config);
5003 i9xx_get_pfit_config(crtc, pipe_config);
5006 tmp = I915_READ(DPLL_MD(crtc->pipe));
5011 tmp = I915_READ(DPLL(crtc->pipe));
5347 static int ironlake_get_refclk(struct drm_crtc *crtc)
5349 struct drm_device *dev = crtc->dev;
5355 for_each_encoder_on_crtc(dev, crtc, encoder) {
5373 static void ironlake_set_pipeconf(struct drm_crtc *crtc)
5375 struct drm_i915_private *dev_priv = crtc->dev->dev_private;
5376 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5422 static void intel_set_pipe_csc(struct drm_crtc *crtc)
5424 struct drm_device *dev = crtc->dev;
5426 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5479 static void haswell_set_pipeconf(struct drm_crtc *crtc)
5481 struct drm_i915_private *dev_priv = crtc->dev->dev_private;
5482 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5503 static bool ironlake_compute_clocks(struct drm_crtc *crtc,
5508 struct drm_device *dev = crtc->dev;
5515 for_each_encoder_on_crtc(dev, crtc, intel_encoder) {
5523 refclk = ironlake_get_refclk(crtc);
5530 limit = intel_limit(crtc, refclk);
5531 ret = dev_priv->display.find_dpll(limit, crtc,
5532 to_intel_crtc(crtc)->config.port_clock,
5545 dev_priv->display.find_dpll(limit, crtc,
5617 struct drm_crtc *crtc = &intel_crtc->base;
5618 struct drm_device *dev = crtc->dev;
5625 for_each_encoder_on_crtc(dev, crtc, intel_encoder) {
5698 static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5702 struct drm_device *dev = crtc->dev;
5704 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5716 for_each_encoder_on_crtc(dev, crtc, encoder) {
5729 ok = ironlake_compute_clocks(crtc, &clock,
5745 intel_crtc_update_cursor(crtc, true);
5776 for_each_encoder_on_crtc(dev, crtc, encoder)
5824 ironlake_set_pipeconf(crtc);
5830 ret = intel_pipe_set_base(crtc, x, y, fb);
5837 static void ironlake_get_fdi_m_n_config(struct intel_crtc *crtc,
5840 struct drm_device *dev = crtc->base.dev;
5853 static void ironlake_get_pfit_config(struct intel_crtc *crtc,
5856 struct drm_device *dev = crtc->base.dev;
5860 tmp = I915_READ(PF_CTL(crtc->pipe));
5863 pipe_config->pch_pfit.pos = I915_READ(PF_WIN_POS(crtc->pipe));
5864 pipe_config->pch_pfit.size = I915_READ(PF_WIN_SZ(crtc->pipe));
5871 PF_PIPE_SEL_IVB(crtc->pipe));
5872 DRM_DEBUG("PF_CTL(crtc->pipe) 0x%x", tmp);
5877 static bool ironlake_get_pipe_config(struct intel_crtc *crtc,
5880 struct drm_device *dev = crtc->base.dev;
5884 pipe_config->cpu_transcoder = (enum transcoder)crtc->pipe;
5887 tmp = I915_READ(PIPECONF(crtc->pipe));
5891 if (I915_READ(PCH_TRANSCONF(crtc->pipe)) & TRANS_ENABLE) {
5897 tmp = I915_READ(FDI_RX_CTL(crtc->pipe));
5901 ironlake_get_fdi_m_n_config(crtc, pipe_config);
5908 pipe_config->shared_dpll = (enum intel_dpll_id)crtc->pipe;
5911 if (tmp & TRANS_DPLLB_SEL(crtc->pipe))
5925 intel_get_pipe_timings(crtc, pipe_config);
5927 ironlake_get_pfit_config(crtc, pipe_config);
5935 struct intel_crtc *crtc;
5937 list_for_each_entry(crtc, struct intel_crtc, &dev->mode_config.crtc_list, base.head) {
5938 if (!crtc->base.enabled)
5941 if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.size ||
5942 crtc->config.cpu_transcoder != TRANSCODER_EDP)
5949 static int haswell_crtc_mode_set(struct drm_crtc *crtc,
5953 struct drm_device *dev = crtc->dev;
5955 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5959 if (!intel_ddi_pll_mode_set(crtc))
5963 intel_crtc_update_cursor(crtc, true);
5977 haswell_set_pipeconf(crtc);
5979 intel_set_pipe_csc(crtc);
5985 ret = intel_pipe_set_base(crtc, x, y, fb);
5992 static bool haswell_get_pipe_config(struct intel_crtc *crtc,
5995 struct drm_device *dev = crtc->base.dev;
6000 pipe_config->cpu_transcoder = (enum transcoder)crtc->pipe;
6021 if (trans_edp_pipe == crtc->pipe)
6047 ironlake_get_fdi_m_n_config(crtc, pipe_config);
6050 intel_get_pipe_timings(crtc, pipe_config);
6052 pfit_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
6054 ironlake_get_pfit_config(crtc, pipe_config);
6056 pipe_config->ips_enabled = hsw_crtc_supports_ips(crtc) &&
6064 static int intel_crtc_mode_set(struct drm_crtc *crtc,
6068 struct drm_device *dev = crtc->dev;
6072 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6081 ret = dev_priv->display.crtc_mode_set(crtc, x, y, fb);
6088 for_each_encoder_on_crtc(dev, crtc, encoder) {
6134 struct drm_crtc *crtc)
6174 struct drm_crtc *crtc)
6178 struct drm_device *dev = crtc->dev;
6179 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6183 int pipe = to_intel_crtc(crtc)->pipe;
6223 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
6261 struct drm_crtc *crtc)
6272 int pipe = to_intel_crtc(crtc)->pipe;
6301 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
6338 struct drm_crtc *crtc = encoder->crtc;
6356 dev_priv->display.write_eld(connector, crtc);
6360 void intel_crtc_load_lut(struct drm_crtc *crtc)
6362 struct drm_device *dev = crtc->dev;
6364 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6371 if (!crtc->enabled || !intel_crtc->active)
6402 static void i845_update_cursor(struct drm_crtc *crtc, u32 base)
6404 struct drm_device *dev = crtc->dev;
6406 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6432 static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
6434 struct drm_device *dev = crtc->dev;
6436 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6458 static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
6460 struct drm_device *dev = crtc->dev;
6462 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6486 static void intel_crtc_update_cursor(struct drm_crtc *crtc,
6489 struct drm_device *dev = crtc->dev;
6491 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6500 if (on && crtc->enabled && crtc->fb) {
6502 if (x > (int) crtc->fb->width)
6505 if (y > (int) crtc->fb->height)
6534 ivb_update_cursor(crtc, base);
6538 i845_update_cursor(crtc, base);
6540 i9xx_update_cursor(crtc, base);
6544 static int intel_crtc_cursor_set(struct drm_crtc *crtc,
6549 struct drm_device *dev = crtc->dev;
6551 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6647 intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL);
6659 static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
6661 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6666 intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL);
6672 void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
6675 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6682 void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
6685 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6692 static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
6696 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6704 intel_crtc_load_lut(crtc);
6810 struct drm_crtc *crtc = NULL;
6822 * - if the connector already has an assigned crtc, use it (but make
6825 * - try to find the first unused crtc that can drive this connector,
6830 if (encoder->crtc) {
6831 crtc = encoder->crtc;
6833 mutex_lock(&crtc->mutex);
6835 /* Make sure the crtc and connector are running */
6839 /* Make sure the crtc and connector are running */
6852 crtc = possible_crtc;
6860 if (!crtc) {
6865 mutex_lock(&crtc->mutex);
6866 intel_encoder->new_crtc = to_intel_crtc(crtc);
6869 intel_crtc = to_intel_crtc(crtc);
6893 mutex_unlock(&crtc->mutex);
6897 if (intel_set_mode(crtc, mode, 0, 0, fb)) {
6901 mutex_unlock(&crtc->mutex);
6916 struct drm_crtc *crtc = encoder->crtc;
6925 intel_set_mode(crtc, NULL, 0, 0, NULL);
6932 mutex_unlock(&crtc->mutex);
6936 /* Switch crtc and encoder back off if necessary */
6940 mutex_unlock(&crtc->mutex);
6944 static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
6947 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7034 struct drm_crtc *crtc)
7037 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7049 mode->clock = intel_crtc_clock_get(dev, crtc);
7064 void intel_increase_pllclock(struct drm_crtc *crtc)
7066 struct drm_device *dev = crtc->dev;
7068 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7095 static void intel_decrease_pllclock(struct drm_crtc *crtc)
7097 struct drm_device *dev = crtc->dev;
7099 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7137 struct drm_crtc *crtc;
7142 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
7143 if (!crtc->fb)
7146 intel_decrease_pllclock(crtc);
7154 struct drm_crtc *crtc;
7159 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
7160 if (!crtc->fb)
7163 if (to_intel_framebuffer(crtc->fb)->obj != obj)
7166 intel_increase_pllclock(crtc);
7172 static void intel_crtc_destroy(struct drm_crtc *crtc)
7174 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7175 struct drm_device *dev = crtc->dev;
7190 intel_crtc_cursor_set(crtc, NULL, 0, 0, 0);
7192 drm_crtc_cleanup(crtc);
7202 struct drm_device *dev = work->crtc->dev;
7212 BUG_ON(atomic_read(&to_intel_crtc(work->crtc)->unpin_work_count) == 0);
7213 atomic_dec(&to_intel_crtc(work->crtc)->unpin_work_count);
7218 struct drm_crtc *crtc)
7221 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7256 struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
7258 do_intel_finish_page_flip(dev, crtc);
7264 struct drm_crtc *crtc = dev_priv->plane_to_crtc_mapping[plane];
7266 do_intel_finish_page_flip(dev, crtc);
7296 struct drm_crtc *crtc,
7301 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7340 struct drm_crtc *crtc,
7345 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7381 struct drm_crtc *crtc,
7386 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7429 struct drm_crtc *crtc,
7434 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7479 struct drm_crtc *crtc,
7484 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7529 struct drm_crtc *crtc,
7536 static int intel_crtc_page_flip(struct drm_crtc *crtc,
7540 struct drm_device *dev = crtc->dev;
7542 struct drm_framebuffer *old_fb = crtc->fb;
7544 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7550 if (fb->pixel_format != crtc->fb->pixel_format)
7558 (fb->offsets[0] != crtc->fb->offsets[0] ||
7559 fb->pitches[0] != crtc->fb->pitches[0]))
7567 work->crtc = crtc;
7582 DRM_DEBUG_DRIVER("flip queue: crtc already busy\n");
7597 crtc->fb = fb;
7605 ret = dev_priv->display.queue_flip(dev, crtc, fb, obj);
7617 crtc->fb = old_fb;
7640 struct drm_crtc *crtc)
7646 ASSERT(crtc);
7648 dev = crtc->dev;
7651 if (tmp == crtc)
7681 to_intel_crtc(encoder->base.crtc);
7702 encoder->base.crtc = &encoder->new_crtc->base;
7733 compute_baseline_pipe_bpp(struct intel_crtc *crtc,
7737 struct drm_device *dev = crtc->base.dev;
7783 connector->new_encoder->new_crtc != crtc)
7792 static void intel_dump_pipe_config(struct intel_crtc *crtc,
7796 DRM_DEBUG_KMS("[CRTC:%d]%s config for pipe %c\n", crtc->base.base.id,
7797 context, pipe_name(crtc->pipe));
7822 static bool check_encoder_cloning(struct drm_crtc *crtc)
7828 list_for_each_entry(encoder, struct intel_encoder, &crtc->dev->mode_config.encoder_list,
7830 if (&encoder->new_crtc->base != crtc)
7842 intel_modeset_pipe_config(struct drm_crtc *crtc,
7846 struct drm_device *dev = crtc->dev;
7853 if (!check_encoder_cloning(crtc)) {
7864 pipe_config->cpu_transcoder = (enum transcoder)to_intel_crtc(crtc)->pipe;
7870 * after encoders and crtc also have had their say. */
7871 plane_bpp = compute_baseline_pipe_bpp(to_intel_crtc(crtc),
7888 if (&encoder->new_crtc->base != crtc)
7914 ret = intel_crtc_compute_config(to_intel_crtc(crtc), pipe_config);
7943 * simplicity we use the crtc's pipe number (because it's easier to obtain). */
7945 intel_modeset_affected_pipes(struct drm_crtc *crtc, unsigned *modeset_pipes,
7949 struct drm_device *dev = crtc->dev;
7966 tmp_crtc = connector->base.encoder->crtc;
7978 if (encoder->base.crtc == &encoder->new_crtc->base)
7981 if (encoder->base.crtc) {
7982 tmp_crtc = encoder->base.crtc;
8012 intel_crtc = to_intel_crtc(crtc);
8013 if (crtc->enabled)
8040 static bool intel_crtc_in_use(struct drm_crtc *crtc)
8043 struct drm_device *dev = crtc->dev;
8046 if (encoder->crtc == crtc)
8061 if (!intel_encoder->base.crtc)
8064 intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
8079 if (!connector->encoder || !connector->encoder->crtc)
8082 intel_crtc = to_intel_crtc(connector->encoder->crtc);
8240 if (&encoder->new_crtc->base != encoder->base.crtc)
8241 DRM_ERROR("encoder's stage crtc doesn't match current crtc\n");
8242 if (encoder->connectors_active && !encoder->base.crtc)
8243 DRM_ERROR("encoder's active_connectors set, but no crtc\n");
8253 if (!!encoder->base.crtc != enabled)
8256 !!encoder->base.crtc, enabled);
8257 if (active && !encoder->base.crtc)
8258 DRM_ERROR("active encoder with no crtc\n");
8270 if (!encoder->base.crtc)
8273 tracked_pipe = to_intel_crtc(encoder->base.crtc)->pipe;
8286 struct intel_crtc *crtc;
8290 list_for_each_entry(crtc, struct intel_crtc, &dev->mode_config.crtc_list,
8298 crtc->base.base.id);
8300 if (crtc->active && !crtc->base.enabled)
8301 DRM_ERROR("active crtc, but not enabled in sw tracking\n");
8305 if (encoder->base.crtc != &crtc->base)
8312 if (active != crtc->active)
8313 DRM_ERROR("crtc's computed active state doesn't match tracked active state "
8314 "(expected %i, found %i)\n", active, crtc->active);
8315 if (enabled != crtc->base.enabled)
8316 DRM_ERROR("crtc's computed enabled state doesn't match tracked enabled state "
8317 "(expected %i, found %i)\n", enabled, crtc->base.enabled);
8319 active = dev_priv->display.get_pipe_config(crtc,
8323 if (crtc->pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
8324 active = crtc->active;
8329 if (encoder->base.crtc != &crtc->base)
8336 if(crtc->active != active)
8337 DRM_ERROR("crtc active state doesn't match with hw state "
8338 "(expected %i, found %i)\n", crtc->active, active);
8341 !intel_pipe_config_compare(dev, &crtc->config, &pipe_config)) {
8343 intel_dump_pipe_config(crtc, &pipe_config,
8345 intel_dump_pipe_config(crtc, &crtc->config,
8355 struct intel_crtc *crtc;
8381 list_for_each_entry(crtc, struct intel_crtc, &dev->mode_config.crtc_list,
8383 if (crtc->base.enabled && intel_crtc_to_shared_dpll(crtc) == pll)
8385 if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll)
8410 static int __intel_set_mode(struct drm_crtc *crtc,
8414 struct drm_device *dev = crtc->dev;
8427 intel_modeset_affected_pipes(crtc, &modeset_pipes,
8430 *saved_hwmode = crtc->hwmode;
8431 *saved_mode = crtc->mode;
8434 * crtcs, we don't keep track of the new mode for more than one crtc.
8439 pipe_config = intel_modeset_pipe_config(crtc, fb, mode);
8446 intel_dump_pipe_config(to_intel_crtc(crtc), pipe_config,
8458 /* crtc->mode is already used by the ->mode_set callbacks, hence we need
8462 crtc->mode = *mode;
8465 to_intel_crtc(crtc)->config = *pipe_config;
8491 crtc->hwmode = pipe_config->adjusted_mode;
8497 drm_calc_timestamping_constants(crtc);
8502 if (ret && crtc->enabled) {
8503 crtc->hwmode = *saved_hwmode;
8504 crtc->mode = *saved_mode;
8514 int intel_set_mode(struct drm_crtc *crtc,
8520 ret = __intel_set_mode(crtc, mode, x, y, fb);
8523 intel_modeset_check_state(crtc->dev);
8528 void intel_crtc_restore_mode(struct drm_crtc *crtc)
8530 intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb);
8570 config->save_encoder_crtcs[count++] = encoder->crtc;
8614 set->connectors[i]->encoder->crtc == set->crtc &&
8630 } else if (set->crtc->fb != set->fb) {
8632 if (set->crtc->fb == NULL) {
8633 DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
8638 set->crtc->fb->pixel_format) {
8645 if (set->fb && (set->x != set->crtc->x || set->y != set->crtc->y))
8648 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
8650 drm_mode_debug_printmodeline(&set->crtc->mode);
8667 /* The upper layers ensure that we either disabl a crtc or have a list
8684 /* If we disable the crtc, disable all its connectors. Also, if
8685 * the connector is on the changing crtc but not on the new
8689 connector->base.encoder->crtc == set->crtc) {
8705 /* Update crtc of enabled connectors. */
8712 new_crtc = connector->new_encoder->base.crtc;
8716 new_crtc = set->crtc;
8746 /* Only now check for crtc changes so we don't miss encoders
8748 if (&encoder->new_crtc->base != encoder->base.crtc) {
8749 DRM_DEBUG_KMS("crtc changed, full mode switch\n");
8766 BUG_ON(!set->crtc);
8767 BUG_ON(!set->crtc->helper_private);
8775 set->crtc->base.id, set->fb->base.id,
8778 DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id);
8781 dev = set->crtc->dev;
8792 save_set.crtc = set->crtc;
8793 save_set.mode = &set->crtc->mode;
8794 save_set.x = set->crtc->x;
8795 save_set.y = set->crtc->y;
8796 save_set.fb = set->crtc->fb;
8815 ret = intel_set_mode(set->crtc, set->mode,
8818 intel_crtc_wait_for_pending_flips(set->crtc);
8820 ret = intel_pipe_set_base(set->crtc,
8826 set->crtc->base.id, ret);
8832 intel_set_mode(save_set.crtc, save_set.mode,
8891 struct intel_crtc *crtc;
8895 list_for_each_entry(crtc, struct intel_crtc, &dev->mode_config.crtc_list, base.head) {
8896 if (intel_crtc_to_shared_dpll(crtc) == pll)
8897 assert_pch_transcoder_disabled(dev_priv, crtc->pipe);
8984 struct intel_crtc *crtc;
8997 crtc = to_intel_crtc(obj_to_crtc(drmmode_obj));
8998 pipe_from_crtc_id->pipe = crtc->pipe;
9679 connector->encoder->base.crtc = NULL;
9710 intel_check_plane_mapping(struct intel_crtc *crtc)
9712 struct drm_device *dev = crtc->base.dev;
9719 reg = DSPCNTR(!crtc->plane);
9723 (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe))
9729 static void intel_sanitize_crtc(struct intel_crtc *crtc)
9731 struct drm_device *dev = crtc->base.dev;
9736 reg = PIPECONF(crtc->config.cpu_transcoder);
9740 * disable the crtc (and hence change the state) if it is wrong. Note
9742 if (INTEL_INFO(dev)->gen < 4 && !intel_check_plane_mapping(crtc)) {
9747 crtc->base.base.id);
9752 plane = crtc->plane;
9753 crtc->plane = !plane;
9754 dev_priv->display.crtc_disable(&crtc->base);
9755 crtc->plane = plane;
9760 if (connector->encoder->base.crtc != &crtc->base)
9766 WARN_ON(crtc->active);
9767 crtc->base.enabled = false;
9771 crtc->pipe == PIPE_A && !crtc->active) {
9781 intel_crtc_update_dpms(&crtc->base);
9783 if (crtc->active != crtc->base.enabled) {
9790 crtc->base.base.id,
9791 crtc->base.enabled ? "enabled" : "disabled",
9792 crtc->active ? "enabled" : "disabled");
9794 crtc->base.enabled = crtc->active;
9797 * crtc links if something is active, this means the
9798 * crtc is now deactivated. Break the links. connector
9801 WARN_ON(crtc->active);
9803 for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
9805 encoder->base.crtc = NULL;
9815 /* We need to check both for a crtc link (meaning that the
9818 bool has_active_crtc = encoder->base.crtc &&
9819 to_intel_crtc(encoder->base.crtc)->active;
9829 if (encoder->base.crtc) {
9850 * the crtc fixup. */
9868 struct intel_crtc *crtc;
9873 list_for_each_entry(crtc, struct intel_crtc, &dev->mode_config.crtc_list,
9875 (void) memset(&crtc->config, 0, sizeof(crtc->config));
9877 crtc->active = dev_priv->display.get_pipe_config(crtc,
9878 &crtc->config);
9880 crtc->base.enabled = crtc->active;
9883 crtc->base.base.id,
9884 crtc->active ? "enabled" : "disabled");
9896 list_for_each_entry(crtc, struct intel_crtc, &dev->mode_config.crtc_list,
9898 if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll)
9912 crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
9913 encoder->base.crtc = &crtc->base;
9915 encoder->get_config(encoder, &crtc->config);
9917 encoder->base.crtc = NULL;
9924 encoder->base.crtc ? "enabled" : "disabled",
9953 struct intel_crtc *crtc;
9966 crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
9967 intel_sanitize_crtc(crtc);
9968 intel_dump_pipe_config(crtc, &crtc->config, "[setup_hw_state]");
9989 struct drm_crtc *crtc =
9992 __intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y,
9993 crtc->fb);
10020 struct drm_crtc *crtc;
10039 list_for_each_entry(crtc, struct drm_crtc, &dev->mode_config.crtc_list, head) {
10041 if (!crtc->fb)
10044 intel_crtc = to_intel_crtc(crtc);
10045 intel_increase_pllclock(crtc);