- skl watermarks code (Damien, Vandana, Pradeep) - reworked audio codec /eld handling code (Jani) - rework the mmio_flip code to use the vblank evade logic and wait for rendering using the standard wait_seqno interface (Ander) - skl forcewake support (Zhe Wang) - refactor the chv interrupt code to use functions shared with vlv (Ville) - prep work for different global gtt views (Tvrtko Ursulin) - precompute the display PLL config before touching hw state (Ander) - completely reworked panel power sequencer code for chv/vlv (Ville) - pre work to split the plane update code into a prepare and commit phase (Gustavo Padovan) - golden context for skl (Armin Reese) - as usual tons of fixes and improvements all over * tag 'drm-intel-next-2014-11-07-fixups' of git://anongit.freedesktop.org/drm-intel: (135 commits) drm/i915: Use correct pipe config to update pll dividers. V2 drm/i915: Plug memory leak in intel_shared_dpll_start_config() drm/i915: Update DRIVER_DATE to 20141107 drm/i915: Add gen to the gpu hang ecode drm/i915: Cache HPLL frequency on VLV/CHV Revert "drm/i915/vlv: Remove check for Old Ack during forcewake" drm/i915: Make mmio flip wait for seqno in the work function drm/i915: Make __wait_seqno non-static and rename to __i915_wait_seqno drm/i915: Move the .global_resources() hook call into modeset_update_crtc_power_domains() drm/i915/audio: add DOC comment describing HDA over HDMI/DP drm/i915: make pipe/port based audio valid accessors easier to use drm/i915/audio: add audio codec enable debug log for g4x drm/i915/audio: add audio codec disable on g4x drm/i915: enable audio codec after port drm/i915/audio: add vlv/chv/gen5-7 audio codec disable sequence drm/i915/audio: rewrite vlv/chv and gen 5-7 audio codec enable sequence drm/i915/skl: Enable Gen9 RC6 drm/i915/skl: Gen9 Forcewake drm/i915/skl: Log the order in which we flush the pipes in the WM code drm/i915/skl: Flush the WM configuration ...
Unified · Split
| @@ -3887,6 +3887,11 @@ int num_ioctls;</synopsis> · 3886 unmodified lines | |||
| 3887 | probing, so those sections fully apply. | 3887 | probing, so those sections fully apply. |
| 3888 | </para> | 3888 | </para> |
| 3889 | </sect2> | 3889 | </sect2> |
| 3890 | <sect2> | ||
| 3891 | <title>High Definition Audio</title> | ||
| 3892 | !Pdrivers/gpu/drm/i915/intel_audio.c High Definition Audio over HDMI and Display Port | ||
| 3893 | !Idrivers/gpu/drm/i915/intel_audio.c | ||
| 3894 | </sect2> | ||
| 3890 | <sect2> | 3895 | <sect2> |
| 3891 | <title>DPIO</title> | 3896 | <title>DPIO</title> |
| 3892 | !Pdrivers/gpu/drm/i915/i915_reg.h DPIO | 3897 | !Pdrivers/gpu/drm/i915/i915_reg.h DPIO |
| @@ -155,6 +155,11 @@ int drm_plane_helper_check_update(struct drm_plane *plane, · 154 unmodified lines | |||
| 155 | return -ERANGE; | 155 | return -ERANGE; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | if (!fb) { | ||
| 159 | *visible = false; | ||
| 160 | return 0; | ||
| 161 | } | ||
| 162 | |||
| 158 | *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale); | 163 | *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale); |
| 159 | if (!*visible) | 164 | if (!*visible) |
| 160 | /* | 165 | /* |
| @@ -40,10 +40,12 @@ i915-y += i915_cmd_parser.o \ · 39 unmodified lines | |||
| 40 | # autogenerated null render state | 40 | # autogenerated null render state |
| 41 | i915-y += intel_renderstate_gen6.o \ | 41 | i915-y += intel_renderstate_gen6.o \ |
| 42 | intel_renderstate_gen7.o \ | 42 | intel_renderstate_gen7.o \ |
| 43 | intel_renderstate_gen8.o | 43 | intel_renderstate_gen8.o \ |
| 44 | intel_renderstate_gen9.o | ||
| 44 | 45 | ||
| 45 | # modesetting core code | 46 | # modesetting core code |
| 46 | i915-y += intel_bios.o \ | 47 | i915-y += intel_audio.o \ |
| 48 | intel_bios.o \ | ||
| 47 | intel_display.o \ | 49 | intel_display.o \ |
| 48 | intel_fifo_underrun.o \ | 50 | intel_fifo_underrun.o \ |
| 49 | intel_frontbuffer.o \ | 51 | intel_frontbuffer.o \ |
| @@ -138,6 +138,11 @@ static const struct drm_i915_cmd_descriptor common_cmds[] = { · 137 unmodified lines | |||
| 138 | .mask = MI_GLOBAL_GTT, | 138 | .mask = MI_GLOBAL_GTT, |
| 139 | .expected = 0, | 139 | .expected = 0, |
| 140 | }}, ), | 140 | }}, ), |
| 141 | /* | ||
| 142 | * MI_BATCH_BUFFER_START requires some special handling. It's not | ||
| 143 | * really a 'skip' action but it doesn't seem like it's worth adding | ||
| 144 | * a new action. See i915_parse_cmds(). | ||
| 145 | */ | ||
| 141 | CMD( MI_BATCH_BUFFER_START, SMI, !F, 0xFF, S ), | 146 | CMD( MI_BATCH_BUFFER_START, SMI, !F, 0xFF, S ), |
| 142 | }; | 147 | }; |
| 143 | 148 | ||
| @@ -955,7 +960,8 @@ static bool check_cmd(const struct intel_engine_cs *ring, · 811 unmodified lines | |||
| 955 | * Parses the specified batch buffer looking for privilege violations as | 960 | * Parses the specified batch buffer looking for privilege violations as |
| 956 | * described in the overview. | 961 | * described in the overview. |
| 957 | * | 962 | * |
| 958 | * Return: non-zero if the parser finds violations or otherwise fails | 963 | * Return: non-zero if the parser finds violations or otherwise fails; -EACCES |
| 964 | * if the batch appears legal but should use hardware parsing | ||
| 959 | */ | 965 | */ |
| 960 | int i915_parse_cmds(struct intel_engine_cs *ring, | 966 | int i915_parse_cmds(struct intel_engine_cs *ring, |
| 961 | struct drm_i915_gem_object *batch_obj, | 967 | struct drm_i915_gem_object *batch_obj, |
| @@ -1002,6 +1008,16 @@ int i915_parse_cmds(struct intel_engine_cs *ring, · 40 unmodified lines | |||
| 1002 | break; | 1008 | break; |
| 1003 | } | 1009 | } |
| 1004 | 1010 | ||
| 1011 | /* | ||
| 1012 | * If the batch buffer contains a chained batch, return an | ||
| 1013 | * error that tells the caller to abort and dispatch the | ||
| 1014 | * workload as a non-secure batch. | ||
| 1015 | */ | ||
| 1016 | if (desc->cmd.value == MI_BATCH_BUFFER_START) { | ||
| 1017 | ret = -EACCES; | ||
| 1018 | break; | ||
| 1019 | } | ||
| 1020 | |||
| 1005 | if (desc->flags & CMD_DESC_FIXED) | 1021 | if (desc->flags & CMD_DESC_FIXED) |
| 1006 | length = desc->length.fixed; | 1022 | length = desc->length.fixed; |
| 1007 | else | 1023 | else |
| @@ -116,7 +116,7 @@ static const char *get_tiling_flag(struct drm_i915_gem_object *obj) · 115 unmodified lines | |||
| 116 | 116 | ||
| 117 | static inline const char *get_global_flag(struct drm_i915_gem_object *obj) | 117 | static inline const char *get_global_flag(struct drm_i915_gem_object *obj) |
| 118 | { | 118 | { |
| 119 | return obj->has_global_gtt_mapping ? "g" : " "; | 119 | return i915_gem_obj_to_ggtt(obj) ? "g" : " "; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | static void | 122 | static void |
| @@ -2630,14 +2630,15 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused) · 2507 unmodified lines | |||
| 2630 | struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; | 2630 | struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; |
| 2631 | 2631 | ||
| 2632 | seq_printf(m, "DPLL%i: %s, id: %i\n", i, pll->name, pll->id); | 2632 | seq_printf(m, "DPLL%i: %s, id: %i\n", i, pll->name, pll->id); |
| 2633 | seq_printf(m, " refcount: %i, active: %i, on: %s\n", pll->refcount, | 2633 | seq_printf(m, " crtc_mask: 0x%08x, active: %d, on: %s\n", |
| 2634 | pll->active, yesno(pll->on)); | 2634 | pll->config.crtc_mask, pll->active, yesno(pll->on)); |
| 2635 | seq_printf(m, " tracked hardware state:\n"); | 2635 | seq_printf(m, " tracked hardware state:\n"); |
| 2636 | seq_printf(m, " dpll: 0x%08x\n", pll->hw_state.dpll); | 2636 | seq_printf(m, " dpll: 0x%08x\n", pll->config.hw_state.dpll); |
| 2637 | seq_printf(m, " dpll_md: 0x%08x\n", pll->hw_state.dpll_md); | 2637 | seq_printf(m, " dpll_md: 0x%08x\n", |
| 2638 | seq_printf(m, " fp0: 0x%08x\n", pll->hw_state.fp0); | 2638 | pll->config.hw_state.dpll_md); |
| 2639 | seq_printf(m, " fp1: 0x%08x\n", pll->hw_state.fp1); | 2639 | seq_printf(m, " fp0: 0x%08x\n", pll->config.hw_state.fp0); |
| 2640 | seq_printf(m, " wrpll: 0x%08x\n", pll->hw_state.wrpll); | 2640 | seq_printf(m, " fp1: 0x%08x\n", pll->config.hw_state.fp1); |
| 2641 | seq_printf(m, " wrpll: 0x%08x\n", pll->config.hw_state.wrpll); | ||
| 2641 | } | 2642 | } |
| 2642 | drm_modeset_unlock_all(dev); | 2643 | drm_modeset_unlock_all(dev); |
| 2643 | 2644 | ||
| @@ -2678,6 +2679,42 @@ static int i915_wa_registers(struct seq_file *m, void *unused) · 34 unmodified lines | |||
| 2678 | return 0; | 2679 | return 0; |
| 2679 | } | 2680 | } |
| 2680 | 2681 | ||
| 2682 | static int i915_ddb_info(struct seq_file *m, void *unused) | ||
| 2683 | { | ||
| 2684 | struct drm_info_node *node = m->private; | ||
| 2685 | struct drm_device *dev = node->minor->dev; | ||
| 2686 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 2687 | struct skl_ddb_allocation *ddb; | ||
| 2688 | struct skl_ddb_entry *entry; | ||
| 2689 | enum pipe pipe; | ||
| 2690 | int plane; | ||
| 2691 | |||
| 2692 | drm_modeset_lock_all(dev); | ||
| 2693 | |||
| 2694 | ddb = &dev_priv->wm.skl_hw.ddb; | ||
| 2695 | |||
| 2696 | seq_printf(m, "%-15s%8s%8s%8s\n", "", "Start", "End", "Size"); | ||
| 2697 | |||
| 2698 | for_each_pipe(dev_priv, pipe) { | ||
| 2699 | seq_printf(m, "Pipe %c\n", pipe_name(pipe)); | ||
| 2700 | |||
| 2701 | for_each_plane(pipe, plane) { | ||
| 2702 | entry = &ddb->plane[pipe][plane]; | ||
| 2703 | seq_printf(m, " Plane%-8d%8u%8u%8u\n", plane + 1, | ||
| 2704 | entry->start, entry->end, | ||
| 2705 | skl_ddb_entry_size(entry)); | ||
| 2706 | } | ||
| 2707 | |||
| 2708 | entry = &ddb->cursor[pipe]; | ||
| 2709 | seq_printf(m, " %-13s%8u%8u%8u\n", "Cursor", entry->start, | ||
| 2710 | entry->end, skl_ddb_entry_size(entry)); | ||
| 2711 | } | ||
| 2712 | |||
| 2713 | drm_modeset_unlock_all(dev); | ||
| 2714 | |||
| 2715 | return 0; | ||
| 2716 | } | ||
| 2717 | |||
| 2681 | struct pipe_crc_info { | 2718 | struct pipe_crc_info { |
| 2682 | const char *name; | 2719 | const char *name; |
| 2683 | struct drm_device *dev; | 2720 | struct drm_device *dev; |
| @@ -2971,6 +3008,8 @@ static int i9xx_pipe_crc_auto_source(struct drm_device *dev, enum pipe pipe, · 287 unmodified lines | |||
| 2971 | break; | 3008 | break; |
| 2972 | } | 3009 | } |
| 2973 | break; | 3010 | break; |
| 3011 | default: | ||
| 3012 | break; | ||
| 2974 | } | 3013 | } |
| 2975 | } | 3014 | } |
| 2976 | drm_modeset_unlock_all(dev); | 3015 | drm_modeset_unlock_all(dev); |
| @@ -3520,7 +3559,7 @@ static const struct file_operations i915_display_crc_ctl_fops = { · 543 unmodified lines | |||
| 3520 | .write = display_crc_ctl_write | 3559 | .write = display_crc_ctl_write |
| 3521 | }; | 3560 | }; |
| 3522 | 3561 | ||
| 3523 | static void wm_latency_show(struct seq_file *m, const uint16_t wm[5]) | 3562 | static void wm_latency_show(struct seq_file *m, const uint16_t wm[8]) |
| 3524 | { | 3563 | { |
| 3525 | struct drm_device *dev = m->private; | 3564 | struct drm_device *dev = m->private; |
| 3526 | int num_levels = ilk_wm_max_level(dev) + 1; | 3565 | int num_levels = ilk_wm_max_level(dev) + 1; |
| @@ -3531,13 +3570,17 @@ static void wm_latency_show(struct seq_file *m, const uint16_t wm[5]) · 4 unmodified lines | |||
| 3531 | for (level = 0; level < num_levels; level++) { | 3570 | for (level = 0; level < num_levels; level++) { |
| 3532 | unsigned int latency = wm[level]; | 3571 | unsigned int latency = wm[level]; |
| 3533 | 3572 | ||
| 3534 | /* WM1+ latency values in 0.5us units */ | 3573 | /* |
| 3535 | if (level > 0) | 3574 | * - WM1+ latency values in 0.5us units |
| 3575 | * - latencies are in us on gen9 | ||
| 3576 | */ | ||
| 3577 | if (INTEL_INFO(dev)->gen >= 9) | ||
| 3578 | latency *= 10; | ||
| 3579 | else if (level > 0) | ||
| 3536 | latency *= 5; | 3580 | latency *= 5; |
| 3537 | 3581 | ||
| 3538 | seq_printf(m, "WM%d %u (%u.%u usec)\n", | 3582 | seq_printf(m, "WM%d %u (%u.%u usec)\n", |
| 3539 | level, wm[level], | 3583 | level, wm[level], latency / 10, latency % 10); |
| 3540 | latency / 10, latency % 10); | ||
| 3541 | } | 3584 | } |
| 3542 | 3585 | ||
| 3543 | drm_modeset_unlock_all(dev); | 3586 | drm_modeset_unlock_all(dev); |
| @@ -3546,8 +3589,15 @@ static void wm_latency_show(struct seq_file *m, const uint16_t wm[5]) · 2 unmodified lines | |||
| 3546 | static int pri_wm_latency_show(struct seq_file *m, void *data) | 3589 | static int pri_wm_latency_show(struct seq_file *m, void *data) |
| 3547 | { | 3590 | { |
| 3548 | struct drm_device *dev = m->private; | 3591 | struct drm_device *dev = m->private; |
| 3592 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3593 | const uint16_t *latencies; | ||
| 3594 | |||
| 3595 | if (INTEL_INFO(dev)->gen >= 9) | ||
| 3596 | latencies = dev_priv->wm.skl_latency; | ||
| 3597 | else | ||
| 3598 | latencies = to_i915(dev)->wm.pri_latency; | ||
| 3549 | 3599 | ||
| 3550 | wm_latency_show(m, to_i915(dev)->wm.pri_latency); | 3600 | wm_latency_show(m, latencies); |
| 3551 | 3601 | ||
| 3552 | return 0; | 3602 | return 0; |
| 3553 | } | 3603 | } |
| @@ -3555,8 +3605,15 @@ static int pri_wm_latency_show(struct seq_file *m, void *data) · 1 unmodified line | |||
| 3555 | static int spr_wm_latency_show(struct seq_file *m, void *data) | 3605 | static int spr_wm_latency_show(struct seq_file *m, void *data) |
| 3556 | { | 3606 | { |
| 3557 | struct drm_device *dev = m->private; | 3607 | struct drm_device *dev = m->private; |
| 3608 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3609 | const uint16_t *latencies; | ||
| 3610 | |||
| 3611 | if (INTEL_INFO(dev)->gen >= 9) | ||
| 3612 | latencies = dev_priv->wm.skl_latency; | ||
| 3613 | else | ||
| 3614 | latencies = to_i915(dev)->wm.spr_latency; | ||
| 3558 | 3615 | ||
| 3559 | wm_latency_show(m, to_i915(dev)->wm.spr_latency); | 3616 | wm_latency_show(m, latencies); |
| 3560 | 3617 | ||
| 3561 | return 0; | 3618 | return 0; |
| 3562 | } | 3619 | } |
| @@ -3564,8 +3621,15 @@ static int spr_wm_latency_show(struct seq_file *m, void *data) · 1 unmodified line | |||
| 3564 | static int cur_wm_latency_show(struct seq_file *m, void *data) | 3621 | static int cur_wm_latency_show(struct seq_file *m, void *data) |
| 3565 | { | 3622 | { |
| 3566 | struct drm_device *dev = m->private; | 3623 | struct drm_device *dev = m->private; |
| 3624 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3625 | const uint16_t *latencies; | ||
| 3567 | 3626 | ||
| 3568 | wm_latency_show(m, to_i915(dev)->wm.cur_latency); | 3627 | if (INTEL_INFO(dev)->gen >= 9) |
| 3628 | latencies = dev_priv->wm.skl_latency; | ||
| 3629 | else | ||
| 3630 | latencies = to_i915(dev)->wm.cur_latency; | ||
| 3631 | |||
| 3632 | wm_latency_show(m, latencies); | ||
| 3569 | 3633 | ||
| 3570 | return 0; | 3634 | return 0; |
| 3571 | } | 3635 | } |
| @@ -3601,11 +3665,11 @@ static int cur_wm_latency_open(struct inode *inode, struct file *file) · 29 unmodified lines | |||
| 3601 | } | 3665 | } |
| 3602 | 3666 | ||
| 3603 | static ssize_t wm_latency_write(struct file *file, const char __user *ubuf, | 3667 | static ssize_t wm_latency_write(struct file *file, const char __user *ubuf, |
| 3604 | size_t len, loff_t *offp, uint16_t wm[5]) | 3668 | size_t len, loff_t *offp, uint16_t wm[8]) |
| 3605 | { | 3669 | { |
| 3606 | struct seq_file *m = file->private_data; | 3670 | struct seq_file *m = file->private_data; |
| 3607 | struct drm_device *dev = m->private; | 3671 | struct drm_device *dev = m->private; |
| 3608 | uint16_t new[5] = { 0 }; | 3672 | uint16_t new[8] = { 0 }; |
| 3609 | int num_levels = ilk_wm_max_level(dev) + 1; | 3673 | int num_levels = ilk_wm_max_level(dev) + 1; |
| 3610 | int level; | 3674 | int level; |
| 3611 | int ret; | 3675 | int ret; |
| @@ -3619,7 +3683,9 @@ static ssize_t wm_latency_write(struct file *file, const char __user *ubuf, · 7 unmodified lines | |||
| 3619 | 3683 | ||
| 3620 | tmp[len] = '\0'; | 3684 | tmp[len] = '\0'; |
| 3621 | 3685 | ||
| 3622 | ret = sscanf(tmp, "%hu %hu %hu %hu %hu", &new[0], &new[1], &new[2], &new[3], &new[4]); | 3686 | ret = sscanf(tmp, "%hu %hu %hu %hu %hu %hu %hu %hu", |
| 3687 | &new[0], &new[1], &new[2], &new[3], | ||
| 3688 | &new[4], &new[5], &new[6], &new[7]); | ||
| 3623 | if (ret != num_levels) | 3689 | if (ret != num_levels) |
| 3624 | return -EINVAL; | 3690 | return -EINVAL; |
| 3625 | 3691 | ||
| @@ -3639,8 +3705,15 @@ static ssize_t pri_wm_latency_write(struct file *file, const char __user *ubuf, · 13 unmodified lines | |||
| 3639 | { | 3705 | { |
| 3640 | struct seq_file *m = file->private_data; | 3706 | struct seq_file *m = file->private_data; |
| 3641 | struct drm_device *dev = m->private; | 3707 | struct drm_device *dev = m->private; |
| 3708 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3709 | uint16_t *latencies; | ||
| 3642 | 3710 | ||
| 3643 | return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.pri_latency); | 3711 | if (INTEL_INFO(dev)->gen >= 9) |
| 3712 | latencies = dev_priv->wm.skl_latency; | ||
| 3713 | else | ||
| 3714 | latencies = to_i915(dev)->wm.pri_latency; | ||
| 3715 | |||
| 3716 | return wm_latency_write(file, ubuf, len, offp, latencies); | ||
| 3644 | } | 3717 | } |
| 3645 | 3718 | ||
| 3646 | static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf, | 3719 | static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf, |
| @@ -3648,8 +3721,15 @@ static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf, · 1 unmodified line | |||
| 3648 | { | 3721 | { |
| 3649 | struct seq_file *m = file->private_data; | 3722 | struct seq_file *m = file->private_data; |
| 3650 | struct drm_device *dev = m->private; | 3723 | struct drm_device *dev = m->private; |
| 3724 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3725 | uint16_t *latencies; | ||
| 3651 | 3726 | ||
| 3652 | return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.spr_latency); | 3727 | if (INTEL_INFO(dev)->gen >= 9) |
| 3728 | latencies = dev_priv->wm.skl_latency; | ||
| 3729 | else | ||
| 3730 | latencies = to_i915(dev)->wm.spr_latency; | ||
| 3731 | |||
| 3732 | return wm_latency_write(file, ubuf, len, offp, latencies); | ||
| 3653 | } | 3733 | } |
| 3654 | 3734 | ||
| 3655 | static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf, | 3735 | static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf, |
| @@ -3657,8 +3737,15 @@ static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf, · 1 unmodified line | |||
| 3657 | { | 3737 | { |
| 3658 | struct seq_file *m = file->private_data; | 3738 | struct seq_file *m = file->private_data; |
| 3659 | struct drm_device *dev = m->private; | 3739 | struct drm_device *dev = m->private; |
| 3740 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3741 | uint16_t *latencies; | ||
| 3742 | |||
| 3743 | if (INTEL_INFO(dev)->gen >= 9) | ||
| 3744 | latencies = dev_priv->wm.skl_latency; | ||
| 3745 | else | ||
| 3746 | latencies = to_i915(dev)->wm.cur_latency; | ||
| 3660 | 3747 | ||
| 3661 | return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.cur_latency); | 3748 | return wm_latency_write(file, ubuf, len, offp, latencies); |
| 3662 | } | 3749 | } |
| 3663 | 3750 | ||
| 3664 | static const struct file_operations i915_pri_wm_latency_fops = { | 3751 | static const struct file_operations i915_pri_wm_latency_fops = { |
| @@ -4201,6 +4288,7 @@ static const struct drm_info_list i915_debugfs_list[] = { · 536 unmodified lines | |||
| 4201 | {"i915_shared_dplls_info", i915_shared_dplls_info, 0}, | 4288 | {"i915_shared_dplls_info", i915_shared_dplls_info, 0}, |
| 4202 | {"i915_dp_mst_info", i915_dp_mst_info, 0}, | 4289 | {"i915_dp_mst_info", i915_dp_mst_info, 0}, |
| 4203 | {"i915_wa_registers", i915_wa_registers, 0}, | 4290 | {"i915_wa_registers", i915_wa_registers, 0}, |
| 4291 | {"i915_ddb_info", i915_ddb_info, 0}, | ||
| 4204 | }; | 4292 | }; |
| 4205 | #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) | 4293 | #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) |
| 4206 | 4294 | ||
| @@ -551,8 +551,8 @@ static void intel_suspend_encoders(struct drm_i915_private *dev_priv) · 550 unmodified lines | |||
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | static int intel_suspend_complete(struct drm_i915_private *dev_priv); | 553 | static int intel_suspend_complete(struct drm_i915_private *dev_priv); |
| 554 | static int intel_resume_prepare(struct drm_i915_private *dev_priv, | 554 | static int vlv_resume_prepare(struct drm_i915_private *dev_priv, |
| 555 | bool rpm_resume); | 555 | bool rpm_resume); |
| 556 | 556 | ||
| 557 | static int i915_drm_suspend(struct drm_device *dev) | 557 | static int i915_drm_suspend(struct drm_device *dev) |
| 558 | { | 558 | { |
| @@ -744,7 +744,7 @@ static int i915_drm_resume(struct drm_device *dev) · 185 unmodified lines | |||
| 744 | static int i915_drm_resume_early(struct drm_device *dev) | 744 | static int i915_drm_resume_early(struct drm_device *dev) |
| 745 | { | 745 | { |
| 746 | struct drm_i915_private *dev_priv = dev->dev_private; | 746 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 747 | int ret; | 747 | int ret = 0; |
| 748 | 748 | ||
| 749 | /* | 749 | /* |
| 750 | * We have a resume ordering issue with the snd-hda driver also | 750 | * We have a resume ordering issue with the snd-hda driver also |
| @@ -760,11 +760,16 @@ static int i915_drm_resume_early(struct drm_device *dev) · 9 unmodified lines | |||
| 760 | 760 | ||
| 761 | pci_set_master(dev->pdev); | 761 | pci_set_master(dev->pdev); |
| 762 | 762 | ||
| 763 | ret = intel_resume_prepare(dev_priv, false); | 763 | if (IS_VALLEYVIEW(dev_priv)) |
| 764 | ret = vlv_resume_prepare(dev_priv, false); | ||
| 764 | if (ret) | 765 | if (ret) |
| 765 | DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret); | 766 | DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret); |
| 766 | 767 | ||
| 767 | intel_uncore_early_sanitize(dev, true); | 768 | intel_uncore_early_sanitize(dev, true); |
| 769 | |||
| 770 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | ||
| 771 | hsw_disable_pc8(dev_priv); | ||
| 772 | |||
| 768 | intel_uncore_sanitize(dev); | 773 | intel_uncore_sanitize(dev); |
| 769 | intel_power_domains_init_hw(dev_priv); | 774 | intel_power_domains_init_hw(dev_priv); |
| 770 | 775 | ||
| @@ -986,25 +991,6 @@ static int hsw_suspend_complete(struct drm_i915_private *dev_priv) · 215 unmodified lines | |||
| 986 | return 0; | 991 | return 0; |
| 987 | } | 992 | } |
| 988 | 993 | ||
| 989 | static int snb_resume_prepare(struct drm_i915_private *dev_priv, | ||
| 990 | bool rpm_resume) | ||
| 991 | { | ||
| 992 | struct drm_device *dev = dev_priv->dev; | ||
| 993 | |||
| 994 | if (rpm_resume) | ||
| 995 | intel_init_pch_refclk(dev); | ||
| 996 | |||
| 997 | return 0; | ||
| 998 | } | ||
| 999 | |||
| 1000 | static int hsw_resume_prepare(struct drm_i915_private *dev_priv, | ||
| 1001 | bool rpm_resume) | ||
| 1002 | { | ||
| 1003 | hsw_disable_pc8(dev_priv); | ||
| 1004 | |||
| 1005 | return 0; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | /* | 994 | /* |
| 1009 | * Save all Gunit registers that may be lost after a D3 and a subsequent | 995 | * Save all Gunit registers that may be lost after a D3 and a subsequent |
| 1010 | * S0i[R123] transition. The list of registers needing a save/restore is | 996 | * S0i[R123] transition. The list of registers needing a save/restore is |
| @@ -1409,13 +1395,9 @@ static int intel_runtime_suspend(struct device *device) · 398 unmodified lines | |||
| 1409 | i915_gem_release_all_mmaps(dev_priv); | 1395 | i915_gem_release_all_mmaps(dev_priv); |
| 1410 | mutex_unlock(&dev->struct_mutex); | 1396 | mutex_unlock(&dev->struct_mutex); |
| 1411 | 1397 | ||
| 1412 | /* | 1398 | flush_delayed_work(&dev_priv->rps.delayed_resume_work); |
| 1413 | * rps.work can't be rearmed here, since we get here only after making | ||
| 1414 | * sure the GPU is idle and the RPS freq is set to the minimum. See | ||
| 1415 | * intel_mark_idle(). | ||
| 1416 | */ | ||
| 1417 | cancel_work_sync(&dev_priv->rps.work); | ||
| 1418 | intel_runtime_pm_disable_interrupts(dev_priv); | 1399 | intel_runtime_pm_disable_interrupts(dev_priv); |
| 1400 | intel_suspend_gt_powersave(dev); | ||
| 1419 | 1401 | ||
| 1420 | ret = intel_suspend_complete(dev_priv); | 1402 | ret = intel_suspend_complete(dev_priv); |
| 1421 | if (ret) { | 1403 | if (ret) { |
| @@ -1462,7 +1444,7 @@ static int intel_runtime_resume(struct device *device) · 40 unmodified lines | |||
| 1462 | struct pci_dev *pdev = to_pci_dev(device); | 1444 | struct pci_dev *pdev = to_pci_dev(device); |
| 1463 | struct drm_device *dev = pci_get_drvdata(pdev); | 1445 | struct drm_device *dev = pci_get_drvdata(pdev); |
| 1464 | struct drm_i915_private *dev_priv = dev->dev_private; | 1446 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1465 | int ret; | 1447 | int ret = 0; |
| 1466 | 1448 | ||
| 1467 | if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev))) | 1449 | if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev))) |
| 1468 | return -ENODEV; | 1450 | return -ENODEV; |
| @@ -1472,7 +1454,13 @@ static int intel_runtime_resume(struct device *device) · 3 unmodified lines | |||
| 1472 | intel_opregion_notify_adapter(dev, PCI_D0); | 1454 | intel_opregion_notify_adapter(dev, PCI_D0); |
| 1473 | dev_priv->pm.suspended = false; | 1455 | dev_priv->pm.suspended = false; |
| 1474 | 1456 | ||
| 1475 | ret = intel_resume_prepare(dev_priv, true); | 1457 | if (IS_GEN6(dev_priv)) |
| 1458 | intel_init_pch_refclk(dev); | ||
| 1459 | else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | ||
| 1460 | hsw_disable_pc8(dev_priv); | ||
| 1461 | else if (IS_VALLEYVIEW(dev_priv)) | ||
| 1462 | ret = vlv_resume_prepare(dev_priv, true); | ||
| 1463 | |||
| 1476 | /* | 1464 | /* |
| 1477 | * No point of rolling back things in case of an error, as the best | 1465 | * No point of rolling back things in case of an error, as the best |
| 1478 | * we can do is to hope that things will still work (and disable RPM). | 1466 | * we can do is to hope that things will still work (and disable RPM). |
| @@ -1481,7 +1469,7 @@ static int intel_runtime_resume(struct device *device) · 2 unmodified lines | |||
| 1481 | gen6_update_ring_freq(dev); | 1469 | gen6_update_ring_freq(dev); |
| 1482 | 1470 | ||
| 1483 | intel_runtime_pm_enable_interrupts(dev_priv); | 1471 | intel_runtime_pm_enable_interrupts(dev_priv); |
| 1484 | intel_reset_gt_powersave(dev); | 1472 | intel_enable_gt_powersave(dev); |
| 1485 | 1473 | ||
| 1486 | if (ret) | 1474 | if (ret) |
| 1487 | DRM_ERROR("Runtime resume failed, disabling it (%d)\n", ret); | 1475 | DRM_ERROR("Runtime resume failed, disabling it (%d)\n", ret); |
| @@ -1510,29 +1498,6 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv) · 22 unmodified lines | |||
| 1510 | return ret; | 1498 | return ret; |
| 1511 | } | 1499 | } |
| 1512 | 1500 | ||
| 1513 | /* | ||
| 1514 | * This function implements common functionality of runtime and system | ||
| 1515 | * resume sequence. Variable rpm_resume used for implementing different | ||
| 1516 | * code paths. | ||
| 1517 | */ | ||
| 1518 | static int intel_resume_prepare(struct drm_i915_private *dev_priv, | ||
| 1519 | bool rpm_resume) | ||
| 1520 | { | ||
| 1521 | struct drm_device *dev = dev_priv->dev; | ||
| 1522 | int ret; | ||
| 1523 | |||
| 1524 | if (IS_GEN6(dev)) | ||
| 1525 | ret = snb_resume_prepare(dev_priv, rpm_resume); | ||
| 1526 | else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) | ||
| 1527 | ret = hsw_resume_prepare(dev_priv, rpm_resume); | ||
| 1528 | else if (IS_VALLEYVIEW(dev)) | ||
| 1529 | ret = vlv_resume_prepare(dev_priv, rpm_resume); | ||
| 1530 | else | ||
| 1531 | ret = 0; | ||
| 1532 | |||
| 1533 | return ret; | ||
| 1534 | } | ||
| 1535 | |||
| 1536 | static const struct dev_pm_ops i915_pm_ops = { | 1501 | static const struct dev_pm_ops i915_pm_ops = { |
| 1537 | /* | 1502 | /* |
| 1538 | * S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND, | 1503 | * S0ix (via system suspend) and S3 event handlers [PMSG_SUSPEND, |
| @@ -55,7 +55,10 @@ · 54 unmodified lines | |||
| 55 | 55 | ||
| 56 | #define DRIVER_NAME "i915" | 56 | #define DRIVER_NAME "i915" |
| 57 | #define DRIVER_DESC "Intel Graphics" | 57 | #define DRIVER_DESC "Intel Graphics" |
| 58 | #define DRIVER_DATE "20141024" | 58 | #define DRIVER_DATE "20141107" |
| 59 | |||
| 60 | #undef WARN_ON | ||
| 61 | #define WARN_ON(x) WARN(x, "WARN_ON(" #x ")") | ||
| 59 | 62 | ||
| 60 | enum pipe { | 63 | enum pipe { |
| 61 | INVALID_PIPE = -1, | 64 | INVALID_PIPE = -1, |
| @@ -226,14 +229,20 @@ struct intel_dpll_hw_state { · 164 unmodified lines | |||
| 226 | uint32_t wrpll; | 229 | uint32_t wrpll; |
| 227 | }; | 230 | }; |
| 228 | 231 | ||
| 232 | struct intel_shared_dpll_config { | ||
| 233 | unsigned crtc_mask; /* mask of CRTCs sharing this PLL */ | ||
| 234 | struct intel_dpll_hw_state hw_state; | ||
| 235 | }; | ||
| 236 | |||
| 229 | struct intel_shared_dpll { | 237 | struct intel_shared_dpll { |
| 230 | int refcount; /* count of number of CRTCs sharing this PLL */ | 238 | struct intel_shared_dpll_config config; |
| 239 | struct intel_shared_dpll_config *new_config; | ||
| 240 | |||
| 231 | int active; /* count of number of active CRTCs (i.e. DPMS on) */ | 241 | int active; /* count of number of active CRTCs (i.e. DPMS on) */ |
| 232 | bool on; /* is the PLL actually active? Disabled during modeset */ | 242 | bool on; /* is the PLL actually active? Disabled during modeset */ |
| 233 | const char *name; | 243 | const char *name; |
| 234 | /* should match the index in the dev_priv->shared_dplls array */ | 244 | /* should match the index in the dev_priv->shared_dplls array */ |
| 235 | enum intel_dpll_id id; | 245 | enum intel_dpll_id id; |
| 236 | struct intel_dpll_hw_state hw_state; | ||
| 237 | /* The mode_set hook is optional and should be used together with the | 246 | /* The mode_set hook is optional and should be used together with the |
| 238 | * intel_prepare_shared_dpll function. */ | 247 | * intel_prepare_shared_dpll function. */ |
| 239 | void (*mode_set)(struct drm_i915_private *dev_priv, | 248 | void (*mode_set)(struct drm_i915_private *dev_priv, |
| @@ -275,7 +284,6 @@ void intel_link_compute_m_n(int bpp, int nlanes, · 35 unmodified lines | |||
| 275 | #define DRIVER_PATCHLEVEL 0 | 284 | #define DRIVER_PATCHLEVEL 0 |
| 276 | 285 | ||
| 277 | #define WATCH_LISTS 0 | 286 | #define WATCH_LISTS 0 |
| 278 | #define WATCH_GTT 0 | ||
| 279 | 287 | ||
| 280 | struct opregion_header; | 288 | struct opregion_header; |
| 281 | struct opregion_acpi; | 289 | struct opregion_acpi; |
| @@ -434,6 +442,7 @@ struct drm_i915_error_state { · 152 unmodified lines | |||
| 434 | }; | 442 | }; |
| 435 | 443 | ||
| 436 | struct intel_connector; | 444 | struct intel_connector; |
| 445 | struct intel_encoder; | ||
| 437 | struct intel_crtc_config; | 446 | struct intel_crtc_config; |
| 438 | struct intel_plane_config; | 447 | struct intel_plane_config; |
| 439 | struct intel_crtc; | 448 | struct intel_crtc; |
| @@ -476,15 +485,14 @@ struct drm_i915_display_funcs { · 36 unmodified lines | |||
| 476 | struct intel_crtc_config *); | 485 | struct intel_crtc_config *); |
| 477 | void (*get_plane_config)(struct intel_crtc *, | 486 | void (*get_plane_config)(struct intel_crtc *, |
| 478 | struct intel_plane_config *); | 487 | struct intel_plane_config *); |
| 479 | int (*crtc_mode_set)(struct intel_crtc *crtc, | 488 | int (*crtc_compute_clock)(struct intel_crtc *crtc); |
| 480 | int x, int y, | ||
| 481 | struct drm_framebuffer *old_fb); | ||
| 482 | void (*crtc_enable)(struct drm_crtc *crtc); | 489 | void (*crtc_enable)(struct drm_crtc *crtc); |
| 483 | void (*crtc_disable)(struct drm_crtc *crtc); | 490 | void (*crtc_disable)(struct drm_crtc *crtc); |
| 484 | void (*off)(struct drm_crtc *crtc); | 491 | void (*off)(struct drm_crtc *crtc); |
| 485 | void (*write_eld)(struct drm_connector *connector, | 492 | void (*audio_codec_enable)(struct drm_connector *connector, |
| 486 | struct drm_crtc *crtc, | 493 | struct intel_encoder *encoder, |
| 487 | struct drm_display_mode *mode); | 494 | struct drm_display_mode *mode); |
| 495 | void (*audio_codec_disable)(struct intel_encoder *encoder); | ||
| 488 | void (*fdi_link_train)(struct drm_crtc *crtc); | 496 | void (*fdi_link_train)(struct drm_crtc *crtc); |
| 489 | void (*init_clock_gating)(struct drm_device *dev); | 497 | void (*init_clock_gating)(struct drm_device *dev); |
| 490 | int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc, | 498 | int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc, |
| @@ -541,6 +549,7 @@ struct intel_uncore { · 50 unmodified lines | |||
| 541 | 549 | ||
| 542 | unsigned fw_rendercount; | 550 | unsigned fw_rendercount; |
| 543 | unsigned fw_mediacount; | 551 | unsigned fw_mediacount; |
| 552 | unsigned fw_blittercount; | ||
| 544 | 553 | ||
| 545 | struct timer_list force_wake_timer; | 554 | struct timer_list force_wake_timer; |
| 546 | }; | 555 | }; |
| @@ -1379,6 +1388,49 @@ struct ilk_wm_values { · 832 unmodified lines | |||
| 1379 | enum intel_ddb_partitioning partitioning; | 1388 | enum intel_ddb_partitioning partitioning; |
| 1380 | }; | 1389 | }; |
| 1381 | 1390 | ||
| 1391 | struct skl_ddb_entry { | ||
| 1392 | uint16_t start, end; /* in number of blocks, 'end' is exclusive */ | ||
| 1393 | }; | ||
| 1394 | |||
| 1395 | static inline uint16_t skl_ddb_entry_size(const struct skl_ddb_entry *entry) | ||
| 1396 | { | ||
| 1397 | return entry->end - entry->start; | ||
| 1398 | } | ||
| 1399 | |||
| 1400 | static inline bool skl_ddb_entry_equal(const struct skl_ddb_entry *e1, | ||
| 1401 | const struct skl_ddb_entry *e2) | ||
| 1402 | { | ||
| 1403 | if (e1->start == e2->start && e1->end == e2->end) | ||
| 1404 | return true; | ||
| 1405 | |||
| 1406 | return false; | ||
| 1407 | } | ||
| 1408 | |||
| 1409 | struct skl_ddb_allocation { | ||
| 1410 | struct skl_ddb_entry pipe[I915_MAX_PIPES]; | ||
| 1411 | struct skl_ddb_entry plane[I915_MAX_PIPES][I915_MAX_PLANES]; | ||
| 1412 | struct skl_ddb_entry cursor[I915_MAX_PIPES]; | ||
| 1413 | }; | ||
| 1414 | |||
| 1415 | struct skl_wm_values { | ||
| 1416 | bool dirty[I915_MAX_PIPES]; | ||
| 1417 | struct skl_ddb_allocation ddb; | ||
| 1418 | uint32_t wm_linetime[I915_MAX_PIPES]; | ||
| 1419 | uint32_t plane[I915_MAX_PIPES][I915_MAX_PLANES][8]; | ||
| 1420 | uint32_t cursor[I915_MAX_PIPES][8]; | ||
| 1421 | uint32_t plane_trans[I915_MAX_PIPES][I915_MAX_PLANES]; | ||
| 1422 | uint32_t cursor_trans[I915_MAX_PIPES]; | ||
| 1423 | }; | ||
| 1424 | |||
| 1425 | struct skl_wm_level { | ||
| 1426 | bool plane_en[I915_MAX_PLANES]; | ||
| 1427 | bool cursor_en; | ||
| 1428 | uint16_t plane_res_b[I915_MAX_PLANES]; | ||
| 1429 | uint8_t plane_res_l[I915_MAX_PLANES]; | ||
| 1430 | uint16_t cursor_res_b; | ||
| 1431 | uint8_t cursor_res_l; | ||
| 1432 | }; | ||
| 1433 | |||
| 1382 | /* | 1434 | /* |
| 1383 | * This struct helps tracking the state needed for runtime PM, which puts the | 1435 | * This struct helps tracking the state needed for runtime PM, which puts the |
| 1384 | * device in PCI D3 state. Notice that when this happens, nothing on the | 1436 | * device in PCI D3 state. Notice that when this happens, nothing on the |
| @@ -1561,6 +1613,7 @@ struct drm_i915_private { · 176 unmodified lines | |||
| 1561 | 1613 | ||
| 1562 | unsigned int fsb_freq, mem_freq, is_ddr3; | 1614 | unsigned int fsb_freq, mem_freq, is_ddr3; |
| 1563 | unsigned int vlv_cdclk_freq; | 1615 | unsigned int vlv_cdclk_freq; |
| 1616 | unsigned int hpll_freq; | ||
| 1564 | 1617 | ||
| 1565 | /** | 1618 | /** |
| 1566 | * wq - Driver workqueue for GEM. | 1619 | * wq - Driver workqueue for GEM. |
| @@ -1670,9 +1723,25 @@ struct drm_i915_private { · 103 unmodified lines | |||
| 1670 | uint16_t spr_latency[5]; | 1723 | uint16_t spr_latency[5]; |
| 1671 | /* cursor */ | 1724 | /* cursor */ |
| 1672 | uint16_t cur_latency[5]; | 1725 | uint16_t cur_latency[5]; |
| 1726 | /* | ||
| 1727 | * Raw watermark memory latency values | ||
| 1728 | * for SKL for all 8 levels | ||
| 1729 | * in 1us units. | ||
| 1730 | */ | ||
| 1731 | uint16_t skl_latency[8]; | ||
| 1732 | |||
| 1733 | /* | ||
| 1734 | * The skl_wm_values structure is a bit too big for stack | ||
| 1735 | * allocation, so we keep the staging struct where we store | ||
| 1736 | * intermediate results here instead. | ||
| 1737 | */ | ||
| 1738 | struct skl_wm_values skl_results; | ||
| 1673 | 1739 | ||
| 1674 | /* current hardware state */ | 1740 | /* current hardware state */ |
| 1675 | struct ilk_wm_values hw; | 1741 | union { |
| 1742 | struct ilk_wm_values hw; | ||
| 1743 | struct skl_wm_values skl_hw; | ||
| 1744 | }; | ||
| 1676 | } wm; | 1745 | } wm; |
| 1677 | 1746 | ||
| 1678 | struct i915_runtime_pm pm; | 1747 | struct i915_runtime_pm pm; |
| @@ -1856,8 +1925,6 @@ struct drm_i915_gem_object { · 177 unmodified lines | |||
| 1856 | unsigned long gt_ro:1; | 1925 | unsigned long gt_ro:1; |
| 1857 | unsigned int cache_level:3; | 1926 | unsigned int cache_level:3; |
| 1858 | 1927 | ||
| 1859 | unsigned int has_aliasing_ppgtt_mapping:1; | ||
| 1860 | unsigned int has_global_gtt_mapping:1; | ||
| 1861 | unsigned int has_dma_mapping:1; | 1928 | unsigned int has_dma_mapping:1; |
| 1862 | 1929 | ||
| 1863 | unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; | 1930 | unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; |
| @@ -2292,8 +2359,6 @@ __printf(3, 4) · 428 unmodified lines | |||
| 2292 | void i915_handle_error(struct drm_device *dev, bool wedged, | 2359 | void i915_handle_error(struct drm_device *dev, bool wedged, |
| 2293 | const char *fmt, ...); | 2360 | const char *fmt, ...); |
| 2294 | 2361 | ||
| 2295 | void gen6_set_pm_mask(struct drm_i915_private *dev_priv, u32 pm_iir, | ||
| 2296 | int new_delay); | ||
| 2297 | extern void intel_irq_init(struct drm_i915_private *dev_priv); | 2362 | extern void intel_irq_init(struct drm_i915_private *dev_priv); |
| 2298 | extern void intel_hpd_init(struct drm_i915_private *dev_priv); | 2363 | extern void intel_hpd_init(struct drm_i915_private *dev_priv); |
| 2299 | int intel_irq_install(struct drm_i915_private *dev_priv); | 2364 | int intel_irq_install(struct drm_i915_private *dev_priv); |
| @@ -2531,6 +2596,11 @@ int __i915_add_request(struct intel_engine_cs *ring, · 231 unmodified lines | |||
| 2531 | u32 *seqno); | 2596 | u32 *seqno); |
| 2532 | #define i915_add_request(ring, seqno) \ | 2597 | #define i915_add_request(ring, seqno) \ |
| 2533 | __i915_add_request(ring, NULL, NULL, seqno) | 2598 | __i915_add_request(ring, NULL, NULL, seqno) |
| 2599 | int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno, | ||
| 2600 | unsigned reset_counter, | ||
| 2601 | bool interruptible, | ||
| 2602 | s64 *timeout, | ||
| 2603 | struct drm_i915_file_private *file_priv); | ||
| 2534 | int __must_check i915_wait_seqno(struct intel_engine_cs *ring, | 2604 | int __must_check i915_wait_seqno(struct intel_engine_cs *ring, |
| 2535 | uint32_t seqno); | 2605 | uint32_t seqno); |
| 2536 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 2606 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
| @@ -2800,7 +2870,6 @@ static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter) · 263 unmodified lines | |||
| 2800 | extern void intel_i2c_reset(struct drm_device *dev); | 2870 | extern void intel_i2c_reset(struct drm_device *dev); |
| 2801 | 2871 | ||
| 2802 | /* intel_opregion.c */ | 2872 | /* intel_opregion.c */ |
| 2803 | struct intel_encoder; | ||
| 2804 | #ifdef CONFIG_ACPI | 2873 | #ifdef CONFIG_ACPI |
| 2805 | extern int intel_opregion_setup(struct drm_device *dev); | 2874 | extern int intel_opregion_setup(struct drm_device *dev); |
| 2806 | extern void intel_opregion_init(struct drm_device *dev); | 2875 | extern void intel_opregion_init(struct drm_device *dev); |
| @@ -2917,7 +2986,9 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val); · 110 unmodified lines | |||
| 2917 | 2986 | ||
| 2918 | #define FORCEWAKE_RENDER (1 << 0) | 2987 | #define FORCEWAKE_RENDER (1 << 0) |
| 2919 | #define FORCEWAKE_MEDIA (1 << 1) | 2988 | #define FORCEWAKE_MEDIA (1 << 1) |
| 2920 | #define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA) | 2989 | #define FORCEWAKE_BLITTER (1 << 2) |
| 2990 | #define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA | \ | ||
| 2991 | FORCEWAKE_BLITTER) | ||
| 2921 | 2992 | ||
| 2922 | 2993 | ||
| 2923 | #define I915_READ8(reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true) | 2994 | #define I915_READ8(reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true) |
| @@ -1134,7 +1134,7 @@ static bool can_wait_boost(struct drm_i915_file_private *file_priv) · 1133 unmodified lines | |||
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| 1136 | /** | 1136 | /** |
| 1137 | * __wait_seqno - wait until execution of seqno has finished | 1137 | * __i915_wait_seqno - wait until execution of seqno has finished |
| 1138 | * @ring: the ring expected to report seqno | 1138 | * @ring: the ring expected to report seqno |
| 1139 | * @seqno: duh! | 1139 | * @seqno: duh! |
| 1140 | * @reset_counter: reset sequence associated with the given seqno | 1140 | * @reset_counter: reset sequence associated with the given seqno |
| @@ -1151,7 +1151,7 @@ static bool can_wait_boost(struct drm_i915_file_private *file_priv) · 10 unmodified lines | |||
| 1151 | * Returns 0 if the seqno was found within the alloted time. Else returns the | 1151 | * Returns 0 if the seqno was found within the alloted time. Else returns the |
| 1152 | * errno with remaining time filled in timeout argument. | 1152 | * errno with remaining time filled in timeout argument. |
| 1153 | */ | 1153 | */ |
| 1154 | static int __wait_seqno(struct intel_engine_cs *ring, u32 seqno, | 1154 | int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno, |
| 1155 | unsigned reset_counter, | 1155 | unsigned reset_counter, |
| 1156 | bool interruptible, | 1156 | bool interruptible, |
| 1157 | s64 *timeout, | 1157 | s64 *timeout, |
| @@ -1262,6 +1262,7 @@ i915_wait_seqno(struct intel_engine_cs *ring, uint32_t seqno) · 104 unmodified lines | |||
| 1262 | struct drm_device *dev = ring->dev; | 1262 | struct drm_device *dev = ring->dev; |
| 1263 | struct drm_i915_private *dev_priv = dev->dev_private; | 1263 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1264 | bool interruptible = dev_priv->mm.interruptible; | 1264 | bool interruptible = dev_priv->mm.interruptible; |
| 1265 | unsigned reset_counter; | ||
| 1265 | int ret; | 1266 | int ret; |
| 1266 | 1267 | ||
| 1267 | BUG_ON(!mutex_is_locked(&dev->struct_mutex)); | 1268 | BUG_ON(!mutex_is_locked(&dev->struct_mutex)); |
| @@ -1275,14 +1276,13 @@ i915_wait_seqno(struct intel_engine_cs *ring, uint32_t seqno) · 7 unmodified lines | |||
| 1275 | if (ret) | 1276 | if (ret) |
| 1276 | return ret; | 1277 | return ret; |
| 1277 | 1278 | ||
| 1278 | return __wait_seqno(ring, seqno, | 1279 | reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); |
| 1279 | atomic_read(&dev_priv->gpu_error.reset_counter), | 1280 | return __i915_wait_seqno(ring, seqno, reset_counter, interruptible, |
| 1280 | interruptible, NULL, NULL); | 1281 | NULL, NULL); |
| 1281 | } | 1282 | } |
| 1282 | 1283 | ||
| 1283 | static int | 1284 | static int |
| 1284 | i915_gem_object_wait_rendering__tail(struct drm_i915_gem_object *obj, | 1285 | i915_gem_object_wait_rendering__tail(struct drm_i915_gem_object *obj) |
| 1285 | struct intel_engine_cs *ring) | ||
| 1286 | { | 1286 | { |
| 1287 | if (!obj->active) | 1287 | if (!obj->active) |
| 1288 | return 0; | 1288 | return 0; |
| @@ -1319,7 +1319,7 @@ i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj, · 30 unmodified lines | |||
| 1319 | if (ret) | 1319 | if (ret) |
| 1320 | return ret; | 1320 | return ret; |
| 1321 | 1321 | ||
| 1322 | return i915_gem_object_wait_rendering__tail(obj, ring); | 1322 | return i915_gem_object_wait_rendering__tail(obj); |
| 1323 | } | 1323 | } |
| 1324 | 1324 | ||
| 1325 | /* A nonblocking variant of the above wait. This is a highly dangerous routine | 1325 | /* A nonblocking variant of the above wait. This is a highly dangerous routine |
| @@ -1354,12 +1354,13 @@ i915_gem_object_wait_rendering__nonblocking(struct drm_i915_gem_object *obj, · 28 unmodified lines | |||
| 1354 | 1354 | ||
| 1355 | reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); | 1355 | reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); |
| 1356 | mutex_unlock(&dev->struct_mutex); | 1356 | mutex_unlock(&dev->struct_mutex); |
| 1357 | ret = __wait_seqno(ring, seqno, reset_counter, true, NULL, file_priv); | 1357 | ret = __i915_wait_seqno(ring, seqno, reset_counter, true, NULL, |
| 1358 | file_priv); | ||
| 1358 | mutex_lock(&dev->struct_mutex); | 1359 | mutex_lock(&dev->struct_mutex); |
| 1359 | if (ret) | 1360 | if (ret) |
| 1360 | return ret; | 1361 | return ret; |
| 1361 | 1362 | ||
| 1362 | return i915_gem_object_wait_rendering__tail(obj, ring); | 1363 | return i915_gem_object_wait_rendering__tail(obj); |
| 1363 | } | 1364 | } |
| 1364 | 1365 | ||
| 1365 | /** | 1366 | /** |
| @@ -2848,8 +2849,8 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 1482 unmodified lines | |||
| 2848 | reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); | 2849 | reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); |
| 2849 | mutex_unlock(&dev->struct_mutex); | 2850 | mutex_unlock(&dev->struct_mutex); |
| 2850 | 2851 | ||
| 2851 | return __wait_seqno(ring, seqno, reset_counter, true, &args->timeout_ns, | 2852 | return __i915_wait_seqno(ring, seqno, reset_counter, true, |
| 2852 | file->driver_priv); | 2853 | &args->timeout_ns, file->driver_priv); |
| 2853 | 2854 | ||
| 2854 | out: | 2855 | out: |
| 2855 | drm_gem_object_unreference(&obj->base); | 2856 | drm_gem_object_unreference(&obj->base); |
| @@ -3477,23 +3478,9 @@ search_free: · 621 unmodified lines | |||
| 3477 | list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); | 3478 | list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); |
| 3478 | list_add_tail(&vma->mm_list, &vm->inactive_list); | 3479 | list_add_tail(&vma->mm_list, &vm->inactive_list); |
| 3479 | 3480 | ||
| 3480 | if (i915_is_ggtt(vm)) { | ||
| 3481 | bool mappable, fenceable; | ||
| 3482 | |||
| 3483 | fenceable = (vma->node.size == fence_size && | ||
| 3484 | (vma->node.start & (fence_alignment - 1)) == 0); | ||
| 3485 | |||
| 3486 | mappable = (vma->node.start + obj->base.size <= | ||
| 3487 | dev_priv->gtt.mappable_end); | ||
| 3488 | |||
| 3489 | obj->map_and_fenceable = mappable && fenceable; | ||
| 3490 | } | ||
| 3491 | |||
| 3492 | WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable); | ||
| 3493 | |||
| 3494 | trace_i915_vma_bind(vma, flags); | 3481 | trace_i915_vma_bind(vma, flags); |
| 3495 | vma->bind_vma(vma, obj->cache_level, | 3482 | vma->bind_vma(vma, obj->cache_level, |
| 3496 | flags & (PIN_MAPPABLE | PIN_GLOBAL) ? GLOBAL_BIND : 0); | 3483 | flags & PIN_GLOBAL ? GLOBAL_BIND : 0); |
| 3497 | 3484 | ||
| 3498 | return vma; | 3485 | return vma; |
| 3499 | 3486 | ||
| @@ -3701,7 +3688,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, · 201 unmodified lines | |||
| 3701 | list_for_each_entry(vma, &obj->vma_list, vma_link) | 3688 | list_for_each_entry(vma, &obj->vma_list, vma_link) |
| 3702 | if (drm_mm_node_allocated(&vma->node)) | 3689 | if (drm_mm_node_allocated(&vma->node)) |
| 3703 | vma->bind_vma(vma, cache_level, | 3690 | vma->bind_vma(vma, cache_level, |
| 3704 | obj->has_global_gtt_mapping ? GLOBAL_BIND : 0); | 3691 | vma->bound & GLOBAL_BIND); |
| 3705 | } | 3692 | } |
| 3706 | 3693 | ||
| 3707 | list_for_each_entry(vma, &obj->vma_list, vma_link) | 3694 | list_for_each_entry(vma, &obj->vma_list, vma_link) |
| @@ -4028,7 +4015,7 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file) · 320 unmodified lines | |||
| 4028 | if (seqno == 0) | 4015 | if (seqno == 0) |
| 4029 | return 0; | 4016 | return 0; |
| 4030 | 4017 | ||
| 4031 | ret = __wait_seqno(ring, seqno, reset_counter, true, NULL, NULL); | 4018 | ret = __i915_wait_seqno(ring, seqno, reset_counter, true, NULL, NULL); |
| 4032 | if (ret == 0) | 4019 | if (ret == 0) |
| 4033 | queue_delayed_work(dev_priv->wq, &dev_priv->mm.retire_work, 0); | 4020 | queue_delayed_work(dev_priv->wq, &dev_priv->mm.retire_work, 0); |
| 4034 | 4021 | ||
| @@ -4062,6 +4049,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, · 27 unmodified lines | |||
| 4062 | { | 4049 | { |
| 4063 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; | 4050 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; |
| 4064 | struct i915_vma *vma; | 4051 | struct i915_vma *vma; |
| 4052 | unsigned bound; | ||
| 4065 | int ret; | 4053 | int ret; |
| 4066 | 4054 | ||
| 4067 | if (WARN_ON(vm == &dev_priv->mm.aliasing_ppgtt->base)) | 4055 | if (WARN_ON(vm == &dev_priv->mm.aliasing_ppgtt->base)) |
| @@ -4070,6 +4058,9 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, · 2 unmodified lines | |||
| 4070 | if (WARN_ON(flags & (PIN_GLOBAL | PIN_MAPPABLE) && !i915_is_ggtt(vm))) | 4058 | if (WARN_ON(flags & (PIN_GLOBAL | PIN_MAPPABLE) && !i915_is_ggtt(vm))) |
| 4071 | return -EINVAL; | 4059 | return -EINVAL; |
| 4072 | 4060 | ||
| 4061 | if (WARN_ON((flags & (PIN_MAPPABLE | PIN_GLOBAL)) == PIN_MAPPABLE)) | ||
| 4062 | return -EINVAL; | ||
| 4063 | |||
| 4073 | vma = i915_gem_obj_to_vma(obj, vm); | 4064 | vma = i915_gem_obj_to_vma(obj, vm); |
| 4074 | if (vma) { | 4065 | if (vma) { |
| 4075 | if (WARN_ON(vma->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT)) | 4066 | if (WARN_ON(vma->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT)) |
| @@ -4091,15 +4082,39 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, · 15 unmodified lines | |||
| 4091 | } | 4082 | } |
| 4092 | } | 4083 | } |
| 4093 | 4084 | ||
| 4085 | bound = vma ? vma->bound : 0; | ||
| 4094 | if (vma == NULL || !drm_mm_node_allocated(&vma->node)) { | 4086 | if (vma == NULL || !drm_mm_node_allocated(&vma->node)) { |
| 4095 | vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags); | 4087 | vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags); |
| 4096 | if (IS_ERR(vma)) | 4088 | if (IS_ERR(vma)) |
| 4097 | return PTR_ERR(vma); | 4089 | return PTR_ERR(vma); |
| 4098 | } | 4090 | } |
| 4099 | 4091 | ||
| 4100 | if (flags & PIN_GLOBAL && !obj->has_global_gtt_mapping) | 4092 | if (flags & PIN_GLOBAL && !(vma->bound & GLOBAL_BIND)) |
| 4101 | vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); | 4093 | vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); |
| 4102 | 4094 | ||
| 4095 | if ((bound ^ vma->bound) & GLOBAL_BIND) { | ||
| 4096 | bool mappable, fenceable; | ||
| 4097 | u32 fence_size, fence_alignment; | ||
| 4098 | |||
| 4099 | fence_size = i915_gem_get_gtt_size(obj->base.dev, | ||
| 4100 | obj->base.size, | ||
| 4101 | obj->tiling_mode); | ||
| 4102 | fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev, | ||
| 4103 | obj->base.size, | ||
| 4104 | obj->tiling_mode, | ||
| 4105 | true); | ||
| 4106 | |||
| 4107 | fenceable = (vma->node.size == fence_size && | ||
| 4108 | (vma->node.start & (fence_alignment - 1)) == 0); | ||
| 4109 | |||
| 4110 | mappable = (vma->node.start + obj->base.size <= | ||
| 4111 | dev_priv->gtt.mappable_end); | ||
| 4112 | |||
| 4113 | obj->map_and_fenceable = mappable && fenceable; | ||
| 4114 | } | ||
| 4115 | |||
| 4116 | WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable); | ||
| 4117 | |||
| 4103 | vma->pin_count++; | 4118 | vma->pin_count++; |
| 4104 | if (flags & PIN_MAPPABLE) | 4119 | if (flags & PIN_MAPPABLE) |
| 4105 | obj->pin_mappable |= true; | 4120 | obj->pin_mappable |= true; |
| @@ -522,6 +522,7 @@ static int do_switch(struct intel_engine_cs *ring, · 521 unmodified lines | |||
| 522 | struct intel_context *from = ring->last_context; | 522 | struct intel_context *from = ring->last_context; |
| 523 | u32 hw_flags = 0; | 523 | u32 hw_flags = 0; |
| 524 | bool uninitialized = false; | 524 | bool uninitialized = false; |
| 525 | struct i915_vma *vma; | ||
| 525 | int ret, i; | 526 | int ret, i; |
| 526 | 527 | ||
| 527 | if (from != NULL && ring == &dev_priv->ring[RCS]) { | 528 | if (from != NULL && ring == &dev_priv->ring[RCS]) { |
| @@ -571,11 +572,10 @@ static int do_switch(struct intel_engine_cs *ring, · 43 unmodified lines | |||
| 571 | if (ret) | 572 | if (ret) |
| 572 | goto unpin_out; | 573 | goto unpin_out; |
| 573 | 574 | ||
| 574 | if (!to->legacy_hw_ctx.rcs_state->has_global_gtt_mapping) { | 575 | vma = i915_gem_obj_to_ggtt(to->legacy_hw_ctx.rcs_state); |
| 575 | struct i915_vma *vma = i915_gem_obj_to_vma(to->legacy_hw_ctx.rcs_state, | 576 | if (!(vma->bound & GLOBAL_BIND)) |
| 576 | &dev_priv->gtt.base); | 577 | vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, |
| 577 | vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, GLOBAL_BIND); | 578 | GLOBAL_BIND); |
| 578 | } | ||
| 579 | 579 | ||
| 580 | if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to)) | 580 | if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to)) |
| 581 | hw_flags |= MI_RESTORE_INHIBIT; | 581 | hw_flags |= MI_RESTORE_INHIBIT; |
| @@ -357,12 +357,9 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, · 356 unmodified lines | |||
| 357 | * through the ppgtt for non_secure batchbuffers. */ | 357 | * through the ppgtt for non_secure batchbuffers. */ |
| 358 | if (unlikely(IS_GEN6(dev) && | 358 | if (unlikely(IS_GEN6(dev) && |
| 359 | reloc->write_domain == I915_GEM_DOMAIN_INSTRUCTION && | 359 | reloc->write_domain == I915_GEM_DOMAIN_INSTRUCTION && |
| 360 | !target_i915_obj->has_global_gtt_mapping)) { | 360 | !(target_vma->bound & GLOBAL_BIND))) |
| 361 | struct i915_vma *vma = | 361 | target_vma->bind_vma(target_vma, target_i915_obj->cache_level, |
| 362 | list_first_entry(&target_i915_obj->vma_list, | 362 | GLOBAL_BIND); |
| 363 | typeof(*vma), vma_link); | ||
| 364 | vma->bind_vma(vma, target_i915_obj->cache_level, GLOBAL_BIND); | ||
| 365 | } | ||
| 366 | 363 | ||
| 367 | /* Validate that the target is in a valid r/w GPU domain */ | 364 | /* Validate that the target is in a valid r/w GPU domain */ |
| 368 | if (unlikely(reloc->write_domain & (reloc->write_domain - 1))) { | 365 | if (unlikely(reloc->write_domain & (reloc->write_domain - 1))) { |
| @@ -531,7 +528,7 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma, · 162 unmodified lines | |||
| 531 | 528 | ||
| 532 | flags = 0; | 529 | flags = 0; |
| 533 | if (entry->flags & __EXEC_OBJECT_NEEDS_MAP) | 530 | if (entry->flags & __EXEC_OBJECT_NEEDS_MAP) |
| 534 | flags |= PIN_MAPPABLE; | 531 | flags |= PIN_GLOBAL | PIN_MAPPABLE; |
| 535 | if (entry->flags & EXEC_OBJECT_NEEDS_GTT) | 532 | if (entry->flags & EXEC_OBJECT_NEEDS_GTT) |
| 536 | flags |= PIN_GLOBAL; | 533 | flags |= PIN_GLOBAL; |
| 537 | if (entry->flags & __EXEC_OBJECT_NEEDS_BIAS) | 534 | if (entry->flags & __EXEC_OBJECT_NEEDS_BIAS) |
| @@ -1368,17 +1365,19 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, · 830 unmodified lines | |||
| 1368 | batch_obj, | 1365 | batch_obj, |
| 1369 | args->batch_start_offset, | 1366 | args->batch_start_offset, |
| 1370 | file->is_master); | 1367 | file->is_master); |
| 1371 | if (ret) | 1368 | if (ret) { |
| 1372 | goto err; | 1369 | if (ret != -EACCES) |
| 1373 | 1370 | goto err; | |
| 1374 | /* | 1371 | } else { |
| 1375 | * XXX: Actually do this when enabling batch copy... | 1372 | /* |
| 1376 | * | 1373 | * XXX: Actually do this when enabling batch copy... |
| 1377 | * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit | 1374 | * |
| 1378 | * from MI_BATCH_BUFFER_START commands issued in the | 1375 | * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit |
| 1379 | * dispatch_execbuffer implementations. We specifically don't | 1376 | * from MI_BATCH_BUFFER_START commands issued in the |
| 1380 | * want that set when the command parser is enabled. | 1377 | * dispatch_execbuffer implementations. We specifically don't |
| 1381 | */ | 1378 | * want that set when the command parser is enabled. |
| 1379 | */ | ||
| 1380 | } | ||
| 1382 | } | 1381 | } |
| 1383 | 1382 | ||
| 1384 | /* snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure | 1383 | /* snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure |
| @@ -1266,7 +1266,7 @@ void i915_check_and_clear_faults(struct drm_device *dev) · 1265 unmodified lines | |||
| 1266 | fault_reg = I915_READ(RING_FAULT_REG(ring)); | 1266 | fault_reg = I915_READ(RING_FAULT_REG(ring)); |
| 1267 | if (fault_reg & RING_FAULT_VALID) { | 1267 | if (fault_reg & RING_FAULT_VALID) { |
| 1268 | DRM_DEBUG_DRIVER("Unexpected fault\n" | 1268 | DRM_DEBUG_DRIVER("Unexpected fault\n" |
| 1269 | "\tAddr: 0x%08lx\\n" | 1269 | "\tAddr: 0x%08lx\n" |
| 1270 | "\tAddress space: %s\n" | 1270 | "\tAddress space: %s\n" |
| 1271 | "\tSource ID: %d\n" | 1271 | "\tSource ID: %d\n" |
| 1272 | "\tType: %d\n", | 1272 | "\tType: %d\n", |
| @@ -1336,7 +1336,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev) · 63 unmodified lines | |||
| 1336 | * Unfortunately above, we've just wiped out the mappings | 1336 | * Unfortunately above, we've just wiped out the mappings |
| 1337 | * without telling our object about it. So we need to fake it. | 1337 | * without telling our object about it. So we need to fake it. |
| 1338 | */ | 1338 | */ |
| 1339 | obj->has_global_gtt_mapping = 0; | 1339 | vma->bound &= ~GLOBAL_BIND; |
| 1340 | vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); | 1340 | vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); |
| 1341 | } | 1341 | } |
| 1342 | 1342 | ||
| @@ -1533,7 +1533,7 @@ static void i915_ggtt_bind_vma(struct i915_vma *vma, · 190 unmodified lines | |||
| 1533 | 1533 | ||
| 1534 | BUG_ON(!i915_is_ggtt(vma->vm)); | 1534 | BUG_ON(!i915_is_ggtt(vma->vm)); |
| 1535 | intel_gtt_insert_sg_entries(vma->obj->pages, entry, flags); | 1535 | intel_gtt_insert_sg_entries(vma->obj->pages, entry, flags); |
| 1536 | vma->obj->has_global_gtt_mapping = 1; | 1536 | vma->bound = GLOBAL_BIND; |
| 1537 | } | 1537 | } |
| 1538 | 1538 | ||
| 1539 | static void i915_ggtt_clear_range(struct i915_address_space *vm, | 1539 | static void i915_ggtt_clear_range(struct i915_address_space *vm, |
| @@ -1552,7 +1552,7 @@ static void i915_ggtt_unbind_vma(struct i915_vma *vma) · 12 unmodified lines | |||
| 1552 | const unsigned int size = vma->obj->base.size >> PAGE_SHIFT; | 1552 | const unsigned int size = vma->obj->base.size >> PAGE_SHIFT; |
| 1553 | 1553 | ||
| 1554 | BUG_ON(!i915_is_ggtt(vma->vm)); | 1554 | BUG_ON(!i915_is_ggtt(vma->vm)); |
| 1555 | vma->obj->has_global_gtt_mapping = 0; | 1555 | vma->bound = 0; |
| 1556 | intel_gtt_clear_range(first, size); | 1556 | intel_gtt_clear_range(first, size); |
| 1557 | } | 1557 | } |
| 1558 | 1558 | ||
| @@ -1580,24 +1580,24 @@ static void ggtt_bind_vma(struct i915_vma *vma, · 21 unmodified lines | |||
| 1580 | * flags. At all other times, the GPU will use the aliasing PPGTT. | 1580 | * flags. At all other times, the GPU will use the aliasing PPGTT. |
| 1581 | */ | 1581 | */ |
| 1582 | if (!dev_priv->mm.aliasing_ppgtt || flags & GLOBAL_BIND) { | 1582 | if (!dev_priv->mm.aliasing_ppgtt || flags & GLOBAL_BIND) { |
| 1583 | if (!obj->has_global_gtt_mapping || | 1583 | if (!(vma->bound & GLOBAL_BIND) || |
| 1584 | (cache_level != obj->cache_level)) { | 1584 | (cache_level != obj->cache_level)) { |
| 1585 | vma->vm->insert_entries(vma->vm, obj->pages, | 1585 | vma->vm->insert_entries(vma->vm, obj->pages, |
| 1586 | vma->node.start, | 1586 | vma->node.start, |
| 1587 | cache_level, flags); | 1587 | cache_level, flags); |
| 1588 | obj->has_global_gtt_mapping = 1; | 1588 | vma->bound |= GLOBAL_BIND; |
| 1589 | } | 1589 | } |
| 1590 | } | 1590 | } |
| 1591 | 1591 | ||
| 1592 | if (dev_priv->mm.aliasing_ppgtt && | 1592 | if (dev_priv->mm.aliasing_ppgtt && |
| 1593 | (!obj->has_aliasing_ppgtt_mapping || | 1593 | (!(vma->bound & LOCAL_BIND) || |
| 1594 | (cache_level != obj->cache_level))) { | 1594 | (cache_level != obj->cache_level))) { |
| 1595 | struct i915_hw_ppgtt *appgtt = dev_priv->mm.aliasing_ppgtt; | 1595 | struct i915_hw_ppgtt *appgtt = dev_priv->mm.aliasing_ppgtt; |
| 1596 | appgtt->base.insert_entries(&appgtt->base, | 1596 | appgtt->base.insert_entries(&appgtt->base, |
| 1597 | vma->obj->pages, | 1597 | vma->obj->pages, |
| 1598 | vma->node.start, | 1598 | vma->node.start, |
| 1599 | cache_level, flags); | 1599 | cache_level, flags); |
| 1600 | vma->obj->has_aliasing_ppgtt_mapping = 1; | 1600 | vma->bound |= LOCAL_BIND; |
| 1601 | } | 1601 | } |
| 1602 | } | 1602 | } |
| 1603 | 1603 | ||
| @@ -1607,21 +1607,21 @@ static void ggtt_unbind_vma(struct i915_vma *vma) · 3 unmodified lines | |||
| 1607 | struct drm_i915_private *dev_priv = dev->dev_private; | 1607 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1608 | struct drm_i915_gem_object *obj = vma->obj; | 1608 | struct drm_i915_gem_object *obj = vma->obj; |
| 1609 | 1609 | ||
| 1610 | if (obj->has_global_gtt_mapping) { | 1610 | if (vma->bound & GLOBAL_BIND) { |
| 1611 | vma->vm->clear_range(vma->vm, | 1611 | vma->vm->clear_range(vma->vm, |
| 1612 | vma->node.start, | 1612 | vma->node.start, |
| 1613 | obj->base.size, | 1613 | obj->base.size, |
| 1614 | true); | 1614 | true); |
| 1615 | obj->has_global_gtt_mapping = 0; | 1615 | vma->bound &= ~GLOBAL_BIND; |
| 1616 | } | 1616 | } |
| 1617 | 1617 | ||
| 1618 | if (obj->has_aliasing_ppgtt_mapping) { | 1618 | if (vma->bound & LOCAL_BIND) { |
| 1619 | struct i915_hw_ppgtt *appgtt = dev_priv->mm.aliasing_ppgtt; | 1619 | struct i915_hw_ppgtt *appgtt = dev_priv->mm.aliasing_ppgtt; |
| 1620 | appgtt->base.clear_range(&appgtt->base, | 1620 | appgtt->base.clear_range(&appgtt->base, |
| 1621 | vma->node.start, | 1621 | vma->node.start, |
| 1622 | obj->base.size, | 1622 | obj->base.size, |
| 1623 | true); | 1623 | true); |
| 1624 | obj->has_aliasing_ppgtt_mapping = 0; | 1624 | vma->bound &= ~LOCAL_BIND; |
| 1625 | } | 1625 | } |
| 1626 | } | 1626 | } |
| 1627 | 1627 | ||
| @@ -1699,7 +1699,7 @@ int i915_gem_setup_global_gtt(struct drm_device *dev, · 71 unmodified lines | |||
| 1699 | DRM_DEBUG_KMS("Reservation failed: %i\n", ret); | 1699 | DRM_DEBUG_KMS("Reservation failed: %i\n", ret); |
| 1700 | return ret; | 1700 | return ret; |
| 1701 | } | 1701 | } |
| 1702 | obj->has_global_gtt_mapping = 1; | 1702 | vma->bound |= GLOBAL_BIND; |
| 1703 | } | 1703 | } |
| 1704 | 1704 | ||
| 1705 | dev_priv->gtt.base.start = start; | 1705 | dev_priv->gtt.base.start = start; |
| @@ -123,6 +123,12 @@ struct i915_vma { · 122 unmodified lines | |||
| 123 | struct drm_i915_gem_object *obj; | 123 | struct drm_i915_gem_object *obj; |
| 124 | struct i915_address_space *vm; | 124 | struct i915_address_space *vm; |
| 125 | 125 | ||
| 126 | /** Flags and address space this VMA is bound to */ | ||
| 127 | #define GLOBAL_BIND (1<<0) | ||
| 128 | #define LOCAL_BIND (1<<1) | ||
| 129 | #define PTE_READ_ONLY (1<<2) | ||
| 130 | unsigned int bound : 4; | ||
| 131 | |||
| 126 | /** This object's place on the active/inactive lists */ | 132 | /** This object's place on the active/inactive lists */ |
| 127 | struct list_head mm_list; | 133 | struct list_head mm_list; |
| 128 | 134 | ||
| @@ -155,8 +161,6 @@ struct i915_vma { · 26 unmodified lines | |||
| 155 | * setting the valid PTE entries to a reserved scratch page. */ | 161 | * setting the valid PTE entries to a reserved scratch page. */ |
| 156 | void (*unbind_vma)(struct i915_vma *vma); | 162 | void (*unbind_vma)(struct i915_vma *vma); |
| 157 | /* Map an object into an address space with the given cache flags. */ | 163 | /* Map an object into an address space with the given cache flags. */ |
| 158 | #define GLOBAL_BIND (1<<0) | ||
| 159 | #define PTE_READ_ONLY (1<<1) | ||
| 160 | void (*bind_vma)(struct i915_vma *vma, | 164 | void (*bind_vma)(struct i915_vma *vma, |
| 161 | enum i915_cache_level cache_level, | 165 | enum i915_cache_level cache_level, |
| 162 | u32 flags); | 166 | u32 flags); |
| @@ -38,6 +38,8 @@ render_state_get_rodata(struct drm_device *dev, const int gen) · 37 unmodified lines | |||
| 38 | return &gen7_null_state; | 38 | return &gen7_null_state; |
| 39 | case 8: | 39 | case 8: |
| 40 | return &gen8_null_state; | 40 | return &gen8_null_state; |
| 41 | case 9: | ||
| 42 | return &gen9_null_state; | ||
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | return NULL; | 45 | return NULL; |
| @@ -533,7 +533,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, · 532 unmodified lines | |||
| 533 | } | 533 | } |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | obj->has_global_gtt_mapping = 1; | 536 | vma->bound |= GLOBAL_BIND; |
| 537 | 537 | ||
| 538 | list_add_tail(&obj->global_list, &dev_priv->mm.bound_list); | 538 | list_add_tail(&obj->global_list, &dev_priv->mm.bound_list); |
| 539 | list_add_tail(&vma->mm_list, &ggtt->inactive_list); | 539 | list_add_tail(&vma->mm_list, &ggtt->inactive_list); |
| @@ -458,6 +458,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data, · 457 unmodified lines | |||
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | /* Hide bit 17 from the user -- see comment in i915_gem_set_tiling */ | 460 | /* Hide bit 17 from the user -- see comment in i915_gem_set_tiling */ |
| 461 | args->phys_swizzle_mode = args->swizzle_mode; | ||
| 461 | if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_17) | 462 | if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_17) |
| 462 | args->swizzle_mode = I915_BIT_6_SWIZZLE_9; | 463 | args->swizzle_mode = I915_BIT_6_SWIZZLE_9; |
| 463 | if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_10_17) | 464 | if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_10_17) |
| @@ -565,6 +565,7 @@ i915_error_object_create(struct drm_i915_private *dev_priv, · 564 unmodified lines | |||
| 565 | struct i915_address_space *vm) | 565 | struct i915_address_space *vm) |
| 566 | { | 566 | { |
| 567 | struct drm_i915_error_object *dst; | 567 | struct drm_i915_error_object *dst; |
| 568 | struct i915_vma *vma = NULL; | ||
| 568 | int num_pages; | 569 | int num_pages; |
| 569 | bool use_ggtt; | 570 | bool use_ggtt; |
| 570 | int i = 0; | 571 | int i = 0; |
| @@ -585,16 +586,17 @@ i915_error_object_create(struct drm_i915_private *dev_priv, · 14 unmodified lines | |||
| 585 | dst->gtt_offset = -1; | 586 | dst->gtt_offset = -1; |
| 586 | 587 | ||
| 587 | reloc_offset = dst->gtt_offset; | 588 | reloc_offset = dst->gtt_offset; |
| 589 | if (i915_is_ggtt(vm)) | ||
| 590 | vma = i915_gem_obj_to_ggtt(src); | ||
| 588 | use_ggtt = (src->cache_level == I915_CACHE_NONE && | 591 | use_ggtt = (src->cache_level == I915_CACHE_NONE && |
| 589 | i915_is_ggtt(vm) && | 592 | vma && (vma->bound & GLOBAL_BIND) && |
| 590 | src->has_global_gtt_mapping && | 593 | reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end); |
| 591 | reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end); | ||
| 592 | 594 | ||
| 593 | /* Cannot access stolen address directly, try to use the aperture */ | 595 | /* Cannot access stolen address directly, try to use the aperture */ |
| 594 | if (src->stolen) { | 596 | if (src->stolen) { |
| 595 | use_ggtt = true; | 597 | use_ggtt = true; |
| 596 | 598 | ||
| 597 | if (!src->has_global_gtt_mapping) | 599 | if (!(vma && vma->bound & GLOBAL_BIND)) |
| 598 | goto unwind; | 600 | goto unwind; |
| 599 | 601 | ||
| 600 | reloc_offset = i915_gem_obj_ggtt_offset(src); | 602 | reloc_offset = i915_gem_obj_ggtt_offset(src); |
| @@ -1240,7 +1242,8 @@ static void i915_error_capture_msg(struct drm_device *dev, · 639 unmodified lines | |||
| 1240 | ecode = i915_error_generate_code(dev_priv, error, &ring_id); | 1242 | ecode = i915_error_generate_code(dev_priv, error, &ring_id); |
| 1241 | 1243 | ||
| 1242 | len = scnprintf(error->error_msg, sizeof(error->error_msg), | 1244 | len = scnprintf(error->error_msg, sizeof(error->error_msg), |
| 1243 | "GPU HANG: ecode %d:0x%08x", ring_id, ecode); | 1245 | "GPU HANG: ecode %d:%d:0x%08x", |
| 1246 | INTEL_INFO(dev)->gen, ring_id, ecode); | ||
| 1244 | 1247 | ||
| 1245 | if (ring_id != -1 && error->ring[ring_id].pid != -1) | 1248 | if (ring_id != -1 && error->ring[ring_id].pid != -1) |
| 1246 | len += scnprintf(error->error_msg + len, | 1249 | len += scnprintf(error->error_msg + len, |
| @@ -126,16 +126,16 @@ static const u32 hpd_status_i915[] = { /* i915 and valleyview are the same */ · 125 unmodified lines | |||
| 126 | 126 | ||
| 127 | #define GEN8_IRQ_INIT_NDX(type, which, imr_val, ier_val) do { \ | 127 | #define GEN8_IRQ_INIT_NDX(type, which, imr_val, ier_val) do { \ |
| 128 | GEN5_ASSERT_IIR_IS_ZERO(GEN8_##type##_IIR(which)); \ | 128 | GEN5_ASSERT_IIR_IS_ZERO(GEN8_##type##_IIR(which)); \ |
| 129 | I915_WRITE(GEN8_##type##_IMR(which), (imr_val)); \ | ||
| 130 | I915_WRITE(GEN8_##type##_IER(which), (ier_val)); \ | 129 | I915_WRITE(GEN8_##type##_IER(which), (ier_val)); \ |
| 131 | POSTING_READ(GEN8_##type##_IER(which)); \ | 130 | I915_WRITE(GEN8_##type##_IMR(which), (imr_val)); \ |
| 131 | POSTING_READ(GEN8_##type##_IMR(which)); \ | ||
| 132 | } while (0) | 132 | } while (0) |
| 133 | 133 | ||
| 134 | #define GEN5_IRQ_INIT(type, imr_val, ier_val) do { \ | 134 | #define GEN5_IRQ_INIT(type, imr_val, ier_val) do { \ |
| 135 | GEN5_ASSERT_IIR_IS_ZERO(type##IIR); \ | 135 | GEN5_ASSERT_IIR_IS_ZERO(type##IIR); \ |
| 136 | I915_WRITE(type##IMR, (imr_val)); \ | ||
| 137 | I915_WRITE(type##IER, (ier_val)); \ | 136 | I915_WRITE(type##IER, (ier_val)); \ |
| 138 | POSTING_READ(type##IER); \ | 137 | I915_WRITE(type##IMR, (imr_val)); \ |
| 138 | POSTING_READ(type##IMR); \ | ||
| 139 | } while (0) | 139 | } while (0) |
| 140 | 140 | ||
| 141 | /* For display hotplug interrupt */ | 141 | /* For display hotplug interrupt */ |
| @@ -979,9 +979,6 @@ static void notify_ring(struct drm_device *dev, · 837 unmodified lines | |||
| 979 | 979 | ||
| 980 | trace_i915_gem_request_complete(ring); | 980 | trace_i915_gem_request_complete(ring); |
| 981 | 981 | ||
| 982 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 983 | intel_notify_mmio_flip(ring); | ||
| 984 | |||
| 985 | wake_up_all(&ring->irq_queue); | 982 | wake_up_all(&ring->irq_queue); |
| 986 | i915_queue_hangcheck(dev); | 983 | i915_queue_hangcheck(dev); |
| 987 | } | 984 | } |
| @@ -3105,10 +3102,22 @@ static void ironlake_irq_reset(struct drm_device *dev) · 2117 unmodified lines | |||
| 3105 | ibx_irq_reset(dev); | 3102 | ibx_irq_reset(dev); |
| 3106 | } | 3103 | } |
| 3107 | 3104 | ||
| 3105 | static void vlv_display_irq_reset(struct drm_i915_private *dev_priv) | ||
| 3106 | { | ||
| 3107 | enum pipe pipe; | ||
| 3108 | |||
| 3109 | I915_WRITE(PORT_HOTPLUG_EN, 0); | ||
| 3110 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); | ||
| 3111 | |||
| 3112 | for_each_pipe(dev_priv, pipe) | ||
| 3113 | I915_WRITE(PIPESTAT(pipe), 0xffff); | ||
| 3114 | |||
| 3115 | GEN5_IRQ_RESET(VLV_); | ||
| 3116 | } | ||
| 3117 | |||
| 3108 | static void valleyview_irq_preinstall(struct drm_device *dev) | 3118 | static void valleyview_irq_preinstall(struct drm_device *dev) |
| 3109 | { | 3119 | { |
| 3110 | struct drm_i915_private *dev_priv = dev->dev_private; | 3120 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 3111 | int pipe; | ||
| 3112 | 3121 | ||
| 3113 | /* VLV magic */ | 3122 | /* VLV magic */ |
| 3114 | I915_WRITE(VLV_IMR, 0); | 3123 | I915_WRITE(VLV_IMR, 0); |
| @@ -3116,22 +3125,11 @@ static void valleyview_irq_preinstall(struct drm_device *dev) · 1 unmodified line | |||
| 3116 | I915_WRITE(RING_IMR(GEN6_BSD_RING_BASE), 0); | 3125 | I915_WRITE(RING_IMR(GEN6_BSD_RING_BASE), 0); |
| 3117 | I915_WRITE(RING_IMR(BLT_RING_BASE), 0); | 3126 | I915_WRITE(RING_IMR(BLT_RING_BASE), 0); |
| 3118 | 3127 | ||
| 3119 | /* and GT */ | ||
| 3120 | I915_WRITE(GTIIR, I915_READ(GTIIR)); | ||
| 3121 | I915_WRITE(GTIIR, I915_READ(GTIIR)); | ||
| 3122 | |||
| 3123 | gen5_gt_irq_reset(dev); | 3128 | gen5_gt_irq_reset(dev); |
| 3124 | 3129 | ||
| 3125 | I915_WRITE(DPINVGTT, 0xff); | 3130 | I915_WRITE(DPINVGTT, DPINVGTT_STATUS_MASK); |
| 3126 | 3131 | ||
| 3127 | I915_WRITE(PORT_HOTPLUG_EN, 0); | 3132 | vlv_display_irq_reset(dev_priv); |
| 3128 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); | ||
| 3129 | for_each_pipe(dev_priv, pipe) | ||
| 3130 | I915_WRITE(PIPESTAT(pipe), 0xffff); | ||
| 3131 | I915_WRITE(VLV_IIR, 0xffffffff); | ||
| 3132 | I915_WRITE(VLV_IMR, 0xffffffff); | ||
| 3133 | I915_WRITE(VLV_IER, 0x0); | ||
| 3134 | POSTING_READ(VLV_IER); | ||
| 3135 | } | 3133 | } |
| 3136 | 3134 | ||
| 3137 | static void gen8_gt_irq_reset(struct drm_i915_private *dev_priv) | 3135 | static void gen8_gt_irq_reset(struct drm_i915_private *dev_priv) |
| @@ -3179,7 +3177,6 @@ void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv) · 41 unmodified lines | |||
| 3179 | static void cherryview_irq_preinstall(struct drm_device *dev) | 3177 | static void cherryview_irq_preinstall(struct drm_device *dev) |
| 3180 | { | 3178 | { |
| 3181 | struct drm_i915_private *dev_priv = dev->dev_private; | 3179 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 3182 | int pipe; | ||
| 3183 | 3180 | ||
| 3184 | I915_WRITE(GEN8_MASTER_IRQ, 0); | 3181 | I915_WRITE(GEN8_MASTER_IRQ, 0); |
| 3185 | POSTING_READ(GEN8_MASTER_IRQ); | 3182 | POSTING_READ(GEN8_MASTER_IRQ); |
| @@ -3188,20 +3185,9 @@ static void cherryview_irq_preinstall(struct drm_device *dev) · 2 unmodified lines | |||
| 3188 | 3185 | ||
| 3189 | GEN5_IRQ_RESET(GEN8_PCU_); | 3186 | GEN5_IRQ_RESET(GEN8_PCU_); |
| 3190 | 3187 | ||
| 3191 | POSTING_READ(GEN8_PCU_IIR); | ||
| 3192 | |||
| 3193 | I915_WRITE(DPINVGTT, DPINVGTT_STATUS_MASK_CHV); | 3188 | I915_WRITE(DPINVGTT, DPINVGTT_STATUS_MASK_CHV); |
| 3194 | 3189 | ||
| 3195 | I915_WRITE(PORT_HOTPLUG_EN, 0); | 3190 | vlv_display_irq_reset(dev_priv); |
| 3196 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); | ||
| 3197 | |||
| 3198 | for_each_pipe(dev_priv, pipe) | ||
| 3199 | I915_WRITE(PIPESTAT(pipe), 0xffff); | ||
| 3200 | |||
| 3201 | I915_WRITE(VLV_IMR, 0xffffffff); | ||
| 3202 | I915_WRITE(VLV_IER, 0x0); | ||
| 3203 | I915_WRITE(VLV_IIR, 0xffffffff); | ||
| 3204 | POSTING_READ(VLV_IIR); | ||
| 3205 | } | 3191 | } |
| 3206 | 3192 | ||
| 3207 | static void ibx_hpd_irq_setup(struct drm_device *dev) | 3193 | static void ibx_hpd_irq_setup(struct drm_device *dev) |
| @@ -3342,45 +3328,51 @@ static void valleyview_display_irqs_install(struct drm_i915_private *dev_priv) · 134 unmodified lines | |||
| 3342 | { | 3328 | { |
| 3343 | u32 pipestat_mask; | 3329 | u32 pipestat_mask; |
| 3344 | u32 iir_mask; | 3330 | u32 iir_mask; |
| 3331 | enum pipe pipe; | ||
| 3345 | 3332 | ||
| 3346 | pipestat_mask = PIPESTAT_INT_STATUS_MASK | | 3333 | pipestat_mask = PIPESTAT_INT_STATUS_MASK | |
| 3347 | PIPE_FIFO_UNDERRUN_STATUS; | 3334 | PIPE_FIFO_UNDERRUN_STATUS; |
| 3348 | 3335 | ||
| 3349 | I915_WRITE(PIPESTAT(PIPE_A), pipestat_mask); | 3336 | for_each_pipe(dev_priv, pipe) |
| 3350 | I915_WRITE(PIPESTAT(PIPE_B), pipestat_mask); | 3337 | I915_WRITE(PIPESTAT(pipe), pipestat_mask); |
| 3351 | POSTING_READ(PIPESTAT(PIPE_A)); | 3338 | POSTING_READ(PIPESTAT(PIPE_A)); |
| 3352 | 3339 | ||
| 3353 | pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV | | 3340 | pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV | |
| 3354 | PIPE_CRC_DONE_INTERRUPT_STATUS; | 3341 | PIPE_CRC_DONE_INTERRUPT_STATUS; |
| 3355 | 3342 | ||
| 3356 | i915_enable_pipestat(dev_priv, PIPE_A, pipestat_mask | | 3343 | i915_enable_pipestat(dev_priv, PIPE_A, PIPE_GMBUS_INTERRUPT_STATUS); |
| 3357 | PIPE_GMBUS_INTERRUPT_STATUS); | 3344 | for_each_pipe(dev_priv, pipe) |
| 3358 | i915_enable_pipestat(dev_priv, PIPE_B, pipestat_mask); | 3345 | i915_enable_pipestat(dev_priv, pipe, pipestat_mask); |
| 3359 | 3346 | ||
| 3360 | iir_mask = I915_DISPLAY_PORT_INTERRUPT | | 3347 | iir_mask = I915_DISPLAY_PORT_INTERRUPT | |
| 3361 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | | 3348 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | |
| 3362 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; | 3349 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; |
| 3350 | if (IS_CHERRYVIEW(dev_priv)) | ||
| 3351 | iir_mask |= I915_DISPLAY_PIPE_C_EVENT_INTERRUPT; | ||
| 3363 | dev_priv->irq_mask &= ~iir_mask; | 3352 | dev_priv->irq_mask &= ~iir_mask; |
| 3364 | 3353 | ||
| 3365 | I915_WRITE(VLV_IIR, iir_mask); | 3354 | I915_WRITE(VLV_IIR, iir_mask); |
| 3366 | I915_WRITE(VLV_IIR, iir_mask); | 3355 | I915_WRITE(VLV_IIR, iir_mask); |
| 3367 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); | ||
| 3368 | I915_WRITE(VLV_IER, ~dev_priv->irq_mask); | 3356 | I915_WRITE(VLV_IER, ~dev_priv->irq_mask); |
| 3369 | POSTING_READ(VLV_IER); | 3357 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); |
| 3358 | POSTING_READ(VLV_IMR); | ||
| 3370 | } | 3359 | } |
| 3371 | 3360 | ||
| 3372 | static void valleyview_display_irqs_uninstall(struct drm_i915_private *dev_priv) | 3361 | static void valleyview_display_irqs_uninstall(struct drm_i915_private *dev_priv) |
| 3373 | { | 3362 | { |
| 3374 | u32 pipestat_mask; | 3363 | u32 pipestat_mask; |
| 3375 | u32 iir_mask; | 3364 | u32 iir_mask; |
| 3365 | enum pipe pipe; | ||
| 3376 | 3366 | ||
| 3377 | iir_mask = I915_DISPLAY_PORT_INTERRUPT | | 3367 | iir_mask = I915_DISPLAY_PORT_INTERRUPT | |
| 3378 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | | 3368 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | |
| 3379 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; | 3369 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; |
| 3370 | if (IS_CHERRYVIEW(dev_priv)) | ||
| 3371 | iir_mask |= I915_DISPLAY_PIPE_C_EVENT_INTERRUPT; | ||
| 3380 | 3372 | ||
| 3381 | dev_priv->irq_mask |= iir_mask; | 3373 | dev_priv->irq_mask |= iir_mask; |
| 3382 | I915_WRITE(VLV_IER, ~dev_priv->irq_mask); | ||
| 3383 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); | 3374 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); |
| 3375 | I915_WRITE(VLV_IER, ~dev_priv->irq_mask); | ||
| 3384 | I915_WRITE(VLV_IIR, iir_mask); | 3376 | I915_WRITE(VLV_IIR, iir_mask); |
| 3385 | I915_WRITE(VLV_IIR, iir_mask); | 3377 | I915_WRITE(VLV_IIR, iir_mask); |
| 3386 | POSTING_READ(VLV_IIR); | 3378 | POSTING_READ(VLV_IIR); |
| @@ -3388,14 +3380,15 @@ static void valleyview_display_irqs_uninstall(struct drm_i915_private *dev_priv) · 1 unmodified line | |||
| 3388 | pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV | | 3380 | pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV | |
| 3389 | PIPE_CRC_DONE_INTERRUPT_STATUS; | 3381 | PIPE_CRC_DONE_INTERRUPT_STATUS; |
| 3390 | 3382 | ||
| 3391 | i915_disable_pipestat(dev_priv, PIPE_A, pipestat_mask | | 3383 | i915_disable_pipestat(dev_priv, PIPE_A, PIPE_GMBUS_INTERRUPT_STATUS); |
| 3392 | PIPE_GMBUS_INTERRUPT_STATUS); | 3384 | for_each_pipe(dev_priv, pipe) |
| 3393 | i915_disable_pipestat(dev_priv, PIPE_B, pipestat_mask); | 3385 | i915_disable_pipestat(dev_priv, pipe, pipestat_mask); |
| 3394 | 3386 | ||
| 3395 | pipestat_mask = PIPESTAT_INT_STATUS_MASK | | 3387 | pipestat_mask = PIPESTAT_INT_STATUS_MASK | |
| 3396 | PIPE_FIFO_UNDERRUN_STATUS; | 3388 | PIPE_FIFO_UNDERRUN_STATUS; |
| 3397 | I915_WRITE(PIPESTAT(PIPE_A), pipestat_mask); | 3389 | |
| 3398 | I915_WRITE(PIPESTAT(PIPE_B), pipestat_mask); | 3390 | for_each_pipe(dev_priv, pipe) |
| 3391 | I915_WRITE(PIPESTAT(pipe), pipestat_mask); | ||
| 3399 | POSTING_READ(PIPESTAT(PIPE_A)); | 3392 | POSTING_READ(PIPESTAT(PIPE_A)); |
| 3400 | } | 3393 | } |
| 3401 | 3394 | ||
| @@ -3425,19 +3418,18 @@ void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv) · 23 unmodified lines | |||
| 3425 | valleyview_display_irqs_uninstall(dev_priv); | 3418 | valleyview_display_irqs_uninstall(dev_priv); |
| 3426 | } | 3419 | } |
| 3427 | 3420 | ||
| 3428 | static int valleyview_irq_postinstall(struct drm_device *dev) | 3421 | static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv) |
| 3429 | { | 3422 | { |
| 3430 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3431 | |||
| 3432 | dev_priv->irq_mask = ~0; | 3423 | dev_priv->irq_mask = ~0; |
| 3433 | 3424 | ||
| 3434 | I915_WRITE(PORT_HOTPLUG_EN, 0); | 3425 | I915_WRITE(PORT_HOTPLUG_EN, 0); |
| 3435 | POSTING_READ(PORT_HOTPLUG_EN); | 3426 | POSTING_READ(PORT_HOTPLUG_EN); |
| 3436 | 3427 | ||
| 3437 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); | ||
| 3438 | I915_WRITE(VLV_IER, ~dev_priv->irq_mask); | ||
| 3439 | I915_WRITE(VLV_IIR, 0xffffffff); | 3428 | I915_WRITE(VLV_IIR, 0xffffffff); |
| 3440 | POSTING_READ(VLV_IER); | 3429 | I915_WRITE(VLV_IIR, 0xffffffff); |
| 3430 | I915_WRITE(VLV_IER, ~dev_priv->irq_mask); | ||
| 3431 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); | ||
| 3432 | POSTING_READ(VLV_IMR); | ||
| 3441 | 3433 | ||
| 3442 | /* Interrupt setup is already guaranteed to be single-threaded, this is | 3434 | /* Interrupt setup is already guaranteed to be single-threaded, this is |
| 3443 | * just to make the assert_spin_locked check happy. */ | 3435 | * just to make the assert_spin_locked check happy. */ |
| @@ -3445,9 +3437,13 @@ static int valleyview_irq_postinstall(struct drm_device *dev) · 1 unmodified line | |||
| 3445 | if (dev_priv->display_irqs_enabled) | 3437 | if (dev_priv->display_irqs_enabled) |
| 3446 | valleyview_display_irqs_install(dev_priv); | 3438 | valleyview_display_irqs_install(dev_priv); |
| 3447 | spin_unlock_irq(&dev_priv->irq_lock); | 3439 | spin_unlock_irq(&dev_priv->irq_lock); |
| 3440 | } | ||
| 3448 | 3441 | ||
| 3449 | I915_WRITE(VLV_IIR, 0xffffffff); | 3442 | static int valleyview_irq_postinstall(struct drm_device *dev) |
| 3450 | I915_WRITE(VLV_IIR, 0xffffffff); | 3443 | { |
| 3444 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3445 | |||
| 3446 | vlv_display_irq_postinstall(dev_priv); | ||
| 3451 | 3447 | ||
| 3452 | gen5_gt_irq_postinstall(dev); | 3448 | gen5_gt_irq_postinstall(dev); |
| 3453 | 3449 | ||
| @@ -3561,8 +3557,10 @@ static int cherryview_irq_postinstall(struct drm_device *dev) · 107 unmodified lines | |||
| 3561 | spin_unlock_irq(&dev_priv->irq_lock); | 3557 | spin_unlock_irq(&dev_priv->irq_lock); |
| 3562 | 3558 | ||
| 3563 | I915_WRITE(VLV_IIR, 0xffffffff); | 3559 | I915_WRITE(VLV_IIR, 0xffffffff); |
| 3564 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); | 3560 | I915_WRITE(VLV_IIR, 0xffffffff); |
| 3565 | I915_WRITE(VLV_IER, enable_mask); | 3561 | I915_WRITE(VLV_IER, enable_mask); |
| 3562 | I915_WRITE(VLV_IMR, dev_priv->irq_mask); | ||
| 3563 | POSTING_READ(VLV_IMR); | ||
| 3566 | 3564 | ||
| 3567 | gen8_gt_irq_postinstall(dev_priv); | 3565 | gen8_gt_irq_postinstall(dev_priv); |
| 3568 | 3566 | ||
| @@ -3585,19 +3583,15 @@ static void gen8_irq_uninstall(struct drm_device *dev) · 16 unmodified lines | |||
| 3585 | static void valleyview_irq_uninstall(struct drm_device *dev) | 3583 | static void valleyview_irq_uninstall(struct drm_device *dev) |
| 3586 | { | 3584 | { |
| 3587 | struct drm_i915_private *dev_priv = dev->dev_private; | 3585 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 3588 | int pipe; | ||
| 3589 | 3586 | ||
| 3590 | if (!dev_priv) | 3587 | if (!dev_priv) |
| 3591 | return; | 3588 | return; |
| 3592 | 3589 | ||
| 3593 | I915_WRITE(VLV_MASTER_IER, 0); | 3590 | I915_WRITE(VLV_MASTER_IER, 0); |
| 3594 | 3591 | ||
| 3595 | for_each_pipe(dev_priv, pipe) | 3592 | gen5_gt_irq_reset(dev); |
| 3596 | I915_WRITE(PIPESTAT(pipe), 0xffff); | ||
| 3597 | 3593 | ||
| 3598 | I915_WRITE(HWSTAM, 0xffffffff); | 3594 | I915_WRITE(HWSTAM, 0xffffffff); |
| 3599 | I915_WRITE(PORT_HOTPLUG_EN, 0); | ||
| 3600 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); | ||
| 3601 | 3595 | ||
| 3602 | /* Interrupt setup is already guaranteed to be single-threaded, this is | 3596 | /* Interrupt setup is already guaranteed to be single-threaded, this is |
| 3603 | * just to make the assert_spin_locked check happy. */ | 3597 | * just to make the assert_spin_locked check happy. */ |
| @@ -3606,12 +3600,9 @@ static void valleyview_irq_uninstall(struct drm_device *dev) · 2 unmodified lines | |||
| 3606 | valleyview_display_irqs_uninstall(dev_priv); | 3600 | valleyview_display_irqs_uninstall(dev_priv); |
| 3607 | spin_unlock_irq(&dev_priv->irq_lock); | 3601 | spin_unlock_irq(&dev_priv->irq_lock); |
| 3608 | 3602 | ||
| 3609 | dev_priv->irq_mask = 0; | 3603 | vlv_display_irq_reset(dev_priv); |
| 3610 | 3604 | ||
| 3611 | I915_WRITE(VLV_IIR, 0xffffffff); | 3605 | dev_priv->irq_mask = 0; |
| 3612 | I915_WRITE(VLV_IMR, 0xffffffff); | ||
| 3613 | I915_WRITE(VLV_IER, 0x0); | ||
| 3614 | POSTING_READ(VLV_IER); | ||
| 3615 | } | 3606 | } |
| 3616 | 3607 | ||
| 3617 | static void cherryview_irq_uninstall(struct drm_device *dev) | 3608 | static void cherryview_irq_uninstall(struct drm_device *dev) |
| @@ -3625,33 +3616,9 @@ static void cherryview_irq_uninstall(struct drm_device *dev) · 7 unmodified lines | |||
| 3625 | I915_WRITE(GEN8_MASTER_IRQ, 0); | 3616 | I915_WRITE(GEN8_MASTER_IRQ, 0); |
| 3626 | POSTING_READ(GEN8_MASTER_IRQ); | 3617 | POSTING_READ(GEN8_MASTER_IRQ); |
| 3627 | 3618 | ||
| 3628 | #define GEN8_IRQ_FINI_NDX(type, which) \ | 3619 | gen8_gt_irq_reset(dev_priv); |
| 3629 | do { \ | ||
| 3630 | I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \ | ||
| 3631 | I915_WRITE(GEN8_##type##_IER(which), 0); \ | ||
| 3632 | I915_WRITE(GEN8_##type##_IIR(which), 0xffffffff); \ | ||
| 3633 | POSTING_READ(GEN8_##type##_IIR(which)); \ | ||
| 3634 | I915_WRITE(GEN8_##type##_IIR(which), 0xffffffff); \ | ||
| 3635 | } while (0) | ||
| 3636 | |||
| 3637 | #define GEN8_IRQ_FINI(type) \ | ||
| 3638 | do { \ | ||
| 3639 | I915_WRITE(GEN8_##type##_IMR, 0xffffffff); \ | ||
| 3640 | I915_WRITE(GEN8_##type##_IER, 0); \ | ||
| 3641 | I915_WRITE(GEN8_##type##_IIR, 0xffffffff); \ | ||
| 3642 | POSTING_READ(GEN8_##type##_IIR); \ | ||
| 3643 | I915_WRITE(GEN8_##type##_IIR, 0xffffffff); \ | ||
| 3644 | } while (0) | ||
| 3645 | |||
| 3646 | GEN8_IRQ_FINI_NDX(GT, 0); | ||
| 3647 | GEN8_IRQ_FINI_NDX(GT, 1); | ||
| 3648 | GEN8_IRQ_FINI_NDX(GT, 2); | ||
| 3649 | GEN8_IRQ_FINI_NDX(GT, 3); | ||
| 3650 | |||
| 3651 | GEN8_IRQ_FINI(PCU); | ||
| 3652 | 3620 | ||
| 3653 | #undef GEN8_IRQ_FINI | 3621 | GEN5_IRQ_RESET(GEN8_PCU_); |
| 3654 | #undef GEN8_IRQ_FINI_NDX | ||
| 3655 | 3622 | ||
| 3656 | I915_WRITE(PORT_HOTPLUG_EN, 0); | 3623 | I915_WRITE(PORT_HOTPLUG_EN, 0); |
| 3657 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); | 3624 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); |
| @@ -3659,10 +3626,7 @@ do { \ · 1 unmodified line | |||
| 3659 | for_each_pipe(dev_priv, pipe) | 3626 | for_each_pipe(dev_priv, pipe) |
| 3660 | I915_WRITE(PIPESTAT(pipe), 0xffff); | 3627 | I915_WRITE(PIPESTAT(pipe), 0xffff); |
| 3661 | 3628 | ||
| 3662 | I915_WRITE(VLV_IMR, 0xffffffff); | 3629 | GEN5_IRQ_RESET(VLV_); |
| 3663 | I915_WRITE(VLV_IER, 0x0); | ||
| 3664 | I915_WRITE(VLV_IIR, 0xffffffff); | ||
| 3665 | POSTING_READ(VLV_IIR); | ||
| 3666 | } | 3630 | } |
| 3667 | 3631 | ||
| 3668 | static void ironlake_irq_uninstall(struct drm_device *dev) | 3632 | static void ironlake_irq_uninstall(struct drm_device *dev) |
| @@ -4102,6 +4102,41 @@ enum punit_power_well { · 4101 unmodified lines | |||
| 4102 | #define I965_CURSOR_MAX_WM 32 | 4102 | #define I965_CURSOR_MAX_WM 32 |
| 4103 | #define I965_CURSOR_DFT_WM 8 | 4103 | #define I965_CURSOR_DFT_WM 8 |
| 4104 | 4104 | ||
| 4105 | /* Watermark register definitions for SKL */ | ||
| 4106 | #define CUR_WM_A_0 0x70140 | ||
| 4107 | #define CUR_WM_B_0 0x71140 | ||
| 4108 | #define PLANE_WM_1_A_0 0x70240 | ||
| 4109 | #define PLANE_WM_1_B_0 0x71240 | ||
| 4110 | #define PLANE_WM_2_A_0 0x70340 | ||
| 4111 | #define PLANE_WM_2_B_0 0x71340 | ||
| 4112 | #define PLANE_WM_TRANS_1_A_0 0x70268 | ||
| 4113 | #define PLANE_WM_TRANS_1_B_0 0x71268 | ||
| 4114 | #define PLANE_WM_TRANS_2_A_0 0x70368 | ||
| 4115 | #define PLANE_WM_TRANS_2_B_0 0x71368 | ||
| 4116 | #define CUR_WM_TRANS_A_0 0x70168 | ||
| 4117 | #define CUR_WM_TRANS_B_0 0x71168 | ||
| 4118 | #define PLANE_WM_EN (1 << 31) | ||
| 4119 | #define PLANE_WM_LINES_SHIFT 14 | ||
| 4120 | #define PLANE_WM_LINES_MASK 0x1f | ||
| 4121 | #define PLANE_WM_BLOCKS_MASK 0x3ff | ||
| 4122 | |||
| 4123 | #define CUR_WM_0(pipe) _PIPE(pipe, CUR_WM_A_0, CUR_WM_B_0) | ||
| 4124 | #define CUR_WM(pipe, level) (CUR_WM_0(pipe) + ((4) * (level))) | ||
| 4125 | #define CUR_WM_TRANS(pipe) _PIPE(pipe, CUR_WM_TRANS_A_0, CUR_WM_TRANS_B_0) | ||
| 4126 | |||
| 4127 | #define _PLANE_WM_1(pipe) _PIPE(pipe, PLANE_WM_1_A_0, PLANE_WM_1_B_0) | ||
| 4128 | #define _PLANE_WM_2(pipe) _PIPE(pipe, PLANE_WM_2_A_0, PLANE_WM_2_B_0) | ||
| 4129 | #define _PLANE_WM_BASE(pipe, plane) \ | ||
| 4130 | _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe)) | ||
| 4131 | #define PLANE_WM(pipe, plane, level) \ | ||
| 4132 | (_PLANE_WM_BASE(pipe, plane) + ((4) * (level))) | ||
| 4133 | #define _PLANE_WM_TRANS_1(pipe) \ | ||
| 4134 | _PIPE(pipe, PLANE_WM_TRANS_1_A_0, PLANE_WM_TRANS_1_B_0) | ||
| 4135 | #define _PLANE_WM_TRANS_2(pipe) \ | ||
| 4136 | _PIPE(pipe, PLANE_WM_TRANS_2_A_0, PLANE_WM_TRANS_2_B_0) | ||
| 4137 | #define PLANE_WM_TRANS(pipe, plane) \ | ||
| 4138 | _PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)) | ||
| 4139 | |||
| 4105 | /* define the Watermark register on Ironlake */ | 4140 | /* define the Watermark register on Ironlake */ |
| 4106 | #define WM0_PIPEA_ILK 0x45100 | 4141 | #define WM0_PIPEA_ILK 0x45100 |
| 4107 | #define WM0_PIPE_PLANE_MASK (0xffff<<16) | 4142 | #define WM0_PIPE_PLANE_MASK (0xffff<<16) |
| @@ -4272,9 +4307,11 @@ enum punit_power_well { · 164 unmodified lines | |||
| 4272 | #define DISPPLANE_NO_LINE_DOUBLE 0 | 4307 | #define DISPPLANE_NO_LINE_DOUBLE 0 |
| 4273 | #define DISPPLANE_STEREO_POLARITY_FIRST 0 | 4308 | #define DISPPLANE_STEREO_POLARITY_FIRST 0 |
| 4274 | #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) | 4309 | #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) |
| 4275 | #define DISPPLANE_ROTATE_180 (1<<15) | 4310 | #define DISPPLANE_ALPHA_PREMULTIPLY (1<<16) /* CHV pipe B */ |
| 4311 | #define DISPPLANE_ROTATE_180 (1<<15) | ||
| 4276 | #define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14) /* Ironlake */ | 4312 | #define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14) /* Ironlake */ |
| 4277 | #define DISPPLANE_TILED (1<<10) | 4313 | #define DISPPLANE_TILED (1<<10) |
| 4314 | #define DISPPLANE_MIRROR (1<<8) /* CHV pipe B */ | ||
| 4278 | #define _DSPAADDR 0x70184 | 4315 | #define _DSPAADDR 0x70184 |
| 4279 | #define _DSPASTRIDE 0x70188 | 4316 | #define _DSPASTRIDE 0x70188 |
| 4280 | #define _DSPAPOS 0x7018C /* reserved */ | 4317 | #define _DSPAPOS 0x7018C /* reserved */ |
| @@ -4295,6 +4332,24 @@ enum punit_power_well { · 14 unmodified lines | |||
| 4295 | #define DSPOFFSET(plane) _PIPE2(plane, _DSPAOFFSET) | 4332 | #define DSPOFFSET(plane) _PIPE2(plane, _DSPAOFFSET) |
| 4296 | #define DSPSURFLIVE(plane) _PIPE2(plane, _DSPASURFLIVE) | 4333 | #define DSPSURFLIVE(plane) _PIPE2(plane, _DSPASURFLIVE) |
| 4297 | 4334 | ||
| 4335 | /* CHV pipe B blender and primary plane */ | ||
| 4336 | #define _CHV_BLEND_A 0x60a00 | ||
| 4337 | #define CHV_BLEND_LEGACY (0<<30) | ||
| 4338 | #define CHV_BLEND_ANDROID (1<<30) | ||
| 4339 | #define CHV_BLEND_MPO (2<<30) | ||
| 4340 | #define CHV_BLEND_MASK (3<<30) | ||
| 4341 | #define _CHV_CANVAS_A 0x60a04 | ||
| 4342 | #define _PRIMPOS_A 0x60a08 | ||
| 4343 | #define _PRIMSIZE_A 0x60a0c | ||
| 4344 | #define _PRIMCNSTALPHA_A 0x60a10 | ||
| 4345 | #define PRIM_CONST_ALPHA_ENABLE (1<<31) | ||
| 4346 | |||
| 4347 | #define CHV_BLEND(pipe) _TRANSCODER2(pipe, _CHV_BLEND_A) | ||
| 4348 | #define CHV_CANVAS(pipe) _TRANSCODER2(pipe, _CHV_CANVAS_A) | ||
| 4349 | #define PRIMPOS(plane) _TRANSCODER2(plane, _PRIMPOS_A) | ||
| 4350 | #define PRIMSIZE(plane) _TRANSCODER2(plane, _PRIMSIZE_A) | ||
| 4351 | #define PRIMCNSTALPHA(plane) _TRANSCODER2(plane, _PRIMCNSTALPHA_A) | ||
| 4352 | |||
| 4298 | /* Display/Sprite base address macros */ | 4353 | /* Display/Sprite base address macros */ |
| 4299 | #define DISP_BASEADDR_MASK (0xfffff000) | 4354 | #define DISP_BASEADDR_MASK (0xfffff000) |
| 4300 | #define I915_LO_DISPBASE(val) (val & ~DISP_BASEADDR_MASK) | 4355 | #define I915_LO_DISPBASE(val) (val & ~DISP_BASEADDR_MASK) |
| @@ -4496,6 +4551,7 @@ enum punit_power_well { · 195 unmodified lines | |||
| 4496 | #define SP_FORMAT_RGBA1010102 (9<<26) | 4551 | #define SP_FORMAT_RGBA1010102 (9<<26) |
| 4497 | #define SP_FORMAT_RGBX8888 (0xe<<26) | 4552 | #define SP_FORMAT_RGBX8888 (0xe<<26) |
| 4498 | #define SP_FORMAT_RGBA8888 (0xf<<26) | 4553 | #define SP_FORMAT_RGBA8888 (0xf<<26) |
| 4554 | #define SP_ALPHA_PREMULTIPLY (1<<23) /* CHV pipe B */ | ||
| 4499 | #define SP_SOURCE_KEY (1<<22) | 4555 | #define SP_SOURCE_KEY (1<<22) |
| 4500 | #define SP_YUV_BYTE_ORDER_MASK (3<<16) | 4556 | #define SP_YUV_BYTE_ORDER_MASK (3<<16) |
| 4501 | #define SP_YUV_ORDER_YUYV (0<<16) | 4557 | #define SP_YUV_ORDER_YUYV (0<<16) |
| @@ -4504,6 +4560,7 @@ enum punit_power_well { · 2 unmodified lines | |||
| 4504 | #define SP_YUV_ORDER_VYUY (3<<16) | 4560 | #define SP_YUV_ORDER_VYUY (3<<16) |
| 4505 | #define SP_ROTATE_180 (1<<15) | 4561 | #define SP_ROTATE_180 (1<<15) |
| 4506 | #define SP_TILED (1<<10) | 4562 | #define SP_TILED (1<<10) |
| 4563 | #define SP_MIRROR (1<<8) /* CHV pipe B */ | ||
| 4507 | #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184) | 4564 | #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184) |
| 4508 | #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188) | 4565 | #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188) |
| 4509 | #define _SPAPOS (VLV_DISPLAY_BASE + 0x7218c) | 4566 | #define _SPAPOS (VLV_DISPLAY_BASE + 0x7218c) |
| @@ -4514,6 +4571,7 @@ enum punit_power_well { · 4 unmodified lines | |||
| 4514 | #define _SPAKEYMAXVAL (VLV_DISPLAY_BASE + 0x721a0) | 4571 | #define _SPAKEYMAXVAL (VLV_DISPLAY_BASE + 0x721a0) |
| 4515 | #define _SPATILEOFF (VLV_DISPLAY_BASE + 0x721a4) | 4572 | #define _SPATILEOFF (VLV_DISPLAY_BASE + 0x721a4) |
| 4516 | #define _SPACONSTALPHA (VLV_DISPLAY_BASE + 0x721a8) | 4573 | #define _SPACONSTALPHA (VLV_DISPLAY_BASE + 0x721a8) |
| 4574 | #define SP_CONST_ALPHA_ENABLE (1<<31) | ||
| 4517 | #define _SPAGAMC (VLV_DISPLAY_BASE + 0x721f4) | 4575 | #define _SPAGAMC (VLV_DISPLAY_BASE + 0x721f4) |
| 4518 | 4576 | ||
| 4519 | #define _SPBCNTR (VLV_DISPLAY_BASE + 0x72280) | 4577 | #define _SPBCNTR (VLV_DISPLAY_BASE + 0x72280) |
| @@ -4542,6 +4600,39 @@ enum punit_power_well { · 22 unmodified lines | |||
| 4542 | #define SPCONSTALPHA(pipe, plane) _PIPE(pipe * 2 + plane, _SPACONSTALPHA, _SPBCONSTALPHA) | 4600 | #define SPCONSTALPHA(pipe, plane) _PIPE(pipe * 2 + plane, _SPACONSTALPHA, _SPBCONSTALPHA) |
| 4543 | #define SPGAMC(pipe, plane) _PIPE(pipe * 2 + plane, _SPAGAMC, _SPBGAMC) | 4601 | #define SPGAMC(pipe, plane) _PIPE(pipe * 2 + plane, _SPAGAMC, _SPBGAMC) |
| 4544 | 4602 | ||
| 4603 | /* | ||
| 4604 | * CHV pipe B sprite CSC | ||
| 4605 | * | ||
| 4606 | * |cr| |c0 c1 c2| |cr + cr_ioff| |cr_ooff| | ||
| 4607 | * |yg| = |c3 c4 c5| x |yg + yg_ioff| + |yg_ooff| | ||
| 4608 | * |cb| |c6 c7 c8| |cb + cr_ioff| |cb_ooff| | ||
| 4609 | */ | ||
| 4610 | #define SPCSCYGOFF(sprite) (VLV_DISPLAY_BASE + 0x6d900 + (sprite) * 0x1000) | ||
| 4611 | #define SPCSCCBOFF(sprite) (VLV_DISPLAY_BASE + 0x6d904 + (sprite) * 0x1000) | ||
| 4612 | #define SPCSCCROFF(sprite) (VLV_DISPLAY_BASE + 0x6d908 + (sprite) * 0x1000) | ||
| 4613 | #define SPCSC_OOFF(x) (((x) & 0x7ff) << 16) /* s11 */ | ||
| 4614 | #define SPCSC_IOFF(x) (((x) & 0x7ff) << 0) /* s11 */ | ||
| 4615 | |||
| 4616 | #define SPCSCC01(sprite) (VLV_DISPLAY_BASE + 0x6d90c + (sprite) * 0x1000) | ||
| 4617 | #define SPCSCC23(sprite) (VLV_DISPLAY_BASE + 0x6d910 + (sprite) * 0x1000) | ||
| 4618 | #define SPCSCC45(sprite) (VLV_DISPLAY_BASE + 0x6d914 + (sprite) * 0x1000) | ||
| 4619 | #define SPCSCC67(sprite) (VLV_DISPLAY_BASE + 0x6d918 + (sprite) * 0x1000) | ||
| 4620 | #define SPCSCC8(sprite) (VLV_DISPLAY_BASE + 0x6d91c + (sprite) * 0x1000) | ||
| 4621 | #define SPCSC_C1(x) (((x) & 0x7fff) << 16) /* s3.12 */ | ||
| 4622 | #define SPCSC_C0(x) (((x) & 0x7fff) << 0) /* s3.12 */ | ||
| 4623 | |||
| 4624 | #define SPCSCYGICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d920 + (sprite) * 0x1000) | ||
| 4625 | #define SPCSCCBICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d924 + (sprite) * 0x1000) | ||
| 4626 | #define SPCSCCRICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d928 + (sprite) * 0x1000) | ||
| 4627 | #define SPCSC_IMAX(x) (((x) & 0x7ff) << 16) /* s11 */ | ||
| 4628 | #define SPCSC_IMIN(x) (((x) & 0x7ff) << 0) /* s11 */ | ||
| 4629 | |||
| 4630 | #define SPCSCYGOCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d92c + (sprite) * 0x1000) | ||
| 4631 | #define SPCSCCBOCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d930 + (sprite) * 0x1000) | ||
| 4632 | #define SPCSCCROCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d934 + (sprite) * 0x1000) | ||
| 4633 | #define SPCSC_OMAX(x) ((x) << 16) /* u10 */ | ||
| 4634 | #define SPCSC_OMIN(x) ((x) << 0) /* u10 */ | ||
| 4635 | |||
| 4545 | /* Skylake plane registers */ | 4636 | /* Skylake plane registers */ |
| 4546 | 4637 | ||
| 4547 | #define _PLANE_CTL_1_A 0x70180 | 4638 | #define _PLANE_CTL_1_A 0x70180 |
| @@ -4605,6 +4696,8 @@ enum punit_power_well { · 57 unmodified lines | |||
| 4605 | #define _PLANE_KEYMSK_2_A 0x70298 | 4696 | #define _PLANE_KEYMSK_2_A 0x70298 |
| 4606 | #define _PLANE_KEYMAX_1_A 0x701a0 | 4697 | #define _PLANE_KEYMAX_1_A 0x701a0 |
| 4607 | #define _PLANE_KEYMAX_2_A 0x702a0 | 4698 | #define _PLANE_KEYMAX_2_A 0x702a0 |
| 4699 | #define _PLANE_BUF_CFG_1_A 0x7027c | ||
| 4700 | #define _PLANE_BUF_CFG_2_A 0x7037c | ||
| 4608 | 4701 | ||
| 4609 | #define _PLANE_CTL_1_B 0x71180 | 4702 | #define _PLANE_CTL_1_B 0x71180 |
| 4610 | #define _PLANE_CTL_2_B 0x71280 | 4703 | #define _PLANE_CTL_2_B 0x71280 |
| @@ -4682,6 +4775,20 @@ enum punit_power_well { · 71 unmodified lines | |||
| 4682 | #define PLANE_KEYMAX(pipe, plane) \ | 4775 | #define PLANE_KEYMAX(pipe, plane) \ |
| 4683 | _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) | 4776 | _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) |
| 4684 | 4777 | ||
| 4778 | #define _PLANE_BUF_CFG_1_B 0x7127c | ||
| 4779 | #define _PLANE_BUF_CFG_2_B 0x7137c | ||
| 4780 | #define _PLANE_BUF_CFG_1(pipe) \ | ||
| 4781 | _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B) | ||
| 4782 | #define _PLANE_BUF_CFG_2(pipe) \ | ||
| 4783 | _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B) | ||
| 4784 | #define PLANE_BUF_CFG(pipe, plane) \ | ||
| 4785 | _PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe)) | ||
| 4786 | |||
| 4787 | /* SKL new cursor registers */ | ||
| 4788 | #define _CUR_BUF_CFG_A 0x7017c | ||
| 4789 | #define _CUR_BUF_CFG_B 0x7117c | ||
| 4790 | #define CUR_BUF_CFG(pipe) _PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B) | ||
| 4791 | |||
| 4685 | /* VBIOS regs */ | 4792 | /* VBIOS regs */ |
| 4686 | #define VGACNTRL 0x71400 | 4793 | #define VGACNTRL 0x71400 |
| 4687 | # define VGA_DISP_DISABLE (1 << 31) | 4794 | # define VGA_DISP_DISABLE (1 << 31) |
| @@ -5726,6 +5833,12 @@ enum punit_power_well { · 1038 unmodified lines | |||
| 5726 | #define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5) | 5833 | #define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5) |
| 5727 | #define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7) | 5834 | #define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7) |
| 5728 | #define FORCEWAKE_MT 0xa188 /* multi-threaded */ | 5835 | #define FORCEWAKE_MT 0xa188 /* multi-threaded */ |
| 5836 | #define FORCEWAKE_MEDIA_GEN9 0xa270 | ||
| 5837 | #define FORCEWAKE_RENDER_GEN9 0xa278 | ||
| 5838 | #define FORCEWAKE_BLITTER_GEN9 0xa188 | ||
| 5839 | #define FORCEWAKE_ACK_MEDIA_GEN9 0x0D88 | ||
| 5840 | #define FORCEWAKE_ACK_RENDER_GEN9 0x0D84 | ||
| 5841 | #define FORCEWAKE_ACK_BLITTER_GEN9 0x130044 | ||
| 5729 | #define FORCEWAKE_KERNEL 0x1 | 5842 | #define FORCEWAKE_KERNEL 0x1 |
| 5730 | #define FORCEWAKE_USER 0x2 | 5843 | #define FORCEWAKE_USER 0x2 |
| 5731 | #define FORCEWAKE_MT_ACK 0x130040 | 5844 | #define FORCEWAKE_MT_ACK 0x130040 |
| @@ -5901,6 +6014,13 @@ enum punit_power_well { · 169 unmodified lines | |||
| 5901 | #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8 | 6014 | #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8 |
| 5902 | #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 | 6015 | #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 |
| 5903 | 6016 | ||
| 6017 | #define GEN9_PCODE_DATA1 0x13812C | ||
| 6018 | #define GEN9_PCODE_READ_MEM_LATENCY 0x6 | ||
| 6019 | #define GEN9_MEM_LATENCY_LEVEL_MASK 0xFF | ||
| 6020 | #define GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT 8 | ||
| 6021 | #define GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT 16 | ||
| 6022 | #define GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT 24 | ||
| 6023 | |||
| 5904 | #define GEN6_GT_CORE_STATUS 0x138060 | 6024 | #define GEN6_GT_CORE_STATUS 0x138060 |
| 5905 | #define GEN6_CORE_CPD_STATE_MASK (7<<4) | 6025 | #define GEN6_CORE_CPD_STATE_MASK (7<<4) |
| 5906 | #define GEN6_RCn_MASK 7 | 6026 | #define GEN6_RCn_MASK 7 |
| @@ -5955,57 +6075,58 @@ enum punit_power_well { · 48 unmodified lines | |||
| 5955 | #define GEN8_CENTROID_PIXEL_OPT_DIS (1<<8) | 6075 | #define GEN8_CENTROID_PIXEL_OPT_DIS (1<<8) |
| 5956 | #define GEN8_SAMPLER_POWER_BYPASS_DIS (1<<1) | 6076 | #define GEN8_SAMPLER_POWER_BYPASS_DIS (1<<1) |
| 5957 | 6077 | ||
| 6078 | /* Audio */ | ||
| 5958 | #define G4X_AUD_VID_DID (dev_priv->info.display_mmio_offset + 0x62020) | 6079 | #define G4X_AUD_VID_DID (dev_priv->info.display_mmio_offset + 0x62020) |
| 5959 | #define INTEL_AUDIO_DEVCL 0x808629FB | 6080 | #define INTEL_AUDIO_DEVCL 0x808629FB |
| 5960 | #define INTEL_AUDIO_DEVBLC 0x80862801 | 6081 | #define INTEL_AUDIO_DEVBLC 0x80862801 |
| 5961 | #define INTEL_AUDIO_DEVCTG 0x80862802 | 6082 | #define INTEL_AUDIO_DEVCTG 0x80862802 |
| 5962 | 6083 | ||
| 5963 | #define G4X_AUD_CNTL_ST 0x620B4 | 6084 | #define G4X_AUD_CNTL_ST 0x620B4 |
| 5964 | #define G4X_ELDV_DEVCL_DEVBLC (1 << 13) | 6085 | #define G4X_ELDV_DEVCL_DEVBLC (1 << 13) |
| 5965 | #define G4X_ELDV_DEVCTG (1 << 14) | 6086 | #define G4X_ELDV_DEVCTG (1 << 14) |
| 5966 | #define G4X_ELD_ADDR (0xf << 5) | 6087 | #define G4X_ELD_ADDR_MASK (0xf << 5) |
| 5967 | #define G4X_ELD_ACK (1 << 4) | 6088 | #define G4X_ELD_ACK (1 << 4) |
| 5968 | #define G4X_HDMIW_HDMIEDID 0x6210C | 6089 | #define G4X_HDMIW_HDMIEDID 0x6210C |
| 5969 | 6090 | ||
| 5970 | #define IBX_HDMIW_HDMIEDID_A 0xE2050 | 6091 | #define _IBX_HDMIW_HDMIEDID_A 0xE2050 |
| 5971 | #define IBX_HDMIW_HDMIEDID_B 0xE2150 | 6092 | #define _IBX_HDMIW_HDMIEDID_B 0xE2150 |
| 5972 | #define IBX_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ | 6093 | #define IBX_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ |
| 5973 | IBX_HDMIW_HDMIEDID_A, \ | 6094 | _IBX_HDMIW_HDMIEDID_A, \ |
| 5974 | IBX_HDMIW_HDMIEDID_B) | 6095 | _IBX_HDMIW_HDMIEDID_B) |
| 5975 | #define IBX_AUD_CNTL_ST_A 0xE20B4 | 6096 | #define _IBX_AUD_CNTL_ST_A 0xE20B4 |
| 5976 | #define IBX_AUD_CNTL_ST_B 0xE21B4 | 6097 | #define _IBX_AUD_CNTL_ST_B 0xE21B4 |
| 5977 | #define IBX_AUD_CNTL_ST(pipe) _PIPE(pipe, \ | 6098 | #define IBX_AUD_CNTL_ST(pipe) _PIPE(pipe, \ |
| 5978 | IBX_AUD_CNTL_ST_A, \ | 6099 | _IBX_AUD_CNTL_ST_A, \ |
| 5979 | IBX_AUD_CNTL_ST_B) | 6100 | _IBX_AUD_CNTL_ST_B) |
| 5980 | #define IBX_ELD_BUFFER_SIZE (0x1f << 10) | 6101 | #define IBX_ELD_BUFFER_SIZE_MASK (0x1f << 10) |
| 5981 | #define IBX_ELD_ADDRESS (0x1f << 5) | 6102 | #define IBX_ELD_ADDRESS_MASK (0x1f << 5) |
| 5982 | #define IBX_ELD_ACK (1 << 4) | 6103 | #define IBX_ELD_ACK (1 << 4) |
| 5983 | #define IBX_AUD_CNTL_ST2 0xE20C0 | 6104 | #define IBX_AUD_CNTL_ST2 0xE20C0 |
| 5984 | #define IBX_ELD_VALIDB (1 << 0) | 6105 | #define IBX_CP_READY(port) ((1 << 1) << (((port) - 1) * 4)) |
| 5985 | #define IBX_CP_READYB (1 << 1) | 6106 | #define IBX_ELD_VALID(port) ((1 << 0) << (((port) - 1) * 4)) |
| 5986 | 6107 | ||
| 5987 | #define CPT_HDMIW_HDMIEDID_A 0xE5050 | 6108 | #define _CPT_HDMIW_HDMIEDID_A 0xE5050 |
| 5988 | #define CPT_HDMIW_HDMIEDID_B 0xE5150 | 6109 | #define _CPT_HDMIW_HDMIEDID_B 0xE5150 |
| 5989 | #define CPT_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ | 6110 | #define CPT_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ |
| 5990 | CPT_HDMIW_HDMIEDID_A, \ | 6111 | _CPT_HDMIW_HDMIEDID_A, \ |
| 5991 | CPT_HDMIW_HDMIEDID_B) | 6112 | _CPT_HDMIW_HDMIEDID_B) |
| 5992 | #define CPT_AUD_CNTL_ST_A 0xE50B4 | 6113 | #define _CPT_AUD_CNTL_ST_A 0xE50B4 |
| 5993 | #define CPT_AUD_CNTL_ST_B 0xE51B4 | 6114 | #define _CPT_AUD_CNTL_ST_B 0xE51B4 |
| 5994 | #define CPT_AUD_CNTL_ST(pipe) _PIPE(pipe, \ | 6115 | #define CPT_AUD_CNTL_ST(pipe) _PIPE(pipe, \ |
| 5995 | CPT_AUD_CNTL_ST_A, \ | 6116 | _CPT_AUD_CNTL_ST_A, \ |
| 5996 | CPT_AUD_CNTL_ST_B) | 6117 | _CPT_AUD_CNTL_ST_B) |
| 5997 | #define CPT_AUD_CNTRL_ST2 0xE50C0 | 6118 | #define CPT_AUD_CNTRL_ST2 0xE50C0 |
| 5998 | 6119 | ||
| 5999 | #define VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050) | 6120 | #define _VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050) |
| 6000 | #define VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150) | 6121 | #define _VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150) |
| 6001 | #define VLV_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ | 6122 | #define VLV_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ |
| 6002 | VLV_HDMIW_HDMIEDID_A, \ | 6123 | _VLV_HDMIW_HDMIEDID_A, \ |
| 6003 | VLV_HDMIW_HDMIEDID_B) | 6124 | _VLV_HDMIW_HDMIEDID_B) |
| 6004 | #define VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4) | 6125 | #define _VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4) |
| 6005 | #define VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4) | 6126 | #define _VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4) |
| 6006 | #define VLV_AUD_CNTL_ST(pipe) _PIPE(pipe, \ | 6127 | #define VLV_AUD_CNTL_ST(pipe) _PIPE(pipe, \ |
| 6007 | VLV_AUD_CNTL_ST_A, \ | 6128 | _VLV_AUD_CNTL_ST_A, \ |
| 6008 | VLV_AUD_CNTL_ST_B) | 6129 | _VLV_AUD_CNTL_ST_B) |
| 6009 | #define VLV_AUD_CNTL_ST2 (VLV_DISPLAY_BASE + 0x620C0) | 6130 | #define VLV_AUD_CNTL_ST2 (VLV_DISPLAY_BASE + 0x620C0) |
| 6010 | 6131 | ||
| 6011 | /* These are the 4 32-bit write offset registers for each stream | 6132 | /* These are the 4 32-bit write offset registers for each stream |
| @@ -6014,28 +6135,28 @@ enum punit_power_well { · 2 unmodified lines | |||
| 6014 | */ | 6135 | */ |
| 6015 | #define GEN7_SO_WRITE_OFFSET(n) (0x5280 + (n) * 4) | 6136 | #define GEN7_SO_WRITE_OFFSET(n) (0x5280 + (n) * 4) |
| 6016 | 6137 | ||
| 6017 | #define IBX_AUD_CONFIG_A 0xe2000 | 6138 | #define _IBX_AUD_CONFIG_A 0xe2000 |
| 6018 | #define IBX_AUD_CONFIG_B 0xe2100 | 6139 | #define _IBX_AUD_CONFIG_B 0xe2100 |
| 6019 | #define IBX_AUD_CFG(pipe) _PIPE(pipe, \ | 6140 | #define IBX_AUD_CFG(pipe) _PIPE(pipe, \ |
| 6020 | IBX_AUD_CONFIG_A, \ | 6141 | _IBX_AUD_CONFIG_A, \ |
| 6021 | IBX_AUD_CONFIG_B) | 6142 | _IBX_AUD_CONFIG_B) |
| 6022 | #define CPT_AUD_CONFIG_A 0xe5000 | 6143 | #define _CPT_AUD_CONFIG_A 0xe5000 |
| 6023 | #define CPT_AUD_CONFIG_B 0xe5100 | 6144 | #define _CPT_AUD_CONFIG_B 0xe5100 |
| 6024 | #define CPT_AUD_CFG(pipe) _PIPE(pipe, \ | 6145 | #define CPT_AUD_CFG(pipe) _PIPE(pipe, \ |
| 6025 | CPT_AUD_CONFIG_A, \ | 6146 | _CPT_AUD_CONFIG_A, \ |
| 6026 | CPT_AUD_CONFIG_B) | 6147 | _CPT_AUD_CONFIG_B) |
| 6027 | #define VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000) | 6148 | #define _VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000) |
| 6028 | #define VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100) | 6149 | #define _VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100) |
| 6029 | #define VLV_AUD_CFG(pipe) _PIPE(pipe, \ | 6150 | #define VLV_AUD_CFG(pipe) _PIPE(pipe, \ |
| 6030 | VLV_AUD_CONFIG_A, \ | 6151 | _VLV_AUD_CONFIG_A, \ |
| 6031 | VLV_AUD_CONFIG_B) | 6152 | _VLV_AUD_CONFIG_B) |
| 6032 | 6153 | ||
| 6033 | #define AUD_CONFIG_N_VALUE_INDEX (1 << 29) | 6154 | #define AUD_CONFIG_N_VALUE_INDEX (1 << 29) |
| 6034 | #define AUD_CONFIG_N_PROG_ENABLE (1 << 28) | 6155 | #define AUD_CONFIG_N_PROG_ENABLE (1 << 28) |
| 6035 | #define AUD_CONFIG_UPPER_N_SHIFT 20 | 6156 | #define AUD_CONFIG_UPPER_N_SHIFT 20 |
| 6036 | #define AUD_CONFIG_UPPER_N_VALUE (0xff << 20) | 6157 | #define AUD_CONFIG_UPPER_N_MASK (0xff << 20) |
| 6037 | #define AUD_CONFIG_LOWER_N_SHIFT 4 | 6158 | #define AUD_CONFIG_LOWER_N_SHIFT 4 |
| 6038 | #define AUD_CONFIG_LOWER_N_VALUE (0xfff << 4) | 6159 | #define AUD_CONFIG_LOWER_N_MASK (0xfff << 4) |
| 6039 | #define AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT 16 | 6160 | #define AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT 16 |
| 6040 | #define AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK (0xf << 16) | 6161 | #define AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK (0xf << 16) |
| 6041 | #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 (0 << 16) | 6162 | #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 (0 << 16) |
| @@ -6051,52 +6172,44 @@ enum punit_power_well { · 9 unmodified lines | |||
| 6051 | #define AUD_CONFIG_DISABLE_NCTS (1 << 3) | 6172 | #define AUD_CONFIG_DISABLE_NCTS (1 << 3) |
| 6052 | 6173 | ||
| 6053 | /* HSW Audio */ | 6174 | /* HSW Audio */ |
| 6054 | #define HSW_AUD_CONFIG_A 0x65000 /* Audio Configuration Transcoder A */ | 6175 | #define _HSW_AUD_CONFIG_A 0x65000 |
| 6055 | #define HSW_AUD_CONFIG_B 0x65100 /* Audio Configuration Transcoder B */ | 6176 | #define _HSW_AUD_CONFIG_B 0x65100 |
| 6056 | #define HSW_AUD_CFG(pipe) _PIPE(pipe, \ | 6177 | #define HSW_AUD_CFG(pipe) _PIPE(pipe, \ |
| 6057 | HSW_AUD_CONFIG_A, \ | 6178 | _HSW_AUD_CONFIG_A, \ |
| 6058 | HSW_AUD_CONFIG_B) | 6179 | _HSW_AUD_CONFIG_B) |
| 6059 | 6180 | ||
| 6060 | #define HSW_AUD_MISC_CTRL_A 0x65010 /* Audio Misc Control Convert 1 */ | 6181 | #define _HSW_AUD_MISC_CTRL_A 0x65010 |
| 6061 | #define HSW_AUD_MISC_CTRL_B 0x65110 /* Audio Misc Control Convert 2 */ | 6182 | #define _HSW_AUD_MISC_CTRL_B 0x65110 |
| 6062 | #define HSW_AUD_MISC_CTRL(pipe) _PIPE(pipe, \ | 6183 | #define HSW_AUD_MISC_CTRL(pipe) _PIPE(pipe, \ |
| 6063 | HSW_AUD_MISC_CTRL_A, \ | 6184 | _HSW_AUD_MISC_CTRL_A, \ |
| 6064 | HSW_AUD_MISC_CTRL_B) | 6185 | _HSW_AUD_MISC_CTRL_B) |
| 6065 | 6186 | ||
| 6066 | #define HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4 /* Audio DIP and ELD Control State Transcoder A */ | 6187 | #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4 |
| 6067 | #define HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4 /* Audio DIP and ELD Control State Transcoder B */ | 6188 | #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4 |
| 6068 | #define HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \ | 6189 | #define HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \ |
| 6069 | HSW_AUD_DIP_ELD_CTRL_ST_A, \ | 6190 | _HSW_AUD_DIP_ELD_CTRL_ST_A, \ |
| 6070 | HSW_AUD_DIP_ELD_CTRL_ST_B) | 6191 | _HSW_AUD_DIP_ELD_CTRL_ST_B) |
| 6071 | 6192 | ||
| 6072 | /* Audio Digital Converter */ | 6193 | /* Audio Digital Converter */ |
| 6073 | #define HSW_AUD_DIG_CNVT_1 0x65080 /* Audio Converter 1 */ | 6194 | #define _HSW_AUD_DIG_CNVT_1 0x65080 |
| 6074 | #define HSW_AUD_DIG_CNVT_2 0x65180 /* Audio Converter 1 */ | 6195 | #define _HSW_AUD_DIG_CNVT_2 0x65180 |
| 6075 | #define AUD_DIG_CNVT(pipe) _PIPE(pipe, \ | 6196 | #define AUD_DIG_CNVT(pipe) _PIPE(pipe, \ |
| 6076 | HSW_AUD_DIG_CNVT_1, \ | 6197 | _HSW_AUD_DIG_CNVT_1, \ |
| 6077 | HSW_AUD_DIG_CNVT_2) | 6198 | _HSW_AUD_DIG_CNVT_2) |
| 6078 | #define DIP_PORT_SEL_MASK 0x3 | 6199 | #define DIP_PORT_SEL_MASK 0x3 |
| 6079 | 6200 | ||
| 6080 | #define HSW_AUD_EDID_DATA_A 0x65050 | 6201 | #define _HSW_AUD_EDID_DATA_A 0x65050 |
| 6081 | #define HSW_AUD_EDID_DATA_B 0x65150 | 6202 | #define _HSW_AUD_EDID_DATA_B 0x65150 |
| 6082 | #define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \ | 6203 | #define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \ |
| 6083 | HSW_AUD_EDID_DATA_A, \ | 6204 | _HSW_AUD_EDID_DATA_A, \ |
| 6084 | HSW_AUD_EDID_DATA_B) | 6205 | _HSW_AUD_EDID_DATA_B) |
| 6085 | 6206 | ||
| 6086 | #define HSW_AUD_PIPE_CONV_CFG 0x6507c /* Audio pipe and converter configs */ | 6207 | #define HSW_AUD_PIPE_CONV_CFG 0x6507c |
| 6087 | #define HSW_AUD_PIN_ELD_CP_VLD 0x650c0 /* Audio ELD and CP Ready Status */ | 6208 | #define HSW_AUD_PIN_ELD_CP_VLD 0x650c0 |
| 6088 | #define AUDIO_INACTIVE_C (1<<11) | 6209 | #define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4)) |
| 6089 | #define AUDIO_INACTIVE_B (1<<7) | 6210 | #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4)) |
| 6090 | #define AUDIO_INACTIVE_A (1<<3) | 6211 | #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4)) |
| 6091 | #define AUDIO_OUTPUT_ENABLE_A (1<<2) | 6212 | #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4)) |
| 6092 | #define AUDIO_OUTPUT_ENABLE_B (1<<6) | ||
| 6093 | #define AUDIO_OUTPUT_ENABLE_C (1<<10) | ||
| 6094 | #define AUDIO_ELD_VALID_A (1<<0) | ||
| 6095 | #define AUDIO_ELD_VALID_B (1<<4) | ||
| 6096 | #define AUDIO_ELD_VALID_C (1<<8) | ||
| 6097 | #define AUDIO_CP_READY_A (1<<1) | ||
| 6098 | #define AUDIO_CP_READY_B (1<<5) | ||
| 6099 | #define AUDIO_CP_READY_C (1<<9) | ||
| 6100 | 6213 | ||
| 6101 | /* HSW Power Wells */ | 6214 | /* HSW Power Wells */ |
| 6102 | #define HSW_PWR_WELL_BIOS 0x45400 /* CTL1 */ | 6215 | #define HSW_PWR_WELL_BIOS 0x45400 /* CTL1 */ |
| @@ -0,0 +1,462 @@ | |||
| 1 | /* | ||
| 2 | * Copyright © 2014 Intel Corporation | ||
| 3 | * | ||
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 5 | * copy of this software and associated documentation files (the "Software"), | ||
| 6 | * to deal in the Software without restriction, including without limitation | ||
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 9 | * Software is furnished to do so, subject to the following conditions: | ||
| 10 | * | ||
| 11 | * The above copyright notice and this permission notice (including the next | ||
| 12 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 13 | * Software. | ||
| 14 | * | ||
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 21 | * DEALINGS IN THE SOFTWARE. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include <linux/kernel.h> | ||
| 25 | |||
| 26 | #include <drm/drmP.h> | ||
| 27 | #include <drm/drm_edid.h> | ||
| 28 | #include "intel_drv.h" | ||
| 29 | #include "i915_drv.h" | ||
| 30 | |||
| 31 | /** | ||
| 32 | * DOC: High Definition Audio over HDMI and Display Port | ||
| 33 | * | ||
| 34 | * The graphics and audio drivers together support High Definition Audio over | ||
| 35 | * HDMI and Display Port. The audio programming sequences are divided into audio | ||
| 36 | * codec and controller enable and disable sequences. The graphics driver | ||
| 37 | * handles the audio codec sequences, while the audio driver handles the audio | ||
| 38 | * controller sequences. | ||
| 39 | * | ||
| 40 | * The disable sequences must be performed before disabling the transcoder or | ||
| 41 | * port. The enable sequences may only be performed after enabling the | ||
| 42 | * transcoder and port, and after completed link training. | ||
| 43 | * | ||
| 44 | * The codec and controller sequences could be done either parallel or serial, | ||
| 45 | * but generally the ELDV/PD change in the codec sequence indicates to the audio | ||
| 46 | * driver that the controller sequence should start. Indeed, most of the | ||
| 47 | * co-operation between the graphics and audio drivers is handled via audio | ||
| 48 | * related registers. (The notable exception is the power management, not | ||
| 49 | * covered here.) | ||
| 50 | */ | ||
| 51 | |||
| 52 | static const struct { | ||
| 53 | int clock; | ||
| 54 | u32 config; | ||
| 55 | } hdmi_audio_clock[] = { | ||
| 56 | { DIV_ROUND_UP(25200 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 }, | ||
| 57 | { 25200, AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 }, /* default per bspec */ | ||
| 58 | { 27000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 }, | ||
| 59 | { 27000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 }, | ||
| 60 | { 54000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 }, | ||
| 61 | { 54000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 }, | ||
| 62 | { DIV_ROUND_UP(74250 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 }, | ||
| 63 | { 74250, AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 }, | ||
| 64 | { DIV_ROUND_UP(148500 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 }, | ||
| 65 | { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 }, | ||
| 66 | }; | ||
| 67 | |||
| 68 | /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ | ||
| 69 | static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode) | ||
| 70 | { | ||
| 71 | int i; | ||
| 72 | |||
| 73 | for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) { | ||
| 74 | if (mode->clock == hdmi_audio_clock[i].clock) | ||
| 75 | break; | ||
| 76 | } | ||
| 77 | |||
| 78 | if (i == ARRAY_SIZE(hdmi_audio_clock)) { | ||
| 79 | DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock); | ||
| 80 | i = 1; | ||
| 81 | } | ||
| 82 | |||
| 83 | DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d (0x%08x)\n", | ||
| 84 | hdmi_audio_clock[i].clock, | ||
| 85 | hdmi_audio_clock[i].config); | ||
| 86 | |||
| 87 | return hdmi_audio_clock[i].config; | ||
| 88 | } | ||
| 89 | |||
| 90 | static bool intel_eld_uptodate(struct drm_connector *connector, | ||
| 91 | int reg_eldv, uint32_t bits_eldv, | ||
| 92 | int reg_elda, uint32_t bits_elda, | ||
| 93 | int reg_edid) | ||
| 94 | { | ||
| 95 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 96 | uint8_t *eld = connector->eld; | ||
| 97 | uint32_t tmp; | ||
| 98 | int i; | ||
| 99 | |||
| 100 | tmp = I915_READ(reg_eldv); | ||
| 101 | tmp &= bits_eldv; | ||
| 102 | |||
| 103 | if (!tmp) | ||
| 104 | return false; | ||
| 105 | |||
| 106 | tmp = I915_READ(reg_elda); | ||
| 107 | tmp &= ~bits_elda; | ||
| 108 | I915_WRITE(reg_elda, tmp); | ||
| 109 | |||
| 110 | for (i = 0; i < eld[2]; i++) | ||
| 111 | if (I915_READ(reg_edid) != *((uint32_t *)eld + i)) | ||
| 112 | return false; | ||
| 113 | |||
| 114 | return true; | ||
| 115 | } | ||
| 116 | |||
| 117 | static void g4x_audio_codec_disable(struct intel_encoder *encoder) | ||
| 118 | { | ||
| 119 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | ||
| 120 | uint32_t eldv, tmp; | ||
| 121 | |||
| 122 | DRM_DEBUG_KMS("Disable audio codec\n"); | ||
| 123 | |||
| 124 | tmp = I915_READ(G4X_AUD_VID_DID); | ||
| 125 | if (tmp == INTEL_AUDIO_DEVBLC || tmp == INTEL_AUDIO_DEVCL) | ||
| 126 | eldv = G4X_ELDV_DEVCL_DEVBLC; | ||
| 127 | else | ||
| 128 | eldv = G4X_ELDV_DEVCTG; | ||
| 129 | |||
| 130 | /* Invalidate ELD */ | ||
| 131 | tmp = I915_READ(G4X_AUD_CNTL_ST); | ||
| 132 | tmp &= ~eldv; | ||
| 133 | I915_WRITE(G4X_AUD_CNTL_ST, tmp); | ||
| 134 | } | ||
| 135 | |||
| 136 | static void g4x_audio_codec_enable(struct drm_connector *connector, | ||
| 137 | struct intel_encoder *encoder, | ||
| 138 | struct drm_display_mode *mode) | ||
| 139 | { | ||
| 140 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 141 | uint8_t *eld = connector->eld; | ||
| 142 | uint32_t eldv; | ||
| 143 | uint32_t tmp; | ||
| 144 | int len, i; | ||
| 145 | |||
| 146 | DRM_DEBUG_KMS("Enable audio codec, %u bytes ELD\n", eld[2]); | ||
| 147 | |||
| 148 | tmp = I915_READ(G4X_AUD_VID_DID); | ||
| 149 | if (tmp == INTEL_AUDIO_DEVBLC || tmp == INTEL_AUDIO_DEVCL) | ||
| 150 | eldv = G4X_ELDV_DEVCL_DEVBLC; | ||
| 151 | else | ||
| 152 | eldv = G4X_ELDV_DEVCTG; | ||
| 153 | |||
| 154 | if (intel_eld_uptodate(connector, | ||
| 155 | G4X_AUD_CNTL_ST, eldv, | ||
| 156 | G4X_AUD_CNTL_ST, G4X_ELD_ADDR_MASK, | ||
| 157 | G4X_HDMIW_HDMIEDID)) | ||
| 158 | return; | ||
| 159 | |||
| 160 | tmp = I915_READ(G4X_AUD_CNTL_ST); | ||
| 161 | tmp &= ~(eldv | G4X_ELD_ADDR_MASK); | ||
| 162 | len = (tmp >> 9) & 0x1f; /* ELD buffer size */ | ||
| 163 | I915_WRITE(G4X_AUD_CNTL_ST, tmp); | ||
| 164 | |||
| 165 | len = min_t(int, eld[2], len); | ||
| 166 | DRM_DEBUG_DRIVER("ELD size %d\n", len); | ||
| 167 | for (i = 0; i < len; i++) | ||
| 168 | I915_WRITE(G4X_HDMIW_HDMIEDID, *((uint32_t *)eld + i)); | ||
| 169 | |||
| 170 | tmp = I915_READ(G4X_AUD_CNTL_ST); | ||
| 171 | tmp |= eldv; | ||
| 172 | I915_WRITE(G4X_AUD_CNTL_ST, tmp); | ||
| 173 | } | ||
| 174 | |||
| 175 | static void hsw_audio_codec_disable(struct intel_encoder *encoder) | ||
| 176 | { | ||
| 177 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | ||
| 178 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); | ||
| 179 | enum pipe pipe = intel_crtc->pipe; | ||
| 180 | uint32_t tmp; | ||
| 181 | |||
| 182 | DRM_DEBUG_KMS("Disable audio codec on pipe %c\n", pipe_name(pipe)); | ||
| 183 | |||
| 184 | /* Disable timestamps */ | ||
| 185 | tmp = I915_READ(HSW_AUD_CFG(pipe)); | ||
| 186 | tmp &= ~AUD_CONFIG_N_VALUE_INDEX; | ||
| 187 | tmp |= AUD_CONFIG_N_PROG_ENABLE; | ||
| 188 | tmp &= ~AUD_CONFIG_UPPER_N_MASK; | ||
| 189 | tmp &= ~AUD_CONFIG_LOWER_N_MASK; | ||
| 190 | if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) | ||
| 191 | tmp |= AUD_CONFIG_N_VALUE_INDEX; | ||
| 192 | I915_WRITE(HSW_AUD_CFG(pipe), tmp); | ||
| 193 | |||
| 194 | /* Invalidate ELD */ | ||
| 195 | tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); | ||
| 196 | tmp &= ~AUDIO_ELD_VALID(pipe); | ||
| 197 | I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); | ||
| 198 | } | ||
| 199 | |||
| 200 | static void hsw_audio_codec_enable(struct drm_connector *connector, | ||
| 201 | struct intel_encoder *encoder, | ||
| 202 | struct drm_display_mode *mode) | ||
| 203 | { | ||
| 204 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 205 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); | ||
| 206 | enum pipe pipe = intel_crtc->pipe; | ||
| 207 | const uint8_t *eld = connector->eld; | ||
| 208 | uint32_t tmp; | ||
| 209 | int len, i; | ||
| 210 | |||
| 211 | DRM_DEBUG_KMS("Enable audio codec on pipe %c, %u bytes ELD\n", | ||
| 212 | pipe_name(pipe), eld[2]); | ||
| 213 | |||
| 214 | /* Enable audio presence detect, invalidate ELD */ | ||
| 215 | tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); | ||
| 216 | tmp |= AUDIO_OUTPUT_ENABLE(pipe); | ||
| 217 | tmp &= ~AUDIO_ELD_VALID(pipe); | ||
| 218 | I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); | ||
| 219 | |||
| 220 | /* | ||
| 221 | * FIXME: We're supposed to wait for vblank here, but we have vblanks | ||
| 222 | * disabled during the mode set. The proper fix would be to push the | ||
| 223 | * rest of the setup into a vblank work item, queued here, but the | ||
| 224 | * infrastructure is not there yet. | ||
| 225 | */ | ||
| 226 | |||
| 227 | /* Reset ELD write address */ | ||
| 228 | tmp = I915_READ(HSW_AUD_DIP_ELD_CTRL(pipe)); | ||
| 229 | tmp &= ~IBX_ELD_ADDRESS_MASK; | ||
| 230 | I915_WRITE(HSW_AUD_DIP_ELD_CTRL(pipe), tmp); | ||
| 231 | |||
| 232 | /* Up to 84 bytes of hw ELD buffer */ | ||
| 233 | len = min_t(int, eld[2], 21); | ||
| 234 | for (i = 0; i < len; i++) | ||
| 235 | I915_WRITE(HSW_AUD_EDID_DATA(pipe), *((uint32_t *)eld + i)); | ||
| 236 | |||
| 237 | /* ELD valid */ | ||
| 238 | tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); | ||
| 239 | tmp |= AUDIO_ELD_VALID(pipe); | ||
| 240 | I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); | ||
| 241 | |||
| 242 | /* Enable timestamps */ | ||
| 243 | tmp = I915_READ(HSW_AUD_CFG(pipe)); | ||
| 244 | tmp &= ~AUD_CONFIG_N_VALUE_INDEX; | ||
| 245 | tmp &= ~AUD_CONFIG_N_PROG_ENABLE; | ||
| 246 | tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK; | ||
| 247 | if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) | ||
| 248 | tmp |= AUD_CONFIG_N_VALUE_INDEX; | ||
| 249 | else | ||
| 250 | tmp |= audio_config_hdmi_pixel_clock(mode); | ||
| 251 | I915_WRITE(HSW_AUD_CFG(pipe), tmp); | ||
| 252 | } | ||
| 253 | |||
| 254 | static void ilk_audio_codec_disable(struct intel_encoder *encoder) | ||
| 255 | { | ||
| 256 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | ||
| 257 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); | ||
| 258 | struct intel_digital_port *intel_dig_port = | ||
| 259 | enc_to_dig_port(&encoder->base); | ||
| 260 | enum port port = intel_dig_port->port; | ||
| 261 | enum pipe pipe = intel_crtc->pipe; | ||
| 262 | uint32_t tmp, eldv; | ||
| 263 | int aud_config; | ||
| 264 | int aud_cntrl_st2; | ||
| 265 | |||
| 266 | DRM_DEBUG_KMS("Disable audio codec on port %c, pipe %c\n", | ||
| 267 | port_name(port), pipe_name(pipe)); | ||
| 268 | |||
| 269 | if (HAS_PCH_IBX(dev_priv->dev)) { | ||
| 270 | aud_config = IBX_AUD_CFG(pipe); | ||
| 271 | aud_cntrl_st2 = IBX_AUD_CNTL_ST2; | ||
| 272 | } else if (IS_VALLEYVIEW(dev_priv)) { | ||
| 273 | aud_config = VLV_AUD_CFG(pipe); | ||
| 274 | aud_cntrl_st2 = VLV_AUD_CNTL_ST2; | ||
| 275 | } else { | ||
| 276 | aud_config = CPT_AUD_CFG(pipe); | ||
| 277 | aud_cntrl_st2 = CPT_AUD_CNTRL_ST2; | ||
| 278 | } | ||
| 279 | |||
| 280 | /* Disable timestamps */ | ||
| 281 | tmp = I915_READ(aud_config); | ||
| 282 | tmp &= ~AUD_CONFIG_N_VALUE_INDEX; | ||
| 283 | tmp |= AUD_CONFIG_N_PROG_ENABLE; | ||
| 284 | tmp &= ~AUD_CONFIG_UPPER_N_MASK; | ||
| 285 | tmp &= ~AUD_CONFIG_LOWER_N_MASK; | ||
| 286 | if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) | ||
| 287 | tmp |= AUD_CONFIG_N_VALUE_INDEX; | ||
| 288 | I915_WRITE(aud_config, tmp); | ||
| 289 | |||
| 290 | if (WARN_ON(!port)) { | ||
| 291 | eldv = IBX_ELD_VALID(PORT_B) | IBX_ELD_VALID(PORT_C) | | ||
| 292 | IBX_ELD_VALID(PORT_D); | ||
| 293 | } else { | ||
| 294 | eldv = IBX_ELD_VALID(port); | ||
| 295 | } | ||
| 296 | |||
| 297 | /* Invalidate ELD */ | ||
| 298 | tmp = I915_READ(aud_cntrl_st2); | ||
| 299 | tmp &= ~eldv; | ||
| 300 | I915_WRITE(aud_cntrl_st2, tmp); | ||
| 301 | } | ||
| 302 | |||
| 303 | static void ilk_audio_codec_enable(struct drm_connector *connector, | ||
| 304 | struct intel_encoder *encoder, | ||
| 305 | struct drm_display_mode *mode) | ||
| 306 | { | ||
| 307 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 308 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); | ||
| 309 | struct intel_digital_port *intel_dig_port = | ||
| 310 | enc_to_dig_port(&encoder->base); | ||
| 311 | enum port port = intel_dig_port->port; | ||
| 312 | enum pipe pipe = intel_crtc->pipe; | ||
| 313 | uint8_t *eld = connector->eld; | ||
| 314 | uint32_t eldv; | ||
| 315 | uint32_t tmp; | ||
| 316 | int len, i; | ||
| 317 | int hdmiw_hdmiedid; | ||
| 318 | int aud_config; | ||
| 319 | int aud_cntl_st; | ||
| 320 | int aud_cntrl_st2; | ||
| 321 | |||
| 322 | DRM_DEBUG_KMS("Enable audio codec on port %c, pipe %c, %u bytes ELD\n", | ||
| 323 | port_name(port), pipe_name(pipe), eld[2]); | ||
| 324 | |||
| 325 | /* | ||
| 326 | * FIXME: We're supposed to wait for vblank here, but we have vblanks | ||
| 327 | * disabled during the mode set. The proper fix would be to push the | ||
| 328 | * rest of the setup into a vblank work item, queued here, but the | ||
| 329 | * infrastructure is not there yet. | ||
| 330 | */ | ||
| 331 | |||
| 332 | if (HAS_PCH_IBX(connector->dev)) { | ||
| 333 | hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID(pipe); | ||
| 334 | aud_config = IBX_AUD_CFG(pipe); | ||
| 335 | aud_cntl_st = IBX_AUD_CNTL_ST(pipe); | ||
| 336 | aud_cntrl_st2 = IBX_AUD_CNTL_ST2; | ||
| 337 | } else if (IS_VALLEYVIEW(connector->dev)) { | ||
| 338 | hdmiw_hdmiedid = VLV_HDMIW_HDMIEDID(pipe); | ||
| 339 | aud_config = VLV_AUD_CFG(pipe); | ||
| 340 | aud_cntl_st = VLV_AUD_CNTL_ST(pipe); | ||
| 341 | aud_cntrl_st2 = VLV_AUD_CNTL_ST2; | ||
| 342 | } else { | ||
| 343 | hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID(pipe); | ||
| 344 | aud_config = CPT_AUD_CFG(pipe); | ||
| 345 | aud_cntl_st = CPT_AUD_CNTL_ST(pipe); | ||
| 346 | aud_cntrl_st2 = CPT_AUD_CNTRL_ST2; | ||
| 347 | } | ||
| 348 | |||
| 349 | if (WARN_ON(!port)) { | ||
| 350 | eldv = IBX_ELD_VALID(PORT_B) | IBX_ELD_VALID(PORT_C) | | ||
| 351 | IBX_ELD_VALID(PORT_D); | ||
| 352 | } else { | ||
| 353 | eldv = IBX_ELD_VALID(port); | ||
| 354 | } | ||
| 355 | |||
| 356 | /* Invalidate ELD */ | ||
| 357 | tmp = I915_READ(aud_cntrl_st2); | ||
| 358 | tmp &= ~eldv; | ||
| 359 | I915_WRITE(aud_cntrl_st2, tmp); | ||
| 360 | |||
| 361 | /* Reset ELD write address */ | ||
| 362 | tmp = I915_READ(aud_cntl_st); | ||
| 363 | tmp &= ~IBX_ELD_ADDRESS_MASK; | ||
| 364 | I915_WRITE(aud_cntl_st, tmp); | ||
| 365 | |||
| 366 | /* Up to 84 bytes of hw ELD buffer */ | ||
| 367 | len = min_t(int, eld[2], 21); | ||
| 368 | for (i = 0; i < len; i++) | ||
| 369 | I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i)); | ||
| 370 | |||
| 371 | /* ELD valid */ | ||
| 372 | tmp = I915_READ(aud_cntrl_st2); | ||
| 373 | tmp |= eldv; | ||
| 374 | I915_WRITE(aud_cntrl_st2, tmp); | ||
| 375 | |||
| 376 | /* Enable timestamps */ | ||
| 377 | tmp = I915_READ(aud_config); | ||
| 378 | tmp &= ~AUD_CONFIG_N_VALUE_INDEX; | ||
| 379 | tmp &= ~AUD_CONFIG_N_PROG_ENABLE; | ||
| 380 | tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK; | ||
| 381 | if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) | ||
| 382 | tmp |= AUD_CONFIG_N_VALUE_INDEX; | ||
| 383 | else | ||
| 384 | tmp |= audio_config_hdmi_pixel_clock(mode); | ||
| 385 | I915_WRITE(aud_config, tmp); | ||
| 386 | } | ||
| 387 | |||
| 388 | /** | ||
| 389 | * intel_audio_codec_enable - Enable the audio codec for HD audio | ||
| 390 | * @intel_encoder: encoder on which to enable audio | ||
| 391 | * | ||
| 392 | * The enable sequences may only be performed after enabling the transcoder and | ||
| 393 | * port, and after completed link training. | ||
| 394 | */ | ||
| 395 | void intel_audio_codec_enable(struct intel_encoder *intel_encoder) | ||
| 396 | { | ||
| 397 | struct drm_encoder *encoder = &intel_encoder->base; | ||
| 398 | struct intel_crtc *crtc = to_intel_crtc(encoder->crtc); | ||
| 399 | struct drm_display_mode *mode = &crtc->config.adjusted_mode; | ||
| 400 | struct drm_connector *connector; | ||
| 401 | struct drm_device *dev = encoder->dev; | ||
| 402 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 403 | |||
| 404 | connector = drm_select_eld(encoder, mode); | ||
| 405 | if (!connector) | ||
| 406 | return; | ||
| 407 | |||
| 408 | DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", | ||
| 409 | connector->base.id, | ||
| 410 | connector->name, | ||
| 411 | connector->encoder->base.id, | ||
| 412 | connector->encoder->name); | ||
| 413 | |||
| 414 | /* ELD Conn_Type */ | ||
| 415 | connector->eld[5] &= ~(3 << 2); | ||
| 416 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) | ||
| 417 | connector->eld[5] |= (1 << 2); | ||
| 418 | |||
| 419 | connector->eld[6] = drm_av_sync_delay(connector, mode) / 2; | ||
| 420 | |||
| 421 | if (dev_priv->display.audio_codec_enable) | ||
| 422 | dev_priv->display.audio_codec_enable(connector, intel_encoder, mode); | ||
| 423 | } | ||
| 424 | |||
| 425 | /** | ||
| 426 | * intel_audio_codec_disable - Disable the audio codec for HD audio | ||
| 427 | * @encoder: encoder on which to disable audio | ||
| 428 | * | ||
| 429 | * The disable sequences must be performed before disabling the transcoder or | ||
| 430 | * port. | ||
| 431 | */ | ||
| 432 | void intel_audio_codec_disable(struct intel_encoder *encoder) | ||
| 433 | { | ||
| 434 | struct drm_device *dev = encoder->base.dev; | ||
| 435 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 436 | |||
| 437 | if (dev_priv->display.audio_codec_disable) | ||
| 438 | dev_priv->display.audio_codec_disable(encoder); | ||
| 439 | } | ||
| 440 | |||
| 441 | /** | ||
| 442 | * intel_init_audio - Set up chip specific audio functions | ||
| 443 | * @dev: drm device | ||
| 444 | */ | ||
| 445 | void intel_init_audio(struct drm_device *dev) | ||
| 446 | { | ||
| 447 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 448 | |||
| 449 | if (IS_G4X(dev)) { | ||
| 450 | dev_priv->display.audio_codec_enable = g4x_audio_codec_enable; | ||
| 451 | dev_priv->display.audio_codec_disable = g4x_audio_codec_disable; | ||
| 452 | } else if (IS_VALLEYVIEW(dev)) { | ||
| 453 | dev_priv->display.audio_codec_enable = ilk_audio_codec_enable; | ||
| 454 | dev_priv->display.audio_codec_disable = ilk_audio_codec_disable; | ||
| 455 | } else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) { | ||
| 456 | dev_priv->display.audio_codec_enable = hsw_audio_codec_enable; | ||
| 457 | dev_priv->display.audio_codec_disable = hsw_audio_codec_disable; | ||
| 458 | } else if (HAS_PCH_SPLIT(dev)) { | ||
| 459 | dev_priv->display.audio_codec_enable = ilk_audio_codec_enable; | ||
| 460 | dev_priv->display.audio_codec_disable = ilk_audio_codec_disable; | ||
| 461 | } | ||
| 462 | } | ||
| @@ -459,6 +459,27 @@ intel_ddi_get_crtc_encoder(struct drm_crtc *crtc) · 458 unmodified lines | |||
| 459 | return ret; | 459 | return ret; |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | static struct intel_encoder * | ||
| 463 | intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc) | ||
| 464 | { | ||
| 465 | struct drm_device *dev = crtc->base.dev; | ||
| 466 | struct intel_encoder *intel_encoder, *ret = NULL; | ||
| 467 | int num_encoders = 0; | ||
| 468 | |||
| 469 | for_each_intel_encoder(dev, intel_encoder) { | ||
| 470 | if (intel_encoder->new_crtc == crtc) { | ||
| 471 | ret = intel_encoder; | ||
| 472 | num_encoders++; | ||
| 473 | } | ||
| 474 | } | ||
| 475 | |||
| 476 | WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders, | ||
| 477 | pipe_name(crtc->pipe)); | ||
| 478 | |||
| 479 | BUG_ON(ret == NULL); | ||
| 480 | return ret; | ||
| 481 | } | ||
| 482 | |||
| 462 | #define LC_FREQ 2700 | 483 | #define LC_FREQ 2700 |
| 463 | #define LC_FREQ_2K U64_C(LC_FREQ * 2000) | 484 | #define LC_FREQ_2K U64_C(LC_FREQ * 2000) |
| 464 | 485 | ||
| @@ -792,7 +813,7 @@ hsw_ddi_pll_select(struct intel_crtc *intel_crtc, · 327 unmodified lines | |||
| 792 | WRPLL_DIVIDER_REFERENCE(r2) | WRPLL_DIVIDER_FEEDBACK(n2) | | 813 | WRPLL_DIVIDER_REFERENCE(r2) | WRPLL_DIVIDER_FEEDBACK(n2) | |
| 793 | WRPLL_DIVIDER_POST(p); | 814 | WRPLL_DIVIDER_POST(p); |
| 794 | 815 | ||
| 795 | intel_crtc->config.dpll_hw_state.wrpll = val; | 816 | intel_crtc->new_config->dpll_hw_state.wrpll = val; |
| 796 | 817 | ||
| 797 | pll = intel_get_shared_dpll(intel_crtc); | 818 | pll = intel_get_shared_dpll(intel_crtc); |
| 798 | if (pll == NULL) { | 819 | if (pll == NULL) { |
| @@ -801,7 +822,7 @@ hsw_ddi_pll_select(struct intel_crtc *intel_crtc, · 2 unmodified lines | |||
| 801 | return false; | 822 | return false; |
| 802 | } | 823 | } |
| 803 | 824 | ||
| 804 | intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL(pll->id); | 825 | intel_crtc->new_config->ddi_pll_sel = PORT_CLK_SEL_WRPLL(pll->id); |
| 805 | } | 826 | } |
| 806 | 827 | ||
| 807 | return true; | 828 | return true; |
| @@ -817,11 +838,9 @@ hsw_ddi_pll_select(struct intel_crtc *intel_crtc, · 9 unmodified lines | |||
| 817 | */ | 838 | */ |
| 818 | bool intel_ddi_pll_select(struct intel_crtc *intel_crtc) | 839 | bool intel_ddi_pll_select(struct intel_crtc *intel_crtc) |
| 819 | { | 840 | { |
| 820 | struct drm_crtc *crtc = &intel_crtc->base; | 841 | struct intel_encoder *intel_encoder = |
| 821 | struct intel_encoder *intel_encoder = intel_ddi_get_crtc_encoder(crtc); | 842 | intel_ddi_get_crtc_new_encoder(intel_crtc); |
| 822 | int clock = intel_crtc->config.port_clock; | 843 | int clock = intel_crtc->new_config->port_clock; |
| 823 | |||
| 824 | intel_put_shared_dpll(intel_crtc); | ||
| 825 | 844 | ||
| 826 | return hsw_ddi_pll_select(intel_crtc, intel_encoder, clock); | 845 | return hsw_ddi_pll_select(intel_crtc, intel_encoder, clock); |
| 827 | } | 846 | } |
| @@ -1120,15 +1139,6 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder) · 292 unmodified lines | |||
| 1120 | enum port port = intel_ddi_get_encoder_port(intel_encoder); | 1139 | enum port port = intel_ddi_get_encoder_port(intel_encoder); |
| 1121 | int type = intel_encoder->type; | 1140 | int type = intel_encoder->type; |
| 1122 | 1141 | ||
| 1123 | if (crtc->config.has_audio) { | ||
| 1124 | DRM_DEBUG_DRIVER("Audio on pipe %c on DDI\n", | ||
| 1125 | pipe_name(crtc->pipe)); | ||
| 1126 | |||
| 1127 | /* write eld */ | ||
| 1128 | DRM_DEBUG_DRIVER("DDI audio: write eld information\n"); | ||
| 1129 | intel_write_eld(encoder, &crtc->config.adjusted_mode); | ||
| 1130 | } | ||
| 1131 | |||
| 1132 | if (type == INTEL_OUTPUT_EDP) { | 1142 | if (type == INTEL_OUTPUT_EDP) { |
| 1133 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 1143 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
| 1134 | intel_edp_panel_on(intel_dp); | 1144 | intel_edp_panel_on(intel_dp); |
| @@ -1195,12 +1205,10 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder) · 60 unmodified lines | |||
| 1195 | struct drm_encoder *encoder = &intel_encoder->base; | 1205 | struct drm_encoder *encoder = &intel_encoder->base; |
| 1196 | struct drm_crtc *crtc = encoder->crtc; | 1206 | struct drm_crtc *crtc = encoder->crtc; |
| 1197 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 1207 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 1198 | int pipe = intel_crtc->pipe; | ||
| 1199 | struct drm_device *dev = encoder->dev; | 1208 | struct drm_device *dev = encoder->dev; |
| 1200 | struct drm_i915_private *dev_priv = dev->dev_private; | 1209 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1201 | enum port port = intel_ddi_get_encoder_port(intel_encoder); | 1210 | enum port port = intel_ddi_get_encoder_port(intel_encoder); |
| 1202 | int type = intel_encoder->type; | 1211 | int type = intel_encoder->type; |
| 1203 | uint32_t tmp; | ||
| 1204 | 1212 | ||
| 1205 | if (type == INTEL_OUTPUT_HDMI) { | 1213 | if (type == INTEL_OUTPUT_HDMI) { |
| 1206 | struct intel_digital_port *intel_dig_port = | 1214 | struct intel_digital_port *intel_dig_port = |
| @@ -1225,9 +1233,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder) · 18 unmodified lines | |||
| 1225 | 1233 | ||
| 1226 | if (intel_crtc->config.has_audio) { | 1234 | if (intel_crtc->config.has_audio) { |
| 1227 | intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); | 1235 | intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); |
| 1228 | tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); | 1236 | intel_audio_codec_enable(intel_encoder); |
| 1229 | tmp |= ((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4)); | ||
| 1230 | I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); | ||
| 1231 | } | 1237 | } |
| 1232 | } | 1238 | } |
| 1233 | 1239 | ||
| @@ -1236,19 +1242,12 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) · 2 unmodified lines | |||
| 1236 | struct drm_encoder *encoder = &intel_encoder->base; | 1242 | struct drm_encoder *encoder = &intel_encoder->base; |
| 1237 | struct drm_crtc *crtc = encoder->crtc; | 1243 | struct drm_crtc *crtc = encoder->crtc; |
| 1238 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 1244 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 1239 | int pipe = intel_crtc->pipe; | ||
| 1240 | int type = intel_encoder->type; | 1245 | int type = intel_encoder->type; |
| 1241 | struct drm_device *dev = encoder->dev; | 1246 | struct drm_device *dev = encoder->dev; |
| 1242 | struct drm_i915_private *dev_priv = dev->dev_private; | 1247 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1243 | uint32_t tmp; | ||
| 1244 | 1248 | ||
| 1245 | /* We can't touch HSW_AUD_PIN_ELD_CP_VLD uncionditionally because this | ||
| 1246 | * register is part of the power well on Haswell. */ | ||
| 1247 | if (intel_crtc->config.has_audio) { | 1249 | if (intel_crtc->config.has_audio) { |
| 1248 | tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); | 1250 | intel_audio_codec_disable(intel_encoder); |
| 1249 | tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << | ||
| 1250 | (pipe * 4)); | ||
| 1251 | I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); | ||
| 1252 | intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); | 1251 | intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); |
| 1253 | } | 1252 | } |
| 1254 | 1253 | ||
| @@ -1311,7 +1310,7 @@ int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv) · 56 unmodified lines | |||
| 1311 | static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv, | 1310 | static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv, |
| 1312 | struct intel_shared_dpll *pll) | 1311 | struct intel_shared_dpll *pll) |
| 1313 | { | 1312 | { |
| 1314 | I915_WRITE(WRPLL_CTL(pll->id), pll->hw_state.wrpll); | 1313 | I915_WRITE(WRPLL_CTL(pll->id), pll->config.hw_state.wrpll); |
| 1315 | POSTING_READ(WRPLL_CTL(pll->id)); | 1314 | POSTING_READ(WRPLL_CTL(pll->id)); |
| 1316 | udelay(20); | 1315 | udelay(20); |
| 1317 | } | 1316 | } |
| @@ -1524,7 +1523,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder, · 206 unmodified lines | |||
| 1524 | 1523 | ||
| 1525 | if (intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_AUDIO)) { | 1524 | if (intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_AUDIO)) { |
| 1526 | temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); | 1525 | temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); |
| 1527 | if (temp & (AUDIO_OUTPUT_ENABLE_A << (intel_crtc->pipe * 4))) | 1526 | if (temp & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe)) |
| 1528 | pipe_config->has_audio = true; | 1527 | pipe_config->has_audio = true; |
| 1529 | } | 1528 | } |
| 1530 | 1529 | ||
| @@ -94,8 +94,10 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc, · 93 unmodified lines | |||
| 94 | static void ironlake_set_pipeconf(struct drm_crtc *crtc); | 94 | static void ironlake_set_pipeconf(struct drm_crtc *crtc); |
| 95 | static void haswell_set_pipeconf(struct drm_crtc *crtc); | 95 | static void haswell_set_pipeconf(struct drm_crtc *crtc); |
| 96 | static void intel_set_pipe_csc(struct drm_crtc *crtc); | 96 | static void intel_set_pipe_csc(struct drm_crtc *crtc); |
| 97 | static void vlv_prepare_pll(struct intel_crtc *crtc); | 97 | static void vlv_prepare_pll(struct intel_crtc *crtc, |
| 98 | static void chv_prepare_pll(struct intel_crtc *crtc); | 98 | const struct intel_crtc_config *pipe_config); |
| 99 | static void chv_prepare_pll(struct intel_crtc *crtc, | ||
| 100 | const struct intel_crtc_config *pipe_config); | ||
| 99 | 101 | ||
| 100 | static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe) | 102 | static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe) |
| 101 | { | 103 | { |
| @@ -406,7 +408,7 @@ static void vlv_clock(int refclk, intel_clock_t *clock) · 304 unmodified lines | |||
| 406 | /** | 408 | /** |
| 407 | * Returns whether any output on the specified pipe is of the specified type | 409 | * Returns whether any output on the specified pipe is of the specified type |
| 408 | */ | 410 | */ |
| 409 | static bool intel_pipe_has_type(struct intel_crtc *crtc, int type) | 411 | bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type) |
| 410 | { | 412 | { |
| 411 | struct drm_device *dev = crtc->base.dev; | 413 | struct drm_device *dev = crtc->base.dev; |
| 412 | struct intel_encoder *encoder; | 414 | struct intel_encoder *encoder; |
| @@ -418,13 +420,31 @@ static bool intel_pipe_has_type(struct intel_crtc *crtc, int type) · 5 unmodified lines | |||
| 418 | return false; | 420 | return false; |
| 419 | } | 421 | } |
| 420 | 422 | ||
| 423 | /** | ||
| 424 | * Returns whether any output on the specified pipe will have the specified | ||
| 425 | * type after a staged modeset is complete, i.e., the same as | ||
| 426 | * intel_pipe_has_type() but looking at encoder->new_crtc instead of | ||
| 427 | * encoder->crtc. | ||
| 428 | */ | ||
| 429 | static bool intel_pipe_will_have_type(struct intel_crtc *crtc, int type) | ||
| 430 | { | ||
| 431 | struct drm_device *dev = crtc->base.dev; | ||
| 432 | struct intel_encoder *encoder; | ||
| 433 | |||
| 434 | for_each_intel_encoder(dev, encoder) | ||
| 435 | if (encoder->new_crtc == crtc && encoder->type == type) | ||
| 436 | return true; | ||
| 437 | |||
| 438 | return false; | ||
| 439 | } | ||
| 440 | |||
| 421 | static const intel_limit_t *intel_ironlake_limit(struct intel_crtc *crtc, | 441 | static const intel_limit_t *intel_ironlake_limit(struct intel_crtc *crtc, |
| 422 | int refclk) | 442 | int refclk) |
| 423 | { | 443 | { |
| 424 | struct drm_device *dev = crtc->base.dev; | 444 | struct drm_device *dev = crtc->base.dev; |
| 425 | const intel_limit_t *limit; | 445 | const intel_limit_t *limit; |
| 426 | 446 | ||
| 427 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 447 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { |
| 428 | if (intel_is_dual_link_lvds(dev)) { | 448 | if (intel_is_dual_link_lvds(dev)) { |
| 429 | if (refclk == 100000) | 449 | if (refclk == 100000) |
| 430 | limit = &intel_limits_ironlake_dual_lvds_100m; | 450 | limit = &intel_limits_ironlake_dual_lvds_100m; |
| @@ -447,15 +467,15 @@ static const intel_limit_t *intel_g4x_limit(struct intel_crtc *crtc) · 16 unmodified lines | |||
| 447 | struct drm_device *dev = crtc->base.dev; | 467 | struct drm_device *dev = crtc->base.dev; |
| 448 | const intel_limit_t *limit; | 468 | const intel_limit_t *limit; |
| 449 | 469 | ||
| 450 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 470 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { |
| 451 | if (intel_is_dual_link_lvds(dev)) | 471 | if (intel_is_dual_link_lvds(dev)) |
| 452 | limit = &intel_limits_g4x_dual_channel_lvds; | 472 | limit = &intel_limits_g4x_dual_channel_lvds; |
| 453 | else | 473 | else |
| 454 | limit = &intel_limits_g4x_single_channel_lvds; | 474 | limit = &intel_limits_g4x_single_channel_lvds; |
| 455 | } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI) || | 475 | } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_HDMI) || |
| 456 | intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) { | 476 | intel_pipe_will_have_type(crtc, INTEL_OUTPUT_ANALOG)) { |
| 457 | limit = &intel_limits_g4x_hdmi; | 477 | limit = &intel_limits_g4x_hdmi; |
| 458 | } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO)) { | 478 | } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_SDVO)) { |
| 459 | limit = &intel_limits_g4x_sdvo; | 479 | limit = &intel_limits_g4x_sdvo; |
| 460 | } else /* The option is for other outputs */ | 480 | } else /* The option is for other outputs */ |
| 461 | limit = &intel_limits_i9xx_sdvo; | 481 | limit = &intel_limits_i9xx_sdvo; |
| @@ -473,7 +493,7 @@ static const intel_limit_t *intel_limit(struct intel_crtc *crtc, int refclk) · 11 unmodified lines | |||
| 473 | else if (IS_G4X(dev)) { | 493 | else if (IS_G4X(dev)) { |
| 474 | limit = intel_g4x_limit(crtc); | 494 | limit = intel_g4x_limit(crtc); |
| 475 | } else if (IS_PINEVIEW(dev)) { | 495 | } else if (IS_PINEVIEW(dev)) { |
| 476 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) | 496 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) |
| 477 | limit = &intel_limits_pineview_lvds; | 497 | limit = &intel_limits_pineview_lvds; |
| 478 | else | 498 | else |
| 479 | limit = &intel_limits_pineview_sdvo; | 499 | limit = &intel_limits_pineview_sdvo; |
| @@ -482,14 +502,14 @@ static const intel_limit_t *intel_limit(struct intel_crtc *crtc, int refclk) · 2 unmodified lines | |||
| 482 | } else if (IS_VALLEYVIEW(dev)) { | 502 | } else if (IS_VALLEYVIEW(dev)) { |
| 483 | limit = &intel_limits_vlv; | 503 | limit = &intel_limits_vlv; |
| 484 | } else if (!IS_GEN2(dev)) { | 504 | } else if (!IS_GEN2(dev)) { |
| 485 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) | 505 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) |
| 486 | limit = &intel_limits_i9xx_lvds; | 506 | limit = &intel_limits_i9xx_lvds; |
| 487 | else | 507 | else |
| 488 | limit = &intel_limits_i9xx_sdvo; | 508 | limit = &intel_limits_i9xx_sdvo; |
| 489 | } else { | 509 | } else { |
| 490 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) | 510 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) |
| 491 | limit = &intel_limits_i8xx_lvds; | 511 | limit = &intel_limits_i8xx_lvds; |
| 492 | else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DVO)) | 512 | else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DVO)) |
| 493 | limit = &intel_limits_i8xx_dvo; | 513 | limit = &intel_limits_i8xx_dvo; |
| 494 | else | 514 | else |
| 495 | limit = &intel_limits_i8xx_dac; | 515 | limit = &intel_limits_i8xx_dac; |
| @@ -584,7 +604,7 @@ i9xx_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · 88 unmodified lines | |||
| 584 | intel_clock_t clock; | 604 | intel_clock_t clock; |
| 585 | int err = target; | 605 | int err = target; |
| 586 | 606 | ||
| 587 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 607 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { |
| 588 | /* | 608 | /* |
| 589 | * For LVDS just rely on its current settings for dual-channel. | 609 | * For LVDS just rely on its current settings for dual-channel. |
| 590 | * We haven't figured out how to reliably set up different | 610 | * We haven't figured out how to reliably set up different |
| @@ -645,7 +665,7 @@ pnv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · 54 unmodified lines | |||
| 645 | intel_clock_t clock; | 665 | intel_clock_t clock; |
| 646 | int err = target; | 666 | int err = target; |
| 647 | 667 | ||
| 648 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 668 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { |
| 649 | /* | 669 | /* |
| 650 | * For LVDS just rely on its current settings for dual-channel. | 670 | * For LVDS just rely on its current settings for dual-channel. |
| 651 | * We haven't figured out how to reliably set up different | 671 | * We haven't figured out how to reliably set up different |
| @@ -708,7 +728,7 @@ g4x_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · 56 unmodified lines | |||
| 708 | int err_most = (target >> 8) + (target >> 9); | 728 | int err_most = (target >> 8) + (target >> 9); |
| 709 | found = false; | 729 | found = false; |
| 710 | 730 | ||
| 711 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 731 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { |
| 712 | if (intel_is_dual_link_lvds(dev)) | 732 | if (intel_is_dual_link_lvds(dev)) |
| 713 | clock.p2 = limit->p2.p2_fast; | 733 | clock.p2 = limit->p2.p2_fast; |
| 714 | else | 734 | else |
| @@ -1484,12 +1504,13 @@ static void intel_init_dpio(struct drm_device *dev) · 769 unmodified lines | |||
| 1484 | } | 1504 | } |
| 1485 | } | 1505 | } |
| 1486 | 1506 | ||
| 1487 | static void vlv_enable_pll(struct intel_crtc *crtc) | 1507 | static void vlv_enable_pll(struct intel_crtc *crtc, |
| 1508 | const struct intel_crtc_config *pipe_config) | ||
| 1488 | { | 1509 | { |
| 1489 | struct drm_device *dev = crtc->base.dev; | 1510 | struct drm_device *dev = crtc->base.dev; |
| 1490 | struct drm_i915_private *dev_priv = dev->dev_private; | 1511 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1491 | int reg = DPLL(crtc->pipe); | 1512 | int reg = DPLL(crtc->pipe); |
| 1492 | u32 dpll = crtc->config.dpll_hw_state.dpll; | 1513 | u32 dpll = pipe_config->dpll_hw_state.dpll; |
| 1493 | 1514 | ||
| 1494 | assert_pipe_disabled(dev_priv, crtc->pipe); | 1515 | assert_pipe_disabled(dev_priv, crtc->pipe); |
| 1495 | 1516 | ||
| @@ -1507,7 +1528,7 @@ static void vlv_enable_pll(struct intel_crtc *crtc) · 11 unmodified lines | |||
| 1507 | if (wait_for(((I915_READ(reg) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1)) | 1528 | if (wait_for(((I915_READ(reg) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1)) |
| 1508 | DRM_ERROR("DPLL %d failed to lock\n", crtc->pipe); | 1529 | DRM_ERROR("DPLL %d failed to lock\n", crtc->pipe); |
| 1509 | 1530 | ||
| 1510 | I915_WRITE(DPLL_MD(crtc->pipe), crtc->config.dpll_hw_state.dpll_md); | 1531 | I915_WRITE(DPLL_MD(crtc->pipe), pipe_config->dpll_hw_state.dpll_md); |
| 1511 | POSTING_READ(DPLL_MD(crtc->pipe)); | 1532 | POSTING_READ(DPLL_MD(crtc->pipe)); |
| 1512 | 1533 | ||
| 1513 | /* We do this three times for luck */ | 1534 | /* We do this three times for luck */ |
| @@ -1522,7 +1543,8 @@ static void vlv_enable_pll(struct intel_crtc *crtc) · 8 unmodified lines | |||
| 1522 | udelay(150); /* wait for warmup */ | 1543 | udelay(150); /* wait for warmup */ |
| 1523 | } | 1544 | } |
| 1524 | 1545 | ||
| 1525 | static void chv_enable_pll(struct intel_crtc *crtc) | 1546 | static void chv_enable_pll(struct intel_crtc *crtc, |
| 1547 | const struct intel_crtc_config *pipe_config) | ||
| 1526 | { | 1548 | { |
| 1527 | struct drm_device *dev = crtc->base.dev; | 1549 | struct drm_device *dev = crtc->base.dev; |
| 1528 | struct drm_i915_private *dev_priv = dev->dev_private; | 1550 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -1547,14 +1569,14 @@ static void chv_enable_pll(struct intel_crtc *crtc) · 18 unmodified lines | |||
| 1547 | udelay(1); | 1569 | udelay(1); |
| 1548 | 1570 | ||
| 1549 | /* Enable PLL */ | 1571 | /* Enable PLL */ |
| 1550 | I915_WRITE(DPLL(pipe), crtc->config.dpll_hw_state.dpll); | 1572 | I915_WRITE(DPLL(pipe), pipe_config->dpll_hw_state.dpll); |
| 1551 | 1573 | ||
| 1552 | /* Check PLL is locked */ | 1574 | /* Check PLL is locked */ |
| 1553 | if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1)) | 1575 | if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1)) |
| 1554 | DRM_ERROR("PLL %d failed to lock\n", pipe); | 1576 | DRM_ERROR("PLL %d failed to lock\n", pipe); |
| 1555 | 1577 | ||
| 1556 | /* not sure when this should be written */ | 1578 | /* not sure when this should be written */ |
| 1557 | I915_WRITE(DPLL_MD(pipe), crtc->config.dpll_hw_state.dpll_md); | 1579 | I915_WRITE(DPLL_MD(pipe), pipe_config->dpll_hw_state.dpll_md); |
| 1558 | POSTING_READ(DPLL_MD(pipe)); | 1580 | POSTING_READ(DPLL_MD(pipe)); |
| 1559 | 1581 | ||
| 1560 | mutex_unlock(&dev_priv->dpio_lock); | 1582 | mutex_unlock(&dev_priv->dpio_lock); |
| @@ -1757,7 +1779,7 @@ static void intel_prepare_shared_dpll(struct intel_crtc *crtc) · 196 unmodified lines | |||
| 1757 | if (WARN_ON(pll == NULL)) | 1779 | if (WARN_ON(pll == NULL)) |
| 1758 | return; | 1780 | return; |
| 1759 | 1781 | ||
| 1760 | WARN_ON(!pll->refcount); | 1782 | WARN_ON(!pll->config.crtc_mask); |
| 1761 | if (pll->active == 0) { | 1783 | if (pll->active == 0) { |
| 1762 | DRM_DEBUG_DRIVER("setting up %s\n", pll->name); | 1784 | DRM_DEBUG_DRIVER("setting up %s\n", pll->name); |
| 1763 | WARN_ON(pll->on); | 1785 | WARN_ON(pll->on); |
| @@ -1784,7 +1806,7 @@ static void intel_enable_shared_dpll(struct intel_crtc *crtc) · 20 unmodified lines | |||
| 1784 | if (WARN_ON(pll == NULL)) | 1806 | if (WARN_ON(pll == NULL)) |
| 1785 | return; | 1807 | return; |
| 1786 | 1808 | ||
| 1787 | if (WARN_ON(pll->refcount == 0)) | 1809 | if (WARN_ON(pll->config.crtc_mask == 0)) |
| 1788 | return; | 1810 | return; |
| 1789 | 1811 | ||
| 1790 | DRM_DEBUG_KMS("enable %s (active %d, on? %d) for crtc %d\n", | 1812 | DRM_DEBUG_KMS("enable %s (active %d, on? %d) for crtc %d\n", |
| @@ -1816,7 +1838,7 @@ static void intel_disable_shared_dpll(struct intel_crtc *crtc) · 25 unmodified lines | |||
| 1816 | if (WARN_ON(pll == NULL)) | 1838 | if (WARN_ON(pll == NULL)) |
| 1817 | return; | 1839 | return; |
| 1818 | 1840 | ||
| 1819 | if (WARN_ON(pll->refcount == 0)) | 1841 | if (WARN_ON(pll->config.crtc_mask == 0)) |
| 1820 | return; | 1842 | return; |
| 1821 | 1843 | ||
| 1822 | DRM_DEBUG_KMS("disable %s (active %d, on? %d) for crtc %d\n", | 1844 | DRM_DEBUG_KMS("disable %s (active %d, on? %d) for crtc %d\n", |
| @@ -2172,11 +2194,13 @@ static int intel_align_height(struct drm_device *dev, int height, bool tiled) · 349 unmodified lines | |||
| 2172 | } | 2194 | } |
| 2173 | 2195 | ||
| 2174 | int | 2196 | int |
| 2175 | intel_pin_and_fence_fb_obj(struct drm_device *dev, | 2197 | intel_pin_and_fence_fb_obj(struct drm_plane *plane, |
| 2176 | struct drm_i915_gem_object *obj, | 2198 | struct drm_framebuffer *fb, |
| 2177 | struct intel_engine_cs *pipelined) | 2199 | struct intel_engine_cs *pipelined) |
| 2178 | { | 2200 | { |
| 2201 | struct drm_device *dev = fb->dev; | ||
| 2179 | struct drm_i915_private *dev_priv = dev->dev_private; | 2202 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 2203 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | ||
| 2180 | u32 alignment; | 2204 | u32 alignment; |
| 2181 | int ret; | 2205 | int ret; |
| 2182 | 2206 | ||
| @@ -2447,6 +2471,12 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, · 264 unmodified lines | |||
| 2447 | ((intel_crtc->config.pipe_src_h - 1) << 16) | | 2471 | ((intel_crtc->config.pipe_src_h - 1) << 16) | |
| 2448 | (intel_crtc->config.pipe_src_w - 1)); | 2472 | (intel_crtc->config.pipe_src_w - 1)); |
| 2449 | I915_WRITE(DSPPOS(plane), 0); | 2473 | I915_WRITE(DSPPOS(plane), 0); |
| 2474 | } else if (IS_CHERRYVIEW(dev) && plane == PLANE_B) { | ||
| 2475 | I915_WRITE(PRIMSIZE(plane), | ||
| 2476 | ((intel_crtc->config.pipe_src_h - 1) << 16) | | ||
| 2477 | (intel_crtc->config.pipe_src_w - 1)); | ||
| 2478 | I915_WRITE(PRIMPOS(plane), 0); | ||
| 2479 | I915_WRITE(PRIMCNSTALPHA(plane), 0); | ||
| 2450 | } | 2480 | } |
| 2451 | 2481 | ||
| 2452 | switch (fb->pixel_format) { | 2482 | switch (fb->pixel_format) { |
| @@ -2869,7 +2899,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, · 416 unmodified lines | |||
| 2869 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 2899 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 2870 | enum pipe pipe = intel_crtc->pipe; | 2900 | enum pipe pipe = intel_crtc->pipe; |
| 2871 | struct drm_framebuffer *old_fb = crtc->primary->fb; | 2901 | struct drm_framebuffer *old_fb = crtc->primary->fb; |
| 2872 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | ||
| 2873 | struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb); | 2902 | struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb); |
| 2874 | int ret; | 2903 | int ret; |
| 2875 | 2904 | ||
| @@ -2892,9 +2921,9 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, · 16 unmodified lines | |||
| 2892 | } | 2921 | } |
| 2893 | 2922 | ||
| 2894 | mutex_lock(&dev->struct_mutex); | 2923 | mutex_lock(&dev->struct_mutex); |
| 2895 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); | 2924 | ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, NULL); |
| 2896 | if (ret == 0) | 2925 | if (ret == 0) |
| 2897 | i915_gem_track_fb(old_obj, obj, | 2926 | i915_gem_track_fb(old_obj, intel_fb_obj(fb), |
| 2898 | INTEL_FRONTBUFFER_PRIMARY(pipe)); | 2927 | INTEL_FRONTBUFFER_PRIMARY(pipe)); |
| 2899 | mutex_unlock(&dev->struct_mutex); | 2928 | mutex_unlock(&dev->struct_mutex); |
| 2900 | if (ret != 0) { | 2929 | if (ret != 0) { |
| @@ -3758,9 +3787,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) · 857 unmodified lines | |||
| 3758 | intel_fdi_normal_train(crtc); | 3787 | intel_fdi_normal_train(crtc); |
| 3759 | 3788 | ||
| 3760 | /* For PCH DP, enable TRANS_DP_CTL */ | 3789 | /* For PCH DP, enable TRANS_DP_CTL */ |
| 3761 | if (HAS_PCH_CPT(dev) && | 3790 | if (HAS_PCH_CPT(dev) && intel_crtc->config.has_dp_encoder) { |
| 3762 | (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) || | ||
| 3763 | intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_EDP))) { | ||
| 3764 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5; | 3791 | u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5; |
| 3765 | reg = TRANS_DP_CTL(pipe); | 3792 | reg = TRANS_DP_CTL(pipe); |
| 3766 | temp = I915_READ(reg); | 3793 | temp = I915_READ(reg); |
| @@ -3820,12 +3847,13 @@ void intel_put_shared_dpll(struct intel_crtc *crtc) · 53 unmodified lines | |||
| 3820 | if (pll == NULL) | 3847 | if (pll == NULL) |
| 3821 | return; | 3848 | return; |
| 3822 | 3849 | ||
| 3823 | if (pll->refcount == 0) { | 3850 | if (!(pll->config.crtc_mask & (1 << crtc->pipe))) { |
| 3824 | WARN(1, "bad %s refcount\n", pll->name); | 3851 | WARN(1, "bad %s crtc mask\n", pll->name); |
| 3825 | return; | 3852 | return; |
| 3826 | } | 3853 | } |
| 3827 | 3854 | ||
| 3828 | if (--pll->refcount == 0) { | 3855 | pll->config.crtc_mask &= ~(1 << crtc->pipe); |
| 3856 | if (pll->config.crtc_mask == 0) { | ||
| 3829 | WARN_ON(pll->on); | 3857 | WARN_ON(pll->on); |
| 3830 | WARN_ON(pll->active); | 3858 | WARN_ON(pll->active); |
| 3831 | } | 3859 | } |
| @@ -3836,15 +3864,9 @@ void intel_put_shared_dpll(struct intel_crtc *crtc) · 4 unmodified lines | |||
| 3836 | struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc) | 3864 | struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc) |
| 3837 | { | 3865 | { |
| 3838 | struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; | 3866 | struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; |
| 3839 | struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc); | 3867 | struct intel_shared_dpll *pll; |
| 3840 | enum intel_dpll_id i; | 3868 | enum intel_dpll_id i; |
| 3841 | 3869 | ||
| 3842 | if (pll) { | ||
| 3843 | DRM_DEBUG_KMS("CRTC:%d dropping existing %s\n", | ||
| 3844 | crtc->base.base.id, pll->name); | ||
| 3845 | intel_put_shared_dpll(crtc); | ||
| 3846 | } | ||
| 3847 | |||
| 3848 | if (HAS_PCH_IBX(dev_priv->dev)) { | 3870 | if (HAS_PCH_IBX(dev_priv->dev)) { |
| 3849 | /* Ironlake PCH has a fixed PLL->PCH pipe mapping. */ | 3871 | /* Ironlake PCH has a fixed PLL->PCH pipe mapping. */ |
| 3850 | i = (enum intel_dpll_id) crtc->pipe; | 3872 | i = (enum intel_dpll_id) crtc->pipe; |
| @@ -3853,7 +3875,7 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc) · 2 unmodified lines | |||
| 3853 | DRM_DEBUG_KMS("CRTC:%d using pre-allocated %s\n", | 3875 | DRM_DEBUG_KMS("CRTC:%d using pre-allocated %s\n", |
| 3854 | crtc->base.base.id, pll->name); | 3876 | crtc->base.base.id, pll->name); |
| 3855 | 3877 | ||
| 3856 | WARN_ON(pll->refcount); | 3878 | WARN_ON(pll->new_config->crtc_mask); |
| 3857 | 3879 | ||
| 3858 | goto found; | 3880 | goto found; |
| 3859 | } | 3881 | } |
| @@ -3862,15 +3884,16 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc) · 2 unmodified lines | |||
| 3862 | pll = &dev_priv->shared_dplls[i]; | 3884 | pll = &dev_priv->shared_dplls[i]; |
| 3863 | 3885 | ||
| 3864 | /* Only want to check enabled timings first */ | 3886 | /* Only want to check enabled timings first */ |
| 3865 | if (pll->refcount == 0) | 3887 | if (pll->new_config->crtc_mask == 0) |
| 3866 | continue; | 3888 | continue; |
| 3867 | 3889 | ||
| 3868 | if (memcmp(&crtc->config.dpll_hw_state, &pll->hw_state, | 3890 | if (memcmp(&crtc->new_config->dpll_hw_state, |
| 3869 | sizeof(pll->hw_state)) == 0) { | 3891 | &pll->new_config->hw_state, |
| 3870 | DRM_DEBUG_KMS("CRTC:%d sharing existing %s (refcount %d, ative %d)\n", | 3892 | sizeof(pll->new_config->hw_state)) == 0) { |
| 3871 | crtc->base.base.id, | 3893 | DRM_DEBUG_KMS("CRTC:%d sharing existing %s (crtc mask 0x%08x, ative %d)\n", |
| 3872 | pll->name, pll->refcount, pll->active); | 3894 | crtc->base.base.id, pll->name, |
| 3873 | 3895 | pll->new_config->crtc_mask, | |
| 3896 | pll->active); | ||
| 3874 | goto found; | 3897 | goto found; |
| 3875 | } | 3898 | } |
| 3876 | } | 3899 | } |
| @@ -3878,7 +3901,7 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc) · 1 unmodified line | |||
| 3878 | /* Ok no matching timings, maybe there's a free one? */ | 3901 | /* Ok no matching timings, maybe there's a free one? */ |
| 3879 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { | 3902 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { |
| 3880 | pll = &dev_priv->shared_dplls[i]; | 3903 | pll = &dev_priv->shared_dplls[i]; |
| 3881 | if (pll->refcount == 0) { | 3904 | if (pll->new_config->crtc_mask == 0) { |
| 3882 | DRM_DEBUG_KMS("CRTC:%d allocated %s\n", | 3905 | DRM_DEBUG_KMS("CRTC:%d allocated %s\n", |
| 3883 | crtc->base.base.id, pll->name); | 3906 | crtc->base.base.id, pll->name); |
| 3884 | goto found; | 3907 | goto found; |
| @@ -3888,18 +3911,86 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc) · 3 unmodified lines | |||
| 3888 | return NULL; | 3911 | return NULL; |
| 3889 | 3912 | ||
| 3890 | found: | 3913 | found: |
| 3891 | if (pll->refcount == 0) | 3914 | if (pll->new_config->crtc_mask == 0) |
| 3892 | pll->hw_state = crtc->config.dpll_hw_state; | 3915 | pll->new_config->hw_state = crtc->new_config->dpll_hw_state; |
| 3893 | 3916 | ||
| 3894 | crtc->config.shared_dpll = i; | 3917 | crtc->new_config->shared_dpll = i; |
| 3895 | DRM_DEBUG_DRIVER("using %s for pipe %c\n", pll->name, | 3918 | DRM_DEBUG_DRIVER("using %s for pipe %c\n", pll->name, |
| 3896 | pipe_name(crtc->pipe)); | 3919 | pipe_name(crtc->pipe)); |
| 3897 | 3920 | ||
| 3898 | pll->refcount++; | 3921 | pll->new_config->crtc_mask |= 1 << crtc->pipe; |
| 3899 | 3922 | ||
| 3900 | return pll; | 3923 | return pll; |
| 3901 | } | 3924 | } |
| 3902 | 3925 | ||
| 3926 | /** | ||
| 3927 | * intel_shared_dpll_start_config - start a new PLL staged config | ||
| 3928 | * @dev_priv: DRM device | ||
| 3929 | * @clear_pipes: mask of pipes that will have their PLLs freed | ||
| 3930 | * | ||
| 3931 | * Starts a new PLL staged config, copying the current config but | ||
| 3932 | * releasing the references of pipes specified in clear_pipes. | ||
| 3933 | */ | ||
| 3934 | static int intel_shared_dpll_start_config(struct drm_i915_private *dev_priv, | ||
| 3935 | unsigned clear_pipes) | ||
| 3936 | { | ||
| 3937 | struct intel_shared_dpll *pll; | ||
| 3938 | enum intel_dpll_id i; | ||
| 3939 | |||
| 3940 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { | ||
| 3941 | pll = &dev_priv->shared_dplls[i]; | ||
| 3942 | |||
| 3943 | pll->new_config = kmemdup(&pll->config, sizeof pll->config, | ||
| 3944 | GFP_KERNEL); | ||
| 3945 | if (!pll->new_config) | ||
| 3946 | goto cleanup; | ||
| 3947 | |||
| 3948 | pll->new_config->crtc_mask &= ~clear_pipes; | ||
| 3949 | } | ||
| 3950 | |||
| 3951 | return 0; | ||
| 3952 | |||
| 3953 | cleanup: | ||
| 3954 | while (--i >= 0) { | ||
| 3955 | pll = &dev_priv->shared_dplls[i]; | ||
| 3956 | kfree(pll->new_config); | ||
| 3957 | pll->new_config = NULL; | ||
| 3958 | } | ||
| 3959 | |||
| 3960 | return -ENOMEM; | ||
| 3961 | } | ||
| 3962 | |||
| 3963 | static void intel_shared_dpll_commit(struct drm_i915_private *dev_priv) | ||
| 3964 | { | ||
| 3965 | struct intel_shared_dpll *pll; | ||
| 3966 | enum intel_dpll_id i; | ||
| 3967 | |||
| 3968 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { | ||
| 3969 | pll = &dev_priv->shared_dplls[i]; | ||
| 3970 | |||
| 3971 | WARN_ON(pll->new_config == &pll->config); | ||
| 3972 | |||
| 3973 | pll->config = *pll->new_config; | ||
| 3974 | kfree(pll->new_config); | ||
| 3975 | pll->new_config = NULL; | ||
| 3976 | } | ||
| 3977 | } | ||
| 3978 | |||
| 3979 | static void intel_shared_dpll_abort_config(struct drm_i915_private *dev_priv) | ||
| 3980 | { | ||
| 3981 | struct intel_shared_dpll *pll; | ||
| 3982 | enum intel_dpll_id i; | ||
| 3983 | |||
| 3984 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { | ||
| 3985 | pll = &dev_priv->shared_dplls[i]; | ||
| 3986 | |||
| 3987 | WARN_ON(pll->new_config == &pll->config); | ||
| 3988 | |||
| 3989 | kfree(pll->new_config); | ||
| 3990 | pll->new_config = NULL; | ||
| 3991 | } | ||
| 3992 | } | ||
| 3993 | |||
| 3903 | static void cpt_verify_modeset(struct drm_device *dev, int pipe) | 3994 | static void cpt_verify_modeset(struct drm_device *dev, int pipe) |
| 3904 | { | 3995 | { |
| 3905 | struct drm_i915_private *dev_priv = dev->dev_private; | 3996 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -4593,6 +4684,9 @@ static void modeset_update_crtc_power_domains(struct drm_device *dev) · 687 unmodified lines | |||
| 4593 | intel_display_power_get(dev_priv, domain); | 4684 | intel_display_power_get(dev_priv, domain); |
| 4594 | } | 4685 | } |
| 4595 | 4686 | ||
| 4687 | if (dev_priv->display.modeset_global_resources) | ||
| 4688 | dev_priv->display.modeset_global_resources(dev); | ||
| 4689 | |||
| 4596 | for_each_intel_crtc(dev, crtc) { | 4690 | for_each_intel_crtc(dev, crtc) { |
| 4597 | enum intel_display_power_domain domain; | 4691 | enum intel_display_power_domain domain; |
| 4598 | 4692 | ||
| @@ -4663,10 +4757,9 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk) · 64 unmodified lines | |||
| 4663 | mutex_unlock(&dev_priv->rps.hw_lock); | 4757 | mutex_unlock(&dev_priv->rps.hw_lock); |
| 4664 | 4758 | ||
| 4665 | if (cdclk == 400000) { | 4759 | if (cdclk == 400000) { |
| 4666 | u32 divider, vco; | 4760 | u32 divider; |
| 4667 | 4761 | ||
| 4668 | vco = valleyview_get_vco(dev_priv); | 4762 | divider = DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1, cdclk) - 1; |
| 4669 | divider = DIV_ROUND_CLOSEST(vco << 1, cdclk) - 1; | ||
| 4670 | 4763 | ||
| 4671 | mutex_lock(&dev_priv->dpio_lock); | 4764 | mutex_lock(&dev_priv->dpio_lock); |
| 4672 | /* adjust cdclk divider */ | 4765 | /* adjust cdclk divider */ |
| @@ -4745,8 +4838,7 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk) · 72 unmodified lines | |||
| 4745 | static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv, | 4838 | static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv, |
| 4746 | int max_pixclk) | 4839 | int max_pixclk) |
| 4747 | { | 4840 | { |
| 4748 | int vco = valleyview_get_vco(dev_priv); | 4841 | int freq_320 = (dev_priv->hpll_freq << 1) % 320000 != 0 ? 333333 : 320000; |
| 4749 | int freq_320 = (vco << 1) % 320000 != 0 ? 333333 : 320000; | ||
| 4750 | 4842 | ||
| 4751 | /* FIXME: Punit isn't quite ready yet */ | 4843 | /* FIXME: Punit isn't quite ready yet */ |
| 4752 | if (IS_CHERRYVIEW(dev_priv->dev)) | 4844 | if (IS_CHERRYVIEW(dev_priv->dev)) |
| @@ -4820,8 +4912,6 @@ static void valleyview_modeset_global_resources(struct drm_device *dev) · 67 unmodified lines | |||
| 4820 | else | 4912 | else |
| 4821 | valleyview_set_cdclk(dev, req_cdclk); | 4913 | valleyview_set_cdclk(dev, req_cdclk); |
| 4822 | } | 4914 | } |
| 4823 | |||
| 4824 | modeset_update_crtc_power_domains(dev); | ||
| 4825 | } | 4915 | } |
| 4826 | 4916 | ||
| 4827 | static void valleyview_crtc_enable(struct drm_crtc *crtc) | 4917 | static void valleyview_crtc_enable(struct drm_crtc *crtc) |
| @@ -4842,9 +4932,9 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) · 14 unmodified lines | |||
| 4842 | 4932 | ||
| 4843 | if (!is_dsi) { | 4933 | if (!is_dsi) { |
| 4844 | if (IS_CHERRYVIEW(dev)) | 4934 | if (IS_CHERRYVIEW(dev)) |
| 4845 | chv_prepare_pll(intel_crtc); | 4935 | chv_prepare_pll(intel_crtc, &intel_crtc->config); |
| 4846 | else | 4936 | else |
| 4847 | vlv_prepare_pll(intel_crtc); | 4937 | vlv_prepare_pll(intel_crtc, &intel_crtc->config); |
| 4848 | } | 4938 | } |
| 4849 | 4939 | ||
| 4850 | if (intel_crtc->config.has_dp_encoder) | 4940 | if (intel_crtc->config.has_dp_encoder) |
| @@ -4852,6 +4942,13 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) · 1 unmodified line | |||
| 4852 | 4942 | ||
| 4853 | intel_set_pipe_timings(intel_crtc); | 4943 | intel_set_pipe_timings(intel_crtc); |
| 4854 | 4944 | ||
| 4945 | if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) { | ||
| 4946 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 4947 | |||
| 4948 | I915_WRITE(CHV_BLEND(pipe), CHV_BLEND_LEGACY); | ||
| 4949 | I915_WRITE(CHV_CANVAS(pipe), 0); | ||
| 4950 | } | ||
| 4951 | |||
| 4855 | i9xx_set_pipeconf(intel_crtc); | 4952 | i9xx_set_pipeconf(intel_crtc); |
| 4856 | 4953 | ||
| 4857 | intel_crtc->active = true; | 4954 | intel_crtc->active = true; |
| @@ -4864,9 +4961,9 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) · 6 unmodified lines | |||
| 4864 | 4961 | ||
| 4865 | if (!is_dsi) { | 4962 | if (!is_dsi) { |
| 4866 | if (IS_CHERRYVIEW(dev)) | 4963 | if (IS_CHERRYVIEW(dev)) |
| 4867 | chv_enable_pll(intel_crtc); | 4964 | chv_enable_pll(intel_crtc, &intel_crtc->config); |
| 4868 | else | 4965 | else |
| 4869 | vlv_enable_pll(intel_crtc); | 4966 | vlv_enable_pll(intel_crtc, &intel_crtc->config); |
| 4870 | } | 4967 | } |
| 4871 | 4968 | ||
| 4872 | for_each_encoder_on_crtc(dev, crtc, encoder) | 4969 | for_each_encoder_on_crtc(dev, crtc, encoder) |
| @@ -5384,11 +5481,11 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, · 511 unmodified lines | |||
| 5384 | struct intel_crtc_config *pipe_config) | 5481 | struct intel_crtc_config *pipe_config) |
| 5385 | { | 5482 | { |
| 5386 | struct drm_device *dev = crtc->base.dev; | 5483 | struct drm_device *dev = crtc->base.dev; |
| 5484 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 5387 | struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; | 5485 | struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; |
| 5388 | 5486 | ||
| 5389 | /* FIXME should check pixel clock limits on all platforms */ | 5487 | /* FIXME should check pixel clock limits on all platforms */ |
| 5390 | if (INTEL_INFO(dev)->gen < 4) { | 5488 | if (INTEL_INFO(dev)->gen < 4) { |
| 5391 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 5392 | int clock_limit = | 5489 | int clock_limit = |
| 5393 | dev_priv->display.get_display_clock_speed(dev); | 5490 | dev_priv->display.get_display_clock_speed(dev); |
| 5394 | 5491 | ||
| @@ -5437,13 +5534,6 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, · 42 unmodified lines | |||
| 5437 | if (HAS_IPS(dev)) | 5534 | if (HAS_IPS(dev)) |
| 5438 | hsw_compute_ips_config(crtc, pipe_config); | 5535 | hsw_compute_ips_config(crtc, pipe_config); |
| 5439 | 5536 | ||
| 5440 | /* | ||
| 5441 | * XXX: PCH/WRPLL clock sharing is done in ->mode_set, so make sure the | ||
| 5442 | * old clock survives for now. | ||
| 5443 | */ | ||
| 5444 | if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev) || HAS_DDI(dev)) | ||
| 5445 | pipe_config->shared_dpll = crtc->config.shared_dpll; | ||
| 5446 | |||
| 5447 | if (pipe_config->has_pch_encoder) | 5537 | if (pipe_config->has_pch_encoder) |
| 5448 | return ironlake_fdi_compute_config(crtc, pipe_config); | 5538 | return ironlake_fdi_compute_config(crtc, pipe_config); |
| 5449 | 5539 | ||
| @@ -5453,7 +5543,6 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, · 3 unmodified lines | |||
| 5453 | static int valleyview_get_display_clock_speed(struct drm_device *dev) | 5543 | static int valleyview_get_display_clock_speed(struct drm_device *dev) |
| 5454 | { | 5544 | { |
| 5455 | struct drm_i915_private *dev_priv = dev->dev_private; | 5545 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 5456 | int vco = valleyview_get_vco(dev_priv); | ||
| 5457 | u32 val; | 5546 | u32 val; |
| 5458 | int divider; | 5547 | int divider; |
| 5459 | 5548 | ||
| @@ -5461,6 +5550,9 @@ static int valleyview_get_display_clock_speed(struct drm_device *dev) · 1 unmodified line | |||
| 5461 | if (IS_CHERRYVIEW(dev)) | 5550 | if (IS_CHERRYVIEW(dev)) |
| 5462 | return 400000; | 5551 | return 400000; |
| 5463 | 5552 | ||
| 5553 | if (dev_priv->hpll_freq == 0) | ||
| 5554 | dev_priv->hpll_freq = valleyview_get_vco(dev_priv); | ||
| 5555 | |||
| 5464 | mutex_lock(&dev_priv->dpio_lock); | 5556 | mutex_lock(&dev_priv->dpio_lock); |
| 5465 | val = vlv_cck_read(dev_priv, CCK_DISPLAY_CLOCK_CONTROL); | 5557 | val = vlv_cck_read(dev_priv, CCK_DISPLAY_CLOCK_CONTROL); |
| 5466 | mutex_unlock(&dev_priv->dpio_lock); | 5558 | mutex_unlock(&dev_priv->dpio_lock); |
| @@ -5471,7 +5563,7 @@ static int valleyview_get_display_clock_speed(struct drm_device *dev) · 4 unmodified lines | |||
| 5471 | (divider << DISPLAY_FREQUENCY_STATUS_SHIFT), | 5563 | (divider << DISPLAY_FREQUENCY_STATUS_SHIFT), |
| 5472 | "cdclk change in progress\n"); | 5564 | "cdclk change in progress\n"); |
| 5473 | 5565 | ||
| 5474 | return DIV_ROUND_CLOSEST(vco << 1, divider + 1); | 5566 | return DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1, divider + 1); |
| 5475 | } | 5567 | } |
| 5476 | 5568 | ||
| 5477 | static int i945_get_display_clock_speed(struct drm_device *dev) | 5569 | static int i945_get_display_clock_speed(struct drm_device *dev) |
| @@ -5611,7 +5703,7 @@ static int i9xx_get_refclk(struct intel_crtc *crtc, int num_connectors) · 133 unmodified lines | |||
| 5611 | 5703 | ||
| 5612 | if (IS_VALLEYVIEW(dev)) { | 5704 | if (IS_VALLEYVIEW(dev)) { |
| 5613 | refclk = 100000; | 5705 | refclk = 100000; |
| 5614 | } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && | 5706 | } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && |
| 5615 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) { | 5707 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) { |
| 5616 | refclk = dev_priv->vbt.lvds_ssc_freq; | 5708 | refclk = dev_priv->vbt.lvds_ssc_freq; |
| 5617 | DRM_DEBUG_KMS("using SSC reference clock of %d kHz\n", refclk); | 5709 | DRM_DEBUG_KMS("using SSC reference clock of %d kHz\n", refclk); |
| @@ -5641,24 +5733,24 @@ static void i9xx_update_pll_dividers(struct intel_crtc *crtc, · 23 unmodified lines | |||
| 5641 | u32 fp, fp2 = 0; | 5733 | u32 fp, fp2 = 0; |
| 5642 | 5734 | ||
| 5643 | if (IS_PINEVIEW(dev)) { | 5735 | if (IS_PINEVIEW(dev)) { |
| 5644 | fp = pnv_dpll_compute_fp(&crtc->config.dpll); | 5736 | fp = pnv_dpll_compute_fp(&crtc->new_config->dpll); |
| 5645 | if (reduced_clock) | 5737 | if (reduced_clock) |
| 5646 | fp2 = pnv_dpll_compute_fp(reduced_clock); | 5738 | fp2 = pnv_dpll_compute_fp(reduced_clock); |
| 5647 | } else { | 5739 | } else { |
| 5648 | fp = i9xx_dpll_compute_fp(&crtc->config.dpll); | 5740 | fp = i9xx_dpll_compute_fp(&crtc->new_config->dpll); |
| 5649 | if (reduced_clock) | 5741 | if (reduced_clock) |
| 5650 | fp2 = i9xx_dpll_compute_fp(reduced_clock); | 5742 | fp2 = i9xx_dpll_compute_fp(reduced_clock); |
| 5651 | } | 5743 | } |
| 5652 | 5744 | ||
| 5653 | crtc->config.dpll_hw_state.fp0 = fp; | 5745 | crtc->new_config->dpll_hw_state.fp0 = fp; |
| 5654 | 5746 | ||
| 5655 | crtc->lowfreq_avail = false; | 5747 | crtc->lowfreq_avail = false; |
| 5656 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && | 5748 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && |
| 5657 | reduced_clock && i915.powersave) { | 5749 | reduced_clock && i915.powersave) { |
| 5658 | crtc->config.dpll_hw_state.fp1 = fp2; | 5750 | crtc->new_config->dpll_hw_state.fp1 = fp2; |
| 5659 | crtc->lowfreq_avail = true; | 5751 | crtc->lowfreq_avail = true; |
| 5660 | } else { | 5752 | } else { |
| 5661 | crtc->config.dpll_hw_state.fp1 = fp; | 5753 | crtc->new_config->dpll_hw_state.fp1 = fp; |
| 5662 | } | 5754 | } |
| 5663 | } | 5755 | } |
| 5664 | 5756 | ||
| @@ -5747,7 +5839,8 @@ void intel_dp_set_m_n(struct intel_crtc *crtc) · 82 unmodified lines | |||
| 5747 | &crtc->config.dp_m2_n2); | 5839 | &crtc->config.dp_m2_n2); |
| 5748 | } | 5840 | } |
| 5749 | 5841 | ||
| 5750 | static void vlv_update_pll(struct intel_crtc *crtc) | 5842 | static void vlv_update_pll(struct intel_crtc *crtc, |
| 5843 | struct intel_crtc_config *pipe_config) | ||
| 5751 | { | 5844 | { |
| 5752 | u32 dpll, dpll_md; | 5845 | u32 dpll, dpll_md; |
| 5753 | 5846 | ||
| @@ -5762,14 +5855,15 @@ static void vlv_update_pll(struct intel_crtc *crtc) · 8 unmodified lines | |||
| 5762 | if (crtc->pipe == PIPE_B) | 5855 | if (crtc->pipe == PIPE_B) |
| 5763 | dpll |= DPLL_INTEGRATED_CRI_CLK_VLV; | 5856 | dpll |= DPLL_INTEGRATED_CRI_CLK_VLV; |
| 5764 | dpll |= DPLL_VCO_ENABLE; | 5857 | dpll |= DPLL_VCO_ENABLE; |
| 5765 | crtc->config.dpll_hw_state.dpll = dpll; | 5858 | pipe_config->dpll_hw_state.dpll = dpll; |
| 5766 | 5859 | ||
| 5767 | dpll_md = (crtc->config.pixel_multiplier - 1) | 5860 | dpll_md = (pipe_config->pixel_multiplier - 1) |
| 5768 | << DPLL_MD_UDI_MULTIPLIER_SHIFT; | 5861 | << DPLL_MD_UDI_MULTIPLIER_SHIFT; |
| 5769 | crtc->config.dpll_hw_state.dpll_md = dpll_md; | 5862 | pipe_config->dpll_hw_state.dpll_md = dpll_md; |
| 5770 | } | 5863 | } |
| 5771 | 5864 | ||
| 5772 | static void vlv_prepare_pll(struct intel_crtc *crtc) | 5865 | static void vlv_prepare_pll(struct intel_crtc *crtc, |
| 5866 | const struct intel_crtc_config *pipe_config) | ||
| 5773 | { | 5867 | { |
| 5774 | struct drm_device *dev = crtc->base.dev; | 5868 | struct drm_device *dev = crtc->base.dev; |
| 5775 | struct drm_i915_private *dev_priv = dev->dev_private; | 5869 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -5780,11 +5874,11 @@ static void vlv_prepare_pll(struct intel_crtc *crtc) · 4 unmodified lines | |||
| 5780 | 5874 | ||
| 5781 | mutex_lock(&dev_priv->dpio_lock); | 5875 | mutex_lock(&dev_priv->dpio_lock); |
| 5782 | 5876 | ||
| 5783 | bestn = crtc->config.dpll.n; | 5877 | bestn = pipe_config->dpll.n; |
| 5784 | bestm1 = crtc->config.dpll.m1; | 5878 | bestm1 = pipe_config->dpll.m1; |
| 5785 | bestm2 = crtc->config.dpll.m2; | 5879 | bestm2 = pipe_config->dpll.m2; |
| 5786 | bestp1 = crtc->config.dpll.p1; | 5880 | bestp1 = pipe_config->dpll.p1; |
| 5787 | bestp2 = crtc->config.dpll.p2; | 5881 | bestp2 = pipe_config->dpll.p2; |
| 5788 | 5882 | ||
| 5789 | /* See eDP HDMI DPIO driver vbios notes doc */ | 5883 | /* See eDP HDMI DPIO driver vbios notes doc */ |
| 5790 | 5884 | ||
| @@ -5821,7 +5915,7 @@ static void vlv_prepare_pll(struct intel_crtc *crtc) · 30 unmodified lines | |||
| 5821 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW3(pipe), mdiv); | 5915 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW3(pipe), mdiv); |
| 5822 | 5916 | ||
| 5823 | /* Set HBR and RBR LPF coefficients */ | 5917 | /* Set HBR and RBR LPF coefficients */ |
| 5824 | if (crtc->config.port_clock == 162000 || | 5918 | if (pipe_config->port_clock == 162000 || |
| 5825 | intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG) || | 5919 | intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG) || |
| 5826 | intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) | 5920 | intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) |
| 5827 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), | 5921 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), |
| @@ -5830,8 +5924,7 @@ static void vlv_prepare_pll(struct intel_crtc *crtc) · 2 unmodified lines | |||
| 5830 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), | 5924 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), |
| 5831 | 0x00d0000f); | 5925 | 0x00d0000f); |
| 5832 | 5926 | ||
| 5833 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP) || | 5927 | if (crtc->config.has_dp_encoder) { |
| 5834 | intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { | ||
| 5835 | /* Use SSC source */ | 5928 | /* Use SSC source */ |
| 5836 | if (pipe == PIPE_A) | 5929 | if (pipe == PIPE_A) |
| 5837 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe), | 5930 | vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe), |
| @@ -5860,19 +5953,21 @@ static void vlv_prepare_pll(struct intel_crtc *crtc) · 22 unmodified lines | |||
| 5860 | mutex_unlock(&dev_priv->dpio_lock); | 5953 | mutex_unlock(&dev_priv->dpio_lock); |
| 5861 | } | 5954 | } |
| 5862 | 5955 | ||
| 5863 | static void chv_update_pll(struct intel_crtc *crtc) | 5956 | static void chv_update_pll(struct intel_crtc *crtc, |
| 5957 | struct intel_crtc_config *pipe_config) | ||
| 5864 | { | 5958 | { |
| 5865 | crtc->config.dpll_hw_state.dpll = DPLL_SSC_REF_CLOCK_CHV | | 5959 | pipe_config->dpll_hw_state.dpll = DPLL_SSC_REF_CLOCK_CHV | |
| 5866 | DPLL_REFA_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS | | 5960 | DPLL_REFA_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS | |
| 5867 | DPLL_VCO_ENABLE; | 5961 | DPLL_VCO_ENABLE; |
| 5868 | if (crtc->pipe != PIPE_A) | 5962 | if (crtc->pipe != PIPE_A) |
| 5869 | crtc->config.dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV; | 5963 | pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV; |
| 5870 | 5964 | ||
| 5871 | crtc->config.dpll_hw_state.dpll_md = | 5965 | pipe_config->dpll_hw_state.dpll_md = |
| 5872 | (crtc->config.pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT; | 5966 | (pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT; |
| 5873 | } | 5967 | } |
| 5874 | 5968 | ||
| 5875 | static void chv_prepare_pll(struct intel_crtc *crtc) | 5969 | static void chv_prepare_pll(struct intel_crtc *crtc, |
| 5970 | const struct intel_crtc_config *pipe_config) | ||
| 5876 | { | 5971 | { |
| 5877 | struct drm_device *dev = crtc->base.dev; | 5972 | struct drm_device *dev = crtc->base.dev; |
| 5878 | struct drm_i915_private *dev_priv = dev->dev_private; | 5973 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -5883,18 +5978,18 @@ static void chv_prepare_pll(struct intel_crtc *crtc) · 4 unmodified lines | |||
| 5883 | u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac; | 5978 | u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac; |
| 5884 | int refclk; | 5979 | int refclk; |
| 5885 | 5980 | ||
| 5886 | bestn = crtc->config.dpll.n; | 5981 | bestn = pipe_config->dpll.n; |
| 5887 | bestm2_frac = crtc->config.dpll.m2 & 0x3fffff; | 5982 | bestm2_frac = pipe_config->dpll.m2 & 0x3fffff; |
| 5888 | bestm1 = crtc->config.dpll.m1; | 5983 | bestm1 = pipe_config->dpll.m1; |
| 5889 | bestm2 = crtc->config.dpll.m2 >> 22; | 5984 | bestm2 = pipe_config->dpll.m2 >> 22; |
| 5890 | bestp1 = crtc->config.dpll.p1; | 5985 | bestp1 = pipe_config->dpll.p1; |
| 5891 | bestp2 = crtc->config.dpll.p2; | 5986 | bestp2 = pipe_config->dpll.p2; |
| 5892 | 5987 | ||
| 5893 | /* | 5988 | /* |
| 5894 | * Enable Refclk and SSC | 5989 | * Enable Refclk and SSC |
| 5895 | */ | 5990 | */ |
| 5896 | I915_WRITE(dpll_reg, | 5991 | I915_WRITE(dpll_reg, |
| 5897 | crtc->config.dpll_hw_state.dpll & ~DPLL_VCO_ENABLE); | 5992 | pipe_config->dpll_hw_state.dpll & ~DPLL_VCO_ENABLE); |
| 5898 | 5993 | ||
| 5899 | mutex_lock(&dev_priv->dpio_lock); | 5994 | mutex_lock(&dev_priv->dpio_lock); |
| 5900 | 5995 | ||
| @@ -5942,6 +6037,53 @@ static void chv_prepare_pll(struct intel_crtc *crtc) · 41 unmodified lines | |||
| 5942 | mutex_unlock(&dev_priv->dpio_lock); | 6037 | mutex_unlock(&dev_priv->dpio_lock); |
| 5943 | } | 6038 | } |
| 5944 | 6039 | ||
| 6040 | /** | ||
| 6041 | * vlv_force_pll_on - forcibly enable just the PLL | ||
| 6042 | * @dev_priv: i915 private structure | ||
| 6043 | * @pipe: pipe PLL to enable | ||
| 6044 | * @dpll: PLL configuration | ||
| 6045 | * | ||
| 6046 | * Enable the PLL for @pipe using the supplied @dpll config. To be used | ||
| 6047 | * in cases where we need the PLL enabled even when @pipe is not going to | ||
| 6048 | * be enabled. | ||
| 6049 | */ | ||
| 6050 | void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, | ||
| 6051 | const struct dpll *dpll) | ||
| 6052 | { | ||
| 6053 | struct intel_crtc *crtc = | ||
| 6054 | to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe)); | ||
| 6055 | struct intel_crtc_config pipe_config = { | ||
| 6056 | .pixel_multiplier = 1, | ||
| 6057 | .dpll = *dpll, | ||
| 6058 | }; | ||
| 6059 | |||
| 6060 | if (IS_CHERRYVIEW(dev)) { | ||
| 6061 | chv_update_pll(crtc, &pipe_config); | ||
| 6062 | chv_prepare_pll(crtc, &pipe_config); | ||
| 6063 | chv_enable_pll(crtc, &pipe_config); | ||
| 6064 | } else { | ||
| 6065 | vlv_update_pll(crtc, &pipe_config); | ||
| 6066 | vlv_prepare_pll(crtc, &pipe_config); | ||
| 6067 | vlv_enable_pll(crtc, &pipe_config); | ||
| 6068 | } | ||
| 6069 | } | ||
| 6070 | |||
| 6071 | /** | ||
| 6072 | * vlv_force_pll_off - forcibly disable just the PLL | ||
| 6073 | * @dev_priv: i915 private structure | ||
| 6074 | * @pipe: pipe PLL to disable | ||
| 6075 | * | ||
| 6076 | * Disable the PLL for @pipe. To be used in cases where we need | ||
| 6077 | * the PLL enabled even when @pipe is not going to be enabled. | ||
| 6078 | */ | ||
| 6079 | void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe) | ||
| 6080 | { | ||
| 6081 | if (IS_CHERRYVIEW(dev)) | ||
| 6082 | chv_disable_pll(to_i915(dev), pipe); | ||
| 6083 | else | ||
| 6084 | vlv_disable_pll(to_i915(dev), pipe); | ||
| 6085 | } | ||
| 6086 | |||
| 5945 | static void i9xx_update_pll(struct intel_crtc *crtc, | 6087 | static void i9xx_update_pll(struct intel_crtc *crtc, |
| 5946 | intel_clock_t *reduced_clock, | 6088 | intel_clock_t *reduced_clock, |
| 5947 | int num_connectors) | 6089 | int num_connectors) |
| @@ -5950,29 +6092,29 @@ static void i9xx_update_pll(struct intel_crtc *crtc, · 2 unmodified lines | |||
| 5950 | struct drm_i915_private *dev_priv = dev->dev_private; | 6092 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 5951 | u32 dpll; | 6093 | u32 dpll; |
| 5952 | bool is_sdvo; | 6094 | bool is_sdvo; |
| 5953 | struct dpll *clock = &crtc->config.dpll; | 6095 | struct dpll *clock = &crtc->new_config->dpll; |
| 5954 | 6096 | ||
| 5955 | i9xx_update_pll_dividers(crtc, reduced_clock); | 6097 | i9xx_update_pll_dividers(crtc, reduced_clock); |
| 5956 | 6098 | ||
| 5957 | is_sdvo = intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO) || | 6099 | is_sdvo = intel_pipe_will_have_type(crtc, INTEL_OUTPUT_SDVO) || |
| 5958 | intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI); | 6100 | intel_pipe_will_have_type(crtc, INTEL_OUTPUT_HDMI); |
| 5959 | 6101 | ||
| 5960 | dpll = DPLL_VGA_MODE_DIS; | 6102 | dpll = DPLL_VGA_MODE_DIS; |
| 5961 | 6103 | ||
| 5962 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) | 6104 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) |
| 5963 | dpll |= DPLLB_MODE_LVDS; | 6105 | dpll |= DPLLB_MODE_LVDS; |
| 5964 | else | 6106 | else |
| 5965 | dpll |= DPLLB_MODE_DAC_SERIAL; | 6107 | dpll |= DPLLB_MODE_DAC_SERIAL; |
| 5966 | 6108 | ||
| 5967 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) { | 6109 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) { |
| 5968 | dpll |= (crtc->config.pixel_multiplier - 1) | 6110 | dpll |= (crtc->new_config->pixel_multiplier - 1) |
| 5969 | << SDVO_MULTIPLIER_SHIFT_HIRES; | 6111 | << SDVO_MULTIPLIER_SHIFT_HIRES; |
| 5970 | } | 6112 | } |
| 5971 | 6113 | ||
| 5972 | if (is_sdvo) | 6114 | if (is_sdvo) |
| 5973 | dpll |= DPLL_SDVO_HIGH_SPEED; | 6115 | dpll |= DPLL_SDVO_HIGH_SPEED; |
| 5974 | 6116 | ||
| 5975 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) | 6117 | if (crtc->new_config->has_dp_encoder) |
| 5976 | dpll |= DPLL_SDVO_HIGH_SPEED; | 6118 | dpll |= DPLL_SDVO_HIGH_SPEED; |
| 5977 | 6119 | ||
| 5978 | /* compute bitmask from p1 value */ | 6120 | /* compute bitmask from p1 value */ |
| @@ -6000,21 +6142,21 @@ static void i9xx_update_pll(struct intel_crtc *crtc, · 21 unmodified lines | |||
| 6000 | if (INTEL_INFO(dev)->gen >= 4) | 6142 | if (INTEL_INFO(dev)->gen >= 4) |
| 6001 | dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); | 6143 | dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); |
| 6002 | 6144 | ||
| 6003 | if (crtc->config.sdvo_tv_clock) | 6145 | if (crtc->new_config->sdvo_tv_clock) |
| 6004 | dpll |= PLL_REF_INPUT_TVCLKINBC; | 6146 | dpll |= PLL_REF_INPUT_TVCLKINBC; |
| 6005 | else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && | 6147 | else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && |
| 6006 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) | 6148 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) |
| 6007 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; | 6149 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; |
| 6008 | else | 6150 | else |
| 6009 | dpll |= PLL_REF_INPUT_DREFCLK; | 6151 | dpll |= PLL_REF_INPUT_DREFCLK; |
| 6010 | 6152 | ||
| 6011 | dpll |= DPLL_VCO_ENABLE; | 6153 | dpll |= DPLL_VCO_ENABLE; |
| 6012 | crtc->config.dpll_hw_state.dpll = dpll; | 6154 | crtc->new_config->dpll_hw_state.dpll = dpll; |
| 6013 | 6155 | ||
| 6014 | if (INTEL_INFO(dev)->gen >= 4) { | 6156 | if (INTEL_INFO(dev)->gen >= 4) { |
| 6015 | u32 dpll_md = (crtc->config.pixel_multiplier - 1) | 6157 | u32 dpll_md = (crtc->new_config->pixel_multiplier - 1) |
| 6016 | << DPLL_MD_UDI_MULTIPLIER_SHIFT; | 6158 | << DPLL_MD_UDI_MULTIPLIER_SHIFT; |
| 6017 | crtc->config.dpll_hw_state.dpll_md = dpll_md; | 6159 | crtc->new_config->dpll_hw_state.dpll_md = dpll_md; |
| 6018 | } | 6160 | } |
| 6019 | } | 6161 | } |
| 6020 | 6162 | ||
| @@ -6025,13 +6167,13 @@ static void i8xx_update_pll(struct intel_crtc *crtc, · 4 unmodified lines | |||
| 6025 | struct drm_device *dev = crtc->base.dev; | 6167 | struct drm_device *dev = crtc->base.dev; |
| 6026 | struct drm_i915_private *dev_priv = dev->dev_private; | 6168 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 6027 | u32 dpll; | 6169 | u32 dpll; |
| 6028 | struct dpll *clock = &crtc->config.dpll; | 6170 | struct dpll *clock = &crtc->new_config->dpll; |
| 6029 | 6171 | ||
| 6030 | i9xx_update_pll_dividers(crtc, reduced_clock); | 6172 | i9xx_update_pll_dividers(crtc, reduced_clock); |
| 6031 | 6173 | ||
| 6032 | dpll = DPLL_VGA_MODE_DIS; | 6174 | dpll = DPLL_VGA_MODE_DIS; |
| 6033 | 6175 | ||
| 6034 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 6176 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { |
| 6035 | dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; | 6177 | dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; |
| 6036 | } else { | 6178 | } else { |
| 6037 | if (clock->p1 == 2) | 6179 | if (clock->p1 == 2) |
| @@ -6042,17 +6184,17 @@ static void i8xx_update_pll(struct intel_crtc *crtc, · 4 unmodified lines | |||
| 6042 | dpll |= PLL_P2_DIVIDE_BY_4; | 6184 | dpll |= PLL_P2_DIVIDE_BY_4; |
| 6043 | } | 6185 | } |
| 6044 | 6186 | ||
| 6045 | if (!IS_I830(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_DVO)) | 6187 | if (!IS_I830(dev) && intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DVO)) |
| 6046 | dpll |= DPLL_DVO_2X_MODE; | 6188 | dpll |= DPLL_DVO_2X_MODE; |
| 6047 | 6189 | ||
| 6048 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && | 6190 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && |
| 6049 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) | 6191 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) |
| 6050 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; | 6192 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; |
| 6051 | else | 6193 | else |
| 6052 | dpll |= PLL_REF_INPUT_DREFCLK; | 6194 | dpll |= PLL_REF_INPUT_DREFCLK; |
| 6053 | 6195 | ||
| 6054 | dpll |= DPLL_VCO_ENABLE; | 6196 | dpll |= DPLL_VCO_ENABLE; |
| 6055 | crtc->config.dpll_hw_state.dpll = dpll; | 6197 | crtc->new_config->dpll_hw_state.dpll = dpll; |
| 6056 | } | 6198 | } |
| 6057 | 6199 | ||
| 6058 | static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) | 6200 | static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) |
| @@ -6248,9 +6390,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc) · 189 unmodified lines | |||
| 6248 | POSTING_READ(PIPECONF(intel_crtc->pipe)); | 6390 | POSTING_READ(PIPECONF(intel_crtc->pipe)); |
| 6249 | } | 6391 | } |
| 6250 | 6392 | ||
| 6251 | static int i9xx_crtc_mode_set(struct intel_crtc *crtc, | 6393 | static int i9xx_crtc_compute_clock(struct intel_crtc *crtc) |
| 6252 | int x, int y, | ||
| 6253 | struct drm_framebuffer *fb) | ||
| 6254 | { | 6394 | { |
| 6255 | struct drm_device *dev = crtc->base.dev; | 6395 | struct drm_device *dev = crtc->base.dev; |
| 6256 | struct drm_i915_private *dev_priv = dev->dev_private; | 6396 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -6261,7 +6401,10 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc, · 4 unmodified lines | |||
| 6261 | struct intel_encoder *encoder; | 6401 | struct intel_encoder *encoder; |
| 6262 | const intel_limit_t *limit; | 6402 | const intel_limit_t *limit; |
| 6263 | 6403 | ||
| 6264 | for_each_encoder_on_crtc(dev, &crtc->base, encoder) { | 6404 | for_each_intel_encoder(dev, encoder) { |
| 6405 | if (encoder->new_crtc != crtc) | ||
| 6406 | continue; | ||
| 6407 | |||
| 6265 | switch (encoder->type) { | 6408 | switch (encoder->type) { |
| 6266 | case INTEL_OUTPUT_LVDS: | 6409 | case INTEL_OUTPUT_LVDS: |
| 6267 | is_lvds = true; | 6410 | is_lvds = true; |
| @@ -6269,6 +6412,8 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc, · 1 unmodified line | |||
| 6269 | case INTEL_OUTPUT_DSI: | 6412 | case INTEL_OUTPUT_DSI: |
| 6270 | is_dsi = true; | 6413 | is_dsi = true; |
| 6271 | break; | 6414 | break; |
| 6415 | default: | ||
| 6416 | break; | ||
| 6272 | } | 6417 | } |
| 6273 | 6418 | ||
| 6274 | num_connectors++; | 6419 | num_connectors++; |
| @@ -6277,7 +6422,7 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc, · 2 unmodified lines | |||
| 6277 | if (is_dsi) | 6422 | if (is_dsi) |
| 6278 | return 0; | 6423 | return 0; |
| 6279 | 6424 | ||
| 6280 | if (!crtc->config.clock_set) { | 6425 | if (!crtc->new_config->clock_set) { |
| 6281 | refclk = i9xx_get_refclk(crtc, num_connectors); | 6426 | refclk = i9xx_get_refclk(crtc, num_connectors); |
| 6282 | 6427 | ||
| 6283 | /* | 6428 | /* |
| @@ -6288,7 +6433,7 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc, · 4 unmodified lines | |||
| 6288 | */ | 6433 | */ |
| 6289 | limit = intel_limit(crtc, refclk); | 6434 | limit = intel_limit(crtc, refclk); |
| 6290 | ok = dev_priv->display.find_dpll(limit, crtc, | 6435 | ok = dev_priv->display.find_dpll(limit, crtc, |
| 6291 | crtc->config.port_clock, | 6436 | crtc->new_config->port_clock, |
| 6292 | refclk, NULL, &clock); | 6437 | refclk, NULL, &clock); |
| 6293 | if (!ok) { | 6438 | if (!ok) { |
| 6294 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); | 6439 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); |
| @@ -6309,11 +6454,11 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc, · 14 unmodified lines | |||
| 6309 | &reduced_clock); | 6454 | &reduced_clock); |
| 6310 | } | 6455 | } |
| 6311 | /* Compat-code for transition, will disappear. */ | 6456 | /* Compat-code for transition, will disappear. */ |
| 6312 | crtc->config.dpll.n = clock.n; | 6457 | crtc->new_config->dpll.n = clock.n; |
| 6313 | crtc->config.dpll.m1 = clock.m1; | 6458 | crtc->new_config->dpll.m1 = clock.m1; |
| 6314 | crtc->config.dpll.m2 = clock.m2; | 6459 | crtc->new_config->dpll.m2 = clock.m2; |
| 6315 | crtc->config.dpll.p1 = clock.p1; | 6460 | crtc->new_config->dpll.p1 = clock.p1; |
| 6316 | crtc->config.dpll.p2 = clock.p2; | 6461 | crtc->new_config->dpll.p2 = clock.p2; |
| 6317 | } | 6462 | } |
| 6318 | 6463 | ||
| 6319 | if (IS_GEN2(dev)) { | 6464 | if (IS_GEN2(dev)) { |
| @@ -6321,9 +6466,9 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc, · 1 unmodified line | |||
| 6321 | has_reduced_clock ? &reduced_clock : NULL, | 6466 | has_reduced_clock ? &reduced_clock : NULL, |
| 6322 | num_connectors); | 6467 | num_connectors); |
| 6323 | } else if (IS_CHERRYVIEW(dev)) { | 6468 | } else if (IS_CHERRYVIEW(dev)) { |
| 6324 | chv_update_pll(crtc); | 6469 | chv_update_pll(crtc, crtc->new_config); |
| 6325 | } else if (IS_VALLEYVIEW(dev)) { | 6470 | } else if (IS_VALLEYVIEW(dev)) { |
| 6326 | vlv_update_pll(crtc); | 6471 | vlv_update_pll(crtc, crtc->new_config); |
| 6327 | } else { | 6472 | } else { |
| 6328 | i9xx_update_pll(crtc, | 6473 | i9xx_update_pll(crtc, |
| 6329 | has_reduced_clock ? &reduced_clock : NULL, | 6474 | has_reduced_clock ? &reduced_clock : NULL, |
| @@ -6597,6 +6742,8 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) · 267 unmodified lines | |||
| 6597 | if (enc_to_dig_port(&encoder->base)->port == PORT_A) | 6742 | if (enc_to_dig_port(&encoder->base)->port == PORT_A) |
| 6598 | has_cpu_edp = true; | 6743 | has_cpu_edp = true; |
| 6599 | break; | 6744 | break; |
| 6745 | default: | ||
| 6746 | break; | ||
| 6600 | } | 6747 | } |
| 6601 | } | 6748 | } |
| 6602 | 6749 | ||
| @@ -6901,6 +7048,8 @@ static void lpt_init_pch_refclk(struct drm_device *dev) · 298 unmodified lines | |||
| 6901 | case INTEL_OUTPUT_ANALOG: | 7048 | case INTEL_OUTPUT_ANALOG: |
| 6902 | has_vga = true; | 7049 | has_vga = true; |
| 6903 | break; | 7050 | break; |
| 7051 | default: | ||
| 7052 | break; | ||
| 6904 | } | 7053 | } |
| 6905 | } | 7054 | } |
| 6906 | 7055 | ||
| @@ -6929,11 +7078,16 @@ static int ironlake_get_refclk(struct drm_crtc *crtc) · 22 unmodified lines | |||
| 6929 | int num_connectors = 0; | 7078 | int num_connectors = 0; |
| 6930 | bool is_lvds = false; | 7079 | bool is_lvds = false; |
| 6931 | 7080 | ||
| 6932 | for_each_encoder_on_crtc(dev, crtc, encoder) { | 7081 | for_each_intel_encoder(dev, encoder) { |
| 7082 | if (encoder->new_crtc != to_intel_crtc(crtc)) | ||
| 7083 | continue; | ||
| 7084 | |||
| 6933 | switch (encoder->type) { | 7085 | switch (encoder->type) { |
| 6934 | case INTEL_OUTPUT_LVDS: | 7086 | case INTEL_OUTPUT_LVDS: |
| 6935 | is_lvds = true; | 7087 | is_lvds = true; |
| 6936 | break; | 7088 | break; |
| 7089 | default: | ||
| 7090 | break; | ||
| 6937 | } | 7091 | } |
| 6938 | num_connectors++; | 7092 | num_connectors++; |
| 6939 | } | 7093 | } |
| @@ -7118,7 +7272,7 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, · 178 unmodified lines | |||
| 7118 | const intel_limit_t *limit; | 7272 | const intel_limit_t *limit; |
| 7119 | bool ret, is_lvds = false; | 7273 | bool ret, is_lvds = false; |
| 7120 | 7274 | ||
| 7121 | is_lvds = intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_LVDS); | 7275 | is_lvds = intel_pipe_will_have_type(intel_crtc, INTEL_OUTPUT_LVDS); |
| 7122 | 7276 | ||
| 7123 | refclk = ironlake_get_refclk(crtc); | 7277 | refclk = ironlake_get_refclk(crtc); |
| 7124 | 7278 | ||
| @@ -7129,7 +7283,7 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, · 4 unmodified lines | |||
| 7129 | */ | 7283 | */ |
| 7130 | limit = intel_limit(intel_crtc, refclk); | 7284 | limit = intel_limit(intel_crtc, refclk); |
| 7131 | ret = dev_priv->display.find_dpll(limit, intel_crtc, | 7285 | ret = dev_priv->display.find_dpll(limit, intel_crtc, |
| 7132 | intel_crtc->config.port_clock, | 7286 | intel_crtc->new_config->port_clock, |
| 7133 | refclk, NULL, clock); | 7287 | refclk, NULL, clock); |
| 7134 | if (!ret) | 7288 | if (!ret) |
| 7135 | return false; | 7289 | return false; |
| @@ -7179,7 +7333,10 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, · 43 unmodified lines | |||
| 7179 | int factor, num_connectors = 0; | 7333 | int factor, num_connectors = 0; |
| 7180 | bool is_lvds = false, is_sdvo = false; | 7334 | bool is_lvds = false, is_sdvo = false; |
| 7181 | 7335 | ||
| 7182 | for_each_encoder_on_crtc(dev, crtc, intel_encoder) { | 7336 | for_each_intel_encoder(dev, intel_encoder) { |
| 7337 | if (intel_encoder->new_crtc != to_intel_crtc(crtc)) | ||
| 7338 | continue; | ||
| 7339 | |||
| 7183 | switch (intel_encoder->type) { | 7340 | switch (intel_encoder->type) { |
| 7184 | case INTEL_OUTPUT_LVDS: | 7341 | case INTEL_OUTPUT_LVDS: |
| 7185 | is_lvds = true; | 7342 | is_lvds = true; |
| @@ -7188,6 +7345,8 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, · 2 unmodified lines | |||
| 7188 | case INTEL_OUTPUT_HDMI: | 7345 | case INTEL_OUTPUT_HDMI: |
| 7189 | is_sdvo = true; | 7346 | is_sdvo = true; |
| 7190 | break; | 7347 | break; |
| 7348 | default: | ||
| 7349 | break; | ||
| 7191 | } | 7350 | } |
| 7192 | 7351 | ||
| 7193 | num_connectors++; | 7352 | num_connectors++; |
| @@ -7200,10 +7359,10 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, · 6 unmodified lines | |||
| 7200 | dev_priv->vbt.lvds_ssc_freq == 100000) || | 7359 | dev_priv->vbt.lvds_ssc_freq == 100000) || |
| 7201 | (HAS_PCH_IBX(dev) && intel_is_dual_link_lvds(dev))) | 7360 | (HAS_PCH_IBX(dev) && intel_is_dual_link_lvds(dev))) |
| 7202 | factor = 25; | 7361 | factor = 25; |
| 7203 | } else if (intel_crtc->config.sdvo_tv_clock) | 7362 | } else if (intel_crtc->new_config->sdvo_tv_clock) |
| 7204 | factor = 20; | 7363 | factor = 20; |
| 7205 | 7364 | ||
| 7206 | if (ironlake_needs_fb_cb_tune(&intel_crtc->config.dpll, factor)) | 7365 | if (ironlake_needs_fb_cb_tune(&intel_crtc->new_config->dpll, factor)) |
| 7207 | *fp |= FP_CB_TUNE; | 7366 | *fp |= FP_CB_TUNE; |
| 7208 | 7367 | ||
| 7209 | if (fp2 && (reduced_clock->m < factor * reduced_clock->n)) | 7368 | if (fp2 && (reduced_clock->m < factor * reduced_clock->n)) |
| @@ -7216,20 +7375,20 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, · 6 unmodified lines | |||
| 7216 | else | 7375 | else |
| 7217 | dpll |= DPLLB_MODE_DAC_SERIAL; | 7376 | dpll |= DPLLB_MODE_DAC_SERIAL; |
| 7218 | 7377 | ||
| 7219 | dpll |= (intel_crtc->config.pixel_multiplier - 1) | 7378 | dpll |= (intel_crtc->new_config->pixel_multiplier - 1) |
| 7220 | << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; | 7379 | << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; |
| 7221 | 7380 | ||
| 7222 | if (is_sdvo) | 7381 | if (is_sdvo) |
| 7223 | dpll |= DPLL_SDVO_HIGH_SPEED; | 7382 | dpll |= DPLL_SDVO_HIGH_SPEED; |
| 7224 | if (intel_crtc->config.has_dp_encoder) | 7383 | if (intel_crtc->new_config->has_dp_encoder) |
| 7225 | dpll |= DPLL_SDVO_HIGH_SPEED; | 7384 | dpll |= DPLL_SDVO_HIGH_SPEED; |
| 7226 | 7385 | ||
| 7227 | /* compute bitmask from p1 value */ | 7386 | /* compute bitmask from p1 value */ |
| 7228 | dpll |= (1 << (intel_crtc->config.dpll.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; | 7387 | dpll |= (1 << (intel_crtc->new_config->dpll.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; |
| 7229 | /* also FPA1 */ | 7388 | /* also FPA1 */ |
| 7230 | dpll |= (1 << (intel_crtc->config.dpll.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; | 7389 | dpll |= (1 << (intel_crtc->new_config->dpll.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; |
| 7231 | 7390 | ||
| 7232 | switch (intel_crtc->config.dpll.p2) { | 7391 | switch (intel_crtc->new_config->dpll.p2) { |
| 7233 | case 5: | 7392 | case 5: |
| 7234 | dpll |= DPLL_DAC_SERIAL_P2_CLOCK_DIV_5; | 7393 | dpll |= DPLL_DAC_SERIAL_P2_CLOCK_DIV_5; |
| 7235 | break; | 7394 | break; |
| @@ -7252,9 +7411,7 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, · 16 unmodified lines | |||
| 7252 | return dpll | DPLL_VCO_ENABLE; | 7411 | return dpll | DPLL_VCO_ENABLE; |
| 7253 | } | 7412 | } |
| 7254 | 7413 | ||
| 7255 | static int ironlake_crtc_mode_set(struct intel_crtc *crtc, | 7414 | static int ironlake_crtc_compute_clock(struct intel_crtc *crtc) |
| 7256 | int x, int y, | ||
| 7257 | struct drm_framebuffer *fb) | ||
| 7258 | { | 7415 | { |
| 7259 | struct drm_device *dev = crtc->base.dev; | 7416 | struct drm_device *dev = crtc->base.dev; |
| 7260 | intel_clock_t clock, reduced_clock; | 7417 | intel_clock_t clock, reduced_clock; |
| @@ -7270,22 +7427,22 @@ static int ironlake_crtc_mode_set(struct intel_crtc *crtc, · 9 unmodified lines | |||
| 7270 | 7427 | ||
| 7271 | ok = ironlake_compute_clocks(&crtc->base, &clock, | 7428 | ok = ironlake_compute_clocks(&crtc->base, &clock, |
| 7272 | &has_reduced_clock, &reduced_clock); | 7429 | &has_reduced_clock, &reduced_clock); |
| 7273 | if (!ok && !crtc->config.clock_set) { | 7430 | if (!ok && !crtc->new_config->clock_set) { |
| 7274 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); | 7431 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); |
| 7275 | return -EINVAL; | 7432 | return -EINVAL; |
| 7276 | } | 7433 | } |
| 7277 | /* Compat-code for transition, will disappear. */ | 7434 | /* Compat-code for transition, will disappear. */ |
| 7278 | if (!crtc->config.clock_set) { | 7435 | if (!crtc->new_config->clock_set) { |
| 7279 | crtc->config.dpll.n = clock.n; | 7436 | crtc->new_config->dpll.n = clock.n; |
| 7280 | crtc->config.dpll.m1 = clock.m1; | 7437 | crtc->new_config->dpll.m1 = clock.m1; |
| 7281 | crtc->config.dpll.m2 = clock.m2; | 7438 | crtc->new_config->dpll.m2 = clock.m2; |
| 7282 | crtc->config.dpll.p1 = clock.p1; | 7439 | crtc->new_config->dpll.p1 = clock.p1; |
| 7283 | crtc->config.dpll.p2 = clock.p2; | 7440 | crtc->new_config->dpll.p2 = clock.p2; |
| 7284 | } | 7441 | } |
| 7285 | 7442 | ||
| 7286 | /* CPU eDP is the only output that doesn't need a PCH PLL of its own. */ | 7443 | /* CPU eDP is the only output that doesn't need a PCH PLL of its own. */ |
| 7287 | if (crtc->config.has_pch_encoder) { | 7444 | if (crtc->new_config->has_pch_encoder) { |
| 7288 | fp = i9xx_dpll_compute_fp(&crtc->config.dpll); | 7445 | fp = i9xx_dpll_compute_fp(&crtc->new_config->dpll); |
| 7289 | if (has_reduced_clock) | 7446 | if (has_reduced_clock) |
| 7290 | fp2 = i9xx_dpll_compute_fp(&reduced_clock); | 7447 | fp2 = i9xx_dpll_compute_fp(&reduced_clock); |
| 7291 | 7448 | ||
| @@ -7293,12 +7450,12 @@ static int ironlake_crtc_mode_set(struct intel_crtc *crtc, · 1 unmodified line | |||
| 7293 | &fp, &reduced_clock, | 7450 | &fp, &reduced_clock, |
| 7294 | has_reduced_clock ? &fp2 : NULL); | 7451 | has_reduced_clock ? &fp2 : NULL); |
| 7295 | 7452 | ||
| 7296 | crtc->config.dpll_hw_state.dpll = dpll; | 7453 | crtc->new_config->dpll_hw_state.dpll = dpll; |
| 7297 | crtc->config.dpll_hw_state.fp0 = fp; | 7454 | crtc->new_config->dpll_hw_state.fp0 = fp; |
| 7298 | if (has_reduced_clock) | 7455 | if (has_reduced_clock) |
| 7299 | crtc->config.dpll_hw_state.fp1 = fp2; | 7456 | crtc->new_config->dpll_hw_state.fp1 = fp2; |
| 7300 | else | 7457 | else |
| 7301 | crtc->config.dpll_hw_state.fp1 = fp; | 7458 | crtc->new_config->dpll_hw_state.fp1 = fp; |
| 7302 | 7459 | ||
| 7303 | pll = intel_get_shared_dpll(crtc); | 7460 | pll = intel_get_shared_dpll(crtc); |
| 7304 | if (pll == NULL) { | 7461 | if (pll == NULL) { |
| @@ -7306,8 +7463,7 @@ static int ironlake_crtc_mode_set(struct intel_crtc *crtc, · 1 unmodified line | |||
| 7306 | pipe_name(crtc->pipe)); | 7463 | pipe_name(crtc->pipe)); |
| 7307 | return -EINVAL; | 7464 | return -EINVAL; |
| 7308 | } | 7465 | } |
| 7309 | } else | 7466 | } |
| 7310 | intel_put_shared_dpll(crtc); | ||
| 7311 | 7467 | ||
| 7312 | if (is_lvds && has_reduced_clock && i915.powersave) | 7468 | if (is_lvds && has_reduced_clock && i915.powersave) |
| 7313 | crtc->lowfreq_avail = true; | 7469 | crtc->lowfreq_avail = true; |
| @@ -7796,19 +7952,7 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv) · 482 unmodified lines | |||
| 7796 | intel_prepare_ddi(dev); | 7952 | intel_prepare_ddi(dev); |
| 7797 | } | 7953 | } |
| 7798 | 7954 | ||
| 7799 | static void snb_modeset_global_resources(struct drm_device *dev) | 7955 | static int haswell_crtc_compute_clock(struct intel_crtc *crtc) |
| 7800 | { | ||
| 7801 | modeset_update_crtc_power_domains(dev); | ||
| 7802 | } | ||
| 7803 | |||
| 7804 | static void haswell_modeset_global_resources(struct drm_device *dev) | ||
| 7805 | { | ||
| 7806 | modeset_update_crtc_power_domains(dev); | ||
| 7807 | } | ||
| 7808 | |||
| 7809 | static int haswell_crtc_mode_set(struct intel_crtc *crtc, | ||
| 7810 | int x, int y, | ||
| 7811 | struct drm_framebuffer *fb) | ||
| 7812 | { | 7956 | { |
| 7813 | if (!intel_ddi_pll_select(crtc)) | 7957 | if (!intel_ddi_pll_select(crtc)) |
| 7814 | return -EINVAL; | 7958 | return -EINVAL; |
| @@ -7940,316 +8084,6 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, · 125 unmodified lines | |||
| 7940 | return true; | 8084 | return true; |
| 7941 | } | 8085 | } |
| 7942 | 8086 | ||
| 7943 | static struct { | ||
| 7944 | int clock; | ||
| 7945 | u32 config; | ||
| 7946 | } hdmi_audio_clock[] = { | ||
| 7947 | { DIV_ROUND_UP(25200 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 }, | ||
| 7948 | { 25200, AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 }, /* default per bspec */ | ||
| 7949 | { 27000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 }, | ||
| 7950 | { 27000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 }, | ||
| 7951 | { 54000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 }, | ||
| 7952 | { 54000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 }, | ||
| 7953 | { DIV_ROUND_UP(74250 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 }, | ||
| 7954 | { 74250, AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 }, | ||
| 7955 | { DIV_ROUND_UP(148500 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 }, | ||
| 7956 | { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 }, | ||
| 7957 | }; | ||
| 7958 | |||
| 7959 | /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ | ||
| 7960 | static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode) | ||
| 7961 | { | ||
| 7962 | int i; | ||
| 7963 | |||
| 7964 | for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) { | ||
| 7965 | if (mode->clock == hdmi_audio_clock[i].clock) | ||
| 7966 | break; | ||
| 7967 | } | ||
| 7968 | |||
| 7969 | if (i == ARRAY_SIZE(hdmi_audio_clock)) { | ||
| 7970 | DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock); | ||
| 7971 | i = 1; | ||
| 7972 | } | ||
| 7973 | |||
| 7974 | DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d (0x%08x)\n", | ||
| 7975 | hdmi_audio_clock[i].clock, | ||
| 7976 | hdmi_audio_clock[i].config); | ||
| 7977 | |||
| 7978 | return hdmi_audio_clock[i].config; | ||
| 7979 | } | ||
| 7980 | |||
| 7981 | static bool intel_eld_uptodate(struct drm_connector *connector, | ||
| 7982 | int reg_eldv, uint32_t bits_eldv, | ||
| 7983 | int reg_elda, uint32_t bits_elda, | ||
| 7984 | int reg_edid) | ||
| 7985 | { | ||
| 7986 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 7987 | uint8_t *eld = connector->eld; | ||
| 7988 | uint32_t i; | ||
| 7989 | |||
| 7990 | i = I915_READ(reg_eldv); | ||
| 7991 | i &= bits_eldv; | ||
| 7992 | |||
| 7993 | if (!eld[0]) | ||
| 7994 | return !i; | ||
| 7995 | |||
| 7996 | if (!i) | ||
| 7997 | return false; | ||
| 7998 | |||
| 7999 | i = I915_READ(reg_elda); | ||
| 8000 | i &= ~bits_elda; | ||
| 8001 | I915_WRITE(reg_elda, i); | ||
| 8002 | |||
| 8003 | for (i = 0; i < eld[2]; i++) | ||
| 8004 | if (I915_READ(reg_edid) != *((uint32_t *)eld + i)) | ||
| 8005 | return false; | ||
| 8006 | |||
| 8007 | return true; | ||
| 8008 | } | ||
| 8009 | |||
| 8010 | static void g4x_write_eld(struct drm_connector *connector, | ||
| 8011 | struct drm_crtc *crtc, | ||
| 8012 | struct drm_display_mode *mode) | ||
| 8013 | { | ||
| 8014 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 8015 | uint8_t *eld = connector->eld; | ||
| 8016 | uint32_t eldv; | ||
| 8017 | uint32_t len; | ||
| 8018 | uint32_t i; | ||
| 8019 | |||
| 8020 | i = I915_READ(G4X_AUD_VID_DID); | ||
| 8021 | |||
| 8022 | if (i == INTEL_AUDIO_DEVBLC || i == INTEL_AUDIO_DEVCL) | ||
| 8023 | eldv = G4X_ELDV_DEVCL_DEVBLC; | ||
| 8024 | else | ||
| 8025 | eldv = G4X_ELDV_DEVCTG; | ||
| 8026 | |||
| 8027 | if (intel_eld_uptodate(connector, | ||
| 8028 | G4X_AUD_CNTL_ST, eldv, | ||
| 8029 | G4X_AUD_CNTL_ST, G4X_ELD_ADDR, | ||
| 8030 | G4X_HDMIW_HDMIEDID)) | ||
| 8031 | return; | ||
| 8032 | |||
| 8033 | i = I915_READ(G4X_AUD_CNTL_ST); | ||
| 8034 | i &= ~(eldv | G4X_ELD_ADDR); | ||
| 8035 | len = (i >> 9) & 0x1f; /* ELD buffer size */ | ||
| 8036 | I915_WRITE(G4X_AUD_CNTL_ST, i); | ||
| 8037 | |||
| 8038 | if (!eld[0]) | ||
| 8039 | return; | ||
| 8040 | |||
| 8041 | len = min_t(uint8_t, eld[2], len); | ||
| 8042 | DRM_DEBUG_DRIVER("ELD size %d\n", len); | ||
| 8043 | for (i = 0; i < len; i++) | ||
| 8044 | I915_WRITE(G4X_HDMIW_HDMIEDID, *((uint32_t *)eld + i)); | ||
| 8045 | |||
| 8046 | i = I915_READ(G4X_AUD_CNTL_ST); | ||
| 8047 | i |= eldv; | ||
| 8048 | I915_WRITE(G4X_AUD_CNTL_ST, i); | ||
| 8049 | } | ||
| 8050 | |||
| 8051 | static void haswell_write_eld(struct drm_connector *connector, | ||
| 8052 | struct drm_crtc *crtc, | ||
| 8053 | struct drm_display_mode *mode) | ||
| 8054 | { | ||
| 8055 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 8056 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 8057 | uint8_t *eld = connector->eld; | ||
| 8058 | uint32_t eldv; | ||
| 8059 | uint32_t i; | ||
| 8060 | int len; | ||
| 8061 | int pipe = to_intel_crtc(crtc)->pipe; | ||
| 8062 | int tmp; | ||
| 8063 | |||
| 8064 | int hdmiw_hdmiedid = HSW_AUD_EDID_DATA(pipe); | ||
| 8065 | int aud_cntl_st = HSW_AUD_DIP_ELD_CTRL(pipe); | ||
| 8066 | int aud_config = HSW_AUD_CFG(pipe); | ||
| 8067 | int aud_cntrl_st2 = HSW_AUD_PIN_ELD_CP_VLD; | ||
| 8068 | |||
| 8069 | /* Audio output enable */ | ||
| 8070 | DRM_DEBUG_DRIVER("HDMI audio: enable codec\n"); | ||
| 8071 | tmp = I915_READ(aud_cntrl_st2); | ||
| 8072 | tmp |= (AUDIO_OUTPUT_ENABLE_A << (pipe * 4)); | ||
| 8073 | I915_WRITE(aud_cntrl_st2, tmp); | ||
| 8074 | POSTING_READ(aud_cntrl_st2); | ||
| 8075 | |||
| 8076 | assert_pipe_disabled(dev_priv, to_intel_crtc(crtc)->pipe); | ||
| 8077 | |||
| 8078 | /* Set ELD valid state */ | ||
| 8079 | tmp = I915_READ(aud_cntrl_st2); | ||
| 8080 | DRM_DEBUG_DRIVER("HDMI audio: pin eld vld status=0x%08x\n", tmp); | ||
| 8081 | tmp |= (AUDIO_ELD_VALID_A << (pipe * 4)); | ||
| 8082 | I915_WRITE(aud_cntrl_st2, tmp); | ||
| 8083 | tmp = I915_READ(aud_cntrl_st2); | ||
| 8084 | DRM_DEBUG_DRIVER("HDMI audio: eld vld status=0x%08x\n", tmp); | ||
| 8085 | |||
| 8086 | /* Enable HDMI mode */ | ||
| 8087 | tmp = I915_READ(aud_config); | ||
| 8088 | DRM_DEBUG_DRIVER("HDMI audio: audio conf: 0x%08x\n", tmp); | ||
| 8089 | /* clear N_programing_enable and N_value_index */ | ||
| 8090 | tmp &= ~(AUD_CONFIG_N_VALUE_INDEX | AUD_CONFIG_N_PROG_ENABLE); | ||
| 8091 | I915_WRITE(aud_config, tmp); | ||
| 8092 | |||
| 8093 | DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe)); | ||
| 8094 | |||
| 8095 | eldv = AUDIO_ELD_VALID_A << (pipe * 4); | ||
| 8096 | |||
| 8097 | if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) { | ||
| 8098 | DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n"); | ||
| 8099 | eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */ | ||
| 8100 | I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */ | ||
| 8101 | } else { | ||
| 8102 | I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode)); | ||
| 8103 | } | ||
| 8104 | |||
| 8105 | if (intel_eld_uptodate(connector, | ||
| 8106 | aud_cntrl_st2, eldv, | ||
| 8107 | aud_cntl_st, IBX_ELD_ADDRESS, | ||
| 8108 | hdmiw_hdmiedid)) | ||
| 8109 | return; | ||
| 8110 | |||
| 8111 | i = I915_READ(aud_cntrl_st2); | ||
| 8112 | i &= ~eldv; | ||
| 8113 | I915_WRITE(aud_cntrl_st2, i); | ||
| 8114 | |||
| 8115 | if (!eld[0]) | ||
| 8116 | return; | ||
| 8117 | |||
| 8118 | i = I915_READ(aud_cntl_st); | ||
| 8119 | i &= ~IBX_ELD_ADDRESS; | ||
| 8120 | I915_WRITE(aud_cntl_st, i); | ||
| 8121 | i = (i >> 29) & DIP_PORT_SEL_MASK; /* DIP_Port_Select, 0x1 = PortB */ | ||
| 8122 | DRM_DEBUG_DRIVER("port num:%d\n", i); | ||
| 8123 | |||
| 8124 | len = min_t(uint8_t, eld[2], 21); /* 84 bytes of hw ELD buffer */ | ||
| 8125 | DRM_DEBUG_DRIVER("ELD size %d\n", len); | ||
| 8126 | for (i = 0; i < len; i++) | ||
| 8127 | I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i)); | ||
| 8128 | |||
| 8129 | i = I915_READ(aud_cntrl_st2); | ||
| 8130 | i |= eldv; | ||
| 8131 | I915_WRITE(aud_cntrl_st2, i); | ||
| 8132 | |||
| 8133 | } | ||
| 8134 | |||
| 8135 | static void ironlake_write_eld(struct drm_connector *connector, | ||
| 8136 | struct drm_crtc *crtc, | ||
| 8137 | struct drm_display_mode *mode) | ||
| 8138 | { | ||
| 8139 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
| 8140 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 8141 | uint8_t *eld = connector->eld; | ||
| 8142 | uint32_t eldv; | ||
| 8143 | uint32_t i; | ||
| 8144 | int len; | ||
| 8145 | int hdmiw_hdmiedid; | ||
| 8146 | int aud_config; | ||
| 8147 | int aud_cntl_st; | ||
| 8148 | int aud_cntrl_st2; | ||
| 8149 | int pipe = to_intel_crtc(crtc)->pipe; | ||
| 8150 | |||
| 8151 | if (HAS_PCH_IBX(connector->dev)) { | ||
| 8152 | hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID(pipe); | ||
| 8153 | aud_config = IBX_AUD_CFG(pipe); | ||
| 8154 | aud_cntl_st = IBX_AUD_CNTL_ST(pipe); | ||
| 8155 | aud_cntrl_st2 = IBX_AUD_CNTL_ST2; | ||
| 8156 | } else if (IS_VALLEYVIEW(connector->dev)) { | ||
| 8157 | hdmiw_hdmiedid = VLV_HDMIW_HDMIEDID(pipe); | ||
| 8158 | aud_config = VLV_AUD_CFG(pipe); | ||
| 8159 | aud_cntl_st = VLV_AUD_CNTL_ST(pipe); | ||
| 8160 | aud_cntrl_st2 = VLV_AUD_CNTL_ST2; | ||
| 8161 | } else { | ||
| 8162 | hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID(pipe); | ||
| 8163 | aud_config = CPT_AUD_CFG(pipe); | ||
| 8164 | aud_cntl_st = CPT_AUD_CNTL_ST(pipe); | ||
| 8165 | aud_cntrl_st2 = CPT_AUD_CNTRL_ST2; | ||
| 8166 | } | ||
| 8167 | |||
| 8168 | DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe)); | ||
| 8169 | |||
| 8170 | if (IS_VALLEYVIEW(connector->dev)) { | ||
| 8171 | struct intel_encoder *intel_encoder; | ||
| 8172 | struct intel_digital_port *intel_dig_port; | ||
| 8173 | |||
| 8174 | intel_encoder = intel_attached_encoder(connector); | ||
| 8175 | intel_dig_port = enc_to_dig_port(&intel_encoder->base); | ||
| 8176 | i = intel_dig_port->port; | ||
| 8177 | } else { | ||
| 8178 | i = I915_READ(aud_cntl_st); | ||
| 8179 | i = (i >> 29) & DIP_PORT_SEL_MASK; | ||
| 8180 | /* DIP_Port_Select, 0x1 = PortB */ | ||
| 8181 | } | ||
| 8182 | |||
| 8183 | if (!i) { | ||
| 8184 | DRM_DEBUG_DRIVER("Audio directed to unknown port\n"); | ||
| 8185 | /* operate blindly on all ports */ | ||
| 8186 | eldv = IBX_ELD_VALIDB; | ||
| 8187 | eldv |= IBX_ELD_VALIDB << 4; | ||
| 8188 | eldv |= IBX_ELD_VALIDB << 8; | ||
| 8189 | } else { | ||
| 8190 | DRM_DEBUG_DRIVER("ELD on port %c\n", port_name(i)); | ||
| 8191 | eldv = IBX_ELD_VALIDB << ((i - 1) * 4); | ||
| 8192 | } | ||
| 8193 | |||
| 8194 | if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) { | ||
| 8195 | DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n"); | ||
| 8196 | eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */ | ||
| 8197 | I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */ | ||
| 8198 | } else { | ||
| 8199 | I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode)); | ||
| 8200 | } | ||
| 8201 | |||
| 8202 | if (intel_eld_uptodate(connector, | ||
| 8203 | aud_cntrl_st2, eldv, | ||
| 8204 | aud_cntl_st, IBX_ELD_ADDRESS, | ||
| 8205 | hdmiw_hdmiedid)) | ||
| 8206 | return; | ||
| 8207 | |||
| 8208 | i = I915_READ(aud_cntrl_st2); | ||
| 8209 | i &= ~eldv; | ||
| 8210 | I915_WRITE(aud_cntrl_st2, i); | ||
| 8211 | |||
| 8212 | if (!eld[0]) | ||
| 8213 | return; | ||
| 8214 | |||
| 8215 | i = I915_READ(aud_cntl_st); | ||
| 8216 | i &= ~IBX_ELD_ADDRESS; | ||
| 8217 | I915_WRITE(aud_cntl_st, i); | ||
| 8218 | |||
| 8219 | len = min_t(uint8_t, eld[2], 21); /* 84 bytes of hw ELD buffer */ | ||
| 8220 | DRM_DEBUG_DRIVER("ELD size %d\n", len); | ||
| 8221 | for (i = 0; i < len; i++) | ||
| 8222 | I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i)); | ||
| 8223 | |||
| 8224 | i = I915_READ(aud_cntrl_st2); | ||
| 8225 | i |= eldv; | ||
| 8226 | I915_WRITE(aud_cntrl_st2, i); | ||
| 8227 | } | ||
| 8228 | |||
| 8229 | void intel_write_eld(struct drm_encoder *encoder, | ||
| 8230 | struct drm_display_mode *mode) | ||
| 8231 | { | ||
| 8232 | struct drm_crtc *crtc = encoder->crtc; | ||
| 8233 | struct drm_connector *connector; | ||
| 8234 | struct drm_device *dev = encoder->dev; | ||
| 8235 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 8236 | |||
| 8237 | connector = drm_select_eld(encoder, mode); | ||
| 8238 | if (!connector) | ||
| 8239 | return; | ||
| 8240 | |||
| 8241 | DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", | ||
| 8242 | connector->base.id, | ||
| 8243 | connector->name, | ||
| 8244 | connector->encoder->base.id, | ||
| 8245 | connector->encoder->name); | ||
| 8246 | |||
| 8247 | connector->eld[6] = drm_av_sync_delay(connector, mode) / 2; | ||
| 8248 | |||
| 8249 | if (dev_priv->display.write_eld) | ||
| 8250 | dev_priv->display.write_eld(connector, crtc, mode); | ||
| 8251 | } | ||
| 8252 | |||
| 8253 | static void i845_update_cursor(struct drm_crtc *crtc, u32 base) | 8087 | static void i845_update_cursor(struct drm_crtc *crtc, u32 base) |
| 8254 | { | 8088 | { |
| 8255 | struct drm_device *dev = crtc->dev; | 8089 | struct drm_device *dev = crtc->dev; |
| @@ -8544,9 +8378,9 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc, · 288 unmodified lines | |||
| 8544 | if (old_width != width) | 8378 | if (old_width != width) |
| 8545 | intel_update_watermarks(crtc); | 8379 | intel_update_watermarks(crtc); |
| 8546 | intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); | 8380 | intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); |
| 8547 | } | ||
| 8548 | 8381 | ||
| 8549 | intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_CURSOR(pipe)); | 8382 | intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_CURSOR(pipe)); |
| 8383 | } | ||
| 8550 | 8384 | ||
| 8551 | return 0; | 8385 | return 0; |
| 8552 | fail_unpin: | 8386 | fail_unpin: |
| @@ -9565,80 +9399,49 @@ static void intel_do_mmio_flip(struct intel_crtc *intel_crtc) · 1012 unmodified lines | |||
| 9565 | struct intel_framebuffer *intel_fb = | 9399 | struct intel_framebuffer *intel_fb = |
| 9566 | to_intel_framebuffer(intel_crtc->base.primary->fb); | 9400 | to_intel_framebuffer(intel_crtc->base.primary->fb); |
| 9567 | struct drm_i915_gem_object *obj = intel_fb->obj; | 9401 | struct drm_i915_gem_object *obj = intel_fb->obj; |
| 9402 | bool atomic_update; | ||
| 9403 | u32 start_vbl_count; | ||
| 9568 | u32 dspcntr; | 9404 | u32 dspcntr; |
| 9569 | u32 reg; | 9405 | u32 reg; |
| 9570 | 9406 | ||
| 9571 | intel_mark_page_flip_active(intel_crtc); | 9407 | intel_mark_page_flip_active(intel_crtc); |
| 9572 | 9408 | ||
| 9409 | atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count); | ||
| 9410 | |||
| 9573 | reg = DSPCNTR(intel_crtc->plane); | 9411 | reg = DSPCNTR(intel_crtc->plane); |
| 9574 | dspcntr = I915_READ(reg); | 9412 | dspcntr = I915_READ(reg); |
| 9575 | 9413 | ||
| 9576 | if (INTEL_INFO(dev)->gen >= 4) { | 9414 | if (obj->tiling_mode != I915_TILING_NONE) |
| 9577 | if (obj->tiling_mode != I915_TILING_NONE) | 9415 | dspcntr |= DISPPLANE_TILED; |
| 9578 | dspcntr |= DISPPLANE_TILED; | 9416 | else |
| 9579 | else | 9417 | dspcntr &= ~DISPPLANE_TILED; |
| 9580 | dspcntr &= ~DISPPLANE_TILED; | 9418 | |
| 9581 | } | ||
| 9582 | I915_WRITE(reg, dspcntr); | 9419 | I915_WRITE(reg, dspcntr); |
| 9583 | 9420 | ||
| 9584 | I915_WRITE(DSPSURF(intel_crtc->plane), | 9421 | I915_WRITE(DSPSURF(intel_crtc->plane), |
| 9585 | intel_crtc->unpin_work->gtt_offset); | 9422 | intel_crtc->unpin_work->gtt_offset); |
| 9586 | POSTING_READ(DSPSURF(intel_crtc->plane)); | 9423 | POSTING_READ(DSPSURF(intel_crtc->plane)); |
| 9587 | } | ||
| 9588 | |||
| 9589 | static int intel_postpone_flip(struct drm_i915_gem_object *obj) | ||
| 9590 | { | ||
| 9591 | struct intel_engine_cs *ring; | ||
| 9592 | int ret; | ||
| 9593 | |||
| 9594 | lockdep_assert_held(&obj->base.dev->struct_mutex); | ||
| 9595 | |||
| 9596 | if (!obj->last_write_seqno) | ||
| 9597 | return 0; | ||
| 9598 | |||
| 9599 | ring = obj->ring; | ||
| 9600 | 9424 | ||
| 9601 | if (i915_seqno_passed(ring->get_seqno(ring, true), | 9425 | if (atomic_update) |
| 9602 | obj->last_write_seqno)) | 9426 | intel_pipe_update_end(intel_crtc, start_vbl_count); |
| 9603 | return 0; | ||
| 9604 | |||
| 9605 | ret = i915_gem_check_olr(ring, obj->last_write_seqno); | ||
| 9606 | if (ret) | ||
| 9607 | return ret; | ||
| 9608 | |||
| 9609 | if (WARN_ON(!ring->irq_get(ring))) | ||
| 9610 | return 0; | ||
| 9611 | |||
| 9612 | return 1; | ||
| 9613 | } | 9427 | } |
| 9614 | 9428 | ||
| 9615 | void intel_notify_mmio_flip(struct intel_engine_cs *ring) | 9429 | static void intel_mmio_flip_work_func(struct work_struct *work) |
| 9616 | { | 9430 | { |
| 9617 | struct drm_i915_private *dev_priv = to_i915(ring->dev); | 9431 | struct intel_crtc *intel_crtc = |
| 9618 | struct intel_crtc *intel_crtc; | 9432 | container_of(work, struct intel_crtc, mmio_flip.work); |
| 9619 | unsigned long irq_flags; | 9433 | struct intel_engine_cs *ring; |
| 9620 | u32 seqno; | 9434 | uint32_t seqno; |
| 9621 | |||
| 9622 | seqno = ring->get_seqno(ring, false); | ||
| 9623 | |||
| 9624 | spin_lock_irqsave(&dev_priv->mmio_flip_lock, irq_flags); | ||
| 9625 | for_each_intel_crtc(ring->dev, intel_crtc) { | ||
| 9626 | struct intel_mmio_flip *mmio_flip; | ||
| 9627 | 9435 | ||
| 9628 | mmio_flip = &intel_crtc->mmio_flip; | 9436 | seqno = intel_crtc->mmio_flip.seqno; |
| 9629 | if (mmio_flip->seqno == 0) | 9437 | ring = intel_crtc->mmio_flip.ring; |
| 9630 | continue; | ||
| 9631 | 9438 | ||
| 9632 | if (ring->id != mmio_flip->ring_id) | 9439 | if (seqno) |
| 9633 | continue; | 9440 | WARN_ON(__i915_wait_seqno(ring, seqno, |
| 9441 | intel_crtc->reset_counter, | ||
| 9442 | false, NULL, NULL) != 0); | ||
| 9634 | 9443 | ||
| 9635 | if (i915_seqno_passed(seqno, mmio_flip->seqno)) { | 9444 | intel_do_mmio_flip(intel_crtc); |
| 9636 | intel_do_mmio_flip(intel_crtc); | ||
| 9637 | mmio_flip->seqno = 0; | ||
| 9638 | ring->irq_put(ring); | ||
| 9639 | } | ||
| 9640 | } | ||
| 9641 | spin_unlock_irqrestore(&dev_priv->mmio_flip_lock, irq_flags); | ||
| 9642 | } | 9445 | } |
| 9643 | 9446 | ||
| 9644 | static int intel_queue_mmio_flip(struct drm_device *dev, | 9447 | static int intel_queue_mmio_flip(struct drm_device *dev, |
| @@ -9648,31 +9451,13 @@ static int intel_queue_mmio_flip(struct drm_device *dev, · 3 unmodified lines | |||
| 9648 | struct intel_engine_cs *ring, | 9451 | struct intel_engine_cs *ring, |
| 9649 | uint32_t flags) | 9452 | uint32_t flags) |
| 9650 | { | 9453 | { |
| 9651 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 9652 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 9454 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 9653 | int ret; | ||
| 9654 | |||
| 9655 | if (WARN_ON(intel_crtc->mmio_flip.seqno)) | ||
| 9656 | return -EBUSY; | ||
| 9657 | |||
| 9658 | ret = intel_postpone_flip(obj); | ||
| 9659 | if (ret < 0) | ||
| 9660 | return ret; | ||
| 9661 | if (ret == 0) { | ||
| 9662 | intel_do_mmio_flip(intel_crtc); | ||
| 9663 | return 0; | ||
| 9664 | } | ||
| 9665 | 9455 | ||
| 9666 | spin_lock_irq(&dev_priv->mmio_flip_lock); | ||
| 9667 | intel_crtc->mmio_flip.seqno = obj->last_write_seqno; | 9456 | intel_crtc->mmio_flip.seqno = obj->last_write_seqno; |
| 9668 | intel_crtc->mmio_flip.ring_id = obj->ring->id; | 9457 | intel_crtc->mmio_flip.ring = obj->ring; |
| 9669 | spin_unlock_irq(&dev_priv->mmio_flip_lock); | 9458 | |
| 9459 | schedule_work(&intel_crtc->mmio_flip.work); | ||
| 9670 | 9460 | ||
| 9671 | /* | ||
| 9672 | * Double check to catch cases where irq fired before | ||
| 9673 | * mmio flip data was ready | ||
| 9674 | */ | ||
| 9675 | intel_notify_mmio_flip(obj->ring); | ||
| 9676 | return 0; | 9461 | return 0; |
| 9677 | } | 9462 | } |
| 9678 | 9463 | ||
| @@ -9855,7 +9640,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 176 unmodified lines | |||
| 9855 | ring = &dev_priv->ring[RCS]; | 9640 | ring = &dev_priv->ring[RCS]; |
| 9856 | } | 9641 | } |
| 9857 | 9642 | ||
| 9858 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); | 9643 | ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, ring); |
| 9859 | if (ret) | 9644 | if (ret) |
| 9860 | goto cleanup_pending; | 9645 | goto cleanup_pending; |
| 9861 | 9646 | ||
| @@ -10397,10 +10182,13 @@ static bool intel_crtc_in_use(struct drm_crtc *crtc) · 535 unmodified lines | |||
| 10397 | static void | 10182 | static void |
| 10398 | intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes) | 10183 | intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes) |
| 10399 | { | 10184 | { |
| 10185 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 10400 | struct intel_encoder *intel_encoder; | 10186 | struct intel_encoder *intel_encoder; |
| 10401 | struct intel_crtc *intel_crtc; | 10187 | struct intel_crtc *intel_crtc; |
| 10402 | struct drm_connector *connector; | 10188 | struct drm_connector *connector; |
| 10403 | 10189 | ||
| 10190 | intel_shared_dpll_commit(dev_priv); | ||
| 10191 | |||
| 10404 | for_each_intel_encoder(dev, intel_encoder) { | 10192 | for_each_intel_encoder(dev, intel_encoder) { |
| 10405 | if (!intel_encoder->base.crtc) | 10193 | if (!intel_encoder->base.crtc) |
| 10406 | continue; | 10194 | continue; |
| @@ -10653,6 +10441,56 @@ intel_pipe_config_compare(struct drm_device *dev, · 246 unmodified lines | |||
| 10653 | return true; | 10441 | return true; |
| 10654 | } | 10442 | } |
| 10655 | 10443 | ||
| 10444 | static void check_wm_state(struct drm_device *dev) | ||
| 10445 | { | ||
| 10446 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 10447 | struct skl_ddb_allocation hw_ddb, *sw_ddb; | ||
| 10448 | struct intel_crtc *intel_crtc; | ||
| 10449 | int plane; | ||
| 10450 | |||
| 10451 | if (INTEL_INFO(dev)->gen < 9) | ||
| 10452 | return; | ||
| 10453 | |||
| 10454 | skl_ddb_get_hw_state(dev_priv, &hw_ddb); | ||
| 10455 | sw_ddb = &dev_priv->wm.skl_hw.ddb; | ||
| 10456 | |||
| 10457 | for_each_intel_crtc(dev, intel_crtc) { | ||
| 10458 | struct skl_ddb_entry *hw_entry, *sw_entry; | ||
| 10459 | const enum pipe pipe = intel_crtc->pipe; | ||
| 10460 | |||
| 10461 | if (!intel_crtc->active) | ||
| 10462 | continue; | ||
| 10463 | |||
| 10464 | /* planes */ | ||
| 10465 | for_each_plane(pipe, plane) { | ||
| 10466 | hw_entry = &hw_ddb.plane[pipe][plane]; | ||
| 10467 | sw_entry = &sw_ddb->plane[pipe][plane]; | ||
| 10468 | |||
| 10469 | if (skl_ddb_entry_equal(hw_entry, sw_entry)) | ||
| 10470 | continue; | ||
| 10471 | |||
| 10472 | DRM_ERROR("mismatch in DDB state pipe %c plane %d " | ||
| 10473 | "(expected (%u,%u), found (%u,%u))\n", | ||
| 10474 | pipe_name(pipe), plane + 1, | ||
| 10475 | sw_entry->start, sw_entry->end, | ||
| 10476 | hw_entry->start, hw_entry->end); | ||
| 10477 | } | ||
| 10478 | |||
| 10479 | /* cursor */ | ||
| 10480 | hw_entry = &hw_ddb.cursor[pipe]; | ||
| 10481 | sw_entry = &sw_ddb->cursor[pipe]; | ||
| 10482 | |||
| 10483 | if (skl_ddb_entry_equal(hw_entry, sw_entry)) | ||
| 10484 | continue; | ||
| 10485 | |||
| 10486 | DRM_ERROR("mismatch in DDB state pipe %c cursor " | ||
| 10487 | "(expected (%u,%u), found (%u,%u))\n", | ||
| 10488 | pipe_name(pipe), | ||
| 10489 | sw_entry->start, sw_entry->end, | ||
| 10490 | hw_entry->start, hw_entry->end); | ||
| 10491 | } | ||
| 10492 | } | ||
| 10493 | |||
| 10656 | static void | 10494 | static void |
| 10657 | check_connector_state(struct drm_device *dev) | 10495 | check_connector_state(struct drm_device *dev) |
| 10658 | { | 10496 | { |
| @@ -10819,9 +10657,9 @@ check_shared_dpll_state(struct drm_device *dev) · 160 unmodified lines | |||
| 10819 | 10657 | ||
| 10820 | active = pll->get_hw_state(dev_priv, pll, &dpll_hw_state); | 10658 | active = pll->get_hw_state(dev_priv, pll, &dpll_hw_state); |
| 10821 | 10659 | ||
| 10822 | WARN(pll->active > pll->refcount, | 10660 | WARN(pll->active > hweight32(pll->config.crtc_mask), |
| 10823 | "more active pll users than references: %i vs %i\n", | 10661 | "more active pll users than references: %i vs %i\n", |
| 10824 | pll->active, pll->refcount); | 10662 | pll->active, hweight32(pll->config.crtc_mask)); |
| 10825 | WARN(pll->active && !pll->on, | 10663 | WARN(pll->active && !pll->on, |
| 10826 | "pll in active use but not on in sw tracking\n"); | 10664 | "pll in active use but not on in sw tracking\n"); |
| 10827 | WARN(pll->on && !pll->active, | 10665 | WARN(pll->on && !pll->active, |
| @@ -10839,11 +10677,11 @@ check_shared_dpll_state(struct drm_device *dev) · 11 unmodified lines | |||
| 10839 | WARN(pll->active != active_crtcs, | 10677 | WARN(pll->active != active_crtcs, |
| 10840 | "pll active crtcs mismatch (expected %i, found %i)\n", | 10678 | "pll active crtcs mismatch (expected %i, found %i)\n", |
| 10841 | pll->active, active_crtcs); | 10679 | pll->active, active_crtcs); |
| 10842 | WARN(pll->refcount != enabled_crtcs, | 10680 | WARN(hweight32(pll->config.crtc_mask) != enabled_crtcs, |
| 10843 | "pll enabled crtcs mismatch (expected %i, found %i)\n", | 10681 | "pll enabled crtcs mismatch (expected %i, found %i)\n", |
| 10844 | pll->refcount, enabled_crtcs); | 10682 | hweight32(pll->config.crtc_mask), enabled_crtcs); |
| 10845 | 10683 | ||
| 10846 | WARN(pll->on && memcmp(&pll->hw_state, &dpll_hw_state, | 10684 | WARN(pll->on && memcmp(&pll->config.hw_state, &dpll_hw_state, |
| 10847 | sizeof(dpll_hw_state)), | 10685 | sizeof(dpll_hw_state)), |
| 10848 | "pll hw state mismatch\n"); | 10686 | "pll hw state mismatch\n"); |
| 10849 | } | 10687 | } |
| @@ -10852,6 +10690,7 @@ check_shared_dpll_state(struct drm_device *dev) · 2 unmodified lines | |||
| 10852 | void | 10690 | void |
| 10853 | intel_modeset_check_state(struct drm_device *dev) | 10691 | intel_modeset_check_state(struct drm_device *dev) |
| 10854 | { | 10692 | { |
| 10693 | check_wm_state(dev); | ||
| 10855 | check_connector_state(dev); | 10694 | check_connector_state(dev); |
| 10856 | check_encoder_state(dev); | 10695 | check_encoder_state(dev); |
| 10857 | check_crtc_state(dev); | 10696 | check_crtc_state(dev); |
| @@ -10961,6 +10800,22 @@ static int __intel_set_mode(struct drm_crtc *crtc, · 103 unmodified lines | |||
| 10961 | prepare_pipes &= ~disable_pipes; | 10800 | prepare_pipes &= ~disable_pipes; |
| 10962 | } | 10801 | } |
| 10963 | 10802 | ||
| 10803 | if (dev_priv->display.crtc_compute_clock) { | ||
| 10804 | unsigned clear_pipes = modeset_pipes | disable_pipes; | ||
| 10805 | |||
| 10806 | ret = intel_shared_dpll_start_config(dev_priv, clear_pipes); | ||
| 10807 | if (ret) | ||
| 10808 | goto done; | ||
| 10809 | |||
| 10810 | for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) { | ||
| 10811 | ret = dev_priv->display.crtc_compute_clock(intel_crtc); | ||
| 10812 | if (ret) { | ||
| 10813 | intel_shared_dpll_abort_config(dev_priv); | ||
| 10814 | goto done; | ||
| 10815 | } | ||
| 10816 | } | ||
| 10817 | } | ||
| 10818 | |||
| 10964 | for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc) | 10819 | for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc) |
| 10965 | intel_crtc_disable(&intel_crtc->base); | 10820 | intel_crtc_disable(&intel_crtc->base); |
| 10966 | 10821 | ||
| @@ -10992,8 +10847,7 @@ static int __intel_set_mode(struct drm_crtc *crtc, · 25 unmodified lines | |||
| 10992 | * update the the output configuration. */ | 10847 | * update the the output configuration. */ |
| 10993 | intel_modeset_update_state(dev, prepare_pipes); | 10848 | intel_modeset_update_state(dev, prepare_pipes); |
| 10994 | 10849 | ||
| 10995 | if (dev_priv->display.modeset_global_resources) | 10850 | modeset_update_crtc_power_domains(dev); |
| 10996 | dev_priv->display.modeset_global_resources(dev); | ||
| 10997 | 10851 | ||
| 10998 | /* Set up the DPLL and any encoders state that needs to adjust or depend | 10852 | /* Set up the DPLL and any encoders state that needs to adjust or depend |
| 10999 | * on the DPLL. | 10853 | * on the DPLL. |
| @@ -11004,9 +10858,7 @@ static int __intel_set_mode(struct drm_crtc *crtc, · 4 unmodified lines | |||
| 11004 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | 10858 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); |
| 11005 | 10859 | ||
| 11006 | mutex_lock(&dev->struct_mutex); | 10860 | mutex_lock(&dev->struct_mutex); |
| 11007 | ret = intel_pin_and_fence_fb_obj(dev, | 10861 | ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, NULL); |
| 11008 | obj, | ||
| 11009 | NULL); | ||
| 11010 | if (ret != 0) { | 10862 | if (ret != 0) { |
| 11011 | DRM_ERROR("pin & fence failed\n"); | 10863 | DRM_ERROR("pin & fence failed\n"); |
| 11012 | mutex_unlock(&dev->struct_mutex); | 10864 | mutex_unlock(&dev->struct_mutex); |
| @@ -11021,10 +10873,6 @@ static int __intel_set_mode(struct drm_crtc *crtc, · 8 unmodified lines | |||
| 11021 | crtc->primary->fb = fb; | 10873 | crtc->primary->fb = fb; |
| 11022 | crtc->x = x; | 10874 | crtc->x = x; |
| 11023 | crtc->y = y; | 10875 | crtc->y = y; |
| 11024 | |||
| 11025 | ret = dev_priv->display.crtc_mode_set(intel_crtc, x, y, fb); | ||
| 11026 | if (ret) | ||
| 11027 | goto done; | ||
| 11028 | } | 10876 | } |
| 11029 | 10877 | ||
| 11030 | /* Now enable the clocks, plane, pipe, and connectors that we set up. */ | 10878 | /* Now enable the clocks, plane, pipe, and connectors that we set up. */ |
| @@ -11518,8 +11366,8 @@ static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv, · 487 unmodified lines | |||
| 11518 | static void ibx_pch_dpll_mode_set(struct drm_i915_private *dev_priv, | 11366 | static void ibx_pch_dpll_mode_set(struct drm_i915_private *dev_priv, |
| 11519 | struct intel_shared_dpll *pll) | 11367 | struct intel_shared_dpll *pll) |
| 11520 | { | 11368 | { |
| 11521 | I915_WRITE(PCH_FP0(pll->id), pll->hw_state.fp0); | 11369 | I915_WRITE(PCH_FP0(pll->id), pll->config.hw_state.fp0); |
| 11522 | I915_WRITE(PCH_FP1(pll->id), pll->hw_state.fp1); | 11370 | I915_WRITE(PCH_FP1(pll->id), pll->config.hw_state.fp1); |
| 11523 | } | 11371 | } |
| 11524 | 11372 | ||
| 11525 | static void ibx_pch_dpll_enable(struct drm_i915_private *dev_priv, | 11373 | static void ibx_pch_dpll_enable(struct drm_i915_private *dev_priv, |
| @@ -11528,7 +11376,7 @@ static void ibx_pch_dpll_enable(struct drm_i915_private *dev_priv, · 2 unmodified lines | |||
| 11528 | /* PCH refclock must be enabled first */ | 11376 | /* PCH refclock must be enabled first */ |
| 11529 | ibx_assert_pch_refclk_enabled(dev_priv); | 11377 | ibx_assert_pch_refclk_enabled(dev_priv); |
| 11530 | 11378 | ||
| 11531 | I915_WRITE(PCH_DPLL(pll->id), pll->hw_state.dpll); | 11379 | I915_WRITE(PCH_DPLL(pll->id), pll->config.hw_state.dpll); |
| 11532 | 11380 | ||
| 11533 | /* Wait for the clocks to stabilize. */ | 11381 | /* Wait for the clocks to stabilize. */ |
| 11534 | POSTING_READ(PCH_DPLL(pll->id)); | 11382 | POSTING_READ(PCH_DPLL(pll->id)); |
| @@ -11539,7 +11387,7 @@ static void ibx_pch_dpll_enable(struct drm_i915_private *dev_priv, · 4 unmodified lines | |||
| 11539 | * | 11387 | * |
| 11540 | * So write it again. | 11388 | * So write it again. |
| 11541 | */ | 11389 | */ |
| 11542 | I915_WRITE(PCH_DPLL(pll->id), pll->hw_state.dpll); | 11390 | I915_WRITE(PCH_DPLL(pll->id), pll->config.hw_state.dpll); |
| 11543 | POSTING_READ(PCH_DPLL(pll->id)); | 11391 | POSTING_READ(PCH_DPLL(pll->id)); |
| 11544 | udelay(200); | 11392 | udelay(200); |
| 11545 | } | 11393 | } |
| @@ -11646,40 +11494,25 @@ intel_check_primary_plane(struct drm_plane *plane, · 100 unmodified lines | |||
| 11646 | struct drm_rect *dest = &state->dst; | 11494 | struct drm_rect *dest = &state->dst; |
| 11647 | struct drm_rect *src = &state->src; | 11495 | struct drm_rect *src = &state->src; |
| 11648 | const struct drm_rect *clip = &state->clip; | 11496 | const struct drm_rect *clip = &state->clip; |
| 11649 | int ret; | ||
| 11650 | |||
| 11651 | ret = drm_plane_helper_check_update(plane, crtc, fb, | ||
| 11652 | src, dest, clip, | ||
| 11653 | DRM_PLANE_HELPER_NO_SCALING, | ||
| 11654 | DRM_PLANE_HELPER_NO_SCALING, | ||
| 11655 | false, true, &state->visible); | ||
| 11656 | if (ret) | ||
| 11657 | return ret; | ||
| 11658 | |||
| 11659 | /* no fb bound */ | ||
| 11660 | if (state->visible && !fb) { | ||
| 11661 | DRM_ERROR("No FB bound\n"); | ||
| 11662 | return -EINVAL; | ||
| 11663 | } | ||
| 11664 | 11497 | ||
| 11665 | return 0; | 11498 | return drm_plane_helper_check_update(plane, crtc, fb, |
| 11499 | src, dest, clip, | ||
| 11500 | DRM_PLANE_HELPER_NO_SCALING, | ||
| 11501 | DRM_PLANE_HELPER_NO_SCALING, | ||
| 11502 | false, true, &state->visible); | ||
| 11666 | } | 11503 | } |
| 11667 | 11504 | ||
| 11668 | static int | 11505 | static int |
| 11669 | intel_commit_primary_plane(struct drm_plane *plane, | 11506 | intel_prepare_primary_plane(struct drm_plane *plane, |
| 11670 | struct intel_plane_state *state) | 11507 | struct intel_plane_state *state) |
| 11671 | { | 11508 | { |
| 11672 | struct drm_crtc *crtc = state->crtc; | 11509 | struct drm_crtc *crtc = state->crtc; |
| 11673 | struct drm_framebuffer *fb = state->fb; | 11510 | struct drm_framebuffer *fb = state->fb; |
| 11674 | struct drm_device *dev = crtc->dev; | 11511 | struct drm_device *dev = crtc->dev; |
| 11675 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 11676 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 11512 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 11677 | enum pipe pipe = intel_crtc->pipe; | 11513 | enum pipe pipe = intel_crtc->pipe; |
| 11678 | struct drm_framebuffer *old_fb = plane->fb; | ||
| 11679 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | 11514 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); |
| 11680 | struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); | 11515 | struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); |
| 11681 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 11682 | struct drm_rect *src = &state->src; | ||
| 11683 | int ret; | 11516 | int ret; |
| 11684 | 11517 | ||
| 11685 | intel_crtc_wait_for_pending_flips(crtc); | 11518 | intel_crtc_wait_for_pending_flips(crtc); |
| @@ -11689,9 +11522,9 @@ intel_commit_primary_plane(struct drm_plane *plane, · 3 unmodified lines | |||
| 11689 | return -EBUSY; | 11522 | return -EBUSY; |
| 11690 | } | 11523 | } |
| 11691 | 11524 | ||
| 11692 | if (plane->fb != fb) { | 11525 | if (old_obj != obj) { |
| 11693 | mutex_lock(&dev->struct_mutex); | 11526 | mutex_lock(&dev->struct_mutex); |
| 11694 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); | 11527 | ret = intel_pin_and_fence_fb_obj(plane, fb, NULL); |
| 11695 | if (ret == 0) | 11528 | if (ret == 0) |
| 11696 | i915_gem_track_fb(old_obj, obj, | 11529 | i915_gem_track_fb(old_obj, obj, |
| 11697 | INTEL_FRONTBUFFER_PRIMARY(pipe)); | 11530 | INTEL_FRONTBUFFER_PRIMARY(pipe)); |
| @@ -11702,6 +11535,25 @@ intel_commit_primary_plane(struct drm_plane *plane, · 4 unmodified lines | |||
| 11702 | } | 11535 | } |
| 11703 | } | 11536 | } |
| 11704 | 11537 | ||
| 11538 | return 0; | ||
| 11539 | } | ||
| 11540 | |||
| 11541 | static void | ||
| 11542 | intel_commit_primary_plane(struct drm_plane *plane, | ||
| 11543 | struct intel_plane_state *state) | ||
| 11544 | { | ||
| 11545 | struct drm_crtc *crtc = state->crtc; | ||
| 11546 | struct drm_framebuffer *fb = state->fb; | ||
| 11547 | struct drm_device *dev = crtc->dev; | ||
| 11548 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 11549 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 11550 | enum pipe pipe = intel_crtc->pipe; | ||
| 11551 | struct drm_framebuffer *old_fb = plane->fb; | ||
| 11552 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | ||
| 11553 | struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); | ||
| 11554 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 11555 | struct drm_rect *src = &state->src; | ||
| 11556 | |||
| 11705 | crtc->primary->fb = fb; | 11557 | crtc->primary->fb = fb; |
| 11706 | crtc->x = src->x1; | 11558 | crtc->x = src->x1; |
| 11707 | crtc->y = src->y1; | 11559 | crtc->y = src->y1; |
| @@ -11778,8 +11630,6 @@ intel_commit_primary_plane(struct drm_plane *plane, · 70 unmodified lines | |||
| 11778 | intel_unpin_fb_obj(old_obj); | 11630 | intel_unpin_fb_obj(old_obj); |
| 11779 | mutex_unlock(&dev->struct_mutex); | 11631 | mutex_unlock(&dev->struct_mutex); |
| 11780 | } | 11632 | } |
| 11781 | |||
| 11782 | return 0; | ||
| 11783 | } | 11633 | } |
| 11784 | 11634 | ||
| 11785 | static int | 11635 | static int |
| @@ -11820,6 +11670,10 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc, · 34 unmodified lines | |||
| 11820 | if (ret) | 11670 | if (ret) |
| 11821 | return ret; | 11671 | return ret; |
| 11822 | 11672 | ||
| 11673 | ret = intel_prepare_primary_plane(plane, &state); | ||
| 11674 | if (ret) | ||
| 11675 | return ret; | ||
| 11676 | |||
| 11823 | intel_commit_primary_plane(plane, &state); | 11677 | intel_commit_primary_plane(plane, &state); |
| 11824 | 11678 | ||
| 11825 | return 0; | 11679 | return 0; |
| @@ -11961,12 +11815,24 @@ intel_commit_cursor_plane(struct drm_plane *plane, · 135 unmodified lines | |||
| 11961 | struct drm_crtc *crtc = state->crtc; | 11815 | struct drm_crtc *crtc = state->crtc; |
| 11962 | struct drm_framebuffer *fb = state->fb; | 11816 | struct drm_framebuffer *fb = state->fb; |
| 11963 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 11817 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 11818 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 11964 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); | 11819 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); |
| 11965 | struct drm_i915_gem_object *obj = intel_fb->obj; | 11820 | struct drm_i915_gem_object *obj = intel_fb->obj; |
| 11966 | int crtc_w, crtc_h; | 11821 | int crtc_w, crtc_h; |
| 11967 | 11822 | ||
| 11968 | crtc->cursor_x = state->orig_dst.x1; | 11823 | crtc->cursor_x = state->orig_dst.x1; |
| 11969 | crtc->cursor_y = state->orig_dst.y1; | 11824 | crtc->cursor_y = state->orig_dst.y1; |
| 11825 | |||
| 11826 | intel_plane->crtc_x = state->orig_dst.x1; | ||
| 11827 | intel_plane->crtc_y = state->orig_dst.y1; | ||
| 11828 | intel_plane->crtc_w = drm_rect_width(&state->orig_dst); | ||
| 11829 | intel_plane->crtc_h = drm_rect_height(&state->orig_dst); | ||
| 11830 | intel_plane->src_x = state->orig_src.x1; | ||
| 11831 | intel_plane->src_y = state->orig_src.y1; | ||
| 11832 | intel_plane->src_w = drm_rect_width(&state->orig_src); | ||
| 11833 | intel_plane->src_h = drm_rect_height(&state->orig_src); | ||
| 11834 | intel_plane->obj = obj; | ||
| 11835 | |||
| 11970 | if (fb != crtc->cursor->fb) { | 11836 | if (fb != crtc->cursor->fb) { |
| 11971 | crtc_w = drm_rect_width(&state->orig_dst); | 11837 | crtc_w = drm_rect_width(&state->orig_dst); |
| 11972 | crtc_h = drm_rect_height(&state->orig_dst); | 11838 | crtc_h = drm_rect_height(&state->orig_dst); |
| @@ -12117,6 +11983,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) · 144 unmodified lines | |||
| 12117 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; | 11983 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; |
| 12118 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; | 11984 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; |
| 12119 | 11985 | ||
| 11986 | INIT_WORK(&intel_crtc->mmio_flip.work, intel_mmio_flip_work_func); | ||
| 11987 | |||
| 12120 | drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs); | 11988 | drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs); |
| 12121 | 11989 | ||
| 12122 | WARN_ON(drm_crtc_index(&intel_crtc->base) != intel_crtc->pipe); | 11990 | WARN_ON(drm_crtc_index(&intel_crtc->base) != intel_crtc->pipe); |
| @@ -12576,7 +12444,8 @@ static void intel_init_display(struct drm_device *dev) · 453 unmodified lines | |||
| 12576 | if (HAS_DDI(dev)) { | 12444 | if (HAS_DDI(dev)) { |
| 12577 | dev_priv->display.get_pipe_config = haswell_get_pipe_config; | 12445 | dev_priv->display.get_pipe_config = haswell_get_pipe_config; |
| 12578 | dev_priv->display.get_plane_config = ironlake_get_plane_config; | 12446 | dev_priv->display.get_plane_config = ironlake_get_plane_config; |
| 12579 | dev_priv->display.crtc_mode_set = haswell_crtc_mode_set; | 12447 | dev_priv->display.crtc_compute_clock = |
| 12448 | haswell_crtc_compute_clock; | ||
| 12580 | dev_priv->display.crtc_enable = haswell_crtc_enable; | 12449 | dev_priv->display.crtc_enable = haswell_crtc_enable; |
| 12581 | dev_priv->display.crtc_disable = haswell_crtc_disable; | 12450 | dev_priv->display.crtc_disable = haswell_crtc_disable; |
| 12582 | dev_priv->display.off = ironlake_crtc_off; | 12451 | dev_priv->display.off = ironlake_crtc_off; |
| @@ -12589,7 +12458,8 @@ static void intel_init_display(struct drm_device *dev) · 6 unmodified lines | |||
| 12589 | } else if (HAS_PCH_SPLIT(dev)) { | 12458 | } else if (HAS_PCH_SPLIT(dev)) { |
| 12590 | dev_priv->display.get_pipe_config = ironlake_get_pipe_config; | 12459 | dev_priv->display.get_pipe_config = ironlake_get_pipe_config; |
| 12591 | dev_priv->display.get_plane_config = ironlake_get_plane_config; | 12460 | dev_priv->display.get_plane_config = ironlake_get_plane_config; |
| 12592 | dev_priv->display.crtc_mode_set = ironlake_crtc_mode_set; | 12461 | dev_priv->display.crtc_compute_clock = |
| 12462 | ironlake_crtc_compute_clock; | ||
| 12593 | dev_priv->display.crtc_enable = ironlake_crtc_enable; | 12463 | dev_priv->display.crtc_enable = ironlake_crtc_enable; |
| 12594 | dev_priv->display.crtc_disable = ironlake_crtc_disable; | 12464 | dev_priv->display.crtc_disable = ironlake_crtc_disable; |
| 12595 | dev_priv->display.off = ironlake_crtc_off; | 12465 | dev_priv->display.off = ironlake_crtc_off; |
| @@ -12598,7 +12468,7 @@ static void intel_init_display(struct drm_device *dev) · 2 unmodified lines | |||
| 12598 | } else if (IS_VALLEYVIEW(dev)) { | 12468 | } else if (IS_VALLEYVIEW(dev)) { |
| 12599 | dev_priv->display.get_pipe_config = i9xx_get_pipe_config; | 12469 | dev_priv->display.get_pipe_config = i9xx_get_pipe_config; |
| 12600 | dev_priv->display.get_plane_config = i9xx_get_plane_config; | 12470 | dev_priv->display.get_plane_config = i9xx_get_plane_config; |
| 12601 | dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; | 12471 | dev_priv->display.crtc_compute_clock = i9xx_crtc_compute_clock; |
| 12602 | dev_priv->display.crtc_enable = valleyview_crtc_enable; | 12472 | dev_priv->display.crtc_enable = valleyview_crtc_enable; |
| 12603 | dev_priv->display.crtc_disable = i9xx_crtc_disable; | 12473 | dev_priv->display.crtc_disable = i9xx_crtc_disable; |
| 12604 | dev_priv->display.off = i9xx_crtc_off; | 12474 | dev_priv->display.off = i9xx_crtc_off; |
| @@ -12607,7 +12477,7 @@ static void intel_init_display(struct drm_device *dev) · 2 unmodified lines | |||
| 12607 | } else { | 12477 | } else { |
| 12608 | dev_priv->display.get_pipe_config = i9xx_get_pipe_config; | 12478 | dev_priv->display.get_pipe_config = i9xx_get_pipe_config; |
| 12609 | dev_priv->display.get_plane_config = i9xx_get_plane_config; | 12479 | dev_priv->display.get_plane_config = i9xx_get_plane_config; |
| 12610 | dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; | 12480 | dev_priv->display.crtc_compute_clock = i9xx_crtc_compute_clock; |
| 12611 | dev_priv->display.crtc_enable = i9xx_crtc_enable; | 12481 | dev_priv->display.crtc_enable = i9xx_crtc_enable; |
| 12612 | dev_priv->display.crtc_disable = i9xx_crtc_disable; | 12482 | dev_priv->display.crtc_disable = i9xx_crtc_disable; |
| 12613 | dev_priv->display.off = i9xx_crtc_off; | 12483 | dev_priv->display.off = i9xx_crtc_off; |
| @@ -12644,35 +12514,20 @@ static void intel_init_display(struct drm_device *dev) · 30 unmodified lines | |||
| 12644 | dev_priv->display.get_display_clock_speed = | 12514 | dev_priv->display.get_display_clock_speed = |
| 12645 | i830_get_display_clock_speed; | 12515 | i830_get_display_clock_speed; |
| 12646 | 12516 | ||
| 12647 | if (IS_G4X(dev)) { | 12517 | if (IS_GEN5(dev)) { |
| 12648 | dev_priv->display.write_eld = g4x_write_eld; | ||
| 12649 | } else if (IS_GEN5(dev)) { | ||
| 12650 | dev_priv->display.fdi_link_train = ironlake_fdi_link_train; | 12518 | dev_priv->display.fdi_link_train = ironlake_fdi_link_train; |
| 12651 | dev_priv->display.write_eld = ironlake_write_eld; | ||
| 12652 | } else if (IS_GEN6(dev)) { | 12519 | } else if (IS_GEN6(dev)) { |
| 12653 | dev_priv->display.fdi_link_train = gen6_fdi_link_train; | 12520 | dev_priv->display.fdi_link_train = gen6_fdi_link_train; |
| 12654 | dev_priv->display.write_eld = ironlake_write_eld; | ||
| 12655 | dev_priv->display.modeset_global_resources = | ||
| 12656 | snb_modeset_global_resources; | ||
| 12657 | } else if (IS_IVYBRIDGE(dev)) { | 12521 | } else if (IS_IVYBRIDGE(dev)) { |
| 12658 | /* FIXME: detect B0+ stepping and use auto training */ | 12522 | /* FIXME: detect B0+ stepping and use auto training */ |
| 12659 | dev_priv->display.fdi_link_train = ivb_manual_fdi_link_train; | 12523 | dev_priv->display.fdi_link_train = ivb_manual_fdi_link_train; |
| 12660 | dev_priv->display.write_eld = ironlake_write_eld; | ||
| 12661 | dev_priv->display.modeset_global_resources = | 12524 | dev_priv->display.modeset_global_resources = |
| 12662 | ivb_modeset_global_resources; | 12525 | ivb_modeset_global_resources; |
| 12663 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { | 12526 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { |
| 12664 | dev_priv->display.fdi_link_train = hsw_fdi_link_train; | 12527 | dev_priv->display.fdi_link_train = hsw_fdi_link_train; |
| 12665 | dev_priv->display.write_eld = haswell_write_eld; | ||
| 12666 | dev_priv->display.modeset_global_resources = | ||
| 12667 | haswell_modeset_global_resources; | ||
| 12668 | } else if (IS_VALLEYVIEW(dev)) { | 12528 | } else if (IS_VALLEYVIEW(dev)) { |
| 12669 | dev_priv->display.modeset_global_resources = | 12529 | dev_priv->display.modeset_global_resources = |
| 12670 | valleyview_modeset_global_resources; | 12530 | valleyview_modeset_global_resources; |
| 12671 | dev_priv->display.write_eld = ironlake_write_eld; | ||
| 12672 | } else if (INTEL_INFO(dev)->gen >= 9) { | ||
| 12673 | dev_priv->display.write_eld = haswell_write_eld; | ||
| 12674 | dev_priv->display.modeset_global_resources = | ||
| 12675 | haswell_modeset_global_resources; | ||
| 12676 | } | 12531 | } |
| 12677 | 12532 | ||
| 12678 | /* Default just returns -ENODEV to indicate unsupported */ | 12533 | /* Default just returns -ENODEV to indicate unsupported */ |
| @@ -12928,6 +12783,7 @@ void intel_modeset_init(struct drm_device *dev) · 249 unmodified lines | |||
| 12928 | return; | 12783 | return; |
| 12929 | 12784 | ||
| 12930 | intel_init_display(dev); | 12785 | intel_init_display(dev); |
| 12786 | intel_init_audio(dev); | ||
| 12931 | 12787 | ||
| 12932 | if (IS_GEN2(dev)) { | 12788 | if (IS_GEN2(dev)) { |
| 12933 | dev->mode_config.max_width = 2048; | 12789 | dev->mode_config.max_width = 2048; |
| @@ -13282,18 +13138,21 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) · 348 unmodified lines | |||
| 13282 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { | 13138 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { |
| 13283 | struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; | 13139 | struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; |
| 13284 | 13140 | ||
| 13285 | pll->on = pll->get_hw_state(dev_priv, pll, &pll->hw_state); | 13141 | pll->on = pll->get_hw_state(dev_priv, pll, |
| 13142 | &pll->config.hw_state); | ||
| 13286 | pll->active = 0; | 13143 | pll->active = 0; |
| 13144 | pll->config.crtc_mask = 0; | ||
| 13287 | for_each_intel_crtc(dev, crtc) { | 13145 | for_each_intel_crtc(dev, crtc) { |
| 13288 | if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll) | 13146 | if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll) { |
| 13289 | pll->active++; | 13147 | pll->active++; |
| 13148 | pll->config.crtc_mask |= 1 << crtc->pipe; | ||
| 13149 | } | ||
| 13290 | } | 13150 | } |
| 13291 | pll->refcount = pll->active; | ||
| 13292 | 13151 | ||
| 13293 | DRM_DEBUG_KMS("%s hw state readout: refcount %i, on %i\n", | 13152 | DRM_DEBUG_KMS("%s hw state readout: crtc_mask 0x%08x, on %i\n", |
| 13294 | pll->name, pll->refcount, pll->on); | 13153 | pll->name, pll->config.crtc_mask, pll->on); |
| 13295 | 13154 | ||
| 13296 | if (pll->refcount) | 13155 | if (pll->config.crtc_mask) |
| 13297 | intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS); | 13156 | intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS); |
| 13298 | } | 13157 | } |
| 13299 | 13158 | ||
| @@ -13383,7 +13242,9 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, · 83 unmodified lines | |||
| 13383 | pll->on = false; | 13242 | pll->on = false; |
| 13384 | } | 13243 | } |
| 13385 | 13244 | ||
| 13386 | if (HAS_PCH_SPLIT(dev)) | 13245 | if (IS_GEN9(dev)) |
| 13246 | skl_wm_get_hw_state(dev); | ||
| 13247 | else if (HAS_PCH_SPLIT(dev)) | ||
| 13387 | ilk_wm_get_hw_state(dev); | 13248 | ilk_wm_get_hw_state(dev); |
| 13388 | 13249 | ||
| 13389 | if (force_restore) { | 13250 | if (force_restore) { |
| @@ -13431,7 +13292,9 @@ void intel_modeset_gem_init(struct drm_device *dev) · 41 unmodified lines | |||
| 13431 | if (obj == NULL) | 13292 | if (obj == NULL) |
| 13432 | continue; | 13293 | continue; |
| 13433 | 13294 | ||
| 13434 | if (intel_pin_and_fence_fb_obj(dev, obj, NULL)) { | 13295 | if (intel_pin_and_fence_fb_obj(c->primary, |
| 13296 | c->primary->fb, | ||
| 13297 | NULL)) { | ||
| 13435 | DRM_ERROR("failed to pin boot fb on pipe %d\n", | 13298 | DRM_ERROR("failed to pin boot fb on pipe %d\n", |
| 13436 | to_intel_crtc(c)->pipe); | 13299 | to_intel_crtc(c)->pipe); |
| 13437 | drm_framebuffer_unreference(c->primary->fb); | 13300 | drm_framebuffer_unreference(c->primary->fb); |
| @@ -113,6 +113,9 @@ static struct intel_dp *intel_attached_dp(struct drm_connector *connector) · 112 unmodified lines | |||
| 113 | static void intel_dp_link_down(struct intel_dp *intel_dp); | 113 | static void intel_dp_link_down(struct intel_dp *intel_dp); |
| 114 | static bool edp_panel_vdd_on(struct intel_dp *intel_dp); | 114 | static bool edp_panel_vdd_on(struct intel_dp *intel_dp); |
| 115 | static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync); | 115 | static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync); |
| 116 | static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp); | ||
| 117 | static void vlv_steal_power_sequencer(struct drm_device *dev, | ||
| 118 | enum pipe pipe); | ||
| 116 | 119 | ||
| 117 | int | 120 | int |
| 118 | intel_dp_max_link_bw(struct intel_dp *intel_dp) | 121 | intel_dp_max_link_bw(struct intel_dp *intel_dp) |
| @@ -283,12 +286,10 @@ intel_hrawclk(struct drm_device *dev) · 164 unmodified lines | |||
| 283 | 286 | ||
| 284 | static void | 287 | static void |
| 285 | intel_dp_init_panel_power_sequencer(struct drm_device *dev, | 288 | intel_dp_init_panel_power_sequencer(struct drm_device *dev, |
| 286 | struct intel_dp *intel_dp, | 289 | struct intel_dp *intel_dp); |
| 287 | struct edp_power_seq *out); | ||
| 288 | static void | 290 | static void |
| 289 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | 291 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, |
| 290 | struct intel_dp *intel_dp, | 292 | struct intel_dp *intel_dp); |
| 291 | struct edp_power_seq *out); | ||
| 292 | 293 | ||
| 293 | static void pps_lock(struct intel_dp *intel_dp) | 294 | static void pps_lock(struct intel_dp *intel_dp) |
| 294 | { | 295 | { |
| @@ -322,6 +323,66 @@ static void pps_unlock(struct intel_dp *intel_dp) · 27 unmodified lines | |||
| 322 | intel_display_power_put(dev_priv, power_domain); | 323 | intel_display_power_put(dev_priv, power_domain); |
| 323 | } | 324 | } |
| 324 | 325 | ||
| 326 | static void | ||
| 327 | vlv_power_sequencer_kick(struct intel_dp *intel_dp) | ||
| 328 | { | ||
| 329 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
| 330 | struct drm_device *dev = intel_dig_port->base.base.dev; | ||
| 331 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 332 | enum pipe pipe = intel_dp->pps_pipe; | ||
| 333 | bool pll_enabled; | ||
| 334 | uint32_t DP; | ||
| 335 | |||
| 336 | if (WARN(I915_READ(intel_dp->output_reg) & DP_PORT_EN, | ||
| 337 | "skipping pipe %c power seqeuncer kick due to port %c being active\n", | ||
| 338 | pipe_name(pipe), port_name(intel_dig_port->port))) | ||
| 339 | return; | ||
| 340 | |||
| 341 | DRM_DEBUG_KMS("kicking pipe %c power sequencer for port %c\n", | ||
| 342 | pipe_name(pipe), port_name(intel_dig_port->port)); | ||
| 343 | |||
| 344 | /* Preserve the BIOS-computed detected bit. This is | ||
| 345 | * supposed to be read-only. | ||
| 346 | */ | ||
| 347 | DP = I915_READ(intel_dp->output_reg) & DP_DETECTED; | ||
| 348 | DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; | ||
| 349 | DP |= DP_PORT_WIDTH(1); | ||
| 350 | DP |= DP_LINK_TRAIN_PAT_1; | ||
| 351 | |||
| 352 | if (IS_CHERRYVIEW(dev)) | ||
| 353 | DP |= DP_PIPE_SELECT_CHV(pipe); | ||
| 354 | else if (pipe == PIPE_B) | ||
| 355 | DP |= DP_PIPEB_SELECT; | ||
| 356 | |||
| 357 | pll_enabled = I915_READ(DPLL(pipe)) & DPLL_VCO_ENABLE; | ||
| 358 | |||
| 359 | /* | ||
| 360 | * The DPLL for the pipe must be enabled for this to work. | ||
| 361 | * So enable temporarily it if it's not already enabled. | ||
| 362 | */ | ||
| 363 | if (!pll_enabled) | ||
| 364 | vlv_force_pll_on(dev, pipe, IS_CHERRYVIEW(dev) ? | ||
| 365 | &chv_dpll[0].dpll : &vlv_dpll[0].dpll); | ||
| 366 | |||
| 367 | /* | ||
| 368 | * Similar magic as in intel_dp_enable_port(). | ||
| 369 | * We _must_ do this port enable + disable trick | ||
| 370 | * to make this power seqeuencer lock onto the port. | ||
| 371 | * Otherwise even VDD force bit won't work. | ||
| 372 | */ | ||
| 373 | I915_WRITE(intel_dp->output_reg, DP); | ||
| 374 | POSTING_READ(intel_dp->output_reg); | ||
| 375 | |||
| 376 | I915_WRITE(intel_dp->output_reg, DP | DP_PORT_EN); | ||
| 377 | POSTING_READ(intel_dp->output_reg); | ||
| 378 | |||
| 379 | I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); | ||
| 380 | POSTING_READ(intel_dp->output_reg); | ||
| 381 | |||
| 382 | if (!pll_enabled) | ||
| 383 | vlv_force_pll_off(dev, pipe); | ||
| 384 | } | ||
| 385 | |||
| 325 | static enum pipe | 386 | static enum pipe |
| 326 | vlv_power_sequencer_pipe(struct intel_dp *intel_dp) | 387 | vlv_power_sequencer_pipe(struct intel_dp *intel_dp) |
| 327 | { | 388 | { |
| @@ -330,10 +391,13 @@ vlv_power_sequencer_pipe(struct intel_dp *intel_dp) · 2 unmodified lines | |||
| 330 | struct drm_i915_private *dev_priv = dev->dev_private; | 391 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 331 | struct intel_encoder *encoder; | 392 | struct intel_encoder *encoder; |
| 332 | unsigned int pipes = (1 << PIPE_A) | (1 << PIPE_B); | 393 | unsigned int pipes = (1 << PIPE_A) | (1 << PIPE_B); |
| 333 | struct edp_power_seq power_seq; | 394 | enum pipe pipe; |
| 334 | 395 | ||
| 335 | lockdep_assert_held(&dev_priv->pps_mutex); | 396 | lockdep_assert_held(&dev_priv->pps_mutex); |
| 336 | 397 | ||
| 398 | /* We should never land here with regular DP ports */ | ||
| 399 | WARN_ON(!is_edp(intel_dp)); | ||
| 400 | |||
| 337 | if (intel_dp->pps_pipe != INVALID_PIPE) | 401 | if (intel_dp->pps_pipe != INVALID_PIPE) |
| 338 | return intel_dp->pps_pipe; | 402 | return intel_dp->pps_pipe; |
| 339 | 403 | ||
| @@ -359,18 +423,26 @@ vlv_power_sequencer_pipe(struct intel_dp *intel_dp) · 19 unmodified lines | |||
| 359 | * are two power sequencers and up to two eDP ports. | 423 | * are two power sequencers and up to two eDP ports. |
| 360 | */ | 424 | */ |
| 361 | if (WARN_ON(pipes == 0)) | 425 | if (WARN_ON(pipes == 0)) |
| 362 | return PIPE_A; | 426 | pipe = PIPE_A; |
| 427 | else | ||
| 428 | pipe = ffs(pipes) - 1; | ||
| 363 | 429 | ||
| 364 | intel_dp->pps_pipe = ffs(pipes) - 1; | 430 | vlv_steal_power_sequencer(dev, pipe); |
| 431 | intel_dp->pps_pipe = pipe; | ||
| 365 | 432 | ||
| 366 | DRM_DEBUG_KMS("picked pipe %c power sequencer for port %c\n", | 433 | DRM_DEBUG_KMS("picked pipe %c power sequencer for port %c\n", |
| 367 | pipe_name(intel_dp->pps_pipe), | 434 | pipe_name(intel_dp->pps_pipe), |
| 368 | port_name(intel_dig_port->port)); | 435 | port_name(intel_dig_port->port)); |
| 369 | 436 | ||
| 370 | /* init power sequencer on this pipe and port */ | 437 | /* init power sequencer on this pipe and port */ |
| 371 | intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq); | 438 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
| 372 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, | 439 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); |
| 373 | &power_seq); | 440 | |
| 441 | /* | ||
| 442 | * Even vdd force doesn't work until we've made | ||
| 443 | * the power sequencer lock in on the port. | ||
| 444 | */ | ||
| 445 | vlv_power_sequencer_kick(intel_dp); | ||
| 374 | 446 | ||
| 375 | return intel_dp->pps_pipe; | 447 | return intel_dp->pps_pipe; |
| 376 | } | 448 | } |
| @@ -425,7 +497,6 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp) · 48 unmodified lines | |||
| 425 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 497 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
| 426 | struct drm_device *dev = intel_dig_port->base.base.dev; | 498 | struct drm_device *dev = intel_dig_port->base.base.dev; |
| 427 | struct drm_i915_private *dev_priv = dev->dev_private; | 499 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 428 | struct edp_power_seq power_seq; | ||
| 429 | enum port port = intel_dig_port->port; | 500 | enum port port = intel_dig_port->port; |
| 430 | 501 | ||
| 431 | lockdep_assert_held(&dev_priv->pps_mutex); | 502 | lockdep_assert_held(&dev_priv->pps_mutex); |
| @@ -453,9 +524,8 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp) · 21 unmodified lines | |||
| 453 | DRM_DEBUG_KMS("initial power sequencer for port %c: pipe %c\n", | 524 | DRM_DEBUG_KMS("initial power sequencer for port %c: pipe %c\n", |
| 454 | port_name(port), pipe_name(intel_dp->pps_pipe)); | 525 | port_name(port), pipe_name(intel_dp->pps_pipe)); |
| 455 | 526 | ||
| 456 | intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq); | 527 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
| 457 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, | 528 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); |
| 458 | &power_seq); | ||
| 459 | } | 529 | } |
| 460 | 530 | ||
| 461 | void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv) | 531 | void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv) |
| @@ -550,6 +620,10 @@ static bool edp_have_panel_power(struct intel_dp *intel_dp) · 88 unmodified lines | |||
| 550 | 620 | ||
| 551 | lockdep_assert_held(&dev_priv->pps_mutex); | 621 | lockdep_assert_held(&dev_priv->pps_mutex); |
| 552 | 622 | ||
| 623 | if (IS_VALLEYVIEW(dev) && | ||
| 624 | intel_dp->pps_pipe == INVALID_PIPE) | ||
| 625 | return false; | ||
| 626 | |||
| 553 | return (I915_READ(_pp_stat_reg(intel_dp)) & PP_ON) != 0; | 627 | return (I915_READ(_pp_stat_reg(intel_dp)) & PP_ON) != 0; |
| 554 | } | 628 | } |
| 555 | 629 | ||
| @@ -560,6 +634,10 @@ static bool edp_have_panel_vdd(struct intel_dp *intel_dp) · 4 unmodified lines | |||
| 560 | 634 | ||
| 561 | lockdep_assert_held(&dev_priv->pps_mutex); | 635 | lockdep_assert_held(&dev_priv->pps_mutex); |
| 562 | 636 | ||
| 637 | if (IS_VALLEYVIEW(dev) && | ||
| 638 | intel_dp->pps_pipe == INVALID_PIPE) | ||
| 639 | return false; | ||
| 640 | |||
| 563 | return I915_READ(_pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD; | 641 | return I915_READ(_pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD; |
| 564 | } | 642 | } |
| 565 | 643 | ||
| @@ -1246,12 +1324,8 @@ static void intel_dp_prepare(struct intel_encoder *encoder) · 680 unmodified lines | |||
| 1246 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; | 1324 | intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; |
| 1247 | intel_dp->DP |= DP_PORT_WIDTH(intel_dp->lane_count); | 1325 | intel_dp->DP |= DP_PORT_WIDTH(intel_dp->lane_count); |
| 1248 | 1326 | ||
| 1249 | if (crtc->config.has_audio) { | 1327 | if (crtc->config.has_audio) |
| 1250 | DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n", | ||
| 1251 | pipe_name(crtc->pipe)); | ||
| 1252 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; | 1328 | intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; |
| 1253 | intel_write_eld(&encoder->base, adjusted_mode); | ||
| 1254 | } | ||
| 1255 | 1329 | ||
| 1256 | /* Split out the IBX/CPU vs CPT settings */ | 1330 | /* Split out the IBX/CPU vs CPT settings */ |
| 1257 | 1331 | ||
| @@ -1409,7 +1483,8 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp) · 151 unmodified lines | |||
| 1409 | power_domain = intel_display_port_power_domain(intel_encoder); | 1483 | power_domain = intel_display_port_power_domain(intel_encoder); |
| 1410 | intel_display_power_get(dev_priv, power_domain); | 1484 | intel_display_power_get(dev_priv, power_domain); |
| 1411 | 1485 | ||
| 1412 | DRM_DEBUG_KMS("Turning eDP VDD on\n"); | 1486 | DRM_DEBUG_KMS("Turning eDP port %c VDD on\n", |
| 1487 | port_name(intel_dig_port->port)); | ||
| 1413 | 1488 | ||
| 1414 | if (!edp_have_panel_power(intel_dp)) | 1489 | if (!edp_have_panel_power(intel_dp)) |
| 1415 | wait_panel_power_cycle(intel_dp); | 1490 | wait_panel_power_cycle(intel_dp); |
| @@ -1428,7 +1503,8 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp) · 12 unmodified lines | |||
| 1428 | * If the panel wasn't on, delay before accessing aux channel | 1503 | * If the panel wasn't on, delay before accessing aux channel |
| 1429 | */ | 1504 | */ |
| 1430 | if (!edp_have_panel_power(intel_dp)) { | 1505 | if (!edp_have_panel_power(intel_dp)) { |
| 1431 | DRM_DEBUG_KMS("eDP was not running\n"); | 1506 | DRM_DEBUG_KMS("eDP port %c panel power wasn't enabled\n", |
| 1507 | port_name(intel_dig_port->port)); | ||
| 1432 | msleep(intel_dp->panel_power_up_delay); | 1508 | msleep(intel_dp->panel_power_up_delay); |
| 1433 | } | 1509 | } |
| 1434 | 1510 | ||
| @@ -1453,7 +1529,8 @@ void intel_edp_panel_vdd_on(struct intel_dp *intel_dp) · 18 unmodified lines | |||
| 1453 | vdd = edp_panel_vdd_on(intel_dp); | 1529 | vdd = edp_panel_vdd_on(intel_dp); |
| 1454 | pps_unlock(intel_dp); | 1530 | pps_unlock(intel_dp); |
| 1455 | 1531 | ||
| 1456 | WARN(!vdd, "eDP VDD already requested on\n"); | 1532 | WARN(!vdd, "eDP port %c VDD already requested on\n", |
| 1533 | port_name(dp_to_dig_port(intel_dp)->port)); | ||
| 1457 | } | 1534 | } |
| 1458 | 1535 | ||
| 1459 | static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) | 1536 | static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) |
| @@ -1474,7 +1551,8 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) · 14 unmodified lines | |||
| 1474 | if (!edp_have_panel_vdd(intel_dp)) | 1551 | if (!edp_have_panel_vdd(intel_dp)) |
| 1475 | return; | 1552 | return; |
| 1476 | 1553 | ||
| 1477 | DRM_DEBUG_KMS("Turning eDP VDD off\n"); | 1554 | DRM_DEBUG_KMS("Turning eDP port %c VDD off\n", |
| 1555 | port_name(intel_dig_port->port)); | ||
| 1478 | 1556 | ||
| 1479 | pp = ironlake_get_pp_control(intel_dp); | 1557 | pp = ironlake_get_pp_control(intel_dp); |
| 1480 | pp &= ~EDP_FORCE_VDD; | 1558 | pp &= ~EDP_FORCE_VDD; |
| @@ -1535,7 +1613,8 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) · 54 unmodified lines | |||
| 1535 | if (!is_edp(intel_dp)) | 1613 | if (!is_edp(intel_dp)) |
| 1536 | return; | 1614 | return; |
| 1537 | 1615 | ||
| 1538 | WARN(!intel_dp->want_panel_vdd, "eDP VDD not forced on"); | 1616 | WARN(!intel_dp->want_panel_vdd, "eDP port %c VDD not forced on", |
| 1617 | port_name(dp_to_dig_port(intel_dp)->port)); | ||
| 1539 | 1618 | ||
| 1540 | intel_dp->want_panel_vdd = false; | 1619 | intel_dp->want_panel_vdd = false; |
| 1541 | 1620 | ||
| @@ -1545,40 +1624,25 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) · 3 unmodified lines | |||
| 1545 | edp_panel_vdd_schedule_off(intel_dp); | 1624 | edp_panel_vdd_schedule_off(intel_dp); |
| 1546 | } | 1625 | } |
| 1547 | 1626 | ||
| 1548 | /* | 1627 | static void edp_panel_on(struct intel_dp *intel_dp) |
| 1549 | * Must be paired with intel_edp_panel_vdd_on(). | ||
| 1550 | * Nested calls to these functions are not allowed since | ||
| 1551 | * we drop the lock. Caller must use some higher level | ||
| 1552 | * locking to prevent nested calls from other threads. | ||
| 1553 | */ | ||
| 1554 | static void intel_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) | ||
| 1555 | { | ||
| 1556 | if (!is_edp(intel_dp)) | ||
| 1557 | return; | ||
| 1558 | |||
| 1559 | pps_lock(intel_dp); | ||
| 1560 | edp_panel_vdd_off(intel_dp, sync); | ||
| 1561 | pps_unlock(intel_dp); | ||
| 1562 | } | ||
| 1563 | |||
| 1564 | void intel_edp_panel_on(struct intel_dp *intel_dp) | ||
| 1565 | { | 1628 | { |
| 1566 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 1629 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
| 1567 | struct drm_i915_private *dev_priv = dev->dev_private; | 1630 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1568 | u32 pp; | 1631 | u32 pp; |
| 1569 | u32 pp_ctrl_reg; | 1632 | u32 pp_ctrl_reg; |
| 1570 | 1633 | ||
| 1634 | lockdep_assert_held(&dev_priv->pps_mutex); | ||
| 1635 | |||
| 1571 | if (!is_edp(intel_dp)) | 1636 | if (!is_edp(intel_dp)) |
| 1572 | return; | 1637 | return; |
| 1573 | 1638 | ||
| 1574 | DRM_DEBUG_KMS("Turn eDP power on\n"); | 1639 | DRM_DEBUG_KMS("Turn eDP port %c panel power on\n", |
| 1575 | 1640 | port_name(dp_to_dig_port(intel_dp)->port)); | |
| 1576 | pps_lock(intel_dp); | ||
| 1577 | 1641 | ||
| 1578 | if (edp_have_panel_power(intel_dp)) { | 1642 | if (WARN(edp_have_panel_power(intel_dp), |
| 1579 | DRM_DEBUG_KMS("eDP power already on\n"); | 1643 | "eDP port %c panel power already on\n", |
| 1580 | goto out; | 1644 | port_name(dp_to_dig_port(intel_dp)->port))) |
| 1581 | } | 1645 | return; |
| 1582 | 1646 | ||
| 1583 | wait_panel_power_cycle(intel_dp); | 1647 | wait_panel_power_cycle(intel_dp); |
| 1584 | 1648 | ||
| @@ -1606,12 +1670,20 @@ void intel_edp_panel_on(struct intel_dp *intel_dp) · 21 unmodified lines | |||
| 1606 | I915_WRITE(pp_ctrl_reg, pp); | 1670 | I915_WRITE(pp_ctrl_reg, pp); |
| 1607 | POSTING_READ(pp_ctrl_reg); | 1671 | POSTING_READ(pp_ctrl_reg); |
| 1608 | } | 1672 | } |
| 1673 | } | ||
| 1609 | 1674 | ||
| 1610 | out: | 1675 | void intel_edp_panel_on(struct intel_dp *intel_dp) |
| 1676 | { | ||
| 1677 | if (!is_edp(intel_dp)) | ||
| 1678 | return; | ||
| 1679 | |||
| 1680 | pps_lock(intel_dp); | ||
| 1681 | edp_panel_on(intel_dp); | ||
| 1611 | pps_unlock(intel_dp); | 1682 | pps_unlock(intel_dp); |
| 1612 | } | 1683 | } |
| 1613 | 1684 | ||
| 1614 | void intel_edp_panel_off(struct intel_dp *intel_dp) | 1685 | |
| 1686 | static void edp_panel_off(struct intel_dp *intel_dp) | ||
| 1615 | { | 1687 | { |
| 1616 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 1688 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
| 1617 | struct intel_encoder *intel_encoder = &intel_dig_port->base; | 1689 | struct intel_encoder *intel_encoder = &intel_dig_port->base; |
| @@ -1621,14 +1693,16 @@ void intel_edp_panel_off(struct intel_dp *intel_dp) · 3 unmodified lines | |||
| 1621 | u32 pp; | 1693 | u32 pp; |
| 1622 | u32 pp_ctrl_reg; | 1694 | u32 pp_ctrl_reg; |
| 1623 | 1695 | ||
| 1696 | lockdep_assert_held(&dev_priv->pps_mutex); | ||
| 1697 | |||
| 1624 | if (!is_edp(intel_dp)) | 1698 | if (!is_edp(intel_dp)) |
| 1625 | return; | 1699 | return; |
| 1626 | 1700 | ||
| 1627 | DRM_DEBUG_KMS("Turn eDP power off\n"); | 1701 | DRM_DEBUG_KMS("Turn eDP port %c panel power off\n", |
| 1702 | port_name(dp_to_dig_port(intel_dp)->port)); | ||
| 1628 | 1703 | ||
| 1629 | pps_lock(intel_dp); | 1704 | WARN(!intel_dp->want_panel_vdd, "Need eDP port %c VDD to turn off panel\n", |
| 1630 | 1705 | port_name(dp_to_dig_port(intel_dp)->port)); | |
| 1631 | WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n"); | ||
| 1632 | 1706 | ||
| 1633 | pp = ironlake_get_pp_control(intel_dp); | 1707 | pp = ironlake_get_pp_control(intel_dp); |
| 1634 | /* We need to switch off panel power _and_ force vdd, for otherwise some | 1708 | /* We need to switch off panel power _and_ force vdd, for otherwise some |
| @@ -1649,7 +1723,15 @@ void intel_edp_panel_off(struct intel_dp *intel_dp) · 14 unmodified lines | |||
| 1649 | /* We got a reference when we enabled the VDD. */ | 1723 | /* We got a reference when we enabled the VDD. */ |
| 1650 | power_domain = intel_display_port_power_domain(intel_encoder); | 1724 | power_domain = intel_display_port_power_domain(intel_encoder); |
| 1651 | intel_display_power_put(dev_priv, power_domain); | 1725 | intel_display_power_put(dev_priv, power_domain); |
| 1726 | } | ||
| 1727 | |||
| 1728 | void intel_edp_panel_off(struct intel_dp *intel_dp) | ||
| 1729 | { | ||
| 1730 | if (!is_edp(intel_dp)) | ||
| 1731 | return; | ||
| 1652 | 1732 | ||
| 1733 | pps_lock(intel_dp); | ||
| 1734 | edp_panel_off(intel_dp); | ||
| 1653 | pps_unlock(intel_dp); | 1735 | pps_unlock(intel_dp); |
| 1654 | } | 1736 | } |
| 1655 | 1737 | ||
| @@ -2368,6 +2450,10 @@ static void intel_disable_dp(struct intel_encoder *encoder) · 712 unmodified lines | |||
| 2368 | { | 2450 | { |
| 2369 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); | 2451 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
| 2370 | struct drm_device *dev = encoder->base.dev; | 2452 | struct drm_device *dev = encoder->base.dev; |
| 2453 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | ||
| 2454 | |||
| 2455 | if (crtc->config.has_audio) | ||
| 2456 | intel_audio_codec_disable(encoder); | ||
| 2371 | 2457 | ||
| 2372 | /* Make sure the panel is off before trying to change the mode. But also | 2458 | /* Make sure the panel is off before trying to change the mode. But also |
| 2373 | * ensure that we have vdd while we switch off the panel. */ | 2459 | * ensure that we have vdd while we switch off the panel. */ |
| @@ -2522,14 +2608,23 @@ static void intel_dp_enable_port(struct intel_dp *intel_dp) · 148 unmodified lines | |||
| 2522 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 2608 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
| 2523 | struct drm_i915_private *dev_priv = dev->dev_private; | 2609 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 2524 | 2610 | ||
| 2525 | intel_dp->DP |= DP_PORT_EN; | ||
| 2526 | |||
| 2527 | /* enable with pattern 1 (as per spec) */ | 2611 | /* enable with pattern 1 (as per spec) */ |
| 2528 | _intel_dp_set_link_train(intel_dp, &intel_dp->DP, | 2612 | _intel_dp_set_link_train(intel_dp, &intel_dp->DP, |
| 2529 | DP_TRAINING_PATTERN_1); | 2613 | DP_TRAINING_PATTERN_1); |
| 2530 | 2614 | ||
| 2531 | I915_WRITE(intel_dp->output_reg, intel_dp->DP); | 2615 | I915_WRITE(intel_dp->output_reg, intel_dp->DP); |
| 2532 | POSTING_READ(intel_dp->output_reg); | 2616 | POSTING_READ(intel_dp->output_reg); |
| 2617 | |||
| 2618 | /* | ||
| 2619 | * Magic for VLV/CHV. We _must_ first set up the register | ||
| 2620 | * without actually enabling the port, and then do another | ||
| 2621 | * write to enable the port. Otherwise link training will | ||
| 2622 | * fail when the power sequencer is freshly used for this port. | ||
| 2623 | */ | ||
| 2624 | intel_dp->DP |= DP_PORT_EN; | ||
| 2625 | |||
| 2626 | I915_WRITE(intel_dp->output_reg, intel_dp->DP); | ||
| 2627 | POSTING_READ(intel_dp->output_reg); | ||
| 2533 | } | 2628 | } |
| 2534 | 2629 | ||
| 2535 | static void intel_enable_dp(struct intel_encoder *encoder) | 2630 | static void intel_enable_dp(struct intel_encoder *encoder) |
| @@ -2537,19 +2632,38 @@ static void intel_enable_dp(struct intel_encoder *encoder) · 1 unmodified line | |||
| 2537 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); | 2632 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
| 2538 | struct drm_device *dev = encoder->base.dev; | 2633 | struct drm_device *dev = encoder->base.dev; |
| 2539 | struct drm_i915_private *dev_priv = dev->dev_private; | 2634 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 2635 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | ||
| 2540 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); | 2636 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); |
| 2541 | 2637 | ||
| 2542 | if (WARN_ON(dp_reg & DP_PORT_EN)) | 2638 | if (WARN_ON(dp_reg & DP_PORT_EN)) |
| 2543 | return; | 2639 | return; |
| 2544 | 2640 | ||
| 2641 | pps_lock(intel_dp); | ||
| 2642 | |||
| 2643 | if (IS_VALLEYVIEW(dev)) | ||
| 2644 | vlv_init_panel_power_sequencer(intel_dp); | ||
| 2645 | |||
| 2545 | intel_dp_enable_port(intel_dp); | 2646 | intel_dp_enable_port(intel_dp); |
| 2546 | intel_edp_panel_vdd_on(intel_dp); | 2647 | |
| 2547 | intel_edp_panel_on(intel_dp); | 2648 | edp_panel_vdd_on(intel_dp); |
| 2548 | intel_edp_panel_vdd_off(intel_dp, true); | 2649 | edp_panel_on(intel_dp); |
| 2650 | edp_panel_vdd_off(intel_dp, true); | ||
| 2651 | |||
| 2652 | pps_unlock(intel_dp); | ||
| 2653 | |||
| 2654 | if (IS_VALLEYVIEW(dev)) | ||
| 2655 | vlv_wait_port_ready(dev_priv, dp_to_dig_port(intel_dp)); | ||
| 2656 | |||
| 2549 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); | 2657 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); |
| 2550 | intel_dp_start_link_train(intel_dp); | 2658 | intel_dp_start_link_train(intel_dp); |
| 2551 | intel_dp_complete_link_train(intel_dp); | 2659 | intel_dp_complete_link_train(intel_dp); |
| 2552 | intel_dp_stop_link_train(intel_dp); | 2660 | intel_dp_stop_link_train(intel_dp); |
| 2661 | |||
| 2662 | if (crtc->config.has_audio) { | ||
| 2663 | DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n", | ||
| 2664 | pipe_name(crtc->pipe)); | ||
| 2665 | intel_audio_codec_enable(encoder); | ||
| 2666 | } | ||
| 2553 | } | 2667 | } |
| 2554 | 2668 | ||
| 2555 | static void g4x_enable_dp(struct intel_encoder *encoder) | 2669 | static void g4x_enable_dp(struct intel_encoder *encoder) |
| @@ -2581,6 +2695,32 @@ static void g4x_pre_enable_dp(struct intel_encoder *encoder) · 25 unmodified lines | |||
| 2581 | } | 2695 | } |
| 2582 | } | 2696 | } |
| 2583 | 2697 | ||
| 2698 | static void vlv_detach_power_sequencer(struct intel_dp *intel_dp) | ||
| 2699 | { | ||
| 2700 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
| 2701 | struct drm_i915_private *dev_priv = intel_dig_port->base.base.dev->dev_private; | ||
| 2702 | enum pipe pipe = intel_dp->pps_pipe; | ||
| 2703 | int pp_on_reg = VLV_PIPE_PP_ON_DELAYS(pipe); | ||
| 2704 | |||
| 2705 | edp_panel_vdd_off_sync(intel_dp); | ||
| 2706 | |||
| 2707 | /* | ||
| 2708 | * VLV seems to get confused when multiple power seqeuencers | ||
| 2709 | * have the same port selected (even if only one has power/vdd | ||
| 2710 | * enabled). The failure manifests as vlv_wait_port_ready() failing | ||
| 2711 | * CHV on the other hand doesn't seem to mind having the same port | ||
| 2712 | * selected in multiple power seqeuencers, but let's clear the | ||
| 2713 | * port select always when logically disconnecting a power sequencer | ||
| 2714 | * from a port. | ||
| 2715 | */ | ||
| 2716 | DRM_DEBUG_KMS("detaching pipe %c power sequencer from port %c\n", | ||
| 2717 | pipe_name(pipe), port_name(intel_dig_port->port)); | ||
| 2718 | I915_WRITE(pp_on_reg, 0); | ||
| 2719 | POSTING_READ(pp_on_reg); | ||
| 2720 | |||
| 2721 | intel_dp->pps_pipe = INVALID_PIPE; | ||
| 2722 | } | ||
| 2723 | |||
| 2584 | static void vlv_steal_power_sequencer(struct drm_device *dev, | 2724 | static void vlv_steal_power_sequencer(struct drm_device *dev, |
| 2585 | enum pipe pipe) | 2725 | enum pipe pipe) |
| 2586 | { | 2726 | { |
| @@ -2589,6 +2729,9 @@ static void vlv_steal_power_sequencer(struct drm_device *dev, · 2 unmodified lines | |||
| 2589 | 2729 | ||
| 2590 | lockdep_assert_held(&dev_priv->pps_mutex); | 2730 | lockdep_assert_held(&dev_priv->pps_mutex); |
| 2591 | 2731 | ||
| 2732 | if (WARN_ON(pipe != PIPE_A && pipe != PIPE_B)) | ||
| 2733 | return; | ||
| 2734 | |||
| 2592 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, | 2735 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, |
| 2593 | base.head) { | 2736 | base.head) { |
| 2594 | struct intel_dp *intel_dp; | 2737 | struct intel_dp *intel_dp; |
| @@ -2606,10 +2749,12 @@ static void vlv_steal_power_sequencer(struct drm_device *dev, · 11 unmodified lines | |||
| 2606 | DRM_DEBUG_KMS("stealing pipe %c power sequencer from port %c\n", | 2749 | DRM_DEBUG_KMS("stealing pipe %c power sequencer from port %c\n", |
| 2607 | pipe_name(pipe), port_name(port)); | 2750 | pipe_name(pipe), port_name(port)); |
| 2608 | 2751 | ||
| 2609 | /* make sure vdd is off before we steal it */ | 2752 | WARN(encoder->connectors_active, |
| 2610 | edp_panel_vdd_off_sync(intel_dp); | 2753 | "stealing pipe %c power sequencer from active eDP port %c\n", |
| 2754 | pipe_name(pipe), port_name(port)); | ||
| 2611 | 2755 | ||
| 2612 | intel_dp->pps_pipe = INVALID_PIPE; | 2756 | /* make sure vdd is off before we steal it */ |
| 2757 | vlv_detach_power_sequencer(intel_dp); | ||
| 2613 | } | 2758 | } |
| 2614 | } | 2759 | } |
| 2615 | 2760 | ||
| @@ -2620,10 +2765,12 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp) · 4 unmodified lines | |||
| 2620 | struct drm_device *dev = encoder->base.dev; | 2765 | struct drm_device *dev = encoder->base.dev; |
| 2621 | struct drm_i915_private *dev_priv = dev->dev_private; | 2766 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 2622 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | 2767 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 2623 | struct edp_power_seq power_seq; | ||
| 2624 | 2768 | ||
| 2625 | lockdep_assert_held(&dev_priv->pps_mutex); | 2769 | lockdep_assert_held(&dev_priv->pps_mutex); |
| 2626 | 2770 | ||
| 2771 | if (!is_edp(intel_dp)) | ||
| 2772 | return; | ||
| 2773 | |||
| 2627 | if (intel_dp->pps_pipe == crtc->pipe) | 2774 | if (intel_dp->pps_pipe == crtc->pipe) |
| 2628 | return; | 2775 | return; |
| 2629 | 2776 | ||
| @@ -2633,7 +2780,7 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp) · 3 unmodified lines | |||
| 2633 | * we still have control of it. | 2780 | * we still have control of it. |
| 2634 | */ | 2781 | */ |
| 2635 | if (intel_dp->pps_pipe != INVALID_PIPE) | 2782 | if (intel_dp->pps_pipe != INVALID_PIPE) |
| 2636 | edp_panel_vdd_off_sync(intel_dp); | 2783 | vlv_detach_power_sequencer(intel_dp); |
| 2637 | 2784 | ||
| 2638 | /* | 2785 | /* |
| 2639 | * We may be stealing the power | 2786 | * We may be stealing the power |
| @@ -2648,9 +2795,8 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp) · 8 unmodified lines | |||
| 2648 | pipe_name(intel_dp->pps_pipe), port_name(intel_dig_port->port)); | 2795 | pipe_name(intel_dp->pps_pipe), port_name(intel_dig_port->port)); |
| 2649 | 2796 | ||
| 2650 | /* init power sequencer on this pipe and port */ | 2797 | /* init power sequencer on this pipe and port */ |
| 2651 | intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq); | 2798 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
| 2652 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, | 2799 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); |
| 2653 | &power_seq); | ||
| 2654 | } | 2800 | } |
| 2655 | 2801 | ||
| 2656 | static void vlv_pre_enable_dp(struct intel_encoder *encoder) | 2802 | static void vlv_pre_enable_dp(struct intel_encoder *encoder) |
| @@ -2679,15 +2825,7 @@ static void vlv_pre_enable_dp(struct intel_encoder *encoder) · 22 unmodified lines | |||
| 2679 | 2825 | ||
| 2680 | mutex_unlock(&dev_priv->dpio_lock); | 2826 | mutex_unlock(&dev_priv->dpio_lock); |
| 2681 | 2827 | ||
| 2682 | if (is_edp(intel_dp)) { | ||
| 2683 | pps_lock(intel_dp); | ||
| 2684 | vlv_init_panel_power_sequencer(intel_dp); | ||
| 2685 | pps_unlock(intel_dp); | ||
| 2686 | } | ||
| 2687 | |||
| 2688 | intel_enable_dp(encoder); | 2828 | intel_enable_dp(encoder); |
| 2689 | |||
| 2690 | vlv_wait_port_ready(dev_priv, dport); | ||
| 2691 | } | 2829 | } |
| 2692 | 2830 | ||
| 2693 | static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder) | 2831 | static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder) |
| @@ -2779,15 +2917,7 @@ static void chv_pre_enable_dp(struct intel_encoder *encoder) · 85 unmodified lines | |||
| 2779 | 2917 | ||
| 2780 | mutex_unlock(&dev_priv->dpio_lock); | 2918 | mutex_unlock(&dev_priv->dpio_lock); |
| 2781 | 2919 | ||
| 2782 | if (is_edp(intel_dp)) { | ||
| 2783 | pps_lock(intel_dp); | ||
| 2784 | vlv_init_panel_power_sequencer(intel_dp); | ||
| 2785 | pps_unlock(intel_dp); | ||
| 2786 | } | ||
| 2787 | |||
| 2788 | intel_enable_dp(encoder); | 2920 | intel_enable_dp(encoder); |
| 2789 | |||
| 2790 | vlv_wait_port_ready(dev_priv, dport); | ||
| 2791 | } | 2921 | } |
| 2792 | 2922 | ||
| 2793 | static void chv_dp_pre_pll_enable(struct intel_encoder *encoder) | 2923 | static void chv_dp_pre_pll_enable(struct intel_encoder *encoder) |
| @@ -3696,7 +3826,6 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) · 902 unmodified lines | |||
| 3696 | 3826 | ||
| 3697 | /* Try 5 times, then try clock recovery if that fails */ | 3827 | /* Try 5 times, then try clock recovery if that fails */ |
| 3698 | if (tries > 5) { | 3828 | if (tries > 5) { |
| 3699 | intel_dp_link_down(intel_dp); | ||
| 3700 | intel_dp_start_link_train(intel_dp); | 3829 | intel_dp_start_link_train(intel_dp); |
| 3701 | intel_dp_set_link_train(intel_dp, &DP, | 3830 | intel_dp_set_link_train(intel_dp, &DP, |
| 3702 | training_pattern | | 3831 | training_pattern | |
| @@ -3854,8 +3983,6 @@ intel_dp_probe_oui(struct intel_dp *intel_dp) · 151 unmodified lines | |||
| 3854 | if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) | 3983 | if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) |
| 3855 | return; | 3984 | return; |
| 3856 | 3985 | ||
| 3857 | intel_edp_panel_vdd_on(intel_dp); | ||
| 3858 | |||
| 3859 | if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_SINK_OUI, buf, 3) == 3) | 3986 | if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_SINK_OUI, buf, 3) == 3) |
| 3860 | DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", | 3987 | DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", |
| 3861 | buf[0], buf[1], buf[2]); | 3988 | buf[0], buf[1], buf[2]); |
| @@ -3863,8 +3990,6 @@ intel_dp_probe_oui(struct intel_dp *intel_dp) · 1 unmodified line | |||
| 3863 | if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_BRANCH_OUI, buf, 3) == 3) | 3990 | if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_BRANCH_OUI, buf, 3) == 3) |
| 3864 | DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", | 3991 | DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", |
| 3865 | buf[0], buf[1], buf[2]); | 3992 | buf[0], buf[1], buf[2]); |
| 3866 | |||
| 3867 | intel_edp_panel_vdd_off(intel_dp, false); | ||
| 3868 | } | 3993 | } |
| 3869 | 3994 | ||
| 3870 | static bool | 3995 | static bool |
| @@ -3878,7 +4003,6 @@ intel_dp_probe_mst(struct intel_dp *intel_dp) · 7 unmodified lines | |||
| 3878 | if (intel_dp->dpcd[DP_DPCD_REV] < 0x12) | 4003 | if (intel_dp->dpcd[DP_DPCD_REV] < 0x12) |
| 3879 | return false; | 4004 | return false; |
| 3880 | 4005 | ||
| 3881 | intel_edp_panel_vdd_on(intel_dp); | ||
| 3882 | if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_MSTM_CAP, buf, 1)) { | 4006 | if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_MSTM_CAP, buf, 1)) { |
| 3883 | if (buf[0] & DP_MST_CAP) { | 4007 | if (buf[0] & DP_MST_CAP) { |
| 3884 | DRM_DEBUG_KMS("Sink is MST capable\n"); | 4008 | DRM_DEBUG_KMS("Sink is MST capable\n"); |
| @@ -3888,7 +4012,6 @@ intel_dp_probe_mst(struct intel_dp *intel_dp) · 3 unmodified lines | |||
| 3888 | intel_dp->is_mst = false; | 4012 | intel_dp->is_mst = false; |
| 3889 | } | 4013 | } |
| 3890 | } | 4014 | } |
| 3891 | intel_edp_panel_vdd_off(intel_dp, false); | ||
| 3892 | 4015 | ||
| 3893 | drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); | 4016 | drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); |
| 3894 | return intel_dp->is_mst; | 4017 | return intel_dp->is_mst; |
| @@ -4568,9 +4691,52 @@ static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) · 673 unmodified lines | |||
| 4568 | pps_unlock(intel_dp); | 4691 | pps_unlock(intel_dp); |
| 4569 | } | 4692 | } |
| 4570 | 4693 | ||
| 4694 | static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp) | ||
| 4695 | { | ||
| 4696 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
| 4697 | struct drm_device *dev = intel_dig_port->base.base.dev; | ||
| 4698 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 4699 | enum intel_display_power_domain power_domain; | ||
| 4700 | |||
| 4701 | lockdep_assert_held(&dev_priv->pps_mutex); | ||
| 4702 | |||
| 4703 | if (!edp_have_panel_vdd(intel_dp)) | ||
| 4704 | return; | ||
| 4705 | |||
| 4706 | /* | ||
| 4707 | * The VDD bit needs a power domain reference, so if the bit is | ||
| 4708 | * already enabled when we boot or resume, grab this reference and | ||
| 4709 | * schedule a vdd off, so we don't hold on to the reference | ||
| 4710 | * indefinitely. | ||
| 4711 | */ | ||
| 4712 | DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n"); | ||
| 4713 | power_domain = intel_display_port_power_domain(&intel_dig_port->base); | ||
| 4714 | intel_display_power_get(dev_priv, power_domain); | ||
| 4715 | |||
| 4716 | edp_panel_vdd_schedule_off(intel_dp); | ||
| 4717 | } | ||
| 4718 | |||
| 4571 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) | 4719 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) |
| 4572 | { | 4720 | { |
| 4573 | intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); | 4721 | struct intel_dp *intel_dp; |
| 4722 | |||
| 4723 | if (to_intel_encoder(encoder)->type != INTEL_OUTPUT_EDP) | ||
| 4724 | return; | ||
| 4725 | |||
| 4726 | intel_dp = enc_to_intel_dp(encoder); | ||
| 4727 | |||
| 4728 | pps_lock(intel_dp); | ||
| 4729 | |||
| 4730 | /* | ||
| 4731 | * Read out the current power sequencer assignment, | ||
| 4732 | * in case the BIOS did something with it. | ||
| 4733 | */ | ||
| 4734 | if (IS_VALLEYVIEW(encoder->dev)) | ||
| 4735 | vlv_initial_power_sequencer_setup(intel_dp); | ||
| 4736 | |||
| 4737 | intel_edp_panel_vdd_sanitize(intel_dp); | ||
| 4738 | |||
| 4739 | pps_unlock(intel_dp); | ||
| 4574 | } | 4740 | } |
| 4575 | 4741 | ||
| 4576 | static const struct drm_connector_funcs intel_dp_connector_funcs = { | 4742 | static const struct drm_connector_funcs intel_dp_connector_funcs = { |
| @@ -4757,16 +4923,20 @@ static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp) · 180 unmodified lines | |||
| 4757 | 4923 | ||
| 4758 | static void | 4924 | static void |
| 4759 | intel_dp_init_panel_power_sequencer(struct drm_device *dev, | 4925 | intel_dp_init_panel_power_sequencer(struct drm_device *dev, |
| 4760 | struct intel_dp *intel_dp, | 4926 | struct intel_dp *intel_dp) |
| 4761 | struct edp_power_seq *out) | ||
| 4762 | { | 4927 | { |
| 4763 | struct drm_i915_private *dev_priv = dev->dev_private; | 4928 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 4764 | struct edp_power_seq cur, vbt, spec, final; | 4929 | struct edp_power_seq cur, vbt, spec, |
| 4930 | *final = &intel_dp->pps_delays; | ||
| 4765 | u32 pp_on, pp_off, pp_div, pp; | 4931 | u32 pp_on, pp_off, pp_div, pp; |
| 4766 | int pp_ctrl_reg, pp_on_reg, pp_off_reg, pp_div_reg; | 4932 | int pp_ctrl_reg, pp_on_reg, pp_off_reg, pp_div_reg; |
| 4767 | 4933 | ||
| 4768 | lockdep_assert_held(&dev_priv->pps_mutex); | 4934 | lockdep_assert_held(&dev_priv->pps_mutex); |
| 4769 | 4935 | ||
| 4936 | /* already initialized? */ | ||
| 4937 | if (final->t11_t12 != 0) | ||
| 4938 | return; | ||
| 4939 | |||
| 4770 | if (HAS_PCH_SPLIT(dev)) { | 4940 | if (HAS_PCH_SPLIT(dev)) { |
| 4771 | pp_ctrl_reg = PCH_PP_CONTROL; | 4941 | pp_ctrl_reg = PCH_PP_CONTROL; |
| 4772 | pp_on_reg = PCH_PP_ON_DELAYS; | 4942 | pp_on_reg = PCH_PP_ON_DELAYS; |
| @@ -4828,7 +4998,7 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev, · 55 unmodified lines | |||
| 4828 | 4998 | ||
| 4829 | /* Use the max of the register settings and vbt. If both are | 4999 | /* Use the max of the register settings and vbt. If both are |
| 4830 | * unset, fall back to the spec limits. */ | 5000 | * unset, fall back to the spec limits. */ |
| 4831 | #define assign_final(field) final.field = (max(cur.field, vbt.field) == 0 ? \ | 5001 | #define assign_final(field) final->field = (max(cur.field, vbt.field) == 0 ? \ |
| 4832 | spec.field : \ | 5002 | spec.field : \ |
| 4833 | max(cur.field, vbt.field)) | 5003 | max(cur.field, vbt.field)) |
| 4834 | assign_final(t1_t3); | 5004 | assign_final(t1_t3); |
| @@ -4838,7 +5008,7 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev, · 3 unmodified lines | |||
| 4838 | assign_final(t11_t12); | 5008 | assign_final(t11_t12); |
| 4839 | #undef assign_final | 5009 | #undef assign_final |
| 4840 | 5010 | ||
| 4841 | #define get_delay(field) (DIV_ROUND_UP(final.field, 10)) | 5011 | #define get_delay(field) (DIV_ROUND_UP(final->field, 10)) |
| 4842 | intel_dp->panel_power_up_delay = get_delay(t1_t3); | 5012 | intel_dp->panel_power_up_delay = get_delay(t1_t3); |
| 4843 | intel_dp->backlight_on_delay = get_delay(t8); | 5013 | intel_dp->backlight_on_delay = get_delay(t8); |
| 4844 | intel_dp->backlight_off_delay = get_delay(t9); | 5014 | intel_dp->backlight_off_delay = get_delay(t9); |
| @@ -4852,21 +5022,18 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev, · 7 unmodified lines | |||
| 4852 | 5022 | ||
| 4853 | DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n", | 5023 | DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n", |
| 4854 | intel_dp->backlight_on_delay, intel_dp->backlight_off_delay); | 5024 | intel_dp->backlight_on_delay, intel_dp->backlight_off_delay); |
| 4855 | |||
| 4856 | if (out) | ||
| 4857 | *out = final; | ||
| 4858 | } | 5025 | } |
| 4859 | 5026 | ||
| 4860 | static void | 5027 | static void |
| 4861 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | 5028 | intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, |
| 4862 | struct intel_dp *intel_dp, | 5029 | struct intel_dp *intel_dp) |
| 4863 | struct edp_power_seq *seq) | ||
| 4864 | { | 5030 | { |
| 4865 | struct drm_i915_private *dev_priv = dev->dev_private; | 5031 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 4866 | u32 pp_on, pp_off, pp_div, port_sel = 0; | 5032 | u32 pp_on, pp_off, pp_div, port_sel = 0; |
| 4867 | int div = HAS_PCH_SPLIT(dev) ? intel_pch_rawclk(dev) : intel_hrawclk(dev); | 5033 | int div = HAS_PCH_SPLIT(dev) ? intel_pch_rawclk(dev) : intel_hrawclk(dev); |
| 4868 | int pp_on_reg, pp_off_reg, pp_div_reg; | 5034 | int pp_on_reg, pp_off_reg, pp_div_reg; |
| 4869 | enum port port = dp_to_dig_port(intel_dp)->port; | 5035 | enum port port = dp_to_dig_port(intel_dp)->port; |
| 5036 | const struct edp_power_seq *seq = &intel_dp->pps_delays; | ||
| 4870 | 5037 | ||
| 4871 | lockdep_assert_held(&dev_priv->pps_mutex); | 5038 | lockdep_assert_held(&dev_priv->pps_mutex); |
| 4872 | 5039 | ||
| @@ -5052,40 +5219,8 @@ intel_dp_drrs_init(struct intel_digital_port *intel_dig_port, · 179 unmodified lines | |||
| 5052 | return downclock_mode; | 5219 | return downclock_mode; |
| 5053 | } | 5220 | } |
| 5054 | 5221 | ||
| 5055 | void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder) | ||
| 5056 | { | ||
| 5057 | struct drm_device *dev = intel_encoder->base.dev; | ||
| 5058 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 5059 | struct intel_dp *intel_dp; | ||
| 5060 | enum intel_display_power_domain power_domain; | ||
| 5061 | |||
| 5062 | if (intel_encoder->type != INTEL_OUTPUT_EDP) | ||
| 5063 | return; | ||
| 5064 | |||
| 5065 | intel_dp = enc_to_intel_dp(&intel_encoder->base); | ||
| 5066 | |||
| 5067 | pps_lock(intel_dp); | ||
| 5068 | |||
| 5069 | if (!edp_have_panel_vdd(intel_dp)) | ||
| 5070 | goto out; | ||
| 5071 | /* | ||
| 5072 | * The VDD bit needs a power domain reference, so if the bit is | ||
| 5073 | * already enabled when we boot or resume, grab this reference and | ||
| 5074 | * schedule a vdd off, so we don't hold on to the reference | ||
| 5075 | * indefinitely. | ||
| 5076 | */ | ||
| 5077 | DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n"); | ||
| 5078 | power_domain = intel_display_port_power_domain(intel_encoder); | ||
| 5079 | intel_display_power_get(dev_priv, power_domain); | ||
| 5080 | |||
| 5081 | edp_panel_vdd_schedule_off(intel_dp); | ||
| 5082 | out: | ||
| 5083 | pps_unlock(intel_dp); | ||
| 5084 | } | ||
| 5085 | |||
| 5086 | static bool intel_edp_init_connector(struct intel_dp *intel_dp, | 5222 | static bool intel_edp_init_connector(struct intel_dp *intel_dp, |
| 5087 | struct intel_connector *intel_connector, | 5223 | struct intel_connector *intel_connector) |
| 5088 | struct edp_power_seq *power_seq) | ||
| 5089 | { | 5224 | { |
| 5090 | struct drm_connector *connector = &intel_connector->base; | 5225 | struct drm_connector *connector = &intel_connector->base; |
| 5091 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 5226 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
| @@ -5103,12 +5238,12 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, · 11 unmodified lines | |||
| 5103 | if (!is_edp(intel_dp)) | 5238 | if (!is_edp(intel_dp)) |
| 5104 | return true; | 5239 | return true; |
| 5105 | 5240 | ||
| 5106 | intel_edp_panel_vdd_sanitize(intel_encoder); | 5241 | pps_lock(intel_dp); |
| 5242 | intel_edp_panel_vdd_sanitize(intel_dp); | ||
| 5243 | pps_unlock(intel_dp); | ||
| 5107 | 5244 | ||
| 5108 | /* Cache DPCD and EDID for edp. */ | 5245 | /* Cache DPCD and EDID for edp. */ |
| 5109 | intel_edp_panel_vdd_on(intel_dp); | ||
| 5110 | has_dpcd = intel_dp_get_dpcd(intel_dp); | 5246 | has_dpcd = intel_dp_get_dpcd(intel_dp); |
| 5111 | intel_edp_panel_vdd_off(intel_dp, false); | ||
| 5112 | 5247 | ||
| 5113 | if (has_dpcd) { | 5248 | if (has_dpcd) { |
| 5114 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) | 5249 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) |
| @@ -5123,7 +5258,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, · 8 unmodified lines | |||
| 5123 | 5258 | ||
| 5124 | /* We now know it's not a ghost, init power sequence regs. */ | 5259 | /* We now know it's not a ghost, init power sequence regs. */ |
| 5125 | pps_lock(intel_dp); | 5260 | pps_lock(intel_dp); |
| 5126 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq); | 5261 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); |
| 5127 | pps_unlock(intel_dp); | 5262 | pps_unlock(intel_dp); |
| 5128 | 5263 | ||
| 5129 | mutex_lock(&dev->mode_config.mutex); | 5264 | mutex_lock(&dev->mode_config.mutex); |
| @@ -5184,7 +5319,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 54 unmodified lines | |||
| 5184 | struct drm_device *dev = intel_encoder->base.dev; | 5319 | struct drm_device *dev = intel_encoder->base.dev; |
| 5185 | struct drm_i915_private *dev_priv = dev->dev_private; | 5320 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 5186 | enum port port = intel_dig_port->port; | 5321 | enum port port = intel_dig_port->port; |
| 5187 | struct edp_power_seq power_seq = { 0 }; | ||
| 5188 | int type; | 5322 | int type; |
| 5189 | 5323 | ||
| 5190 | intel_dp->pps_pipe = INVALID_PIPE; | 5324 | intel_dp->pps_pipe = INVALID_PIPE; |
| @@ -5223,6 +5357,11 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 32 unmodified lines | |||
| 5223 | if (type == DRM_MODE_CONNECTOR_eDP) | 5357 | if (type == DRM_MODE_CONNECTOR_eDP) |
| 5224 | intel_encoder->type = INTEL_OUTPUT_EDP; | 5358 | intel_encoder->type = INTEL_OUTPUT_EDP; |
| 5225 | 5359 | ||
| 5360 | /* eDP only on port B and/or C on vlv/chv */ | ||
| 5361 | if (WARN_ON(IS_VALLEYVIEW(dev) && is_edp(intel_dp) && | ||
| 5362 | port != PORT_B && port != PORT_C)) | ||
| 5363 | return false; | ||
| 5364 | |||
| 5226 | DRM_DEBUG_KMS("Adding %s connector on port %c\n", | 5365 | DRM_DEBUG_KMS("Adding %s connector on port %c\n", |
| 5227 | type == DRM_MODE_CONNECTOR_eDP ? "eDP" : "DP", | 5366 | type == DRM_MODE_CONNECTOR_eDP ? "eDP" : "DP", |
| 5228 | port_name(port)); | 5367 | port_name(port)); |
| @@ -5265,13 +5404,11 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 36 unmodified lines | |||
| 5265 | 5404 | ||
| 5266 | if (is_edp(intel_dp)) { | 5405 | if (is_edp(intel_dp)) { |
| 5267 | pps_lock(intel_dp); | 5406 | pps_lock(intel_dp); |
| 5268 | if (IS_VALLEYVIEW(dev)) { | 5407 | intel_dp_init_panel_power_timestamps(intel_dp); |
| 5408 | if (IS_VALLEYVIEW(dev)) | ||
| 5269 | vlv_initial_power_sequencer_setup(intel_dp); | 5409 | vlv_initial_power_sequencer_setup(intel_dp); |
| 5270 | } else { | 5410 | else |
| 5271 | intel_dp_init_panel_power_timestamps(intel_dp); | 5411 | intel_dp_init_panel_power_sequencer(dev, intel_dp); |
| 5272 | intel_dp_init_panel_power_sequencer(dev, intel_dp, | ||
| 5273 | &power_seq); | ||
| 5274 | } | ||
| 5275 | pps_unlock(intel_dp); | 5412 | pps_unlock(intel_dp); |
| 5276 | } | 5413 | } |
| 5277 | 5414 | ||
| @@ -5285,7 +5422,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 7 unmodified lines | |||
| 5285 | } | 5422 | } |
| 5286 | } | 5423 | } |
| 5287 | 5424 | ||
| 5288 | if (!intel_edp_init_connector(intel_dp, intel_connector, &power_seq)) { | 5425 | if (!intel_edp_init_connector(intel_dp, intel_connector)) { |
| 5289 | drm_dp_aux_unregister(&intel_dp->aux); | 5426 | drm_dp_aux_unregister(&intel_dp->aux); |
| 5290 | if (is_edp(intel_dp)) { | 5427 | if (is_edp(intel_dp)) { |
| 5291 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | 5428 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); |
| @@ -94,18 +94,20 @@ · 93 unmodified lines | |||
| 94 | 94 | ||
| 95 | /* these are outputs from the chip - integrated only | 95 | /* these are outputs from the chip - integrated only |
| 96 | external chips are via DVO or SDVO output */ | 96 | external chips are via DVO or SDVO output */ |
| 97 | #define INTEL_OUTPUT_UNUSED 0 | 97 | enum intel_output_type { |
| 98 | #define INTEL_OUTPUT_ANALOG 1 | 98 | INTEL_OUTPUT_UNUSED = 0, |
| 99 | #define INTEL_OUTPUT_DVO 2 | 99 | INTEL_OUTPUT_ANALOG = 1, |
| 100 | #define INTEL_OUTPUT_SDVO 3 | 100 | INTEL_OUTPUT_DVO = 2, |
| 101 | #define INTEL_OUTPUT_LVDS 4 | 101 | INTEL_OUTPUT_SDVO = 3, |
| 102 | #define INTEL_OUTPUT_TVOUT 5 | 102 | INTEL_OUTPUT_LVDS = 4, |
| 103 | #define INTEL_OUTPUT_HDMI 6 | 103 | INTEL_OUTPUT_TVOUT = 5, |
| 104 | #define INTEL_OUTPUT_DISPLAYPORT 7 | 104 | INTEL_OUTPUT_HDMI = 6, |
| 105 | #define INTEL_OUTPUT_EDP 8 | 105 | INTEL_OUTPUT_DISPLAYPORT = 7, |
| 106 | #define INTEL_OUTPUT_DSI 9 | 106 | INTEL_OUTPUT_EDP = 8, |
| 107 | #define INTEL_OUTPUT_UNKNOWN 10 | 107 | INTEL_OUTPUT_DSI = 9, |
| 108 | #define INTEL_OUTPUT_DP_MST 11 | 108 | INTEL_OUTPUT_UNKNOWN = 10, |
| 109 | INTEL_OUTPUT_DP_MST = 11, | ||
| 110 | }; | ||
| 109 | 111 | ||
| 110 | #define INTEL_DVO_CHIP_NONE 0 | 112 | #define INTEL_DVO_CHIP_NONE 0 |
| 111 | #define INTEL_DVO_CHIP_LVDS 1 | 113 | #define INTEL_DVO_CHIP_LVDS 1 |
| @@ -136,7 +138,7 @@ struct intel_encoder { · 24 unmodified lines | |||
| 136 | */ | 138 | */ |
| 137 | struct intel_crtc *new_crtc; | 139 | struct intel_crtc *new_crtc; |
| 138 | 140 | ||
| 139 | int type; | 141 | enum intel_output_type type; |
| 140 | unsigned int cloneable; | 142 | unsigned int cloneable; |
| 141 | bool connectors_active; | 143 | bool connectors_active; |
| 142 | void (*hot_plug)(struct intel_encoder *); | 144 | void (*hot_plug)(struct intel_encoder *); |
| @@ -399,7 +401,14 @@ struct intel_pipe_wm { · 256 unmodified lines | |||
| 399 | 401 | ||
| 400 | struct intel_mmio_flip { | 402 | struct intel_mmio_flip { |
| 401 | u32 seqno; | 403 | u32 seqno; |
| 402 | u32 ring_id; | 404 | struct intel_engine_cs *ring; |
| 405 | struct work_struct work; | ||
| 406 | }; | ||
| 407 | |||
| 408 | struct skl_pipe_wm { | ||
| 409 | struct skl_wm_level wm[8]; | ||
| 410 | struct skl_wm_level trans_wm; | ||
| 411 | uint32_t linetime; | ||
| 403 | }; | 412 | }; |
| 404 | 413 | ||
| 405 | struct intel_crtc { | 414 | struct intel_crtc { |
| @@ -449,6 +458,8 @@ struct intel_crtc { · 43 unmodified lines | |||
| 449 | struct { | 458 | struct { |
| 450 | /* watermarks currently being used */ | 459 | /* watermarks currently being used */ |
| 451 | struct intel_pipe_wm active; | 460 | struct intel_pipe_wm active; |
| 461 | /* SKL wm values currently in use */ | ||
| 462 | struct skl_pipe_wm skl_active; | ||
| 452 | } wm; | 463 | } wm; |
| 453 | 464 | ||
| 454 | int scanline_offset; | 465 | int scanline_offset; |
| @@ -590,6 +601,7 @@ struct intel_dp { · 135 unmodified lines | |||
| 590 | * this port. Only relevant on VLV/CHV. | 601 | * this port. Only relevant on VLV/CHV. |
| 591 | */ | 602 | */ |
| 592 | enum pipe pps_pipe; | 603 | enum pipe pps_pipe; |
| 604 | struct edp_power_seq pps_delays; | ||
| 593 | 605 | ||
| 594 | bool use_tps3; | 606 | bool use_tps3; |
| 595 | bool can_mst; /* this port supports mst */ | 607 | bool can_mst; /* this port supports mst */ |
| @@ -848,6 +860,11 @@ void intel_frontbuffer_flip(struct drm_device *dev, · 252 unmodified lines | |||
| 848 | void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire); | 860 | void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire); |
| 849 | 861 | ||
| 850 | 862 | ||
| 863 | /* intel_audio.c */ | ||
| 864 | void intel_init_audio(struct drm_device *dev); | ||
| 865 | void intel_audio_codec_enable(struct intel_encoder *encoder); | ||
| 866 | void intel_audio_codec_disable(struct intel_encoder *encoder); | ||
| 867 | |||
| 851 | /* intel_display.c */ | 868 | /* intel_display.c */ |
| 852 | const char *intel_output_name(int output); | 869 | const char *intel_output_name(int output); |
| 853 | bool intel_has_pending_fb_unpin(struct drm_device *dev); | 870 | bool intel_has_pending_fb_unpin(struct drm_device *dev); |
| @@ -873,6 +890,7 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, · 19 unmodified lines | |||
| 873 | struct drm_file *file_priv); | 890 | struct drm_file *file_priv); |
| 874 | enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, | 891 | enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, |
| 875 | enum pipe pipe); | 892 | enum pipe pipe); |
| 893 | bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type); | ||
| 876 | static inline void | 894 | static inline void |
| 877 | intel_wait_for_vblank(struct drm_device *dev, int pipe) | 895 | intel_wait_for_vblank(struct drm_device *dev, int pipe) |
| 878 | { | 896 | { |
| @@ -887,8 +905,8 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, · 8 unmodified lines | |||
| 887 | struct drm_modeset_acquire_ctx *ctx); | 905 | struct drm_modeset_acquire_ctx *ctx); |
| 888 | void intel_release_load_detect_pipe(struct drm_connector *connector, | 906 | void intel_release_load_detect_pipe(struct drm_connector *connector, |
| 889 | struct intel_load_detect_pipe *old); | 907 | struct intel_load_detect_pipe *old); |
| 890 | int intel_pin_and_fence_fb_obj(struct drm_device *dev, | 908 | int intel_pin_and_fence_fb_obj(struct drm_plane *plane, |
| 891 | struct drm_i915_gem_object *obj, | 909 | struct drm_framebuffer *fb, |
| 892 | struct intel_engine_cs *pipelined); | 910 | struct intel_engine_cs *pipelined); |
| 893 | void intel_unpin_fb_obj(struct drm_i915_gem_object *obj); | 911 | void intel_unpin_fb_obj(struct drm_i915_gem_object *obj); |
| 894 | struct drm_framebuffer * | 912 | struct drm_framebuffer * |
| @@ -910,6 +928,10 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv, · 15 unmodified lines | |||
| 910 | struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc); | 928 | struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc); |
| 911 | void intel_put_shared_dpll(struct intel_crtc *crtc); | 929 | void intel_put_shared_dpll(struct intel_crtc *crtc); |
| 912 | 930 | ||
| 931 | void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, | ||
| 932 | const struct dpll *dpll); | ||
| 933 | void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe); | ||
| 934 | |||
| 913 | /* modesetting asserts */ | 935 | /* modesetting asserts */ |
| 914 | void assert_panel_unlocked(struct drm_i915_private *dev_priv, | 936 | void assert_panel_unlocked(struct drm_i915_private *dev_priv, |
| 915 | enum pipe pipe); | 937 | enum pipe pipe); |
| @@ -924,8 +946,6 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv, · 8 unmodified lines | |||
| 924 | void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state); | 946 | void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state); |
| 925 | #define assert_pipe_enabled(d, p) assert_pipe(d, p, true) | 947 | #define assert_pipe_enabled(d, p) assert_pipe(d, p, true) |
| 926 | #define assert_pipe_disabled(d, p) assert_pipe(d, p, false) | 948 | #define assert_pipe_disabled(d, p) assert_pipe(d, p, false) |
| 927 | void intel_write_eld(struct drm_encoder *encoder, | ||
| 928 | struct drm_display_mode *mode); | ||
| 929 | unsigned long intel_gen4_compute_page_offset(int *x, int *y, | 949 | unsigned long intel_gen4_compute_page_offset(int *x, int *y, |
| 930 | unsigned int tiling_mode, | 950 | unsigned int tiling_mode, |
| 931 | unsigned int bpp, | 951 | unsigned int bpp, |
| @@ -970,7 +990,6 @@ bool intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, · 38 unmodified lines | |||
| 970 | void intel_edp_backlight_on(struct intel_dp *intel_dp); | 990 | void intel_edp_backlight_on(struct intel_dp *intel_dp); |
| 971 | void intel_edp_backlight_off(struct intel_dp *intel_dp); | 991 | void intel_edp_backlight_off(struct intel_dp *intel_dp); |
| 972 | void intel_edp_panel_vdd_on(struct intel_dp *intel_dp); | 992 | void intel_edp_panel_vdd_on(struct intel_dp *intel_dp); |
| 973 | void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder); | ||
| 974 | void intel_edp_panel_on(struct intel_dp *intel_dp); | 993 | void intel_edp_panel_on(struct intel_dp *intel_dp); |
| 975 | void intel_edp_panel_off(struct intel_dp *intel_dp); | 994 | void intel_edp_panel_off(struct intel_dp *intel_dp); |
| 976 | void intel_edp_psr_enable(struct intel_dp *intel_dp); | 995 | void intel_edp_psr_enable(struct intel_dp *intel_dp); |
| @@ -982,7 +1001,6 @@ void intel_edp_psr_flush(struct drm_device *dev, · 5 unmodified lines | |||
| 982 | unsigned frontbuffer_bits); | 1001 | unsigned frontbuffer_bits); |
| 983 | void intel_edp_psr_init(struct drm_device *dev); | 1002 | void intel_edp_psr_init(struct drm_device *dev); |
| 984 | 1003 | ||
| 985 | int intel_dp_handle_hpd_irq(struct intel_digital_port *digport, bool long_hpd); | ||
| 986 | void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector); | 1004 | void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector); |
| 987 | void intel_dp_mst_suspend(struct drm_device *dev); | 1005 | void intel_dp_mst_suspend(struct drm_device *dev); |
| 988 | void intel_dp_mst_resume(struct drm_device *dev); | 1006 | void intel_dp_mst_resume(struct drm_device *dev); |
| @@ -1139,6 +1157,9 @@ void gen6_update_ring_freq(struct drm_device *dev); · 150 unmodified lines | |||
| 1139 | void gen6_rps_idle(struct drm_i915_private *dev_priv); | 1157 | void gen6_rps_idle(struct drm_i915_private *dev_priv); |
| 1140 | void gen6_rps_boost(struct drm_i915_private *dev_priv); | 1158 | void gen6_rps_boost(struct drm_i915_private *dev_priv); |
| 1141 | void ilk_wm_get_hw_state(struct drm_device *dev); | 1159 | void ilk_wm_get_hw_state(struct drm_device *dev); |
| 1160 | void skl_wm_get_hw_state(struct drm_device *dev); | ||
| 1161 | void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, | ||
| 1162 | struct skl_ddb_allocation *ddb /* out */); | ||
| 1142 | 1163 | ||
| 1143 | 1164 | ||
| 1144 | /* intel_sdvo.c */ | 1165 | /* intel_sdvo.c */ |
| @@ -1158,7 +1179,9 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data, · 13 unmodified lines | |||
| 1158 | struct drm_file *file_priv); | 1179 | struct drm_file *file_priv); |
| 1159 | int intel_sprite_get_colorkey(struct drm_device *dev, void *data, | 1180 | int intel_sprite_get_colorkey(struct drm_device *dev, void *data, |
| 1160 | struct drm_file *file_priv); | 1181 | struct drm_file *file_priv); |
| 1161 | 1182 | bool intel_pipe_update_start(struct intel_crtc *crtc, | |
| 1183 | uint32_t *start_vbl_count); | ||
| 1184 | void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count); | ||
| 1162 | 1185 | ||
| 1163 | /* intel_tv.c */ | 1186 | /* intel_tv.c */ |
| 1164 | void intel_tv_init(struct drm_device *dev); | 1187 | void intel_tv_init(struct drm_device *dev); |
| @@ -119,25 +119,25 @@ static int intelfb_alloc(struct drm_fb_helper *helper, · 118 unmodified lines | |||
| 119 | goto out; | 119 | goto out; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | /* Flush everything out, we'll be doing GTT only from now on */ | ||
| 123 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); | ||
| 124 | if (ret) { | ||
| 125 | DRM_ERROR("failed to pin obj: %d\n", ret); | ||
| 126 | goto out_unref; | ||
| 127 | } | ||
| 128 | |||
| 129 | fb = __intel_framebuffer_create(dev, &mode_cmd, obj); | 122 | fb = __intel_framebuffer_create(dev, &mode_cmd, obj); |
| 130 | if (IS_ERR(fb)) { | 123 | if (IS_ERR(fb)) { |
| 131 | ret = PTR_ERR(fb); | 124 | ret = PTR_ERR(fb); |
| 132 | goto out_unpin; | 125 | goto out_unref; |
| 126 | } | ||
| 127 | |||
| 128 | /* Flush everything out, we'll be doing GTT only from now on */ | ||
| 129 | ret = intel_pin_and_fence_fb_obj(NULL, fb, NULL); | ||
| 130 | if (ret) { | ||
| 131 | DRM_ERROR("failed to pin obj: %d\n", ret); | ||
| 132 | goto out_fb; | ||
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | ifbdev->fb = to_intel_framebuffer(fb); | 135 | ifbdev->fb = to_intel_framebuffer(fb); |
| 136 | 136 | ||
| 137 | return 0; | 137 | return 0; |
| 138 | 138 | ||
| 139 | out_unpin: | 139 | out_fb: |
| 140 | i915_gem_object_ggtt_unpin(obj); | 140 | drm_framebuffer_remove(fb); |
| 141 | out_unref: | 141 | out_unref: |
| 142 | drm_gem_object_unreference(&obj->base); | 142 | drm_gem_object_unreference(&obj->base); |
| 143 | out: | 143 | out: |
| @@ -661,14 +661,6 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder) · 660 unmodified lines | |||
| 661 | if (crtc->config.has_hdmi_sink) | 661 | if (crtc->config.has_hdmi_sink) |
| 662 | hdmi_val |= HDMI_MODE_SELECT_HDMI; | 662 | hdmi_val |= HDMI_MODE_SELECT_HDMI; |
| 663 | 663 | ||
| 664 | if (crtc->config.has_audio) { | ||
| 665 | WARN_ON(!crtc->config.has_hdmi_sink); | ||
| 666 | DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n", | ||
| 667 | pipe_name(crtc->pipe)); | ||
| 668 | hdmi_val |= SDVO_AUDIO_ENABLE; | ||
| 669 | intel_write_eld(&encoder->base, adjusted_mode); | ||
| 670 | } | ||
| 671 | |||
| 672 | if (HAS_PCH_CPT(dev)) | 664 | if (HAS_PCH_CPT(dev)) |
| 673 | hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe); | 665 | hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe); |
| 674 | else if (IS_CHERRYVIEW(dev)) | 666 | else if (IS_CHERRYVIEW(dev)) |
| @@ -791,6 +783,13 @@ static void intel_enable_hdmi(struct intel_encoder *encoder) · 116 unmodified lines | |||
| 791 | I915_WRITE(intel_hdmi->hdmi_reg, temp); | 783 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 792 | POSTING_READ(intel_hdmi->hdmi_reg); | 784 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 793 | } | 785 | } |
| 786 | |||
| 787 | if (intel_crtc->config.has_audio) { | ||
| 788 | WARN_ON(!intel_crtc->config.has_hdmi_sink); | ||
| 789 | DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n", | ||
| 790 | pipe_name(intel_crtc->pipe)); | ||
| 791 | intel_audio_codec_enable(encoder); | ||
| 792 | } | ||
| 794 | } | 793 | } |
| 795 | 794 | ||
| 796 | static void vlv_enable_hdmi(struct intel_encoder *encoder) | 795 | static void vlv_enable_hdmi(struct intel_encoder *encoder) |
| @@ -802,9 +801,13 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) · 5 unmodified lines | |||
| 802 | struct drm_device *dev = encoder->base.dev; | 801 | struct drm_device *dev = encoder->base.dev; |
| 803 | struct drm_i915_private *dev_priv = dev->dev_private; | 802 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 804 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); | 803 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
| 804 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | ||
| 805 | u32 temp; | 805 | u32 temp; |
| 806 | u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE; | 806 | u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE; |
| 807 | 807 | ||
| 808 | if (crtc->config.has_audio) | ||
| 809 | intel_audio_codec_disable(encoder); | ||
| 810 | |||
| 808 | temp = I915_READ(intel_hdmi->hdmi_reg); | 811 | temp = I915_READ(intel_hdmi->hdmi_reg); |
| 809 | 812 | ||
| 810 | /* HW workaround for IBX, we need to move the port to transcoder A | 813 | /* HW workaround for IBX, we need to move the port to transcoder A |
| @@ -356,9 +356,9 @@ static int execlists_ctx_write_tail(struct drm_i915_gem_object *ctx_obj, u32 tai · 355 unmodified lines | |||
| 356 | return 0; | 356 | return 0; |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | static int execlists_submit_context(struct intel_engine_cs *ring, | 359 | static void execlists_submit_contexts(struct intel_engine_cs *ring, |
| 360 | struct intel_context *to0, u32 tail0, | 360 | struct intel_context *to0, u32 tail0, |
| 361 | struct intel_context *to1, u32 tail1) | 361 | struct intel_context *to1, u32 tail1) |
| 362 | { | 362 | { |
| 363 | struct drm_i915_gem_object *ctx_obj0; | 363 | struct drm_i915_gem_object *ctx_obj0; |
| 364 | struct drm_i915_gem_object *ctx_obj1 = NULL; | 364 | struct drm_i915_gem_object *ctx_obj1 = NULL; |
| @@ -378,8 +378,6 @@ static int execlists_submit_context(struct intel_engine_cs *ring, · 13 unmodified lines | |||
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | execlists_elsp_write(ring, ctx_obj0, ctx_obj1); | 380 | execlists_elsp_write(ring, ctx_obj0, ctx_obj1); |
| 381 | |||
| 382 | return 0; | ||
| 383 | } | 381 | } |
| 384 | 382 | ||
| 385 | static void execlists_context_unqueue(struct intel_engine_cs *ring) | 383 | static void execlists_context_unqueue(struct intel_engine_cs *ring) |
| @@ -413,9 +411,9 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring) · 27 unmodified lines | |||
| 413 | 411 | ||
| 414 | WARN_ON(req1 && req1->elsp_submitted); | 412 | WARN_ON(req1 && req1->elsp_submitted); |
| 415 | 413 | ||
| 416 | WARN_ON(execlists_submit_context(ring, req0->ctx, req0->tail, | 414 | execlists_submit_contexts(ring, req0->ctx, req0->tail, |
| 417 | req1 ? req1->ctx : NULL, | 415 | req1 ? req1->ctx : NULL, |
| 418 | req1 ? req1->tail : 0)); | 416 | req1 ? req1->tail : 0); |
| 419 | 417 | ||
| 420 | req0->elsp_submitted++; | 418 | req0->elsp_submitted++; |
| 421 | if (req1) | 419 | if (req1) |
| @@ -1214,11 +1212,13 @@ static int gen8_emit_request(struct intel_ringbuffer *ringbuf) · 792 unmodified lines | |||
| 1214 | */ | 1212 | */ |
| 1215 | void intel_logical_ring_cleanup(struct intel_engine_cs *ring) | 1213 | void intel_logical_ring_cleanup(struct intel_engine_cs *ring) |
| 1216 | { | 1214 | { |
| 1217 | struct drm_i915_private *dev_priv = ring->dev->dev_private; | 1215 | struct drm_i915_private *dev_priv; |
| 1218 | 1216 | ||
| 1219 | if (!intel_ring_initialized(ring)) | 1217 | if (!intel_ring_initialized(ring)) |
| 1220 | return; | 1218 | return; |
| 1221 | 1219 | ||
| 1220 | dev_priv = ring->dev->dev_private; | ||
| 1221 | |||
| 1222 | intel_logical_ring_stop(ring); | 1222 | intel_logical_ring_stop(ring); |
| 1223 | WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0); | 1223 | WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0); |
| 1224 | ring->preallocated_lazy_request = NULL; | 1224 | ring->preallocated_lazy_request = NULL; |
| @@ -1649,6 +1649,27 @@ static uint32_t get_lr_context_size(struct intel_engine_cs *ring) · 424 unmodified lines | |||
| 1649 | return ret; | 1649 | return ret; |
| 1650 | } | 1650 | } |
| 1651 | 1651 | ||
| 1652 | static int lrc_setup_hardware_status_page(struct intel_engine_cs *ring, | ||
| 1653 | struct drm_i915_gem_object *default_ctx_obj) | ||
| 1654 | { | ||
| 1655 | struct drm_i915_private *dev_priv = ring->dev->dev_private; | ||
| 1656 | |||
| 1657 | /* The status page is offset 0 from the default context object | ||
| 1658 | * in LRC mode. */ | ||
| 1659 | ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(default_ctx_obj); | ||
| 1660 | ring->status_page.page_addr = | ||
| 1661 | kmap(sg_page(default_ctx_obj->pages->sgl)); | ||
| 1662 | if (ring->status_page.page_addr == NULL) | ||
| 1663 | return -ENOMEM; | ||
| 1664 | ring->status_page.obj = default_ctx_obj; | ||
| 1665 | |||
| 1666 | I915_WRITE(RING_HWS_PGA(ring->mmio_base), | ||
| 1667 | (u32)ring->status_page.gfx_addr); | ||
| 1668 | POSTING_READ(RING_HWS_PGA(ring->mmio_base)); | ||
| 1669 | |||
| 1670 | return 0; | ||
| 1671 | } | ||
| 1672 | |||
| 1652 | /** | 1673 | /** |
| 1653 | * intel_lr_context_deferred_create() - create the LRC specific bits of a context | 1674 | * intel_lr_context_deferred_create() - create the LRC specific bits of a context |
| 1654 | * @ctx: LR context to create. | 1675 | * @ctx: LR context to create. |
| @@ -1734,14 +1755,11 @@ int intel_lr_context_deferred_create(struct intel_context *ctx, · 79 unmodified lines | |||
| 1734 | ctx->engine[ring->id].state = ctx_obj; | 1755 | ctx->engine[ring->id].state = ctx_obj; |
| 1735 | 1756 | ||
| 1736 | if (ctx == ring->default_context) { | 1757 | if (ctx == ring->default_context) { |
| 1737 | /* The status page is offset 0 from the default context object | 1758 | ret = lrc_setup_hardware_status_page(ring, ctx_obj); |
| 1738 | * in LRC mode. */ | 1759 | if (ret) { |
| 1739 | ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(ctx_obj); | 1760 | DRM_ERROR("Failed to setup hardware status page\n"); |
| 1740 | ring->status_page.page_addr = | 1761 | goto error; |
| 1741 | kmap(sg_page(ctx_obj->pages->sgl)); | 1762 | } |
| 1742 | if (ring->status_page.page_addr == NULL) | ||
| 1743 | return -ENOMEM; | ||
| 1744 | ring->status_page.obj = ctx_obj; | ||
| 1745 | } | 1763 | } |
| 1746 | 1764 | ||
| 1747 | if (ring->id == RCS && !ctx->rcs_initialized) { | 1765 | if (ring->id == RCS && !ctx->rcs_initialized) { |
| @@ -1960,6 +1960,14 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels, · 1959 unmodified lines | |||
| 1960 | return DIV_ROUND_UP(pri_val * 64, horiz_pixels * bytes_per_pixel) + 2; | 1960 | return DIV_ROUND_UP(pri_val * 64, horiz_pixels * bytes_per_pixel) + 2; |
| 1961 | } | 1961 | } |
| 1962 | 1962 | ||
| 1963 | struct skl_pipe_wm_parameters { | ||
| 1964 | bool active; | ||
| 1965 | uint32_t pipe_htotal; | ||
| 1966 | uint32_t pixel_rate; /* in KHz */ | ||
| 1967 | struct intel_plane_wm_parameters plane[I915_MAX_PLANES]; | ||
| 1968 | struct intel_plane_wm_parameters cursor; | ||
| 1969 | }; | ||
| 1970 | |||
| 1963 | struct ilk_pipe_wm_parameters { | 1971 | struct ilk_pipe_wm_parameters { |
| 1964 | bool active; | 1972 | bool active; |
| 1965 | uint32_t pipe_htotal; | 1973 | uint32_t pipe_htotal; |
| @@ -2271,11 +2279,82 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) · 305 unmodified lines | |||
| 2271 | PIPE_WM_LINETIME_TIME(linetime); | 2279 | PIPE_WM_LINETIME_TIME(linetime); |
| 2272 | } | 2280 | } |
| 2273 | 2281 | ||
| 2274 | static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[5]) | 2282 | static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8]) |
| 2275 | { | 2283 | { |
| 2276 | struct drm_i915_private *dev_priv = dev->dev_private; | 2284 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 2277 | 2285 | ||
| 2278 | if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { | 2286 | if (IS_GEN9(dev)) { |
| 2287 | uint32_t val; | ||
| 2288 | int ret, i; | ||
| 2289 | int level, max_level = ilk_wm_max_level(dev); | ||
| 2290 | |||
| 2291 | /* read the first set of memory latencies[0:3] */ | ||
| 2292 | val = 0; /* data0 to be programmed to 0 for first set */ | ||
| 2293 | mutex_lock(&dev_priv->rps.hw_lock); | ||
| 2294 | ret = sandybridge_pcode_read(dev_priv, | ||
| 2295 | GEN9_PCODE_READ_MEM_LATENCY, | ||
| 2296 | &val); | ||
| 2297 | mutex_unlock(&dev_priv->rps.hw_lock); | ||
| 2298 | |||
| 2299 | if (ret) { | ||
| 2300 | DRM_ERROR("SKL Mailbox read error = %d\n", ret); | ||
| 2301 | return; | ||
| 2302 | } | ||
| 2303 | |||
| 2304 | wm[0] = val & GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2305 | wm[1] = (val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) & | ||
| 2306 | GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2307 | wm[2] = (val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) & | ||
| 2308 | GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2309 | wm[3] = (val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) & | ||
| 2310 | GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2311 | |||
| 2312 | /* read the second set of memory latencies[4:7] */ | ||
| 2313 | val = 1; /* data0 to be programmed to 1 for second set */ | ||
| 2314 | mutex_lock(&dev_priv->rps.hw_lock); | ||
| 2315 | ret = sandybridge_pcode_read(dev_priv, | ||
| 2316 | GEN9_PCODE_READ_MEM_LATENCY, | ||
| 2317 | &val); | ||
| 2318 | mutex_unlock(&dev_priv->rps.hw_lock); | ||
| 2319 | if (ret) { | ||
| 2320 | DRM_ERROR("SKL Mailbox read error = %d\n", ret); | ||
| 2321 | return; | ||
| 2322 | } | ||
| 2323 | |||
| 2324 | wm[4] = val & GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2325 | wm[5] = (val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) & | ||
| 2326 | GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2327 | wm[6] = (val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) & | ||
| 2328 | GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2329 | wm[7] = (val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) & | ||
| 2330 | GEN9_MEM_LATENCY_LEVEL_MASK; | ||
| 2331 | |||
| 2332 | /* | ||
| 2333 | * punit doesn't take into account the read latency so we need | ||
| 2334 | * to add 2us to the various latency levels we retrieve from | ||
| 2335 | * the punit. | ||
| 2336 | * - W0 is a bit special in that it's the only level that | ||
| 2337 | * can't be disabled if we want to have display working, so | ||
| 2338 | * we always add 2us there. | ||
| 2339 | * - For levels >=1, punit returns 0us latency when they are | ||
| 2340 | * disabled, so we respect that and don't add 2us then | ||
| 2341 | * | ||
| 2342 | * Additionally, if a level n (n > 1) has a 0us latency, all | ||
| 2343 | * levels m (m >= n) need to be disabled. We make sure to | ||
| 2344 | * sanitize the values out of the punit to satisfy this | ||
| 2345 | * requirement. | ||
| 2346 | */ | ||
| 2347 | wm[0] += 2; | ||
| 2348 | for (level = 1; level <= max_level; level++) | ||
| 2349 | if (wm[level] != 0) | ||
| 2350 | wm[level] += 2; | ||
| 2351 | else { | ||
| 2352 | for (i = level + 1; i <= max_level; i++) | ||
| 2353 | wm[i] = 0; | ||
| 2354 | |||
| 2355 | break; | ||
| 2356 | } | ||
| 2357 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { | ||
| 2279 | uint64_t sskpd = I915_READ64(MCH_SSKPD); | 2358 | uint64_t sskpd = I915_READ64(MCH_SSKPD); |
| 2280 | 2359 | ||
| 2281 | wm[0] = (sskpd >> 56) & 0xFF; | 2360 | wm[0] = (sskpd >> 56) & 0xFF; |
| @@ -2323,7 +2402,9 @@ static void intel_fixup_cur_wm_latency(struct drm_device *dev, uint16_t wm[5]) · 41 unmodified lines | |||
| 2323 | int ilk_wm_max_level(const struct drm_device *dev) | 2402 | int ilk_wm_max_level(const struct drm_device *dev) |
| 2324 | { | 2403 | { |
| 2325 | /* how many WM levels are we expecting */ | 2404 | /* how many WM levels are we expecting */ |
| 2326 | if (IS_HASWELL(dev) || IS_BROADWELL(dev)) | 2405 | if (IS_GEN9(dev)) |
| 2406 | return 7; | ||
| 2407 | else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) | ||
| 2327 | return 4; | 2408 | return 4; |
| 2328 | else if (INTEL_INFO(dev)->gen >= 6) | 2409 | else if (INTEL_INFO(dev)->gen >= 6) |
| 2329 | return 3; | 2410 | return 3; |
| @@ -2333,7 +2414,7 @@ int ilk_wm_max_level(const struct drm_device *dev) · 3 unmodified lines | |||
| 2333 | 2414 | ||
| 2334 | static void intel_print_wm_latency(struct drm_device *dev, | 2415 | static void intel_print_wm_latency(struct drm_device *dev, |
| 2335 | const char *name, | 2416 | const char *name, |
| 2336 | const uint16_t wm[5]) | 2417 | const uint16_t wm[8]) |
| 2337 | { | 2418 | { |
| 2338 | int level, max_level = ilk_wm_max_level(dev); | 2419 | int level, max_level = ilk_wm_max_level(dev); |
| 2339 | 2420 | ||
| @@ -2346,8 +2427,13 @@ static void intel_print_wm_latency(struct drm_device *dev, · 6 unmodified lines | |||
| 2346 | continue; | 2427 | continue; |
| 2347 | } | 2428 | } |
| 2348 | 2429 | ||
| 2349 | /* WM1+ latency values in 0.5us units */ | 2430 | /* |
| 2350 | if (level > 0) | 2431 | * - latencies are in us on gen9. |
| 2432 | * - before then, WM1+ latency values are in 0.5us units | ||
| 2433 | */ | ||
| 2434 | if (IS_GEN9(dev)) | ||
| 2435 | latency *= 10; | ||
| 2436 | else if (level > 0) | ||
| 2351 | latency *= 5; | 2437 | latency *= 5; |
| 2352 | 2438 | ||
| 2353 | DRM_DEBUG_KMS("%s WM%d latency %u (%u.%u usec)\n", | 2439 | DRM_DEBUG_KMS("%s WM%d latency %u (%u.%u usec)\n", |
| @@ -2415,6 +2501,14 @@ static void ilk_setup_wm_latency(struct drm_device *dev) · 61 unmodified lines | |||
| 2415 | snb_wm_latency_quirk(dev); | 2501 | snb_wm_latency_quirk(dev); |
| 2416 | } | 2502 | } |
| 2417 | 2503 | ||
| 2504 | static void skl_setup_wm_latency(struct drm_device *dev) | ||
| 2505 | { | ||
| 2506 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 2507 | |||
| 2508 | intel_read_wm_latency(dev, dev_priv->wm.skl_latency); | ||
| 2509 | intel_print_wm_latency(dev, "Gen9 Plane", dev_priv->wm.skl_latency); | ||
| 2510 | } | ||
| 2511 | |||
| 2418 | static void ilk_compute_wm_parameters(struct drm_crtc *crtc, | 2512 | static void ilk_compute_wm_parameters(struct drm_crtc *crtc, |
| 2419 | struct ilk_pipe_wm_parameters *p) | 2513 | struct ilk_pipe_wm_parameters *p) |
| 2420 | { | 2514 | { |
| @@ -2905,6 +2999,769 @@ static bool ilk_disable_lp_wm(struct drm_device *dev) · 484 unmodified lines | |||
| 2905 | return _ilk_disable_lp_wm(dev_priv, WM_DIRTY_LP_ALL); | 2999 | return _ilk_disable_lp_wm(dev_priv, WM_DIRTY_LP_ALL); |
| 2906 | } | 3000 | } |
| 2907 | 3001 | ||
| 3002 | /* | ||
| 3003 | * On gen9, we need to allocate Display Data Buffer (DDB) portions to the | ||
| 3004 | * different active planes. | ||
| 3005 | */ | ||
| 3006 | |||
| 3007 | #define SKL_DDB_SIZE 896 /* in blocks */ | ||
| 3008 | |||
| 3009 | static void | ||
| 3010 | skl_ddb_get_pipe_allocation_limits(struct drm_device *dev, | ||
| 3011 | struct drm_crtc *for_crtc, | ||
| 3012 | const struct intel_wm_config *config, | ||
| 3013 | const struct skl_pipe_wm_parameters *params, | ||
| 3014 | struct skl_ddb_entry *alloc /* out */) | ||
| 3015 | { | ||
| 3016 | struct drm_crtc *crtc; | ||
| 3017 | unsigned int pipe_size, ddb_size; | ||
| 3018 | int nth_active_pipe; | ||
| 3019 | |||
| 3020 | if (!params->active) { | ||
| 3021 | alloc->start = 0; | ||
| 3022 | alloc->end = 0; | ||
| 3023 | return; | ||
| 3024 | } | ||
| 3025 | |||
| 3026 | ddb_size = SKL_DDB_SIZE; | ||
| 3027 | |||
| 3028 | ddb_size -= 4; /* 4 blocks for bypass path allocation */ | ||
| 3029 | |||
| 3030 | nth_active_pipe = 0; | ||
| 3031 | for_each_crtc(dev, crtc) { | ||
| 3032 | if (!intel_crtc_active(crtc)) | ||
| 3033 | continue; | ||
| 3034 | |||
| 3035 | if (crtc == for_crtc) | ||
| 3036 | break; | ||
| 3037 | |||
| 3038 | nth_active_pipe++; | ||
| 3039 | } | ||
| 3040 | |||
| 3041 | pipe_size = ddb_size / config->num_pipes_active; | ||
| 3042 | alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active; | ||
| 3043 | alloc->end = alloc->start + pipe_size; | ||
| 3044 | } | ||
| 3045 | |||
| 3046 | static unsigned int skl_cursor_allocation(const struct intel_wm_config *config) | ||
| 3047 | { | ||
| 3048 | if (config->num_pipes_active == 1) | ||
| 3049 | return 32; | ||
| 3050 | |||
| 3051 | return 8; | ||
| 3052 | } | ||
| 3053 | |||
| 3054 | static void skl_ddb_entry_init_from_hw(struct skl_ddb_entry *entry, u32 reg) | ||
| 3055 | { | ||
| 3056 | entry->start = reg & 0x3ff; | ||
| 3057 | entry->end = (reg >> 16) & 0x3ff; | ||
| 3058 | if (entry->end) | ||
| 3059 | entry->end += 1; | ||
| 3060 | } | ||
| 3061 | |||
| 3062 | void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, | ||
| 3063 | struct skl_ddb_allocation *ddb /* out */) | ||
| 3064 | { | ||
| 3065 | struct drm_device *dev = dev_priv->dev; | ||
| 3066 | enum pipe pipe; | ||
| 3067 | int plane; | ||
| 3068 | u32 val; | ||
| 3069 | |||
| 3070 | for_each_pipe(dev_priv, pipe) { | ||
| 3071 | for_each_plane(pipe, plane) { | ||
| 3072 | val = I915_READ(PLANE_BUF_CFG(pipe, plane)); | ||
| 3073 | skl_ddb_entry_init_from_hw(&ddb->plane[pipe][plane], | ||
| 3074 | val); | ||
| 3075 | } | ||
| 3076 | |||
| 3077 | val = I915_READ(CUR_BUF_CFG(pipe)); | ||
| 3078 | skl_ddb_entry_init_from_hw(&ddb->cursor[pipe], val); | ||
| 3079 | } | ||
| 3080 | } | ||
| 3081 | |||
| 3082 | static unsigned int | ||
| 3083 | skl_plane_relative_data_rate(const struct intel_plane_wm_parameters *p) | ||
| 3084 | { | ||
| 3085 | return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel; | ||
| 3086 | } | ||
| 3087 | |||
| 3088 | /* | ||
| 3089 | * We don't overflow 32 bits. Worst case is 3 planes enabled, each fetching | ||
| 3090 | * a 8192x4096@32bpp framebuffer: | ||
| 3091 | * 3 * 4096 * 8192 * 4 < 2^32 | ||
| 3092 | */ | ||
| 3093 | static unsigned int | ||
| 3094 | skl_get_total_relative_data_rate(struct intel_crtc *intel_crtc, | ||
| 3095 | const struct skl_pipe_wm_parameters *params) | ||
| 3096 | { | ||
| 3097 | unsigned int total_data_rate = 0; | ||
| 3098 | int plane; | ||
| 3099 | |||
| 3100 | for (plane = 0; plane < intel_num_planes(intel_crtc); plane++) { | ||
| 3101 | const struct intel_plane_wm_parameters *p; | ||
| 3102 | |||
| 3103 | p = ¶ms->plane[plane]; | ||
| 3104 | if (!p->enabled) | ||
| 3105 | continue; | ||
| 3106 | |||
| 3107 | total_data_rate += skl_plane_relative_data_rate(p); | ||
| 3108 | } | ||
| 3109 | |||
| 3110 | return total_data_rate; | ||
| 3111 | } | ||
| 3112 | |||
| 3113 | static void | ||
| 3114 | skl_allocate_pipe_ddb(struct drm_crtc *crtc, | ||
| 3115 | const struct intel_wm_config *config, | ||
| 3116 | const struct skl_pipe_wm_parameters *params, | ||
| 3117 | struct skl_ddb_allocation *ddb /* out */) | ||
| 3118 | { | ||
| 3119 | struct drm_device *dev = crtc->dev; | ||
| 3120 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 3121 | enum pipe pipe = intel_crtc->pipe; | ||
| 3122 | struct skl_ddb_entry *alloc = &ddb->pipe[pipe]; | ||
| 3123 | uint16_t alloc_size, start, cursor_blocks; | ||
| 3124 | unsigned int total_data_rate; | ||
| 3125 | int plane; | ||
| 3126 | |||
| 3127 | skl_ddb_get_pipe_allocation_limits(dev, crtc, config, params, alloc); | ||
| 3128 | alloc_size = skl_ddb_entry_size(alloc); | ||
| 3129 | if (alloc_size == 0) { | ||
| 3130 | memset(ddb->plane[pipe], 0, sizeof(ddb->plane[pipe])); | ||
| 3131 | memset(&ddb->cursor[pipe], 0, sizeof(ddb->cursor[pipe])); | ||
| 3132 | return; | ||
| 3133 | } | ||
| 3134 | |||
| 3135 | cursor_blocks = skl_cursor_allocation(config); | ||
| 3136 | ddb->cursor[pipe].start = alloc->end - cursor_blocks; | ||
| 3137 | ddb->cursor[pipe].end = alloc->end; | ||
| 3138 | |||
| 3139 | alloc_size -= cursor_blocks; | ||
| 3140 | alloc->end -= cursor_blocks; | ||
| 3141 | |||
| 3142 | /* | ||
| 3143 | * Each active plane get a portion of the remaining space, in | ||
| 3144 | * proportion to the amount of data they need to fetch from memory. | ||
| 3145 | * | ||
| 3146 | * FIXME: we may not allocate every single block here. | ||
| 3147 | */ | ||
| 3148 | total_data_rate = skl_get_total_relative_data_rate(intel_crtc, params); | ||
| 3149 | |||
| 3150 | start = alloc->start; | ||
| 3151 | for (plane = 0; plane < intel_num_planes(intel_crtc); plane++) { | ||
| 3152 | const struct intel_plane_wm_parameters *p; | ||
| 3153 | unsigned int data_rate; | ||
| 3154 | uint16_t plane_blocks; | ||
| 3155 | |||
| 3156 | p = ¶ms->plane[plane]; | ||
| 3157 | if (!p->enabled) | ||
| 3158 | continue; | ||
| 3159 | |||
| 3160 | data_rate = skl_plane_relative_data_rate(p); | ||
| 3161 | |||
| 3162 | /* | ||
| 3163 | * promote the expression to 64 bits to avoid overflowing, the | ||
| 3164 | * result is < available as data_rate / total_data_rate < 1 | ||
| 3165 | */ | ||
| 3166 | plane_blocks = div_u64((uint64_t)alloc_size * data_rate, | ||
| 3167 | total_data_rate); | ||
| 3168 | |||
| 3169 | ddb->plane[pipe][plane].start = start; | ||
| 3170 | ddb->plane[pipe][plane].end = start + plane_blocks; | ||
| 3171 | |||
| 3172 | start += plane_blocks; | ||
| 3173 | } | ||
| 3174 | |||
| 3175 | } | ||
| 3176 | |||
| 3177 | static uint32_t skl_pipe_pixel_rate(const struct intel_crtc_config *config) | ||
| 3178 | { | ||
| 3179 | /* TODO: Take into account the scalers once we support them */ | ||
| 3180 | return config->adjusted_mode.crtc_clock; | ||
| 3181 | } | ||
| 3182 | |||
| 3183 | /* | ||
| 3184 | * The max latency should be 257 (max the punit can code is 255 and we add 2us | ||
| 3185 | * for the read latency) and bytes_per_pixel should always be <= 8, so that | ||
| 3186 | * should allow pixel_rate up to ~2 GHz which seems sufficient since max | ||
| 3187 | * 2xcdclk is 1350 MHz and the pixel rate should never exceed that. | ||
| 3188 | */ | ||
| 3189 | static uint32_t skl_wm_method1(uint32_t pixel_rate, uint8_t bytes_per_pixel, | ||
| 3190 | uint32_t latency) | ||
| 3191 | { | ||
| 3192 | uint32_t wm_intermediate_val, ret; | ||
| 3193 | |||
| 3194 | if (latency == 0) | ||
| 3195 | return UINT_MAX; | ||
| 3196 | |||
| 3197 | wm_intermediate_val = latency * pixel_rate * bytes_per_pixel; | ||
| 3198 | ret = DIV_ROUND_UP(wm_intermediate_val, 1000); | ||
| 3199 | |||
| 3200 | return ret; | ||
| 3201 | } | ||
| 3202 | |||
| 3203 | static uint32_t skl_wm_method2(uint32_t pixel_rate, uint32_t pipe_htotal, | ||
| 3204 | uint32_t horiz_pixels, uint8_t bytes_per_pixel, | ||
| 3205 | uint32_t latency) | ||
| 3206 | { | ||
| 3207 | uint32_t ret, plane_bytes_per_line, wm_intermediate_val; | ||
| 3208 | |||
| 3209 | if (latency == 0) | ||
| 3210 | return UINT_MAX; | ||
| 3211 | |||
| 3212 | plane_bytes_per_line = horiz_pixels * bytes_per_pixel; | ||
| 3213 | wm_intermediate_val = latency * pixel_rate; | ||
| 3214 | ret = DIV_ROUND_UP(wm_intermediate_val, pipe_htotal * 1000) * | ||
| 3215 | plane_bytes_per_line; | ||
| 3216 | |||
| 3217 | return ret; | ||
| 3218 | } | ||
| 3219 | |||
| 3220 | static bool skl_ddb_allocation_changed(const struct skl_ddb_allocation *new_ddb, | ||
| 3221 | const struct intel_crtc *intel_crtc) | ||
| 3222 | { | ||
| 3223 | struct drm_device *dev = intel_crtc->base.dev; | ||
| 3224 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3225 | const struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb; | ||
| 3226 | enum pipe pipe = intel_crtc->pipe; | ||
| 3227 | |||
| 3228 | if (memcmp(new_ddb->plane[pipe], cur_ddb->plane[pipe], | ||
| 3229 | sizeof(new_ddb->plane[pipe]))) | ||
| 3230 | return true; | ||
| 3231 | |||
| 3232 | if (memcmp(&new_ddb->cursor[pipe], &cur_ddb->cursor[pipe], | ||
| 3233 | sizeof(new_ddb->cursor[pipe]))) | ||
| 3234 | return true; | ||
| 3235 | |||
| 3236 | return false; | ||
| 3237 | } | ||
| 3238 | |||
| 3239 | static void skl_compute_wm_global_parameters(struct drm_device *dev, | ||
| 3240 | struct intel_wm_config *config) | ||
| 3241 | { | ||
| 3242 | struct drm_crtc *crtc; | ||
| 3243 | struct drm_plane *plane; | ||
| 3244 | |||
| 3245 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | ||
| 3246 | config->num_pipes_active += intel_crtc_active(crtc); | ||
| 3247 | |||
| 3248 | /* FIXME: I don't think we need those two global parameters on SKL */ | ||
| 3249 | list_for_each_entry(plane, &dev->mode_config.plane_list, head) { | ||
| 3250 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 3251 | |||
| 3252 | config->sprites_enabled |= intel_plane->wm.enabled; | ||
| 3253 | config->sprites_scaled |= intel_plane->wm.scaled; | ||
| 3254 | } | ||
| 3255 | } | ||
| 3256 | |||
| 3257 | static void skl_compute_wm_pipe_parameters(struct drm_crtc *crtc, | ||
| 3258 | struct skl_pipe_wm_parameters *p) | ||
| 3259 | { | ||
| 3260 | struct drm_device *dev = crtc->dev; | ||
| 3261 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 3262 | enum pipe pipe = intel_crtc->pipe; | ||
| 3263 | struct drm_plane *plane; | ||
| 3264 | int i = 1; /* Index for sprite planes start */ | ||
| 3265 | |||
| 3266 | p->active = intel_crtc_active(crtc); | ||
| 3267 | if (p->active) { | ||
| 3268 | p->pipe_htotal = intel_crtc->config.adjusted_mode.crtc_htotal; | ||
| 3269 | p->pixel_rate = skl_pipe_pixel_rate(&intel_crtc->config); | ||
| 3270 | |||
| 3271 | /* | ||
| 3272 | * For now, assume primary and cursor planes are always enabled. | ||
| 3273 | */ | ||
| 3274 | p->plane[0].enabled = true; | ||
| 3275 | p->plane[0].bytes_per_pixel = | ||
| 3276 | crtc->primary->fb->bits_per_pixel / 8; | ||
| 3277 | p->plane[0].horiz_pixels = intel_crtc->config.pipe_src_w; | ||
| 3278 | p->plane[0].vert_pixels = intel_crtc->config.pipe_src_h; | ||
| 3279 | |||
| 3280 | p->cursor.enabled = true; | ||
| 3281 | p->cursor.bytes_per_pixel = 4; | ||
| 3282 | p->cursor.horiz_pixels = intel_crtc->cursor_width ? | ||
| 3283 | intel_crtc->cursor_width : 64; | ||
| 3284 | } | ||
| 3285 | |||
| 3286 | list_for_each_entry(plane, &dev->mode_config.plane_list, head) { | ||
| 3287 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 3288 | |||
| 3289 | if (intel_plane->pipe == pipe) | ||
| 3290 | p->plane[i++] = intel_plane->wm; | ||
| 3291 | } | ||
| 3292 | } | ||
| 3293 | |||
| 3294 | static bool skl_compute_plane_wm(struct skl_pipe_wm_parameters *p, | ||
| 3295 | struct intel_plane_wm_parameters *p_params, | ||
| 3296 | uint16_t ddb_allocation, | ||
| 3297 | uint32_t mem_value, | ||
| 3298 | uint16_t *out_blocks, /* out */ | ||
| 3299 | uint8_t *out_lines /* out */) | ||
| 3300 | { | ||
| 3301 | uint32_t method1, method2, plane_bytes_per_line, res_blocks, res_lines; | ||
| 3302 | uint32_t result_bytes; | ||
| 3303 | |||
| 3304 | if (mem_value == 0 || !p->active || !p_params->enabled) | ||
| 3305 | return false; | ||
| 3306 | |||
| 3307 | method1 = skl_wm_method1(p->pixel_rate, | ||
| 3308 | p_params->bytes_per_pixel, | ||
| 3309 | mem_value); | ||
| 3310 | method2 = skl_wm_method2(p->pixel_rate, | ||
| 3311 | p->pipe_htotal, | ||
| 3312 | p_params->horiz_pixels, | ||
| 3313 | p_params->bytes_per_pixel, | ||
| 3314 | mem_value); | ||
| 3315 | |||
| 3316 | plane_bytes_per_line = p_params->horiz_pixels * | ||
| 3317 | p_params->bytes_per_pixel; | ||
| 3318 | |||
| 3319 | /* For now xtile and linear */ | ||
| 3320 | if (((ddb_allocation * 512) / plane_bytes_per_line) >= 1) | ||
| 3321 | result_bytes = min(method1, method2); | ||
| 3322 | else | ||
| 3323 | result_bytes = method1; | ||
| 3324 | |||
| 3325 | res_blocks = DIV_ROUND_UP(result_bytes, 512) + 1; | ||
| 3326 | res_lines = DIV_ROUND_UP(result_bytes, plane_bytes_per_line); | ||
| 3327 | |||
| 3328 | if (res_blocks > ddb_allocation || res_lines > 31) | ||
| 3329 | return false; | ||
| 3330 | |||
| 3331 | *out_blocks = res_blocks; | ||
| 3332 | *out_lines = res_lines; | ||
| 3333 | |||
| 3334 | return true; | ||
| 3335 | } | ||
| 3336 | |||
| 3337 | static void skl_compute_wm_level(const struct drm_i915_private *dev_priv, | ||
| 3338 | struct skl_ddb_allocation *ddb, | ||
| 3339 | struct skl_pipe_wm_parameters *p, | ||
| 3340 | enum pipe pipe, | ||
| 3341 | int level, | ||
| 3342 | int num_planes, | ||
| 3343 | struct skl_wm_level *result) | ||
| 3344 | { | ||
| 3345 | uint16_t latency = dev_priv->wm.skl_latency[level]; | ||
| 3346 | uint16_t ddb_blocks; | ||
| 3347 | int i; | ||
| 3348 | |||
| 3349 | for (i = 0; i < num_planes; i++) { | ||
| 3350 | ddb_blocks = skl_ddb_entry_size(&ddb->plane[pipe][i]); | ||
| 3351 | |||
| 3352 | result->plane_en[i] = skl_compute_plane_wm(p, &p->plane[i], | ||
| 3353 | ddb_blocks, | ||
| 3354 | latency, | ||
| 3355 | &result->plane_res_b[i], | ||
| 3356 | &result->plane_res_l[i]); | ||
| 3357 | } | ||
| 3358 | |||
| 3359 | ddb_blocks = skl_ddb_entry_size(&ddb->cursor[pipe]); | ||
| 3360 | result->cursor_en = skl_compute_plane_wm(p, &p->cursor, ddb_blocks, | ||
| 3361 | latency, &result->cursor_res_b, | ||
| 3362 | &result->cursor_res_l); | ||
| 3363 | } | ||
| 3364 | |||
| 3365 | static uint32_t | ||
| 3366 | skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p) | ||
| 3367 | { | ||
| 3368 | if (!intel_crtc_active(crtc)) | ||
| 3369 | return 0; | ||
| 3370 | |||
| 3371 | return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate); | ||
| 3372 | |||
| 3373 | } | ||
| 3374 | |||
| 3375 | static void skl_compute_transition_wm(struct drm_crtc *crtc, | ||
| 3376 | struct skl_pipe_wm_parameters *params, | ||
| 3377 | struct skl_wm_level *trans_wm /* out */) | ||
| 3378 | { | ||
| 3379 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 3380 | int i; | ||
| 3381 | |||
| 3382 | if (!params->active) | ||
| 3383 | return; | ||
| 3384 | |||
| 3385 | /* Until we know more, just disable transition WMs */ | ||
| 3386 | for (i = 0; i < intel_num_planes(intel_crtc); i++) | ||
| 3387 | trans_wm->plane_en[i] = false; | ||
| 3388 | trans_wm->cursor_en = false; | ||
| 3389 | } | ||
| 3390 | |||
| 3391 | static void skl_compute_pipe_wm(struct drm_crtc *crtc, | ||
| 3392 | struct skl_ddb_allocation *ddb, | ||
| 3393 | struct skl_pipe_wm_parameters *params, | ||
| 3394 | struct skl_pipe_wm *pipe_wm) | ||
| 3395 | { | ||
| 3396 | struct drm_device *dev = crtc->dev; | ||
| 3397 | const struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3398 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 3399 | int level, max_level = ilk_wm_max_level(dev); | ||
| 3400 | |||
| 3401 | for (level = 0; level <= max_level; level++) { | ||
| 3402 | skl_compute_wm_level(dev_priv, ddb, params, intel_crtc->pipe, | ||
| 3403 | level, intel_num_planes(intel_crtc), | ||
| 3404 | &pipe_wm->wm[level]); | ||
| 3405 | } | ||
| 3406 | pipe_wm->linetime = skl_compute_linetime_wm(crtc, params); | ||
| 3407 | |||
| 3408 | skl_compute_transition_wm(crtc, params, &pipe_wm->trans_wm); | ||
| 3409 | } | ||
| 3410 | |||
| 3411 | static void skl_compute_wm_results(struct drm_device *dev, | ||
| 3412 | struct skl_pipe_wm_parameters *p, | ||
| 3413 | struct skl_pipe_wm *p_wm, | ||
| 3414 | struct skl_wm_values *r, | ||
| 3415 | struct intel_crtc *intel_crtc) | ||
| 3416 | { | ||
| 3417 | int level, max_level = ilk_wm_max_level(dev); | ||
| 3418 | enum pipe pipe = intel_crtc->pipe; | ||
| 3419 | uint32_t temp; | ||
| 3420 | int i; | ||
| 3421 | |||
| 3422 | for (level = 0; level <= max_level; level++) { | ||
| 3423 | for (i = 0; i < intel_num_planes(intel_crtc); i++) { | ||
| 3424 | temp = 0; | ||
| 3425 | |||
| 3426 | temp |= p_wm->wm[level].plane_res_l[i] << | ||
| 3427 | PLANE_WM_LINES_SHIFT; | ||
| 3428 | temp |= p_wm->wm[level].plane_res_b[i]; | ||
| 3429 | if (p_wm->wm[level].plane_en[i]) | ||
| 3430 | temp |= PLANE_WM_EN; | ||
| 3431 | |||
| 3432 | r->plane[pipe][i][level] = temp; | ||
| 3433 | } | ||
| 3434 | |||
| 3435 | temp = 0; | ||
| 3436 | |||
| 3437 | temp |= p_wm->wm[level].cursor_res_l << PLANE_WM_LINES_SHIFT; | ||
| 3438 | temp |= p_wm->wm[level].cursor_res_b; | ||
| 3439 | |||
| 3440 | if (p_wm->wm[level].cursor_en) | ||
| 3441 | temp |= PLANE_WM_EN; | ||
| 3442 | |||
| 3443 | r->cursor[pipe][level] = temp; | ||
| 3444 | |||
| 3445 | } | ||
| 3446 | |||
| 3447 | /* transition WMs */ | ||
| 3448 | for (i = 0; i < intel_num_planes(intel_crtc); i++) { | ||
| 3449 | temp = 0; | ||
| 3450 | temp |= p_wm->trans_wm.plane_res_l[i] << PLANE_WM_LINES_SHIFT; | ||
| 3451 | temp |= p_wm->trans_wm.plane_res_b[i]; | ||
| 3452 | if (p_wm->trans_wm.plane_en[i]) | ||
| 3453 | temp |= PLANE_WM_EN; | ||
| 3454 | |||
| 3455 | r->plane_trans[pipe][i] = temp; | ||
| 3456 | } | ||
| 3457 | |||
| 3458 | temp = 0; | ||
| 3459 | temp |= p_wm->trans_wm.cursor_res_l << PLANE_WM_LINES_SHIFT; | ||
| 3460 | temp |= p_wm->trans_wm.cursor_res_b; | ||
| 3461 | if (p_wm->trans_wm.cursor_en) | ||
| 3462 | temp |= PLANE_WM_EN; | ||
| 3463 | |||
| 3464 | r->cursor_trans[pipe] = temp; | ||
| 3465 | |||
| 3466 | r->wm_linetime[pipe] = p_wm->linetime; | ||
| 3467 | } | ||
| 3468 | |||
| 3469 | static void skl_ddb_entry_write(struct drm_i915_private *dev_priv, uint32_t reg, | ||
| 3470 | const struct skl_ddb_entry *entry) | ||
| 3471 | { | ||
| 3472 | if (entry->end) | ||
| 3473 | I915_WRITE(reg, (entry->end - 1) << 16 | entry->start); | ||
| 3474 | else | ||
| 3475 | I915_WRITE(reg, 0); | ||
| 3476 | } | ||
| 3477 | |||
| 3478 | static void skl_write_wm_values(struct drm_i915_private *dev_priv, | ||
| 3479 | const struct skl_wm_values *new) | ||
| 3480 | { | ||
| 3481 | struct drm_device *dev = dev_priv->dev; | ||
| 3482 | struct intel_crtc *crtc; | ||
| 3483 | |||
| 3484 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) { | ||
| 3485 | int i, level, max_level = ilk_wm_max_level(dev); | ||
| 3486 | enum pipe pipe = crtc->pipe; | ||
| 3487 | |||
| 3488 | if (!new->dirty[pipe]) | ||
| 3489 | continue; | ||
| 3490 | |||
| 3491 | I915_WRITE(PIPE_WM_LINETIME(pipe), new->wm_linetime[pipe]); | ||
| 3492 | |||
| 3493 | for (level = 0; level <= max_level; level++) { | ||
| 3494 | for (i = 0; i < intel_num_planes(crtc); i++) | ||
| 3495 | I915_WRITE(PLANE_WM(pipe, i, level), | ||
| 3496 | new->plane[pipe][i][level]); | ||
| 3497 | I915_WRITE(CUR_WM(pipe, level), | ||
| 3498 | new->cursor[pipe][level]); | ||
| 3499 | } | ||
| 3500 | for (i = 0; i < intel_num_planes(crtc); i++) | ||
| 3501 | I915_WRITE(PLANE_WM_TRANS(pipe, i), | ||
| 3502 | new->plane_trans[pipe][i]); | ||
| 3503 | I915_WRITE(CUR_WM_TRANS(pipe), new->cursor_trans[pipe]); | ||
| 3504 | |||
| 3505 | for (i = 0; i < intel_num_planes(crtc); i++) | ||
| 3506 | skl_ddb_entry_write(dev_priv, | ||
| 3507 | PLANE_BUF_CFG(pipe, i), | ||
| 3508 | &new->ddb.plane[pipe][i]); | ||
| 3509 | |||
| 3510 | skl_ddb_entry_write(dev_priv, CUR_BUF_CFG(pipe), | ||
| 3511 | &new->ddb.cursor[pipe]); | ||
| 3512 | } | ||
| 3513 | } | ||
| 3514 | |||
| 3515 | /* | ||
| 3516 | * When setting up a new DDB allocation arrangement, we need to correctly | ||
| 3517 | * sequence the times at which the new allocations for the pipes are taken into | ||
| 3518 | * account or we'll have pipes fetching from space previously allocated to | ||
| 3519 | * another pipe. | ||
| 3520 | * | ||
| 3521 | * Roughly the sequence looks like: | ||
| 3522 | * 1. re-allocate the pipe(s) with the allocation being reduced and not | ||
| 3523 | * overlapping with a previous light-up pipe (another way to put it is: | ||
| 3524 | * pipes with their new allocation strickly included into their old ones). | ||
| 3525 | * 2. re-allocate the other pipes that get their allocation reduced | ||
| 3526 | * 3. allocate the pipes having their allocation increased | ||
| 3527 | * | ||
| 3528 | * Steps 1. and 2. are here to take care of the following case: | ||
| 3529 | * - Initially DDB looks like this: | ||
| 3530 | * | B | C | | ||
| 3531 | * - enable pipe A. | ||
| 3532 | * - pipe B has a reduced DDB allocation that overlaps with the old pipe C | ||
| 3533 | * allocation | ||
| 3534 | * | A | B | C | | ||
| 3535 | * | ||
| 3536 | * We need to sequence the re-allocation: C, B, A (and not B, C, A). | ||
| 3537 | */ | ||
| 3538 | |||
| 3539 | static void | ||
| 3540 | skl_wm_flush_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, int pass) | ||
| 3541 | { | ||
| 3542 | struct drm_device *dev = dev_priv->dev; | ||
| 3543 | int plane; | ||
| 3544 | |||
| 3545 | DRM_DEBUG_KMS("flush pipe %c (pass %d)\n", pipe_name(pipe), pass); | ||
| 3546 | |||
| 3547 | for_each_plane(pipe, plane) { | ||
| 3548 | I915_WRITE(PLANE_SURF(pipe, plane), | ||
| 3549 | I915_READ(PLANE_SURF(pipe, plane))); | ||
| 3550 | } | ||
| 3551 | I915_WRITE(CURBASE(pipe), I915_READ(CURBASE(pipe))); | ||
| 3552 | } | ||
| 3553 | |||
| 3554 | static bool | ||
| 3555 | skl_ddb_allocation_included(const struct skl_ddb_allocation *old, | ||
| 3556 | const struct skl_ddb_allocation *new, | ||
| 3557 | enum pipe pipe) | ||
| 3558 | { | ||
| 3559 | uint16_t old_size, new_size; | ||
| 3560 | |||
| 3561 | old_size = skl_ddb_entry_size(&old->pipe[pipe]); | ||
| 3562 | new_size = skl_ddb_entry_size(&new->pipe[pipe]); | ||
| 3563 | |||
| 3564 | return old_size != new_size && | ||
| 3565 | new->pipe[pipe].start >= old->pipe[pipe].start && | ||
| 3566 | new->pipe[pipe].end <= old->pipe[pipe].end; | ||
| 3567 | } | ||
| 3568 | |||
| 3569 | static void skl_flush_wm_values(struct drm_i915_private *dev_priv, | ||
| 3570 | struct skl_wm_values *new_values) | ||
| 3571 | { | ||
| 3572 | struct drm_device *dev = dev_priv->dev; | ||
| 3573 | struct skl_ddb_allocation *cur_ddb, *new_ddb; | ||
| 3574 | bool reallocated[I915_MAX_PIPES] = {false, false, false}; | ||
| 3575 | struct intel_crtc *crtc; | ||
| 3576 | enum pipe pipe; | ||
| 3577 | |||
| 3578 | new_ddb = &new_values->ddb; | ||
| 3579 | cur_ddb = &dev_priv->wm.skl_hw.ddb; | ||
| 3580 | |||
| 3581 | /* | ||
| 3582 | * First pass: flush the pipes with the new allocation contained into | ||
| 3583 | * the old space. | ||
| 3584 | * | ||
| 3585 | * We'll wait for the vblank on those pipes to ensure we can safely | ||
| 3586 | * re-allocate the freed space without this pipe fetching from it. | ||
| 3587 | */ | ||
| 3588 | for_each_intel_crtc(dev, crtc) { | ||
| 3589 | if (!crtc->active) | ||
| 3590 | continue; | ||
| 3591 | |||
| 3592 | pipe = crtc->pipe; | ||
| 3593 | |||
| 3594 | if (!skl_ddb_allocation_included(cur_ddb, new_ddb, pipe)) | ||
| 3595 | continue; | ||
| 3596 | |||
| 3597 | skl_wm_flush_pipe(dev_priv, pipe, 1); | ||
| 3598 | intel_wait_for_vblank(dev, pipe); | ||
| 3599 | |||
| 3600 | reallocated[pipe] = true; | ||
| 3601 | } | ||
| 3602 | |||
| 3603 | |||
| 3604 | /* | ||
| 3605 | * Second pass: flush the pipes that are having their allocation | ||
| 3606 | * reduced, but overlapping with a previous allocation. | ||
| 3607 | * | ||
| 3608 | * Here as well we need to wait for the vblank to make sure the freed | ||
| 3609 | * space is not used anymore. | ||
| 3610 | */ | ||
| 3611 | for_each_intel_crtc(dev, crtc) { | ||
| 3612 | if (!crtc->active) | ||
| 3613 | continue; | ||
| 3614 | |||
| 3615 | pipe = crtc->pipe; | ||
| 3616 | |||
| 3617 | if (reallocated[pipe]) | ||
| 3618 | continue; | ||
| 3619 | |||
| 3620 | if (skl_ddb_entry_size(&new_ddb->pipe[pipe]) < | ||
| 3621 | skl_ddb_entry_size(&cur_ddb->pipe[pipe])) { | ||
| 3622 | skl_wm_flush_pipe(dev_priv, pipe, 2); | ||
| 3623 | intel_wait_for_vblank(dev, pipe); | ||
| 3624 | } | ||
| 3625 | |||
| 3626 | reallocated[pipe] = true; | ||
| 3627 | } | ||
| 3628 | |||
| 3629 | /* | ||
| 3630 | * Third pass: flush the pipes that got more space allocated. | ||
| 3631 | * | ||
| 3632 | * We don't need to actively wait for the update here, next vblank | ||
| 3633 | * will just get more DDB space with the correct WM values. | ||
| 3634 | */ | ||
| 3635 | for_each_intel_crtc(dev, crtc) { | ||
| 3636 | if (!crtc->active) | ||
| 3637 | continue; | ||
| 3638 | |||
| 3639 | pipe = crtc->pipe; | ||
| 3640 | |||
| 3641 | /* | ||
| 3642 | * At this point, only the pipes more space than before are | ||
| 3643 | * left to re-allocate. | ||
| 3644 | */ | ||
| 3645 | if (reallocated[pipe]) | ||
| 3646 | continue; | ||
| 3647 | |||
| 3648 | skl_wm_flush_pipe(dev_priv, pipe, 3); | ||
| 3649 | } | ||
| 3650 | } | ||
| 3651 | |||
| 3652 | static bool skl_update_pipe_wm(struct drm_crtc *crtc, | ||
| 3653 | struct skl_pipe_wm_parameters *params, | ||
| 3654 | struct intel_wm_config *config, | ||
| 3655 | struct skl_ddb_allocation *ddb, /* out */ | ||
| 3656 | struct skl_pipe_wm *pipe_wm /* out */) | ||
| 3657 | { | ||
| 3658 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 3659 | |||
| 3660 | skl_compute_wm_pipe_parameters(crtc, params); | ||
| 3661 | skl_allocate_pipe_ddb(crtc, config, params, ddb); | ||
| 3662 | skl_compute_pipe_wm(crtc, ddb, params, pipe_wm); | ||
| 3663 | |||
| 3664 | if (!memcmp(&intel_crtc->wm.skl_active, pipe_wm, sizeof(*pipe_wm))) | ||
| 3665 | return false; | ||
| 3666 | |||
| 3667 | intel_crtc->wm.skl_active = *pipe_wm; | ||
| 3668 | return true; | ||
| 3669 | } | ||
| 3670 | |||
| 3671 | static void skl_update_other_pipe_wm(struct drm_device *dev, | ||
| 3672 | struct drm_crtc *crtc, | ||
| 3673 | struct intel_wm_config *config, | ||
| 3674 | struct skl_wm_values *r) | ||
| 3675 | { | ||
| 3676 | struct intel_crtc *intel_crtc; | ||
| 3677 | struct intel_crtc *this_crtc = to_intel_crtc(crtc); | ||
| 3678 | |||
| 3679 | /* | ||
| 3680 | * If the WM update hasn't changed the allocation for this_crtc (the | ||
| 3681 | * crtc we are currently computing the new WM values for), other | ||
| 3682 | * enabled crtcs will keep the same allocation and we don't need to | ||
| 3683 | * recompute anything for them. | ||
| 3684 | */ | ||
| 3685 | if (!skl_ddb_allocation_changed(&r->ddb, this_crtc)) | ||
| 3686 | return; | ||
| 3687 | |||
| 3688 | /* | ||
| 3689 | * Otherwise, because of this_crtc being freshly enabled/disabled, the | ||
| 3690 | * other active pipes need new DDB allocation and WM values. | ||
| 3691 | */ | ||
| 3692 | list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, | ||
| 3693 | base.head) { | ||
| 3694 | struct skl_pipe_wm_parameters params = {}; | ||
| 3695 | struct skl_pipe_wm pipe_wm = {}; | ||
| 3696 | bool wm_changed; | ||
| 3697 | |||
| 3698 | if (this_crtc->pipe == intel_crtc->pipe) | ||
| 3699 | continue; | ||
| 3700 | |||
| 3701 | if (!intel_crtc->active) | ||
| 3702 | continue; | ||
| 3703 | |||
| 3704 | wm_changed = skl_update_pipe_wm(&intel_crtc->base, | ||
| 3705 | ¶ms, config, | ||
| 3706 | &r->ddb, &pipe_wm); | ||
| 3707 | |||
| 3708 | /* | ||
| 3709 | * If we end up re-computing the other pipe WM values, it's | ||
| 3710 | * because it was really needed, so we expect the WM values to | ||
| 3711 | * be different. | ||
| 3712 | */ | ||
| 3713 | WARN_ON(!wm_changed); | ||
| 3714 | |||
| 3715 | skl_compute_wm_results(dev, ¶ms, &pipe_wm, r, intel_crtc); | ||
| 3716 | r->dirty[intel_crtc->pipe] = true; | ||
| 3717 | } | ||
| 3718 | } | ||
| 3719 | |||
| 3720 | static void skl_update_wm(struct drm_crtc *crtc) | ||
| 3721 | { | ||
| 3722 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 3723 | struct drm_device *dev = crtc->dev; | ||
| 3724 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3725 | struct skl_pipe_wm_parameters params = {}; | ||
| 3726 | struct skl_wm_values *results = &dev_priv->wm.skl_results; | ||
| 3727 | struct skl_pipe_wm pipe_wm = {}; | ||
| 3728 | struct intel_wm_config config = {}; | ||
| 3729 | |||
| 3730 | memset(results, 0, sizeof(*results)); | ||
| 3731 | |||
| 3732 | skl_compute_wm_global_parameters(dev, &config); | ||
| 3733 | |||
| 3734 | if (!skl_update_pipe_wm(crtc, ¶ms, &config, | ||
| 3735 | &results->ddb, &pipe_wm)) | ||
| 3736 | return; | ||
| 3737 | |||
| 3738 | skl_compute_wm_results(dev, ¶ms, &pipe_wm, results, intel_crtc); | ||
| 3739 | results->dirty[intel_crtc->pipe] = true; | ||
| 3740 | |||
| 3741 | skl_update_other_pipe_wm(dev, crtc, &config, results); | ||
| 3742 | skl_write_wm_values(dev_priv, results); | ||
| 3743 | skl_flush_wm_values(dev_priv, results); | ||
| 3744 | |||
| 3745 | /* store the new configuration */ | ||
| 3746 | dev_priv->wm.skl_hw = *results; | ||
| 3747 | } | ||
| 3748 | |||
| 3749 | static void | ||
| 3750 | skl_update_sprite_wm(struct drm_plane *plane, struct drm_crtc *crtc, | ||
| 3751 | uint32_t sprite_width, uint32_t sprite_height, | ||
| 3752 | int pixel_size, bool enabled, bool scaled) | ||
| 3753 | { | ||
| 3754 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 3755 | |||
| 3756 | intel_plane->wm.enabled = enabled; | ||
| 3757 | intel_plane->wm.scaled = scaled; | ||
| 3758 | intel_plane->wm.horiz_pixels = sprite_width; | ||
| 3759 | intel_plane->wm.vert_pixels = sprite_height; | ||
| 3760 | intel_plane->wm.bytes_per_pixel = pixel_size; | ||
| 3761 | |||
| 3762 | skl_update_wm(crtc); | ||
| 3763 | } | ||
| 3764 | |||
| 2908 | static void ilk_update_wm(struct drm_crtc *crtc) | 3765 | static void ilk_update_wm(struct drm_crtc *crtc) |
| 2909 | { | 3766 | { |
| 2910 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 3767 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| @@ -2979,6 +3836,113 @@ ilk_update_sprite_wm(struct drm_plane *plane, · 68 unmodified lines | |||
| 2979 | ilk_update_wm(crtc); | 3836 | ilk_update_wm(crtc); |
| 2980 | } | 3837 | } |
| 2981 | 3838 | ||
| 3839 | static void skl_pipe_wm_active_state(uint32_t val, | ||
| 3840 | struct skl_pipe_wm *active, | ||
| 3841 | bool is_transwm, | ||
| 3842 | bool is_cursor, | ||
| 3843 | int i, | ||
| 3844 | int level) | ||
| 3845 | { | ||
| 3846 | bool is_enabled = (val & PLANE_WM_EN) != 0; | ||
| 3847 | |||
| 3848 | if (!is_transwm) { | ||
| 3849 | if (!is_cursor) { | ||
| 3850 | active->wm[level].plane_en[i] = is_enabled; | ||
| 3851 | active->wm[level].plane_res_b[i] = | ||
| 3852 | val & PLANE_WM_BLOCKS_MASK; | ||
| 3853 | active->wm[level].plane_res_l[i] = | ||
| 3854 | (val >> PLANE_WM_LINES_SHIFT) & | ||
| 3855 | PLANE_WM_LINES_MASK; | ||
| 3856 | } else { | ||
| 3857 | active->wm[level].cursor_en = is_enabled; | ||
| 3858 | active->wm[level].cursor_res_b = | ||
| 3859 | val & PLANE_WM_BLOCKS_MASK; | ||
| 3860 | active->wm[level].cursor_res_l = | ||
| 3861 | (val >> PLANE_WM_LINES_SHIFT) & | ||
| 3862 | PLANE_WM_LINES_MASK; | ||
| 3863 | } | ||
| 3864 | } else { | ||
| 3865 | if (!is_cursor) { | ||
| 3866 | active->trans_wm.plane_en[i] = is_enabled; | ||
| 3867 | active->trans_wm.plane_res_b[i] = | ||
| 3868 | val & PLANE_WM_BLOCKS_MASK; | ||
| 3869 | active->trans_wm.plane_res_l[i] = | ||
| 3870 | (val >> PLANE_WM_LINES_SHIFT) & | ||
| 3871 | PLANE_WM_LINES_MASK; | ||
| 3872 | } else { | ||
| 3873 | active->trans_wm.cursor_en = is_enabled; | ||
| 3874 | active->trans_wm.cursor_res_b = | ||
| 3875 | val & PLANE_WM_BLOCKS_MASK; | ||
| 3876 | active->trans_wm.cursor_res_l = | ||
| 3877 | (val >> PLANE_WM_LINES_SHIFT) & | ||
| 3878 | PLANE_WM_LINES_MASK; | ||
| 3879 | } | ||
| 3880 | } | ||
| 3881 | } | ||
| 3882 | |||
| 3883 | static void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc) | ||
| 3884 | { | ||
| 3885 | struct drm_device *dev = crtc->dev; | ||
| 3886 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3887 | struct skl_wm_values *hw = &dev_priv->wm.skl_hw; | ||
| 3888 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 3889 | struct skl_pipe_wm *active = &intel_crtc->wm.skl_active; | ||
| 3890 | enum pipe pipe = intel_crtc->pipe; | ||
| 3891 | int level, i, max_level; | ||
| 3892 | uint32_t temp; | ||
| 3893 | |||
| 3894 | max_level = ilk_wm_max_level(dev); | ||
| 3895 | |||
| 3896 | hw->wm_linetime[pipe] = I915_READ(PIPE_WM_LINETIME(pipe)); | ||
| 3897 | |||
| 3898 | for (level = 0; level <= max_level; level++) { | ||
| 3899 | for (i = 0; i < intel_num_planes(intel_crtc); i++) | ||
| 3900 | hw->plane[pipe][i][level] = | ||
| 3901 | I915_READ(PLANE_WM(pipe, i, level)); | ||
| 3902 | hw->cursor[pipe][level] = I915_READ(CUR_WM(pipe, level)); | ||
| 3903 | } | ||
| 3904 | |||
| 3905 | for (i = 0; i < intel_num_planes(intel_crtc); i++) | ||
| 3906 | hw->plane_trans[pipe][i] = I915_READ(PLANE_WM_TRANS(pipe, i)); | ||
| 3907 | hw->cursor_trans[pipe] = I915_READ(CUR_WM_TRANS(pipe)); | ||
| 3908 | |||
| 3909 | if (!intel_crtc_active(crtc)) | ||
| 3910 | return; | ||
| 3911 | |||
| 3912 | hw->dirty[pipe] = true; | ||
| 3913 | |||
| 3914 | active->linetime = hw->wm_linetime[pipe]; | ||
| 3915 | |||
| 3916 | for (level = 0; level <= max_level; level++) { | ||
| 3917 | for (i = 0; i < intel_num_planes(intel_crtc); i++) { | ||
| 3918 | temp = hw->plane[pipe][i][level]; | ||
| 3919 | skl_pipe_wm_active_state(temp, active, false, | ||
| 3920 | false, i, level); | ||
| 3921 | } | ||
| 3922 | temp = hw->cursor[pipe][level]; | ||
| 3923 | skl_pipe_wm_active_state(temp, active, false, true, i, level); | ||
| 3924 | } | ||
| 3925 | |||
| 3926 | for (i = 0; i < intel_num_planes(intel_crtc); i++) { | ||
| 3927 | temp = hw->plane_trans[pipe][i]; | ||
| 3928 | skl_pipe_wm_active_state(temp, active, true, false, i, 0); | ||
| 3929 | } | ||
| 3930 | |||
| 3931 | temp = hw->cursor_trans[pipe]; | ||
| 3932 | skl_pipe_wm_active_state(temp, active, true, true, i, 0); | ||
| 3933 | } | ||
| 3934 | |||
| 3935 | void skl_wm_get_hw_state(struct drm_device *dev) | ||
| 3936 | { | ||
| 3937 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 3938 | struct skl_ddb_allocation *ddb = &dev_priv->wm.skl_hw.ddb; | ||
| 3939 | struct drm_crtc *crtc; | ||
| 3940 | |||
| 3941 | skl_ddb_get_hw_state(dev_priv, ddb); | ||
| 3942 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | ||
| 3943 | skl_pipe_wm_get_hw_state(crtc); | ||
| 3944 | } | ||
| 3945 | |||
| 2982 | static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc) | 3946 | static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc) |
| 2983 | { | 3947 | { |
| 2984 | struct drm_device *dev = crtc->dev; | 3948 | struct drm_device *dev = crtc->dev; |
| @@ -3575,6 +4539,13 @@ static void gen8_disable_rps_interrupts(struct drm_device *dev) · 590 unmodified lines | |||
| 3575 | I915_WRITE(GEN8_GT_IIR(2), dev_priv->pm_rps_events); | 4539 | I915_WRITE(GEN8_GT_IIR(2), dev_priv->pm_rps_events); |
| 3576 | } | 4540 | } |
| 3577 | 4541 | ||
| 4542 | static void gen9_disable_rps(struct drm_device *dev) | ||
| 4543 | { | ||
| 4544 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 4545 | |||
| 4546 | I915_WRITE(GEN6_RC_CONTROL, 0); | ||
| 4547 | } | ||
| 4548 | |||
| 3578 | static void gen6_disable_rps_interrupts(struct drm_device *dev) | 4549 | static void gen6_disable_rps_interrupts(struct drm_device *dev) |
| 3579 | { | 4550 | { |
| 3580 | struct drm_i915_private *dev_priv = dev->dev_private; | 4551 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -3735,6 +4706,45 @@ static void parse_rp_state_cap(struct drm_i915_private *dev_priv, u32 rp_state_c · 154 unmodified lines | |||
| 3735 | dev_priv->rps.min_freq_softlimit = dev_priv->rps.min_freq; | 4706 | dev_priv->rps.min_freq_softlimit = dev_priv->rps.min_freq; |
| 3736 | } | 4707 | } |
| 3737 | 4708 | ||
| 4709 | static void gen9_enable_rps(struct drm_device *dev) | ||
| 4710 | { | ||
| 4711 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 4712 | struct intel_engine_cs *ring; | ||
| 4713 | uint32_t rc6_mask = 0; | ||
| 4714 | int unused; | ||
| 4715 | |||
| 4716 | /* 1a: Software RC state - RC0 */ | ||
| 4717 | I915_WRITE(GEN6_RC_STATE, 0); | ||
| 4718 | |||
| 4719 | /* 1b: Get forcewake during program sequence. Although the driver | ||
| 4720 | * hasn't enabled a state yet where we need forcewake, BIOS may have.*/ | ||
| 4721 | gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); | ||
| 4722 | |||
| 4723 | /* 2a: Disable RC states. */ | ||
| 4724 | I915_WRITE(GEN6_RC_CONTROL, 0); | ||
| 4725 | |||
| 4726 | /* 2b: Program RC6 thresholds.*/ | ||
| 4727 | I915_WRITE(GEN6_RC6_WAKE_RATE_LIMIT, 54 << 16); | ||
| 4728 | I915_WRITE(GEN6_RC_EVALUATION_INTERVAL, 125000); /* 12500 * 1280ns */ | ||
| 4729 | I915_WRITE(GEN6_RC_IDLE_HYSTERSIS, 25); /* 25 * 1280ns */ | ||
| 4730 | for_each_ring(ring, dev_priv, unused) | ||
| 4731 | I915_WRITE(RING_MAX_IDLE(ring->mmio_base), 10); | ||
| 4732 | I915_WRITE(GEN6_RC_SLEEP, 0); | ||
| 4733 | I915_WRITE(GEN6_RC6_THRESHOLD, 37500); /* 37.5/125ms per EI */ | ||
| 4734 | |||
| 4735 | /* 3a: Enable RC6 */ | ||
| 4736 | if (intel_enable_rc6(dev) & INTEL_RC6_ENABLE) | ||
| 4737 | rc6_mask = GEN6_RC_CTL_RC6_ENABLE; | ||
| 4738 | DRM_INFO("RC6 %s\n", (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? | ||
| 4739 | "on" : "off"); | ||
| 4740 | I915_WRITE(GEN6_RC_CONTROL, GEN6_RC_CTL_HW_ENABLE | | ||
| 4741 | GEN6_RC_CTL_EI_MODE(1) | | ||
| 4742 | rc6_mask); | ||
| 4743 | |||
| 4744 | gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL); | ||
| 4745 | |||
| 4746 | } | ||
| 4747 | |||
| 3738 | static void gen8_enable_rps(struct drm_device *dev) | 4748 | static void gen8_enable_rps(struct drm_device *dev) |
| 3739 | { | 4749 | { |
| 3740 | struct drm_i915_private *dev_priv = dev->dev_private; | 4750 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -5269,7 +6279,9 @@ void intel_disable_gt_powersave(struct drm_device *dev) · 1528 unmodified lines | |||
| 5269 | intel_suspend_gt_powersave(dev); | 6279 | intel_suspend_gt_powersave(dev); |
| 5270 | 6280 | ||
| 5271 | mutex_lock(&dev_priv->rps.hw_lock); | 6281 | mutex_lock(&dev_priv->rps.hw_lock); |
| 5272 | if (IS_CHERRYVIEW(dev)) | 6282 | if (INTEL_INFO(dev)->gen >= 9) |
| 6283 | gen9_disable_rps(dev); | ||
| 6284 | else if (IS_CHERRYVIEW(dev)) | ||
| 5273 | cherryview_disable_rps(dev); | 6285 | cherryview_disable_rps(dev); |
| 5274 | else if (IS_VALLEYVIEW(dev)) | 6286 | else if (IS_VALLEYVIEW(dev)) |
| 5275 | valleyview_disable_rps(dev); | 6287 | valleyview_disable_rps(dev); |
| @@ -5293,6 +6305,8 @@ static void intel_gen6_powersave_work(struct work_struct *work) · 17 unmodified lines | |||
| 5293 | cherryview_enable_rps(dev); | 6305 | cherryview_enable_rps(dev); |
| 5294 | } else if (IS_VALLEYVIEW(dev)) { | 6306 | } else if (IS_VALLEYVIEW(dev)) { |
| 5295 | valleyview_enable_rps(dev); | 6307 | valleyview_enable_rps(dev); |
| 6308 | } else if (INTEL_INFO(dev)->gen >= 9) { | ||
| 6309 | gen9_enable_rps(dev); | ||
| 5296 | } else if (IS_BROADWELL(dev)) { | 6310 | } else if (IS_BROADWELL(dev)) { |
| 5297 | gen8_enable_rps(dev); | 6311 | gen8_enable_rps(dev); |
| 5298 | __gen6_update_ring_freq(dev); | 6312 | __gen6_update_ring_freq(dev); |
| @@ -6127,7 +7141,11 @@ void intel_init_pm(struct drm_device *dev) · 828 unmodified lines | |||
| 6127 | 7141 | ||
| 6128 | /* For FIFO watermark updates */ | 7142 | /* For FIFO watermark updates */ |
| 6129 | if (IS_GEN9(dev)) { | 7143 | if (IS_GEN9(dev)) { |
| 7144 | skl_setup_wm_latency(dev); | ||
| 7145 | |||
| 6130 | dev_priv->display.init_clock_gating = gen9_init_clock_gating; | 7146 | dev_priv->display.init_clock_gating = gen9_init_clock_gating; |
| 7147 | dev_priv->display.update_wm = skl_update_wm; | ||
| 7148 | dev_priv->display.update_sprite_wm = skl_update_sprite_wm; | ||
| 6131 | } else if (HAS_PCH_SPLIT(dev)) { | 7149 | } else if (HAS_PCH_SPLIT(dev)) { |
| 6132 | ilk_setup_wm_latency(dev); | 7150 | ilk_setup_wm_latency(dev); |
| 6133 | 7151 | ||
| @@ -6219,6 +7237,8 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u8 mbox, u32 *val) · 85 unmodified lines | |||
| 6219 | } | 7237 | } |
| 6220 | 7238 | ||
| 6221 | I915_WRITE(GEN6_PCODE_DATA, *val); | 7239 | I915_WRITE(GEN6_PCODE_DATA, *val); |
| 7240 | if (INTEL_INFO(dev_priv)->gen >= 9) | ||
| 7241 | I915_WRITE(GEN9_PCODE_DATA1, 0); | ||
| 6222 | I915_WRITE(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox); | 7242 | I915_WRITE(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox); |
| 6223 | 7243 | ||
| 6224 | if (wait_for((I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) == 0, | 7244 | if (wait_for((I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) == 0, |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | extern const struct intel_renderstate_rodata gen6_null_state; | 29 | extern const struct intel_renderstate_rodata gen6_null_state; |
| 30 | extern const struct intel_renderstate_rodata gen7_null_state; | 30 | extern const struct intel_renderstate_rodata gen7_null_state; |
| 31 | extern const struct intel_renderstate_rodata gen8_null_state; | 31 | extern const struct intel_renderstate_rodata gen8_null_state; |
| 32 | extern const struct intel_renderstate_rodata gen9_null_state; | ||
| 32 | 33 | ||
| 33 | #define RO_RENDERSTATE(_g) \ | 34 | #define RO_RENDERSTATE(_g) \ |
| 34 | const struct intel_renderstate_rodata gen ## _g ## _null_state = { \ | 35 | const struct intel_renderstate_rodata gen ## _g ## _null_state = { \ |
| @@ -1,70 +1,575 @@ | |||
| 1 | #include "intel_renderstate.h" | 1 | #include "intel_renderstate.h" |
| 2 | 2 | ||
| 3 | static const u32 gen8_null_state_relocs[] = { | 3 | static const u32 gen8_null_state_relocs[] = { |
| 4 | 0x00000048, | 4 | 0x00000798, |
| 5 | 0x00000050, | 5 | 0x000007a4, |
| 6 | 0x00000060, | 6 | 0x000007ac, |
| 7 | 0x000003ec, | 7 | 0x000007bc, |
| 8 | -1, | 8 | -1, |
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | static const u32 gen8_null_state_batch[] = { | 11 | static const u32 gen8_null_state_batch[] = { |
| 12 | 0x7a000004, | ||
| 13 | 0x01000000, | ||
| 14 | 0x00000000, | ||
| 15 | 0x00000000, | ||
| 16 | 0x00000000, | ||
| 17 | 0x00000000, | ||
| 12 | 0x69040000, | 18 | 0x69040000, |
| 13 | 0x61020001, | 19 | 0x78140000, |
| 20 | 0x04000000, | ||
| 21 | 0x7820000a, | ||
| 22 | 0x00000000, | ||
| 23 | 0x00000000, | ||
| 24 | 0x80000000, | ||
| 25 | 0x00000000, | ||
| 26 | 0x00000000, | ||
| 27 | 0x00000000, | ||
| 28 | 0x00000000, | ||
| 29 | 0x00000000, | ||
| 30 | 0x00000000, | ||
| 31 | 0x00000000, | ||
| 32 | 0x00000000, | ||
| 33 | 0x78130002, | ||
| 34 | 0x00000000, | ||
| 35 | 0x00000000, | ||
| 36 | 0x02001808, | ||
| 37 | 0x781f0002, | ||
| 38 | 0x00000000, | ||
| 39 | 0x00000000, | ||
| 40 | 0x00000000, | ||
| 41 | 0x78510009, | ||
| 42 | 0x00000000, | ||
| 43 | 0x00000000, | ||
| 44 | 0x00000000, | ||
| 45 | 0x00000000, | ||
| 46 | 0x00000000, | ||
| 47 | 0x00000000, | ||
| 48 | 0x00000000, | ||
| 49 | 0x00000000, | ||
| 50 | 0x00000000, | ||
| 51 | 0x00000000, | ||
| 52 | 0x78100007, | ||
| 53 | 0x00000000, | ||
| 54 | 0x00000000, | ||
| 55 | 0x00010000, | ||
| 56 | 0x00000000, | ||
| 57 | 0x00000000, | ||
| 58 | 0x00000000, | ||
| 59 | 0x00000000, | ||
| 60 | 0x00000000, | ||
| 61 | 0x781b0007, | ||
| 62 | 0x00000000, | ||
| 63 | 0x00000000, | ||
| 64 | 0x00000000, | ||
| 65 | 0x00000000, | ||
| 66 | 0x00000000, | ||
| 67 | 0x00000000, | ||
| 68 | 0x00000800, | ||
| 69 | 0x00000000, | ||
| 70 | 0x78110008, | ||
| 71 | 0x00000000, | ||
| 72 | 0x00000000, | ||
| 73 | 0x00000000, | ||
| 74 | 0x00000000, | ||
| 75 | 0x00000000, | ||
| 76 | 0x00000000, | ||
| 77 | 0x00000000, | ||
| 78 | 0x00000000, | ||
| 79 | 0x00000000, | ||
| 80 | 0x781e0003, | ||
| 81 | 0x00000000, | ||
| 82 | 0x00000000, | ||
| 83 | 0x00000000, | ||
| 84 | 0x00000000, | ||
| 85 | 0x781d0007, | ||
| 86 | 0x00000000, | ||
| 87 | 0x00000000, | ||
| 88 | 0x00000000, | ||
| 89 | 0x00000000, | ||
| 90 | 0x00000000, | ||
| 91 | 0x00000000, | ||
| 92 | 0x00000000, | ||
| 93 | 0x00000000, | ||
| 94 | 0x78120002, | ||
| 95 | 0x00000000, | ||
| 96 | 0x00000000, | ||
| 97 | 0x00000000, | ||
| 98 | 0x78500003, | ||
| 99 | 0x00000000, | ||
| 100 | 0x00000000, | ||
| 101 | 0x00000000, | ||
| 102 | 0x00000000, | ||
| 103 | 0x781c0002, | ||
| 104 | 0x00000000, | ||
| 105 | 0x00000000, | ||
| 106 | 0x00000000, | ||
| 107 | 0x780c0000, | ||
| 108 | 0x00000000, | ||
| 109 | 0x78520003, | ||
| 110 | 0x00000000, | ||
| 111 | 0x00000000, | ||
| 112 | 0x00000000, | ||
| 113 | 0x00000000, | ||
| 114 | 0x78300000, | ||
| 115 | 0x08010040, | ||
| 116 | 0x78310000, | ||
| 117 | 0x1e000000, | ||
| 118 | 0x78320000, | ||
| 119 | 0x1e000000, | ||
| 120 | 0x78330000, | ||
| 121 | 0x1e000000, | ||
| 122 | 0x79190002, | ||
| 123 | 0x00000000, | ||
| 124 | 0x00000000, | ||
| 125 | 0x00000000, | ||
| 126 | 0x791a0002, | ||
| 127 | 0x00000000, | ||
| 128 | 0x00000000, | ||
| 129 | 0x00000000, | ||
| 130 | 0x791b0002, | ||
| 131 | 0x00000000, | ||
| 132 | 0x00000000, | ||
| 133 | 0x00000000, | ||
| 134 | 0x79120000, | ||
| 135 | 0x00000000, | ||
| 136 | 0x79130000, | ||
| 137 | 0x00000000, | ||
| 138 | 0x79140000, | ||
| 139 | 0x00000000, | ||
| 140 | 0x79150000, | ||
| 141 | 0x00000000, | ||
| 142 | 0x79160000, | ||
| 143 | 0x00000000, | ||
| 144 | 0x78150009, | ||
| 145 | 0x00000000, | ||
| 146 | 0x00000000, | ||
| 147 | 0x00000000, | ||
| 148 | 0x00000000, | ||
| 149 | 0x00000000, | ||
| 150 | 0x00000000, | ||
| 151 | 0x00000000, | ||
| 152 | 0x00000000, | ||
| 153 | 0x00000000, | ||
| 154 | 0x00000000, | ||
| 155 | 0x78190009, | ||
| 156 | 0x00000000, | ||
| 157 | 0x00000000, | ||
| 158 | 0x00000000, | ||
| 159 | 0x00000000, | ||
| 160 | 0x00000000, | ||
| 161 | 0x00000000, | ||
| 162 | 0x00000000, | ||
| 163 | 0x00000000, | ||
| 164 | 0x00000000, | ||
| 165 | 0x00000000, | ||
| 166 | 0x781a0009, | ||
| 167 | 0x00000000, | ||
| 168 | 0x00000000, | ||
| 169 | 0x00000000, | ||
| 170 | 0x00000000, | ||
| 171 | 0x00000000, | ||
| 172 | 0x00000000, | ||
| 173 | 0x00000000, | ||
| 174 | 0x00000000, | ||
| 175 | 0x00000000, | ||
| 176 | 0x00000000, | ||
| 177 | 0x78160009, | ||
| 178 | 0x00000000, | ||
| 179 | 0x00000000, | ||
| 180 | 0x00000000, | ||
| 181 | 0x00000000, | ||
| 182 | 0x00000000, | ||
| 183 | 0x00000000, | ||
| 184 | 0x00000000, | ||
| 185 | 0x00000000, | ||
| 186 | 0x00000000, | ||
| 187 | 0x00000000, | ||
| 188 | 0x78170009, | ||
| 189 | 0x00000000, | ||
| 190 | 0x00000000, | ||
| 191 | 0x00000000, | ||
| 192 | 0x00000000, | ||
| 193 | 0x00000000, | ||
| 194 | 0x00000000, | ||
| 195 | 0x00000000, | ||
| 196 | 0x00000000, | ||
| 197 | 0x00000000, | ||
| 198 | 0x00000000, | ||
| 199 | 0x78490001, | ||
| 200 | 0x00000000, | ||
| 201 | 0x00000000, | ||
| 202 | 0x784a0000, | ||
| 203 | 0x00000000, | ||
| 204 | 0x784b0000, | ||
| 205 | 0x00000004, | ||
| 206 | 0x79170101, | ||
| 207 | 0x00000000, | ||
| 208 | 0x00000080, | ||
| 209 | 0x00000000, | ||
| 210 | 0x00000000, | ||
| 211 | 0x00000000, | ||
| 212 | 0x00000000, | ||
| 213 | 0x00000000, | ||
| 214 | 0x00000000, | ||
| 215 | 0x00000000, | ||
| 216 | 0x00000000, | ||
| 217 | 0x00000000, | ||
| 218 | 0x00000000, | ||
| 219 | 0x00000000, | ||
| 220 | 0x00000000, | ||
| 221 | 0x00000000, | ||
| 222 | 0x00000000, | ||
| 223 | 0x00000000, | ||
| 224 | 0x00000000, | ||
| 225 | 0x00000000, | ||
| 226 | 0x00000000, | ||
| 227 | 0x00000000, | ||
| 228 | 0x00000000, | ||
| 229 | 0x00000000, | ||
| 230 | 0x00000000, | ||
| 231 | 0x00000000, | ||
| 232 | 0x00000000, | ||
| 233 | 0x00000000, | ||
| 234 | 0x00000000, | ||
| 235 | 0x00000000, | ||
| 236 | 0x00000000, | ||
| 237 | 0x00000000, | ||
| 238 | 0x00000000, | ||
| 239 | 0x00000000, | ||
| 240 | 0x00000000, | ||
| 241 | 0x00000000, | ||
| 242 | 0x00000000, | ||
| 243 | 0x00000000, | ||
| 244 | 0x00000000, | ||
| 245 | 0x00000000, | ||
| 246 | 0x00000000, | ||
| 247 | 0x00000000, | ||
| 248 | 0x00000000, | ||
| 249 | 0x00000000, | ||
| 250 | 0x00000000, | ||
| 251 | 0x00000000, | ||
| 252 | 0x00000000, | ||
| 253 | 0x00000000, | ||
| 254 | 0x00000000, | ||
| 255 | 0x00000000, | ||
| 256 | 0x00000000, | ||
| 257 | 0x00000000, | ||
| 258 | 0x00000000, | ||
| 259 | 0x00000000, | ||
| 260 | 0x00000000, | ||
| 261 | 0x00000000, | ||
| 262 | 0x00000000, | ||
| 263 | 0x00000000, | ||
| 264 | 0x00000000, | ||
| 265 | 0x00000000, | ||
| 266 | 0x00000000, | ||
| 267 | 0x00000000, | ||
| 268 | 0x00000000, | ||
| 269 | 0x00000000, | ||
| 270 | 0x00000000, | ||
| 271 | 0x00000000, | ||
| 272 | 0x00000000, | ||
| 273 | 0x00000000, | ||
| 274 | 0x00000000, | ||
| 275 | 0x00000000, | ||
| 276 | 0x00000000, | ||
| 277 | 0x00000000, | ||
| 278 | 0x00000000, | ||
| 279 | 0x00000000, | ||
| 280 | 0x00000000, | ||
| 281 | 0x00000000, | ||
| 282 | 0x00000000, | ||
| 283 | 0x00000000, | ||
| 284 | 0x00000000, | ||
| 285 | 0x00000000, | ||
| 286 | 0x00000000, | ||
| 287 | 0x00000000, | ||
| 288 | 0x00000000, | ||
| 289 | 0x00000000, | ||
| 290 | 0x00000000, | ||
| 291 | 0x00000000, | ||
| 292 | 0x00000000, | ||
| 293 | 0x00000000, | ||
| 294 | 0x00000000, | ||
| 295 | 0x00000000, | ||
| 296 | 0x00000000, | ||
| 297 | 0x00000000, | ||
| 298 | 0x00000000, | ||
| 299 | 0x00000000, | ||
| 300 | 0x00000000, | ||
| 301 | 0x00000000, | ||
| 302 | 0x00000000, | ||
| 303 | 0x00000000, | ||
| 304 | 0x00000000, | ||
| 305 | 0x00000000, | ||
| 306 | 0x00000000, | ||
| 307 | 0x00000000, | ||
| 308 | 0x00000000, | ||
| 309 | 0x00000000, | ||
| 310 | 0x00000000, | ||
| 311 | 0x00000000, | ||
| 312 | 0x00000000, | ||
| 313 | 0x00000000, | ||
| 314 | 0x00000000, | ||
| 315 | 0x00000000, | ||
| 316 | 0x00000000, | ||
| 317 | 0x00000000, | ||
| 318 | 0x00000000, | ||
| 319 | 0x00000000, | ||
| 320 | 0x00000000, | ||
| 321 | 0x00000000, | ||
| 322 | 0x00000000, | ||
| 323 | 0x00000000, | ||
| 324 | 0x00000000, | ||
| 325 | 0x00000000, | ||
| 326 | 0x00000000, | ||
| 327 | 0x00000000, | ||
| 328 | 0x00000000, | ||
| 329 | 0x00000000, | ||
| 330 | 0x00000000, | ||
| 331 | 0x00000000, | ||
| 332 | 0x00000000, | ||
| 333 | 0x00000000, | ||
| 334 | 0x00000000, | ||
| 335 | 0x00000000, | ||
| 336 | 0x00000000, | ||
| 337 | 0x00000000, | ||
| 338 | 0x00000000, | ||
| 339 | 0x00000000, | ||
| 340 | 0x00000000, | ||
| 341 | 0x00000000, | ||
| 342 | 0x00000000, | ||
| 343 | 0x00000000, | ||
| 344 | 0x00000000, | ||
| 345 | 0x00000000, | ||
| 346 | 0x00000000, | ||
| 347 | 0x00000000, | ||
| 348 | 0x00000000, | ||
| 349 | 0x00000000, | ||
| 350 | 0x00000000, | ||
| 351 | 0x00000000, | ||
| 352 | 0x00000000, | ||
| 353 | 0x00000000, | ||
| 354 | 0x00000000, | ||
| 355 | 0x00000000, | ||
| 356 | 0x00000000, | ||
| 357 | 0x00000000, | ||
| 358 | 0x00000000, | ||
| 359 | 0x00000000, | ||
| 360 | 0x00000000, | ||
| 361 | 0x00000000, | ||
| 362 | 0x00000000, | ||
| 363 | 0x00000000, | ||
| 364 | 0x00000000, | ||
| 365 | 0x00000000, | ||
| 366 | 0x00000000, | ||
| 367 | 0x00000000, | ||
| 368 | 0x00000000, | ||
| 369 | 0x00000000, | ||
| 370 | 0x00000000, | ||
| 371 | 0x00000000, | ||
| 372 | 0x00000000, | ||
| 373 | 0x00000000, | ||
| 374 | 0x00000000, | ||
| 375 | 0x00000000, | ||
| 376 | 0x00000000, | ||
| 377 | 0x00000000, | ||
| 378 | 0x00000000, | ||
| 379 | 0x00000000, | ||
| 380 | 0x00000000, | ||
| 381 | 0x00000000, | ||
| 382 | 0x00000000, | ||
| 383 | 0x00000000, | ||
| 384 | 0x00000000, | ||
| 385 | 0x00000000, | ||
| 386 | 0x00000000, | ||
| 387 | 0x00000000, | ||
| 388 | 0x00000000, | ||
| 389 | 0x00000000, | ||
| 390 | 0x00000000, | ||
| 391 | 0x00000000, | ||
| 392 | 0x00000000, | ||
| 393 | 0x00000000, | ||
| 394 | 0x00000000, | ||
| 395 | 0x00000000, | ||
| 396 | 0x00000000, | ||
| 14 | 0x00000000, | 397 | 0x00000000, |
| 15 | 0x00000000, | 398 | 0x00000000, |
| 16 | 0x79120000, | ||
| 17 | 0x00000000, | 399 | 0x00000000, |
| 18 | 0x79130000, | ||
| 19 | 0x00000000, | 400 | 0x00000000, |
| 20 | 0x79140000, | ||
| 21 | 0x00000000, | 401 | 0x00000000, |
| 22 | 0x79150000, | ||
| 23 | 0x00000000, | 402 | 0x00000000, |
| 24 | 0x79160000, | ||
| 25 | 0x00000000, | 403 | 0x00000000, |
| 26 | 0x6101000e, | ||
| 27 | 0x00000001, | ||
| 28 | 0x00000000, | 404 | 0x00000000, |
| 29 | 0x00000001, | 405 | 0x00000000, |
| 406 | 0x00000000, | ||
| 407 | 0x00000000, | ||
| 408 | 0x00000000, | ||
| 409 | 0x00000000, | ||
| 410 | 0x00000000, | ||
| 411 | 0x00000000, | ||
| 412 | 0x00000000, | ||
| 413 | 0x00000000, | ||
| 414 | 0x00000000, | ||
| 415 | 0x00000000, | ||
| 416 | 0x00000000, | ||
| 417 | 0x00000000, | ||
| 418 | 0x00000000, | ||
| 419 | 0x00000000, | ||
| 420 | 0x00000000, | ||
| 421 | 0x00000000, | ||
| 422 | 0x00000000, | ||
| 423 | 0x00000000, | ||
| 424 | 0x00000000, | ||
| 425 | 0x00000000, | ||
| 426 | 0x00000000, | ||
| 427 | 0x00000000, | ||
| 428 | 0x00000000, | ||
| 429 | 0x00000000, | ||
| 430 | 0x00000000, | ||
| 431 | 0x00000000, | ||
| 432 | 0x00000000, | ||
| 433 | 0x00000000, | ||
| 434 | 0x00000000, | ||
| 435 | 0x00000000, | ||
| 436 | 0x00000000, | ||
| 437 | 0x00000000, | ||
| 438 | 0x00000000, | ||
| 439 | 0x00000000, | ||
| 440 | 0x00000000, | ||
| 441 | 0x00000000, | ||
| 442 | 0x00000000, | ||
| 443 | 0x00000000, | ||
| 444 | 0x00000000, | ||
| 445 | 0x00000000, | ||
| 446 | 0x00000000, | ||
| 447 | 0x00000000, | ||
| 448 | 0x00000000, | ||
| 449 | 0x00000000, | ||
| 450 | 0x00000000, | ||
| 451 | 0x00000000, | ||
| 452 | 0x00000000, | ||
| 453 | 0x00000000, | ||
| 454 | 0x00000000, | ||
| 455 | 0x00000000, | ||
| 456 | 0x00000000, | ||
| 457 | 0x00000000, | ||
| 458 | 0x00000000, | ||
| 459 | 0x00000000, | ||
| 460 | 0x00000000, | ||
| 461 | 0x00000000, | ||
| 462 | 0x00000000, | ||
| 463 | 0x00000000, | ||
| 464 | 0x00000000, | ||
| 465 | 0x79180006, | ||
| 466 | 0x00000000, | ||
| 467 | 0x00000000, | ||
| 468 | 0x00000000, | ||
| 469 | 0x00000000, | ||
| 470 | 0x00000000, | ||
| 471 | 0x00000000, | ||
| 472 | 0x00000000, | ||
| 473 | 0x79180006, | ||
| 474 | 0x20000000, | ||
| 475 | 0x00000000, | ||
| 476 | 0x00000000, | ||
| 477 | 0x00000000, | ||
| 478 | 0x00000000, | ||
| 479 | 0x00000000, | ||
| 480 | 0x00000000, | ||
| 481 | 0x79180006, | ||
| 482 | 0x40000000, | ||
| 483 | 0x00000000, | ||
| 484 | 0x00000000, | ||
| 485 | 0x00000000, | ||
| 486 | 0x00000000, | ||
| 487 | 0x00000000, | ||
| 488 | 0x00000000, | ||
| 489 | 0x79180006, | ||
| 490 | 0x60000000, | ||
| 491 | 0x00000000, | ||
| 492 | 0x00000000, | ||
| 493 | 0x00000000, | ||
| 494 | 0x00000000, | ||
| 495 | 0x00000000, | ||
| 496 | 0x00000000, | ||
| 497 | 0x6101000e, | ||
| 30 | 0x00000001, /* reloc */ | 498 | 0x00000001, /* reloc */ |
| 31 | 0x00000000, | 499 | 0x00000000, |
| 500 | 0x00000000, | ||
| 32 | 0x00000001, /* reloc */ | 501 | 0x00000001, /* reloc */ |
| 33 | 0x00000000, | 502 | 0x00000000, |
| 503 | 0x00000001, /* reloc */ | ||
| 34 | 0x00000000, | 504 | 0x00000000, |
| 505 | 0x00000001, | ||
| 35 | 0x00000000, | 506 | 0x00000000, |
| 36 | 0x00000001, /* reloc */ | 507 | 0x00000001, /* reloc */ |
| 37 | 0x00000000, | 508 | 0x00000000, |
| 38 | 0xfffff001, | ||
| 39 | 0x00001001, | 509 | 0x00001001, |
| 40 | 0xfffff001, | ||
| 41 | 0x00001001, | 510 | 0x00001001, |
| 42 | 0x78230000, | 511 | 0x00000001, |
| 43 | 0x000006e0, | 512 | 0x00001001, |
| 44 | 0x78210000, | 513 | 0x61020001, |
| 45 | 0x00000700, | 514 | 0x00000000, |
| 46 | 0x78300000, | 515 | 0x00000000, |
| 47 | 0x08010040, | 516 | 0x79000002, |
| 48 | 0x78330000, | 517 | 0x00000000, |
| 49 | 0x08000000, | 518 | 0x00000000, |
| 50 | 0x78310000, | 519 | 0x00000000, |
| 51 | 0x08000000, | 520 | 0x78050006, |
| 52 | 0x78320000, | 521 | 0x00000000, |
| 53 | 0x08000000, | 522 | 0x00000000, |
| 54 | 0x78240000, | 523 | 0x00000000, |
| 55 | 0x00000641, | 524 | 0x00000000, |
| 56 | 0x780e0000, | 525 | 0x00000000, |
| 57 | 0x00000601, | 526 | 0x00000000, |
| 527 | 0x00000000, | ||
| 528 | 0x79040002, | ||
| 529 | 0x00000000, | ||
| 530 | 0x00000000, | ||
| 531 | 0x00000000, | ||
| 532 | 0x79040002, | ||
| 533 | 0x40000000, | ||
| 534 | 0x00000000, | ||
| 535 | 0x00000000, | ||
| 536 | 0x79040002, | ||
| 537 | 0x80000000, | ||
| 538 | 0x00000000, | ||
| 539 | 0x00000000, | ||
| 540 | 0x79040002, | ||
| 541 | 0xc0000000, | ||
| 542 | 0x00000000, | ||
| 543 | 0x00000000, | ||
| 544 | 0x79080001, | ||
| 545 | 0x00000000, | ||
| 546 | 0x00000000, | ||
| 547 | 0x790a0001, | ||
| 548 | 0x00000000, | ||
| 549 | 0x00000000, | ||
| 550 | 0x78060003, | ||
| 551 | 0x00000000, | ||
| 552 | 0x00000000, | ||
| 553 | 0x00000000, | ||
| 554 | 0x00000000, | ||
| 555 | 0x78070003, | ||
| 556 | 0x00000000, | ||
| 557 | 0x00000000, | ||
| 558 | 0x00000000, | ||
| 559 | 0x00000000, | ||
| 560 | 0x78040001, | ||
| 561 | 0x00000000, | ||
| 562 | 0x00000000, | ||
| 563 | 0x79110000, | ||
| 564 | 0x00000000, | ||
| 58 | 0x780d0000, | 565 | 0x780d0000, |
| 59 | 0x00000000, | 566 | 0x00000000, |
| 60 | 0x78180000, | 567 | 0x79060000, |
| 61 | 0x00000001, | ||
| 62 | 0x78520003, | ||
| 63 | 0x00000000, | 568 | 0x00000000, |
| 569 | 0x7907001f, | ||
| 64 | 0x00000000, | 570 | 0x00000000, |
| 65 | 0x00000000, | 571 | 0x00000000, |
| 66 | 0x00000000, | 572 | 0x00000000, |
| 67 | 0x78190009, | ||
| 68 | 0x00000000, | 573 | 0x00000000, |
| 69 | 0x00000000, | 574 | 0x00000000, |
| 70 | 0x00000000, | 575 | 0x00000000, |
| @@ -75,7 +580,6 @@ static const u32 gen8_null_state_batch[] = { · 4 unmodified lines | |||
| 75 | 0x00000000, | 580 | 0x00000000, |
| 76 | 0x00000000, | 581 | 0x00000000, |
| 77 | 0x00000000, | 582 | 0x00000000, |
| 78 | 0x781b0007, | ||
| 79 | 0x00000000, | 583 | 0x00000000, |
| 80 | 0x00000000, | 584 | 0x00000000, |
| 81 | 0x00000000, | 585 | 0x00000000, |
| @@ -84,26 +588,22 @@ static const u32 gen8_null_state_batch[] = { · 2 unmodified lines | |||
| 84 | 0x00000000, | 588 | 0x00000000, |
| 85 | 0x00000000, | 589 | 0x00000000, |
| 86 | 0x00000000, | 590 | 0x00000000, |
| 87 | 0x78270000, | ||
| 88 | 0x00000000, | 591 | 0x00000000, |
| 89 | 0x782c0000, | ||
| 90 | 0x00000000, | 592 | 0x00000000, |
| 91 | 0x781c0002, | ||
| 92 | 0x00000000, | 593 | 0x00000000, |
| 93 | 0x00000000, | 594 | 0x00000000, |
| 94 | 0x00000000, | 595 | 0x00000000, |
| 95 | 0x78160009, | ||
| 96 | 0x00000000, | 596 | 0x00000000, |
| 97 | 0x00000000, | 597 | 0x00000000, |
| 98 | 0x00000000, | 598 | 0x00000000, |
| 99 | 0x00000000, | 599 | 0x00000000, |
| 100 | 0x00000000, | 600 | 0x00000000, |
| 101 | 0x00000000, | 601 | 0x00000000, |
| 602 | 0x7902000f, | ||
| 102 | 0x00000000, | 603 | 0x00000000, |
| 103 | 0x00000000, | 604 | 0x00000000, |
| 104 | 0x00000000, | 605 | 0x00000000, |
| 105 | 0x00000000, | 606 | 0x00000000, |
| 106 | 0x78110008, | ||
| 107 | 0x00000000, | 607 | 0x00000000, |
| 108 | 0x00000000, | 608 | 0x00000000, |
| 109 | 0x00000000, | 609 | 0x00000000, |
| @@ -113,12 +613,10 @@ static const u32 gen8_null_state_batch[] = { · 3 unmodified lines | |||
| 113 | 0x00000000, | 613 | 0x00000000, |
| 114 | 0x00000000, | 614 | 0x00000000, |
| 115 | 0x00000000, | 615 | 0x00000000, |
| 116 | 0x78290000, | ||
| 117 | 0x00000000, | 616 | 0x00000000, |
| 118 | 0x782e0000, | ||
| 119 | 0x00000000, | 617 | 0x00000000, |
| 120 | 0x781a0009, | ||
| 121 | 0x00000000, | 618 | 0x00000000, |
| 619 | 0x790c000f, | ||
| 122 | 0x00000000, | 620 | 0x00000000, |
| 123 | 0x00000000, | 621 | 0x00000000, |
| 124 | 0x00000000, | 622 | 0x00000000, |
| @@ -128,7 +626,6 @@ static const u32 gen8_null_state_batch[] = { · 3 unmodified lines | |||
| 128 | 0x00000000, | 626 | 0x00000000, |
| 129 | 0x00000000, | 627 | 0x00000000, |
| 130 | 0x00000000, | 628 | 0x00000000, |
| 131 | 0x781d0007, | ||
| 132 | 0x00000000, | 629 | 0x00000000, |
| 133 | 0x00000000, | 630 | 0x00000000, |
| 134 | 0x00000000, | 631 | 0x00000000, |
| @@ -136,153 +633,153 @@ static const u32 gen8_null_state_batch[] = { · 1 unmodified line | |||
| 136 | 0x00000000, | 633 | 0x00000000, |
| 137 | 0x00000000, | 634 | 0x00000000, |
| 138 | 0x00000000, | 635 | 0x00000000, |
| 636 | 0x780a0003, | ||
| 139 | 0x00000000, | 637 | 0x00000000, |
| 140 | 0x78280000, | ||
| 141 | 0x00000000, | 638 | 0x00000000, |
| 142 | 0x782d0000, | ||
| 143 | 0x00000000, | 639 | 0x00000000, |
| 144 | 0x78260000, | ||
| 145 | 0x00000000, | 640 | 0x00000000, |
| 146 | 0x782b0000, | 641 | 0x78080083, |
| 642 | 0x00004000, | ||
| 147 | 0x00000000, | 643 | 0x00000000, |
| 148 | 0x78150009, | ||
| 149 | 0x00000000, | 644 | 0x00000000, |
| 150 | 0x00000000, | 645 | 0x00000000, |
| 646 | 0x04004000, | ||
| 151 | 0x00000000, | 647 | 0x00000000, |
| 152 | 0x00000000, | 648 | 0x00000000, |
| 153 | 0x00000000, | 649 | 0x00000000, |
| 650 | 0x08004000, | ||
| 154 | 0x00000000, | 651 | 0x00000000, |
| 155 | 0x00000000, | 652 | 0x00000000, |
| 156 | 0x00000000, | 653 | 0x00000000, |
| 654 | 0x0c004000, | ||
| 157 | 0x00000000, | 655 | 0x00000000, |
| 158 | 0x00000000, | 656 | 0x00000000, |
| 159 | 0x78100007, | ||
| 160 | 0x00000000, | 657 | 0x00000000, |
| 658 | 0x10004000, | ||
| 161 | 0x00000000, | 659 | 0x00000000, |
| 162 | 0x00000000, | 660 | 0x00000000, |
| 163 | 0x00000000, | 661 | 0x00000000, |
| 662 | 0x14004000, | ||
| 164 | 0x00000000, | 663 | 0x00000000, |
| 165 | 0x00000000, | 664 | 0x00000000, |
| 166 | 0x00000000, | 665 | 0x00000000, |
| 666 | 0x18004000, | ||
| 167 | 0x00000000, | 667 | 0x00000000, |
| 168 | 0x781e0003, | ||
| 169 | 0x00000000, | 668 | 0x00000000, |
| 170 | 0x00000000, | 669 | 0x00000000, |
| 670 | 0x1c004000, | ||
| 171 | 0x00000000, | 671 | 0x00000000, |
| 172 | 0x00000000, | 672 | 0x00000000, |
| 173 | 0x78120002, | ||
| 174 | 0x00000000, | 673 | 0x00000000, |
| 674 | 0x20004000, | ||
| 175 | 0x00000000, | 675 | 0x00000000, |
| 176 | 0x00000000, | 676 | 0x00000000, |
| 177 | 0x781f0002, | ||
| 178 | 0x30400820, | ||
| 179 | 0x00000000, | 677 | 0x00000000, |
| 678 | 0x24004000, | ||
| 180 | 0x00000000, | 679 | 0x00000000, |
| 181 | 0x78510009, | ||
| 182 | 0x00000000, | 680 | 0x00000000, |
| 183 | 0x00000000, | 681 | 0x00000000, |
| 682 | 0x28004000, | ||
| 184 | 0x00000000, | 683 | 0x00000000, |
| 185 | 0x00000000, | 684 | 0x00000000, |
| 186 | 0x00000000, | 685 | 0x00000000, |
| 686 | 0x2c004000, | ||
| 187 | 0x00000000, | 687 | 0x00000000, |
| 188 | 0x00000000, | 688 | 0x00000000, |
| 189 | 0x00000000, | 689 | 0x00000000, |
| 690 | 0x30004000, | ||
| 190 | 0x00000000, | 691 | 0x00000000, |
| 191 | 0x00000000, | 692 | 0x00000000, |
| 192 | 0x78500003, | ||
| 193 | 0x00210000, | ||
| 194 | 0x00000000, | 693 | 0x00000000, |
| 694 | 0x34004000, | ||
| 195 | 0x00000000, | 695 | 0x00000000, |
| 196 | 0x00000000, | 696 | 0x00000000, |
| 197 | 0x78130002, | ||
| 198 | 0x00000000, | 697 | 0x00000000, |
| 698 | 0x38004000, | ||
| 199 | 0x00000000, | 699 | 0x00000000, |
| 200 | 0x00000000, | 700 | 0x00000000, |
| 201 | 0x782a0000, | ||
| 202 | 0x00000480, | ||
| 203 | 0x782f0000, | ||
| 204 | 0x00000540, | ||
| 205 | 0x78140000, | ||
| 206 | 0x00000800, | ||
| 207 | 0x78170009, | ||
| 208 | 0x00000000, | 701 | 0x00000000, |
| 702 | 0x3c004000, | ||
| 209 | 0x00000000, | 703 | 0x00000000, |
| 210 | 0x00000000, | 704 | 0x00000000, |
| 211 | 0x00000000, | 705 | 0x00000000, |
| 706 | 0x40004000, | ||
| 212 | 0x00000000, | 707 | 0x00000000, |
| 213 | 0x00000000, | 708 | 0x00000000, |
| 214 | 0x00000000, | 709 | 0x00000000, |
| 710 | 0x44004000, | ||
| 215 | 0x00000000, | 711 | 0x00000000, |
| 216 | 0x00000000, | 712 | 0x00000000, |
| 217 | 0x00000000, | 713 | 0x00000000, |
| 218 | 0x7820000a, | 714 | 0x48004000, |
| 219 | 0x00000580, | ||
| 220 | 0x00000000, | 715 | 0x00000000, |
| 221 | 0x08080000, | ||
| 222 | 0x00000000, | 716 | 0x00000000, |
| 223 | 0x00000000, | 717 | 0x00000000, |
| 224 | 0x1f000002, | 718 | 0x4c004000, |
| 225 | 0x00060000, | ||
| 226 | 0x00000000, | 719 | 0x00000000, |
| 227 | 0x00000000, | 720 | 0x00000000, |
| 228 | 0x00000000, | 721 | 0x00000000, |
| 722 | 0x50004000, | ||
| 229 | 0x00000000, | 723 | 0x00000000, |
| 230 | 0x784d0000, | ||
| 231 | 0x40000000, | ||
| 232 | 0x784f0000, | ||
| 233 | 0x80000100, | ||
| 234 | 0x780f0000, | ||
| 235 | 0x00000740, | ||
| 236 | 0x78050006, | ||
| 237 | 0x00000000, | 724 | 0x00000000, |
| 238 | 0x00000000, | 725 | 0x00000000, |
| 726 | 0x54004000, | ||
| 239 | 0x00000000, | 727 | 0x00000000, |
| 240 | 0x00000000, | 728 | 0x00000000, |
| 241 | 0x00000000, | 729 | 0x00000000, |
| 730 | 0x58004000, | ||
| 242 | 0x00000000, | 731 | 0x00000000, |
| 243 | 0x00000000, | 732 | 0x00000000, |
| 244 | 0x78070003, | ||
| 245 | 0x00000000, | 733 | 0x00000000, |
| 734 | 0x5c004000, | ||
| 246 | 0x00000000, | 735 | 0x00000000, |
| 247 | 0x00000000, | 736 | 0x00000000, |
| 248 | 0x00000000, | 737 | 0x00000000, |
| 249 | 0x78060003, | 738 | 0x60004000, |
| 250 | 0x00000000, | 739 | 0x00000000, |
| 251 | 0x00000000, | 740 | 0x00000000, |
| 252 | 0x00000000, | 741 | 0x00000000, |
| 742 | 0x64004000, | ||
| 253 | 0x00000000, | 743 | 0x00000000, |
| 254 | 0x78040001, | ||
| 255 | 0x00000000, | 744 | 0x00000000, |
| 256 | 0x00000001, | 745 | 0x00000000, |
| 257 | 0x79000002, | 746 | 0x68004000, |
| 258 | 0xffffffff, | 747 | 0x00000000, |
| 748 | 0x00000000, | ||
| 749 | 0x00000000, | ||
| 750 | 0x6c004000, | ||
| 751 | 0x00000000, | ||
| 752 | 0x00000000, | ||
| 753 | 0x00000000, | ||
| 754 | 0x70004000, | ||
| 755 | 0x00000000, | ||
| 756 | 0x00000000, | ||
| 757 | 0x00000000, | ||
| 758 | 0x74004000, | ||
| 759 | 0x00000000, | ||
| 760 | 0x00000000, | ||
| 761 | 0x00000000, | ||
| 762 | 0x78004000, | ||
| 763 | 0x00000000, | ||
| 259 | 0x00000000, | 764 | 0x00000000, |
| 260 | 0x00000000, | 765 | 0x00000000, |
| 261 | 0x78080003, | 766 | 0x7c004000, |
| 262 | 0x00006000, | ||
| 263 | 0x000005e0, /* reloc */ | ||
| 264 | 0x00000000, | 767 | 0x00000000, |
| 265 | 0x00000000, | 768 | 0x00000000, |
| 266 | 0x78090005, | 769 | 0x00000000, |
| 770 | 0x80004000, | ||
| 771 | 0x00000000, | ||
| 772 | 0x00000000, | ||
| 773 | 0x00000000, | ||
| 774 | 0x78090043, | ||
| 267 | 0x02000000, | 775 | 0x02000000, |
| 268 | 0x22220000, | 776 | 0x22220000, |
| 269 | 0x02f60000, | ||
| 270 | 0x11230000, | ||
| 271 | 0x02850004, | ||
| 272 | 0x11230000, | ||
| 273 | 0x784b0000, | ||
| 274 | 0x0000000f, | ||
| 275 | 0x78490001, | ||
| 276 | 0x00000000, | 777 | 0x00000000, |
| 277 | 0x00000000, | 778 | 0x00000000, |
| 278 | 0x7b000005, | ||
| 279 | 0x00000000, | 779 | 0x00000000, |
| 280 | 0x00000003, | ||
| 281 | 0x00000000, | 780 | 0x00000000, |
| 282 | 0x00000001, | ||
| 283 | 0x00000000, | 781 | 0x00000000, |
| 284 | 0x00000000, | 782 | 0x00000000, |
| 285 | 0x05000000, /* cmds end */ | ||
| 286 | 0x00000000, | 783 | 0x00000000, |
| 287 | 0x00000000, | 784 | 0x00000000, |
| 288 | 0x00000000, | 785 | 0x00000000, |
| @@ -297,8 +794,6 @@ static const u32 gen8_null_state_batch[] = { · 8 unmodified lines | |||
| 297 | 0x00000000, | 794 | 0x00000000, |
| 298 | 0x00000000, | 795 | 0x00000000, |
| 299 | 0x00000000, | 796 | 0x00000000, |
| 300 | 0x000004c0, /* state start */ | ||
| 301 | 0x00000500, | ||
| 302 | 0x00000000, | 797 | 0x00000000, |
| 303 | 0x00000000, | 798 | 0x00000000, |
| 304 | 0x00000000, | 799 | 0x00000000, |
| @@ -345,46 +840,65 @@ static const u32 gen8_null_state_batch[] = { · 40 unmodified lines | |||
| 345 | 0x00000000, | 840 | 0x00000000, |
| 346 | 0x00000000, | 841 | 0x00000000, |
| 347 | 0x00000000, | 842 | 0x00000000, |
| 843 | 0x680b0001, | ||
| 844 | 0x78260000, | ||
| 845 | 0x00000000, | ||
| 846 | 0x78270000, | ||
| 847 | 0x00000000, | ||
| 848 | 0x78280000, | ||
| 849 | 0x00000000, | ||
| 850 | 0x78290000, | ||
| 851 | 0x00000000, | ||
| 852 | 0x782a0000, | ||
| 853 | 0x00000000, | ||
| 854 | 0x780e0000, | ||
| 855 | 0x00000dc1, | ||
| 856 | 0x78240000, | ||
| 857 | 0x00000e01, | ||
| 858 | 0x784f0000, | ||
| 859 | 0x80000100, | ||
| 860 | 0x784d0000, | ||
| 861 | 0x40000000, | ||
| 862 | 0x782b0000, | ||
| 863 | 0x00000000, | ||
| 864 | 0x782c0000, | ||
| 865 | 0x00000000, | ||
| 866 | 0x782d0000, | ||
| 867 | 0x00000000, | ||
| 868 | 0x782e0000, | ||
| 869 | 0x00000000, | ||
| 870 | 0x782f0000, | ||
| 871 | 0x00000000, | ||
| 872 | 0x780f0000, | ||
| 348 | 0x00000000, | 873 | 0x00000000, |
| 874 | 0x78230000, | ||
| 875 | 0x00000e60, | ||
| 876 | 0x78210000, | ||
| 877 | 0x00000e80, | ||
| 878 | 0x7b000005, | ||
| 879 | 0x00000004, | ||
| 880 | 0x00000001, | ||
| 349 | 0x00000000, | 881 | 0x00000000, |
| 882 | 0x00000001, | ||
| 350 | 0x00000000, | 883 | 0x00000000, |
| 351 | 0x00000092, | ||
| 352 | 0x00000000, | 884 | 0x00000000, |
| 885 | 0x05000000, /* cmds end */ | ||
| 353 | 0x00000000, | 886 | 0x00000000, |
| 354 | 0x00000000, | 887 | 0x00000000, |
| 355 | 0x00000000, | 888 | 0x00000000, |
| 356 | 0x00000000, | 889 | 0x00000000, |
| 357 | 0x00000000, | 890 | 0x00000000, |
| 358 | 0x00000000, | 891 | 0x00000000, |
| 892 | 0x00000000, /* state start */ | ||
| 359 | 0x00000000, | 893 | 0x00000000, |
| 894 | 0x3f800000, | ||
| 895 | 0x3f800000, | ||
| 896 | 0x3f800000, | ||
| 897 | 0x3f800000, | ||
| 360 | 0x00000000, | 898 | 0x00000000, |
| 361 | 0x00000000, | 899 | 0x00000000, |
| 362 | 0x00000000, | 900 | 0x00000000, |
| 363 | 0x00000000, | 901 | 0x00000000, |
| 364 | 0x0060005a, | ||
| 365 | 0x21403ae8, | ||
| 366 | 0x3a0000c0, | ||
| 367 | 0x008d0040, | ||
| 368 | 0x0060005a, | ||
| 369 | 0x21603ae8, | ||
| 370 | 0x3a0000c0, | ||
| 371 | 0x008d0080, | ||
| 372 | 0x0060005a, | ||
| 373 | 0x21803ae8, | ||
| 374 | 0x3a0000d0, | ||
| 375 | 0x008d0040, | ||
| 376 | 0x0060005a, | ||
| 377 | 0x21a03ae8, | ||
| 378 | 0x3a0000d0, | ||
| 379 | 0x008d0080, | ||
| 380 | 0x02800031, | ||
| 381 | 0x2e0022e8, | ||
| 382 | 0x0e000140, | ||
| 383 | 0x08840001, | ||
| 384 | 0x05800031, | ||
| 385 | 0x200022e0, | ||
| 386 | 0x0e000e00, | ||
| 387 | 0x90031000, | ||
| 388 | 0x00000000, | 902 | 0x00000000, |
| 389 | 0x00000000, | 903 | 0x00000000, |
| 390 | 0x00000000, | 904 | 0x00000000, |
| @@ -410,38 +924,6 @@ static const u32 gen8_null_state_batch[] = { · 19 unmodified lines | |||
| 410 | 0x00000000, | 924 | 0x00000000, |
| 411 | 0x00000000, | 925 | 0x00000000, |
| 412 | 0x00000000, | 926 | 0x00000000, |
| 413 | 0x06200000, | ||
| 414 | 0x00000002, | ||
| 415 | 0x06200000, | ||
| 416 | 0x00000002, | ||
| 417 | 0x06200000, | ||
| 418 | 0x00000002, | ||
| 419 | 0x06200000, | ||
| 420 | 0x00000002, | ||
| 421 | 0x06200000, | ||
| 422 | 0x00000002, | ||
| 423 | 0x06200000, | ||
| 424 | 0x00000002, | ||
| 425 | 0x06200000, | ||
| 426 | 0x00000002, | ||
| 427 | 0x06200000, | ||
| 428 | 0x00000002, | ||
| 429 | 0x06200000, | ||
| 430 | 0x00000002, | ||
| 431 | 0x06200000, | ||
| 432 | 0x00000002, | ||
| 433 | 0x06200000, | ||
| 434 | 0x00000002, | ||
| 435 | 0x06200000, | ||
| 436 | 0x00000002, | ||
| 437 | 0x06200000, | ||
| 438 | 0x00000002, | ||
| 439 | 0x06200000, | ||
| 440 | 0x00000002, | ||
| 441 | 0x06200000, | ||
| 442 | 0x00000002, | ||
| 443 | 0x06200000, | ||
| 444 | 0x00000002, | ||
| 445 | 0x00000000, | 927 | 0x00000000, |
| 446 | 0x00000000, | 928 | 0x00000000, |
| 447 | 0x00000000, | 929 | 0x00000000, |
| @@ -449,8 +931,6 @@ static const u32 gen8_null_state_batch[] = { · 1 unmodified line | |||
| 449 | 0x00000000, | 931 | 0x00000000, |
| 450 | 0x00000000, | 932 | 0x00000000, |
| 451 | 0x00000000, | 933 | 0x00000000, |
| 452 | 0xf99a130c, | ||
| 453 | 0x799a130c, | ||
| 454 | 0x00000000, | 934 | 0x00000000, |
| 455 | 0x00000000, | 935 | 0x00000000, |
| 456 | 0x00000000, | 936 | 0x00000000, |
| @@ -466,9 +946,7 @@ static const u32 gen8_null_state_batch[] = { · 9 unmodified lines | |||
| 466 | 0x00000000, | 946 | 0x00000000, |
| 467 | 0x00000000, | 947 | 0x00000000, |
| 468 | 0x00000000, | 948 | 0x00000000, |
| 469 | 0x3f800000, | ||
| 470 | 0x00000000, | 949 | 0x00000000, |
| 471 | 0x3f800000, | ||
| 472 | 0x00000000, | 950 | 0x00000000, |
| 473 | 0x00000000, | 951 | 0x00000000, |
| 474 | 0x00000000, | 952 | 0x00000000, |
| @@ -0,0 +1,974 @@ | |||
| 1 | #include "intel_renderstate.h" | ||
| 2 | |||
| 3 | static const u32 gen9_null_state_relocs[] = { | ||
| 4 | 0x000007a8, | ||
| 5 | 0x000007b4, | ||
| 6 | 0x000007bc, | ||
| 7 | 0x000007cc, | ||
| 8 | -1, | ||
| 9 | }; | ||
| 10 | |||
| 11 | static const u32 gen9_null_state_batch[] = { | ||
| 12 | 0x7a000004, | ||
| 13 | 0x01000000, | ||
| 14 | 0x00000000, | ||
| 15 | 0x00000000, | ||
| 16 | 0x00000000, | ||
| 17 | 0x00000000, | ||
| 18 | 0x69040300, | ||
| 19 | 0x78140000, | ||
| 20 | 0x04000000, | ||
| 21 | 0x7820000a, | ||
| 22 | 0x00000000, | ||
| 23 | 0x00000000, | ||
| 24 | 0x80000000, | ||
| 25 | 0x00000000, | ||
| 26 | 0x00000000, | ||
| 27 | 0x00000000, | ||
| 28 | 0x00000000, | ||
| 29 | 0x00000000, | ||
| 30 | 0x00000000, | ||
| 31 | 0x00000000, | ||
| 32 | 0x00000000, | ||
| 33 | 0x78130002, | ||
| 34 | 0x00000000, | ||
| 35 | 0x00000000, | ||
| 36 | 0x02001808, | ||
| 37 | 0x781f0004, | ||
| 38 | 0x00000000, | ||
| 39 | 0x00000000, | ||
| 40 | 0x00000000, | ||
| 41 | 0x00000000, | ||
| 42 | 0x00000000, | ||
| 43 | 0x78510009, | ||
| 44 | 0x00000000, | ||
| 45 | 0x00000000, | ||
| 46 | 0x00000000, | ||
| 47 | 0x00000000, | ||
| 48 | 0x00000000, | ||
| 49 | 0x00000000, | ||
| 50 | 0x00000000, | ||
| 51 | 0x00000000, | ||
| 52 | 0x00000000, | ||
| 53 | 0x00000000, | ||
| 54 | 0x78100007, | ||
| 55 | 0x00000000, | ||
| 56 | 0x00000000, | ||
| 57 | 0x00010000, | ||
| 58 | 0x00000000, | ||
| 59 | 0x00000000, | ||
| 60 | 0x00000000, | ||
| 61 | 0x00000000, | ||
| 62 | 0x00000000, | ||
| 63 | 0x781b0007, | ||
| 64 | 0x00000000, | ||
| 65 | 0x00000000, | ||
| 66 | 0x00000000, | ||
| 67 | 0x00000000, | ||
| 68 | 0x00000000, | ||
| 69 | 0x00000000, | ||
| 70 | 0x00000800, | ||
| 71 | 0x00000000, | ||
| 72 | 0x78110008, | ||
| 73 | 0x00000000, | ||
| 74 | 0x00000000, | ||
| 75 | 0x00000000, | ||
| 76 | 0x00000000, | ||
| 77 | 0x00000000, | ||
| 78 | 0x00000000, | ||
| 79 | 0x00000000, | ||
| 80 | 0x00000000, | ||
| 81 | 0x00000000, | ||
| 82 | 0x781e0003, | ||
| 83 | 0x00000000, | ||
| 84 | 0x00000000, | ||
| 85 | 0x00000000, | ||
| 86 | 0x00000000, | ||
| 87 | 0x781d0009, | ||
| 88 | 0x00000000, | ||
| 89 | 0x00000000, | ||
| 90 | 0x00000000, | ||
| 91 | 0x00000000, | ||
| 92 | 0x00000000, | ||
| 93 | 0x00000000, | ||
| 94 | 0x00000000, | ||
| 95 | 0x00000000, | ||
| 96 | 0x00000000, | ||
| 97 | 0x00000000, | ||
| 98 | 0x78120002, | ||
| 99 | 0x00000000, | ||
| 100 | 0x00000000, | ||
| 101 | 0x00000000, | ||
| 102 | 0x78500003, | ||
| 103 | 0x00000000, | ||
| 104 | 0x00000000, | ||
| 105 | 0x00000000, | ||
| 106 | 0x00000000, | ||
| 107 | 0x781c0002, | ||
| 108 | 0x00000000, | ||
| 109 | 0x00000000, | ||
| 110 | 0x00000000, | ||
| 111 | 0x780c0000, | ||
| 112 | 0x00000000, | ||
| 113 | 0x78520003, | ||
| 114 | 0x00000000, | ||
| 115 | 0x00000000, | ||
| 116 | 0x00000000, | ||
| 117 | 0x00000000, | ||
| 118 | 0x78300000, | ||
| 119 | 0x08010040, | ||
| 120 | 0x78310000, | ||
| 121 | 0x1e000000, | ||
| 122 | 0x78320000, | ||
| 123 | 0x1e000000, | ||
| 124 | 0x78330000, | ||
| 125 | 0x1e000000, | ||
| 126 | 0x79190002, | ||
| 127 | 0x00000000, | ||
| 128 | 0x00000000, | ||
| 129 | 0x00000000, | ||
| 130 | 0x791a0002, | ||
| 131 | 0x00000000, | ||
| 132 | 0x00000000, | ||
| 133 | 0x00000000, | ||
| 134 | 0x791b0002, | ||
| 135 | 0x00000000, | ||
| 136 | 0x00000000, | ||
| 137 | 0x00000000, | ||
| 138 | 0x79120000, | ||
| 139 | 0x00000000, | ||
| 140 | 0x79130000, | ||
| 141 | 0x00000000, | ||
| 142 | 0x79140000, | ||
| 143 | 0x00000000, | ||
| 144 | 0x79150000, | ||
| 145 | 0x00000000, | ||
| 146 | 0x79160000, | ||
| 147 | 0x00000000, | ||
| 148 | 0x78150009, | ||
| 149 | 0x00000000, | ||
| 150 | 0x00000000, | ||
| 151 | 0x00000000, | ||
| 152 | 0x00000000, | ||
| 153 | 0x00000000, | ||
| 154 | 0x00000000, | ||
| 155 | 0x00000000, | ||
| 156 | 0x00000000, | ||
| 157 | 0x00000000, | ||
| 158 | 0x00000000, | ||
| 159 | 0x78190009, | ||
| 160 | 0x00000000, | ||
| 161 | 0x00000000, | ||
| 162 | 0x00000000, | ||
| 163 | 0x00000000, | ||
| 164 | 0x00000000, | ||
| 165 | 0x00000000, | ||
| 166 | 0x00000000, | ||
| 167 | 0x00000000, | ||
| 168 | 0x00000000, | ||
| 169 | 0x00000000, | ||
| 170 | 0x781a0009, | ||
| 171 | 0x00000000, | ||
| 172 | 0x00000000, | ||
| 173 | 0x00000000, | ||
| 174 | 0x00000000, | ||
| 175 | 0x00000000, | ||
| 176 | 0x00000000, | ||
| 177 | 0x00000000, | ||
| 178 | 0x00000000, | ||
| 179 | 0x00000000, | ||
| 180 | 0x00000000, | ||
| 181 | 0x78160009, | ||
| 182 | 0x00000000, | ||
| 183 | 0x00000000, | ||
| 184 | 0x00000000, | ||
| 185 | 0x00000000, | ||
| 186 | 0x00000000, | ||
| 187 | 0x00000000, | ||
| 188 | 0x00000000, | ||
| 189 | 0x00000000, | ||
| 190 | 0x00000000, | ||
| 191 | 0x00000000, | ||
| 192 | 0x78170009, | ||
| 193 | 0x00000000, | ||
| 194 | 0x00000000, | ||
| 195 | 0x00000000, | ||
| 196 | 0x00000000, | ||
| 197 | 0x00000000, | ||
| 198 | 0x00000000, | ||
| 199 | 0x00000000, | ||
| 200 | 0x00000000, | ||
| 201 | 0x00000000, | ||
| 202 | 0x00000000, | ||
| 203 | 0x78490001, | ||
| 204 | 0x00000000, | ||
| 205 | 0x00000000, | ||
| 206 | 0x784a0000, | ||
| 207 | 0x00000000, | ||
| 208 | 0x784b0000, | ||
| 209 | 0x00000004, | ||
| 210 | 0x79170101, | ||
| 211 | 0x00000000, | ||
| 212 | 0x00000080, | ||
| 213 | 0x00000000, | ||
| 214 | 0x00000000, | ||
| 215 | 0x00000000, | ||
| 216 | 0x00000000, | ||
| 217 | 0x00000000, | ||
| 218 | 0x00000000, | ||
| 219 | 0x00000000, | ||
| 220 | 0x00000000, | ||
| 221 | 0x00000000, | ||
| 222 | 0x00000000, | ||
| 223 | 0x00000000, | ||
| 224 | 0x00000000, | ||
| 225 | 0x00000000, | ||
| 226 | 0x00000000, | ||
| 227 | 0x00000000, | ||
| 228 | 0x00000000, | ||
| 229 | 0x00000000, | ||
| 230 | 0x00000000, | ||
| 231 | 0x00000000, | ||
| 232 | 0x00000000, | ||
| 233 | 0x00000000, | ||
| 234 | 0x00000000, | ||
| 235 | 0x00000000, | ||
| 236 | 0x00000000, | ||
| 237 | 0x00000000, | ||
| 238 | 0x00000000, | ||
| 239 | 0x00000000, | ||
| 240 | 0x00000000, | ||
| 241 | 0x00000000, | ||
| 242 | 0x00000000, | ||
| 243 | 0x00000000, | ||
| 244 | 0x00000000, | ||
| 245 | 0x00000000, | ||
| 246 | 0x00000000, | ||
| 247 | 0x00000000, | ||
| 248 | 0x00000000, | ||
| 249 | 0x00000000, | ||
| 250 | 0x00000000, | ||
| 251 | 0x00000000, | ||
| 252 | 0x00000000, | ||
| 253 | 0x00000000, | ||
| 254 | 0x00000000, | ||
| 255 | 0x00000000, | ||
| 256 | 0x00000000, | ||
| 257 | 0x00000000, | ||
| 258 | 0x00000000, | ||
| 259 | 0x00000000, | ||
| 260 | 0x00000000, | ||
| 261 | 0x00000000, | ||
| 262 | 0x00000000, | ||
| 263 | 0x00000000, | ||
| 264 | 0x00000000, | ||
| 265 | 0x00000000, | ||
| 266 | 0x00000000, | ||
| 267 | 0x00000000, | ||
| 268 | 0x00000000, | ||
| 269 | 0x00000000, | ||
| 270 | 0x00000000, | ||
| 271 | 0x00000000, | ||
| 272 | 0x00000000, | ||
| 273 | 0x00000000, | ||
| 274 | 0x00000000, | ||
| 275 | 0x00000000, | ||
| 276 | 0x00000000, | ||
| 277 | 0x00000000, | ||
| 278 | 0x00000000, | ||
| 279 | 0x00000000, | ||
| 280 | 0x00000000, | ||
| 281 | 0x00000000, | ||
| 282 | 0x00000000, | ||
| 283 | 0x00000000, | ||
| 284 | 0x00000000, | ||
| 285 | 0x00000000, | ||
| 286 | 0x00000000, | ||
| 287 | 0x00000000, | ||
| 288 | 0x00000000, | ||
| 289 | 0x00000000, | ||
| 290 | 0x00000000, | ||
| 291 | 0x00000000, | ||
| 292 | 0x00000000, | ||
| 293 | 0x00000000, | ||
| 294 | 0x00000000, | ||
| 295 | 0x00000000, | ||
| 296 | 0x00000000, | ||
| 297 | 0x00000000, | ||
| 298 | 0x00000000, | ||
| 299 | 0x00000000, | ||
| 300 | 0x00000000, | ||
| 301 | 0x00000000, | ||
| 302 | 0x00000000, | ||
| 303 | 0x00000000, | ||
| 304 | 0x00000000, | ||
| 305 | 0x00000000, | ||
| 306 | 0x00000000, | ||
| 307 | 0x00000000, | ||
| 308 | 0x00000000, | ||
| 309 | 0x00000000, | ||
| 310 | 0x00000000, | ||
| 311 | 0x00000000, | ||
| 312 | 0x00000000, | ||
| 313 | 0x00000000, | ||
| 314 | 0x00000000, | ||
| 315 | 0x00000000, | ||
| 316 | 0x00000000, | ||
| 317 | 0x00000000, | ||
| 318 | 0x00000000, | ||
| 319 | 0x00000000, | ||
| 320 | 0x00000000, | ||
| 321 | 0x00000000, | ||
| 322 | 0x00000000, | ||
| 323 | 0x00000000, | ||
| 324 | 0x00000000, | ||
| 325 | 0x00000000, | ||
| 326 | 0x00000000, | ||
| 327 | 0x00000000, | ||
| 328 | 0x00000000, | ||
| 329 | 0x00000000, | ||
| 330 | 0x00000000, | ||
| 331 | 0x00000000, | ||
| 332 | 0x00000000, | ||
| 333 | 0x00000000, | ||
| 334 | 0x00000000, | ||
| 335 | 0x00000000, | ||
| 336 | 0x00000000, | ||
| 337 | 0x00000000, | ||
| 338 | 0x00000000, | ||
| 339 | 0x00000000, | ||
| 340 | 0x00000000, | ||
| 341 | 0x00000000, | ||
| 342 | 0x00000000, | ||
| 343 | 0x00000000, | ||
| 344 | 0x00000000, | ||
| 345 | 0x00000000, | ||
| 346 | 0x00000000, | ||
| 347 | 0x00000000, | ||
| 348 | 0x00000000, | ||
| 349 | 0x00000000, | ||
| 350 | 0x00000000, | ||
| 351 | 0x00000000, | ||
| 352 | 0x00000000, | ||
| 353 | 0x00000000, | ||
| 354 | 0x00000000, | ||
| 355 | 0x00000000, | ||
| 356 | 0x00000000, | ||
| 357 | 0x00000000, | ||
| 358 | 0x00000000, | ||
| 359 | 0x00000000, | ||
| 360 | 0x00000000, | ||
| 361 | 0x00000000, | ||
| 362 | 0x00000000, | ||
| 363 | 0x00000000, | ||
| 364 | 0x00000000, | ||
| 365 | 0x00000000, | ||
| 366 | 0x00000000, | ||
| 367 | 0x00000000, | ||
| 368 | 0x00000000, | ||
| 369 | 0x00000000, | ||
| 370 | 0x00000000, | ||
| 371 | 0x00000000, | ||
| 372 | 0x00000000, | ||
| 373 | 0x00000000, | ||
| 374 | 0x00000000, | ||
| 375 | 0x00000000, | ||
| 376 | 0x00000000, | ||
| 377 | 0x00000000, | ||
| 378 | 0x00000000, | ||
| 379 | 0x00000000, | ||
| 380 | 0x00000000, | ||
| 381 | 0x00000000, | ||
| 382 | 0x00000000, | ||
| 383 | 0x00000000, | ||
| 384 | 0x00000000, | ||
| 385 | 0x00000000, | ||
| 386 | 0x00000000, | ||
| 387 | 0x00000000, | ||
| 388 | 0x00000000, | ||
| 389 | 0x00000000, | ||
| 390 | 0x00000000, | ||
| 391 | 0x00000000, | ||
| 392 | 0x00000000, | ||
| 393 | 0x00000000, | ||
| 394 | 0x00000000, | ||
| 395 | 0x00000000, | ||
| 396 | 0x00000000, | ||
| 397 | 0x00000000, | ||
| 398 | 0x00000000, | ||
| 399 | 0x00000000, | ||
| 400 | 0x00000000, | ||
| 401 | 0x00000000, | ||
| 402 | 0x00000000, | ||
| 403 | 0x00000000, | ||
| 404 | 0x00000000, | ||
| 405 | 0x00000000, | ||
| 406 | 0x00000000, | ||
| 407 | 0x00000000, | ||
| 408 | 0x00000000, | ||
| 409 | 0x00000000, | ||
| 410 | 0x00000000, | ||
| 411 | 0x00000000, | ||
| 412 | 0x00000000, | ||
| 413 | 0x00000000, | ||
| 414 | 0x00000000, | ||
| 415 | 0x00000000, | ||
| 416 | 0x00000000, | ||
| 417 | 0x00000000, | ||
| 418 | 0x00000000, | ||
| 419 | 0x00000000, | ||
| 420 | 0x00000000, | ||
| 421 | 0x00000000, | ||
| 422 | 0x00000000, | ||
| 423 | 0x00000000, | ||
| 424 | 0x00000000, | ||
| 425 | 0x00000000, | ||
| 426 | 0x00000000, | ||
| 427 | 0x00000000, | ||
| 428 | 0x00000000, | ||
| 429 | 0x00000000, | ||
| 430 | 0x00000000, | ||
| 431 | 0x00000000, | ||
| 432 | 0x00000000, | ||
| 433 | 0x00000000, | ||
| 434 | 0x00000000, | ||
| 435 | 0x00000000, | ||
| 436 | 0x00000000, | ||
| 437 | 0x00000000, | ||
| 438 | 0x00000000, | ||
| 439 | 0x00000000, | ||
| 440 | 0x00000000, | ||
| 441 | 0x00000000, | ||
| 442 | 0x00000000, | ||
| 443 | 0x00000000, | ||
| 444 | 0x00000000, | ||
| 445 | 0x00000000, | ||
| 446 | 0x00000000, | ||
| 447 | 0x00000000, | ||
| 448 | 0x00000000, | ||
| 449 | 0x00000000, | ||
| 450 | 0x00000000, | ||
| 451 | 0x00000000, | ||
| 452 | 0x00000000, | ||
| 453 | 0x00000000, | ||
| 454 | 0x00000000, | ||
| 455 | 0x00000000, | ||
| 456 | 0x00000000, | ||
| 457 | 0x00000000, | ||
| 458 | 0x00000000, | ||
| 459 | 0x00000000, | ||
| 460 | 0x00000000, | ||
| 461 | 0x00000000, | ||
| 462 | 0x00000000, | ||
| 463 | 0x00000000, | ||
| 464 | 0x00000000, | ||
| 465 | 0x00000000, | ||
| 466 | 0x00000000, | ||
| 467 | 0x00000000, | ||
| 468 | 0x00000000, | ||
| 469 | 0x79180006, | ||
| 470 | 0x00000000, | ||
| 471 | 0x00000000, | ||
| 472 | 0x00000000, | ||
| 473 | 0x00000000, | ||
| 474 | 0x00000000, | ||
| 475 | 0x00000000, | ||
| 476 | 0x00000000, | ||
| 477 | 0x79180006, | ||
| 478 | 0x20000000, | ||
| 479 | 0x00000000, | ||
| 480 | 0x00000000, | ||
| 481 | 0x00000000, | ||
| 482 | 0x00000000, | ||
| 483 | 0x00000000, | ||
| 484 | 0x00000000, | ||
| 485 | 0x79180006, | ||
| 486 | 0x40000000, | ||
| 487 | 0x00000000, | ||
| 488 | 0x00000000, | ||
| 489 | 0x00000000, | ||
| 490 | 0x00000000, | ||
| 491 | 0x00000000, | ||
| 492 | 0x00000000, | ||
| 493 | 0x79180006, | ||
| 494 | 0x60000000, | ||
| 495 | 0x00000000, | ||
| 496 | 0x00000000, | ||
| 497 | 0x00000000, | ||
| 498 | 0x00000000, | ||
| 499 | 0x00000000, | ||
| 500 | 0x00000000, | ||
| 501 | 0x61010011, | ||
| 502 | 0x00000001, /* reloc */ | ||
| 503 | 0x00000000, | ||
| 504 | 0x00000000, | ||
| 505 | 0x00000001, /* reloc */ | ||
| 506 | 0x00000000, | ||
| 507 | 0x00000001, /* reloc */ | ||
| 508 | 0x00000000, | ||
| 509 | 0x00000001, | ||
| 510 | 0x00000000, | ||
| 511 | 0x00000001, /* reloc */ | ||
| 512 | 0x00000000, | ||
| 513 | 0x00001001, | ||
| 514 | 0x00001001, | ||
| 515 | 0x00000001, | ||
| 516 | 0x00001001, | ||
| 517 | 0x00000000, | ||
| 518 | 0x00000000, | ||
| 519 | 0x00000000, | ||
| 520 | 0x61020001, | ||
| 521 | 0x00000000, | ||
| 522 | 0x00000000, | ||
| 523 | 0x79000002, | ||
| 524 | 0x00000000, | ||
| 525 | 0x00000000, | ||
| 526 | 0x00000000, | ||
| 527 | 0x78050006, | ||
| 528 | 0x00000000, | ||
| 529 | 0x00000000, | ||
| 530 | 0x00000000, | ||
| 531 | 0x00000000, | ||
| 532 | 0x00000000, | ||
| 533 | 0x00000000, | ||
| 534 | 0x00000000, | ||
| 535 | 0x79040002, | ||
| 536 | 0x00000000, | ||
| 537 | 0x00000000, | ||
| 538 | 0x00000000, | ||
| 539 | 0x79040002, | ||
| 540 | 0x40000000, | ||
| 541 | 0x00000000, | ||
| 542 | 0x00000000, | ||
| 543 | 0x79040002, | ||
| 544 | 0x80000000, | ||
| 545 | 0x00000000, | ||
| 546 | 0x00000000, | ||
| 547 | 0x79040002, | ||
| 548 | 0xc0000000, | ||
| 549 | 0x00000000, | ||
| 550 | 0x00000000, | ||
| 551 | 0x79080001, | ||
| 552 | 0x00000000, | ||
| 553 | 0x00000000, | ||
| 554 | 0x790a0001, | ||
| 555 | 0x00000000, | ||
| 556 | 0x00000000, | ||
| 557 | 0x78060003, | ||
| 558 | 0x00000000, | ||
| 559 | 0x00000000, | ||
| 560 | 0x00000000, | ||
| 561 | 0x00000000, | ||
| 562 | 0x78070003, | ||
| 563 | 0x00000000, | ||
| 564 | 0x00000000, | ||
| 565 | 0x00000000, | ||
| 566 | 0x00000000, | ||
| 567 | 0x78040001, | ||
| 568 | 0x00000000, | ||
| 569 | 0x00000000, | ||
| 570 | 0x79110000, | ||
| 571 | 0x00000000, | ||
| 572 | 0x780d0000, | ||
| 573 | 0x00000000, | ||
| 574 | 0x79060000, | ||
| 575 | 0x00000000, | ||
| 576 | 0x7907001f, | ||
| 577 | 0x00000000, | ||
| 578 | 0x00000000, | ||
| 579 | 0x00000000, | ||
| 580 | 0x00000000, | ||
| 581 | 0x00000000, | ||
| 582 | 0x00000000, | ||
| 583 | 0x00000000, | ||
| 584 | 0x00000000, | ||
| 585 | 0x00000000, | ||
| 586 | 0x00000000, | ||
| 587 | 0x00000000, | ||
| 588 | 0x00000000, | ||
| 589 | 0x00000000, | ||
| 590 | 0x00000000, | ||
| 591 | 0x00000000, | ||
| 592 | 0x00000000, | ||
| 593 | 0x00000000, | ||
| 594 | 0x00000000, | ||
| 595 | 0x00000000, | ||
| 596 | 0x00000000, | ||
| 597 | 0x00000000, | ||
| 598 | 0x00000000, | ||
| 599 | 0x00000000, | ||
| 600 | 0x00000000, | ||
| 601 | 0x00000000, | ||
| 602 | 0x00000000, | ||
| 603 | 0x00000000, | ||
| 604 | 0x00000000, | ||
| 605 | 0x00000000, | ||
| 606 | 0x00000000, | ||
| 607 | 0x00000000, | ||
| 608 | 0x00000000, | ||
| 609 | 0x7902000f, | ||
| 610 | 0x00000000, | ||
| 611 | 0x00000000, | ||
| 612 | 0x00000000, | ||
| 613 | 0x00000000, | ||
| 614 | 0x00000000, | ||
| 615 | 0x00000000, | ||
| 616 | 0x00000000, | ||
| 617 | 0x00000000, | ||
| 618 | 0x00000000, | ||
| 619 | 0x00000000, | ||
| 620 | 0x00000000, | ||
| 621 | 0x00000000, | ||
| 622 | 0x00000000, | ||
| 623 | 0x00000000, | ||
| 624 | 0x00000000, | ||
| 625 | 0x00000000, | ||
| 626 | 0x790c000f, | ||
| 627 | 0x00000000, | ||
| 628 | 0x00000000, | ||
| 629 | 0x00000000, | ||
| 630 | 0x00000000, | ||
| 631 | 0x00000000, | ||
| 632 | 0x00000000, | ||
| 633 | 0x00000000, | ||
| 634 | 0x00000000, | ||
| 635 | 0x00000000, | ||
| 636 | 0x00000000, | ||
| 637 | 0x00000000, | ||
| 638 | 0x00000000, | ||
| 639 | 0x00000000, | ||
| 640 | 0x00000000, | ||
| 641 | 0x00000000, | ||
| 642 | 0x00000000, | ||
| 643 | 0x780a0003, | ||
| 644 | 0x00000000, | ||
| 645 | 0x00000000, | ||
| 646 | 0x00000000, | ||
| 647 | 0x00000000, | ||
| 648 | 0x78080083, | ||
| 649 | 0x00004000, | ||
| 650 | 0x00000000, | ||
| 651 | 0x00000000, | ||
| 652 | 0x00000000, | ||
| 653 | 0x04004000, | ||
| 654 | 0x00000000, | ||
| 655 | 0x00000000, | ||
| 656 | 0x00000000, | ||
| 657 | 0x08004000, | ||
| 658 | 0x00000000, | ||
| 659 | 0x00000000, | ||
| 660 | 0x00000000, | ||
| 661 | 0x0c004000, | ||
| 662 | 0x00000000, | ||
| 663 | 0x00000000, | ||
| 664 | 0x00000000, | ||
| 665 | 0x10004000, | ||
| 666 | 0x00000000, | ||
| 667 | 0x00000000, | ||
| 668 | 0x00000000, | ||
| 669 | 0x14004000, | ||
| 670 | 0x00000000, | ||
| 671 | 0x00000000, | ||
| 672 | 0x00000000, | ||
| 673 | 0x18004000, | ||
| 674 | 0x00000000, | ||
| 675 | 0x00000000, | ||
| 676 | 0x00000000, | ||
| 677 | 0x1c004000, | ||
| 678 | 0x00000000, | ||
| 679 | 0x00000000, | ||
| 680 | 0x00000000, | ||
| 681 | 0x20004000, | ||
| 682 | 0x00000000, | ||
| 683 | 0x00000000, | ||
| 684 | 0x00000000, | ||
| 685 | 0x24004000, | ||
| 686 | 0x00000000, | ||
| 687 | 0x00000000, | ||
| 688 | 0x00000000, | ||
| 689 | 0x28004000, | ||
| 690 | 0x00000000, | ||
| 691 | 0x00000000, | ||
| 692 | 0x00000000, | ||
| 693 | 0x2c004000, | ||
| 694 | 0x00000000, | ||
| 695 | 0x00000000, | ||
| 696 | 0x00000000, | ||
| 697 | 0x30004000, | ||
| 698 | 0x00000000, | ||
| 699 | 0x00000000, | ||
| 700 | 0x00000000, | ||
| 701 | 0x34004000, | ||
| 702 | 0x00000000, | ||
| 703 | 0x00000000, | ||
| 704 | 0x00000000, | ||
| 705 | 0x38004000, | ||
| 706 | 0x00000000, | ||
| 707 | 0x00000000, | ||
| 708 | 0x00000000, | ||
| 709 | 0x3c004000, | ||
| 710 | 0x00000000, | ||
| 711 | 0x00000000, | ||
| 712 | 0x00000000, | ||
| 713 | 0x40004000, | ||
| 714 | 0x00000000, | ||
| 715 | 0x00000000, | ||
| 716 | 0x00000000, | ||
| 717 | 0x44004000, | ||
| 718 | 0x00000000, | ||
| 719 | 0x00000000, | ||
| 720 | 0x00000000, | ||
| 721 | 0x48004000, | ||
| 722 | 0x00000000, | ||
| 723 | 0x00000000, | ||
| 724 | 0x00000000, | ||
| 725 | 0x4c004000, | ||
| 726 | 0x00000000, | ||
| 727 | 0x00000000, | ||
| 728 | 0x00000000, | ||
| 729 | 0x50004000, | ||
| 730 | 0x00000000, | ||
| 731 | 0x00000000, | ||
| 732 | 0x00000000, | ||
| 733 | 0x54004000, | ||
| 734 | 0x00000000, | ||
| 735 | 0x00000000, | ||
| 736 | 0x00000000, | ||
| 737 | 0x58004000, | ||
| 738 | 0x00000000, | ||
| 739 | 0x00000000, | ||
| 740 | 0x00000000, | ||
| 741 | 0x5c004000, | ||
| 742 | 0x00000000, | ||
| 743 | 0x00000000, | ||
| 744 | 0x00000000, | ||
| 745 | 0x60004000, | ||
| 746 | 0x00000000, | ||
| 747 | 0x00000000, | ||
| 748 | 0x00000000, | ||
| 749 | 0x64004000, | ||
| 750 | 0x00000000, | ||
| 751 | 0x00000000, | ||
| 752 | 0x00000000, | ||
| 753 | 0x68004000, | ||
| 754 | 0x00000000, | ||
| 755 | 0x00000000, | ||
| 756 | 0x00000000, | ||
| 757 | 0x6c004000, | ||
| 758 | 0x00000000, | ||
| 759 | 0x00000000, | ||
| 760 | 0x00000000, | ||
| 761 | 0x70004000, | ||
| 762 | 0x00000000, | ||
| 763 | 0x00000000, | ||
| 764 | 0x00000000, | ||
| 765 | 0x74004000, | ||
| 766 | 0x00000000, | ||
| 767 | 0x00000000, | ||
| 768 | 0x00000000, | ||
| 769 | 0x78004000, | ||
| 770 | 0x00000000, | ||
| 771 | 0x00000000, | ||
| 772 | 0x00000000, | ||
| 773 | 0x7c004000, | ||
| 774 | 0x00000000, | ||
| 775 | 0x00000000, | ||
| 776 | 0x00000000, | ||
| 777 | 0x80004000, | ||
| 778 | 0x00000000, | ||
| 779 | 0x00000000, | ||
| 780 | 0x00000000, | ||
| 781 | 0x78090043, | ||
| 782 | 0x02000000, | ||
| 783 | 0x22220000, | ||
| 784 | 0x00000000, | ||
| 785 | 0x00000000, | ||
| 786 | 0x00000000, | ||
| 787 | 0x00000000, | ||
| 788 | 0x00000000, | ||
| 789 | 0x00000000, | ||
| 790 | 0x00000000, | ||
| 791 | 0x00000000, | ||
| 792 | 0x00000000, | ||
| 793 | 0x00000000, | ||
| 794 | 0x00000000, | ||
| 795 | 0x00000000, | ||
| 796 | 0x00000000, | ||
| 797 | 0x00000000, | ||
| 798 | 0x00000000, | ||
| 799 | 0x00000000, | ||
| 800 | 0x00000000, | ||
| 801 | 0x00000000, | ||
| 802 | 0x00000000, | ||
| 803 | 0x00000000, | ||
| 804 | 0x00000000, | ||
| 805 | 0x00000000, | ||
| 806 | 0x00000000, | ||
| 807 | 0x00000000, | ||
| 808 | 0x00000000, | ||
| 809 | 0x00000000, | ||
| 810 | 0x00000000, | ||
| 811 | 0x00000000, | ||
| 812 | 0x00000000, | ||
| 813 | 0x00000000, | ||
| 814 | 0x00000000, | ||
| 815 | 0x00000000, | ||
| 816 | 0x00000000, | ||
| 817 | 0x00000000, | ||
| 818 | 0x00000000, | ||
| 819 | 0x00000000, | ||
| 820 | 0x00000000, | ||
| 821 | 0x00000000, | ||
| 822 | 0x00000000, | ||
| 823 | 0x00000000, | ||
| 824 | 0x00000000, | ||
| 825 | 0x00000000, | ||
| 826 | 0x00000000, | ||
| 827 | 0x00000000, | ||
| 828 | 0x00000000, | ||
| 829 | 0x00000000, | ||
| 830 | 0x00000000, | ||
| 831 | 0x00000000, | ||
| 832 | 0x00000000, | ||
| 833 | 0x00000000, | ||
| 834 | 0x00000000, | ||
| 835 | 0x00000000, | ||
| 836 | 0x00000000, | ||
| 837 | 0x00000000, | ||
| 838 | 0x00000000, | ||
| 839 | 0x00000000, | ||
| 840 | 0x00000000, | ||
| 841 | 0x00000000, | ||
| 842 | 0x00000000, | ||
| 843 | 0x00000000, | ||
| 844 | 0x00000000, | ||
| 845 | 0x00000000, | ||
| 846 | 0x00000000, | ||
| 847 | 0x00000000, | ||
| 848 | 0x00000000, | ||
| 849 | 0x00000000, | ||
| 850 | 0x78550003, | ||
| 851 | 0x00000000, | ||
| 852 | 0x00000000, | ||
| 853 | 0x00000000, | ||
| 854 | 0x00000000, | ||
| 855 | 0x680b0001, | ||
| 856 | 0x780e0000, | ||
| 857 | 0x00000e01, | ||
| 858 | 0x78240000, | ||
| 859 | 0x00000e41, | ||
| 860 | 0x784f0000, | ||
| 861 | 0x80000100, | ||
| 862 | 0x784d0000, | ||
| 863 | 0x40000000, | ||
| 864 | 0x782b0000, | ||
| 865 | 0x00000000, | ||
| 866 | 0x782c0000, | ||
| 867 | 0x00000000, | ||
| 868 | 0x782d0000, | ||
| 869 | 0x00000000, | ||
| 870 | 0x782e0000, | ||
| 871 | 0x00000000, | ||
| 872 | 0x782f0000, | ||
| 873 | 0x00000000, | ||
| 874 | 0x780f0000, | ||
| 875 | 0x00000000, | ||
| 876 | 0x78230000, | ||
| 877 | 0x00000ea0, | ||
| 878 | 0x78210000, | ||
| 879 | 0x00000ec0, | ||
| 880 | 0x78260000, | ||
| 881 | 0x00000000, | ||
| 882 | 0x78270000, | ||
| 883 | 0x00000000, | ||
| 884 | 0x78280000, | ||
| 885 | 0x00000000, | ||
| 886 | 0x78290000, | ||
| 887 | 0x00000000, | ||
| 888 | 0x782a0000, | ||
| 889 | 0x00000000, | ||
| 890 | 0x7b000005, | ||
| 891 | 0x00000004, | ||
| 892 | 0x00000001, | ||
| 893 | 0x00000000, | ||
| 894 | 0x00000001, | ||
| 895 | 0x00000000, | ||
| 896 | 0x00000000, | ||
| 897 | 0x05000000, /* cmds end */ | ||
| 898 | 0x00000000, | ||
| 899 | 0x00000000, | ||
| 900 | 0x00000000, | ||
| 901 | 0x00000000, | ||
| 902 | 0x00000000, | ||
| 903 | 0x00000000, | ||
| 904 | 0x00000000, | ||
| 905 | 0x00000000, | ||
| 906 | 0x00000000, | ||
| 907 | 0x00000000, | ||
| 908 | 0x00000000, /* state start */ | ||
| 909 | 0x00000000, | ||
| 910 | 0x3f800000, | ||
| 911 | 0x3f800000, | ||
| 912 | 0x3f800000, | ||
| 913 | 0x3f800000, | ||
| 914 | 0x00000000, | ||
| 915 | 0x00000000, | ||
| 916 | 0x00000000, | ||
| 917 | 0x00000000, | ||
| 918 | 0x00000000, | ||
| 919 | 0x00000000, | ||
| 920 | 0x00000000, | ||
| 921 | 0x00000000, | ||
| 922 | 0x00000000, | ||
| 923 | 0x00000000, | ||
| 924 | 0x00000000, | ||
| 925 | 0x00000000, | ||
| 926 | 0x00000000, | ||
| 927 | 0x00000000, | ||
| 928 | 0x00000000, | ||
| 929 | 0x00000000, | ||
| 930 | 0x00000000, | ||
| 931 | 0x00000000, | ||
| 932 | 0x00000000, | ||
| 933 | 0x00000000, | ||
| 934 | 0x00000000, | ||
| 935 | 0x00000000, | ||
| 936 | 0x00000000, | ||
| 937 | 0x00000000, | ||
| 938 | 0x00000000, | ||
| 939 | 0x00000000, | ||
| 940 | 0x00000000, | ||
| 941 | 0x00000000, | ||
| 942 | 0x00000000, | ||
| 943 | 0x00000000, | ||
| 944 | 0x00000000, | ||
| 945 | 0x00000000, | ||
| 946 | 0x00000000, | ||
| 947 | 0x00000000, | ||
| 948 | 0x00000000, | ||
| 949 | 0x00000000, | ||
| 950 | 0x00000000, | ||
| 951 | 0x00000000, | ||
| 952 | 0x00000000, | ||
| 953 | 0x00000000, | ||
| 954 | 0x00000000, | ||
| 955 | 0x00000000, | ||
| 956 | 0x00000000, | ||
| 957 | 0x00000000, | ||
| 958 | 0x00000000, | ||
| 959 | 0x00000000, | ||
| 960 | 0x00000000, | ||
| 961 | 0x00000000, | ||
| 962 | 0x00000000, | ||
| 963 | 0x00000000, | ||
| 964 | 0x00000000, | ||
| 965 | 0x00000000, | ||
| 966 | 0x00000000, | ||
| 967 | 0x00000000, | ||
| 968 | 0x00000000, | ||
| 969 | 0x00000000, | ||
| 970 | 0x00000000, | ||
| 971 | 0x00000000, /* state end */ | ||
| 972 | }; | ||
| 973 | |||
| 974 | RO_RENDERSTATE(9); | ||
| @@ -1845,12 +1845,15 @@ error: · 1844 unmodified lines | |||
| 1845 | 1845 | ||
| 1846 | void intel_cleanup_ring_buffer(struct intel_engine_cs *ring) | 1846 | void intel_cleanup_ring_buffer(struct intel_engine_cs *ring) |
| 1847 | { | 1847 | { |
| 1848 | struct drm_i915_private *dev_priv = to_i915(ring->dev); | 1848 | struct drm_i915_private *dev_priv; |
| 1849 | struct intel_ringbuffer *ringbuf = ring->buffer; | 1849 | struct intel_ringbuffer *ringbuf; |
| 1850 | 1850 | ||
| 1851 | if (!intel_ring_initialized(ring)) | 1851 | if (!intel_ring_initialized(ring)) |
| 1852 | return; | 1852 | return; |
| 1853 | 1853 | ||
| 1854 | dev_priv = to_i915(ring->dev); | ||
| 1855 | ringbuf = ring->buffer; | ||
| 1856 | |||
| 1854 | intel_stop_ring_buffer(ring); | 1857 | intel_stop_ring_buffer(ring); |
| 1855 | WARN_ON(!IS_GEN2(ring->dev) && (I915_READ_MODE(ring) & MODE_IDLE) == 0); | 1858 | WARN_ON(!IS_GEN2(ring->dev) && (I915_READ_MODE(ring) & MODE_IDLE) == 0); |
| 1856 | 1859 | ||
| @@ -587,6 +587,9 @@ static void chv_pipe_power_well_disable(struct drm_i915_private *dev_priv, · 586 unmodified lines | |||
| 587 | power_well->data != PIPE_C); | 587 | power_well->data != PIPE_C); |
| 588 | 588 | ||
| 589 | chv_set_pipe_power_well(dev_priv, power_well, false); | 589 | chv_set_pipe_power_well(dev_priv, power_well, false); |
| 590 | |||
| 591 | if (power_well->data == PIPE_A) | ||
| 592 | vlv_power_sequencer_reset(dev_priv); | ||
| 590 | } | 593 | } |
| 591 | 594 | ||
| 592 | static void check_power_well_state(struct drm_i915_private *dev_priv, | 595 | static void check_power_well_state(struct drm_i915_private *dev_priv, |
| @@ -938,12 +941,20 @@ static struct i915_power_well chv_power_wells[] = { · 345 unmodified lines | |||
| 938 | .data = PUNIT_POWER_WELL_DISP2D, | 941 | .data = PUNIT_POWER_WELL_DISP2D, |
| 939 | .ops = &vlv_display_power_well_ops, | 942 | .ops = &vlv_display_power_well_ops, |
| 940 | }, | 943 | }, |
| 944 | #endif | ||
| 941 | { | 945 | { |
| 942 | .name = "pipe-a", | 946 | .name = "pipe-a", |
| 943 | .domains = CHV_PIPE_A_POWER_DOMAINS, | 947 | /* |
| 948 | * FIXME: pipe A power well seems to be the new disp2d well. | ||
| 949 | * At least all registers seem to be housed there. Figure | ||
| 950 | * out if this a a temporary situation in pre-production | ||
| 951 | * hardware or a permanent state of affairs. | ||
| 952 | */ | ||
| 953 | .domains = CHV_PIPE_A_POWER_DOMAINS | VLV_DISPLAY_POWER_DOMAINS, | ||
| 944 | .data = PIPE_A, | 954 | .data = PIPE_A, |
| 945 | .ops = &chv_pipe_power_well_ops, | 955 | .ops = &chv_pipe_power_well_ops, |
| 946 | }, | 956 | }, |
| 957 | #if 0 | ||
| 947 | { | 958 | { |
| 948 | .name = "pipe-b", | 959 | .name = "pipe-b", |
| 949 | .domains = CHV_PIPE_B_POWER_DOMAINS, | 960 | .domains = CHV_PIPE_B_POWER_DOMAINS, |
| @@ -1137,12 +1148,9 @@ static void vlv_cmnlane_wa(struct drm_i915_private *dev_priv) · 187 unmodified lines | |||
| 1137 | struct i915_power_well *disp2d = | 1148 | struct i915_power_well *disp2d = |
| 1138 | lookup_power_well(dev_priv, PUNIT_POWER_WELL_DISP2D); | 1149 | lookup_power_well(dev_priv, PUNIT_POWER_WELL_DISP2D); |
| 1139 | 1150 | ||
| 1140 | /* nothing to do if common lane is already off */ | ||
| 1141 | if (!cmn->ops->is_enabled(dev_priv, cmn)) | ||
| 1142 | return; | ||
| 1143 | |||
| 1144 | /* If the display might be already active skip this */ | 1151 | /* If the display might be already active skip this */ |
| 1145 | if (disp2d->ops->is_enabled(dev_priv, disp2d) && | 1152 | if (cmn->ops->is_enabled(dev_priv, cmn) && |
| 1153 | disp2d->ops->is_enabled(dev_priv, disp2d) && | ||
| 1146 | I915_READ(DPIO_CTL) & DPIO_CMNRST) | 1154 | I915_READ(DPIO_CTL) & DPIO_CMNRST) |
| 1147 | return; | 1155 | return; |
| 1148 | 1156 | ||
| @@ -37,6 +37,20 @@ · 36 unmodified lines | |||
| 37 | #include <drm/i915_drm.h> | 37 | #include <drm/i915_drm.h> |
| 38 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
| 39 | 39 | ||
| 40 | static bool | ||
| 41 | format_is_yuv(uint32_t format) | ||
| 42 | { | ||
| 43 | switch (format) { | ||
| 44 | case DRM_FORMAT_YUYV: | ||
| 45 | case DRM_FORMAT_UYVY: | ||
| 46 | case DRM_FORMAT_VYUY: | ||
| 47 | case DRM_FORMAT_YVYU: | ||
| 48 | return true; | ||
| 49 | default: | ||
| 50 | return false; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 40 | static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs) | 54 | static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs) |
| 41 | { | 55 | { |
| 42 | /* paranoia */ | 56 | /* paranoia */ |
| @@ -46,7 +60,23 @@ static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs) · 3 unmodified lines | |||
| 46 | return DIV_ROUND_UP(usecs * mode->crtc_clock, 1000 * mode->crtc_htotal); | 60 | return DIV_ROUND_UP(usecs * mode->crtc_clock, 1000 * mode->crtc_htotal); |
| 47 | } | 61 | } |
| 48 | 62 | ||
| 49 | static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl_count) | 63 | /** |
| 64 | * intel_pipe_update_start() - start update of a set of display registers | ||
| 65 | * @crtc: the crtc of which the registers are going to be updated | ||
| 66 | * @start_vbl_count: vblank counter return pointer used for error checking | ||
| 67 | * | ||
| 68 | * Mark the start of an update to pipe registers that should be updated | ||
| 69 | * atomically regarding vblank. If the next vblank will happens within | ||
| 70 | * the next 100 us, this function waits until the vblank passes. | ||
| 71 | * | ||
| 72 | * After a successful call to this function, interrupts will be disabled | ||
| 73 | * until a subsequent call to intel_pipe_update_end(). That is done to | ||
| 74 | * avoid random delays. The value written to @start_vbl_count should be | ||
| 75 | * supplied to intel_pipe_update_end() for error checking. | ||
| 76 | * | ||
| 77 | * Return: true if the call was successful | ||
| 78 | */ | ||
| 79 | bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl_count) | ||
| 50 | { | 80 | { |
| 51 | struct drm_device *dev = crtc->base.dev; | 81 | struct drm_device *dev = crtc->base.dev; |
| 52 | const struct drm_display_mode *mode = &crtc->config.adjusted_mode; | 82 | const struct drm_display_mode *mode = &crtc->config.adjusted_mode; |
| @@ -56,8 +86,6 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl · 3 unmodified lines | |||
| 56 | wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base); | 86 | wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base); |
| 57 | DEFINE_WAIT(wait); | 87 | DEFINE_WAIT(wait); |
| 58 | 88 | ||
| 59 | WARN_ON(!drm_modeset_is_locked(&crtc->base.mutex)); | ||
| 60 | |||
| 61 | vblank_start = mode->crtc_vblank_start; | 89 | vblank_start = mode->crtc_vblank_start; |
| 62 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) | 90 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) |
| 63 | vblank_start = DIV_ROUND_UP(vblank_start, 2); | 91 | vblank_start = DIV_ROUND_UP(vblank_start, 2); |
| @@ -112,7 +140,16 @@ static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl · 48 unmodified lines | |||
| 112 | return true; | 140 | return true; |
| 113 | } | 141 | } |
| 114 | 142 | ||
| 115 | static void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count) | 143 | /** |
| 144 | * intel_pipe_update_end() - end update of a set of display registers | ||
| 145 | * @crtc: the crtc of which the registers were updated | ||
| 146 | * @start_vbl_count: start vblank counter (used for error checking) | ||
| 147 | * | ||
| 148 | * Mark the end of an update started with intel_pipe_update_start(). This | ||
| 149 | * re-enables interrupts and verifies the update was actually completed | ||
| 150 | * before a vblank using the value of @start_vbl_count. | ||
| 151 | */ | ||
| 152 | void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count) | ||
| 116 | { | 153 | { |
| 117 | struct drm_device *dev = crtc->base.dev; | 154 | struct drm_device *dev = crtc->base.dev; |
| 118 | enum pipe pipe = crtc->pipe; | 155 | enum pipe pipe = crtc->pipe; |
| @@ -319,6 +356,45 @@ skl_get_colorkey(struct drm_plane *drm_plane, · 200 unmodified lines | |||
| 319 | } | 356 | } |
| 320 | } | 357 | } |
| 321 | 358 | ||
| 359 | static void | ||
| 360 | chv_update_csc(struct intel_plane *intel_plane, uint32_t format) | ||
| 361 | { | ||
| 362 | struct drm_i915_private *dev_priv = intel_plane->base.dev->dev_private; | ||
| 363 | int plane = intel_plane->plane; | ||
| 364 | |||
| 365 | /* Seems RGB data bypasses the CSC always */ | ||
| 366 | if (!format_is_yuv(format)) | ||
| 367 | return; | ||
| 368 | |||
| 369 | /* | ||
| 370 | * BT.601 limited range YCbCr -> full range RGB | ||
| 371 | * | ||
| 372 | * |r| | 6537 4769 0| |cr | | ||
| 373 | * |g| = |-3330 4769 -1605| x |y-64| | ||
| 374 | * |b| | 0 4769 8263| |cb | | ||
| 375 | * | ||
| 376 | * Cb and Cr apparently come in as signed already, so no | ||
| 377 | * need for any offset. For Y we need to remove the offset. | ||
| 378 | */ | ||
| 379 | I915_WRITE(SPCSCYGOFF(plane), SPCSC_OOFF(0) | SPCSC_IOFF(-64)); | ||
| 380 | I915_WRITE(SPCSCCBOFF(plane), SPCSC_OOFF(0) | SPCSC_IOFF(0)); | ||
| 381 | I915_WRITE(SPCSCCROFF(plane), SPCSC_OOFF(0) | SPCSC_IOFF(0)); | ||
| 382 | |||
| 383 | I915_WRITE(SPCSCC01(plane), SPCSC_C1(4769) | SPCSC_C0(6537)); | ||
| 384 | I915_WRITE(SPCSCC23(plane), SPCSC_C1(-3330) | SPCSC_C0(0)); | ||
| 385 | I915_WRITE(SPCSCC45(plane), SPCSC_C1(-1605) | SPCSC_C0(4769)); | ||
| 386 | I915_WRITE(SPCSCC67(plane), SPCSC_C1(4769) | SPCSC_C0(0)); | ||
| 387 | I915_WRITE(SPCSCC8(plane), SPCSC_C0(8263)); | ||
| 388 | |||
| 389 | I915_WRITE(SPCSCYGICLAMP(plane), SPCSC_IMAX(940) | SPCSC_IMIN(64)); | ||
| 390 | I915_WRITE(SPCSCCBICLAMP(plane), SPCSC_IMAX(448) | SPCSC_IMIN(-448)); | ||
| 391 | I915_WRITE(SPCSCCRICLAMP(plane), SPCSC_IMAX(448) | SPCSC_IMIN(-448)); | ||
| 392 | |||
| 393 | I915_WRITE(SPCSCYGOCLAMP(plane), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); | ||
| 394 | I915_WRITE(SPCSCCBOCLAMP(plane), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); | ||
| 395 | I915_WRITE(SPCSCCROCLAMP(plane), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); | ||
| 396 | } | ||
| 397 | |||
| 322 | static void | 398 | static void |
| 323 | vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, | 399 | vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, |
| 324 | struct drm_framebuffer *fb, | 400 | struct drm_framebuffer *fb, |
| @@ -430,6 +506,9 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, · 105 unmodified lines | |||
| 430 | 506 | ||
| 431 | intel_update_primary_plane(intel_crtc); | 507 | intel_update_primary_plane(intel_crtc); |
| 432 | 508 | ||
| 509 | if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) | ||
| 510 | chv_update_csc(intel_plane, fb->pixel_format); | ||
| 511 | |||
| 433 | I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]); | 512 | I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]); |
| 434 | I915_WRITE(SPPOS(pipe, plane), (crtc_y << 16) | crtc_x); | 513 | I915_WRITE(SPPOS(pipe, plane), (crtc_y << 16) | crtc_x); |
| 435 | 514 | ||
| @@ -438,6 +517,8 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, · 2 unmodified lines | |||
| 438 | else | 517 | else |
| 439 | I915_WRITE(SPLINOFF(pipe, plane), linear_offset); | 518 | I915_WRITE(SPLINOFF(pipe, plane), linear_offset); |
| 440 | 519 | ||
| 520 | I915_WRITE(SPCONSTALPHA(pipe, plane), 0); | ||
| 521 | |||
| 441 | I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); | 522 | I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); |
| 442 | I915_WRITE(SPCNTR(pipe, plane), sprctl); | 523 | I915_WRITE(SPCNTR(pipe, plane), sprctl); |
| 443 | I915_WRITE(SPSURF(pipe, plane), i915_gem_obj_ggtt_offset(obj) + | 524 | I915_WRITE(SPSURF(pipe, plane), i915_gem_obj_ggtt_offset(obj) + |
| @@ -1002,20 +1083,6 @@ ilk_get_colorkey(struct drm_plane *plane, struct drm_intel_sprite_colorkey *key) · 558 unmodified lines | |||
| 1002 | key->flags = I915_SET_COLORKEY_NONE; | 1083 | key->flags = I915_SET_COLORKEY_NONE; |
| 1003 | } | 1084 | } |
| 1004 | 1085 | ||
| 1005 | static bool | ||
| 1006 | format_is_yuv(uint32_t format) | ||
| 1007 | { | ||
| 1008 | switch (format) { | ||
| 1009 | case DRM_FORMAT_YUYV: | ||
| 1010 | case DRM_FORMAT_UYVY: | ||
| 1011 | case DRM_FORMAT_VYUY: | ||
| 1012 | case DRM_FORMAT_YVYU: | ||
| 1013 | return true; | ||
| 1014 | default: | ||
| 1015 | return false; | ||
| 1016 | } | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | static bool colorkey_enabled(struct intel_plane *intel_plane) | 1086 | static bool colorkey_enabled(struct intel_plane *intel_plane) |
| 1020 | { | 1087 | { |
| 1021 | struct drm_intel_sprite_colorkey key; | 1088 | struct drm_intel_sprite_colorkey key; |
| @@ -1032,8 +1099,7 @@ intel_check_sprite_plane(struct drm_plane *plane, · 10 unmodified lines | |||
| 1032 | struct intel_crtc *intel_crtc = to_intel_crtc(state->crtc); | 1099 | struct intel_crtc *intel_crtc = to_intel_crtc(state->crtc); |
| 1033 | struct intel_plane *intel_plane = to_intel_plane(plane); | 1100 | struct intel_plane *intel_plane = to_intel_plane(plane); |
| 1034 | struct drm_framebuffer *fb = state->fb; | 1101 | struct drm_framebuffer *fb = state->fb; |
| 1035 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); | 1102 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); |
| 1036 | struct drm_i915_gem_object *obj = intel_fb->obj; | ||
| 1037 | int crtc_x, crtc_y; | 1103 | int crtc_x, crtc_y; |
| 1038 | unsigned int crtc_w, crtc_h; | 1104 | unsigned int crtc_w, crtc_h; |
| 1039 | uint32_t src_x, src_y, src_w, src_h; | 1105 | uint32_t src_x, src_y, src_w, src_h; |
| @@ -1192,34 +1258,18 @@ intel_check_sprite_plane(struct drm_plane *plane, · 152 unmodified lines | |||
| 1192 | } | 1258 | } |
| 1193 | 1259 | ||
| 1194 | static int | 1260 | static int |
| 1195 | intel_commit_sprite_plane(struct drm_plane *plane, | 1261 | intel_prepare_sprite_plane(struct drm_plane *plane, |
| 1196 | struct intel_plane_state *state) | 1262 | struct intel_plane_state *state) |
| 1197 | { | 1263 | { |
| 1198 | struct drm_device *dev = plane->dev; | 1264 | struct drm_device *dev = plane->dev; |
| 1199 | struct drm_crtc *crtc = state->crtc; | 1265 | struct drm_crtc *crtc = state->crtc; |
| 1200 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 1266 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 1201 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 1202 | enum pipe pipe = intel_crtc->pipe; | 1267 | enum pipe pipe = intel_crtc->pipe; |
| 1203 | struct drm_framebuffer *fb = state->fb; | 1268 | struct drm_framebuffer *fb = state->fb; |
| 1204 | struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); | 1269 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); |
| 1205 | struct drm_i915_gem_object *obj = intel_fb->obj; | 1270 | struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); |
| 1206 | struct drm_i915_gem_object *old_obj = intel_plane->obj; | ||
| 1207 | int crtc_x, crtc_y; | ||
| 1208 | unsigned int crtc_w, crtc_h; | ||
| 1209 | uint32_t src_x, src_y, src_w, src_h; | ||
| 1210 | struct drm_rect *dst = &state->dst; | ||
| 1211 | const struct drm_rect *clip = &state->clip; | ||
| 1212 | bool primary_enabled; | ||
| 1213 | int ret; | 1271 | int ret; |
| 1214 | 1272 | ||
| 1215 | /* | ||
| 1216 | * If the sprite is completely covering the primary plane, | ||
| 1217 | * we can disable the primary and save power. | ||
| 1218 | */ | ||
| 1219 | primary_enabled = !drm_rect_equals(dst, clip) || colorkey_enabled(intel_plane); | ||
| 1220 | WARN_ON(!primary_enabled && !state->visible && intel_crtc->active); | ||
| 1221 | |||
| 1222 | |||
| 1223 | if (old_obj != obj) { | 1273 | if (old_obj != obj) { |
| 1224 | mutex_lock(&dev->struct_mutex); | 1274 | mutex_lock(&dev->struct_mutex); |
| 1225 | 1275 | ||
| @@ -1229,7 +1279,7 @@ intel_commit_sprite_plane(struct drm_plane *plane, · 3 unmodified lines | |||
| 1229 | * the sprite planes only require 128KiB alignment and 32 PTE | 1279 | * the sprite planes only require 128KiB alignment and 32 PTE |
| 1230 | * padding. | 1280 | * padding. |
| 1231 | */ | 1281 | */ |
| 1232 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); | 1282 | ret = intel_pin_and_fence_fb_obj(plane, fb, NULL); |
| 1233 | if (ret == 0) | 1283 | if (ret == 0) |
| 1234 | i915_gem_track_fb(old_obj, obj, | 1284 | i915_gem_track_fb(old_obj, obj, |
| 1235 | INTEL_FRONTBUFFER_SPRITE(pipe)); | 1285 | INTEL_FRONTBUFFER_SPRITE(pipe)); |
| @@ -1238,6 +1288,35 @@ intel_commit_sprite_plane(struct drm_plane *plane, · 2 unmodified lines | |||
| 1238 | return ret; | 1288 | return ret; |
| 1239 | } | 1289 | } |
| 1240 | 1290 | ||
| 1291 | return 0; | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | static void | ||
| 1295 | intel_commit_sprite_plane(struct drm_plane *plane, | ||
| 1296 | struct intel_plane_state *state) | ||
| 1297 | { | ||
| 1298 | struct drm_device *dev = plane->dev; | ||
| 1299 | struct drm_crtc *crtc = state->crtc; | ||
| 1300 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 1301 | struct intel_plane *intel_plane = to_intel_plane(plane); | ||
| 1302 | enum pipe pipe = intel_crtc->pipe; | ||
| 1303 | struct drm_framebuffer *fb = state->fb; | ||
| 1304 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | ||
| 1305 | struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); | ||
| 1306 | int crtc_x, crtc_y; | ||
| 1307 | unsigned int crtc_w, crtc_h; | ||
| 1308 | uint32_t src_x, src_y, src_w, src_h; | ||
| 1309 | struct drm_rect *dst = &state->dst; | ||
| 1310 | const struct drm_rect *clip = &state->clip; | ||
| 1311 | bool primary_enabled; | ||
| 1312 | |||
| 1313 | /* | ||
| 1314 | * If the sprite is completely covering the primary plane, | ||
| 1315 | * we can disable the primary and save power. | ||
| 1316 | */ | ||
| 1317 | primary_enabled = !drm_rect_equals(dst, clip) || colorkey_enabled(intel_plane); | ||
| 1318 | WARN_ON(!primary_enabled && !state->visible && intel_crtc->active); | ||
| 1319 | |||
| 1241 | intel_plane->crtc_x = state->orig_dst.x1; | 1320 | intel_plane->crtc_x = state->orig_dst.x1; |
| 1242 | intel_plane->crtc_y = state->orig_dst.y1; | 1321 | intel_plane->crtc_y = state->orig_dst.y1; |
| 1243 | intel_plane->crtc_w = drm_rect_width(&state->orig_dst); | 1322 | intel_plane->crtc_w = drm_rect_width(&state->orig_dst); |
| @@ -1298,8 +1377,6 @@ intel_commit_sprite_plane(struct drm_plane *plane, · 54 unmodified lines | |||
| 1298 | intel_unpin_fb_obj(old_obj); | 1377 | intel_unpin_fb_obj(old_obj); |
| 1299 | mutex_unlock(&dev->struct_mutex); | 1378 | mutex_unlock(&dev->struct_mutex); |
| 1300 | } | 1379 | } |
| 1301 | |||
| 1302 | return 0; | ||
| 1303 | } | 1380 | } |
| 1304 | 1381 | ||
| 1305 | static int | 1382 | static int |
| @@ -1339,7 +1416,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, · 33 unmodified lines | |||
| 1339 | if (ret) | 1416 | if (ret) |
| 1340 | return ret; | 1417 | return ret; |
| 1341 | 1418 | ||
| 1342 | return intel_commit_sprite_plane(plane, &state); | 1419 | ret = intel_prepare_sprite_plane(plane, &state); |
| 1420 | if (ret) | ||
| 1421 | return ret; | ||
| 1422 | |||
| 1423 | intel_commit_sprite_plane(plane, &state); | ||
| 1424 | return 0; | ||
| 1343 | } | 1425 | } |
| 1344 | 1426 | ||
| 1345 | static int | 1427 | static int |
| @@ -194,15 +194,13 @@ static void vlv_force_wake_reset(struct drm_i915_private *dev_priv) · 193 unmodified lines | |||
| 194 | static void __vlv_force_wake_get(struct drm_i915_private *dev_priv, | 194 | static void __vlv_force_wake_get(struct drm_i915_private *dev_priv, |
| 195 | int fw_engine) | 195 | int fw_engine) |
| 196 | { | 196 | { |
| 197 | /* | ||
| 198 | * WaRsDontPollForAckOnClearingFWBits:vlv | ||
| 199 | * Hardware clears ack bits lazily (only when all ack | ||
| 200 | * bits become 0) so don't poll for individiual ack | ||
| 201 | * bits to be clear here like on other platforms. | ||
| 202 | */ | ||
| 203 | |||
| 204 | /* Check for Render Engine */ | 197 | /* Check for Render Engine */ |
| 205 | if (FORCEWAKE_RENDER & fw_engine) { | 198 | if (FORCEWAKE_RENDER & fw_engine) { |
| 199 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 200 | FORCEWAKE_ACK_VLV) & | ||
| 201 | FORCEWAKE_KERNEL) == 0, | ||
| 202 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 203 | DRM_ERROR("Timed out: Render forcewake old ack to clear.\n"); | ||
| 206 | 204 | ||
| 207 | __raw_i915_write32(dev_priv, FORCEWAKE_VLV, | 205 | __raw_i915_write32(dev_priv, FORCEWAKE_VLV, |
| 208 | _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); | 206 | _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); |
| @@ -216,6 +214,11 @@ static void __vlv_force_wake_get(struct drm_i915_private *dev_priv, · 7 unmodified lines | |||
| 216 | 214 | ||
| 217 | /* Check for Media Engine */ | 215 | /* Check for Media Engine */ |
| 218 | if (FORCEWAKE_MEDIA & fw_engine) { | 216 | if (FORCEWAKE_MEDIA & fw_engine) { |
| 217 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 218 | FORCEWAKE_ACK_MEDIA_VLV) & | ||
| 219 | FORCEWAKE_KERNEL) == 0, | ||
| 220 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 221 | DRM_ERROR("Timed out: Media forcewake old ack to clear.\n"); | ||
| 219 | 222 | ||
| 220 | __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_VLV, | 223 | __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_VLV, |
| 221 | _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); | 224 | _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); |
| @@ -296,6 +299,154 @@ static void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) · 74 unmodified lines | |||
| 296 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); | 299 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); |
| 297 | } | 300 | } |
| 298 | 301 | ||
| 302 | static void __gen9_gt_force_wake_mt_reset(struct drm_i915_private *dev_priv) | ||
| 303 | { | ||
| 304 | __raw_i915_write32(dev_priv, FORCEWAKE_RENDER_GEN9, | ||
| 305 | _MASKED_BIT_DISABLE(0xffff)); | ||
| 306 | |||
| 307 | __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_GEN9, | ||
| 308 | _MASKED_BIT_DISABLE(0xffff)); | ||
| 309 | |||
| 310 | __raw_i915_write32(dev_priv, FORCEWAKE_BLITTER_GEN9, | ||
| 311 | _MASKED_BIT_DISABLE(0xffff)); | ||
| 312 | } | ||
| 313 | |||
| 314 | static void | ||
| 315 | __gen9_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine) | ||
| 316 | { | ||
| 317 | /* Check for Render Engine */ | ||
| 318 | if (FORCEWAKE_RENDER & fw_engine) { | ||
| 319 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 320 | FORCEWAKE_ACK_RENDER_GEN9) & | ||
| 321 | FORCEWAKE_KERNEL) == 0, | ||
| 322 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 323 | DRM_ERROR("Timed out: Render forcewake old ack to clear.\n"); | ||
| 324 | |||
| 325 | __raw_i915_write32(dev_priv, FORCEWAKE_RENDER_GEN9, | ||
| 326 | _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); | ||
| 327 | |||
| 328 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 329 | FORCEWAKE_ACK_RENDER_GEN9) & | ||
| 330 | FORCEWAKE_KERNEL), | ||
| 331 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 332 | DRM_ERROR("Timed out: waiting for Render to ack.\n"); | ||
| 333 | } | ||
| 334 | |||
| 335 | /* Check for Media Engine */ | ||
| 336 | if (FORCEWAKE_MEDIA & fw_engine) { | ||
| 337 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 338 | FORCEWAKE_ACK_MEDIA_GEN9) & | ||
| 339 | FORCEWAKE_KERNEL) == 0, | ||
| 340 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 341 | DRM_ERROR("Timed out: Media forcewake old ack to clear.\n"); | ||
| 342 | |||
| 343 | __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_GEN9, | ||
| 344 | _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); | ||
| 345 | |||
| 346 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 347 | FORCEWAKE_ACK_MEDIA_GEN9) & | ||
| 348 | FORCEWAKE_KERNEL), | ||
| 349 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 350 | DRM_ERROR("Timed out: waiting for Media to ack.\n"); | ||
| 351 | } | ||
| 352 | |||
| 353 | /* Check for Blitter Engine */ | ||
| 354 | if (FORCEWAKE_BLITTER & fw_engine) { | ||
| 355 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 356 | FORCEWAKE_ACK_BLITTER_GEN9) & | ||
| 357 | FORCEWAKE_KERNEL) == 0, | ||
| 358 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 359 | DRM_ERROR("Timed out: Blitter forcewake old ack to clear.\n"); | ||
| 360 | |||
| 361 | __raw_i915_write32(dev_priv, FORCEWAKE_BLITTER_GEN9, | ||
| 362 | _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); | ||
| 363 | |||
| 364 | if (wait_for_atomic((__raw_i915_read32(dev_priv, | ||
| 365 | FORCEWAKE_ACK_BLITTER_GEN9) & | ||
| 366 | FORCEWAKE_KERNEL), | ||
| 367 | FORCEWAKE_ACK_TIMEOUT_MS)) | ||
| 368 | DRM_ERROR("Timed out: waiting for Blitter to ack.\n"); | ||
| 369 | } | ||
| 370 | } | ||
| 371 | |||
| 372 | static void | ||
| 373 | __gen9_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) | ||
| 374 | { | ||
| 375 | /* Check for Render Engine */ | ||
| 376 | if (FORCEWAKE_RENDER & fw_engine) | ||
| 377 | __raw_i915_write32(dev_priv, FORCEWAKE_RENDER_GEN9, | ||
| 378 | _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); | ||
| 379 | |||
| 380 | /* Check for Media Engine */ | ||
| 381 | if (FORCEWAKE_MEDIA & fw_engine) | ||
| 382 | __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_GEN9, | ||
| 383 | _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); | ||
| 384 | |||
| 385 | /* Check for Blitter Engine */ | ||
| 386 | if (FORCEWAKE_BLITTER & fw_engine) | ||
| 387 | __raw_i915_write32(dev_priv, FORCEWAKE_BLITTER_GEN9, | ||
| 388 | _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); | ||
| 389 | } | ||
| 390 | |||
| 391 | static void | ||
| 392 | gen9_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine) | ||
| 393 | { | ||
| 394 | unsigned long irqflags; | ||
| 395 | |||
| 396 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); | ||
| 397 | |||
| 398 | if (FORCEWAKE_RENDER & fw_engine) { | ||
| 399 | if (dev_priv->uncore.fw_rendercount++ == 0) | ||
| 400 | dev_priv->uncore.funcs.force_wake_get(dev_priv, | ||
| 401 | FORCEWAKE_RENDER); | ||
| 402 | } | ||
| 403 | |||
| 404 | if (FORCEWAKE_MEDIA & fw_engine) { | ||
| 405 | if (dev_priv->uncore.fw_mediacount++ == 0) | ||
| 406 | dev_priv->uncore.funcs.force_wake_get(dev_priv, | ||
| 407 | FORCEWAKE_MEDIA); | ||
| 408 | } | ||
| 409 | |||
| 410 | if (FORCEWAKE_BLITTER & fw_engine) { | ||
| 411 | if (dev_priv->uncore.fw_blittercount++ == 0) | ||
| 412 | dev_priv->uncore.funcs.force_wake_get(dev_priv, | ||
| 413 | FORCEWAKE_BLITTER); | ||
| 414 | } | ||
| 415 | |||
| 416 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); | ||
| 417 | } | ||
| 418 | |||
| 419 | static void | ||
| 420 | gen9_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) | ||
| 421 | { | ||
| 422 | unsigned long irqflags; | ||
| 423 | |||
| 424 | spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); | ||
| 425 | |||
| 426 | if (FORCEWAKE_RENDER & fw_engine) { | ||
| 427 | WARN_ON(dev_priv->uncore.fw_rendercount == 0); | ||
| 428 | if (--dev_priv->uncore.fw_rendercount == 0) | ||
| 429 | dev_priv->uncore.funcs.force_wake_put(dev_priv, | ||
| 430 | FORCEWAKE_RENDER); | ||
| 431 | } | ||
| 432 | |||
| 433 | if (FORCEWAKE_MEDIA & fw_engine) { | ||
| 434 | WARN_ON(dev_priv->uncore.fw_mediacount == 0); | ||
| 435 | if (--dev_priv->uncore.fw_mediacount == 0) | ||
| 436 | dev_priv->uncore.funcs.force_wake_put(dev_priv, | ||
| 437 | FORCEWAKE_MEDIA); | ||
| 438 | } | ||
| 439 | |||
| 440 | if (FORCEWAKE_BLITTER & fw_engine) { | ||
| 441 | WARN_ON(dev_priv->uncore.fw_blittercount == 0); | ||
| 442 | if (--dev_priv->uncore.fw_blittercount == 0) | ||
| 443 | dev_priv->uncore.funcs.force_wake_put(dev_priv, | ||
| 444 | FORCEWAKE_BLITTER); | ||
| 445 | } | ||
| 446 | |||
| 447 | spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); | ||
| 448 | } | ||
| 449 | |||
| 299 | static void gen6_force_wake_timer(unsigned long arg) | 450 | static void gen6_force_wake_timer(unsigned long arg) |
| 300 | { | 451 | { |
| 301 | struct drm_i915_private *dev_priv = (void *)arg; | 452 | struct drm_i915_private *dev_priv = (void *)arg; |
| @@ -334,6 +485,9 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) · 32 unmodified lines | |||
| 334 | if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev)) | 485 | if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev)) |
| 335 | __gen7_gt_force_wake_mt_reset(dev_priv); | 486 | __gen7_gt_force_wake_mt_reset(dev_priv); |
| 336 | 487 | ||
| 488 | if (IS_GEN9(dev)) | ||
| 489 | __gen9_gt_force_wake_mt_reset(dev_priv); | ||
| 490 | |||
| 337 | if (restore) { /* If reset with a user forcewake, try to restore */ | 491 | if (restore) { /* If reset with a user forcewake, try to restore */ |
| 338 | unsigned fw = 0; | 492 | unsigned fw = 0; |
| 339 | 493 | ||
| @@ -343,6 +497,15 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) · 3 unmodified lines | |||
| 343 | 497 | ||
| 344 | if (dev_priv->uncore.fw_mediacount) | 498 | if (dev_priv->uncore.fw_mediacount) |
| 345 | fw |= FORCEWAKE_MEDIA; | 499 | fw |= FORCEWAKE_MEDIA; |
| 500 | } else if (IS_GEN9(dev)) { | ||
| 501 | if (dev_priv->uncore.fw_rendercount) | ||
| 502 | fw |= FORCEWAKE_RENDER; | ||
| 503 | |||
| 504 | if (dev_priv->uncore.fw_mediacount) | ||
| 505 | fw |= FORCEWAKE_MEDIA; | ||
| 506 | |||
| 507 | if (dev_priv->uncore.fw_blittercount) | ||
| 508 | fw |= FORCEWAKE_BLITTER; | ||
| 346 | } else { | 509 | } else { |
| 347 | if (dev_priv->uncore.forcewake_count) | 510 | if (dev_priv->uncore.forcewake_count) |
| 348 | fw = FORCEWAKE_ALL; | 511 | fw = FORCEWAKE_ALL; |
| @@ -414,6 +577,10 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine) · 65 unmodified lines | |||
| 414 | 577 | ||
| 415 | intel_runtime_pm_get(dev_priv); | 578 | intel_runtime_pm_get(dev_priv); |
| 416 | 579 | ||
| 580 | /* Redirect to Gen9 specific routine */ | ||
| 581 | if (IS_GEN9(dev_priv->dev)) | ||
| 582 | return gen9_force_wake_get(dev_priv, fw_engine); | ||
| 583 | |||
| 417 | /* Redirect to VLV specific routine */ | 584 | /* Redirect to VLV specific routine */ |
| 418 | if (IS_VALLEYVIEW(dev_priv->dev)) | 585 | if (IS_VALLEYVIEW(dev_priv->dev)) |
| 419 | return vlv_force_wake_get(dev_priv, fw_engine); | 586 | return vlv_force_wake_get(dev_priv, fw_engine); |
| @@ -435,6 +602,12 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) · 15 unmodified lines | |||
| 435 | if (!dev_priv->uncore.funcs.force_wake_put) | 602 | if (!dev_priv->uncore.funcs.force_wake_put) |
| 436 | return; | 603 | return; |
| 437 | 604 | ||
| 605 | /* Redirect to Gen9 specific routine */ | ||
| 606 | if (IS_GEN9(dev_priv->dev)) { | ||
| 607 | gen9_force_wake_put(dev_priv, fw_engine); | ||
| 608 | goto out; | ||
| 609 | } | ||
| 610 | |||
| 438 | /* Redirect to VLV specific routine */ | 611 | /* Redirect to VLV specific routine */ |
| 439 | if (IS_VALLEYVIEW(dev_priv->dev)) { | 612 | if (IS_VALLEYVIEW(dev_priv->dev)) { |
| 440 | vlv_force_wake_put(dev_priv, fw_engine); | 613 | vlv_force_wake_put(dev_priv, fw_engine); |
| @@ -855,7 +1028,10 @@ void intel_uncore_init(struct drm_device *dev) · 414 unmodified lines | |||
| 855 | 1028 | ||
| 856 | __intel_uncore_early_sanitize(dev, false); | 1029 | __intel_uncore_early_sanitize(dev, false); |
| 857 | 1030 | ||
| 858 | if (IS_VALLEYVIEW(dev)) { | 1031 | if (IS_GEN9(dev)) { |
| 1032 | dev_priv->uncore.funcs.force_wake_get = __gen9_force_wake_get; | ||
| 1033 | dev_priv->uncore.funcs.force_wake_put = __gen9_force_wake_put; | ||
| 1034 | } else if (IS_VALLEYVIEW(dev)) { | ||
| 859 | dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get; | 1035 | dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get; |
| 860 | dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put; | 1036 | dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put; |
| 861 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { | 1037 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { |
| @@ -876,6 +876,12 @@ struct drm_i915_gem_get_tiling { · 875 unmodified lines | |||
| 876 | * mmap mapping. | 876 | * mmap mapping. |
| 877 | */ | 877 | */ |
| 878 | __u32 swizzle_mode; | 878 | __u32 swizzle_mode; |
| 879 | |||
| 880 | /** | ||
| 881 | * Returned address bit 6 swizzling required for CPU access through | ||
| 882 | * mmap mapping whilst bound. | ||
| 883 | */ | ||
| 884 | __u32 phys_swizzle_mode; | ||
| 879 | }; | 885 | }; |
| 880 | 886 | ||
| 881 | struct drm_i915_gem_get_aperture { | 887 | struct drm_i915_gem_get_aperture { |