Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-intel-next-2014-11-07-fixups' of git://anongit.freedesktop.org/drm-intel into drm-next

- 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
...

+5167 -1661
+5
Documentation/DocBook/drm.tmpl
··· 3888 3888 </para> 3889 3889 </sect2> 3890 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> 3895 + <sect2> 3891 3896 <title>DPIO</title> 3892 3897 !Pdrivers/gpu/drm/i915/i915_reg.h DPIO 3893 3898 <table id="dpiox2">
+5
drivers/gpu/drm/drm_plane_helper.c
··· 155 155 return -ERANGE; 156 156 } 157 157 158 + if (!fb) { 159 + *visible = false; 160 + return 0; 161 + } 162 + 158 163 *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale); 159 164 if (!*visible) 160 165 /*
+4 -2
drivers/gpu/drm/i915/Makefile
··· 40 40 # autogenerated null render state 41 41 i915-y += intel_renderstate_gen6.o \ 42 42 intel_renderstate_gen7.o \ 43 - intel_renderstate_gen8.o 43 + intel_renderstate_gen8.o \ 44 + intel_renderstate_gen9.o 44 45 45 46 # modesetting core code 46 - i915-y += intel_bios.o \ 47 + i915-y += intel_audio.o \ 48 + intel_bios.o \ 47 49 intel_display.o \ 48 50 intel_fifo_underrun.o \ 49 51 intel_frontbuffer.o \
+17 -1
drivers/gpu/drm/i915/i915_cmd_parser.c
··· 138 138 .mask = MI_GLOBAL_GTT, 139 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 146 CMD( MI_BATCH_BUFFER_START, SMI, !F, 0xFF, S ), 142 147 }; 143 148 ··· 960 955 * Parses the specified batch buffer looking for privilege violations as 961 956 * described in the overview. 962 957 * 963 - * Return: non-zero if the parser finds violations or otherwise fails 958 + * Return: non-zero if the parser finds violations or otherwise fails; -EACCES 959 + * if the batch appears legal but should use hardware parsing 964 960 */ 965 961 int i915_parse_cmds(struct intel_engine_cs *ring, 966 962 struct drm_i915_gem_object *batch_obj, ··· 1005 999 DRM_DEBUG_DRIVER("CMD: Unrecognized command: 0x%08X\n", 1006 1000 *cmd); 1007 1001 ret = -EINVAL; 1002 + break; 1003 + } 1004 + 1005 + /* 1006 + * If the batch buffer contains a chained batch, return an 1007 + * error that tells the caller to abort and dispatch the 1008 + * workload as a non-secure batch. 1009 + */ 1010 + if (desc->cmd.value == MI_BATCH_BUFFER_START) { 1011 + ret = -EACCES; 1008 1012 break; 1009 1013 } 1010 1014
+110 -22
drivers/gpu/drm/i915/i915_debugfs.c
··· 116 116 117 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 122 static void ··· 2630 2630 struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; 2631 2631 2632 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, 2634 - pll->active, yesno(pll->on)); 2633 + seq_printf(m, " crtc_mask: 0x%08x, active: %d, on: %s\n", 2634 + pll->config.crtc_mask, pll->active, yesno(pll->on)); 2635 2635 seq_printf(m, " tracked hardware state:\n"); 2636 - seq_printf(m, " dpll: 0x%08x\n", pll->hw_state.dpll); 2637 - seq_printf(m, " dpll_md: 0x%08x\n", pll->hw_state.dpll_md); 2638 - seq_printf(m, " fp0: 0x%08x\n", pll->hw_state.fp0); 2639 - seq_printf(m, " fp1: 0x%08x\n", pll->hw_state.fp1); 2640 - seq_printf(m, " wrpll: 0x%08x\n", pll->hw_state.wrpll); 2636 + seq_printf(m, " dpll: 0x%08x\n", pll->config.hw_state.dpll); 2637 + seq_printf(m, " dpll_md: 0x%08x\n", 2638 + pll->config.hw_state.dpll_md); 2639 + seq_printf(m, " fp0: 0x%08x\n", pll->config.hw_state.fp0); 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 2643 drm_modeset_unlock_all(dev); 2643 2644 ··· 2675 2674 2676 2675 intel_runtime_pm_put(dev_priv); 2677 2676 mutex_unlock(&dev->struct_mutex); 2677 + 2678 + return 0; 2679 + } 2680 + 2681 + static int i915_ddb_info(struct seq_file *m, void *unused) 2682 + { 2683 + struct drm_info_node *node = m->private; 2684 + struct drm_device *dev = node->minor->dev; 2685 + struct drm_i915_private *dev_priv = dev->dev_private; 2686 + struct skl_ddb_allocation *ddb; 2687 + struct skl_ddb_entry *entry; 2688 + enum pipe pipe; 2689 + int plane; 2690 + 2691 + drm_modeset_lock_all(dev); 2692 + 2693 + ddb = &dev_priv->wm.skl_hw.ddb; 2694 + 2695 + seq_printf(m, "%-15s%8s%8s%8s\n", "", "Start", "End", "Size"); 2696 + 2697 + for_each_pipe(dev_priv, pipe) { 2698 + seq_printf(m, "Pipe %c\n", pipe_name(pipe)); 2699 + 2700 + for_each_plane(pipe, plane) { 2701 + entry = &ddb->plane[pipe][plane]; 2702 + seq_printf(m, " Plane%-8d%8u%8u%8u\n", plane + 1, 2703 + entry->start, entry->end, 2704 + skl_ddb_entry_size(entry)); 2705 + } 2706 + 2707 + entry = &ddb->cursor[pipe]; 2708 + seq_printf(m, " %-13s%8u%8u%8u\n", "Cursor", entry->start, 2709 + entry->end, skl_ddb_entry_size(entry)); 2710 + } 2711 + 2712 + drm_modeset_unlock_all(dev); 2678 2713 2679 2714 return 0; 2680 2715 } ··· 3007 2970 port_name(dig_port->port)); 3008 2971 break; 3009 2972 } 2973 + break; 2974 + default: 3010 2975 break; 3011 2976 } 3012 2977 } ··· 3559 3520 .write = display_crc_ctl_write 3560 3521 }; 3561 3522 3562 - static void wm_latency_show(struct seq_file *m, const uint16_t wm[5]) 3523 + static void wm_latency_show(struct seq_file *m, const uint16_t wm[8]) 3563 3524 { 3564 3525 struct drm_device *dev = m->private; 3565 3526 int num_levels = ilk_wm_max_level(dev) + 1; ··· 3570 3531 for (level = 0; level < num_levels; level++) { 3571 3532 unsigned int latency = wm[level]; 3572 3533 3573 - /* WM1+ latency values in 0.5us units */ 3574 - if (level > 0) 3534 + /* 3535 + * - WM1+ latency values in 0.5us units 3536 + * - latencies are in us on gen9 3537 + */ 3538 + if (INTEL_INFO(dev)->gen >= 9) 3539 + latency *= 10; 3540 + else if (level > 0) 3575 3541 latency *= 5; 3576 3542 3577 3543 seq_printf(m, "WM%d %u (%u.%u usec)\n", 3578 - level, wm[level], 3579 - latency / 10, latency % 10); 3544 + level, wm[level], latency / 10, latency % 10); 3580 3545 } 3581 3546 3582 3547 drm_modeset_unlock_all(dev); ··· 3589 3546 static int pri_wm_latency_show(struct seq_file *m, void *data) 3590 3547 { 3591 3548 struct drm_device *dev = m->private; 3549 + struct drm_i915_private *dev_priv = dev->dev_private; 3550 + const uint16_t *latencies; 3592 3551 3593 - wm_latency_show(m, to_i915(dev)->wm.pri_latency); 3552 + if (INTEL_INFO(dev)->gen >= 9) 3553 + latencies = dev_priv->wm.skl_latency; 3554 + else 3555 + latencies = to_i915(dev)->wm.pri_latency; 3556 + 3557 + wm_latency_show(m, latencies); 3594 3558 3595 3559 return 0; 3596 3560 } ··· 3605 3555 static int spr_wm_latency_show(struct seq_file *m, void *data) 3606 3556 { 3607 3557 struct drm_device *dev = m->private; 3558 + struct drm_i915_private *dev_priv = dev->dev_private; 3559 + const uint16_t *latencies; 3608 3560 3609 - wm_latency_show(m, to_i915(dev)->wm.spr_latency); 3561 + if (INTEL_INFO(dev)->gen >= 9) 3562 + latencies = dev_priv->wm.skl_latency; 3563 + else 3564 + latencies = to_i915(dev)->wm.spr_latency; 3565 + 3566 + wm_latency_show(m, latencies); 3610 3567 3611 3568 return 0; 3612 3569 } ··· 3621 3564 static int cur_wm_latency_show(struct seq_file *m, void *data) 3622 3565 { 3623 3566 struct drm_device *dev = m->private; 3567 + struct drm_i915_private *dev_priv = dev->dev_private; 3568 + const uint16_t *latencies; 3624 3569 3625 - wm_latency_show(m, to_i915(dev)->wm.cur_latency); 3570 + if (INTEL_INFO(dev)->gen >= 9) 3571 + latencies = dev_priv->wm.skl_latency; 3572 + else 3573 + latencies = to_i915(dev)->wm.cur_latency; 3574 + 3575 + wm_latency_show(m, latencies); 3626 3576 3627 3577 return 0; 3628 3578 } ··· 3665 3601 } 3666 3602 3667 3603 static ssize_t wm_latency_write(struct file *file, const char __user *ubuf, 3668 - size_t len, loff_t *offp, uint16_t wm[5]) 3604 + size_t len, loff_t *offp, uint16_t wm[8]) 3669 3605 { 3670 3606 struct seq_file *m = file->private_data; 3671 3607 struct drm_device *dev = m->private; 3672 - uint16_t new[5] = { 0 }; 3608 + uint16_t new[8] = { 0 }; 3673 3609 int num_levels = ilk_wm_max_level(dev) + 1; 3674 3610 int level; 3675 3611 int ret; ··· 3683 3619 3684 3620 tmp[len] = '\0'; 3685 3621 3686 - ret = sscanf(tmp, "%hu %hu %hu %hu %hu", &new[0], &new[1], &new[2], &new[3], &new[4]); 3622 + ret = sscanf(tmp, "%hu %hu %hu %hu %hu %hu %hu %hu", 3623 + &new[0], &new[1], &new[2], &new[3], 3624 + &new[4], &new[5], &new[6], &new[7]); 3687 3625 if (ret != num_levels) 3688 3626 return -EINVAL; 3689 3627 ··· 3705 3639 { 3706 3640 struct seq_file *m = file->private_data; 3707 3641 struct drm_device *dev = m->private; 3642 + struct drm_i915_private *dev_priv = dev->dev_private; 3643 + uint16_t *latencies; 3708 3644 3709 - return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.pri_latency); 3645 + if (INTEL_INFO(dev)->gen >= 9) 3646 + latencies = dev_priv->wm.skl_latency; 3647 + else 3648 + latencies = to_i915(dev)->wm.pri_latency; 3649 + 3650 + return wm_latency_write(file, ubuf, len, offp, latencies); 3710 3651 } 3711 3652 3712 3653 static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf, ··· 3721 3648 { 3722 3649 struct seq_file *m = file->private_data; 3723 3650 struct drm_device *dev = m->private; 3651 + struct drm_i915_private *dev_priv = dev->dev_private; 3652 + uint16_t *latencies; 3724 3653 3725 - return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.spr_latency); 3654 + if (INTEL_INFO(dev)->gen >= 9) 3655 + latencies = dev_priv->wm.skl_latency; 3656 + else 3657 + latencies = to_i915(dev)->wm.spr_latency; 3658 + 3659 + return wm_latency_write(file, ubuf, len, offp, latencies); 3726 3660 } 3727 3661 3728 3662 static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf, ··· 3737 3657 { 3738 3658 struct seq_file *m = file->private_data; 3739 3659 struct drm_device *dev = m->private; 3660 + struct drm_i915_private *dev_priv = dev->dev_private; 3661 + uint16_t *latencies; 3740 3662 3741 - return wm_latency_write(file, ubuf, len, offp, to_i915(dev)->wm.cur_latency); 3663 + if (INTEL_INFO(dev)->gen >= 9) 3664 + latencies = dev_priv->wm.skl_latency; 3665 + else 3666 + latencies = to_i915(dev)->wm.cur_latency; 3667 + 3668 + return wm_latency_write(file, ubuf, len, offp, latencies); 3742 3669 } 3743 3670 3744 3671 static const struct file_operations i915_pri_wm_latency_fops = { ··· 4288 4201 {"i915_shared_dplls_info", i915_shared_dplls_info, 0}, 4289 4202 {"i915_dp_mst_info", i915_dp_mst_info, 0}, 4290 4203 {"i915_wa_registers", i915_wa_registers, 0}, 4204 + {"i915_ddb_info", i915_ddb_info, 0}, 4291 4205 }; 4292 4206 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) 4293 4207
+20 -55
drivers/gpu/drm/i915/i915_drv.c
··· 551 551 } 552 552 553 553 static int intel_suspend_complete(struct drm_i915_private *dev_priv); 554 - static int intel_resume_prepare(struct drm_i915_private *dev_priv, 555 - bool rpm_resume); 554 + static int vlv_resume_prepare(struct drm_i915_private *dev_priv, 555 + bool rpm_resume); 556 556 557 557 static int i915_drm_suspend(struct drm_device *dev) 558 558 { ··· 744 744 static int i915_drm_resume_early(struct drm_device *dev) 745 745 { 746 746 struct drm_i915_private *dev_priv = dev->dev_private; 747 - int ret; 747 + int ret = 0; 748 748 749 749 /* 750 750 * We have a resume ordering issue with the snd-hda driver also ··· 760 760 761 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 765 if (ret) 765 766 DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret); 766 767 767 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 773 intel_uncore_sanitize(dev); 769 774 intel_power_domains_init_hw(dev_priv); 770 775 ··· 987 982 static int hsw_suspend_complete(struct drm_i915_private *dev_priv) 988 983 { 989 984 hsw_enable_pc8(dev_priv); 990 - 991 - return 0; 992 - } 993 - 994 - static int snb_resume_prepare(struct drm_i915_private *dev_priv, 995 - bool rpm_resume) 996 - { 997 - struct drm_device *dev = dev_priv->dev; 998 - 999 - if (rpm_resume) 1000 - intel_init_pch_refclk(dev); 1001 - 1002 - return 0; 1003 - } 1004 - 1005 - static int hsw_resume_prepare(struct drm_i915_private *dev_priv, 1006 - bool rpm_resume) 1007 - { 1008 - hsw_disable_pc8(dev_priv); 1009 985 1010 986 return 0; 1011 987 } ··· 1395 1409 i915_gem_release_all_mmaps(dev_priv); 1396 1410 mutex_unlock(&dev->struct_mutex); 1397 1411 1398 - /* 1399 - * rps.work can't be rearmed here, since we get here only after making 1400 - * sure the GPU is idle and the RPS freq is set to the minimum. See 1401 - * intel_mark_idle(). 1402 - */ 1403 - cancel_work_sync(&dev_priv->rps.work); 1412 + flush_delayed_work(&dev_priv->rps.delayed_resume_work); 1404 1413 intel_runtime_pm_disable_interrupts(dev_priv); 1414 + intel_suspend_gt_powersave(dev); 1405 1415 1406 1416 ret = intel_suspend_complete(dev_priv); 1407 1417 if (ret) { ··· 1444 1462 struct pci_dev *pdev = to_pci_dev(device); 1445 1463 struct drm_device *dev = pci_get_drvdata(pdev); 1446 1464 struct drm_i915_private *dev_priv = dev->dev_private; 1447 - int ret; 1465 + int ret = 0; 1448 1466 1449 1467 if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev))) 1450 1468 return -ENODEV; ··· 1454 1472 intel_opregion_notify_adapter(dev, PCI_D0); 1455 1473 dev_priv->pm.suspended = false; 1456 1474 1457 - ret = intel_resume_prepare(dev_priv, true); 1475 + if (IS_GEN6(dev_priv)) 1476 + intel_init_pch_refclk(dev); 1477 + else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) 1478 + hsw_disable_pc8(dev_priv); 1479 + else if (IS_VALLEYVIEW(dev_priv)) 1480 + ret = vlv_resume_prepare(dev_priv, true); 1481 + 1458 1482 /* 1459 1483 * No point of rolling back things in case of an error, as the best 1460 1484 * we can do is to hope that things will still work (and disable RPM). ··· 1469 1481 gen6_update_ring_freq(dev); 1470 1482 1471 1483 intel_runtime_pm_enable_interrupts(dev_priv); 1472 - intel_reset_gt_powersave(dev); 1484 + intel_enable_gt_powersave(dev); 1473 1485 1474 1486 if (ret) 1475 1487 DRM_ERROR("Runtime resume failed, disabling it (%d)\n", ret); ··· 1492 1504 ret = hsw_suspend_complete(dev_priv); 1493 1505 else if (IS_VALLEYVIEW(dev)) 1494 1506 ret = vlv_suspend_complete(dev_priv); 1495 - else 1496 - ret = 0; 1497 - 1498 - return ret; 1499 - } 1500 - 1501 - /* 1502 - * This function implements common functionality of runtime and system 1503 - * resume sequence. Variable rpm_resume used for implementing different 1504 - * code paths. 1505 - */ 1506 - static int intel_resume_prepare(struct drm_i915_private *dev_priv, 1507 - bool rpm_resume) 1508 - { 1509 - struct drm_device *dev = dev_priv->dev; 1510 - int ret; 1511 - 1512 - if (IS_GEN6(dev)) 1513 - ret = snb_resume_prepare(dev_priv, rpm_resume); 1514 - else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) 1515 - ret = hsw_resume_prepare(dev_priv, rpm_resume); 1516 - else if (IS_VALLEYVIEW(dev)) 1517 - ret = vlv_resume_prepare(dev_priv, rpm_resume); 1518 1507 else 1519 1508 ret = 0; 1520 1509
+88 -17
drivers/gpu/drm/i915/i915_drv.h
··· 55 55 56 56 #define DRIVER_NAME "i915" 57 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 63 enum pipe { 61 64 INVALID_PIPE = -1, ··· 229 226 uint32_t wrpll; 230 227 }; 231 228 229 + struct intel_shared_dpll_config { 230 + unsigned crtc_mask; /* mask of CRTCs sharing this PLL */ 231 + struct intel_dpll_hw_state hw_state; 232 + }; 233 + 232 234 struct intel_shared_dpll { 233 - int refcount; /* count of number of CRTCs sharing this PLL */ 235 + struct intel_shared_dpll_config config; 236 + struct intel_shared_dpll_config *new_config; 237 + 234 238 int active; /* count of number of active CRTCs (i.e. DPMS on) */ 235 239 bool on; /* is the PLL actually active? Disabled during modeset */ 236 240 const char *name; 237 241 /* should match the index in the dev_priv->shared_dplls array */ 238 242 enum intel_dpll_id id; 239 - struct intel_dpll_hw_state hw_state; 240 243 /* The mode_set hook is optional and should be used together with the 241 244 * intel_prepare_shared_dpll function. */ 242 245 void (*mode_set)(struct drm_i915_private *dev_priv, ··· 284 275 #define DRIVER_PATCHLEVEL 0 285 276 286 277 #define WATCH_LISTS 0 287 - #define WATCH_GTT 0 288 278 289 279 struct opregion_header; 290 280 struct opregion_acpi; ··· 442 434 }; 443 435 444 436 struct intel_connector; 437 + struct intel_encoder; 445 438 struct intel_crtc_config; 446 439 struct intel_plane_config; 447 440 struct intel_crtc; ··· 485 476 struct intel_crtc_config *); 486 477 void (*get_plane_config)(struct intel_crtc *, 487 478 struct intel_plane_config *); 488 - int (*crtc_mode_set)(struct intel_crtc *crtc, 489 - int x, int y, 490 - struct drm_framebuffer *old_fb); 479 + int (*crtc_compute_clock)(struct intel_crtc *crtc); 491 480 void (*crtc_enable)(struct drm_crtc *crtc); 492 481 void (*crtc_disable)(struct drm_crtc *crtc); 493 482 void (*off)(struct drm_crtc *crtc); 494 - void (*write_eld)(struct drm_connector *connector, 495 - struct drm_crtc *crtc, 496 - struct drm_display_mode *mode); 483 + void (*audio_codec_enable)(struct drm_connector *connector, 484 + struct intel_encoder *encoder, 485 + struct drm_display_mode *mode); 486 + void (*audio_codec_disable)(struct intel_encoder *encoder); 497 487 void (*fdi_link_train)(struct drm_crtc *crtc); 498 488 void (*init_clock_gating)(struct drm_device *dev); 499 489 int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc, ··· 549 541 550 542 unsigned fw_rendercount; 551 543 unsigned fw_mediacount; 544 + unsigned fw_blittercount; 552 545 553 546 struct timer_list force_wake_timer; 554 547 }; ··· 1388 1379 enum intel_ddb_partitioning partitioning; 1389 1380 }; 1390 1381 1382 + struct skl_ddb_entry { 1383 + uint16_t start, end; /* in number of blocks, 'end' is exclusive */ 1384 + }; 1385 + 1386 + static inline uint16_t skl_ddb_entry_size(const struct skl_ddb_entry *entry) 1387 + { 1388 + return entry->end - entry->start; 1389 + } 1390 + 1391 + static inline bool skl_ddb_entry_equal(const struct skl_ddb_entry *e1, 1392 + const struct skl_ddb_entry *e2) 1393 + { 1394 + if (e1->start == e2->start && e1->end == e2->end) 1395 + return true; 1396 + 1397 + return false; 1398 + } 1399 + 1400 + struct skl_ddb_allocation { 1401 + struct skl_ddb_entry pipe[I915_MAX_PIPES]; 1402 + struct skl_ddb_entry plane[I915_MAX_PIPES][I915_MAX_PLANES]; 1403 + struct skl_ddb_entry cursor[I915_MAX_PIPES]; 1404 + }; 1405 + 1406 + struct skl_wm_values { 1407 + bool dirty[I915_MAX_PIPES]; 1408 + struct skl_ddb_allocation ddb; 1409 + uint32_t wm_linetime[I915_MAX_PIPES]; 1410 + uint32_t plane[I915_MAX_PIPES][I915_MAX_PLANES][8]; 1411 + uint32_t cursor[I915_MAX_PIPES][8]; 1412 + uint32_t plane_trans[I915_MAX_PIPES][I915_MAX_PLANES]; 1413 + uint32_t cursor_trans[I915_MAX_PIPES]; 1414 + }; 1415 + 1416 + struct skl_wm_level { 1417 + bool plane_en[I915_MAX_PLANES]; 1418 + bool cursor_en; 1419 + uint16_t plane_res_b[I915_MAX_PLANES]; 1420 + uint8_t plane_res_l[I915_MAX_PLANES]; 1421 + uint16_t cursor_res_b; 1422 + uint8_t cursor_res_l; 1423 + }; 1424 + 1391 1425 /* 1392 1426 * This struct helps tracking the state needed for runtime PM, which puts the 1393 1427 * device in PCI D3 state. Notice that when this happens, nothing on the ··· 1613 1561 1614 1562 unsigned int fsb_freq, mem_freq, is_ddr3; 1615 1563 unsigned int vlv_cdclk_freq; 1564 + unsigned int hpll_freq; 1616 1565 1617 1566 /** 1618 1567 * wq - Driver workqueue for GEM. ··· 1723 1670 uint16_t spr_latency[5]; 1724 1671 /* cursor */ 1725 1672 uint16_t cur_latency[5]; 1673 + /* 1674 + * Raw watermark memory latency values 1675 + * for SKL for all 8 levels 1676 + * in 1us units. 1677 + */ 1678 + uint16_t skl_latency[8]; 1679 + 1680 + /* 1681 + * The skl_wm_values structure is a bit too big for stack 1682 + * allocation, so we keep the staging struct where we store 1683 + * intermediate results here instead. 1684 + */ 1685 + struct skl_wm_values skl_results; 1726 1686 1727 1687 /* current hardware state */ 1728 - struct ilk_wm_values hw; 1688 + union { 1689 + struct ilk_wm_values hw; 1690 + struct skl_wm_values skl_hw; 1691 + }; 1729 1692 } wm; 1730 1693 1731 1694 struct i915_runtime_pm pm; ··· 1925 1856 unsigned long gt_ro:1; 1926 1857 unsigned int cache_level:3; 1927 1858 1928 - unsigned int has_aliasing_ppgtt_mapping:1; 1929 - unsigned int has_global_gtt_mapping:1; 1930 1859 unsigned int has_dma_mapping:1; 1931 1860 1932 1861 unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; ··· 2359 2292 void i915_handle_error(struct drm_device *dev, bool wedged, 2360 2293 const char *fmt, ...); 2361 2294 2362 - void gen6_set_pm_mask(struct drm_i915_private *dev_priv, u32 pm_iir, 2363 - int new_delay); 2364 2295 extern void intel_irq_init(struct drm_i915_private *dev_priv); 2365 2296 extern void intel_hpd_init(struct drm_i915_private *dev_priv); 2366 2297 int intel_irq_install(struct drm_i915_private *dev_priv); ··· 2596 2531 u32 *seqno); 2597 2532 #define i915_add_request(ring, seqno) \ 2598 2533 __i915_add_request(ring, NULL, NULL, seqno) 2534 + int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno, 2535 + unsigned reset_counter, 2536 + bool interruptible, 2537 + s64 *timeout, 2538 + struct drm_i915_file_private *file_priv); 2599 2539 int __must_check i915_wait_seqno(struct intel_engine_cs *ring, 2600 2540 uint32_t seqno); 2601 2541 int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); ··· 2870 2800 extern void intel_i2c_reset(struct drm_device *dev); 2871 2801 2872 2802 /* intel_opregion.c */ 2873 - struct intel_encoder; 2874 2803 #ifdef CONFIG_ACPI 2875 2804 extern int intel_opregion_setup(struct drm_device *dev); 2876 2805 extern void intel_opregion_init(struct drm_device *dev); ··· 2986 2917 2987 2918 #define FORCEWAKE_RENDER (1 << 0) 2988 2919 #define FORCEWAKE_MEDIA (1 << 1) 2989 - #define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA) 2920 + #define FORCEWAKE_BLITTER (1 << 2) 2921 + #define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA | \ 2922 + FORCEWAKE_BLITTER) 2990 2923 2991 2924 2992 2925 #define I915_READ8(reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true)
+45 -30
drivers/gpu/drm/i915/i915_gem.c
··· 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 1138 * @ring: the ring expected to report seqno 1139 1139 * @seqno: duh! 1140 1140 * @reset_counter: reset sequence associated with the given seqno ··· 1151 1151 * Returns 0 if the seqno was found within the alloted time. Else returns the 1152 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 1155 unsigned reset_counter, 1156 1156 bool interruptible, 1157 1157 s64 *timeout, ··· 1262 1262 struct drm_device *dev = ring->dev; 1263 1263 struct drm_i915_private *dev_priv = dev->dev_private; 1264 1264 bool interruptible = dev_priv->mm.interruptible; 1265 + unsigned reset_counter; 1265 1266 int ret; 1266 1267 1267 1268 BUG_ON(!mutex_is_locked(&dev->struct_mutex)); ··· 1276 1275 if (ret) 1277 1276 return ret; 1278 1277 1279 - return __wait_seqno(ring, seqno, 1280 - atomic_read(&dev_priv->gpu_error.reset_counter), 1281 - interruptible, NULL, NULL); 1278 + reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); 1279 + return __i915_wait_seqno(ring, seqno, reset_counter, interruptible, 1280 + NULL, NULL); 1282 1281 } 1283 1282 1284 1283 static int 1285 - i915_gem_object_wait_rendering__tail(struct drm_i915_gem_object *obj, 1286 - struct intel_engine_cs *ring) 1284 + i915_gem_object_wait_rendering__tail(struct drm_i915_gem_object *obj) 1287 1285 { 1288 1286 if (!obj->active) 1289 1287 return 0; ··· 1319 1319 if (ret) 1320 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 1325 /* A nonblocking variant of the above wait. This is a highly dangerous routine ··· 1354 1354 1355 1355 reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); 1356 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 1359 mutex_lock(&dev->struct_mutex); 1359 1360 if (ret) 1360 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 /** ··· 2849 2848 reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); 2850 2849 mutex_unlock(&dev->struct_mutex); 2851 2850 2852 - return __wait_seqno(ring, seqno, reset_counter, true, &args->timeout_ns, 2853 - file->driver_priv); 2851 + return __i915_wait_seqno(ring, seqno, reset_counter, true, 2852 + &args->timeout_ns, file->driver_priv); 2854 2853 2855 2854 out: 2856 2855 drm_gem_object_unreference(&obj->base); ··· 3478 3477 list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); 3479 3478 list_add_tail(&vma->mm_list, &vm->inactive_list); 3480 3479 3481 - if (i915_is_ggtt(vm)) { 3482 - bool mappable, fenceable; 3483 - 3484 - fenceable = (vma->node.size == fence_size && 3485 - (vma->node.start & (fence_alignment - 1)) == 0); 3486 - 3487 - mappable = (vma->node.start + obj->base.size <= 3488 - dev_priv->gtt.mappable_end); 3489 - 3490 - obj->map_and_fenceable = mappable && fenceable; 3491 - } 3492 - 3493 - WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable); 3494 - 3495 3480 trace_i915_vma_bind(vma, flags); 3496 3481 vma->bind_vma(vma, obj->cache_level, 3497 - flags & (PIN_MAPPABLE | PIN_GLOBAL) ? GLOBAL_BIND : 0); 3482 + flags & PIN_GLOBAL ? GLOBAL_BIND : 0); 3498 3483 3499 3484 return vma; 3500 3485 ··· 3688 3701 list_for_each_entry(vma, &obj->vma_list, vma_link) 3689 3702 if (drm_mm_node_allocated(&vma->node)) 3690 3703 vma->bind_vma(vma, cache_level, 3691 - obj->has_global_gtt_mapping ? GLOBAL_BIND : 0); 3704 + vma->bound & GLOBAL_BIND); 3692 3705 } 3693 3706 3694 3707 list_for_each_entry(vma, &obj->vma_list, vma_link) ··· 4015 4028 if (seqno == 0) 4016 4029 return 0; 4017 4030 4018 - ret = __wait_seqno(ring, seqno, reset_counter, true, NULL, NULL); 4031 + ret = __i915_wait_seqno(ring, seqno, reset_counter, true, NULL, NULL); 4019 4032 if (ret == 0) 4020 4033 queue_delayed_work(dev_priv->wq, &dev_priv->mm.retire_work, 0); 4021 4034 ··· 4049 4062 { 4050 4063 struct drm_i915_private *dev_priv = obj->base.dev->dev_private; 4051 4064 struct i915_vma *vma; 4065 + unsigned bound; 4052 4066 int ret; 4053 4067 4054 4068 if (WARN_ON(vm == &dev_priv->mm.aliasing_ppgtt->base)) 4055 4069 return -ENODEV; 4056 4070 4057 4071 if (WARN_ON(flags & (PIN_GLOBAL | PIN_MAPPABLE) && !i915_is_ggtt(vm))) 4072 + return -EINVAL; 4073 + 4074 + if (WARN_ON((flags & (PIN_MAPPABLE | PIN_GLOBAL)) == PIN_MAPPABLE)) 4058 4075 return -EINVAL; 4059 4076 4060 4077 vma = i915_gem_obj_to_vma(obj, vm); ··· 4082 4091 } 4083 4092 } 4084 4093 4094 + bound = vma ? vma->bound : 0; 4085 4095 if (vma == NULL || !drm_mm_node_allocated(&vma->node)) { 4086 4096 vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags); 4087 4097 if (IS_ERR(vma)) 4088 4098 return PTR_ERR(vma); 4089 4099 } 4090 4100 4091 - if (flags & PIN_GLOBAL && !obj->has_global_gtt_mapping) 4101 + if (flags & PIN_GLOBAL && !(vma->bound & GLOBAL_BIND)) 4092 4102 vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); 4103 + 4104 + if ((bound ^ vma->bound) & GLOBAL_BIND) { 4105 + bool mappable, fenceable; 4106 + u32 fence_size, fence_alignment; 4107 + 4108 + fence_size = i915_gem_get_gtt_size(obj->base.dev, 4109 + obj->base.size, 4110 + obj->tiling_mode); 4111 + fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev, 4112 + obj->base.size, 4113 + obj->tiling_mode, 4114 + true); 4115 + 4116 + fenceable = (vma->node.size == fence_size && 4117 + (vma->node.start & (fence_alignment - 1)) == 0); 4118 + 4119 + mappable = (vma->node.start + obj->base.size <= 4120 + dev_priv->gtt.mappable_end); 4121 + 4122 + obj->map_and_fenceable = mappable && fenceable; 4123 + } 4124 + 4125 + WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable); 4093 4126 4094 4127 vma->pin_count++; 4095 4128 if (flags & PIN_MAPPABLE)
+5 -5
drivers/gpu/drm/i915/i915_gem_context.c
··· 522 522 struct intel_context *from = ring->last_context; 523 523 u32 hw_flags = 0; 524 524 bool uninitialized = false; 525 + struct i915_vma *vma; 525 526 int ret, i; 526 527 527 528 if (from != NULL && ring == &dev_priv->ring[RCS]) { ··· 572 571 if (ret) 573 572 goto unpin_out; 574 573 575 - if (!to->legacy_hw_ctx.rcs_state->has_global_gtt_mapping) { 576 - struct i915_vma *vma = i915_gem_obj_to_vma(to->legacy_hw_ctx.rcs_state, 577 - &dev_priv->gtt.base); 578 - vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, GLOBAL_BIND); 579 - } 574 + vma = i915_gem_obj_to_ggtt(to->legacy_hw_ctx.rcs_state); 575 + if (!(vma->bound & GLOBAL_BIND)) 576 + vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, 577 + GLOBAL_BIND); 580 578 581 579 if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to)) 582 580 hw_flags |= MI_RESTORE_INHIBIT;
+17 -18
drivers/gpu/drm/i915/i915_gem_execbuffer.c
··· 357 357 * through the ppgtt for non_secure batchbuffers. */ 358 358 if (unlikely(IS_GEN6(dev) && 359 359 reloc->write_domain == I915_GEM_DOMAIN_INSTRUCTION && 360 - !target_i915_obj->has_global_gtt_mapping)) { 361 - struct i915_vma *vma = 362 - list_first_entry(&target_i915_obj->vma_list, 363 - typeof(*vma), vma_link); 364 - vma->bind_vma(vma, target_i915_obj->cache_level, GLOBAL_BIND); 365 - } 360 + !(target_vma->bound & GLOBAL_BIND))) 361 + target_vma->bind_vma(target_vma, target_i915_obj->cache_level, 362 + GLOBAL_BIND); 366 363 367 364 /* Validate that the target is in a valid r/w GPU domain */ 368 365 if (unlikely(reloc->write_domain & (reloc->write_domain - 1))) { ··· 528 531 529 532 flags = 0; 530 533 if (entry->flags & __EXEC_OBJECT_NEEDS_MAP) 531 - flags |= PIN_MAPPABLE; 534 + flags |= PIN_GLOBAL | PIN_MAPPABLE; 532 535 if (entry->flags & EXEC_OBJECT_NEEDS_GTT) 533 536 flags |= PIN_GLOBAL; 534 537 if (entry->flags & __EXEC_OBJECT_NEEDS_BIAS) ··· 1365 1368 batch_obj, 1366 1369 args->batch_start_offset, 1367 1370 file->is_master); 1368 - if (ret) 1369 - goto err; 1370 - 1371 - /* 1372 - * XXX: Actually do this when enabling batch copy... 1373 - * 1374 - * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit 1375 - * from MI_BATCH_BUFFER_START commands issued in the 1376 - * dispatch_execbuffer implementations. We specifically don't 1377 - * want that set when the command parser is enabled. 1378 - */ 1371 + if (ret) { 1372 + if (ret != -EACCES) 1373 + goto err; 1374 + } else { 1375 + /* 1376 + * XXX: Actually do this when enabling batch copy... 1377 + * 1378 + * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit 1379 + * from MI_BATCH_BUFFER_START commands issued in the 1380 + * dispatch_execbuffer implementations. We specifically don't 1381 + * want that set when the command parser is enabled. 1382 + */ 1383 + } 1379 1384 } 1380 1385 1381 1386 /* snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure
+13 -13
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 1266 1266 fault_reg = I915_READ(RING_FAULT_REG(ring)); 1267 1267 if (fault_reg & RING_FAULT_VALID) { 1268 1268 DRM_DEBUG_DRIVER("Unexpected fault\n" 1269 - "\tAddr: 0x%08lx\\n" 1269 + "\tAddr: 0x%08lx\n" 1270 1270 "\tAddress space: %s\n" 1271 1271 "\tSource ID: %d\n" 1272 1272 "\tType: %d\n", ··· 1336 1336 * Unfortunately above, we've just wiped out the mappings 1337 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 1340 vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); 1341 1341 } 1342 1342 ··· 1533 1533 1534 1534 BUG_ON(!i915_is_ggtt(vma->vm)); 1535 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 1539 static void i915_ggtt_clear_range(struct i915_address_space *vm, ··· 1552 1552 const unsigned int size = vma->obj->base.size >> PAGE_SHIFT; 1553 1553 1554 1554 BUG_ON(!i915_is_ggtt(vma->vm)); 1555 - vma->obj->has_global_gtt_mapping = 0; 1555 + vma->bound = 0; 1556 1556 intel_gtt_clear_range(first, size); 1557 1557 } 1558 1558 ··· 1580 1580 * flags. At all other times, the GPU will use the aliasing PPGTT. 1581 1581 */ 1582 1582 if (!dev_priv->mm.aliasing_ppgtt || flags & GLOBAL_BIND) { 1583 - if (!obj->has_global_gtt_mapping || 1583 + if (!(vma->bound & GLOBAL_BIND) || 1584 1584 (cache_level != obj->cache_level)) { 1585 1585 vma->vm->insert_entries(vma->vm, obj->pages, 1586 1586 vma->node.start, 1587 1587 cache_level, flags); 1588 - obj->has_global_gtt_mapping = 1; 1588 + vma->bound |= GLOBAL_BIND; 1589 1589 } 1590 1590 } 1591 1591 1592 1592 if (dev_priv->mm.aliasing_ppgtt && 1593 - (!obj->has_aliasing_ppgtt_mapping || 1593 + (!(vma->bound & LOCAL_BIND) || 1594 1594 (cache_level != obj->cache_level))) { 1595 1595 struct i915_hw_ppgtt *appgtt = dev_priv->mm.aliasing_ppgtt; 1596 1596 appgtt->base.insert_entries(&appgtt->base, 1597 1597 vma->obj->pages, 1598 1598 vma->node.start, 1599 1599 cache_level, flags); 1600 - vma->obj->has_aliasing_ppgtt_mapping = 1; 1600 + vma->bound |= LOCAL_BIND; 1601 1601 } 1602 1602 } 1603 1603 ··· 1607 1607 struct drm_i915_private *dev_priv = dev->dev_private; 1608 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 1611 vma->vm->clear_range(vma->vm, 1612 1612 vma->node.start, 1613 1613 obj->base.size, 1614 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 1619 struct i915_hw_ppgtt *appgtt = dev_priv->mm.aliasing_ppgtt; 1620 1620 appgtt->base.clear_range(&appgtt->base, 1621 1621 vma->node.start, 1622 1622 obj->base.size, 1623 1623 true); 1624 - obj->has_aliasing_ppgtt_mapping = 0; 1624 + vma->bound &= ~LOCAL_BIND; 1625 1625 } 1626 1626 } 1627 1627 ··· 1699 1699 DRM_DEBUG_KMS("Reservation failed: %i\n", ret); 1700 1700 return ret; 1701 1701 } 1702 - obj->has_global_gtt_mapping = 1; 1702 + vma->bound |= GLOBAL_BIND; 1703 1703 } 1704 1704 1705 1705 dev_priv->gtt.base.start = start;
+6 -2
drivers/gpu/drm/i915/i915_gem_gtt.h
··· 123 123 struct drm_i915_gem_object *obj; 124 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 132 /** This object's place on the active/inactive lists */ 127 133 struct list_head mm_list; 128 134 ··· 161 155 * setting the valid PTE entries to a reserved scratch page. */ 162 156 void (*unbind_vma)(struct i915_vma *vma); 163 157 /* Map an object into an address space with the given cache flags. */ 164 - #define GLOBAL_BIND (1<<0) 165 - #define PTE_READ_ONLY (1<<1) 166 158 void (*bind_vma)(struct i915_vma *vma, 167 159 enum i915_cache_level cache_level, 168 160 u32 flags);
+2
drivers/gpu/drm/i915/i915_gem_render_state.c
··· 38 38 return &gen7_null_state; 39 39 case 8: 40 40 return &gen8_null_state; 41 + case 9: 42 + return &gen9_null_state; 41 43 } 42 44 43 45 return NULL;
+1 -1
drivers/gpu/drm/i915/i915_gem_stolen.c
··· 533 533 } 534 534 } 535 535 536 - obj->has_global_gtt_mapping = 1; 536 + vma->bound |= GLOBAL_BIND; 537 537 538 538 list_add_tail(&obj->global_list, &dev_priv->mm.bound_list); 539 539 list_add_tail(&vma->mm_list, &ggtt->inactive_list);
+1
drivers/gpu/drm/i915/i915_gem_tiling.c
··· 458 458 } 459 459 460 460 /* Hide bit 17 from the user -- see comment in i915_gem_set_tiling */ 461 + args->phys_swizzle_mode = args->swizzle_mode; 461 462 if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_17) 462 463 args->swizzle_mode = I915_BIT_6_SWIZZLE_9; 463 464 if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_10_17)
+8 -5
drivers/gpu/drm/i915/i915_gpu_error.c
··· 565 565 struct i915_address_space *vm) 566 566 { 567 567 struct drm_i915_error_object *dst; 568 + struct i915_vma *vma = NULL; 568 569 int num_pages; 569 570 bool use_ggtt; 570 571 int i = 0; ··· 586 585 dst->gtt_offset = -1; 587 586 588 587 reloc_offset = dst->gtt_offset; 588 + if (i915_is_ggtt(vm)) 589 + vma = i915_gem_obj_to_ggtt(src); 589 590 use_ggtt = (src->cache_level == I915_CACHE_NONE && 590 - i915_is_ggtt(vm) && 591 - src->has_global_gtt_mapping && 592 - reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end); 591 + vma && (vma->bound & GLOBAL_BIND) && 592 + reloc_offset + num_pages * PAGE_SIZE <= dev_priv->gtt.mappable_end); 593 593 594 594 /* Cannot access stolen address directly, try to use the aperture */ 595 595 if (src->stolen) { 596 596 use_ggtt = true; 597 597 598 - if (!src->has_global_gtt_mapping) 598 + if (!(vma && vma->bound & GLOBAL_BIND)) 599 599 goto unwind; 600 600 601 601 reloc_offset = i915_gem_obj_ggtt_offset(src); ··· 1242 1240 ecode = i915_error_generate_code(dev_priv, error, &ring_id); 1243 1241 1244 1242 len = scnprintf(error->error_msg, sizeof(error->error_msg), 1245 - "GPU HANG: ecode %d:0x%08x", ring_id, ecode); 1243 + "GPU HANG: ecode %d:%d:0x%08x", 1244 + INTEL_INFO(dev)->gen, ring_id, ecode); 1246 1245 1247 1246 if (ring_id != -1 && error->ring[ring_id].pid != -1) 1248 1247 len += scnprintf(error->error_msg + len,
+60 -96
drivers/gpu/drm/i915/i915_irq.c
··· 126 126 127 127 #define GEN8_IRQ_INIT_NDX(type, which, imr_val, ier_val) do { \ 128 128 GEN5_ASSERT_IIR_IS_ZERO(GEN8_##type##_IIR(which)); \ 129 - I915_WRITE(GEN8_##type##_IMR(which), (imr_val)); \ 130 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 132 } while (0) 133 133 134 134 #define GEN5_IRQ_INIT(type, imr_val, ier_val) do { \ 135 135 GEN5_ASSERT_IIR_IS_ZERO(type##IIR); \ 136 - I915_WRITE(type##IMR, (imr_val)); \ 137 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 139 } while (0) 140 140 141 141 /* For display hotplug interrupt */ ··· 978 978 return; 979 979 980 980 trace_i915_gem_request_complete(ring); 981 - 982 - if (drm_core_check_feature(dev, DRIVER_MODESET)) 983 - intel_notify_mmio_flip(ring); 984 981 985 982 wake_up_all(&ring->irq_queue); 986 983 i915_queue_hangcheck(dev); ··· 3102 3105 ibx_irq_reset(dev); 3103 3106 } 3104 3107 3108 + static void vlv_display_irq_reset(struct drm_i915_private *dev_priv) 3109 + { 3110 + enum pipe pipe; 3111 + 3112 + I915_WRITE(PORT_HOTPLUG_EN, 0); 3113 + I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); 3114 + 3115 + for_each_pipe(dev_priv, pipe) 3116 + I915_WRITE(PIPESTAT(pipe), 0xffff); 3117 + 3118 + GEN5_IRQ_RESET(VLV_); 3119 + } 3120 + 3105 3121 static void valleyview_irq_preinstall(struct drm_device *dev) 3106 3122 { 3107 3123 struct drm_i915_private *dev_priv = dev->dev_private; 3108 - int pipe; 3109 3124 3110 3125 /* VLV magic */ 3111 3126 I915_WRITE(VLV_IMR, 0); ··· 3125 3116 I915_WRITE(RING_IMR(GEN6_BSD_RING_BASE), 0); 3126 3117 I915_WRITE(RING_IMR(BLT_RING_BASE), 0); 3127 3118 3128 - /* and GT */ 3129 - I915_WRITE(GTIIR, I915_READ(GTIIR)); 3130 - I915_WRITE(GTIIR, I915_READ(GTIIR)); 3131 - 3132 3119 gen5_gt_irq_reset(dev); 3133 3120 3134 - I915_WRITE(DPINVGTT, 0xff); 3121 + I915_WRITE(DPINVGTT, DPINVGTT_STATUS_MASK); 3135 3122 3136 - I915_WRITE(PORT_HOTPLUG_EN, 0); 3137 - I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); 3138 - for_each_pipe(dev_priv, pipe) 3139 - I915_WRITE(PIPESTAT(pipe), 0xffff); 3140 - I915_WRITE(VLV_IIR, 0xffffffff); 3141 - I915_WRITE(VLV_IMR, 0xffffffff); 3142 - I915_WRITE(VLV_IER, 0x0); 3143 - POSTING_READ(VLV_IER); 3123 + vlv_display_irq_reset(dev_priv); 3144 3124 } 3145 3125 3146 3126 static void gen8_gt_irq_reset(struct drm_i915_private *dev_priv) ··· 3177 3179 static void cherryview_irq_preinstall(struct drm_device *dev) 3178 3180 { 3179 3181 struct drm_i915_private *dev_priv = dev->dev_private; 3180 - int pipe; 3181 3182 3182 3183 I915_WRITE(GEN8_MASTER_IRQ, 0); 3183 3184 POSTING_READ(GEN8_MASTER_IRQ); ··· 3185 3188 3186 3189 GEN5_IRQ_RESET(GEN8_PCU_); 3187 3190 3188 - POSTING_READ(GEN8_PCU_IIR); 3189 - 3190 3191 I915_WRITE(DPINVGTT, DPINVGTT_STATUS_MASK_CHV); 3191 3192 3192 - I915_WRITE(PORT_HOTPLUG_EN, 0); 3193 - I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); 3194 - 3195 - for_each_pipe(dev_priv, pipe) 3196 - I915_WRITE(PIPESTAT(pipe), 0xffff); 3197 - 3198 - I915_WRITE(VLV_IMR, 0xffffffff); 3199 - I915_WRITE(VLV_IER, 0x0); 3200 - I915_WRITE(VLV_IIR, 0xffffffff); 3201 - POSTING_READ(VLV_IIR); 3193 + vlv_display_irq_reset(dev_priv); 3202 3194 } 3203 3195 3204 3196 static void ibx_hpd_irq_setup(struct drm_device *dev) ··· 3328 3342 { 3329 3343 u32 pipestat_mask; 3330 3344 u32 iir_mask; 3345 + enum pipe pipe; 3331 3346 3332 3347 pipestat_mask = PIPESTAT_INT_STATUS_MASK | 3333 3348 PIPE_FIFO_UNDERRUN_STATUS; 3334 3349 3335 - I915_WRITE(PIPESTAT(PIPE_A), pipestat_mask); 3336 - I915_WRITE(PIPESTAT(PIPE_B), pipestat_mask); 3350 + for_each_pipe(dev_priv, pipe) 3351 + I915_WRITE(PIPESTAT(pipe), pipestat_mask); 3337 3352 POSTING_READ(PIPESTAT(PIPE_A)); 3338 3353 3339 3354 pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV | 3340 3355 PIPE_CRC_DONE_INTERRUPT_STATUS; 3341 3356 3342 - i915_enable_pipestat(dev_priv, PIPE_A, pipestat_mask | 3343 - PIPE_GMBUS_INTERRUPT_STATUS); 3344 - i915_enable_pipestat(dev_priv, PIPE_B, pipestat_mask); 3357 + i915_enable_pipestat(dev_priv, PIPE_A, PIPE_GMBUS_INTERRUPT_STATUS); 3358 + for_each_pipe(dev_priv, pipe) 3359 + i915_enable_pipestat(dev_priv, pipe, pipestat_mask); 3345 3360 3346 3361 iir_mask = I915_DISPLAY_PORT_INTERRUPT | 3347 3362 I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | 3348 3363 I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; 3364 + if (IS_CHERRYVIEW(dev_priv)) 3365 + iir_mask |= I915_DISPLAY_PIPE_C_EVENT_INTERRUPT; 3349 3366 dev_priv->irq_mask &= ~iir_mask; 3350 3367 3351 3368 I915_WRITE(VLV_IIR, iir_mask); 3352 3369 I915_WRITE(VLV_IIR, iir_mask); 3353 - I915_WRITE(VLV_IMR, dev_priv->irq_mask); 3354 3370 I915_WRITE(VLV_IER, ~dev_priv->irq_mask); 3355 - POSTING_READ(VLV_IER); 3371 + I915_WRITE(VLV_IMR, dev_priv->irq_mask); 3372 + POSTING_READ(VLV_IMR); 3356 3373 } 3357 3374 3358 3375 static void valleyview_display_irqs_uninstall(struct drm_i915_private *dev_priv) 3359 3376 { 3360 3377 u32 pipestat_mask; 3361 3378 u32 iir_mask; 3379 + enum pipe pipe; 3362 3380 3363 3381 iir_mask = I915_DISPLAY_PORT_INTERRUPT | 3364 3382 I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | 3365 3383 I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; 3384 + if (IS_CHERRYVIEW(dev_priv)) 3385 + iir_mask |= I915_DISPLAY_PIPE_C_EVENT_INTERRUPT; 3366 3386 3367 3387 dev_priv->irq_mask |= iir_mask; 3368 - I915_WRITE(VLV_IER, ~dev_priv->irq_mask); 3369 3388 I915_WRITE(VLV_IMR, dev_priv->irq_mask); 3389 + I915_WRITE(VLV_IER, ~dev_priv->irq_mask); 3370 3390 I915_WRITE(VLV_IIR, iir_mask); 3371 3391 I915_WRITE(VLV_IIR, iir_mask); 3372 3392 POSTING_READ(VLV_IIR); ··· 3380 3388 pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV | 3381 3389 PIPE_CRC_DONE_INTERRUPT_STATUS; 3382 3390 3383 - i915_disable_pipestat(dev_priv, PIPE_A, pipestat_mask | 3384 - PIPE_GMBUS_INTERRUPT_STATUS); 3385 - i915_disable_pipestat(dev_priv, PIPE_B, pipestat_mask); 3391 + i915_disable_pipestat(dev_priv, PIPE_A, PIPE_GMBUS_INTERRUPT_STATUS); 3392 + for_each_pipe(dev_priv, pipe) 3393 + i915_disable_pipestat(dev_priv, pipe, pipestat_mask); 3386 3394 3387 3395 pipestat_mask = PIPESTAT_INT_STATUS_MASK | 3388 3396 PIPE_FIFO_UNDERRUN_STATUS; 3389 - I915_WRITE(PIPESTAT(PIPE_A), pipestat_mask); 3390 - I915_WRITE(PIPESTAT(PIPE_B), pipestat_mask); 3397 + 3398 + for_each_pipe(dev_priv, pipe) 3399 + I915_WRITE(PIPESTAT(pipe), pipestat_mask); 3391 3400 POSTING_READ(PIPESTAT(PIPE_A)); 3392 3401 } 3393 3402 ··· 3418 3425 valleyview_display_irqs_uninstall(dev_priv); 3419 3426 } 3420 3427 3421 - static int valleyview_irq_postinstall(struct drm_device *dev) 3428 + static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv) 3422 3429 { 3423 - struct drm_i915_private *dev_priv = dev->dev_private; 3424 - 3425 3430 dev_priv->irq_mask = ~0; 3426 3431 3427 3432 I915_WRITE(PORT_HOTPLUG_EN, 0); 3428 3433 POSTING_READ(PORT_HOTPLUG_EN); 3429 3434 3430 - I915_WRITE(VLV_IMR, dev_priv->irq_mask); 3431 - I915_WRITE(VLV_IER, ~dev_priv->irq_mask); 3432 3435 I915_WRITE(VLV_IIR, 0xffffffff); 3433 - POSTING_READ(VLV_IER); 3436 + I915_WRITE(VLV_IIR, 0xffffffff); 3437 + I915_WRITE(VLV_IER, ~dev_priv->irq_mask); 3438 + I915_WRITE(VLV_IMR, dev_priv->irq_mask); 3439 + POSTING_READ(VLV_IMR); 3434 3440 3435 3441 /* Interrupt setup is already guaranteed to be single-threaded, this is 3436 3442 * just to make the assert_spin_locked check happy. */ ··· 3437 3445 if (dev_priv->display_irqs_enabled) 3438 3446 valleyview_display_irqs_install(dev_priv); 3439 3447 spin_unlock_irq(&dev_priv->irq_lock); 3448 + } 3440 3449 3441 - I915_WRITE(VLV_IIR, 0xffffffff); 3442 - I915_WRITE(VLV_IIR, 0xffffffff); 3450 + static int valleyview_irq_postinstall(struct drm_device *dev) 3451 + { 3452 + struct drm_i915_private *dev_priv = dev->dev_private; 3453 + 3454 + vlv_display_irq_postinstall(dev_priv); 3443 3455 3444 3456 gen5_gt_irq_postinstall(dev); 3445 3457 ··· 3557 3561 spin_unlock_irq(&dev_priv->irq_lock); 3558 3562 3559 3563 I915_WRITE(VLV_IIR, 0xffffffff); 3560 - I915_WRITE(VLV_IMR, dev_priv->irq_mask); 3564 + I915_WRITE(VLV_IIR, 0xffffffff); 3561 3565 I915_WRITE(VLV_IER, enable_mask); 3566 + I915_WRITE(VLV_IMR, dev_priv->irq_mask); 3567 + POSTING_READ(VLV_IMR); 3562 3568 3563 3569 gen8_gt_irq_postinstall(dev_priv); 3564 3570 ··· 3583 3585 static void valleyview_irq_uninstall(struct drm_device *dev) 3584 3586 { 3585 3587 struct drm_i915_private *dev_priv = dev->dev_private; 3586 - int pipe; 3587 3588 3588 3589 if (!dev_priv) 3589 3590 return; 3590 3591 3591 3592 I915_WRITE(VLV_MASTER_IER, 0); 3592 3593 3593 - for_each_pipe(dev_priv, pipe) 3594 - I915_WRITE(PIPESTAT(pipe), 0xffff); 3594 + gen5_gt_irq_reset(dev); 3595 3595 3596 3596 I915_WRITE(HWSTAM, 0xffffffff); 3597 - I915_WRITE(PORT_HOTPLUG_EN, 0); 3598 - I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); 3599 3597 3600 3598 /* Interrupt setup is already guaranteed to be single-threaded, this is 3601 3599 * just to make the assert_spin_locked check happy. */ ··· 3600 3606 valleyview_display_irqs_uninstall(dev_priv); 3601 3607 spin_unlock_irq(&dev_priv->irq_lock); 3602 3608 3603 - dev_priv->irq_mask = 0; 3609 + vlv_display_irq_reset(dev_priv); 3604 3610 3605 - I915_WRITE(VLV_IIR, 0xffffffff); 3606 - I915_WRITE(VLV_IMR, 0xffffffff); 3607 - I915_WRITE(VLV_IER, 0x0); 3608 - POSTING_READ(VLV_IER); 3611 + dev_priv->irq_mask = 0; 3609 3612 } 3610 3613 3611 3614 static void cherryview_irq_uninstall(struct drm_device *dev) ··· 3616 3625 I915_WRITE(GEN8_MASTER_IRQ, 0); 3617 3626 POSTING_READ(GEN8_MASTER_IRQ); 3618 3627 3619 - #define GEN8_IRQ_FINI_NDX(type, which) \ 3620 - do { \ 3621 - I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \ 3622 - I915_WRITE(GEN8_##type##_IER(which), 0); \ 3623 - I915_WRITE(GEN8_##type##_IIR(which), 0xffffffff); \ 3624 - POSTING_READ(GEN8_##type##_IIR(which)); \ 3625 - I915_WRITE(GEN8_##type##_IIR(which), 0xffffffff); \ 3626 - } while (0) 3628 + gen8_gt_irq_reset(dev_priv); 3627 3629 3628 - #define GEN8_IRQ_FINI(type) \ 3629 - do { \ 3630 - I915_WRITE(GEN8_##type##_IMR, 0xffffffff); \ 3631 - I915_WRITE(GEN8_##type##_IER, 0); \ 3632 - I915_WRITE(GEN8_##type##_IIR, 0xffffffff); \ 3633 - POSTING_READ(GEN8_##type##_IIR); \ 3634 - I915_WRITE(GEN8_##type##_IIR, 0xffffffff); \ 3635 - } while (0) 3636 - 3637 - GEN8_IRQ_FINI_NDX(GT, 0); 3638 - GEN8_IRQ_FINI_NDX(GT, 1); 3639 - GEN8_IRQ_FINI_NDX(GT, 2); 3640 - GEN8_IRQ_FINI_NDX(GT, 3); 3641 - 3642 - GEN8_IRQ_FINI(PCU); 3643 - 3644 - #undef GEN8_IRQ_FINI 3645 - #undef GEN8_IRQ_FINI_NDX 3630 + GEN5_IRQ_RESET(GEN8_PCU_); 3646 3631 3647 3632 I915_WRITE(PORT_HOTPLUG_EN, 0); 3648 3633 I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); ··· 3626 3659 for_each_pipe(dev_priv, pipe) 3627 3660 I915_WRITE(PIPESTAT(pipe), 0xffff); 3628 3661 3629 - I915_WRITE(VLV_IMR, 0xffffffff); 3630 - I915_WRITE(VLV_IER, 0x0); 3631 - I915_WRITE(VLV_IIR, 0xffffffff); 3632 - POSTING_READ(VLV_IIR); 3662 + GEN5_IRQ_RESET(VLV_); 3633 3663 } 3634 3664 3635 3665 static void ironlake_irq_uninstall(struct drm_device *dev)
+204 -91
drivers/gpu/drm/i915/i915_reg.h
··· 4102 4102 #define I965_CURSOR_MAX_WM 32 4103 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 4140 /* define the Watermark register on Ironlake */ 4106 4141 #define WM0_PIPEA_ILK 0x45100 4107 4142 #define WM0_PIPE_PLANE_MASK (0xffff<<16) ··· 4307 4272 #define DISPPLANE_NO_LINE_DOUBLE 0 4308 4273 #define DISPPLANE_STEREO_POLARITY_FIRST 0 4309 4274 #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) 4310 - #define DISPPLANE_ROTATE_180 (1<<15) 4275 + #define DISPPLANE_ALPHA_PREMULTIPLY (1<<16) /* CHV pipe B */ 4276 + #define DISPPLANE_ROTATE_180 (1<<15) 4311 4277 #define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14) /* Ironlake */ 4312 4278 #define DISPPLANE_TILED (1<<10) 4279 + #define DISPPLANE_MIRROR (1<<8) /* CHV pipe B */ 4313 4280 #define _DSPAADDR 0x70184 4314 4281 #define _DSPASTRIDE 0x70188 4315 4282 #define _DSPAPOS 0x7018C /* reserved */ ··· 4331 4294 #define DSPLINOFF(plane) DSPADDR(plane) 4332 4295 #define DSPOFFSET(plane) _PIPE2(plane, _DSPAOFFSET) 4333 4296 #define DSPSURFLIVE(plane) _PIPE2(plane, _DSPASURFLIVE) 4297 + 4298 + /* CHV pipe B blender and primary plane */ 4299 + #define _CHV_BLEND_A 0x60a00 4300 + #define CHV_BLEND_LEGACY (0<<30) 4301 + #define CHV_BLEND_ANDROID (1<<30) 4302 + #define CHV_BLEND_MPO (2<<30) 4303 + #define CHV_BLEND_MASK (3<<30) 4304 + #define _CHV_CANVAS_A 0x60a04 4305 + #define _PRIMPOS_A 0x60a08 4306 + #define _PRIMSIZE_A 0x60a0c 4307 + #define _PRIMCNSTALPHA_A 0x60a10 4308 + #define PRIM_CONST_ALPHA_ENABLE (1<<31) 4309 + 4310 + #define CHV_BLEND(pipe) _TRANSCODER2(pipe, _CHV_BLEND_A) 4311 + #define CHV_CANVAS(pipe) _TRANSCODER2(pipe, _CHV_CANVAS_A) 4312 + #define PRIMPOS(plane) _TRANSCODER2(plane, _PRIMPOS_A) 4313 + #define PRIMSIZE(plane) _TRANSCODER2(plane, _PRIMSIZE_A) 4314 + #define PRIMCNSTALPHA(plane) _TRANSCODER2(plane, _PRIMCNSTALPHA_A) 4334 4315 4335 4316 /* Display/Sprite base address macros */ 4336 4317 #define DISP_BASEADDR_MASK (0xfffff000) ··· 4551 4496 #define SP_FORMAT_RGBA1010102 (9<<26) 4552 4497 #define SP_FORMAT_RGBX8888 (0xe<<26) 4553 4498 #define SP_FORMAT_RGBA8888 (0xf<<26) 4499 + #define SP_ALPHA_PREMULTIPLY (1<<23) /* CHV pipe B */ 4554 4500 #define SP_SOURCE_KEY (1<<22) 4555 4501 #define SP_YUV_BYTE_ORDER_MASK (3<<16) 4556 4502 #define SP_YUV_ORDER_YUYV (0<<16) ··· 4560 4504 #define SP_YUV_ORDER_VYUY (3<<16) 4561 4505 #define SP_ROTATE_180 (1<<15) 4562 4506 #define SP_TILED (1<<10) 4507 + #define SP_MIRROR (1<<8) /* CHV pipe B */ 4563 4508 #define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184) 4564 4509 #define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188) 4565 4510 #define _SPAPOS (VLV_DISPLAY_BASE + 0x7218c) ··· 4571 4514 #define _SPAKEYMAXVAL (VLV_DISPLAY_BASE + 0x721a0) 4572 4515 #define _SPATILEOFF (VLV_DISPLAY_BASE + 0x721a4) 4573 4516 #define _SPACONSTALPHA (VLV_DISPLAY_BASE + 0x721a8) 4517 + #define SP_CONST_ALPHA_ENABLE (1<<31) 4574 4518 #define _SPAGAMC (VLV_DISPLAY_BASE + 0x721f4) 4575 4519 4576 4520 #define _SPBCNTR (VLV_DISPLAY_BASE + 0x72280) ··· 4599 4541 #define SPTILEOFF(pipe, plane) _PIPE(pipe * 2 + plane, _SPATILEOFF, _SPBTILEOFF) 4600 4542 #define SPCONSTALPHA(pipe, plane) _PIPE(pipe * 2 + plane, _SPACONSTALPHA, _SPBCONSTALPHA) 4601 4543 #define SPGAMC(pipe, plane) _PIPE(pipe * 2 + plane, _SPAGAMC, _SPBGAMC) 4544 + 4545 + /* 4546 + * CHV pipe B sprite CSC 4547 + * 4548 + * |cr| |c0 c1 c2| |cr + cr_ioff| |cr_ooff| 4549 + * |yg| = |c3 c4 c5| x |yg + yg_ioff| + |yg_ooff| 4550 + * |cb| |c6 c7 c8| |cb + cr_ioff| |cb_ooff| 4551 + */ 4552 + #define SPCSCYGOFF(sprite) (VLV_DISPLAY_BASE + 0x6d900 + (sprite) * 0x1000) 4553 + #define SPCSCCBOFF(sprite) (VLV_DISPLAY_BASE + 0x6d904 + (sprite) * 0x1000) 4554 + #define SPCSCCROFF(sprite) (VLV_DISPLAY_BASE + 0x6d908 + (sprite) * 0x1000) 4555 + #define SPCSC_OOFF(x) (((x) & 0x7ff) << 16) /* s11 */ 4556 + #define SPCSC_IOFF(x) (((x) & 0x7ff) << 0) /* s11 */ 4557 + 4558 + #define SPCSCC01(sprite) (VLV_DISPLAY_BASE + 0x6d90c + (sprite) * 0x1000) 4559 + #define SPCSCC23(sprite) (VLV_DISPLAY_BASE + 0x6d910 + (sprite) * 0x1000) 4560 + #define SPCSCC45(sprite) (VLV_DISPLAY_BASE + 0x6d914 + (sprite) * 0x1000) 4561 + #define SPCSCC67(sprite) (VLV_DISPLAY_BASE + 0x6d918 + (sprite) * 0x1000) 4562 + #define SPCSCC8(sprite) (VLV_DISPLAY_BASE + 0x6d91c + (sprite) * 0x1000) 4563 + #define SPCSC_C1(x) (((x) & 0x7fff) << 16) /* s3.12 */ 4564 + #define SPCSC_C0(x) (((x) & 0x7fff) << 0) /* s3.12 */ 4565 + 4566 + #define SPCSCYGICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d920 + (sprite) * 0x1000) 4567 + #define SPCSCCBICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d924 + (sprite) * 0x1000) 4568 + #define SPCSCCRICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d928 + (sprite) * 0x1000) 4569 + #define SPCSC_IMAX(x) (((x) & 0x7ff) << 16) /* s11 */ 4570 + #define SPCSC_IMIN(x) (((x) & 0x7ff) << 0) /* s11 */ 4571 + 4572 + #define SPCSCYGOCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d92c + (sprite) * 0x1000) 4573 + #define SPCSCCBOCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d930 + (sprite) * 0x1000) 4574 + #define SPCSCCROCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d934 + (sprite) * 0x1000) 4575 + #define SPCSC_OMAX(x) ((x) << 16) /* u10 */ 4576 + #define SPCSC_OMIN(x) ((x) << 0) /* u10 */ 4602 4577 4603 4578 /* Skylake plane registers */ 4604 4579 ··· 4696 4605 #define _PLANE_KEYMSK_2_A 0x70298 4697 4606 #define _PLANE_KEYMAX_1_A 0x701a0 4698 4607 #define _PLANE_KEYMAX_2_A 0x702a0 4608 + #define _PLANE_BUF_CFG_1_A 0x7027c 4609 + #define _PLANE_BUF_CFG_2_A 0x7037c 4699 4610 4700 4611 #define _PLANE_CTL_1_B 0x71180 4701 4612 #define _PLANE_CTL_2_B 0x71280 ··· 4774 4681 #define _PLANE_KEYMAX_2(pipe) _PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B) 4775 4682 #define PLANE_KEYMAX(pipe, plane) \ 4776 4683 _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) 4684 + 4685 + #define _PLANE_BUF_CFG_1_B 0x7127c 4686 + #define _PLANE_BUF_CFG_2_B 0x7137c 4687 + #define _PLANE_BUF_CFG_1(pipe) \ 4688 + _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B) 4689 + #define _PLANE_BUF_CFG_2(pipe) \ 4690 + _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B) 4691 + #define PLANE_BUF_CFG(pipe, plane) \ 4692 + _PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe)) 4693 + 4694 + /* SKL new cursor registers */ 4695 + #define _CUR_BUF_CFG_A 0x7017c 4696 + #define _CUR_BUF_CFG_B 0x7117c 4697 + #define CUR_BUF_CFG(pipe) _PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B) 4777 4698 4778 4699 /* VBIOS regs */ 4779 4700 #define VGACNTRL 0x71400 ··· 5833 5726 #define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5) 5834 5727 #define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7) 5835 5728 #define FORCEWAKE_MT 0xa188 /* multi-threaded */ 5729 + #define FORCEWAKE_MEDIA_GEN9 0xa270 5730 + #define FORCEWAKE_RENDER_GEN9 0xa278 5731 + #define FORCEWAKE_BLITTER_GEN9 0xa188 5732 + #define FORCEWAKE_ACK_MEDIA_GEN9 0x0D88 5733 + #define FORCEWAKE_ACK_RENDER_GEN9 0x0D84 5734 + #define FORCEWAKE_ACK_BLITTER_GEN9 0x130044 5836 5735 #define FORCEWAKE_KERNEL 0x1 5837 5736 #define FORCEWAKE_USER 0x2 5838 5737 #define FORCEWAKE_MT_ACK 0x130040 ··· 6014 5901 #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8 6015 5902 #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 6016 5903 5904 + #define GEN9_PCODE_DATA1 0x13812C 5905 + #define GEN9_PCODE_READ_MEM_LATENCY 0x6 5906 + #define GEN9_MEM_LATENCY_LEVEL_MASK 0xFF 5907 + #define GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT 8 5908 + #define GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT 16 5909 + #define GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT 24 5910 + 6017 5911 #define GEN6_GT_CORE_STATUS 0x138060 6018 5912 #define GEN6_CORE_CPD_STATE_MASK (7<<4) 6019 5913 #define GEN6_RCn_MASK 7 ··· 6075 5955 #define GEN8_CENTROID_PIXEL_OPT_DIS (1<<8) 6076 5956 #define GEN8_SAMPLER_POWER_BYPASS_DIS (1<<1) 6077 5957 5958 + /* Audio */ 6078 5959 #define G4X_AUD_VID_DID (dev_priv->info.display_mmio_offset + 0x62020) 6079 - #define INTEL_AUDIO_DEVCL 0x808629FB 6080 - #define INTEL_AUDIO_DEVBLC 0x80862801 6081 - #define INTEL_AUDIO_DEVCTG 0x80862802 5960 + #define INTEL_AUDIO_DEVCL 0x808629FB 5961 + #define INTEL_AUDIO_DEVBLC 0x80862801 5962 + #define INTEL_AUDIO_DEVCTG 0x80862802 6082 5963 6083 5964 #define G4X_AUD_CNTL_ST 0x620B4 6084 - #define G4X_ELDV_DEVCL_DEVBLC (1 << 13) 6085 - #define G4X_ELDV_DEVCTG (1 << 14) 6086 - #define G4X_ELD_ADDR (0xf << 5) 6087 - #define G4X_ELD_ACK (1 << 4) 5965 + #define G4X_ELDV_DEVCL_DEVBLC (1 << 13) 5966 + #define G4X_ELDV_DEVCTG (1 << 14) 5967 + #define G4X_ELD_ADDR_MASK (0xf << 5) 5968 + #define G4X_ELD_ACK (1 << 4) 6088 5969 #define G4X_HDMIW_HDMIEDID 0x6210C 6089 5970 6090 - #define IBX_HDMIW_HDMIEDID_A 0xE2050 6091 - #define IBX_HDMIW_HDMIEDID_B 0xE2150 5971 + #define _IBX_HDMIW_HDMIEDID_A 0xE2050 5972 + #define _IBX_HDMIW_HDMIEDID_B 0xE2150 6092 5973 #define IBX_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ 6093 - IBX_HDMIW_HDMIEDID_A, \ 6094 - IBX_HDMIW_HDMIEDID_B) 6095 - #define IBX_AUD_CNTL_ST_A 0xE20B4 6096 - #define IBX_AUD_CNTL_ST_B 0xE21B4 5974 + _IBX_HDMIW_HDMIEDID_A, \ 5975 + _IBX_HDMIW_HDMIEDID_B) 5976 + #define _IBX_AUD_CNTL_ST_A 0xE20B4 5977 + #define _IBX_AUD_CNTL_ST_B 0xE21B4 6097 5978 #define IBX_AUD_CNTL_ST(pipe) _PIPE(pipe, \ 6098 - IBX_AUD_CNTL_ST_A, \ 6099 - IBX_AUD_CNTL_ST_B) 6100 - #define IBX_ELD_BUFFER_SIZE (0x1f << 10) 6101 - #define IBX_ELD_ADDRESS (0x1f << 5) 6102 - #define IBX_ELD_ACK (1 << 4) 5979 + _IBX_AUD_CNTL_ST_A, \ 5980 + _IBX_AUD_CNTL_ST_B) 5981 + #define IBX_ELD_BUFFER_SIZE_MASK (0x1f << 10) 5982 + #define IBX_ELD_ADDRESS_MASK (0x1f << 5) 5983 + #define IBX_ELD_ACK (1 << 4) 6103 5984 #define IBX_AUD_CNTL_ST2 0xE20C0 6104 - #define IBX_ELD_VALIDB (1 << 0) 6105 - #define IBX_CP_READYB (1 << 1) 5985 + #define IBX_CP_READY(port) ((1 << 1) << (((port) - 1) * 4)) 5986 + #define IBX_ELD_VALID(port) ((1 << 0) << (((port) - 1) * 4)) 6106 5987 6107 - #define CPT_HDMIW_HDMIEDID_A 0xE5050 6108 - #define CPT_HDMIW_HDMIEDID_B 0xE5150 5988 + #define _CPT_HDMIW_HDMIEDID_A 0xE5050 5989 + #define _CPT_HDMIW_HDMIEDID_B 0xE5150 6109 5990 #define CPT_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ 6110 - CPT_HDMIW_HDMIEDID_A, \ 6111 - CPT_HDMIW_HDMIEDID_B) 6112 - #define CPT_AUD_CNTL_ST_A 0xE50B4 6113 - #define CPT_AUD_CNTL_ST_B 0xE51B4 5991 + _CPT_HDMIW_HDMIEDID_A, \ 5992 + _CPT_HDMIW_HDMIEDID_B) 5993 + #define _CPT_AUD_CNTL_ST_A 0xE50B4 5994 + #define _CPT_AUD_CNTL_ST_B 0xE51B4 6114 5995 #define CPT_AUD_CNTL_ST(pipe) _PIPE(pipe, \ 6115 - CPT_AUD_CNTL_ST_A, \ 6116 - CPT_AUD_CNTL_ST_B) 5996 + _CPT_AUD_CNTL_ST_A, \ 5997 + _CPT_AUD_CNTL_ST_B) 6117 5998 #define CPT_AUD_CNTRL_ST2 0xE50C0 6118 5999 6119 - #define VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050) 6120 - #define VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150) 6000 + #define _VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050) 6001 + #define _VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150) 6121 6002 #define VLV_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \ 6122 - VLV_HDMIW_HDMIEDID_A, \ 6123 - VLV_HDMIW_HDMIEDID_B) 6124 - #define VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4) 6125 - #define VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4) 6003 + _VLV_HDMIW_HDMIEDID_A, \ 6004 + _VLV_HDMIW_HDMIEDID_B) 6005 + #define _VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4) 6006 + #define _VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4) 6126 6007 #define VLV_AUD_CNTL_ST(pipe) _PIPE(pipe, \ 6127 - VLV_AUD_CNTL_ST_A, \ 6128 - VLV_AUD_CNTL_ST_B) 6008 + _VLV_AUD_CNTL_ST_A, \ 6009 + _VLV_AUD_CNTL_ST_B) 6129 6010 #define VLV_AUD_CNTL_ST2 (VLV_DISPLAY_BASE + 0x620C0) 6130 6011 6131 6012 /* These are the 4 32-bit write offset registers for each stream ··· 6135 6014 */ 6136 6015 #define GEN7_SO_WRITE_OFFSET(n) (0x5280 + (n) * 4) 6137 6016 6138 - #define IBX_AUD_CONFIG_A 0xe2000 6139 - #define IBX_AUD_CONFIG_B 0xe2100 6017 + #define _IBX_AUD_CONFIG_A 0xe2000 6018 + #define _IBX_AUD_CONFIG_B 0xe2100 6140 6019 #define IBX_AUD_CFG(pipe) _PIPE(pipe, \ 6141 - IBX_AUD_CONFIG_A, \ 6142 - IBX_AUD_CONFIG_B) 6143 - #define CPT_AUD_CONFIG_A 0xe5000 6144 - #define CPT_AUD_CONFIG_B 0xe5100 6020 + _IBX_AUD_CONFIG_A, \ 6021 + _IBX_AUD_CONFIG_B) 6022 + #define _CPT_AUD_CONFIG_A 0xe5000 6023 + #define _CPT_AUD_CONFIG_B 0xe5100 6145 6024 #define CPT_AUD_CFG(pipe) _PIPE(pipe, \ 6146 - CPT_AUD_CONFIG_A, \ 6147 - CPT_AUD_CONFIG_B) 6148 - #define VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000) 6149 - #define VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100) 6025 + _CPT_AUD_CONFIG_A, \ 6026 + _CPT_AUD_CONFIG_B) 6027 + #define _VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000) 6028 + #define _VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100) 6150 6029 #define VLV_AUD_CFG(pipe) _PIPE(pipe, \ 6151 - VLV_AUD_CONFIG_A, \ 6152 - VLV_AUD_CONFIG_B) 6030 + _VLV_AUD_CONFIG_A, \ 6031 + _VLV_AUD_CONFIG_B) 6153 6032 6154 6033 #define AUD_CONFIG_N_VALUE_INDEX (1 << 29) 6155 6034 #define AUD_CONFIG_N_PROG_ENABLE (1 << 28) 6156 6035 #define AUD_CONFIG_UPPER_N_SHIFT 20 6157 - #define AUD_CONFIG_UPPER_N_VALUE (0xff << 20) 6036 + #define AUD_CONFIG_UPPER_N_MASK (0xff << 20) 6158 6037 #define AUD_CONFIG_LOWER_N_SHIFT 4 6159 - #define AUD_CONFIG_LOWER_N_VALUE (0xfff << 4) 6038 + #define AUD_CONFIG_LOWER_N_MASK (0xfff << 4) 6160 6039 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT 16 6161 6040 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK (0xf << 16) 6162 6041 #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 (0 << 16) ··· 6172 6051 #define AUD_CONFIG_DISABLE_NCTS (1 << 3) 6173 6052 6174 6053 /* HSW Audio */ 6175 - #define HSW_AUD_CONFIG_A 0x65000 /* Audio Configuration Transcoder A */ 6176 - #define HSW_AUD_CONFIG_B 0x65100 /* Audio Configuration Transcoder B */ 6177 - #define HSW_AUD_CFG(pipe) _PIPE(pipe, \ 6178 - HSW_AUD_CONFIG_A, \ 6179 - HSW_AUD_CONFIG_B) 6054 + #define _HSW_AUD_CONFIG_A 0x65000 6055 + #define _HSW_AUD_CONFIG_B 0x65100 6056 + #define HSW_AUD_CFG(pipe) _PIPE(pipe, \ 6057 + _HSW_AUD_CONFIG_A, \ 6058 + _HSW_AUD_CONFIG_B) 6180 6059 6181 - #define HSW_AUD_MISC_CTRL_A 0x65010 /* Audio Misc Control Convert 1 */ 6182 - #define HSW_AUD_MISC_CTRL_B 0x65110 /* Audio Misc Control Convert 2 */ 6183 - #define HSW_AUD_MISC_CTRL(pipe) _PIPE(pipe, \ 6184 - HSW_AUD_MISC_CTRL_A, \ 6185 - HSW_AUD_MISC_CTRL_B) 6060 + #define _HSW_AUD_MISC_CTRL_A 0x65010 6061 + #define _HSW_AUD_MISC_CTRL_B 0x65110 6062 + #define HSW_AUD_MISC_CTRL(pipe) _PIPE(pipe, \ 6063 + _HSW_AUD_MISC_CTRL_A, \ 6064 + _HSW_AUD_MISC_CTRL_B) 6186 6065 6187 - #define HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4 /* Audio DIP and ELD Control State Transcoder A */ 6188 - #define HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4 /* Audio DIP and ELD Control State Transcoder B */ 6189 - #define HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \ 6190 - HSW_AUD_DIP_ELD_CTRL_ST_A, \ 6191 - HSW_AUD_DIP_ELD_CTRL_ST_B) 6066 + #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4 6067 + #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4 6068 + #define HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \ 6069 + _HSW_AUD_DIP_ELD_CTRL_ST_A, \ 6070 + _HSW_AUD_DIP_ELD_CTRL_ST_B) 6192 6071 6193 6072 /* Audio Digital Converter */ 6194 - #define HSW_AUD_DIG_CNVT_1 0x65080 /* Audio Converter 1 */ 6195 - #define HSW_AUD_DIG_CNVT_2 0x65180 /* Audio Converter 1 */ 6196 - #define AUD_DIG_CNVT(pipe) _PIPE(pipe, \ 6197 - HSW_AUD_DIG_CNVT_1, \ 6198 - HSW_AUD_DIG_CNVT_2) 6199 - #define DIP_PORT_SEL_MASK 0x3 6073 + #define _HSW_AUD_DIG_CNVT_1 0x65080 6074 + #define _HSW_AUD_DIG_CNVT_2 0x65180 6075 + #define AUD_DIG_CNVT(pipe) _PIPE(pipe, \ 6076 + _HSW_AUD_DIG_CNVT_1, \ 6077 + _HSW_AUD_DIG_CNVT_2) 6078 + #define DIP_PORT_SEL_MASK 0x3 6200 6079 6201 - #define HSW_AUD_EDID_DATA_A 0x65050 6202 - #define HSW_AUD_EDID_DATA_B 0x65150 6203 - #define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \ 6204 - HSW_AUD_EDID_DATA_A, \ 6205 - HSW_AUD_EDID_DATA_B) 6080 + #define _HSW_AUD_EDID_DATA_A 0x65050 6081 + #define _HSW_AUD_EDID_DATA_B 0x65150 6082 + #define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \ 6083 + _HSW_AUD_EDID_DATA_A, \ 6084 + _HSW_AUD_EDID_DATA_B) 6206 6085 6207 - #define HSW_AUD_PIPE_CONV_CFG 0x6507c /* Audio pipe and converter configs */ 6208 - #define HSW_AUD_PIN_ELD_CP_VLD 0x650c0 /* Audio ELD and CP Ready Status */ 6209 - #define AUDIO_INACTIVE_C (1<<11) 6210 - #define AUDIO_INACTIVE_B (1<<7) 6211 - #define AUDIO_INACTIVE_A (1<<3) 6212 - #define AUDIO_OUTPUT_ENABLE_A (1<<2) 6213 - #define AUDIO_OUTPUT_ENABLE_B (1<<6) 6214 - #define AUDIO_OUTPUT_ENABLE_C (1<<10) 6215 - #define AUDIO_ELD_VALID_A (1<<0) 6216 - #define AUDIO_ELD_VALID_B (1<<4) 6217 - #define AUDIO_ELD_VALID_C (1<<8) 6218 - #define AUDIO_CP_READY_A (1<<1) 6219 - #define AUDIO_CP_READY_B (1<<5) 6220 - #define AUDIO_CP_READY_C (1<<9) 6086 + #define HSW_AUD_PIPE_CONV_CFG 0x6507c 6087 + #define HSW_AUD_PIN_ELD_CP_VLD 0x650c0 6088 + #define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4)) 6089 + #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4)) 6090 + #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4)) 6091 + #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4)) 6221 6092 6222 6093 /* HSW Power Wells */ 6223 6094 #define HSW_PWR_WELL_BIOS 0x45400 /* CTL1 */
+462
drivers/gpu/drm/i915/intel_audio.c
··· 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 + }
+30 -31
drivers/gpu/drm/i915/intel_ddi.c
··· 459 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 483 #define LC_FREQ 2700 463 484 #define LC_FREQ_2K U64_C(LC_FREQ * 2000) 464 485 ··· 813 792 WRPLL_DIVIDER_REFERENCE(r2) | WRPLL_DIVIDER_FEEDBACK(n2) | 814 793 WRPLL_DIVIDER_POST(p); 815 794 816 - intel_crtc->config.dpll_hw_state.wrpll = val; 795 + intel_crtc->new_config->dpll_hw_state.wrpll = val; 817 796 818 797 pll = intel_get_shared_dpll(intel_crtc); 819 798 if (pll == NULL) { ··· 822 801 return false; 823 802 } 824 803 825 - intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL(pll->id); 804 + intel_crtc->new_config->ddi_pll_sel = PORT_CLK_SEL_WRPLL(pll->id); 826 805 } 827 806 828 807 return true; ··· 838 817 */ 839 818 bool intel_ddi_pll_select(struct intel_crtc *intel_crtc) 840 819 { 841 - struct drm_crtc *crtc = &intel_crtc->base; 842 - struct intel_encoder *intel_encoder = intel_ddi_get_crtc_encoder(crtc); 843 - int clock = intel_crtc->config.port_clock; 844 - 845 - intel_put_shared_dpll(intel_crtc); 820 + struct intel_encoder *intel_encoder = 821 + intel_ddi_get_crtc_new_encoder(intel_crtc); 822 + int clock = intel_crtc->new_config->port_clock; 846 823 847 824 return hsw_ddi_pll_select(intel_crtc, intel_encoder, clock); 848 825 } ··· 1139 1120 enum port port = intel_ddi_get_encoder_port(intel_encoder); 1140 1121 int type = intel_encoder->type; 1141 1122 1142 - if (crtc->config.has_audio) { 1143 - DRM_DEBUG_DRIVER("Audio on pipe %c on DDI\n", 1144 - pipe_name(crtc->pipe)); 1145 - 1146 - /* write eld */ 1147 - DRM_DEBUG_DRIVER("DDI audio: write eld information\n"); 1148 - intel_write_eld(encoder, &crtc->config.adjusted_mode); 1149 - } 1150 - 1151 1123 if (type == INTEL_OUTPUT_EDP) { 1152 1124 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 1153 1125 intel_edp_panel_on(intel_dp); ··· 1205 1195 struct drm_encoder *encoder = &intel_encoder->base; 1206 1196 struct drm_crtc *crtc = encoder->crtc; 1207 1197 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1208 - int pipe = intel_crtc->pipe; 1209 1198 struct drm_device *dev = encoder->dev; 1210 1199 struct drm_i915_private *dev_priv = dev->dev_private; 1211 1200 enum port port = intel_ddi_get_encoder_port(intel_encoder); 1212 1201 int type = intel_encoder->type; 1213 - uint32_t tmp; 1214 1202 1215 1203 if (type == INTEL_OUTPUT_HDMI) { 1216 1204 struct intel_digital_port *intel_dig_port = ··· 1233 1225 1234 1226 if (intel_crtc->config.has_audio) { 1235 1227 intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); 1236 - tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); 1237 - tmp |= ((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4)); 1238 - I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); 1228 + intel_audio_codec_enable(intel_encoder); 1239 1229 } 1240 1230 } 1241 1231 ··· 1242 1236 struct drm_encoder *encoder = &intel_encoder->base; 1243 1237 struct drm_crtc *crtc = encoder->crtc; 1244 1238 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1245 - int pipe = intel_crtc->pipe; 1246 1239 int type = intel_encoder->type; 1247 1240 struct drm_device *dev = encoder->dev; 1248 1241 struct drm_i915_private *dev_priv = dev->dev_private; 1249 - uint32_t tmp; 1250 1242 1251 - /* We can't touch HSW_AUD_PIN_ELD_CP_VLD uncionditionally because this 1252 - * register is part of the power well on Haswell. */ 1253 1243 if (intel_crtc->config.has_audio) { 1254 - tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); 1255 - tmp &= ~((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << 1256 - (pipe * 4)); 1257 - I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); 1244 + intel_audio_codec_disable(intel_encoder); 1258 1245 intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); 1259 1246 } 1260 1247 ··· 1310 1311 static void hsw_ddi_pll_enable(struct drm_i915_private *dev_priv, 1311 1312 struct intel_shared_dpll *pll) 1312 1313 { 1313 - I915_WRITE(WRPLL_CTL(pll->id), pll->hw_state.wrpll); 1314 + I915_WRITE(WRPLL_CTL(pll->id), pll->config.hw_state.wrpll); 1314 1315 POSTING_READ(WRPLL_CTL(pll->id)); 1315 1316 udelay(20); 1316 1317 } ··· 1523 1524 1524 1525 if (intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_AUDIO)) { 1525 1526 temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); 1526 - if (temp & (AUDIO_OUTPUT_ENABLE_A << (intel_crtc->pipe * 4))) 1527 + if (temp & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe)) 1527 1528 pipe_config->has_audio = true; 1528 1529 } 1529 1530
+512 -649
drivers/gpu/drm/i915/intel_display.c
··· 94 94 static void ironlake_set_pipeconf(struct drm_crtc *crtc); 95 95 static void haswell_set_pipeconf(struct drm_crtc *crtc); 96 96 static void intel_set_pipe_csc(struct drm_crtc *crtc); 97 - static void vlv_prepare_pll(struct intel_crtc *crtc); 98 - static void chv_prepare_pll(struct intel_crtc *crtc); 97 + static void vlv_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 102 static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe) 101 103 { ··· 408 406 /** 409 407 * Returns whether any output on the specified pipe is of the specified type 410 408 */ 411 - static bool intel_pipe_has_type(struct intel_crtc *crtc, int type) 409 + bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type) 412 410 { 413 411 struct drm_device *dev = crtc->base.dev; 414 412 struct intel_encoder *encoder; ··· 420 418 return false; 421 419 } 422 420 421 + /** 422 + * Returns whether any output on the specified pipe will have the specified 423 + * type after a staged modeset is complete, i.e., the same as 424 + * intel_pipe_has_type() but looking at encoder->new_crtc instead of 425 + * encoder->crtc. 426 + */ 427 + static bool intel_pipe_will_have_type(struct intel_crtc *crtc, int type) 428 + { 429 + struct drm_device *dev = crtc->base.dev; 430 + struct intel_encoder *encoder; 431 + 432 + for_each_intel_encoder(dev, encoder) 433 + if (encoder->new_crtc == crtc && encoder->type == type) 434 + return true; 435 + 436 + return false; 437 + } 438 + 423 439 static const intel_limit_t *intel_ironlake_limit(struct intel_crtc *crtc, 424 440 int refclk) 425 441 { 426 442 struct drm_device *dev = crtc->base.dev; 427 443 const intel_limit_t *limit; 428 444 429 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 445 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { 430 446 if (intel_is_dual_link_lvds(dev)) { 431 447 if (refclk == 100000) 432 448 limit = &intel_limits_ironlake_dual_lvds_100m; ··· 467 447 struct drm_device *dev = crtc->base.dev; 468 448 const intel_limit_t *limit; 469 449 470 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 450 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { 471 451 if (intel_is_dual_link_lvds(dev)) 472 452 limit = &intel_limits_g4x_dual_channel_lvds; 473 453 else 474 454 limit = &intel_limits_g4x_single_channel_lvds; 475 - } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI) || 476 - intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) { 455 + } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_HDMI) || 456 + intel_pipe_will_have_type(crtc, INTEL_OUTPUT_ANALOG)) { 477 457 limit = &intel_limits_g4x_hdmi; 478 - } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO)) { 458 + } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_SDVO)) { 479 459 limit = &intel_limits_g4x_sdvo; 480 460 } else /* The option is for other outputs */ 481 461 limit = &intel_limits_i9xx_sdvo; ··· 493 473 else if (IS_G4X(dev)) { 494 474 limit = intel_g4x_limit(crtc); 495 475 } else if (IS_PINEVIEW(dev)) { 496 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) 476 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) 497 477 limit = &intel_limits_pineview_lvds; 498 478 else 499 479 limit = &intel_limits_pineview_sdvo; ··· 502 482 } else if (IS_VALLEYVIEW(dev)) { 503 483 limit = &intel_limits_vlv; 504 484 } else if (!IS_GEN2(dev)) { 505 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) 485 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) 506 486 limit = &intel_limits_i9xx_lvds; 507 487 else 508 488 limit = &intel_limits_i9xx_sdvo; 509 489 } else { 510 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) 490 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) 511 491 limit = &intel_limits_i8xx_lvds; 512 - else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DVO)) 492 + else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DVO)) 513 493 limit = &intel_limits_i8xx_dvo; 514 494 else 515 495 limit = &intel_limits_i8xx_dac; ··· 604 584 intel_clock_t clock; 605 585 int err = target; 606 586 607 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 587 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { 608 588 /* 609 589 * For LVDS just rely on its current settings for dual-channel. 610 590 * We haven't figured out how to reliably set up different ··· 665 645 intel_clock_t clock; 666 646 int err = target; 667 647 668 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 648 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { 669 649 /* 670 650 * For LVDS just rely on its current settings for dual-channel. 671 651 * We haven't figured out how to reliably set up different ··· 728 708 int err_most = (target >> 8) + (target >> 9); 729 709 found = false; 730 710 731 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 711 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { 732 712 if (intel_is_dual_link_lvds(dev)) 733 713 clock.p2 = limit->p2.p2_fast; 734 714 else ··· 1504 1484 } 1505 1485 } 1506 1486 1507 - static void vlv_enable_pll(struct intel_crtc *crtc) 1487 + static void vlv_enable_pll(struct intel_crtc *crtc, 1488 + const struct intel_crtc_config *pipe_config) 1508 1489 { 1509 1490 struct drm_device *dev = crtc->base.dev; 1510 1491 struct drm_i915_private *dev_priv = dev->dev_private; 1511 1492 int reg = DPLL(crtc->pipe); 1512 - u32 dpll = crtc->config.dpll_hw_state.dpll; 1493 + u32 dpll = pipe_config->dpll_hw_state.dpll; 1513 1494 1514 1495 assert_pipe_disabled(dev_priv, crtc->pipe); 1515 1496 ··· 1528 1507 if (wait_for(((I915_READ(reg) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1)) 1529 1508 DRM_ERROR("DPLL %d failed to lock\n", crtc->pipe); 1530 1509 1531 - I915_WRITE(DPLL_MD(crtc->pipe), crtc->config.dpll_hw_state.dpll_md); 1510 + I915_WRITE(DPLL_MD(crtc->pipe), pipe_config->dpll_hw_state.dpll_md); 1532 1511 POSTING_READ(DPLL_MD(crtc->pipe)); 1533 1512 1534 1513 /* We do this three times for luck */ ··· 1543 1522 udelay(150); /* wait for warmup */ 1544 1523 } 1545 1524 1546 - static void chv_enable_pll(struct intel_crtc *crtc) 1525 + static void chv_enable_pll(struct intel_crtc *crtc, 1526 + const struct intel_crtc_config *pipe_config) 1547 1527 { 1548 1528 struct drm_device *dev = crtc->base.dev; 1549 1529 struct drm_i915_private *dev_priv = dev->dev_private; ··· 1569 1547 udelay(1); 1570 1548 1571 1549 /* Enable PLL */ 1572 - I915_WRITE(DPLL(pipe), crtc->config.dpll_hw_state.dpll); 1550 + I915_WRITE(DPLL(pipe), pipe_config->dpll_hw_state.dpll); 1573 1551 1574 1552 /* Check PLL is locked */ 1575 1553 if (wait_for(((I915_READ(DPLL(pipe)) & DPLL_LOCK_VLV) == DPLL_LOCK_VLV), 1)) 1576 1554 DRM_ERROR("PLL %d failed to lock\n", pipe); 1577 1555 1578 1556 /* not sure when this should be written */ 1579 - I915_WRITE(DPLL_MD(pipe), crtc->config.dpll_hw_state.dpll_md); 1557 + I915_WRITE(DPLL_MD(pipe), pipe_config->dpll_hw_state.dpll_md); 1580 1558 POSTING_READ(DPLL_MD(pipe)); 1581 1559 1582 1560 mutex_unlock(&dev_priv->dpio_lock); ··· 1779 1757 if (WARN_ON(pll == NULL)) 1780 1758 return; 1781 1759 1782 - WARN_ON(!pll->refcount); 1760 + WARN_ON(!pll->config.crtc_mask); 1783 1761 if (pll->active == 0) { 1784 1762 DRM_DEBUG_DRIVER("setting up %s\n", pll->name); 1785 1763 WARN_ON(pll->on); ··· 1806 1784 if (WARN_ON(pll == NULL)) 1807 1785 return; 1808 1786 1809 - if (WARN_ON(pll->refcount == 0)) 1787 + if (WARN_ON(pll->config.crtc_mask == 0)) 1810 1788 return; 1811 1789 1812 1790 DRM_DEBUG_KMS("enable %s (active %d, on? %d) for crtc %d\n", ··· 1838 1816 if (WARN_ON(pll == NULL)) 1839 1817 return; 1840 1818 1841 - if (WARN_ON(pll->refcount == 0)) 1819 + if (WARN_ON(pll->config.crtc_mask == 0)) 1842 1820 return; 1843 1821 1844 1822 DRM_DEBUG_KMS("disable %s (active %d, on? %d) for crtc %d\n", ··· 2194 2172 } 2195 2173 2196 2174 int 2197 - intel_pin_and_fence_fb_obj(struct drm_device *dev, 2198 - struct drm_i915_gem_object *obj, 2175 + intel_pin_and_fence_fb_obj(struct drm_plane *plane, 2176 + struct drm_framebuffer *fb, 2199 2177 struct intel_engine_cs *pipelined) 2200 2178 { 2179 + struct drm_device *dev = fb->dev; 2201 2180 struct drm_i915_private *dev_priv = dev->dev_private; 2181 + struct drm_i915_gem_object *obj = intel_fb_obj(fb); 2202 2182 u32 alignment; 2203 2183 int ret; 2204 2184 ··· 2471 2447 ((intel_crtc->config.pipe_src_h - 1) << 16) | 2472 2448 (intel_crtc->config.pipe_src_w - 1)); 2473 2449 I915_WRITE(DSPPOS(plane), 0); 2450 + } else if (IS_CHERRYVIEW(dev) && plane == PLANE_B) { 2451 + I915_WRITE(PRIMSIZE(plane), 2452 + ((intel_crtc->config.pipe_src_h - 1) << 16) | 2453 + (intel_crtc->config.pipe_src_w - 1)); 2454 + I915_WRITE(PRIMPOS(plane), 0); 2455 + I915_WRITE(PRIMCNSTALPHA(plane), 0); 2474 2456 } 2475 2457 2476 2458 switch (fb->pixel_format) { ··· 2899 2869 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 2900 2870 enum pipe pipe = intel_crtc->pipe; 2901 2871 struct drm_framebuffer *old_fb = crtc->primary->fb; 2902 - struct drm_i915_gem_object *obj = intel_fb_obj(fb); 2903 2872 struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb); 2904 2873 int ret; 2905 2874 ··· 2921 2892 } 2922 2893 2923 2894 mutex_lock(&dev->struct_mutex); 2924 - ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); 2895 + ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, NULL); 2925 2896 if (ret == 0) 2926 - i915_gem_track_fb(old_obj, obj, 2897 + i915_gem_track_fb(old_obj, intel_fb_obj(fb), 2927 2898 INTEL_FRONTBUFFER_PRIMARY(pipe)); 2928 2899 mutex_unlock(&dev->struct_mutex); 2929 2900 if (ret != 0) { ··· 3787 3758 intel_fdi_normal_train(crtc); 3788 3759 3789 3760 /* For PCH DP, enable TRANS_DP_CTL */ 3790 - if (HAS_PCH_CPT(dev) && 3791 - (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) || 3792 - intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_EDP))) { 3761 + if (HAS_PCH_CPT(dev) && intel_crtc->config.has_dp_encoder) { 3793 3762 u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5; 3794 3763 reg = TRANS_DP_CTL(pipe); 3795 3764 temp = I915_READ(reg); ··· 3847 3820 if (pll == NULL) 3848 3821 return; 3849 3822 3850 - if (pll->refcount == 0) { 3851 - WARN(1, "bad %s refcount\n", pll->name); 3823 + if (!(pll->config.crtc_mask & (1 << crtc->pipe))) { 3824 + WARN(1, "bad %s crtc mask\n", pll->name); 3852 3825 return; 3853 3826 } 3854 3827 3855 - if (--pll->refcount == 0) { 3828 + pll->config.crtc_mask &= ~(1 << crtc->pipe); 3829 + if (pll->config.crtc_mask == 0) { 3856 3830 WARN_ON(pll->on); 3857 3831 WARN_ON(pll->active); 3858 3832 } ··· 3864 3836 struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc) 3865 3837 { 3866 3838 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; 3867 - struct intel_shared_dpll *pll = intel_crtc_to_shared_dpll(crtc); 3839 + struct intel_shared_dpll *pll; 3868 3840 enum intel_dpll_id i; 3869 - 3870 - if (pll) { 3871 - DRM_DEBUG_KMS("CRTC:%d dropping existing %s\n", 3872 - crtc->base.base.id, pll->name); 3873 - intel_put_shared_dpll(crtc); 3874 - } 3875 3841 3876 3842 if (HAS_PCH_IBX(dev_priv->dev)) { 3877 3843 /* Ironlake PCH has a fixed PLL->PCH pipe mapping. */ ··· 3875 3853 DRM_DEBUG_KMS("CRTC:%d using pre-allocated %s\n", 3876 3854 crtc->base.base.id, pll->name); 3877 3855 3878 - WARN_ON(pll->refcount); 3856 + WARN_ON(pll->new_config->crtc_mask); 3879 3857 3880 3858 goto found; 3881 3859 } ··· 3884 3862 pll = &dev_priv->shared_dplls[i]; 3885 3863 3886 3864 /* Only want to check enabled timings first */ 3887 - if (pll->refcount == 0) 3865 + if (pll->new_config->crtc_mask == 0) 3888 3866 continue; 3889 3867 3890 - if (memcmp(&crtc->config.dpll_hw_state, &pll->hw_state, 3891 - sizeof(pll->hw_state)) == 0) { 3892 - DRM_DEBUG_KMS("CRTC:%d sharing existing %s (refcount %d, ative %d)\n", 3893 - crtc->base.base.id, 3894 - pll->name, pll->refcount, pll->active); 3895 - 3868 + if (memcmp(&crtc->new_config->dpll_hw_state, 3869 + &pll->new_config->hw_state, 3870 + sizeof(pll->new_config->hw_state)) == 0) { 3871 + DRM_DEBUG_KMS("CRTC:%d sharing existing %s (crtc mask 0x%08x, ative %d)\n", 3872 + crtc->base.base.id, pll->name, 3873 + pll->new_config->crtc_mask, 3874 + pll->active); 3896 3875 goto found; 3897 3876 } 3898 3877 } ··· 3901 3878 /* Ok no matching timings, maybe there's a free one? */ 3902 3879 for (i = 0; i < dev_priv->num_shared_dpll; i++) { 3903 3880 pll = &dev_priv->shared_dplls[i]; 3904 - if (pll->refcount == 0) { 3881 + if (pll->new_config->crtc_mask == 0) { 3905 3882 DRM_DEBUG_KMS("CRTC:%d allocated %s\n", 3906 3883 crtc->base.base.id, pll->name); 3907 3884 goto found; ··· 3911 3888 return NULL; 3912 3889 3913 3890 found: 3914 - if (pll->refcount == 0) 3915 - pll->hw_state = crtc->config.dpll_hw_state; 3891 + if (pll->new_config->crtc_mask == 0) 3892 + pll->new_config->hw_state = crtc->new_config->dpll_hw_state; 3916 3893 3917 - crtc->config.shared_dpll = i; 3894 + crtc->new_config->shared_dpll = i; 3918 3895 DRM_DEBUG_DRIVER("using %s for pipe %c\n", pll->name, 3919 3896 pipe_name(crtc->pipe)); 3920 3897 3921 - pll->refcount++; 3898 + pll->new_config->crtc_mask |= 1 << crtc->pipe; 3922 3899 3923 3900 return pll; 3901 + } 3902 + 3903 + /** 3904 + * intel_shared_dpll_start_config - start a new PLL staged config 3905 + * @dev_priv: DRM device 3906 + * @clear_pipes: mask of pipes that will have their PLLs freed 3907 + * 3908 + * Starts a new PLL staged config, copying the current config but 3909 + * releasing the references of pipes specified in clear_pipes. 3910 + */ 3911 + static int intel_shared_dpll_start_config(struct drm_i915_private *dev_priv, 3912 + unsigned clear_pipes) 3913 + { 3914 + struct intel_shared_dpll *pll; 3915 + enum intel_dpll_id i; 3916 + 3917 + for (i = 0; i < dev_priv->num_shared_dpll; i++) { 3918 + pll = &dev_priv->shared_dplls[i]; 3919 + 3920 + pll->new_config = kmemdup(&pll->config, sizeof pll->config, 3921 + GFP_KERNEL); 3922 + if (!pll->new_config) 3923 + goto cleanup; 3924 + 3925 + pll->new_config->crtc_mask &= ~clear_pipes; 3926 + } 3927 + 3928 + return 0; 3929 + 3930 + cleanup: 3931 + while (--i >= 0) { 3932 + pll = &dev_priv->shared_dplls[i]; 3933 + kfree(pll->new_config); 3934 + pll->new_config = NULL; 3935 + } 3936 + 3937 + return -ENOMEM; 3938 + } 3939 + 3940 + static void intel_shared_dpll_commit(struct drm_i915_private *dev_priv) 3941 + { 3942 + struct intel_shared_dpll *pll; 3943 + enum intel_dpll_id i; 3944 + 3945 + for (i = 0; i < dev_priv->num_shared_dpll; i++) { 3946 + pll = &dev_priv->shared_dplls[i]; 3947 + 3948 + WARN_ON(pll->new_config == &pll->config); 3949 + 3950 + pll->config = *pll->new_config; 3951 + kfree(pll->new_config); 3952 + pll->new_config = NULL; 3953 + } 3954 + } 3955 + 3956 + static void intel_shared_dpll_abort_config(struct drm_i915_private *dev_priv) 3957 + { 3958 + struct intel_shared_dpll *pll; 3959 + enum intel_dpll_id i; 3960 + 3961 + for (i = 0; i < dev_priv->num_shared_dpll; i++) { 3962 + pll = &dev_priv->shared_dplls[i]; 3963 + 3964 + WARN_ON(pll->new_config == &pll->config); 3965 + 3966 + kfree(pll->new_config); 3967 + pll->new_config = NULL; 3968 + } 3924 3969 } 3925 3970 3926 3971 static void cpt_verify_modeset(struct drm_device *dev, int pipe) ··· 4684 4593 intel_display_power_get(dev_priv, domain); 4685 4594 } 4686 4595 4596 + if (dev_priv->display.modeset_global_resources) 4597 + dev_priv->display.modeset_global_resources(dev); 4598 + 4687 4599 for_each_intel_crtc(dev, crtc) { 4688 4600 enum intel_display_power_domain domain; 4689 4601 ··· 4757 4663 mutex_unlock(&dev_priv->rps.hw_lock); 4758 4664 4759 4665 if (cdclk == 400000) { 4760 - u32 divider, vco; 4666 + u32 divider; 4761 4667 4762 - vco = valleyview_get_vco(dev_priv); 4763 - divider = DIV_ROUND_CLOSEST(vco << 1, cdclk) - 1; 4668 + divider = DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1, cdclk) - 1; 4764 4669 4765 4670 mutex_lock(&dev_priv->dpio_lock); 4766 4671 /* adjust cdclk divider */ ··· 4838 4745 static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv, 4839 4746 int max_pixclk) 4840 4747 { 4841 - int vco = valleyview_get_vco(dev_priv); 4842 - int freq_320 = (vco << 1) % 320000 != 0 ? 333333 : 320000; 4748 + int freq_320 = (dev_priv->hpll_freq << 1) % 320000 != 0 ? 333333 : 320000; 4843 4749 4844 4750 /* FIXME: Punit isn't quite ready yet */ 4845 4751 if (IS_CHERRYVIEW(dev_priv->dev)) ··· 4912 4820 else 4913 4821 valleyview_set_cdclk(dev, req_cdclk); 4914 4822 } 4915 - 4916 - modeset_update_crtc_power_domains(dev); 4917 4823 } 4918 4824 4919 4825 static void valleyview_crtc_enable(struct drm_crtc *crtc) ··· 4932 4842 4933 4843 if (!is_dsi) { 4934 4844 if (IS_CHERRYVIEW(dev)) 4935 - chv_prepare_pll(intel_crtc); 4845 + chv_prepare_pll(intel_crtc, &intel_crtc->config); 4936 4846 else 4937 - vlv_prepare_pll(intel_crtc); 4847 + vlv_prepare_pll(intel_crtc, &intel_crtc->config); 4938 4848 } 4939 4849 4940 4850 if (intel_crtc->config.has_dp_encoder) 4941 4851 intel_dp_set_m_n(intel_crtc); 4942 4852 4943 4853 intel_set_pipe_timings(intel_crtc); 4854 + 4855 + if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) { 4856 + struct drm_i915_private *dev_priv = dev->dev_private; 4857 + 4858 + I915_WRITE(CHV_BLEND(pipe), CHV_BLEND_LEGACY); 4859 + I915_WRITE(CHV_CANVAS(pipe), 0); 4860 + } 4944 4861 4945 4862 i9xx_set_pipeconf(intel_crtc); 4946 4863 ··· 4961 4864 4962 4865 if (!is_dsi) { 4963 4866 if (IS_CHERRYVIEW(dev)) 4964 - chv_enable_pll(intel_crtc); 4867 + chv_enable_pll(intel_crtc, &intel_crtc->config); 4965 4868 else 4966 - vlv_enable_pll(intel_crtc); 4869 + vlv_enable_pll(intel_crtc, &intel_crtc->config); 4967 4870 } 4968 4871 4969 4872 for_each_encoder_on_crtc(dev, crtc, encoder) ··· 5481 5384 struct intel_crtc_config *pipe_config) 5482 5385 { 5483 5386 struct drm_device *dev = crtc->base.dev; 5387 + struct drm_i915_private *dev_priv = dev->dev_private; 5484 5388 struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; 5485 5389 5486 5390 /* FIXME should check pixel clock limits on all platforms */ 5487 5391 if (INTEL_INFO(dev)->gen < 4) { 5488 - struct drm_i915_private *dev_priv = dev->dev_private; 5489 5392 int clock_limit = 5490 5393 dev_priv->display.get_display_clock_speed(dev); 5491 5394 ··· 5534 5437 if (HAS_IPS(dev)) 5535 5438 hsw_compute_ips_config(crtc, pipe_config); 5536 5439 5537 - /* 5538 - * XXX: PCH/WRPLL clock sharing is done in ->mode_set, so make sure the 5539 - * old clock survives for now. 5540 - */ 5541 - if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev) || HAS_DDI(dev)) 5542 - pipe_config->shared_dpll = crtc->config.shared_dpll; 5543 - 5544 5440 if (pipe_config->has_pch_encoder) 5545 5441 return ironlake_fdi_compute_config(crtc, pipe_config); 5546 5442 ··· 5543 5453 static int valleyview_get_display_clock_speed(struct drm_device *dev) 5544 5454 { 5545 5455 struct drm_i915_private *dev_priv = dev->dev_private; 5546 - int vco = valleyview_get_vco(dev_priv); 5547 5456 u32 val; 5548 5457 int divider; 5549 5458 5550 5459 /* FIXME: Punit isn't quite ready yet */ 5551 5460 if (IS_CHERRYVIEW(dev)) 5552 5461 return 400000; 5462 + 5463 + if (dev_priv->hpll_freq == 0) 5464 + dev_priv->hpll_freq = valleyview_get_vco(dev_priv); 5553 5465 5554 5466 mutex_lock(&dev_priv->dpio_lock); 5555 5467 val = vlv_cck_read(dev_priv, CCK_DISPLAY_CLOCK_CONTROL); ··· 5563 5471 (divider << DISPLAY_FREQUENCY_STATUS_SHIFT), 5564 5472 "cdclk change in progress\n"); 5565 5473 5566 - return DIV_ROUND_CLOSEST(vco << 1, divider + 1); 5474 + return DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1, divider + 1); 5567 5475 } 5568 5476 5569 5477 static int i945_get_display_clock_speed(struct drm_device *dev) ··· 5703 5611 5704 5612 if (IS_VALLEYVIEW(dev)) { 5705 5613 refclk = 100000; 5706 - } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && 5614 + } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && 5707 5615 intel_panel_use_ssc(dev_priv) && num_connectors < 2) { 5708 5616 refclk = dev_priv->vbt.lvds_ssc_freq; 5709 5617 DRM_DEBUG_KMS("using SSC reference clock of %d kHz\n", refclk); ··· 5733 5641 u32 fp, fp2 = 0; 5734 5642 5735 5643 if (IS_PINEVIEW(dev)) { 5736 - fp = pnv_dpll_compute_fp(&crtc->config.dpll); 5644 + fp = pnv_dpll_compute_fp(&crtc->new_config->dpll); 5737 5645 if (reduced_clock) 5738 5646 fp2 = pnv_dpll_compute_fp(reduced_clock); 5739 5647 } else { 5740 - fp = i9xx_dpll_compute_fp(&crtc->config.dpll); 5648 + fp = i9xx_dpll_compute_fp(&crtc->new_config->dpll); 5741 5649 if (reduced_clock) 5742 5650 fp2 = i9xx_dpll_compute_fp(reduced_clock); 5743 5651 } 5744 5652 5745 - crtc->config.dpll_hw_state.fp0 = fp; 5653 + crtc->new_config->dpll_hw_state.fp0 = fp; 5746 5654 5747 5655 crtc->lowfreq_avail = false; 5748 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && 5656 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && 5749 5657 reduced_clock && i915.powersave) { 5750 - crtc->config.dpll_hw_state.fp1 = fp2; 5658 + crtc->new_config->dpll_hw_state.fp1 = fp2; 5751 5659 crtc->lowfreq_avail = true; 5752 5660 } else { 5753 - crtc->config.dpll_hw_state.fp1 = fp; 5661 + crtc->new_config->dpll_hw_state.fp1 = fp; 5754 5662 } 5755 5663 } 5756 5664 ··· 5839 5747 &crtc->config.dp_m2_n2); 5840 5748 } 5841 5749 5842 - static void vlv_update_pll(struct intel_crtc *crtc) 5750 + static void vlv_update_pll(struct intel_crtc *crtc, 5751 + struct intel_crtc_config *pipe_config) 5843 5752 { 5844 5753 u32 dpll, dpll_md; 5845 5754 ··· 5855 5762 if (crtc->pipe == PIPE_B) 5856 5763 dpll |= DPLL_INTEGRATED_CRI_CLK_VLV; 5857 5764 dpll |= DPLL_VCO_ENABLE; 5858 - crtc->config.dpll_hw_state.dpll = dpll; 5765 + pipe_config->dpll_hw_state.dpll = dpll; 5859 5766 5860 - dpll_md = (crtc->config.pixel_multiplier - 1) 5767 + dpll_md = (pipe_config->pixel_multiplier - 1) 5861 5768 << DPLL_MD_UDI_MULTIPLIER_SHIFT; 5862 - crtc->config.dpll_hw_state.dpll_md = dpll_md; 5769 + pipe_config->dpll_hw_state.dpll_md = dpll_md; 5863 5770 } 5864 5771 5865 - static void vlv_prepare_pll(struct intel_crtc *crtc) 5772 + static void vlv_prepare_pll(struct intel_crtc *crtc, 5773 + const struct intel_crtc_config *pipe_config) 5866 5774 { 5867 5775 struct drm_device *dev = crtc->base.dev; 5868 5776 struct drm_i915_private *dev_priv = dev->dev_private; ··· 5874 5780 5875 5781 mutex_lock(&dev_priv->dpio_lock); 5876 5782 5877 - bestn = crtc->config.dpll.n; 5878 - bestm1 = crtc->config.dpll.m1; 5879 - bestm2 = crtc->config.dpll.m2; 5880 - bestp1 = crtc->config.dpll.p1; 5881 - bestp2 = crtc->config.dpll.p2; 5783 + bestn = pipe_config->dpll.n; 5784 + bestm1 = pipe_config->dpll.m1; 5785 + bestm2 = pipe_config->dpll.m2; 5786 + bestp1 = pipe_config->dpll.p1; 5787 + bestp2 = pipe_config->dpll.p2; 5882 5788 5883 5789 /* See eDP HDMI DPIO driver vbios notes doc */ 5884 5790 ··· 5915 5821 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW3(pipe), mdiv); 5916 5822 5917 5823 /* Set HBR and RBR LPF coefficients */ 5918 - if (crtc->config.port_clock == 162000 || 5824 + if (pipe_config->port_clock == 162000 || 5919 5825 intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG) || 5920 5826 intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) 5921 5827 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), ··· 5924 5830 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe), 5925 5831 0x00d0000f); 5926 5832 5927 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP) || 5928 - intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) { 5833 + if (crtc->config.has_dp_encoder) { 5929 5834 /* Use SSC source */ 5930 5835 if (pipe == PIPE_A) 5931 5836 vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe), ··· 5953 5860 mutex_unlock(&dev_priv->dpio_lock); 5954 5861 } 5955 5862 5956 - static void chv_update_pll(struct intel_crtc *crtc) 5863 + static void chv_update_pll(struct intel_crtc *crtc, 5864 + struct intel_crtc_config *pipe_config) 5957 5865 { 5958 - crtc->config.dpll_hw_state.dpll = DPLL_SSC_REF_CLOCK_CHV | 5866 + pipe_config->dpll_hw_state.dpll = DPLL_SSC_REF_CLOCK_CHV | 5959 5867 DPLL_REFA_CLK_ENABLE_VLV | DPLL_VGA_MODE_DIS | 5960 5868 DPLL_VCO_ENABLE; 5961 5869 if (crtc->pipe != PIPE_A) 5962 - crtc->config.dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV; 5870 + pipe_config->dpll_hw_state.dpll |= DPLL_INTEGRATED_CRI_CLK_VLV; 5963 5871 5964 - crtc->config.dpll_hw_state.dpll_md = 5965 - (crtc->config.pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT; 5872 + pipe_config->dpll_hw_state.dpll_md = 5873 + (pipe_config->pixel_multiplier - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT; 5966 5874 } 5967 5875 5968 - static void chv_prepare_pll(struct intel_crtc *crtc) 5876 + static void chv_prepare_pll(struct intel_crtc *crtc, 5877 + const struct intel_crtc_config *pipe_config) 5969 5878 { 5970 5879 struct drm_device *dev = crtc->base.dev; 5971 5880 struct drm_i915_private *dev_priv = dev->dev_private; ··· 5978 5883 u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac; 5979 5884 int refclk; 5980 5885 5981 - bestn = crtc->config.dpll.n; 5982 - bestm2_frac = crtc->config.dpll.m2 & 0x3fffff; 5983 - bestm1 = crtc->config.dpll.m1; 5984 - bestm2 = crtc->config.dpll.m2 >> 22; 5985 - bestp1 = crtc->config.dpll.p1; 5986 - bestp2 = crtc->config.dpll.p2; 5886 + bestn = pipe_config->dpll.n; 5887 + bestm2_frac = pipe_config->dpll.m2 & 0x3fffff; 5888 + bestm1 = pipe_config->dpll.m1; 5889 + bestm2 = pipe_config->dpll.m2 >> 22; 5890 + bestp1 = pipe_config->dpll.p1; 5891 + bestp2 = pipe_config->dpll.p2; 5987 5892 5988 5893 /* 5989 5894 * Enable Refclk and SSC 5990 5895 */ 5991 5896 I915_WRITE(dpll_reg, 5992 - crtc->config.dpll_hw_state.dpll & ~DPLL_VCO_ENABLE); 5897 + pipe_config->dpll_hw_state.dpll & ~DPLL_VCO_ENABLE); 5993 5898 5994 5899 mutex_lock(&dev_priv->dpio_lock); 5995 5900 ··· 6037 5942 mutex_unlock(&dev_priv->dpio_lock); 6038 5943 } 6039 5944 5945 + /** 5946 + * vlv_force_pll_on - forcibly enable just the PLL 5947 + * @dev_priv: i915 private structure 5948 + * @pipe: pipe PLL to enable 5949 + * @dpll: PLL configuration 5950 + * 5951 + * Enable the PLL for @pipe using the supplied @dpll config. To be used 5952 + * in cases where we need the PLL enabled even when @pipe is not going to 5953 + * be enabled. 5954 + */ 5955 + void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, 5956 + const struct dpll *dpll) 5957 + { 5958 + struct intel_crtc *crtc = 5959 + to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe)); 5960 + struct intel_crtc_config pipe_config = { 5961 + .pixel_multiplier = 1, 5962 + .dpll = *dpll, 5963 + }; 5964 + 5965 + if (IS_CHERRYVIEW(dev)) { 5966 + chv_update_pll(crtc, &pipe_config); 5967 + chv_prepare_pll(crtc, &pipe_config); 5968 + chv_enable_pll(crtc, &pipe_config); 5969 + } else { 5970 + vlv_update_pll(crtc, &pipe_config); 5971 + vlv_prepare_pll(crtc, &pipe_config); 5972 + vlv_enable_pll(crtc, &pipe_config); 5973 + } 5974 + } 5975 + 5976 + /** 5977 + * vlv_force_pll_off - forcibly disable just the PLL 5978 + * @dev_priv: i915 private structure 5979 + * @pipe: pipe PLL to disable 5980 + * 5981 + * Disable the PLL for @pipe. To be used in cases where we need 5982 + * the PLL enabled even when @pipe is not going to be enabled. 5983 + */ 5984 + void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe) 5985 + { 5986 + if (IS_CHERRYVIEW(dev)) 5987 + chv_disable_pll(to_i915(dev), pipe); 5988 + else 5989 + vlv_disable_pll(to_i915(dev), pipe); 5990 + } 5991 + 6040 5992 static void i9xx_update_pll(struct intel_crtc *crtc, 6041 5993 intel_clock_t *reduced_clock, 6042 5994 int num_connectors) ··· 6092 5950 struct drm_i915_private *dev_priv = dev->dev_private; 6093 5951 u32 dpll; 6094 5952 bool is_sdvo; 6095 - struct dpll *clock = &crtc->config.dpll; 5953 + struct dpll *clock = &crtc->new_config->dpll; 6096 5954 6097 5955 i9xx_update_pll_dividers(crtc, reduced_clock); 6098 5956 6099 - is_sdvo = intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO) || 6100 - intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI); 5957 + is_sdvo = intel_pipe_will_have_type(crtc, INTEL_OUTPUT_SDVO) || 5958 + intel_pipe_will_have_type(crtc, INTEL_OUTPUT_HDMI); 6101 5959 6102 5960 dpll = DPLL_VGA_MODE_DIS; 6103 5961 6104 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) 5962 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) 6105 5963 dpll |= DPLLB_MODE_LVDS; 6106 5964 else 6107 5965 dpll |= DPLLB_MODE_DAC_SERIAL; 6108 5966 6109 5967 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) { 6110 - dpll |= (crtc->config.pixel_multiplier - 1) 5968 + dpll |= (crtc->new_config->pixel_multiplier - 1) 6111 5969 << SDVO_MULTIPLIER_SHIFT_HIRES; 6112 5970 } 6113 5971 6114 5972 if (is_sdvo) 6115 5973 dpll |= DPLL_SDVO_HIGH_SPEED; 6116 5974 6117 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) 5975 + if (crtc->new_config->has_dp_encoder) 6118 5976 dpll |= DPLL_SDVO_HIGH_SPEED; 6119 5977 6120 5978 /* compute bitmask from p1 value */ ··· 6142 6000 if (INTEL_INFO(dev)->gen >= 4) 6143 6001 dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); 6144 6002 6145 - if (crtc->config.sdvo_tv_clock) 6003 + if (crtc->new_config->sdvo_tv_clock) 6146 6004 dpll |= PLL_REF_INPUT_TVCLKINBC; 6147 - else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && 6005 + else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && 6148 6006 intel_panel_use_ssc(dev_priv) && num_connectors < 2) 6149 6007 dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; 6150 6008 else 6151 6009 dpll |= PLL_REF_INPUT_DREFCLK; 6152 6010 6153 6011 dpll |= DPLL_VCO_ENABLE; 6154 - crtc->config.dpll_hw_state.dpll = dpll; 6012 + crtc->new_config->dpll_hw_state.dpll = dpll; 6155 6013 6156 6014 if (INTEL_INFO(dev)->gen >= 4) { 6157 - u32 dpll_md = (crtc->config.pixel_multiplier - 1) 6015 + u32 dpll_md = (crtc->new_config->pixel_multiplier - 1) 6158 6016 << DPLL_MD_UDI_MULTIPLIER_SHIFT; 6159 - crtc->config.dpll_hw_state.dpll_md = dpll_md; 6017 + crtc->new_config->dpll_hw_state.dpll_md = dpll_md; 6160 6018 } 6161 6019 } 6162 6020 ··· 6167 6025 struct drm_device *dev = crtc->base.dev; 6168 6026 struct drm_i915_private *dev_priv = dev->dev_private; 6169 6027 u32 dpll; 6170 - struct dpll *clock = &crtc->config.dpll; 6028 + struct dpll *clock = &crtc->new_config->dpll; 6171 6029 6172 6030 i9xx_update_pll_dividers(crtc, reduced_clock); 6173 6031 6174 6032 dpll = DPLL_VGA_MODE_DIS; 6175 6033 6176 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 6034 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { 6177 6035 dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; 6178 6036 } else { 6179 6037 if (clock->p1 == 2) ··· 6184 6042 dpll |= PLL_P2_DIVIDE_BY_4; 6185 6043 } 6186 6044 6187 - if (!IS_I830(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_DVO)) 6045 + if (!IS_I830(dev) && intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DVO)) 6188 6046 dpll |= DPLL_DVO_2X_MODE; 6189 6047 6190 - if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && 6048 + if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && 6191 6049 intel_panel_use_ssc(dev_priv) && num_connectors < 2) 6192 6050 dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; 6193 6051 else 6194 6052 dpll |= PLL_REF_INPUT_DREFCLK; 6195 6053 6196 6054 dpll |= DPLL_VCO_ENABLE; 6197 - crtc->config.dpll_hw_state.dpll = dpll; 6055 + crtc->new_config->dpll_hw_state.dpll = dpll; 6198 6056 } 6199 6057 6200 6058 static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) ··· 6390 6248 POSTING_READ(PIPECONF(intel_crtc->pipe)); 6391 6249 } 6392 6250 6393 - static int i9xx_crtc_mode_set(struct intel_crtc *crtc, 6394 - int x, int y, 6395 - struct drm_framebuffer *fb) 6251 + static int i9xx_crtc_compute_clock(struct intel_crtc *crtc) 6396 6252 { 6397 6253 struct drm_device *dev = crtc->base.dev; 6398 6254 struct drm_i915_private *dev_priv = dev->dev_private; ··· 6401 6261 struct intel_encoder *encoder; 6402 6262 const intel_limit_t *limit; 6403 6263 6404 - for_each_encoder_on_crtc(dev, &crtc->base, encoder) { 6264 + for_each_intel_encoder(dev, encoder) { 6265 + if (encoder->new_crtc != crtc) 6266 + continue; 6267 + 6405 6268 switch (encoder->type) { 6406 6269 case INTEL_OUTPUT_LVDS: 6407 6270 is_lvds = true; 6408 6271 break; 6409 6272 case INTEL_OUTPUT_DSI: 6410 6273 is_dsi = true; 6274 + break; 6275 + default: 6411 6276 break; 6412 6277 } 6413 6278 ··· 6422 6277 if (is_dsi) 6423 6278 return 0; 6424 6279 6425 - if (!crtc->config.clock_set) { 6280 + if (!crtc->new_config->clock_set) { 6426 6281 refclk = i9xx_get_refclk(crtc, num_connectors); 6427 6282 6428 6283 /* ··· 6433 6288 */ 6434 6289 limit = intel_limit(crtc, refclk); 6435 6290 ok = dev_priv->display.find_dpll(limit, crtc, 6436 - crtc->config.port_clock, 6291 + crtc->new_config->port_clock, 6437 6292 refclk, NULL, &clock); 6438 6293 if (!ok) { 6439 6294 DRM_ERROR("Couldn't find PLL settings for mode!\n"); ··· 6454 6309 &reduced_clock); 6455 6310 } 6456 6311 /* Compat-code for transition, will disappear. */ 6457 - crtc->config.dpll.n = clock.n; 6458 - crtc->config.dpll.m1 = clock.m1; 6459 - crtc->config.dpll.m2 = clock.m2; 6460 - crtc->config.dpll.p1 = clock.p1; 6461 - crtc->config.dpll.p2 = clock.p2; 6312 + crtc->new_config->dpll.n = clock.n; 6313 + crtc->new_config->dpll.m1 = clock.m1; 6314 + crtc->new_config->dpll.m2 = clock.m2; 6315 + crtc->new_config->dpll.p1 = clock.p1; 6316 + crtc->new_config->dpll.p2 = clock.p2; 6462 6317 } 6463 6318 6464 6319 if (IS_GEN2(dev)) { ··· 6466 6321 has_reduced_clock ? &reduced_clock : NULL, 6467 6322 num_connectors); 6468 6323 } else if (IS_CHERRYVIEW(dev)) { 6469 - chv_update_pll(crtc); 6324 + chv_update_pll(crtc, crtc->new_config); 6470 6325 } else if (IS_VALLEYVIEW(dev)) { 6471 - vlv_update_pll(crtc); 6326 + vlv_update_pll(crtc, crtc->new_config); 6472 6327 } else { 6473 6328 i9xx_update_pll(crtc, 6474 6329 has_reduced_clock ? &reduced_clock : NULL, ··· 6741 6596 has_panel = true; 6742 6597 if (enc_to_dig_port(&encoder->base)->port == PORT_A) 6743 6598 has_cpu_edp = true; 6599 + break; 6600 + default: 6744 6601 break; 6745 6602 } 6746 6603 } ··· 7048 6901 case INTEL_OUTPUT_ANALOG: 7049 6902 has_vga = true; 7050 6903 break; 6904 + default: 6905 + break; 7051 6906 } 7052 6907 } 7053 6908 ··· 7078 6929 int num_connectors = 0; 7079 6930 bool is_lvds = false; 7080 6931 7081 - for_each_encoder_on_crtc(dev, crtc, encoder) { 6932 + for_each_intel_encoder(dev, encoder) { 6933 + if (encoder->new_crtc != to_intel_crtc(crtc)) 6934 + continue; 6935 + 7082 6936 switch (encoder->type) { 7083 6937 case INTEL_OUTPUT_LVDS: 7084 6938 is_lvds = true; 6939 + break; 6940 + default: 7085 6941 break; 7086 6942 } 7087 6943 num_connectors++; ··· 7272 7118 const intel_limit_t *limit; 7273 7119 bool ret, is_lvds = false; 7274 7120 7275 - is_lvds = intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_LVDS); 7121 + is_lvds = intel_pipe_will_have_type(intel_crtc, INTEL_OUTPUT_LVDS); 7276 7122 7277 7123 refclk = ironlake_get_refclk(crtc); 7278 7124 ··· 7283 7129 */ 7284 7130 limit = intel_limit(intel_crtc, refclk); 7285 7131 ret = dev_priv->display.find_dpll(limit, intel_crtc, 7286 - intel_crtc->config.port_clock, 7132 + intel_crtc->new_config->port_clock, 7287 7133 refclk, NULL, clock); 7288 7134 if (!ret) 7289 7135 return false; ··· 7333 7179 int factor, num_connectors = 0; 7334 7180 bool is_lvds = false, is_sdvo = false; 7335 7181 7336 - for_each_encoder_on_crtc(dev, crtc, intel_encoder) { 7182 + for_each_intel_encoder(dev, intel_encoder) { 7183 + if (intel_encoder->new_crtc != to_intel_crtc(crtc)) 7184 + continue; 7185 + 7337 7186 switch (intel_encoder->type) { 7338 7187 case INTEL_OUTPUT_LVDS: 7339 7188 is_lvds = true; ··· 7344 7187 case INTEL_OUTPUT_SDVO: 7345 7188 case INTEL_OUTPUT_HDMI: 7346 7189 is_sdvo = true; 7190 + break; 7191 + default: 7347 7192 break; 7348 7193 } 7349 7194 ··· 7359 7200 dev_priv->vbt.lvds_ssc_freq == 100000) || 7360 7201 (HAS_PCH_IBX(dev) && intel_is_dual_link_lvds(dev))) 7361 7202 factor = 25; 7362 - } else if (intel_crtc->config.sdvo_tv_clock) 7203 + } else if (intel_crtc->new_config->sdvo_tv_clock) 7363 7204 factor = 20; 7364 7205 7365 - if (ironlake_needs_fb_cb_tune(&intel_crtc->config.dpll, factor)) 7206 + if (ironlake_needs_fb_cb_tune(&intel_crtc->new_config->dpll, factor)) 7366 7207 *fp |= FP_CB_TUNE; 7367 7208 7368 7209 if (fp2 && (reduced_clock->m < factor * reduced_clock->n)) ··· 7375 7216 else 7376 7217 dpll |= DPLLB_MODE_DAC_SERIAL; 7377 7218 7378 - dpll |= (intel_crtc->config.pixel_multiplier - 1) 7219 + dpll |= (intel_crtc->new_config->pixel_multiplier - 1) 7379 7220 << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; 7380 7221 7381 7222 if (is_sdvo) 7382 7223 dpll |= DPLL_SDVO_HIGH_SPEED; 7383 - if (intel_crtc->config.has_dp_encoder) 7224 + if (intel_crtc->new_config->has_dp_encoder) 7384 7225 dpll |= DPLL_SDVO_HIGH_SPEED; 7385 7226 7386 7227 /* compute bitmask from p1 value */ 7387 - dpll |= (1 << (intel_crtc->config.dpll.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; 7228 + dpll |= (1 << (intel_crtc->new_config->dpll.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; 7388 7229 /* also FPA1 */ 7389 - dpll |= (1 << (intel_crtc->config.dpll.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; 7230 + dpll |= (1 << (intel_crtc->new_config->dpll.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; 7390 7231 7391 - switch (intel_crtc->config.dpll.p2) { 7232 + switch (intel_crtc->new_config->dpll.p2) { 7392 7233 case 5: 7393 7234 dpll |= DPLL_DAC_SERIAL_P2_CLOCK_DIV_5; 7394 7235 break; ··· 7411 7252 return dpll | DPLL_VCO_ENABLE; 7412 7253 } 7413 7254 7414 - static int ironlake_crtc_mode_set(struct intel_crtc *crtc, 7415 - int x, int y, 7416 - struct drm_framebuffer *fb) 7255 + static int ironlake_crtc_compute_clock(struct intel_crtc *crtc) 7417 7256 { 7418 7257 struct drm_device *dev = crtc->base.dev; 7419 7258 intel_clock_t clock, reduced_clock; ··· 7427 7270 7428 7271 ok = ironlake_compute_clocks(&crtc->base, &clock, 7429 7272 &has_reduced_clock, &reduced_clock); 7430 - if (!ok && !crtc->config.clock_set) { 7273 + if (!ok && !crtc->new_config->clock_set) { 7431 7274 DRM_ERROR("Couldn't find PLL settings for mode!\n"); 7432 7275 return -EINVAL; 7433 7276 } 7434 7277 /* Compat-code for transition, will disappear. */ 7435 - if (!crtc->config.clock_set) { 7436 - crtc->config.dpll.n = clock.n; 7437 - crtc->config.dpll.m1 = clock.m1; 7438 - crtc->config.dpll.m2 = clock.m2; 7439 - crtc->config.dpll.p1 = clock.p1; 7440 - crtc->config.dpll.p2 = clock.p2; 7278 + if (!crtc->new_config->clock_set) { 7279 + crtc->new_config->dpll.n = clock.n; 7280 + crtc->new_config->dpll.m1 = clock.m1; 7281 + crtc->new_config->dpll.m2 = clock.m2; 7282 + crtc->new_config->dpll.p1 = clock.p1; 7283 + crtc->new_config->dpll.p2 = clock.p2; 7441 7284 } 7442 7285 7443 7286 /* CPU eDP is the only output that doesn't need a PCH PLL of its own. */ 7444 - if (crtc->config.has_pch_encoder) { 7445 - fp = i9xx_dpll_compute_fp(&crtc->config.dpll); 7287 + if (crtc->new_config->has_pch_encoder) { 7288 + fp = i9xx_dpll_compute_fp(&crtc->new_config->dpll); 7446 7289 if (has_reduced_clock) 7447 7290 fp2 = i9xx_dpll_compute_fp(&reduced_clock); 7448 7291 ··· 7450 7293 &fp, &reduced_clock, 7451 7294 has_reduced_clock ? &fp2 : NULL); 7452 7295 7453 - crtc->config.dpll_hw_state.dpll = dpll; 7454 - crtc->config.dpll_hw_state.fp0 = fp; 7296 + crtc->new_config->dpll_hw_state.dpll = dpll; 7297 + crtc->new_config->dpll_hw_state.fp0 = fp; 7455 7298 if (has_reduced_clock) 7456 - crtc->config.dpll_hw_state.fp1 = fp2; 7299 + crtc->new_config->dpll_hw_state.fp1 = fp2; 7457 7300 else 7458 - crtc->config.dpll_hw_state.fp1 = fp; 7301 + crtc->new_config->dpll_hw_state.fp1 = fp; 7459 7302 7460 7303 pll = intel_get_shared_dpll(crtc); 7461 7304 if (pll == NULL) { ··· 7463 7306 pipe_name(crtc->pipe)); 7464 7307 return -EINVAL; 7465 7308 } 7466 - } else 7467 - intel_put_shared_dpll(crtc); 7309 + } 7468 7310 7469 7311 if (is_lvds && has_reduced_clock && i915.powersave) 7470 7312 crtc->lowfreq_avail = true; ··· 7952 7796 intel_prepare_ddi(dev); 7953 7797 } 7954 7798 7955 - static void snb_modeset_global_resources(struct drm_device *dev) 7956 - { 7957 - modeset_update_crtc_power_domains(dev); 7958 - } 7959 - 7960 - static void haswell_modeset_global_resources(struct drm_device *dev) 7961 - { 7962 - modeset_update_crtc_power_domains(dev); 7963 - } 7964 - 7965 - static int haswell_crtc_mode_set(struct intel_crtc *crtc, 7966 - int x, int y, 7967 - struct drm_framebuffer *fb) 7799 + static int haswell_crtc_compute_clock(struct intel_crtc *crtc) 7968 7800 { 7969 7801 if (!intel_ddi_pll_select(crtc)) 7970 7802 return -EINVAL; ··· 8082 7938 } 8083 7939 8084 7940 return true; 8085 - } 8086 - 8087 - static struct { 8088 - int clock; 8089 - u32 config; 8090 - } hdmi_audio_clock[] = { 8091 - { DIV_ROUND_UP(25200 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 }, 8092 - { 25200, AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 }, /* default per bspec */ 8093 - { 27000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 }, 8094 - { 27000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 }, 8095 - { 54000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 }, 8096 - { 54000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 }, 8097 - { DIV_ROUND_UP(74250 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 }, 8098 - { 74250, AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 }, 8099 - { DIV_ROUND_UP(148500 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 }, 8100 - { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 }, 8101 - }; 8102 - 8103 - /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ 8104 - static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode) 8105 - { 8106 - int i; 8107 - 8108 - for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) { 8109 - if (mode->clock == hdmi_audio_clock[i].clock) 8110 - break; 8111 - } 8112 - 8113 - if (i == ARRAY_SIZE(hdmi_audio_clock)) { 8114 - DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock); 8115 - i = 1; 8116 - } 8117 - 8118 - DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d (0x%08x)\n", 8119 - hdmi_audio_clock[i].clock, 8120 - hdmi_audio_clock[i].config); 8121 - 8122 - return hdmi_audio_clock[i].config; 8123 - } 8124 - 8125 - static bool intel_eld_uptodate(struct drm_connector *connector, 8126 - int reg_eldv, uint32_t bits_eldv, 8127 - int reg_elda, uint32_t bits_elda, 8128 - int reg_edid) 8129 - { 8130 - struct drm_i915_private *dev_priv = connector->dev->dev_private; 8131 - uint8_t *eld = connector->eld; 8132 - uint32_t i; 8133 - 8134 - i = I915_READ(reg_eldv); 8135 - i &= bits_eldv; 8136 - 8137 - if (!eld[0]) 8138 - return !i; 8139 - 8140 - if (!i) 8141 - return false; 8142 - 8143 - i = I915_READ(reg_elda); 8144 - i &= ~bits_elda; 8145 - I915_WRITE(reg_elda, i); 8146 - 8147 - for (i = 0; i < eld[2]; i++) 8148 - if (I915_READ(reg_edid) != *((uint32_t *)eld + i)) 8149 - return false; 8150 - 8151 - return true; 8152 - } 8153 - 8154 - static void g4x_write_eld(struct drm_connector *connector, 8155 - struct drm_crtc *crtc, 8156 - struct drm_display_mode *mode) 8157 - { 8158 - struct drm_i915_private *dev_priv = connector->dev->dev_private; 8159 - uint8_t *eld = connector->eld; 8160 - uint32_t eldv; 8161 - uint32_t len; 8162 - uint32_t i; 8163 - 8164 - i = I915_READ(G4X_AUD_VID_DID); 8165 - 8166 - if (i == INTEL_AUDIO_DEVBLC || i == INTEL_AUDIO_DEVCL) 8167 - eldv = G4X_ELDV_DEVCL_DEVBLC; 8168 - else 8169 - eldv = G4X_ELDV_DEVCTG; 8170 - 8171 - if (intel_eld_uptodate(connector, 8172 - G4X_AUD_CNTL_ST, eldv, 8173 - G4X_AUD_CNTL_ST, G4X_ELD_ADDR, 8174 - G4X_HDMIW_HDMIEDID)) 8175 - return; 8176 - 8177 - i = I915_READ(G4X_AUD_CNTL_ST); 8178 - i &= ~(eldv | G4X_ELD_ADDR); 8179 - len = (i >> 9) & 0x1f; /* ELD buffer size */ 8180 - I915_WRITE(G4X_AUD_CNTL_ST, i); 8181 - 8182 - if (!eld[0]) 8183 - return; 8184 - 8185 - len = min_t(uint8_t, eld[2], len); 8186 - DRM_DEBUG_DRIVER("ELD size %d\n", len); 8187 - for (i = 0; i < len; i++) 8188 - I915_WRITE(G4X_HDMIW_HDMIEDID, *((uint32_t *)eld + i)); 8189 - 8190 - i = I915_READ(G4X_AUD_CNTL_ST); 8191 - i |= eldv; 8192 - I915_WRITE(G4X_AUD_CNTL_ST, i); 8193 - } 8194 - 8195 - static void haswell_write_eld(struct drm_connector *connector, 8196 - struct drm_crtc *crtc, 8197 - struct drm_display_mode *mode) 8198 - { 8199 - struct drm_i915_private *dev_priv = connector->dev->dev_private; 8200 - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 8201 - uint8_t *eld = connector->eld; 8202 - uint32_t eldv; 8203 - uint32_t i; 8204 - int len; 8205 - int pipe = to_intel_crtc(crtc)->pipe; 8206 - int tmp; 8207 - 8208 - int hdmiw_hdmiedid = HSW_AUD_EDID_DATA(pipe); 8209 - int aud_cntl_st = HSW_AUD_DIP_ELD_CTRL(pipe); 8210 - int aud_config = HSW_AUD_CFG(pipe); 8211 - int aud_cntrl_st2 = HSW_AUD_PIN_ELD_CP_VLD; 8212 - 8213 - /* Audio output enable */ 8214 - DRM_DEBUG_DRIVER("HDMI audio: enable codec\n"); 8215 - tmp = I915_READ(aud_cntrl_st2); 8216 - tmp |= (AUDIO_OUTPUT_ENABLE_A << (pipe * 4)); 8217 - I915_WRITE(aud_cntrl_st2, tmp); 8218 - POSTING_READ(aud_cntrl_st2); 8219 - 8220 - assert_pipe_disabled(dev_priv, to_intel_crtc(crtc)->pipe); 8221 - 8222 - /* Set ELD valid state */ 8223 - tmp = I915_READ(aud_cntrl_st2); 8224 - DRM_DEBUG_DRIVER("HDMI audio: pin eld vld status=0x%08x\n", tmp); 8225 - tmp |= (AUDIO_ELD_VALID_A << (pipe * 4)); 8226 - I915_WRITE(aud_cntrl_st2, tmp); 8227 - tmp = I915_READ(aud_cntrl_st2); 8228 - DRM_DEBUG_DRIVER("HDMI audio: eld vld status=0x%08x\n", tmp); 8229 - 8230 - /* Enable HDMI mode */ 8231 - tmp = I915_READ(aud_config); 8232 - DRM_DEBUG_DRIVER("HDMI audio: audio conf: 0x%08x\n", tmp); 8233 - /* clear N_programing_enable and N_value_index */ 8234 - tmp &= ~(AUD_CONFIG_N_VALUE_INDEX | AUD_CONFIG_N_PROG_ENABLE); 8235 - I915_WRITE(aud_config, tmp); 8236 - 8237 - DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe)); 8238 - 8239 - eldv = AUDIO_ELD_VALID_A << (pipe * 4); 8240 - 8241 - if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) { 8242 - DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n"); 8243 - eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */ 8244 - I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */ 8245 - } else { 8246 - I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode)); 8247 - } 8248 - 8249 - if (intel_eld_uptodate(connector, 8250 - aud_cntrl_st2, eldv, 8251 - aud_cntl_st, IBX_ELD_ADDRESS, 8252 - hdmiw_hdmiedid)) 8253 - return; 8254 - 8255 - i = I915_READ(aud_cntrl_st2); 8256 - i &= ~eldv; 8257 - I915_WRITE(aud_cntrl_st2, i); 8258 - 8259 - if (!eld[0]) 8260 - return; 8261 - 8262 - i = I915_READ(aud_cntl_st); 8263 - i &= ~IBX_ELD_ADDRESS; 8264 - I915_WRITE(aud_cntl_st, i); 8265 - i = (i >> 29) & DIP_PORT_SEL_MASK; /* DIP_Port_Select, 0x1 = PortB */ 8266 - DRM_DEBUG_DRIVER("port num:%d\n", i); 8267 - 8268 - len = min_t(uint8_t, eld[2], 21); /* 84 bytes of hw ELD buffer */ 8269 - DRM_DEBUG_DRIVER("ELD size %d\n", len); 8270 - for (i = 0; i < len; i++) 8271 - I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i)); 8272 - 8273 - i = I915_READ(aud_cntrl_st2); 8274 - i |= eldv; 8275 - I915_WRITE(aud_cntrl_st2, i); 8276 - 8277 - } 8278 - 8279 - static void ironlake_write_eld(struct drm_connector *connector, 8280 - struct drm_crtc *crtc, 8281 - struct drm_display_mode *mode) 8282 - { 8283 - struct drm_i915_private *dev_priv = connector->dev->dev_private; 8284 - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 8285 - uint8_t *eld = connector->eld; 8286 - uint32_t eldv; 8287 - uint32_t i; 8288 - int len; 8289 - int hdmiw_hdmiedid; 8290 - int aud_config; 8291 - int aud_cntl_st; 8292 - int aud_cntrl_st2; 8293 - int pipe = to_intel_crtc(crtc)->pipe; 8294 - 8295 - if (HAS_PCH_IBX(connector->dev)) { 8296 - hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID(pipe); 8297 - aud_config = IBX_AUD_CFG(pipe); 8298 - aud_cntl_st = IBX_AUD_CNTL_ST(pipe); 8299 - aud_cntrl_st2 = IBX_AUD_CNTL_ST2; 8300 - } else if (IS_VALLEYVIEW(connector->dev)) { 8301 - hdmiw_hdmiedid = VLV_HDMIW_HDMIEDID(pipe); 8302 - aud_config = VLV_AUD_CFG(pipe); 8303 - aud_cntl_st = VLV_AUD_CNTL_ST(pipe); 8304 - aud_cntrl_st2 = VLV_AUD_CNTL_ST2; 8305 - } else { 8306 - hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID(pipe); 8307 - aud_config = CPT_AUD_CFG(pipe); 8308 - aud_cntl_st = CPT_AUD_CNTL_ST(pipe); 8309 - aud_cntrl_st2 = CPT_AUD_CNTRL_ST2; 8310 - } 8311 - 8312 - DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe)); 8313 - 8314 - if (IS_VALLEYVIEW(connector->dev)) { 8315 - struct intel_encoder *intel_encoder; 8316 - struct intel_digital_port *intel_dig_port; 8317 - 8318 - intel_encoder = intel_attached_encoder(connector); 8319 - intel_dig_port = enc_to_dig_port(&intel_encoder->base); 8320 - i = intel_dig_port->port; 8321 - } else { 8322 - i = I915_READ(aud_cntl_st); 8323 - i = (i >> 29) & DIP_PORT_SEL_MASK; 8324 - /* DIP_Port_Select, 0x1 = PortB */ 8325 - } 8326 - 8327 - if (!i) { 8328 - DRM_DEBUG_DRIVER("Audio directed to unknown port\n"); 8329 - /* operate blindly on all ports */ 8330 - eldv = IBX_ELD_VALIDB; 8331 - eldv |= IBX_ELD_VALIDB << 4; 8332 - eldv |= IBX_ELD_VALIDB << 8; 8333 - } else { 8334 - DRM_DEBUG_DRIVER("ELD on port %c\n", port_name(i)); 8335 - eldv = IBX_ELD_VALIDB << ((i - 1) * 4); 8336 - } 8337 - 8338 - if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)) { 8339 - DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n"); 8340 - eld[5] |= (1 << 2); /* Conn_Type, 0x1 = DisplayPort */ 8341 - I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */ 8342 - } else { 8343 - I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode)); 8344 - } 8345 - 8346 - if (intel_eld_uptodate(connector, 8347 - aud_cntrl_st2, eldv, 8348 - aud_cntl_st, IBX_ELD_ADDRESS, 8349 - hdmiw_hdmiedid)) 8350 - return; 8351 - 8352 - i = I915_READ(aud_cntrl_st2); 8353 - i &= ~eldv; 8354 - I915_WRITE(aud_cntrl_st2, i); 8355 - 8356 - if (!eld[0]) 8357 - return; 8358 - 8359 - i = I915_READ(aud_cntl_st); 8360 - i &= ~IBX_ELD_ADDRESS; 8361 - I915_WRITE(aud_cntl_st, i); 8362 - 8363 - len = min_t(uint8_t, eld[2], 21); /* 84 bytes of hw ELD buffer */ 8364 - DRM_DEBUG_DRIVER("ELD size %d\n", len); 8365 - for (i = 0; i < len; i++) 8366 - I915_WRITE(hdmiw_hdmiedid, *((uint32_t *)eld + i)); 8367 - 8368 - i = I915_READ(aud_cntrl_st2); 8369 - i |= eldv; 8370 - I915_WRITE(aud_cntrl_st2, i); 8371 - } 8372 - 8373 - void intel_write_eld(struct drm_encoder *encoder, 8374 - struct drm_display_mode *mode) 8375 - { 8376 - struct drm_crtc *crtc = encoder->crtc; 8377 - struct drm_connector *connector; 8378 - struct drm_device *dev = encoder->dev; 8379 - struct drm_i915_private *dev_priv = dev->dev_private; 8380 - 8381 - connector = drm_select_eld(encoder, mode); 8382 - if (!connector) 8383 - return; 8384 - 8385 - DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", 8386 - connector->base.id, 8387 - connector->name, 8388 - connector->encoder->base.id, 8389 - connector->encoder->name); 8390 - 8391 - connector->eld[6] = drm_av_sync_delay(connector, mode) / 2; 8392 - 8393 - if (dev_priv->display.write_eld) 8394 - dev_priv->display.write_eld(connector, crtc, mode); 8395 7941 } 8396 7942 8397 7943 static void i845_update_cursor(struct drm_crtc *crtc, u32 base) ··· 8378 8544 if (old_width != width) 8379 8545 intel_update_watermarks(crtc); 8380 8546 intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); 8381 - } 8382 8547 8383 - intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_CURSOR(pipe)); 8548 + intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_CURSOR(pipe)); 8549 + } 8384 8550 8385 8551 return 0; 8386 8552 fail_unpin: ··· 9399 9565 struct intel_framebuffer *intel_fb = 9400 9566 to_intel_framebuffer(intel_crtc->base.primary->fb); 9401 9567 struct drm_i915_gem_object *obj = intel_fb->obj; 9568 + bool atomic_update; 9569 + u32 start_vbl_count; 9402 9570 u32 dspcntr; 9403 9571 u32 reg; 9404 9572 9405 9573 intel_mark_page_flip_active(intel_crtc); 9406 9574 9575 + atomic_update = intel_pipe_update_start(intel_crtc, &start_vbl_count); 9576 + 9407 9577 reg = DSPCNTR(intel_crtc->plane); 9408 9578 dspcntr = I915_READ(reg); 9409 9579 9410 - if (INTEL_INFO(dev)->gen >= 4) { 9411 - if (obj->tiling_mode != I915_TILING_NONE) 9412 - dspcntr |= DISPPLANE_TILED; 9413 - else 9414 - dspcntr &= ~DISPPLANE_TILED; 9415 - } 9580 + if (obj->tiling_mode != I915_TILING_NONE) 9581 + dspcntr |= DISPPLANE_TILED; 9582 + else 9583 + dspcntr &= ~DISPPLANE_TILED; 9584 + 9416 9585 I915_WRITE(reg, dspcntr); 9417 9586 9418 9587 I915_WRITE(DSPSURF(intel_crtc->plane), 9419 9588 intel_crtc->unpin_work->gtt_offset); 9420 9589 POSTING_READ(DSPSURF(intel_crtc->plane)); 9590 + 9591 + if (atomic_update) 9592 + intel_pipe_update_end(intel_crtc, start_vbl_count); 9421 9593 } 9422 9594 9423 - static int intel_postpone_flip(struct drm_i915_gem_object *obj) 9595 + static void intel_mmio_flip_work_func(struct work_struct *work) 9424 9596 { 9597 + struct intel_crtc *intel_crtc = 9598 + container_of(work, struct intel_crtc, mmio_flip.work); 9425 9599 struct intel_engine_cs *ring; 9426 - int ret; 9600 + uint32_t seqno; 9427 9601 9428 - lockdep_assert_held(&obj->base.dev->struct_mutex); 9602 + seqno = intel_crtc->mmio_flip.seqno; 9603 + ring = intel_crtc->mmio_flip.ring; 9429 9604 9430 - if (!obj->last_write_seqno) 9431 - return 0; 9605 + if (seqno) 9606 + WARN_ON(__i915_wait_seqno(ring, seqno, 9607 + intel_crtc->reset_counter, 9608 + false, NULL, NULL) != 0); 9432 9609 9433 - ring = obj->ring; 9434 - 9435 - if (i915_seqno_passed(ring->get_seqno(ring, true), 9436 - obj->last_write_seqno)) 9437 - return 0; 9438 - 9439 - ret = i915_gem_check_olr(ring, obj->last_write_seqno); 9440 - if (ret) 9441 - return ret; 9442 - 9443 - if (WARN_ON(!ring->irq_get(ring))) 9444 - return 0; 9445 - 9446 - return 1; 9447 - } 9448 - 9449 - void intel_notify_mmio_flip(struct intel_engine_cs *ring) 9450 - { 9451 - struct drm_i915_private *dev_priv = to_i915(ring->dev); 9452 - struct intel_crtc *intel_crtc; 9453 - unsigned long irq_flags; 9454 - u32 seqno; 9455 - 9456 - seqno = ring->get_seqno(ring, false); 9457 - 9458 - spin_lock_irqsave(&dev_priv->mmio_flip_lock, irq_flags); 9459 - for_each_intel_crtc(ring->dev, intel_crtc) { 9460 - struct intel_mmio_flip *mmio_flip; 9461 - 9462 - mmio_flip = &intel_crtc->mmio_flip; 9463 - if (mmio_flip->seqno == 0) 9464 - continue; 9465 - 9466 - if (ring->id != mmio_flip->ring_id) 9467 - continue; 9468 - 9469 - if (i915_seqno_passed(seqno, mmio_flip->seqno)) { 9470 - intel_do_mmio_flip(intel_crtc); 9471 - mmio_flip->seqno = 0; 9472 - ring->irq_put(ring); 9473 - } 9474 - } 9475 - spin_unlock_irqrestore(&dev_priv->mmio_flip_lock, irq_flags); 9610 + intel_do_mmio_flip(intel_crtc); 9476 9611 } 9477 9612 9478 9613 static int intel_queue_mmio_flip(struct drm_device *dev, ··· 9451 9648 struct intel_engine_cs *ring, 9452 9649 uint32_t flags) 9453 9650 { 9454 - struct drm_i915_private *dev_priv = dev->dev_private; 9455 9651 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 9456 - int ret; 9457 9652 9458 - if (WARN_ON(intel_crtc->mmio_flip.seqno)) 9459 - return -EBUSY; 9460 - 9461 - ret = intel_postpone_flip(obj); 9462 - if (ret < 0) 9463 - return ret; 9464 - if (ret == 0) { 9465 - intel_do_mmio_flip(intel_crtc); 9466 - return 0; 9467 - } 9468 - 9469 - spin_lock_irq(&dev_priv->mmio_flip_lock); 9470 9653 intel_crtc->mmio_flip.seqno = obj->last_write_seqno; 9471 - intel_crtc->mmio_flip.ring_id = obj->ring->id; 9472 - spin_unlock_irq(&dev_priv->mmio_flip_lock); 9654 + intel_crtc->mmio_flip.ring = obj->ring; 9473 9655 9474 - /* 9475 - * Double check to catch cases where irq fired before 9476 - * mmio flip data was ready 9477 - */ 9478 - intel_notify_mmio_flip(obj->ring); 9656 + schedule_work(&intel_crtc->mmio_flip.work); 9657 + 9479 9658 return 0; 9480 9659 } 9481 9660 ··· 9640 9855 ring = &dev_priv->ring[RCS]; 9641 9856 } 9642 9857 9643 - ret = intel_pin_and_fence_fb_obj(dev, obj, ring); 9858 + ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, ring); 9644 9859 if (ret) 9645 9860 goto cleanup_pending; 9646 9861 ··· 10182 10397 static void 10183 10398 intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes) 10184 10399 { 10400 + struct drm_i915_private *dev_priv = dev->dev_private; 10185 10401 struct intel_encoder *intel_encoder; 10186 10402 struct intel_crtc *intel_crtc; 10187 10403 struct drm_connector *connector; 10404 + 10405 + intel_shared_dpll_commit(dev_priv); 10188 10406 10189 10407 for_each_intel_encoder(dev, intel_encoder) { 10190 10408 if (!intel_encoder->base.crtc) ··· 10441 10653 return true; 10442 10654 } 10443 10655 10656 + static void check_wm_state(struct drm_device *dev) 10657 + { 10658 + struct drm_i915_private *dev_priv = dev->dev_private; 10659 + struct skl_ddb_allocation hw_ddb, *sw_ddb; 10660 + struct intel_crtc *intel_crtc; 10661 + int plane; 10662 + 10663 + if (INTEL_INFO(dev)->gen < 9) 10664 + return; 10665 + 10666 + skl_ddb_get_hw_state(dev_priv, &hw_ddb); 10667 + sw_ddb = &dev_priv->wm.skl_hw.ddb; 10668 + 10669 + for_each_intel_crtc(dev, intel_crtc) { 10670 + struct skl_ddb_entry *hw_entry, *sw_entry; 10671 + const enum pipe pipe = intel_crtc->pipe; 10672 + 10673 + if (!intel_crtc->active) 10674 + continue; 10675 + 10676 + /* planes */ 10677 + for_each_plane(pipe, plane) { 10678 + hw_entry = &hw_ddb.plane[pipe][plane]; 10679 + sw_entry = &sw_ddb->plane[pipe][plane]; 10680 + 10681 + if (skl_ddb_entry_equal(hw_entry, sw_entry)) 10682 + continue; 10683 + 10684 + DRM_ERROR("mismatch in DDB state pipe %c plane %d " 10685 + "(expected (%u,%u), found (%u,%u))\n", 10686 + pipe_name(pipe), plane + 1, 10687 + sw_entry->start, sw_entry->end, 10688 + hw_entry->start, hw_entry->end); 10689 + } 10690 + 10691 + /* cursor */ 10692 + hw_entry = &hw_ddb.cursor[pipe]; 10693 + sw_entry = &sw_ddb->cursor[pipe]; 10694 + 10695 + if (skl_ddb_entry_equal(hw_entry, sw_entry)) 10696 + continue; 10697 + 10698 + DRM_ERROR("mismatch in DDB state pipe %c cursor " 10699 + "(expected (%u,%u), found (%u,%u))\n", 10700 + pipe_name(pipe), 10701 + sw_entry->start, sw_entry->end, 10702 + hw_entry->start, hw_entry->end); 10703 + } 10704 + } 10705 + 10444 10706 static void 10445 10707 check_connector_state(struct drm_device *dev) 10446 10708 { ··· 10657 10819 10658 10820 active = pll->get_hw_state(dev_priv, pll, &dpll_hw_state); 10659 10821 10660 - WARN(pll->active > pll->refcount, 10822 + WARN(pll->active > hweight32(pll->config.crtc_mask), 10661 10823 "more active pll users than references: %i vs %i\n", 10662 - pll->active, pll->refcount); 10824 + pll->active, hweight32(pll->config.crtc_mask)); 10663 10825 WARN(pll->active && !pll->on, 10664 10826 "pll in active use but not on in sw tracking\n"); 10665 10827 WARN(pll->on && !pll->active, ··· 10677 10839 WARN(pll->active != active_crtcs, 10678 10840 "pll active crtcs mismatch (expected %i, found %i)\n", 10679 10841 pll->active, active_crtcs); 10680 - WARN(pll->refcount != enabled_crtcs, 10842 + WARN(hweight32(pll->config.crtc_mask) != enabled_crtcs, 10681 10843 "pll enabled crtcs mismatch (expected %i, found %i)\n", 10682 - pll->refcount, enabled_crtcs); 10844 + hweight32(pll->config.crtc_mask), enabled_crtcs); 10683 10845 10684 - WARN(pll->on && memcmp(&pll->hw_state, &dpll_hw_state, 10846 + WARN(pll->on && memcmp(&pll->config.hw_state, &dpll_hw_state, 10685 10847 sizeof(dpll_hw_state)), 10686 10848 "pll hw state mismatch\n"); 10687 10849 } ··· 10690 10852 void 10691 10853 intel_modeset_check_state(struct drm_device *dev) 10692 10854 { 10855 + check_wm_state(dev); 10693 10856 check_connector_state(dev); 10694 10857 check_encoder_state(dev); 10695 10858 check_crtc_state(dev); ··· 10800 10961 prepare_pipes &= ~disable_pipes; 10801 10962 } 10802 10963 10964 + if (dev_priv->display.crtc_compute_clock) { 10965 + unsigned clear_pipes = modeset_pipes | disable_pipes; 10966 + 10967 + ret = intel_shared_dpll_start_config(dev_priv, clear_pipes); 10968 + if (ret) 10969 + goto done; 10970 + 10971 + for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) { 10972 + ret = dev_priv->display.crtc_compute_clock(intel_crtc); 10973 + if (ret) { 10974 + intel_shared_dpll_abort_config(dev_priv); 10975 + goto done; 10976 + } 10977 + } 10978 + } 10979 + 10803 10980 for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc) 10804 10981 intel_crtc_disable(&intel_crtc->base); 10805 10982 ··· 10847 10992 * update the the output configuration. */ 10848 10993 intel_modeset_update_state(dev, prepare_pipes); 10849 10994 10850 - if (dev_priv->display.modeset_global_resources) 10851 - dev_priv->display.modeset_global_resources(dev); 10995 + modeset_update_crtc_power_domains(dev); 10852 10996 10853 10997 /* Set up the DPLL and any encoders state that needs to adjust or depend 10854 10998 * on the DPLL. ··· 10858 11004 struct drm_i915_gem_object *obj = intel_fb_obj(fb); 10859 11005 10860 11006 mutex_lock(&dev->struct_mutex); 10861 - ret = intel_pin_and_fence_fb_obj(dev, 10862 - obj, 10863 - NULL); 11007 + ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, NULL); 10864 11008 if (ret != 0) { 10865 11009 DRM_ERROR("pin & fence failed\n"); 10866 11010 mutex_unlock(&dev->struct_mutex); ··· 10873 11021 crtc->primary->fb = fb; 10874 11022 crtc->x = x; 10875 11023 crtc->y = y; 10876 - 10877 - ret = dev_priv->display.crtc_mode_set(intel_crtc, x, y, fb); 10878 - if (ret) 10879 - goto done; 10880 11024 } 10881 11025 10882 11026 /* Now enable the clocks, plane, pipe, and connectors that we set up. */ ··· 11366 11518 static void ibx_pch_dpll_mode_set(struct drm_i915_private *dev_priv, 11367 11519 struct intel_shared_dpll *pll) 11368 11520 { 11369 - I915_WRITE(PCH_FP0(pll->id), pll->hw_state.fp0); 11370 - I915_WRITE(PCH_FP1(pll->id), pll->hw_state.fp1); 11521 + I915_WRITE(PCH_FP0(pll->id), pll->config.hw_state.fp0); 11522 + I915_WRITE(PCH_FP1(pll->id), pll->config.hw_state.fp1); 11371 11523 } 11372 11524 11373 11525 static void ibx_pch_dpll_enable(struct drm_i915_private *dev_priv, ··· 11376 11528 /* PCH refclock must be enabled first */ 11377 11529 ibx_assert_pch_refclk_enabled(dev_priv); 11378 11530 11379 - I915_WRITE(PCH_DPLL(pll->id), pll->hw_state.dpll); 11531 + I915_WRITE(PCH_DPLL(pll->id), pll->config.hw_state.dpll); 11380 11532 11381 11533 /* Wait for the clocks to stabilize. */ 11382 11534 POSTING_READ(PCH_DPLL(pll->id)); ··· 11387 11539 * 11388 11540 * So write it again. 11389 11541 */ 11390 - I915_WRITE(PCH_DPLL(pll->id), pll->hw_state.dpll); 11542 + I915_WRITE(PCH_DPLL(pll->id), pll->config.hw_state.dpll); 11391 11543 POSTING_READ(PCH_DPLL(pll->id)); 11392 11544 udelay(200); 11393 11545 } ··· 11494 11646 struct drm_rect *dest = &state->dst; 11495 11647 struct drm_rect *src = &state->src; 11496 11648 const struct drm_rect *clip = &state->clip; 11649 + 11650 + return drm_plane_helper_check_update(plane, crtc, fb, 11651 + src, dest, clip, 11652 + DRM_PLANE_HELPER_NO_SCALING, 11653 + DRM_PLANE_HELPER_NO_SCALING, 11654 + false, true, &state->visible); 11655 + } 11656 + 11657 + static int 11658 + intel_prepare_primary_plane(struct drm_plane *plane, 11659 + struct intel_plane_state *state) 11660 + { 11661 + struct drm_crtc *crtc = state->crtc; 11662 + struct drm_framebuffer *fb = state->fb; 11663 + struct drm_device *dev = crtc->dev; 11664 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 11665 + enum pipe pipe = intel_crtc->pipe; 11666 + struct drm_i915_gem_object *obj = intel_fb_obj(fb); 11667 + struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); 11497 11668 int ret; 11498 11669 11499 - ret = drm_plane_helper_check_update(plane, crtc, fb, 11500 - src, dest, clip, 11501 - DRM_PLANE_HELPER_NO_SCALING, 11502 - DRM_PLANE_HELPER_NO_SCALING, 11503 - false, true, &state->visible); 11504 - if (ret) 11505 - return ret; 11670 + intel_crtc_wait_for_pending_flips(crtc); 11506 11671 11507 - /* no fb bound */ 11508 - if (state->visible && !fb) { 11509 - DRM_ERROR("No FB bound\n"); 11510 - return -EINVAL; 11672 + if (intel_crtc_has_pending_flip(crtc)) { 11673 + DRM_ERROR("pipe is still busy with an old pageflip\n"); 11674 + return -EBUSY; 11675 + } 11676 + 11677 + if (old_obj != obj) { 11678 + mutex_lock(&dev->struct_mutex); 11679 + ret = intel_pin_and_fence_fb_obj(plane, fb, NULL); 11680 + if (ret == 0) 11681 + i915_gem_track_fb(old_obj, obj, 11682 + INTEL_FRONTBUFFER_PRIMARY(pipe)); 11683 + mutex_unlock(&dev->struct_mutex); 11684 + if (ret != 0) { 11685 + DRM_DEBUG_KMS("pin & fence failed\n"); 11686 + return ret; 11687 + } 11511 11688 } 11512 11689 11513 11690 return 0; 11514 11691 } 11515 11692 11516 - static int 11693 + static void 11517 11694 intel_commit_primary_plane(struct drm_plane *plane, 11518 11695 struct intel_plane_state *state) 11519 11696 { ··· 11553 11680 struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); 11554 11681 struct intel_plane *intel_plane = to_intel_plane(plane); 11555 11682 struct drm_rect *src = &state->src; 11556 - int ret; 11557 - 11558 - intel_crtc_wait_for_pending_flips(crtc); 11559 - 11560 - if (intel_crtc_has_pending_flip(crtc)) { 11561 - DRM_ERROR("pipe is still busy with an old pageflip\n"); 11562 - return -EBUSY; 11563 - } 11564 - 11565 - if (plane->fb != fb) { 11566 - mutex_lock(&dev->struct_mutex); 11567 - ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); 11568 - if (ret == 0) 11569 - i915_gem_track_fb(old_obj, obj, 11570 - INTEL_FRONTBUFFER_PRIMARY(pipe)); 11571 - mutex_unlock(&dev->struct_mutex); 11572 - if (ret != 0) { 11573 - DRM_DEBUG_KMS("pin & fence failed\n"); 11574 - return ret; 11575 - } 11576 - } 11577 11683 11578 11684 crtc->primary->fb = fb; 11579 11685 crtc->x = src->x1; ··· 11630 11778 intel_unpin_fb_obj(old_obj); 11631 11779 mutex_unlock(&dev->struct_mutex); 11632 11780 } 11633 - 11634 - return 0; 11635 11781 } 11636 11782 11637 11783 static int ··· 11667 11817 state.orig_dst = state.dst; 11668 11818 11669 11819 ret = intel_check_primary_plane(plane, &state); 11820 + if (ret) 11821 + return ret; 11822 + 11823 + ret = intel_prepare_primary_plane(plane, &state); 11670 11824 if (ret) 11671 11825 return ret; 11672 11826 ··· 11815 11961 struct drm_crtc *crtc = state->crtc; 11816 11962 struct drm_framebuffer *fb = state->fb; 11817 11963 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 11964 + struct intel_plane *intel_plane = to_intel_plane(plane); 11818 11965 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 11819 11966 struct drm_i915_gem_object *obj = intel_fb->obj; 11820 11967 int crtc_w, crtc_h; 11821 11968 11822 11969 crtc->cursor_x = state->orig_dst.x1; 11823 11970 crtc->cursor_y = state->orig_dst.y1; 11971 + 11972 + intel_plane->crtc_x = state->orig_dst.x1; 11973 + intel_plane->crtc_y = state->orig_dst.y1; 11974 + intel_plane->crtc_w = drm_rect_width(&state->orig_dst); 11975 + intel_plane->crtc_h = drm_rect_height(&state->orig_dst); 11976 + intel_plane->src_x = state->orig_src.x1; 11977 + intel_plane->src_y = state->orig_src.y1; 11978 + intel_plane->src_w = drm_rect_width(&state->orig_src); 11979 + intel_plane->src_h = drm_rect_height(&state->orig_src); 11980 + intel_plane->obj = obj; 11981 + 11824 11982 if (fb != crtc->cursor->fb) { 11825 11983 crtc_w = drm_rect_width(&state->orig_dst); 11826 11984 crtc_h = drm_rect_height(&state->orig_dst); ··· 11982 12116 dev_priv->plane_to_crtc_mapping[intel_crtc->plane] != NULL); 11983 12117 dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; 11984 12118 dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; 12119 + 12120 + INIT_WORK(&intel_crtc->mmio_flip.work, intel_mmio_flip_work_func); 11985 12121 11986 12122 drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs); 11987 12123 ··· 12444 12576 if (HAS_DDI(dev)) { 12445 12577 dev_priv->display.get_pipe_config = haswell_get_pipe_config; 12446 12578 dev_priv->display.get_plane_config = ironlake_get_plane_config; 12447 - dev_priv->display.crtc_mode_set = haswell_crtc_mode_set; 12579 + dev_priv->display.crtc_compute_clock = 12580 + haswell_crtc_compute_clock; 12448 12581 dev_priv->display.crtc_enable = haswell_crtc_enable; 12449 12582 dev_priv->display.crtc_disable = haswell_crtc_disable; 12450 12583 dev_priv->display.off = ironlake_crtc_off; ··· 12458 12589 } else if (HAS_PCH_SPLIT(dev)) { 12459 12590 dev_priv->display.get_pipe_config = ironlake_get_pipe_config; 12460 12591 dev_priv->display.get_plane_config = ironlake_get_plane_config; 12461 - dev_priv->display.crtc_mode_set = ironlake_crtc_mode_set; 12592 + dev_priv->display.crtc_compute_clock = 12593 + ironlake_crtc_compute_clock; 12462 12594 dev_priv->display.crtc_enable = ironlake_crtc_enable; 12463 12595 dev_priv->display.crtc_disable = ironlake_crtc_disable; 12464 12596 dev_priv->display.off = ironlake_crtc_off; ··· 12468 12598 } else if (IS_VALLEYVIEW(dev)) { 12469 12599 dev_priv->display.get_pipe_config = i9xx_get_pipe_config; 12470 12600 dev_priv->display.get_plane_config = i9xx_get_plane_config; 12471 - dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; 12601 + dev_priv->display.crtc_compute_clock = i9xx_crtc_compute_clock; 12472 12602 dev_priv->display.crtc_enable = valleyview_crtc_enable; 12473 12603 dev_priv->display.crtc_disable = i9xx_crtc_disable; 12474 12604 dev_priv->display.off = i9xx_crtc_off; ··· 12477 12607 } else { 12478 12608 dev_priv->display.get_pipe_config = i9xx_get_pipe_config; 12479 12609 dev_priv->display.get_plane_config = i9xx_get_plane_config; 12480 - dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; 12610 + dev_priv->display.crtc_compute_clock = i9xx_crtc_compute_clock; 12481 12611 dev_priv->display.crtc_enable = i9xx_crtc_enable; 12482 12612 dev_priv->display.crtc_disable = i9xx_crtc_disable; 12483 12613 dev_priv->display.off = i9xx_crtc_off; ··· 12514 12644 dev_priv->display.get_display_clock_speed = 12515 12645 i830_get_display_clock_speed; 12516 12646 12517 - if (IS_G4X(dev)) { 12518 - dev_priv->display.write_eld = g4x_write_eld; 12519 - } else if (IS_GEN5(dev)) { 12647 + if (IS_GEN5(dev)) { 12520 12648 dev_priv->display.fdi_link_train = ironlake_fdi_link_train; 12521 - dev_priv->display.write_eld = ironlake_write_eld; 12522 12649 } else if (IS_GEN6(dev)) { 12523 12650 dev_priv->display.fdi_link_train = gen6_fdi_link_train; 12524 - dev_priv->display.write_eld = ironlake_write_eld; 12525 - dev_priv->display.modeset_global_resources = 12526 - snb_modeset_global_resources; 12527 12651 } else if (IS_IVYBRIDGE(dev)) { 12528 12652 /* FIXME: detect B0+ stepping and use auto training */ 12529 12653 dev_priv->display.fdi_link_train = ivb_manual_fdi_link_train; 12530 - dev_priv->display.write_eld = ironlake_write_eld; 12531 12654 dev_priv->display.modeset_global_resources = 12532 12655 ivb_modeset_global_resources; 12533 12656 } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { 12534 12657 dev_priv->display.fdi_link_train = hsw_fdi_link_train; 12535 - dev_priv->display.write_eld = haswell_write_eld; 12536 - dev_priv->display.modeset_global_resources = 12537 - haswell_modeset_global_resources; 12538 12658 } else if (IS_VALLEYVIEW(dev)) { 12539 12659 dev_priv->display.modeset_global_resources = 12540 12660 valleyview_modeset_global_resources; 12541 - dev_priv->display.write_eld = ironlake_write_eld; 12542 - } else if (INTEL_INFO(dev)->gen >= 9) { 12543 - dev_priv->display.write_eld = haswell_write_eld; 12544 - dev_priv->display.modeset_global_resources = 12545 - haswell_modeset_global_resources; 12546 12661 } 12547 12662 12548 12663 /* Default just returns -ENODEV to indicate unsupported */ ··· 12783 12928 return; 12784 12929 12785 12930 intel_init_display(dev); 12931 + intel_init_audio(dev); 12786 12932 12787 12933 if (IS_GEN2(dev)) { 12788 12934 dev->mode_config.max_width = 2048; ··· 13138 13282 for (i = 0; i < dev_priv->num_shared_dpll; i++) { 13139 13283 struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; 13140 13284 13141 - pll->on = pll->get_hw_state(dev_priv, pll, &pll->hw_state); 13285 + pll->on = pll->get_hw_state(dev_priv, pll, 13286 + &pll->config.hw_state); 13142 13287 pll->active = 0; 13288 + pll->config.crtc_mask = 0; 13143 13289 for_each_intel_crtc(dev, crtc) { 13144 - if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll) 13290 + if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll) { 13145 13291 pll->active++; 13292 + pll->config.crtc_mask |= 1 << crtc->pipe; 13293 + } 13146 13294 } 13147 - pll->refcount = pll->active; 13148 13295 13149 - DRM_DEBUG_KMS("%s hw state readout: refcount %i, on %i\n", 13150 - pll->name, pll->refcount, pll->on); 13296 + DRM_DEBUG_KMS("%s hw state readout: crtc_mask 0x%08x, on %i\n", 13297 + pll->name, pll->config.crtc_mask, pll->on); 13151 13298 13152 - if (pll->refcount) 13299 + if (pll->config.crtc_mask) 13153 13300 intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS); 13154 13301 } 13155 13302 ··· 13242 13383 pll->on = false; 13243 13384 } 13244 13385 13245 - if (HAS_PCH_SPLIT(dev)) 13386 + if (IS_GEN9(dev)) 13387 + skl_wm_get_hw_state(dev); 13388 + else if (HAS_PCH_SPLIT(dev)) 13246 13389 ilk_wm_get_hw_state(dev); 13247 13390 13248 13391 if (force_restore) { ··· 13292 13431 if (obj == NULL) 13293 13432 continue; 13294 13433 13295 - if (intel_pin_and_fence_fb_obj(dev, obj, NULL)) { 13434 + if (intel_pin_and_fence_fb_obj(c->primary, 13435 + c->primary->fb, 13436 + NULL)) { 13296 13437 DRM_ERROR("failed to pin boot fb on pipe %d\n", 13297 13438 to_intel_crtc(c)->pipe); 13298 13439 drm_framebuffer_unreference(c->primary->fb);
+283 -146
drivers/gpu/drm/i915/intel_dp.c
··· 113 113 static void intel_dp_link_down(struct intel_dp *intel_dp); 114 114 static bool edp_panel_vdd_on(struct intel_dp *intel_dp); 115 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 120 int 118 121 intel_dp_max_link_bw(struct intel_dp *intel_dp) ··· 286 283 287 284 static void 288 285 intel_dp_init_panel_power_sequencer(struct drm_device *dev, 289 - struct intel_dp *intel_dp, 290 - struct edp_power_seq *out); 286 + struct intel_dp *intel_dp); 291 287 static void 292 288 intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, 293 - struct intel_dp *intel_dp, 294 - struct edp_power_seq *out); 289 + struct intel_dp *intel_dp); 295 290 296 291 static void pps_lock(struct intel_dp *intel_dp) 297 292 { ··· 323 322 intel_display_power_put(dev_priv, power_domain); 324 323 } 325 324 325 + static void 326 + vlv_power_sequencer_kick(struct intel_dp *intel_dp) 327 + { 328 + struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); 329 + struct drm_device *dev = intel_dig_port->base.base.dev; 330 + struct drm_i915_private *dev_priv = dev->dev_private; 331 + enum pipe pipe = intel_dp->pps_pipe; 332 + bool pll_enabled; 333 + uint32_t DP; 334 + 335 + if (WARN(I915_READ(intel_dp->output_reg) & DP_PORT_EN, 336 + "skipping pipe %c power seqeuncer kick due to port %c being active\n", 337 + pipe_name(pipe), port_name(intel_dig_port->port))) 338 + return; 339 + 340 + DRM_DEBUG_KMS("kicking pipe %c power sequencer for port %c\n", 341 + pipe_name(pipe), port_name(intel_dig_port->port)); 342 + 343 + /* Preserve the BIOS-computed detected bit. This is 344 + * supposed to be read-only. 345 + */ 346 + DP = I915_READ(intel_dp->output_reg) & DP_DETECTED; 347 + DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; 348 + DP |= DP_PORT_WIDTH(1); 349 + DP |= DP_LINK_TRAIN_PAT_1; 350 + 351 + if (IS_CHERRYVIEW(dev)) 352 + DP |= DP_PIPE_SELECT_CHV(pipe); 353 + else if (pipe == PIPE_B) 354 + DP |= DP_PIPEB_SELECT; 355 + 356 + pll_enabled = I915_READ(DPLL(pipe)) & DPLL_VCO_ENABLE; 357 + 358 + /* 359 + * The DPLL for the pipe must be enabled for this to work. 360 + * So enable temporarily it if it's not already enabled. 361 + */ 362 + if (!pll_enabled) 363 + vlv_force_pll_on(dev, pipe, IS_CHERRYVIEW(dev) ? 364 + &chv_dpll[0].dpll : &vlv_dpll[0].dpll); 365 + 366 + /* 367 + * Similar magic as in intel_dp_enable_port(). 368 + * We _must_ do this port enable + disable trick 369 + * to make this power seqeuencer lock onto the port. 370 + * Otherwise even VDD force bit won't work. 371 + */ 372 + I915_WRITE(intel_dp->output_reg, DP); 373 + POSTING_READ(intel_dp->output_reg); 374 + 375 + I915_WRITE(intel_dp->output_reg, DP | DP_PORT_EN); 376 + POSTING_READ(intel_dp->output_reg); 377 + 378 + I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); 379 + POSTING_READ(intel_dp->output_reg); 380 + 381 + if (!pll_enabled) 382 + vlv_force_pll_off(dev, pipe); 383 + } 384 + 326 385 static enum pipe 327 386 vlv_power_sequencer_pipe(struct intel_dp *intel_dp) 328 387 { ··· 391 330 struct drm_i915_private *dev_priv = dev->dev_private; 392 331 struct intel_encoder *encoder; 393 332 unsigned int pipes = (1 << PIPE_A) | (1 << PIPE_B); 394 - struct edp_power_seq power_seq; 333 + enum pipe pipe; 395 334 396 335 lockdep_assert_held(&dev_priv->pps_mutex); 336 + 337 + /* We should never land here with regular DP ports */ 338 + WARN_ON(!is_edp(intel_dp)); 397 339 398 340 if (intel_dp->pps_pipe != INVALID_PIPE) 399 341 return intel_dp->pps_pipe; ··· 423 359 * are two power sequencers and up to two eDP ports. 424 360 */ 425 361 if (WARN_ON(pipes == 0)) 426 - return PIPE_A; 362 + pipe = PIPE_A; 363 + else 364 + pipe = ffs(pipes) - 1; 427 365 428 - intel_dp->pps_pipe = ffs(pipes) - 1; 366 + vlv_steal_power_sequencer(dev, pipe); 367 + intel_dp->pps_pipe = pipe; 429 368 430 369 DRM_DEBUG_KMS("picked pipe %c power sequencer for port %c\n", 431 370 pipe_name(intel_dp->pps_pipe), 432 371 port_name(intel_dig_port->port)); 433 372 434 373 /* init power sequencer on this pipe and port */ 435 - intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq); 436 - intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, 437 - &power_seq); 374 + intel_dp_init_panel_power_sequencer(dev, intel_dp); 375 + intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); 376 + 377 + /* 378 + * Even vdd force doesn't work until we've made 379 + * the power sequencer lock in on the port. 380 + */ 381 + vlv_power_sequencer_kick(intel_dp); 438 382 439 383 return intel_dp->pps_pipe; 440 384 } ··· 497 425 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); 498 426 struct drm_device *dev = intel_dig_port->base.base.dev; 499 427 struct drm_i915_private *dev_priv = dev->dev_private; 500 - struct edp_power_seq power_seq; 501 428 enum port port = intel_dig_port->port; 502 429 503 430 lockdep_assert_held(&dev_priv->pps_mutex); ··· 524 453 DRM_DEBUG_KMS("initial power sequencer for port %c: pipe %c\n", 525 454 port_name(port), pipe_name(intel_dp->pps_pipe)); 526 455 527 - intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq); 528 - intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, 529 - &power_seq); 456 + intel_dp_init_panel_power_sequencer(dev, intel_dp); 457 + intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); 530 458 } 531 459 532 460 void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv) ··· 620 550 621 551 lockdep_assert_held(&dev_priv->pps_mutex); 622 552 553 + if (IS_VALLEYVIEW(dev) && 554 + intel_dp->pps_pipe == INVALID_PIPE) 555 + return false; 556 + 623 557 return (I915_READ(_pp_stat_reg(intel_dp)) & PP_ON) != 0; 624 558 } 625 559 ··· 633 559 struct drm_i915_private *dev_priv = dev->dev_private; 634 560 635 561 lockdep_assert_held(&dev_priv->pps_mutex); 562 + 563 + if (IS_VALLEYVIEW(dev) && 564 + intel_dp->pps_pipe == INVALID_PIPE) 565 + return false; 636 566 637 567 return I915_READ(_pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD; 638 568 } ··· 1324 1246 intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0; 1325 1247 intel_dp->DP |= DP_PORT_WIDTH(intel_dp->lane_count); 1326 1248 1327 - if (crtc->config.has_audio) { 1328 - DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n", 1329 - pipe_name(crtc->pipe)); 1249 + if (crtc->config.has_audio) 1330 1250 intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE; 1331 - intel_write_eld(&encoder->base, adjusted_mode); 1332 - } 1333 1251 1334 1252 /* Split out the IBX/CPU vs CPT settings */ 1335 1253 ··· 1483 1409 power_domain = intel_display_port_power_domain(intel_encoder); 1484 1410 intel_display_power_get(dev_priv, power_domain); 1485 1411 1486 - DRM_DEBUG_KMS("Turning eDP VDD on\n"); 1412 + DRM_DEBUG_KMS("Turning eDP port %c VDD on\n", 1413 + port_name(intel_dig_port->port)); 1487 1414 1488 1415 if (!edp_have_panel_power(intel_dp)) 1489 1416 wait_panel_power_cycle(intel_dp); ··· 1503 1428 * If the panel wasn't on, delay before accessing aux channel 1504 1429 */ 1505 1430 if (!edp_have_panel_power(intel_dp)) { 1506 - DRM_DEBUG_KMS("eDP was not running\n"); 1431 + DRM_DEBUG_KMS("eDP port %c panel power wasn't enabled\n", 1432 + port_name(intel_dig_port->port)); 1507 1433 msleep(intel_dp->panel_power_up_delay); 1508 1434 } 1509 1435 ··· 1529 1453 vdd = edp_panel_vdd_on(intel_dp); 1530 1454 pps_unlock(intel_dp); 1531 1455 1532 - WARN(!vdd, "eDP VDD already requested on\n"); 1456 + WARN(!vdd, "eDP port %c VDD already requested on\n", 1457 + port_name(dp_to_dig_port(intel_dp)->port)); 1533 1458 } 1534 1459 1535 1460 static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) ··· 1551 1474 if (!edp_have_panel_vdd(intel_dp)) 1552 1475 return; 1553 1476 1554 - DRM_DEBUG_KMS("Turning eDP VDD off\n"); 1477 + DRM_DEBUG_KMS("Turning eDP port %c VDD off\n", 1478 + port_name(intel_dig_port->port)); 1555 1479 1556 1480 pp = ironlake_get_pp_control(intel_dp); 1557 1481 pp &= ~EDP_FORCE_VDD; ··· 1613 1535 if (!is_edp(intel_dp)) 1614 1536 return; 1615 1537 1616 - WARN(!intel_dp->want_panel_vdd, "eDP VDD not forced on"); 1538 + WARN(!intel_dp->want_panel_vdd, "eDP port %c VDD not forced on", 1539 + port_name(dp_to_dig_port(intel_dp)->port)); 1617 1540 1618 1541 intel_dp->want_panel_vdd = false; 1619 1542 ··· 1624 1545 edp_panel_vdd_schedule_off(intel_dp); 1625 1546 } 1626 1547 1627 - /* 1628 - * Must be paired with intel_edp_panel_vdd_on(). 1629 - * Nested calls to these functions are not allowed since 1630 - * we drop the lock. Caller must use some higher level 1631 - * locking to prevent nested calls from other threads. 1632 - */ 1633 - static void intel_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) 1634 - { 1635 - if (!is_edp(intel_dp)) 1636 - return; 1637 - 1638 - pps_lock(intel_dp); 1639 - edp_panel_vdd_off(intel_dp, sync); 1640 - pps_unlock(intel_dp); 1641 - } 1642 - 1643 - void intel_edp_panel_on(struct intel_dp *intel_dp) 1548 + static void edp_panel_on(struct intel_dp *intel_dp) 1644 1549 { 1645 1550 struct drm_device *dev = intel_dp_to_dev(intel_dp); 1646 1551 struct drm_i915_private *dev_priv = dev->dev_private; 1647 1552 u32 pp; 1648 1553 u32 pp_ctrl_reg; 1649 1554 1555 + lockdep_assert_held(&dev_priv->pps_mutex); 1556 + 1650 1557 if (!is_edp(intel_dp)) 1651 1558 return; 1652 1559 1653 - DRM_DEBUG_KMS("Turn eDP power on\n"); 1560 + DRM_DEBUG_KMS("Turn eDP port %c panel power on\n", 1561 + port_name(dp_to_dig_port(intel_dp)->port)); 1654 1562 1655 - pps_lock(intel_dp); 1656 - 1657 - if (edp_have_panel_power(intel_dp)) { 1658 - DRM_DEBUG_KMS("eDP power already on\n"); 1659 - goto out; 1660 - } 1563 + if (WARN(edp_have_panel_power(intel_dp), 1564 + "eDP port %c panel power already on\n", 1565 + port_name(dp_to_dig_port(intel_dp)->port))) 1566 + return; 1661 1567 1662 1568 wait_panel_power_cycle(intel_dp); 1663 1569 ··· 1670 1606 I915_WRITE(pp_ctrl_reg, pp); 1671 1607 POSTING_READ(pp_ctrl_reg); 1672 1608 } 1609 + } 1673 1610 1674 - out: 1611 + void intel_edp_panel_on(struct intel_dp *intel_dp) 1612 + { 1613 + if (!is_edp(intel_dp)) 1614 + return; 1615 + 1616 + pps_lock(intel_dp); 1617 + edp_panel_on(intel_dp); 1675 1618 pps_unlock(intel_dp); 1676 1619 } 1677 1620 1678 - void intel_edp_panel_off(struct intel_dp *intel_dp) 1621 + 1622 + static void edp_panel_off(struct intel_dp *intel_dp) 1679 1623 { 1680 1624 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); 1681 1625 struct intel_encoder *intel_encoder = &intel_dig_port->base; ··· 1693 1621 u32 pp; 1694 1622 u32 pp_ctrl_reg; 1695 1623 1624 + lockdep_assert_held(&dev_priv->pps_mutex); 1625 + 1696 1626 if (!is_edp(intel_dp)) 1697 1627 return; 1698 1628 1699 - DRM_DEBUG_KMS("Turn eDP power off\n"); 1629 + DRM_DEBUG_KMS("Turn eDP port %c panel power off\n", 1630 + port_name(dp_to_dig_port(intel_dp)->port)); 1700 1631 1701 - pps_lock(intel_dp); 1702 - 1703 - WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n"); 1632 + WARN(!intel_dp->want_panel_vdd, "Need eDP port %c VDD to turn off panel\n", 1633 + port_name(dp_to_dig_port(intel_dp)->port)); 1704 1634 1705 1635 pp = ironlake_get_pp_control(intel_dp); 1706 1636 /* We need to switch off panel power _and_ force vdd, for otherwise some ··· 1723 1649 /* We got a reference when we enabled the VDD. */ 1724 1650 power_domain = intel_display_port_power_domain(intel_encoder); 1725 1651 intel_display_power_put(dev_priv, power_domain); 1652 + } 1726 1653 1654 + void intel_edp_panel_off(struct intel_dp *intel_dp) 1655 + { 1656 + if (!is_edp(intel_dp)) 1657 + return; 1658 + 1659 + pps_lock(intel_dp); 1660 + edp_panel_off(intel_dp); 1727 1661 pps_unlock(intel_dp); 1728 1662 } 1729 1663 ··· 2450 2368 { 2451 2369 struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); 2452 2370 struct drm_device *dev = encoder->base.dev; 2371 + struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); 2372 + 2373 + if (crtc->config.has_audio) 2374 + intel_audio_codec_disable(encoder); 2453 2375 2454 2376 /* Make sure the panel is off before trying to change the mode. But also 2455 2377 * ensure that we have vdd while we switch off the panel. */ ··· 2608 2522 struct drm_device *dev = intel_dp_to_dev(intel_dp); 2609 2523 struct drm_i915_private *dev_priv = dev->dev_private; 2610 2524 2611 - intel_dp->DP |= DP_PORT_EN; 2612 - 2613 2525 /* enable with pattern 1 (as per spec) */ 2614 2526 _intel_dp_set_link_train(intel_dp, &intel_dp->DP, 2615 2527 DP_TRAINING_PATTERN_1); 2528 + 2529 + I915_WRITE(intel_dp->output_reg, intel_dp->DP); 2530 + POSTING_READ(intel_dp->output_reg); 2531 + 2532 + /* 2533 + * Magic for VLV/CHV. We _must_ first set up the register 2534 + * without actually enabling the port, and then do another 2535 + * write to enable the port. Otherwise link training will 2536 + * fail when the power sequencer is freshly used for this port. 2537 + */ 2538 + intel_dp->DP |= DP_PORT_EN; 2616 2539 2617 2540 I915_WRITE(intel_dp->output_reg, intel_dp->DP); 2618 2541 POSTING_READ(intel_dp->output_reg); ··· 2632 2537 struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); 2633 2538 struct drm_device *dev = encoder->base.dev; 2634 2539 struct drm_i915_private *dev_priv = dev->dev_private; 2540 + struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); 2635 2541 uint32_t dp_reg = I915_READ(intel_dp->output_reg); 2636 2542 2637 2543 if (WARN_ON(dp_reg & DP_PORT_EN)) 2638 2544 return; 2639 2545 2546 + pps_lock(intel_dp); 2547 + 2548 + if (IS_VALLEYVIEW(dev)) 2549 + vlv_init_panel_power_sequencer(intel_dp); 2550 + 2640 2551 intel_dp_enable_port(intel_dp); 2641 - intel_edp_panel_vdd_on(intel_dp); 2642 - intel_edp_panel_on(intel_dp); 2643 - intel_edp_panel_vdd_off(intel_dp, true); 2552 + 2553 + edp_panel_vdd_on(intel_dp); 2554 + edp_panel_on(intel_dp); 2555 + edp_panel_vdd_off(intel_dp, true); 2556 + 2557 + pps_unlock(intel_dp); 2558 + 2559 + if (IS_VALLEYVIEW(dev)) 2560 + vlv_wait_port_ready(dev_priv, dp_to_dig_port(intel_dp)); 2561 + 2644 2562 intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); 2645 2563 intel_dp_start_link_train(intel_dp); 2646 2564 intel_dp_complete_link_train(intel_dp); 2647 2565 intel_dp_stop_link_train(intel_dp); 2566 + 2567 + if (crtc->config.has_audio) { 2568 + DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n", 2569 + pipe_name(crtc->pipe)); 2570 + intel_audio_codec_enable(encoder); 2571 + } 2648 2572 } 2649 2573 2650 2574 static void g4x_enable_dp(struct intel_encoder *encoder) ··· 2695 2581 } 2696 2582 } 2697 2583 2584 + static void vlv_detach_power_sequencer(struct intel_dp *intel_dp) 2585 + { 2586 + struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); 2587 + struct drm_i915_private *dev_priv = intel_dig_port->base.base.dev->dev_private; 2588 + enum pipe pipe = intel_dp->pps_pipe; 2589 + int pp_on_reg = VLV_PIPE_PP_ON_DELAYS(pipe); 2590 + 2591 + edp_panel_vdd_off_sync(intel_dp); 2592 + 2593 + /* 2594 + * VLV seems to get confused when multiple power seqeuencers 2595 + * have the same port selected (even if only one has power/vdd 2596 + * enabled). The failure manifests as vlv_wait_port_ready() failing 2597 + * CHV on the other hand doesn't seem to mind having the same port 2598 + * selected in multiple power seqeuencers, but let's clear the 2599 + * port select always when logically disconnecting a power sequencer 2600 + * from a port. 2601 + */ 2602 + DRM_DEBUG_KMS("detaching pipe %c power sequencer from port %c\n", 2603 + pipe_name(pipe), port_name(intel_dig_port->port)); 2604 + I915_WRITE(pp_on_reg, 0); 2605 + POSTING_READ(pp_on_reg); 2606 + 2607 + intel_dp->pps_pipe = INVALID_PIPE; 2608 + } 2609 + 2698 2610 static void vlv_steal_power_sequencer(struct drm_device *dev, 2699 2611 enum pipe pipe) 2700 2612 { ··· 2728 2588 struct intel_encoder *encoder; 2729 2589 2730 2590 lockdep_assert_held(&dev_priv->pps_mutex); 2591 + 2592 + if (WARN_ON(pipe != PIPE_A && pipe != PIPE_B)) 2593 + return; 2731 2594 2732 2595 list_for_each_entry(encoder, &dev->mode_config.encoder_list, 2733 2596 base.head) { ··· 2749 2606 DRM_DEBUG_KMS("stealing pipe %c power sequencer from port %c\n", 2750 2607 pipe_name(pipe), port_name(port)); 2751 2608 2752 - /* make sure vdd is off before we steal it */ 2753 - edp_panel_vdd_off_sync(intel_dp); 2609 + WARN(encoder->connectors_active, 2610 + "stealing pipe %c power sequencer from active eDP port %c\n", 2611 + pipe_name(pipe), port_name(port)); 2754 2612 2755 - intel_dp->pps_pipe = INVALID_PIPE; 2613 + /* make sure vdd is off before we steal it */ 2614 + vlv_detach_power_sequencer(intel_dp); 2756 2615 } 2757 2616 } 2758 2617 ··· 2765 2620 struct drm_device *dev = encoder->base.dev; 2766 2621 struct drm_i915_private *dev_priv = dev->dev_private; 2767 2622 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); 2768 - struct edp_power_seq power_seq; 2769 2623 2770 2624 lockdep_assert_held(&dev_priv->pps_mutex); 2625 + 2626 + if (!is_edp(intel_dp)) 2627 + return; 2771 2628 2772 2629 if (intel_dp->pps_pipe == crtc->pipe) 2773 2630 return; ··· 2780 2633 * we still have control of it. 2781 2634 */ 2782 2635 if (intel_dp->pps_pipe != INVALID_PIPE) 2783 - edp_panel_vdd_off_sync(intel_dp); 2636 + vlv_detach_power_sequencer(intel_dp); 2784 2637 2785 2638 /* 2786 2639 * We may be stealing the power ··· 2795 2648 pipe_name(intel_dp->pps_pipe), port_name(intel_dig_port->port)); 2796 2649 2797 2650 /* init power sequencer on this pipe and port */ 2798 - intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq); 2799 - intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, 2800 - &power_seq); 2651 + intel_dp_init_panel_power_sequencer(dev, intel_dp); 2652 + intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); 2801 2653 } 2802 2654 2803 2655 static void vlv_pre_enable_dp(struct intel_encoder *encoder) ··· 2825 2679 2826 2680 mutex_unlock(&dev_priv->dpio_lock); 2827 2681 2828 - if (is_edp(intel_dp)) { 2829 - pps_lock(intel_dp); 2830 - vlv_init_panel_power_sequencer(intel_dp); 2831 - pps_unlock(intel_dp); 2832 - } 2833 - 2834 2682 intel_enable_dp(encoder); 2835 - 2836 - vlv_wait_port_ready(dev_priv, dport); 2837 2683 } 2838 2684 2839 2685 static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder) ··· 2917 2779 2918 2780 mutex_unlock(&dev_priv->dpio_lock); 2919 2781 2920 - if (is_edp(intel_dp)) { 2921 - pps_lock(intel_dp); 2922 - vlv_init_panel_power_sequencer(intel_dp); 2923 - pps_unlock(intel_dp); 2924 - } 2925 - 2926 2782 intel_enable_dp(encoder); 2927 - 2928 - vlv_wait_port_ready(dev_priv, dport); 2929 2783 } 2930 2784 2931 2785 static void chv_dp_pre_pll_enable(struct intel_encoder *encoder) ··· 3826 3696 3827 3697 /* Try 5 times, then try clock recovery if that fails */ 3828 3698 if (tries > 5) { 3829 - intel_dp_link_down(intel_dp); 3830 3699 intel_dp_start_link_train(intel_dp); 3831 3700 intel_dp_set_link_train(intel_dp, &DP, 3832 3701 training_pattern | ··· 3983 3854 if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) 3984 3855 return; 3985 3856 3986 - intel_edp_panel_vdd_on(intel_dp); 3987 - 3988 3857 if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_SINK_OUI, buf, 3) == 3) 3989 3858 DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", 3990 3859 buf[0], buf[1], buf[2]); ··· 3990 3863 if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_BRANCH_OUI, buf, 3) == 3) 3991 3864 DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", 3992 3865 buf[0], buf[1], buf[2]); 3993 - 3994 - intel_edp_panel_vdd_off(intel_dp, false); 3995 3866 } 3996 3867 3997 3868 static bool ··· 4003 3878 if (intel_dp->dpcd[DP_DPCD_REV] < 0x12) 4004 3879 return false; 4005 3880 4006 - intel_edp_panel_vdd_on(intel_dp); 4007 3881 if (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_MSTM_CAP, buf, 1)) { 4008 3882 if (buf[0] & DP_MST_CAP) { 4009 3883 DRM_DEBUG_KMS("Sink is MST capable\n"); ··· 4012 3888 intel_dp->is_mst = false; 4013 3889 } 4014 3890 } 4015 - intel_edp_panel_vdd_off(intel_dp, false); 4016 3891 4017 3892 drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); 4018 3893 return intel_dp->is_mst; ··· 4691 4568 pps_unlock(intel_dp); 4692 4569 } 4693 4570 4571 + static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp) 4572 + { 4573 + struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); 4574 + struct drm_device *dev = intel_dig_port->base.base.dev; 4575 + struct drm_i915_private *dev_priv = dev->dev_private; 4576 + enum intel_display_power_domain power_domain; 4577 + 4578 + lockdep_assert_held(&dev_priv->pps_mutex); 4579 + 4580 + if (!edp_have_panel_vdd(intel_dp)) 4581 + return; 4582 + 4583 + /* 4584 + * The VDD bit needs a power domain reference, so if the bit is 4585 + * already enabled when we boot or resume, grab this reference and 4586 + * schedule a vdd off, so we don't hold on to the reference 4587 + * indefinitely. 4588 + */ 4589 + DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n"); 4590 + power_domain = intel_display_port_power_domain(&intel_dig_port->base); 4591 + intel_display_power_get(dev_priv, power_domain); 4592 + 4593 + edp_panel_vdd_schedule_off(intel_dp); 4594 + } 4595 + 4694 4596 static void intel_dp_encoder_reset(struct drm_encoder *encoder) 4695 4597 { 4696 - intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); 4598 + struct intel_dp *intel_dp; 4599 + 4600 + if (to_intel_encoder(encoder)->type != INTEL_OUTPUT_EDP) 4601 + return; 4602 + 4603 + intel_dp = enc_to_intel_dp(encoder); 4604 + 4605 + pps_lock(intel_dp); 4606 + 4607 + /* 4608 + * Read out the current power sequencer assignment, 4609 + * in case the BIOS did something with it. 4610 + */ 4611 + if (IS_VALLEYVIEW(encoder->dev)) 4612 + vlv_initial_power_sequencer_setup(intel_dp); 4613 + 4614 + intel_edp_panel_vdd_sanitize(intel_dp); 4615 + 4616 + pps_unlock(intel_dp); 4697 4617 } 4698 4618 4699 4619 static const struct drm_connector_funcs intel_dp_connector_funcs = { ··· 4923 4757 4924 4758 static void 4925 4759 intel_dp_init_panel_power_sequencer(struct drm_device *dev, 4926 - struct intel_dp *intel_dp, 4927 - struct edp_power_seq *out) 4760 + struct intel_dp *intel_dp) 4928 4761 { 4929 4762 struct drm_i915_private *dev_priv = dev->dev_private; 4930 - struct edp_power_seq cur, vbt, spec, final; 4763 + struct edp_power_seq cur, vbt, spec, 4764 + *final = &intel_dp->pps_delays; 4931 4765 u32 pp_on, pp_off, pp_div, pp; 4932 4766 int pp_ctrl_reg, pp_on_reg, pp_off_reg, pp_div_reg; 4933 4767 4934 4768 lockdep_assert_held(&dev_priv->pps_mutex); 4769 + 4770 + /* already initialized? */ 4771 + if (final->t11_t12 != 0) 4772 + return; 4935 4773 4936 4774 if (HAS_PCH_SPLIT(dev)) { 4937 4775 pp_ctrl_reg = PCH_PP_CONTROL; ··· 4998 4828 4999 4829 /* Use the max of the register settings and vbt. If both are 5000 4830 * unset, fall back to the spec limits. */ 5001 - #define assign_final(field) final.field = (max(cur.field, vbt.field) == 0 ? \ 4831 + #define assign_final(field) final->field = (max(cur.field, vbt.field) == 0 ? \ 5002 4832 spec.field : \ 5003 4833 max(cur.field, vbt.field)) 5004 4834 assign_final(t1_t3); ··· 5008 4838 assign_final(t11_t12); 5009 4839 #undef assign_final 5010 4840 5011 - #define get_delay(field) (DIV_ROUND_UP(final.field, 10)) 4841 + #define get_delay(field) (DIV_ROUND_UP(final->field, 10)) 5012 4842 intel_dp->panel_power_up_delay = get_delay(t1_t3); 5013 4843 intel_dp->backlight_on_delay = get_delay(t8); 5014 4844 intel_dp->backlight_off_delay = get_delay(t9); ··· 5022 4852 5023 4853 DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n", 5024 4854 intel_dp->backlight_on_delay, intel_dp->backlight_off_delay); 5025 - 5026 - if (out) 5027 - *out = final; 5028 4855 } 5029 4856 5030 4857 static void 5031 4858 intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, 5032 - struct intel_dp *intel_dp, 5033 - struct edp_power_seq *seq) 4859 + struct intel_dp *intel_dp) 5034 4860 { 5035 4861 struct drm_i915_private *dev_priv = dev->dev_private; 5036 4862 u32 pp_on, pp_off, pp_div, port_sel = 0; 5037 4863 int div = HAS_PCH_SPLIT(dev) ? intel_pch_rawclk(dev) : intel_hrawclk(dev); 5038 4864 int pp_on_reg, pp_off_reg, pp_div_reg; 5039 4865 enum port port = dp_to_dig_port(intel_dp)->port; 4866 + const struct edp_power_seq *seq = &intel_dp->pps_delays; 5040 4867 5041 4868 lockdep_assert_held(&dev_priv->pps_mutex); 5042 4869 ··· 5219 5052 return downclock_mode; 5220 5053 } 5221 5054 5222 - void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder) 5223 - { 5224 - struct drm_device *dev = intel_encoder->base.dev; 5225 - struct drm_i915_private *dev_priv = dev->dev_private; 5226 - struct intel_dp *intel_dp; 5227 - enum intel_display_power_domain power_domain; 5228 - 5229 - if (intel_encoder->type != INTEL_OUTPUT_EDP) 5230 - return; 5231 - 5232 - intel_dp = enc_to_intel_dp(&intel_encoder->base); 5233 - 5234 - pps_lock(intel_dp); 5235 - 5236 - if (!edp_have_panel_vdd(intel_dp)) 5237 - goto out; 5238 - /* 5239 - * The VDD bit needs a power domain reference, so if the bit is 5240 - * already enabled when we boot or resume, grab this reference and 5241 - * schedule a vdd off, so we don't hold on to the reference 5242 - * indefinitely. 5243 - */ 5244 - DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n"); 5245 - power_domain = intel_display_port_power_domain(intel_encoder); 5246 - intel_display_power_get(dev_priv, power_domain); 5247 - 5248 - edp_panel_vdd_schedule_off(intel_dp); 5249 - out: 5250 - pps_unlock(intel_dp); 5251 - } 5252 - 5253 5055 static bool intel_edp_init_connector(struct intel_dp *intel_dp, 5254 - struct intel_connector *intel_connector, 5255 - struct edp_power_seq *power_seq) 5056 + struct intel_connector *intel_connector) 5256 5057 { 5257 5058 struct drm_connector *connector = &intel_connector->base; 5258 5059 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); ··· 5238 5103 if (!is_edp(intel_dp)) 5239 5104 return true; 5240 5105 5241 - intel_edp_panel_vdd_sanitize(intel_encoder); 5106 + pps_lock(intel_dp); 5107 + intel_edp_panel_vdd_sanitize(intel_dp); 5108 + pps_unlock(intel_dp); 5242 5109 5243 5110 /* Cache DPCD and EDID for edp. */ 5244 - intel_edp_panel_vdd_on(intel_dp); 5245 5111 has_dpcd = intel_dp_get_dpcd(intel_dp); 5246 - intel_edp_panel_vdd_off(intel_dp, false); 5247 5112 5248 5113 if (has_dpcd) { 5249 5114 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) ··· 5258 5123 5259 5124 /* We now know it's not a ghost, init power sequence regs. */ 5260 5125 pps_lock(intel_dp); 5261 - intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq); 5126 + intel_dp_init_panel_power_sequencer_registers(dev, intel_dp); 5262 5127 pps_unlock(intel_dp); 5263 5128 5264 5129 mutex_lock(&dev->mode_config.mutex); ··· 5319 5184 struct drm_device *dev = intel_encoder->base.dev; 5320 5185 struct drm_i915_private *dev_priv = dev->dev_private; 5321 5186 enum port port = intel_dig_port->port; 5322 - struct edp_power_seq power_seq = { 0 }; 5323 5187 int type; 5324 5188 5325 5189 intel_dp->pps_pipe = INVALID_PIPE; ··· 5356 5222 */ 5357 5223 if (type == DRM_MODE_CONNECTOR_eDP) 5358 5224 intel_encoder->type = INTEL_OUTPUT_EDP; 5225 + 5226 + /* eDP only on port B and/or C on vlv/chv */ 5227 + if (WARN_ON(IS_VALLEYVIEW(dev) && is_edp(intel_dp) && 5228 + port != PORT_B && port != PORT_C)) 5229 + return false; 5359 5230 5360 5231 DRM_DEBUG_KMS("Adding %s connector on port %c\n", 5361 5232 type == DRM_MODE_CONNECTOR_eDP ? "eDP" : "DP", ··· 5404 5265 5405 5266 if (is_edp(intel_dp)) { 5406 5267 pps_lock(intel_dp); 5407 - if (IS_VALLEYVIEW(dev)) { 5268 + intel_dp_init_panel_power_timestamps(intel_dp); 5269 + if (IS_VALLEYVIEW(dev)) 5408 5270 vlv_initial_power_sequencer_setup(intel_dp); 5409 - } else { 5410 - intel_dp_init_panel_power_timestamps(intel_dp); 5411 - intel_dp_init_panel_power_sequencer(dev, intel_dp, 5412 - &power_seq); 5413 - } 5271 + else 5272 + intel_dp_init_panel_power_sequencer(dev, intel_dp); 5414 5273 pps_unlock(intel_dp); 5415 5274 } 5416 5275 ··· 5422 5285 } 5423 5286 } 5424 5287 5425 - if (!intel_edp_init_connector(intel_dp, intel_connector, &power_seq)) { 5288 + if (!intel_edp_init_connector(intel_dp, intel_connector)) { 5426 5289 drm_dp_aux_unregister(&intel_dp->aux); 5427 5290 if (is_edp(intel_dp)) { 5428 5291 cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
+44 -21
drivers/gpu/drm/i915/intel_drv.h
··· 94 94 95 95 /* these are outputs from the chip - integrated only 96 96 external chips are via DVO or SDVO output */ 97 - #define INTEL_OUTPUT_UNUSED 0 98 - #define INTEL_OUTPUT_ANALOG 1 99 - #define INTEL_OUTPUT_DVO 2 100 - #define INTEL_OUTPUT_SDVO 3 101 - #define INTEL_OUTPUT_LVDS 4 102 - #define INTEL_OUTPUT_TVOUT 5 103 - #define INTEL_OUTPUT_HDMI 6 104 - #define INTEL_OUTPUT_DISPLAYPORT 7 105 - #define INTEL_OUTPUT_EDP 8 106 - #define INTEL_OUTPUT_DSI 9 107 - #define INTEL_OUTPUT_UNKNOWN 10 108 - #define INTEL_OUTPUT_DP_MST 11 97 + enum intel_output_type { 98 + INTEL_OUTPUT_UNUSED = 0, 99 + INTEL_OUTPUT_ANALOG = 1, 100 + INTEL_OUTPUT_DVO = 2, 101 + INTEL_OUTPUT_SDVO = 3, 102 + INTEL_OUTPUT_LVDS = 4, 103 + INTEL_OUTPUT_TVOUT = 5, 104 + INTEL_OUTPUT_HDMI = 6, 105 + INTEL_OUTPUT_DISPLAYPORT = 7, 106 + INTEL_OUTPUT_EDP = 8, 107 + INTEL_OUTPUT_DSI = 9, 108 + INTEL_OUTPUT_UNKNOWN = 10, 109 + INTEL_OUTPUT_DP_MST = 11, 110 + }; 109 111 110 112 #define INTEL_DVO_CHIP_NONE 0 111 113 #define INTEL_DVO_CHIP_LVDS 1 ··· 138 136 */ 139 137 struct intel_crtc *new_crtc; 140 138 141 - int type; 139 + enum intel_output_type type; 142 140 unsigned int cloneable; 143 141 bool connectors_active; 144 142 void (*hot_plug)(struct intel_encoder *); ··· 401 399 402 400 struct intel_mmio_flip { 403 401 u32 seqno; 404 - u32 ring_id; 402 + struct intel_engine_cs *ring; 403 + struct work_struct work; 404 + }; 405 + 406 + struct skl_pipe_wm { 407 + struct skl_wm_level wm[8]; 408 + struct skl_wm_level trans_wm; 409 + uint32_t linetime; 405 410 }; 406 411 407 412 struct intel_crtc { ··· 458 449 struct { 459 450 /* watermarks currently being used */ 460 451 struct intel_pipe_wm active; 452 + /* SKL wm values currently in use */ 453 + struct skl_pipe_wm skl_active; 461 454 } wm; 462 455 463 456 int scanline_offset; ··· 601 590 * this port. Only relevant on VLV/CHV. 602 591 */ 603 592 enum pipe pps_pipe; 593 + struct edp_power_seq pps_delays; 604 594 605 595 bool use_tps3; 606 596 bool can_mst; /* this port supports mst */ ··· 860 848 void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire); 861 849 862 850 851 + /* intel_audio.c */ 852 + void intel_init_audio(struct drm_device *dev); 853 + void intel_audio_codec_enable(struct intel_encoder *encoder); 854 + void intel_audio_codec_disable(struct intel_encoder *encoder); 855 + 863 856 /* intel_display.c */ 864 857 const char *intel_output_name(int output); 865 858 bool intel_has_pending_fb_unpin(struct drm_device *dev); ··· 890 873 struct drm_file *file_priv); 891 874 enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, 892 875 enum pipe pipe); 876 + bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type); 893 877 static inline void 894 878 intel_wait_for_vblank(struct drm_device *dev, int pipe) 895 879 { ··· 905 887 struct drm_modeset_acquire_ctx *ctx); 906 888 void intel_release_load_detect_pipe(struct drm_connector *connector, 907 889 struct intel_load_detect_pipe *old); 908 - int intel_pin_and_fence_fb_obj(struct drm_device *dev, 909 - struct drm_i915_gem_object *obj, 890 + int intel_pin_and_fence_fb_obj(struct drm_plane *plane, 891 + struct drm_framebuffer *fb, 910 892 struct intel_engine_cs *pipelined); 911 893 void intel_unpin_fb_obj(struct drm_i915_gem_object *obj); 912 894 struct drm_framebuffer * ··· 928 910 struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc); 929 911 void intel_put_shared_dpll(struct intel_crtc *crtc); 930 912 913 + void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, 914 + const struct dpll *dpll); 915 + void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe); 916 + 931 917 /* modesetting asserts */ 932 918 void assert_panel_unlocked(struct drm_i915_private *dev_priv, 933 919 enum pipe pipe); ··· 946 924 void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state); 947 925 #define assert_pipe_enabled(d, p) assert_pipe(d, p, true) 948 926 #define assert_pipe_disabled(d, p) assert_pipe(d, p, false) 949 - void intel_write_eld(struct drm_encoder *encoder, 950 - struct drm_display_mode *mode); 951 927 unsigned long intel_gen4_compute_page_offset(int *x, int *y, 952 928 unsigned int tiling_mode, 953 929 unsigned int bpp, ··· 990 970 void intel_edp_backlight_on(struct intel_dp *intel_dp); 991 971 void intel_edp_backlight_off(struct intel_dp *intel_dp); 992 972 void intel_edp_panel_vdd_on(struct intel_dp *intel_dp); 993 - void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder); 994 973 void intel_edp_panel_on(struct intel_dp *intel_dp); 995 974 void intel_edp_panel_off(struct intel_dp *intel_dp); 996 975 void intel_edp_psr_enable(struct intel_dp *intel_dp); ··· 1001 982 unsigned frontbuffer_bits); 1002 983 void intel_edp_psr_init(struct drm_device *dev); 1003 984 1004 - int intel_dp_handle_hpd_irq(struct intel_digital_port *digport, bool long_hpd); 1005 985 void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector); 1006 986 void intel_dp_mst_suspend(struct drm_device *dev); 1007 987 void intel_dp_mst_resume(struct drm_device *dev); ··· 1157 1139 void gen6_rps_idle(struct drm_i915_private *dev_priv); 1158 1140 void gen6_rps_boost(struct drm_i915_private *dev_priv); 1159 1141 void ilk_wm_get_hw_state(struct drm_device *dev); 1142 + void skl_wm_get_hw_state(struct drm_device *dev); 1143 + void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, 1144 + struct skl_ddb_allocation *ddb /* out */); 1160 1145 1161 1146 1162 1147 /* intel_sdvo.c */ ··· 1179 1158 struct drm_file *file_priv); 1180 1159 int intel_sprite_get_colorkey(struct drm_device *dev, void *data, 1181 1160 struct drm_file *file_priv); 1182 - 1161 + bool intel_pipe_update_start(struct intel_crtc *crtc, 1162 + uint32_t *start_vbl_count); 1163 + void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count); 1183 1164 1184 1165 /* intel_tv.c */ 1185 1166 void intel_tv_init(struct drm_device *dev);
+10 -10
drivers/gpu/drm/i915/intel_fbdev.c
··· 119 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 122 fb = __intel_framebuffer_create(dev, &mode_cmd, obj); 130 123 if (IS_ERR(fb)) { 131 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 135 ifbdev->fb = to_intel_framebuffer(fb); 136 136 137 137 return 0; 138 138 139 - out_unpin: 140 - i915_gem_object_ggtt_unpin(obj); 139 + out_fb: 140 + drm_framebuffer_remove(fb); 141 141 out_unref: 142 142 drm_gem_object_unreference(&obj->base); 143 143 out:
+11 -8
drivers/gpu/drm/i915/intel_hdmi.c
··· 661 661 if (crtc->config.has_hdmi_sink) 662 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 664 if (HAS_PCH_CPT(dev)) 673 665 hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe); 674 666 else if (IS_CHERRYVIEW(dev)) ··· 783 791 I915_WRITE(intel_hdmi->hdmi_reg, temp); 784 792 POSTING_READ(intel_hdmi->hdmi_reg); 785 793 } 794 + 795 + if (intel_crtc->config.has_audio) { 796 + WARN_ON(!intel_crtc->config.has_hdmi_sink); 797 + DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n", 798 + pipe_name(intel_crtc->pipe)); 799 + intel_audio_codec_enable(encoder); 800 + } 786 801 } 787 802 788 803 static void vlv_enable_hdmi(struct intel_encoder *encoder) ··· 801 802 struct drm_device *dev = encoder->base.dev; 802 803 struct drm_i915_private *dev_priv = dev->dev_private; 803 804 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); 805 + struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); 804 806 u32 temp; 805 807 u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE; 808 + 809 + if (crtc->config.has_audio) 810 + intel_audio_codec_disable(encoder); 806 811 807 812 temp = I915_READ(intel_hdmi->hdmi_reg); 808 813
+35 -17
drivers/gpu/drm/i915/intel_lrc.c
··· 356 356 return 0; 357 357 } 358 358 359 - static int execlists_submit_context(struct intel_engine_cs *ring, 360 - struct intel_context *to0, u32 tail0, 361 - struct intel_context *to1, u32 tail1) 359 + static void execlists_submit_contexts(struct intel_engine_cs *ring, 360 + struct intel_context *to0, u32 tail0, 361 + struct intel_context *to1, u32 tail1) 362 362 { 363 363 struct drm_i915_gem_object *ctx_obj0; 364 364 struct drm_i915_gem_object *ctx_obj1 = NULL; ··· 378 378 } 379 379 380 380 execlists_elsp_write(ring, ctx_obj0, ctx_obj1); 381 - 382 - return 0; 383 381 } 384 382 385 383 static void execlists_context_unqueue(struct intel_engine_cs *ring) ··· 411 413 412 414 WARN_ON(req1 && req1->elsp_submitted); 413 415 414 - WARN_ON(execlists_submit_context(ring, req0->ctx, req0->tail, 415 - req1 ? req1->ctx : NULL, 416 - req1 ? req1->tail : 0)); 416 + execlists_submit_contexts(ring, req0->ctx, req0->tail, 417 + req1 ? req1->ctx : NULL, 418 + req1 ? req1->tail : 0); 417 419 418 420 req0->elsp_submitted++; 419 421 if (req1) ··· 1212 1214 */ 1213 1215 void intel_logical_ring_cleanup(struct intel_engine_cs *ring) 1214 1216 { 1215 - struct drm_i915_private *dev_priv = ring->dev->dev_private; 1217 + struct drm_i915_private *dev_priv; 1216 1218 1217 1219 if (!intel_ring_initialized(ring)) 1218 1220 return; 1221 + 1222 + dev_priv = ring->dev->dev_private; 1219 1223 1220 1224 intel_logical_ring_stop(ring); 1221 1225 WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0); ··· 1649 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 1674 * intel_lr_context_deferred_create() - create the LRC specific bits of a context 1654 1675 * @ctx: LR context to create. ··· 1755 1734 ctx->engine[ring->id].state = ctx_obj; 1756 1735 1757 1736 if (ctx == ring->default_context) { 1758 - /* The status page is offset 0 from the default context object 1759 - * in LRC mode. */ 1760 - ring->status_page.gfx_addr = i915_gem_obj_ggtt_offset(ctx_obj); 1761 - ring->status_page.page_addr = 1762 - kmap(sg_page(ctx_obj->pages->sgl)); 1763 - if (ring->status_page.page_addr == NULL) 1764 - return -ENOMEM; 1765 - ring->status_page.obj = ctx_obj; 1737 + ret = lrc_setup_hardware_status_page(ring, ctx_obj); 1738 + if (ret) { 1739 + DRM_ERROR("Failed to setup hardware status page\n"); 1740 + goto error; 1741 + } 1766 1742 } 1767 1743 1768 1744 if (ring->id == RCS && !ctx->rcs_initialized) {
+1027 -7
drivers/gpu/drm/i915/intel_pm.c
··· 1960 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 1971 struct ilk_pipe_wm_parameters { 1964 1972 bool active; 1965 1973 uint32_t pipe_htotal; ··· 2279 2271 PIPE_WM_LINETIME_TIME(linetime); 2280 2272 } 2281 2273 2282 - static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[5]) 2274 + static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8]) 2283 2275 { 2284 2276 struct drm_i915_private *dev_priv = dev->dev_private; 2285 2277 2286 - if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { 2278 + if (IS_GEN9(dev)) { 2279 + uint32_t val; 2280 + int ret, i; 2281 + int level, max_level = ilk_wm_max_level(dev); 2282 + 2283 + /* read the first set of memory latencies[0:3] */ 2284 + val = 0; /* data0 to be programmed to 0 for first set */ 2285 + mutex_lock(&dev_priv->rps.hw_lock); 2286 + ret = sandybridge_pcode_read(dev_priv, 2287 + GEN9_PCODE_READ_MEM_LATENCY, 2288 + &val); 2289 + mutex_unlock(&dev_priv->rps.hw_lock); 2290 + 2291 + if (ret) { 2292 + DRM_ERROR("SKL Mailbox read error = %d\n", ret); 2293 + return; 2294 + } 2295 + 2296 + wm[0] = val & GEN9_MEM_LATENCY_LEVEL_MASK; 2297 + wm[1] = (val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) & 2298 + GEN9_MEM_LATENCY_LEVEL_MASK; 2299 + wm[2] = (val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) & 2300 + GEN9_MEM_LATENCY_LEVEL_MASK; 2301 + wm[3] = (val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) & 2302 + GEN9_MEM_LATENCY_LEVEL_MASK; 2303 + 2304 + /* read the second set of memory latencies[4:7] */ 2305 + val = 1; /* data0 to be programmed to 1 for second set */ 2306 + mutex_lock(&dev_priv->rps.hw_lock); 2307 + ret = sandybridge_pcode_read(dev_priv, 2308 + GEN9_PCODE_READ_MEM_LATENCY, 2309 + &val); 2310 + mutex_unlock(&dev_priv->rps.hw_lock); 2311 + if (ret) { 2312 + DRM_ERROR("SKL Mailbox read error = %d\n", ret); 2313 + return; 2314 + } 2315 + 2316 + wm[4] = val & GEN9_MEM_LATENCY_LEVEL_MASK; 2317 + wm[5] = (val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) & 2318 + GEN9_MEM_LATENCY_LEVEL_MASK; 2319 + wm[6] = (val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) & 2320 + GEN9_MEM_LATENCY_LEVEL_MASK; 2321 + wm[7] = (val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) & 2322 + GEN9_MEM_LATENCY_LEVEL_MASK; 2323 + 2324 + /* 2325 + * punit doesn't take into account the read latency so we need 2326 + * to add 2us to the various latency levels we retrieve from 2327 + * the punit. 2328 + * - W0 is a bit special in that it's the only level that 2329 + * can't be disabled if we want to have display working, so 2330 + * we always add 2us there. 2331 + * - For levels >=1, punit returns 0us latency when they are 2332 + * disabled, so we respect that and don't add 2us then 2333 + * 2334 + * Additionally, if a level n (n > 1) has a 0us latency, all 2335 + * levels m (m >= n) need to be disabled. We make sure to 2336 + * sanitize the values out of the punit to satisfy this 2337 + * requirement. 2338 + */ 2339 + wm[0] += 2; 2340 + for (level = 1; level <= max_level; level++) 2341 + if (wm[level] != 0) 2342 + wm[level] += 2; 2343 + else { 2344 + for (i = level + 1; i <= max_level; i++) 2345 + wm[i] = 0; 2346 + 2347 + break; 2348 + } 2349 + } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { 2287 2350 uint64_t sskpd = I915_READ64(MCH_SSKPD); 2288 2351 2289 2352 wm[0] = (sskpd >> 56) & 0xFF; ··· 2402 2323 int ilk_wm_max_level(const struct drm_device *dev) 2403 2324 { 2404 2325 /* how many WM levels are we expecting */ 2405 - if (IS_HASWELL(dev) || IS_BROADWELL(dev)) 2326 + if (IS_GEN9(dev)) 2327 + return 7; 2328 + else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) 2406 2329 return 4; 2407 2330 else if (INTEL_INFO(dev)->gen >= 6) 2408 2331 return 3; ··· 2414 2333 2415 2334 static void intel_print_wm_latency(struct drm_device *dev, 2416 2335 const char *name, 2417 - const uint16_t wm[5]) 2336 + const uint16_t wm[8]) 2418 2337 { 2419 2338 int level, max_level = ilk_wm_max_level(dev); 2420 2339 ··· 2427 2346 continue; 2428 2347 } 2429 2348 2430 - /* WM1+ latency values in 0.5us units */ 2431 - if (level > 0) 2349 + /* 2350 + * - latencies are in us on gen9. 2351 + * - before then, WM1+ latency values are in 0.5us units 2352 + */ 2353 + if (IS_GEN9(dev)) 2354 + latency *= 10; 2355 + else if (level > 0) 2432 2356 latency *= 5; 2433 2357 2434 2358 DRM_DEBUG_KMS("%s WM%d latency %u (%u.%u usec)\n", ··· 2499 2413 2500 2414 if (IS_GEN6(dev)) 2501 2415 snb_wm_latency_quirk(dev); 2416 + } 2417 + 2418 + static void skl_setup_wm_latency(struct drm_device *dev) 2419 + { 2420 + struct drm_i915_private *dev_priv = dev->dev_private; 2421 + 2422 + intel_read_wm_latency(dev, dev_priv->wm.skl_latency); 2423 + intel_print_wm_latency(dev, "Gen9 Plane", dev_priv->wm.skl_latency); 2502 2424 } 2503 2425 2504 2426 static void ilk_compute_wm_parameters(struct drm_crtc *crtc, ··· 2999 2905 return _ilk_disable_lp_wm(dev_priv, WM_DIRTY_LP_ALL); 3000 2906 } 3001 2907 2908 + /* 2909 + * On gen9, we need to allocate Display Data Buffer (DDB) portions to the 2910 + * different active planes. 2911 + */ 2912 + 2913 + #define SKL_DDB_SIZE 896 /* in blocks */ 2914 + 2915 + static void 2916 + skl_ddb_get_pipe_allocation_limits(struct drm_device *dev, 2917 + struct drm_crtc *for_crtc, 2918 + const struct intel_wm_config *config, 2919 + const struct skl_pipe_wm_parameters *params, 2920 + struct skl_ddb_entry *alloc /* out */) 2921 + { 2922 + struct drm_crtc *crtc; 2923 + unsigned int pipe_size, ddb_size; 2924 + int nth_active_pipe; 2925 + 2926 + if (!params->active) { 2927 + alloc->start = 0; 2928 + alloc->end = 0; 2929 + return; 2930 + } 2931 + 2932 + ddb_size = SKL_DDB_SIZE; 2933 + 2934 + ddb_size -= 4; /* 4 blocks for bypass path allocation */ 2935 + 2936 + nth_active_pipe = 0; 2937 + for_each_crtc(dev, crtc) { 2938 + if (!intel_crtc_active(crtc)) 2939 + continue; 2940 + 2941 + if (crtc == for_crtc) 2942 + break; 2943 + 2944 + nth_active_pipe++; 2945 + } 2946 + 2947 + pipe_size = ddb_size / config->num_pipes_active; 2948 + alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active; 2949 + alloc->end = alloc->start + pipe_size; 2950 + } 2951 + 2952 + static unsigned int skl_cursor_allocation(const struct intel_wm_config *config) 2953 + { 2954 + if (config->num_pipes_active == 1) 2955 + return 32; 2956 + 2957 + return 8; 2958 + } 2959 + 2960 + static void skl_ddb_entry_init_from_hw(struct skl_ddb_entry *entry, u32 reg) 2961 + { 2962 + entry->start = reg & 0x3ff; 2963 + entry->end = (reg >> 16) & 0x3ff; 2964 + if (entry->end) 2965 + entry->end += 1; 2966 + } 2967 + 2968 + void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, 2969 + struct skl_ddb_allocation *ddb /* out */) 2970 + { 2971 + struct drm_device *dev = dev_priv->dev; 2972 + enum pipe pipe; 2973 + int plane; 2974 + u32 val; 2975 + 2976 + for_each_pipe(dev_priv, pipe) { 2977 + for_each_plane(pipe, plane) { 2978 + val = I915_READ(PLANE_BUF_CFG(pipe, plane)); 2979 + skl_ddb_entry_init_from_hw(&ddb->plane[pipe][plane], 2980 + val); 2981 + } 2982 + 2983 + val = I915_READ(CUR_BUF_CFG(pipe)); 2984 + skl_ddb_entry_init_from_hw(&ddb->cursor[pipe], val); 2985 + } 2986 + } 2987 + 2988 + static unsigned int 2989 + skl_plane_relative_data_rate(const struct intel_plane_wm_parameters *p) 2990 + { 2991 + return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel; 2992 + } 2993 + 2994 + /* 2995 + * We don't overflow 32 bits. Worst case is 3 planes enabled, each fetching 2996 + * a 8192x4096@32bpp framebuffer: 2997 + * 3 * 4096 * 8192 * 4 < 2^32 2998 + */ 2999 + static unsigned int 3000 + skl_get_total_relative_data_rate(struct intel_crtc *intel_crtc, 3001 + const struct skl_pipe_wm_parameters *params) 3002 + { 3003 + unsigned int total_data_rate = 0; 3004 + int plane; 3005 + 3006 + for (plane = 0; plane < intel_num_planes(intel_crtc); plane++) { 3007 + const struct intel_plane_wm_parameters *p; 3008 + 3009 + p = &params->plane[plane]; 3010 + if (!p->enabled) 3011 + continue; 3012 + 3013 + total_data_rate += skl_plane_relative_data_rate(p); 3014 + } 3015 + 3016 + return total_data_rate; 3017 + } 3018 + 3019 + static void 3020 + skl_allocate_pipe_ddb(struct drm_crtc *crtc, 3021 + const struct intel_wm_config *config, 3022 + const struct skl_pipe_wm_parameters *params, 3023 + struct skl_ddb_allocation *ddb /* out */) 3024 + { 3025 + struct drm_device *dev = crtc->dev; 3026 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3027 + enum pipe pipe = intel_crtc->pipe; 3028 + struct skl_ddb_entry *alloc = &ddb->pipe[pipe]; 3029 + uint16_t alloc_size, start, cursor_blocks; 3030 + unsigned int total_data_rate; 3031 + int plane; 3032 + 3033 + skl_ddb_get_pipe_allocation_limits(dev, crtc, config, params, alloc); 3034 + alloc_size = skl_ddb_entry_size(alloc); 3035 + if (alloc_size == 0) { 3036 + memset(ddb->plane[pipe], 0, sizeof(ddb->plane[pipe])); 3037 + memset(&ddb->cursor[pipe], 0, sizeof(ddb->cursor[pipe])); 3038 + return; 3039 + } 3040 + 3041 + cursor_blocks = skl_cursor_allocation(config); 3042 + ddb->cursor[pipe].start = alloc->end - cursor_blocks; 3043 + ddb->cursor[pipe].end = alloc->end; 3044 + 3045 + alloc_size -= cursor_blocks; 3046 + alloc->end -= cursor_blocks; 3047 + 3048 + /* 3049 + * Each active plane get a portion of the remaining space, in 3050 + * proportion to the amount of data they need to fetch from memory. 3051 + * 3052 + * FIXME: we may not allocate every single block here. 3053 + */ 3054 + total_data_rate = skl_get_total_relative_data_rate(intel_crtc, params); 3055 + 3056 + start = alloc->start; 3057 + for (plane = 0; plane < intel_num_planes(intel_crtc); plane++) { 3058 + const struct intel_plane_wm_parameters *p; 3059 + unsigned int data_rate; 3060 + uint16_t plane_blocks; 3061 + 3062 + p = &params->plane[plane]; 3063 + if (!p->enabled) 3064 + continue; 3065 + 3066 + data_rate = skl_plane_relative_data_rate(p); 3067 + 3068 + /* 3069 + * promote the expression to 64 bits to avoid overflowing, the 3070 + * result is < available as data_rate / total_data_rate < 1 3071 + */ 3072 + plane_blocks = div_u64((uint64_t)alloc_size * data_rate, 3073 + total_data_rate); 3074 + 3075 + ddb->plane[pipe][plane].start = start; 3076 + ddb->plane[pipe][plane].end = start + plane_blocks; 3077 + 3078 + start += plane_blocks; 3079 + } 3080 + 3081 + } 3082 + 3083 + static uint32_t skl_pipe_pixel_rate(const struct intel_crtc_config *config) 3084 + { 3085 + /* TODO: Take into account the scalers once we support them */ 3086 + return config->adjusted_mode.crtc_clock; 3087 + } 3088 + 3089 + /* 3090 + * The max latency should be 257 (max the punit can code is 255 and we add 2us 3091 + * for the read latency) and bytes_per_pixel should always be <= 8, so that 3092 + * should allow pixel_rate up to ~2 GHz which seems sufficient since max 3093 + * 2xcdclk is 1350 MHz and the pixel rate should never exceed that. 3094 + */ 3095 + static uint32_t skl_wm_method1(uint32_t pixel_rate, uint8_t bytes_per_pixel, 3096 + uint32_t latency) 3097 + { 3098 + uint32_t wm_intermediate_val, ret; 3099 + 3100 + if (latency == 0) 3101 + return UINT_MAX; 3102 + 3103 + wm_intermediate_val = latency * pixel_rate * bytes_per_pixel; 3104 + ret = DIV_ROUND_UP(wm_intermediate_val, 1000); 3105 + 3106 + return ret; 3107 + } 3108 + 3109 + static uint32_t skl_wm_method2(uint32_t pixel_rate, uint32_t pipe_htotal, 3110 + uint32_t horiz_pixels, uint8_t bytes_per_pixel, 3111 + uint32_t latency) 3112 + { 3113 + uint32_t ret, plane_bytes_per_line, wm_intermediate_val; 3114 + 3115 + if (latency == 0) 3116 + return UINT_MAX; 3117 + 3118 + plane_bytes_per_line = horiz_pixels * bytes_per_pixel; 3119 + wm_intermediate_val = latency * pixel_rate; 3120 + ret = DIV_ROUND_UP(wm_intermediate_val, pipe_htotal * 1000) * 3121 + plane_bytes_per_line; 3122 + 3123 + return ret; 3124 + } 3125 + 3126 + static bool skl_ddb_allocation_changed(const struct skl_ddb_allocation *new_ddb, 3127 + const struct intel_crtc *intel_crtc) 3128 + { 3129 + struct drm_device *dev = intel_crtc->base.dev; 3130 + struct drm_i915_private *dev_priv = dev->dev_private; 3131 + const struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb; 3132 + enum pipe pipe = intel_crtc->pipe; 3133 + 3134 + if (memcmp(new_ddb->plane[pipe], cur_ddb->plane[pipe], 3135 + sizeof(new_ddb->plane[pipe]))) 3136 + return true; 3137 + 3138 + if (memcmp(&new_ddb->cursor[pipe], &cur_ddb->cursor[pipe], 3139 + sizeof(new_ddb->cursor[pipe]))) 3140 + return true; 3141 + 3142 + return false; 3143 + } 3144 + 3145 + static void skl_compute_wm_global_parameters(struct drm_device *dev, 3146 + struct intel_wm_config *config) 3147 + { 3148 + struct drm_crtc *crtc; 3149 + struct drm_plane *plane; 3150 + 3151 + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 3152 + config->num_pipes_active += intel_crtc_active(crtc); 3153 + 3154 + /* FIXME: I don't think we need those two global parameters on SKL */ 3155 + list_for_each_entry(plane, &dev->mode_config.plane_list, head) { 3156 + struct intel_plane *intel_plane = to_intel_plane(plane); 3157 + 3158 + config->sprites_enabled |= intel_plane->wm.enabled; 3159 + config->sprites_scaled |= intel_plane->wm.scaled; 3160 + } 3161 + } 3162 + 3163 + static void skl_compute_wm_pipe_parameters(struct drm_crtc *crtc, 3164 + struct skl_pipe_wm_parameters *p) 3165 + { 3166 + struct drm_device *dev = crtc->dev; 3167 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3168 + enum pipe pipe = intel_crtc->pipe; 3169 + struct drm_plane *plane; 3170 + int i = 1; /* Index for sprite planes start */ 3171 + 3172 + p->active = intel_crtc_active(crtc); 3173 + if (p->active) { 3174 + p->pipe_htotal = intel_crtc->config.adjusted_mode.crtc_htotal; 3175 + p->pixel_rate = skl_pipe_pixel_rate(&intel_crtc->config); 3176 + 3177 + /* 3178 + * For now, assume primary and cursor planes are always enabled. 3179 + */ 3180 + p->plane[0].enabled = true; 3181 + p->plane[0].bytes_per_pixel = 3182 + crtc->primary->fb->bits_per_pixel / 8; 3183 + p->plane[0].horiz_pixels = intel_crtc->config.pipe_src_w; 3184 + p->plane[0].vert_pixels = intel_crtc->config.pipe_src_h; 3185 + 3186 + p->cursor.enabled = true; 3187 + p->cursor.bytes_per_pixel = 4; 3188 + p->cursor.horiz_pixels = intel_crtc->cursor_width ? 3189 + intel_crtc->cursor_width : 64; 3190 + } 3191 + 3192 + list_for_each_entry(plane, &dev->mode_config.plane_list, head) { 3193 + struct intel_plane *intel_plane = to_intel_plane(plane); 3194 + 3195 + if (intel_plane->pipe == pipe) 3196 + p->plane[i++] = intel_plane->wm; 3197 + } 3198 + } 3199 + 3200 + static bool skl_compute_plane_wm(struct skl_pipe_wm_parameters *p, 3201 + struct intel_plane_wm_parameters *p_params, 3202 + uint16_t ddb_allocation, 3203 + uint32_t mem_value, 3204 + uint16_t *out_blocks, /* out */ 3205 + uint8_t *out_lines /* out */) 3206 + { 3207 + uint32_t method1, method2, plane_bytes_per_line, res_blocks, res_lines; 3208 + uint32_t result_bytes; 3209 + 3210 + if (mem_value == 0 || !p->active || !p_params->enabled) 3211 + return false; 3212 + 3213 + method1 = skl_wm_method1(p->pixel_rate, 3214 + p_params->bytes_per_pixel, 3215 + mem_value); 3216 + method2 = skl_wm_method2(p->pixel_rate, 3217 + p->pipe_htotal, 3218 + p_params->horiz_pixels, 3219 + p_params->bytes_per_pixel, 3220 + mem_value); 3221 + 3222 + plane_bytes_per_line = p_params->horiz_pixels * 3223 + p_params->bytes_per_pixel; 3224 + 3225 + /* For now xtile and linear */ 3226 + if (((ddb_allocation * 512) / plane_bytes_per_line) >= 1) 3227 + result_bytes = min(method1, method2); 3228 + else 3229 + result_bytes = method1; 3230 + 3231 + res_blocks = DIV_ROUND_UP(result_bytes, 512) + 1; 3232 + res_lines = DIV_ROUND_UP(result_bytes, plane_bytes_per_line); 3233 + 3234 + if (res_blocks > ddb_allocation || res_lines > 31) 3235 + return false; 3236 + 3237 + *out_blocks = res_blocks; 3238 + *out_lines = res_lines; 3239 + 3240 + return true; 3241 + } 3242 + 3243 + static void skl_compute_wm_level(const struct drm_i915_private *dev_priv, 3244 + struct skl_ddb_allocation *ddb, 3245 + struct skl_pipe_wm_parameters *p, 3246 + enum pipe pipe, 3247 + int level, 3248 + int num_planes, 3249 + struct skl_wm_level *result) 3250 + { 3251 + uint16_t latency = dev_priv->wm.skl_latency[level]; 3252 + uint16_t ddb_blocks; 3253 + int i; 3254 + 3255 + for (i = 0; i < num_planes; i++) { 3256 + ddb_blocks = skl_ddb_entry_size(&ddb->plane[pipe][i]); 3257 + 3258 + result->plane_en[i] = skl_compute_plane_wm(p, &p->plane[i], 3259 + ddb_blocks, 3260 + latency, 3261 + &result->plane_res_b[i], 3262 + &result->plane_res_l[i]); 3263 + } 3264 + 3265 + ddb_blocks = skl_ddb_entry_size(&ddb->cursor[pipe]); 3266 + result->cursor_en = skl_compute_plane_wm(p, &p->cursor, ddb_blocks, 3267 + latency, &result->cursor_res_b, 3268 + &result->cursor_res_l); 3269 + } 3270 + 3271 + static uint32_t 3272 + skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p) 3273 + { 3274 + if (!intel_crtc_active(crtc)) 3275 + return 0; 3276 + 3277 + return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate); 3278 + 3279 + } 3280 + 3281 + static void skl_compute_transition_wm(struct drm_crtc *crtc, 3282 + struct skl_pipe_wm_parameters *params, 3283 + struct skl_wm_level *trans_wm /* out */) 3284 + { 3285 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3286 + int i; 3287 + 3288 + if (!params->active) 3289 + return; 3290 + 3291 + /* Until we know more, just disable transition WMs */ 3292 + for (i = 0; i < intel_num_planes(intel_crtc); i++) 3293 + trans_wm->plane_en[i] = false; 3294 + trans_wm->cursor_en = false; 3295 + } 3296 + 3297 + static void skl_compute_pipe_wm(struct drm_crtc *crtc, 3298 + struct skl_ddb_allocation *ddb, 3299 + struct skl_pipe_wm_parameters *params, 3300 + struct skl_pipe_wm *pipe_wm) 3301 + { 3302 + struct drm_device *dev = crtc->dev; 3303 + const struct drm_i915_private *dev_priv = dev->dev_private; 3304 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3305 + int level, max_level = ilk_wm_max_level(dev); 3306 + 3307 + for (level = 0; level <= max_level; level++) { 3308 + skl_compute_wm_level(dev_priv, ddb, params, intel_crtc->pipe, 3309 + level, intel_num_planes(intel_crtc), 3310 + &pipe_wm->wm[level]); 3311 + } 3312 + pipe_wm->linetime = skl_compute_linetime_wm(crtc, params); 3313 + 3314 + skl_compute_transition_wm(crtc, params, &pipe_wm->trans_wm); 3315 + } 3316 + 3317 + static void skl_compute_wm_results(struct drm_device *dev, 3318 + struct skl_pipe_wm_parameters *p, 3319 + struct skl_pipe_wm *p_wm, 3320 + struct skl_wm_values *r, 3321 + struct intel_crtc *intel_crtc) 3322 + { 3323 + int level, max_level = ilk_wm_max_level(dev); 3324 + enum pipe pipe = intel_crtc->pipe; 3325 + uint32_t temp; 3326 + int i; 3327 + 3328 + for (level = 0; level <= max_level; level++) { 3329 + for (i = 0; i < intel_num_planes(intel_crtc); i++) { 3330 + temp = 0; 3331 + 3332 + temp |= p_wm->wm[level].plane_res_l[i] << 3333 + PLANE_WM_LINES_SHIFT; 3334 + temp |= p_wm->wm[level].plane_res_b[i]; 3335 + if (p_wm->wm[level].plane_en[i]) 3336 + temp |= PLANE_WM_EN; 3337 + 3338 + r->plane[pipe][i][level] = temp; 3339 + } 3340 + 3341 + temp = 0; 3342 + 3343 + temp |= p_wm->wm[level].cursor_res_l << PLANE_WM_LINES_SHIFT; 3344 + temp |= p_wm->wm[level].cursor_res_b; 3345 + 3346 + if (p_wm->wm[level].cursor_en) 3347 + temp |= PLANE_WM_EN; 3348 + 3349 + r->cursor[pipe][level] = temp; 3350 + 3351 + } 3352 + 3353 + /* transition WMs */ 3354 + for (i = 0; i < intel_num_planes(intel_crtc); i++) { 3355 + temp = 0; 3356 + temp |= p_wm->trans_wm.plane_res_l[i] << PLANE_WM_LINES_SHIFT; 3357 + temp |= p_wm->trans_wm.plane_res_b[i]; 3358 + if (p_wm->trans_wm.plane_en[i]) 3359 + temp |= PLANE_WM_EN; 3360 + 3361 + r->plane_trans[pipe][i] = temp; 3362 + } 3363 + 3364 + temp = 0; 3365 + temp |= p_wm->trans_wm.cursor_res_l << PLANE_WM_LINES_SHIFT; 3366 + temp |= p_wm->trans_wm.cursor_res_b; 3367 + if (p_wm->trans_wm.cursor_en) 3368 + temp |= PLANE_WM_EN; 3369 + 3370 + r->cursor_trans[pipe] = temp; 3371 + 3372 + r->wm_linetime[pipe] = p_wm->linetime; 3373 + } 3374 + 3375 + static void skl_ddb_entry_write(struct drm_i915_private *dev_priv, uint32_t reg, 3376 + const struct skl_ddb_entry *entry) 3377 + { 3378 + if (entry->end) 3379 + I915_WRITE(reg, (entry->end - 1) << 16 | entry->start); 3380 + else 3381 + I915_WRITE(reg, 0); 3382 + } 3383 + 3384 + static void skl_write_wm_values(struct drm_i915_private *dev_priv, 3385 + const struct skl_wm_values *new) 3386 + { 3387 + struct drm_device *dev = dev_priv->dev; 3388 + struct intel_crtc *crtc; 3389 + 3390 + list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) { 3391 + int i, level, max_level = ilk_wm_max_level(dev); 3392 + enum pipe pipe = crtc->pipe; 3393 + 3394 + if (!new->dirty[pipe]) 3395 + continue; 3396 + 3397 + I915_WRITE(PIPE_WM_LINETIME(pipe), new->wm_linetime[pipe]); 3398 + 3399 + for (level = 0; level <= max_level; level++) { 3400 + for (i = 0; i < intel_num_planes(crtc); i++) 3401 + I915_WRITE(PLANE_WM(pipe, i, level), 3402 + new->plane[pipe][i][level]); 3403 + I915_WRITE(CUR_WM(pipe, level), 3404 + new->cursor[pipe][level]); 3405 + } 3406 + for (i = 0; i < intel_num_planes(crtc); i++) 3407 + I915_WRITE(PLANE_WM_TRANS(pipe, i), 3408 + new->plane_trans[pipe][i]); 3409 + I915_WRITE(CUR_WM_TRANS(pipe), new->cursor_trans[pipe]); 3410 + 3411 + for (i = 0; i < intel_num_planes(crtc); i++) 3412 + skl_ddb_entry_write(dev_priv, 3413 + PLANE_BUF_CFG(pipe, i), 3414 + &new->ddb.plane[pipe][i]); 3415 + 3416 + skl_ddb_entry_write(dev_priv, CUR_BUF_CFG(pipe), 3417 + &new->ddb.cursor[pipe]); 3418 + } 3419 + } 3420 + 3421 + /* 3422 + * When setting up a new DDB allocation arrangement, we need to correctly 3423 + * sequence the times at which the new allocations for the pipes are taken into 3424 + * account or we'll have pipes fetching from space previously allocated to 3425 + * another pipe. 3426 + * 3427 + * Roughly the sequence looks like: 3428 + * 1. re-allocate the pipe(s) with the allocation being reduced and not 3429 + * overlapping with a previous light-up pipe (another way to put it is: 3430 + * pipes with their new allocation strickly included into their old ones). 3431 + * 2. re-allocate the other pipes that get their allocation reduced 3432 + * 3. allocate the pipes having their allocation increased 3433 + * 3434 + * Steps 1. and 2. are here to take care of the following case: 3435 + * - Initially DDB looks like this: 3436 + * | B | C | 3437 + * - enable pipe A. 3438 + * - pipe B has a reduced DDB allocation that overlaps with the old pipe C 3439 + * allocation 3440 + * | A | B | C | 3441 + * 3442 + * We need to sequence the re-allocation: C, B, A (and not B, C, A). 3443 + */ 3444 + 3445 + static void 3446 + skl_wm_flush_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, int pass) 3447 + { 3448 + struct drm_device *dev = dev_priv->dev; 3449 + int plane; 3450 + 3451 + DRM_DEBUG_KMS("flush pipe %c (pass %d)\n", pipe_name(pipe), pass); 3452 + 3453 + for_each_plane(pipe, plane) { 3454 + I915_WRITE(PLANE_SURF(pipe, plane), 3455 + I915_READ(PLANE_SURF(pipe, plane))); 3456 + } 3457 + I915_WRITE(CURBASE(pipe), I915_READ(CURBASE(pipe))); 3458 + } 3459 + 3460 + static bool 3461 + skl_ddb_allocation_included(const struct skl_ddb_allocation *old, 3462 + const struct skl_ddb_allocation *new, 3463 + enum pipe pipe) 3464 + { 3465 + uint16_t old_size, new_size; 3466 + 3467 + old_size = skl_ddb_entry_size(&old->pipe[pipe]); 3468 + new_size = skl_ddb_entry_size(&new->pipe[pipe]); 3469 + 3470 + return old_size != new_size && 3471 + new->pipe[pipe].start >= old->pipe[pipe].start && 3472 + new->pipe[pipe].end <= old->pipe[pipe].end; 3473 + } 3474 + 3475 + static void skl_flush_wm_values(struct drm_i915_private *dev_priv, 3476 + struct skl_wm_values *new_values) 3477 + { 3478 + struct drm_device *dev = dev_priv->dev; 3479 + struct skl_ddb_allocation *cur_ddb, *new_ddb; 3480 + bool reallocated[I915_MAX_PIPES] = {false, false, false}; 3481 + struct intel_crtc *crtc; 3482 + enum pipe pipe; 3483 + 3484 + new_ddb = &new_values->ddb; 3485 + cur_ddb = &dev_priv->wm.skl_hw.ddb; 3486 + 3487 + /* 3488 + * First pass: flush the pipes with the new allocation contained into 3489 + * the old space. 3490 + * 3491 + * We'll wait for the vblank on those pipes to ensure we can safely 3492 + * re-allocate the freed space without this pipe fetching from it. 3493 + */ 3494 + for_each_intel_crtc(dev, crtc) { 3495 + if (!crtc->active) 3496 + continue; 3497 + 3498 + pipe = crtc->pipe; 3499 + 3500 + if (!skl_ddb_allocation_included(cur_ddb, new_ddb, pipe)) 3501 + continue; 3502 + 3503 + skl_wm_flush_pipe(dev_priv, pipe, 1); 3504 + intel_wait_for_vblank(dev, pipe); 3505 + 3506 + reallocated[pipe] = true; 3507 + } 3508 + 3509 + 3510 + /* 3511 + * Second pass: flush the pipes that are having their allocation 3512 + * reduced, but overlapping with a previous allocation. 3513 + * 3514 + * Here as well we need to wait for the vblank to make sure the freed 3515 + * space is not used anymore. 3516 + */ 3517 + for_each_intel_crtc(dev, crtc) { 3518 + if (!crtc->active) 3519 + continue; 3520 + 3521 + pipe = crtc->pipe; 3522 + 3523 + if (reallocated[pipe]) 3524 + continue; 3525 + 3526 + if (skl_ddb_entry_size(&new_ddb->pipe[pipe]) < 3527 + skl_ddb_entry_size(&cur_ddb->pipe[pipe])) { 3528 + skl_wm_flush_pipe(dev_priv, pipe, 2); 3529 + intel_wait_for_vblank(dev, pipe); 3530 + } 3531 + 3532 + reallocated[pipe] = true; 3533 + } 3534 + 3535 + /* 3536 + * Third pass: flush the pipes that got more space allocated. 3537 + * 3538 + * We don't need to actively wait for the update here, next vblank 3539 + * will just get more DDB space with the correct WM values. 3540 + */ 3541 + for_each_intel_crtc(dev, crtc) { 3542 + if (!crtc->active) 3543 + continue; 3544 + 3545 + pipe = crtc->pipe; 3546 + 3547 + /* 3548 + * At this point, only the pipes more space than before are 3549 + * left to re-allocate. 3550 + */ 3551 + if (reallocated[pipe]) 3552 + continue; 3553 + 3554 + skl_wm_flush_pipe(dev_priv, pipe, 3); 3555 + } 3556 + } 3557 + 3558 + static bool skl_update_pipe_wm(struct drm_crtc *crtc, 3559 + struct skl_pipe_wm_parameters *params, 3560 + struct intel_wm_config *config, 3561 + struct skl_ddb_allocation *ddb, /* out */ 3562 + struct skl_pipe_wm *pipe_wm /* out */) 3563 + { 3564 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3565 + 3566 + skl_compute_wm_pipe_parameters(crtc, params); 3567 + skl_allocate_pipe_ddb(crtc, config, params, ddb); 3568 + skl_compute_pipe_wm(crtc, ddb, params, pipe_wm); 3569 + 3570 + if (!memcmp(&intel_crtc->wm.skl_active, pipe_wm, sizeof(*pipe_wm))) 3571 + return false; 3572 + 3573 + intel_crtc->wm.skl_active = *pipe_wm; 3574 + return true; 3575 + } 3576 + 3577 + static void skl_update_other_pipe_wm(struct drm_device *dev, 3578 + struct drm_crtc *crtc, 3579 + struct intel_wm_config *config, 3580 + struct skl_wm_values *r) 3581 + { 3582 + struct intel_crtc *intel_crtc; 3583 + struct intel_crtc *this_crtc = to_intel_crtc(crtc); 3584 + 3585 + /* 3586 + * If the WM update hasn't changed the allocation for this_crtc (the 3587 + * crtc we are currently computing the new WM values for), other 3588 + * enabled crtcs will keep the same allocation and we don't need to 3589 + * recompute anything for them. 3590 + */ 3591 + if (!skl_ddb_allocation_changed(&r->ddb, this_crtc)) 3592 + return; 3593 + 3594 + /* 3595 + * Otherwise, because of this_crtc being freshly enabled/disabled, the 3596 + * other active pipes need new DDB allocation and WM values. 3597 + */ 3598 + list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, 3599 + base.head) { 3600 + struct skl_pipe_wm_parameters params = {}; 3601 + struct skl_pipe_wm pipe_wm = {}; 3602 + bool wm_changed; 3603 + 3604 + if (this_crtc->pipe == intel_crtc->pipe) 3605 + continue; 3606 + 3607 + if (!intel_crtc->active) 3608 + continue; 3609 + 3610 + wm_changed = skl_update_pipe_wm(&intel_crtc->base, 3611 + &params, config, 3612 + &r->ddb, &pipe_wm); 3613 + 3614 + /* 3615 + * If we end up re-computing the other pipe WM values, it's 3616 + * because it was really needed, so we expect the WM values to 3617 + * be different. 3618 + */ 3619 + WARN_ON(!wm_changed); 3620 + 3621 + skl_compute_wm_results(dev, &params, &pipe_wm, r, intel_crtc); 3622 + r->dirty[intel_crtc->pipe] = true; 3623 + } 3624 + } 3625 + 3626 + static void skl_update_wm(struct drm_crtc *crtc) 3627 + { 3628 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3629 + struct drm_device *dev = crtc->dev; 3630 + struct drm_i915_private *dev_priv = dev->dev_private; 3631 + struct skl_pipe_wm_parameters params = {}; 3632 + struct skl_wm_values *results = &dev_priv->wm.skl_results; 3633 + struct skl_pipe_wm pipe_wm = {}; 3634 + struct intel_wm_config config = {}; 3635 + 3636 + memset(results, 0, sizeof(*results)); 3637 + 3638 + skl_compute_wm_global_parameters(dev, &config); 3639 + 3640 + if (!skl_update_pipe_wm(crtc, &params, &config, 3641 + &results->ddb, &pipe_wm)) 3642 + return; 3643 + 3644 + skl_compute_wm_results(dev, &params, &pipe_wm, results, intel_crtc); 3645 + results->dirty[intel_crtc->pipe] = true; 3646 + 3647 + skl_update_other_pipe_wm(dev, crtc, &config, results); 3648 + skl_write_wm_values(dev_priv, results); 3649 + skl_flush_wm_values(dev_priv, results); 3650 + 3651 + /* store the new configuration */ 3652 + dev_priv->wm.skl_hw = *results; 3653 + } 3654 + 3655 + static void 3656 + skl_update_sprite_wm(struct drm_plane *plane, struct drm_crtc *crtc, 3657 + uint32_t sprite_width, uint32_t sprite_height, 3658 + int pixel_size, bool enabled, bool scaled) 3659 + { 3660 + struct intel_plane *intel_plane = to_intel_plane(plane); 3661 + 3662 + intel_plane->wm.enabled = enabled; 3663 + intel_plane->wm.scaled = scaled; 3664 + intel_plane->wm.horiz_pixels = sprite_width; 3665 + intel_plane->wm.vert_pixels = sprite_height; 3666 + intel_plane->wm.bytes_per_pixel = pixel_size; 3667 + 3668 + skl_update_wm(crtc); 3669 + } 3670 + 3002 3671 static void ilk_update_wm(struct drm_crtc *crtc) 3003 3672 { 3004 3673 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); ··· 3834 2977 intel_wait_for_vblank(dev, intel_plane->pipe); 3835 2978 3836 2979 ilk_update_wm(crtc); 2980 + } 2981 + 2982 + static void skl_pipe_wm_active_state(uint32_t val, 2983 + struct skl_pipe_wm *active, 2984 + bool is_transwm, 2985 + bool is_cursor, 2986 + int i, 2987 + int level) 2988 + { 2989 + bool is_enabled = (val & PLANE_WM_EN) != 0; 2990 + 2991 + if (!is_transwm) { 2992 + if (!is_cursor) { 2993 + active->wm[level].plane_en[i] = is_enabled; 2994 + active->wm[level].plane_res_b[i] = 2995 + val & PLANE_WM_BLOCKS_MASK; 2996 + active->wm[level].plane_res_l[i] = 2997 + (val >> PLANE_WM_LINES_SHIFT) & 2998 + PLANE_WM_LINES_MASK; 2999 + } else { 3000 + active->wm[level].cursor_en = is_enabled; 3001 + active->wm[level].cursor_res_b = 3002 + val & PLANE_WM_BLOCKS_MASK; 3003 + active->wm[level].cursor_res_l = 3004 + (val >> PLANE_WM_LINES_SHIFT) & 3005 + PLANE_WM_LINES_MASK; 3006 + } 3007 + } else { 3008 + if (!is_cursor) { 3009 + active->trans_wm.plane_en[i] = is_enabled; 3010 + active->trans_wm.plane_res_b[i] = 3011 + val & PLANE_WM_BLOCKS_MASK; 3012 + active->trans_wm.plane_res_l[i] = 3013 + (val >> PLANE_WM_LINES_SHIFT) & 3014 + PLANE_WM_LINES_MASK; 3015 + } else { 3016 + active->trans_wm.cursor_en = is_enabled; 3017 + active->trans_wm.cursor_res_b = 3018 + val & PLANE_WM_BLOCKS_MASK; 3019 + active->trans_wm.cursor_res_l = 3020 + (val >> PLANE_WM_LINES_SHIFT) & 3021 + PLANE_WM_LINES_MASK; 3022 + } 3023 + } 3024 + } 3025 + 3026 + static void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc) 3027 + { 3028 + struct drm_device *dev = crtc->dev; 3029 + struct drm_i915_private *dev_priv = dev->dev_private; 3030 + struct skl_wm_values *hw = &dev_priv->wm.skl_hw; 3031 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3032 + struct skl_pipe_wm *active = &intel_crtc->wm.skl_active; 3033 + enum pipe pipe = intel_crtc->pipe; 3034 + int level, i, max_level; 3035 + uint32_t temp; 3036 + 3037 + max_level = ilk_wm_max_level(dev); 3038 + 3039 + hw->wm_linetime[pipe] = I915_READ(PIPE_WM_LINETIME(pipe)); 3040 + 3041 + for (level = 0; level <= max_level; level++) { 3042 + for (i = 0; i < intel_num_planes(intel_crtc); i++) 3043 + hw->plane[pipe][i][level] = 3044 + I915_READ(PLANE_WM(pipe, i, level)); 3045 + hw->cursor[pipe][level] = I915_READ(CUR_WM(pipe, level)); 3046 + } 3047 + 3048 + for (i = 0; i < intel_num_planes(intel_crtc); i++) 3049 + hw->plane_trans[pipe][i] = I915_READ(PLANE_WM_TRANS(pipe, i)); 3050 + hw->cursor_trans[pipe] = I915_READ(CUR_WM_TRANS(pipe)); 3051 + 3052 + if (!intel_crtc_active(crtc)) 3053 + return; 3054 + 3055 + hw->dirty[pipe] = true; 3056 + 3057 + active->linetime = hw->wm_linetime[pipe]; 3058 + 3059 + for (level = 0; level <= max_level; level++) { 3060 + for (i = 0; i < intel_num_planes(intel_crtc); i++) { 3061 + temp = hw->plane[pipe][i][level]; 3062 + skl_pipe_wm_active_state(temp, active, false, 3063 + false, i, level); 3064 + } 3065 + temp = hw->cursor[pipe][level]; 3066 + skl_pipe_wm_active_state(temp, active, false, true, i, level); 3067 + } 3068 + 3069 + for (i = 0; i < intel_num_planes(intel_crtc); i++) { 3070 + temp = hw->plane_trans[pipe][i]; 3071 + skl_pipe_wm_active_state(temp, active, true, false, i, 0); 3072 + } 3073 + 3074 + temp = hw->cursor_trans[pipe]; 3075 + skl_pipe_wm_active_state(temp, active, true, true, i, 0); 3076 + } 3077 + 3078 + void skl_wm_get_hw_state(struct drm_device *dev) 3079 + { 3080 + struct drm_i915_private *dev_priv = dev->dev_private; 3081 + struct skl_ddb_allocation *ddb = &dev_priv->wm.skl_hw.ddb; 3082 + struct drm_crtc *crtc; 3083 + 3084 + skl_ddb_get_hw_state(dev_priv, ddb); 3085 + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 3086 + skl_pipe_wm_get_hw_state(crtc); 3837 3087 } 3838 3088 3839 3089 static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc) ··· 4539 3575 I915_WRITE(GEN8_GT_IIR(2), dev_priv->pm_rps_events); 4540 3576 } 4541 3577 3578 + static void gen9_disable_rps(struct drm_device *dev) 3579 + { 3580 + struct drm_i915_private *dev_priv = dev->dev_private; 3581 + 3582 + I915_WRITE(GEN6_RC_CONTROL, 0); 3583 + } 3584 + 4542 3585 static void gen6_disable_rps_interrupts(struct drm_device *dev) 4543 3586 { 4544 3587 struct drm_i915_private *dev_priv = dev->dev_private; ··· 4704 3733 4705 3734 if (dev_priv->rps.min_freq_softlimit == 0) 4706 3735 dev_priv->rps.min_freq_softlimit = dev_priv->rps.min_freq; 3736 + } 3737 + 3738 + static void gen9_enable_rps(struct drm_device *dev) 3739 + { 3740 + struct drm_i915_private *dev_priv = dev->dev_private; 3741 + struct intel_engine_cs *ring; 3742 + uint32_t rc6_mask = 0; 3743 + int unused; 3744 + 3745 + /* 1a: Software RC state - RC0 */ 3746 + I915_WRITE(GEN6_RC_STATE, 0); 3747 + 3748 + /* 1b: Get forcewake during program sequence. Although the driver 3749 + * hasn't enabled a state yet where we need forcewake, BIOS may have.*/ 3750 + gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); 3751 + 3752 + /* 2a: Disable RC states. */ 3753 + I915_WRITE(GEN6_RC_CONTROL, 0); 3754 + 3755 + /* 2b: Program RC6 thresholds.*/ 3756 + I915_WRITE(GEN6_RC6_WAKE_RATE_LIMIT, 54 << 16); 3757 + I915_WRITE(GEN6_RC_EVALUATION_INTERVAL, 125000); /* 12500 * 1280ns */ 3758 + I915_WRITE(GEN6_RC_IDLE_HYSTERSIS, 25); /* 25 * 1280ns */ 3759 + for_each_ring(ring, dev_priv, unused) 3760 + I915_WRITE(RING_MAX_IDLE(ring->mmio_base), 10); 3761 + I915_WRITE(GEN6_RC_SLEEP, 0); 3762 + I915_WRITE(GEN6_RC6_THRESHOLD, 37500); /* 37.5/125ms per EI */ 3763 + 3764 + /* 3a: Enable RC6 */ 3765 + if (intel_enable_rc6(dev) & INTEL_RC6_ENABLE) 3766 + rc6_mask = GEN6_RC_CTL_RC6_ENABLE; 3767 + DRM_INFO("RC6 %s\n", (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? 3768 + "on" : "off"); 3769 + I915_WRITE(GEN6_RC_CONTROL, GEN6_RC_CTL_HW_ENABLE | 3770 + GEN6_RC_CTL_EI_MODE(1) | 3771 + rc6_mask); 3772 + 3773 + gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL); 3774 + 4707 3775 } 4708 3776 4709 3777 static void gen8_enable_rps(struct drm_device *dev) ··· 6279 5269 intel_suspend_gt_powersave(dev); 6280 5270 6281 5271 mutex_lock(&dev_priv->rps.hw_lock); 6282 - if (IS_CHERRYVIEW(dev)) 5272 + if (INTEL_INFO(dev)->gen >= 9) 5273 + gen9_disable_rps(dev); 5274 + else if (IS_CHERRYVIEW(dev)) 6283 5275 cherryview_disable_rps(dev); 6284 5276 else if (IS_VALLEYVIEW(dev)) 6285 5277 valleyview_disable_rps(dev); ··· 6305 5293 cherryview_enable_rps(dev); 6306 5294 } else if (IS_VALLEYVIEW(dev)) { 6307 5295 valleyview_enable_rps(dev); 5296 + } else if (INTEL_INFO(dev)->gen >= 9) { 5297 + gen9_enable_rps(dev); 6308 5298 } else if (IS_BROADWELL(dev)) { 6309 5299 gen8_enable_rps(dev); 6310 5300 __gen6_update_ring_freq(dev); ··· 7141 6127 7142 6128 /* For FIFO watermark updates */ 7143 6129 if (IS_GEN9(dev)) { 6130 + skl_setup_wm_latency(dev); 6131 + 7144 6132 dev_priv->display.init_clock_gating = gen9_init_clock_gating; 6133 + dev_priv->display.update_wm = skl_update_wm; 6134 + dev_priv->display.update_sprite_wm = skl_update_sprite_wm; 7145 6135 } else if (HAS_PCH_SPLIT(dev)) { 7146 6136 ilk_setup_wm_latency(dev); 7147 6137 ··· 7237 6219 } 7238 6220 7239 6221 I915_WRITE(GEN6_PCODE_DATA, *val); 6222 + if (INTEL_INFO(dev_priv)->gen >= 9) 6223 + I915_WRITE(GEN9_PCODE_DATA1, 0); 7240 6224 I915_WRITE(GEN6_PCODE_MAILBOX, GEN6_PCODE_READY | mbox); 7241 6225 7242 6226 if (wait_for((I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) == 0,
+1
drivers/gpu/drm/i915/intel_renderstate.h
··· 29 29 extern const struct intel_renderstate_rodata gen6_null_state; 30 30 extern const struct intel_renderstate_rodata gen7_null_state; 31 31 extern const struct intel_renderstate_rodata gen8_null_state; 32 + extern const struct intel_renderstate_rodata gen9_null_state; 32 33 33 34 #define RO_RENDERSTATE(_g) \ 34 35 const struct intel_renderstate_rodata gen ## _g ## _null_state = { \
+832 -354
drivers/gpu/drm/i915/intel_renderstate_gen8.c
··· 1 1 #include "intel_renderstate.h" 2 2 3 3 static const u32 gen8_null_state_relocs[] = { 4 - 0x00000048, 5 - 0x00000050, 6 - 0x00000060, 7 - 0x000003ec, 4 + 0x00000798, 5 + 0x000007a4, 6 + 0x000007ac, 7 + 0x000007bc, 8 8 -1, 9 9 }; 10 10 11 11 static const u32 gen8_null_state_batch[] = { 12 + 0x7a000004, 13 + 0x01000000, 14 + 0x00000000, 15 + 0x00000000, 16 + 0x00000000, 17 + 0x00000000, 12 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, 14 132 0x00000000, 15 133 0x00000000, 16 134 0x79120000, ··· 141 23 0x00000000, 142 24 0x79160000, 143 25 0x00000000, 144 - 0x6101000e, 145 - 0x00000001, 146 - 0x00000000, 147 - 0x00000001, 148 - 0x00000001, /* reloc */ 149 - 0x00000000, 150 - 0x00000001, /* reloc */ 26 + 0x78150009, 151 27 0x00000000, 152 28 0x00000000, 153 29 0x00000000, 154 - 0x00000001, /* reloc */ 155 30 0x00000000, 156 - 0xfffff001, 157 - 0x00001001, 158 - 0xfffff001, 159 - 0x00001001, 160 - 0x78230000, 161 - 0x000006e0, 162 - 0x78210000, 163 - 0x00000700, 164 - 0x78300000, 165 - 0x08010040, 166 - 0x78330000, 167 - 0x08000000, 168 - 0x78310000, 169 - 0x08000000, 170 - 0x78320000, 171 - 0x08000000, 172 - 0x78240000, 173 - 0x00000641, 174 - 0x780e0000, 175 - 0x00000601, 176 - 0x780d0000, 177 31 0x00000000, 178 - 0x78180000, 179 - 0x00000001, 180 - 0x78520003, 32 + 0x00000000, 181 33 0x00000000, 182 34 0x00000000, 183 35 0x00000000, ··· 163 75 0x00000000, 164 76 0x00000000, 165 77 0x00000000, 166 - 0x781b0007, 78 + 0x781a0009, 167 79 0x00000000, 168 80 0x00000000, 169 81 0x00000000, ··· 171 83 0x00000000, 172 84 0x00000000, 173 85 0x00000000, 174 - 0x00000000, 175 - 0x78270000, 176 - 0x00000000, 177 - 0x782c0000, 178 - 0x00000000, 179 - 0x781c0002, 180 86 0x00000000, 181 87 0x00000000, 182 88 0x00000000, ··· 185 103 0x00000000, 186 104 0x00000000, 187 105 0x00000000, 188 - 0x78110008, 189 - 0x00000000, 190 - 0x00000000, 191 - 0x00000000, 192 - 0x00000000, 193 - 0x00000000, 194 - 0x00000000, 195 - 0x00000000, 196 - 0x00000000, 197 - 0x00000000, 198 - 0x78290000, 199 - 0x00000000, 200 - 0x782e0000, 201 - 0x00000000, 202 - 0x781a0009, 203 - 0x00000000, 204 - 0x00000000, 205 - 0x00000000, 206 - 0x00000000, 207 - 0x00000000, 208 - 0x00000000, 209 - 0x00000000, 210 - 0x00000000, 211 - 0x00000000, 212 - 0x00000000, 213 - 0x781d0007, 214 - 0x00000000, 215 - 0x00000000, 216 - 0x00000000, 217 - 0x00000000, 218 - 0x00000000, 219 - 0x00000000, 220 - 0x00000000, 221 - 0x00000000, 222 - 0x78280000, 223 - 0x00000000, 224 - 0x782d0000, 225 - 0x00000000, 226 - 0x78260000, 227 - 0x00000000, 228 - 0x782b0000, 229 - 0x00000000, 230 - 0x78150009, 231 - 0x00000000, 232 - 0x00000000, 233 - 0x00000000, 234 - 0x00000000, 235 - 0x00000000, 236 - 0x00000000, 237 - 0x00000000, 238 - 0x00000000, 239 - 0x00000000, 240 - 0x00000000, 241 - 0x78100007, 242 - 0x00000000, 243 - 0x00000000, 244 - 0x00000000, 245 - 0x00000000, 246 - 0x00000000, 247 - 0x00000000, 248 - 0x00000000, 249 - 0x00000000, 250 - 0x781e0003, 251 - 0x00000000, 252 - 0x00000000, 253 - 0x00000000, 254 - 0x00000000, 255 - 0x78120002, 256 - 0x00000000, 257 - 0x00000000, 258 - 0x00000000, 259 - 0x781f0002, 260 - 0x30400820, 261 - 0x00000000, 262 - 0x00000000, 263 - 0x78510009, 264 - 0x00000000, 265 - 0x00000000, 266 - 0x00000000, 267 - 0x00000000, 268 - 0x00000000, 269 - 0x00000000, 270 - 0x00000000, 271 - 0x00000000, 272 - 0x00000000, 273 - 0x00000000, 274 - 0x78500003, 275 - 0x00210000, 276 - 0x00000000, 277 - 0x00000000, 278 - 0x00000000, 279 - 0x78130002, 280 - 0x00000000, 281 - 0x00000000, 282 - 0x00000000, 283 - 0x782a0000, 284 - 0x00000480, 285 - 0x782f0000, 286 - 0x00000540, 287 - 0x78140000, 288 - 0x00000800, 289 106 0x78170009, 290 107 0x00000000, 291 108 0x00000000, ··· 196 215 0x00000000, 197 216 0x00000000, 198 217 0x00000000, 199 - 0x7820000a, 200 - 0x00000580, 201 - 0x00000000, 202 - 0x08080000, 218 + 0x78490001, 203 219 0x00000000, 204 220 0x00000000, 205 - 0x1f000002, 206 - 0x00060000, 221 + 0x784a0000, 222 + 0x00000000, 223 + 0x784b0000, 224 + 0x00000004, 225 + 0x79170101, 226 + 0x00000000, 227 + 0x00000080, 207 228 0x00000000, 208 229 0x00000000, 209 230 0x00000000, 210 231 0x00000000, 211 - 0x784d0000, 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 + 0x00000000, 470 + 0x00000000, 471 + 0x00000000, 472 + 0x00000000, 473 + 0x00000000, 474 + 0x00000000, 475 + 0x00000000, 476 + 0x00000000, 477 + 0x00000000, 478 + 0x00000000, 479 + 0x00000000, 480 + 0x00000000, 481 + 0x00000000, 482 + 0x00000000, 483 + 0x00000000, 484 + 0x79180006, 485 + 0x00000000, 486 + 0x00000000, 487 + 0x00000000, 488 + 0x00000000, 489 + 0x00000000, 490 + 0x00000000, 491 + 0x00000000, 492 + 0x79180006, 493 + 0x20000000, 494 + 0x00000000, 495 + 0x00000000, 496 + 0x00000000, 497 + 0x00000000, 498 + 0x00000000, 499 + 0x00000000, 500 + 0x79180006, 212 501 0x40000000, 213 - 0x784f0000, 214 - 0x80000100, 215 - 0x780f0000, 216 - 0x00000740, 502 + 0x00000000, 503 + 0x00000000, 504 + 0x00000000, 505 + 0x00000000, 506 + 0x00000000, 507 + 0x00000000, 508 + 0x79180006, 509 + 0x60000000, 510 + 0x00000000, 511 + 0x00000000, 512 + 0x00000000, 513 + 0x00000000, 514 + 0x00000000, 515 + 0x00000000, 516 + 0x6101000e, 517 + 0x00000001, /* reloc */ 518 + 0x00000000, 519 + 0x00000000, 520 + 0x00000001, /* reloc */ 521 + 0x00000000, 522 + 0x00000001, /* reloc */ 523 + 0x00000000, 524 + 0x00000001, 525 + 0x00000000, 526 + 0x00000001, /* reloc */ 527 + 0x00000000, 528 + 0x00001001, 529 + 0x00001001, 530 + 0x00000001, 531 + 0x00001001, 532 + 0x61020001, 533 + 0x00000000, 534 + 0x00000000, 535 + 0x79000002, 536 + 0x00000000, 537 + 0x00000000, 538 + 0x00000000, 217 539 0x78050006, 218 540 0x00000000, 219 541 0x00000000, 220 542 0x00000000, 543 + 0x00000000, 544 + 0x00000000, 545 + 0x00000000, 546 + 0x00000000, 547 + 0x79040002, 548 + 0x00000000, 549 + 0x00000000, 550 + 0x00000000, 551 + 0x79040002, 552 + 0x40000000, 553 + 0x00000000, 554 + 0x00000000, 555 + 0x79040002, 556 + 0x80000000, 557 + 0x00000000, 558 + 0x00000000, 559 + 0x79040002, 560 + 0xc0000000, 561 + 0x00000000, 562 + 0x00000000, 563 + 0x79080001, 564 + 0x00000000, 565 + 0x00000000, 566 + 0x790a0001, 567 + 0x00000000, 568 + 0x00000000, 569 + 0x78060003, 221 570 0x00000000, 222 571 0x00000000, 223 572 0x00000000, ··· 557 246 0x00000000, 558 247 0x00000000, 559 248 0x00000000, 560 - 0x78060003, 561 - 0x00000000, 562 - 0x00000000, 563 - 0x00000000, 564 - 0x00000000, 565 249 0x78040001, 566 250 0x00000000, 567 - 0x00000001, 568 - 0x79000002, 569 - 0xffffffff, 251 + 0x00000000, 252 + 0x79110000, 253 + 0x00000000, 254 + 0x780d0000, 255 + 0x00000000, 256 + 0x79060000, 257 + 0x00000000, 258 + 0x7907001f, 570 259 0x00000000, 571 260 0x00000000, 572 - 0x78080003, 573 - 0x00006000, 574 - 0x000005e0, /* reloc */ 575 261 0x00000000, 576 262 0x00000000, 577 - 0x78090005, 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 + 0x7902000f, 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 + 0x790c000f, 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 + 0x780a0003, 326 + 0x00000000, 327 + 0x00000000, 328 + 0x00000000, 329 + 0x00000000, 330 + 0x78080083, 331 + 0x00004000, 332 + 0x00000000, 333 + 0x00000000, 334 + 0x00000000, 335 + 0x04004000, 336 + 0x00000000, 337 + 0x00000000, 338 + 0x00000000, 339 + 0x08004000, 340 + 0x00000000, 341 + 0x00000000, 342 + 0x00000000, 343 + 0x0c004000, 344 + 0x00000000, 345 + 0x00000000, 346 + 0x00000000, 347 + 0x10004000, 348 + 0x00000000, 349 + 0x00000000, 350 + 0x00000000, 351 + 0x14004000, 352 + 0x00000000, 353 + 0x00000000, 354 + 0x00000000, 355 + 0x18004000, 356 + 0x00000000, 357 + 0x00000000, 358 + 0x00000000, 359 + 0x1c004000, 360 + 0x00000000, 361 + 0x00000000, 362 + 0x00000000, 363 + 0x20004000, 364 + 0x00000000, 365 + 0x00000000, 366 + 0x00000000, 367 + 0x24004000, 368 + 0x00000000, 369 + 0x00000000, 370 + 0x00000000, 371 + 0x28004000, 372 + 0x00000000, 373 + 0x00000000, 374 + 0x00000000, 375 + 0x2c004000, 376 + 0x00000000, 377 + 0x00000000, 378 + 0x00000000, 379 + 0x30004000, 380 + 0x00000000, 381 + 0x00000000, 382 + 0x00000000, 383 + 0x34004000, 384 + 0x00000000, 385 + 0x00000000, 386 + 0x00000000, 387 + 0x38004000, 388 + 0x00000000, 389 + 0x00000000, 390 + 0x00000000, 391 + 0x3c004000, 392 + 0x00000000, 393 + 0x00000000, 394 + 0x00000000, 395 + 0x40004000, 396 + 0x00000000, 397 + 0x00000000, 398 + 0x00000000, 399 + 0x44004000, 400 + 0x00000000, 401 + 0x00000000, 402 + 0x00000000, 403 + 0x48004000, 404 + 0x00000000, 405 + 0x00000000, 406 + 0x00000000, 407 + 0x4c004000, 408 + 0x00000000, 409 + 0x00000000, 410 + 0x00000000, 411 + 0x50004000, 412 + 0x00000000, 413 + 0x00000000, 414 + 0x00000000, 415 + 0x54004000, 416 + 0x00000000, 417 + 0x00000000, 418 + 0x00000000, 419 + 0x58004000, 420 + 0x00000000, 421 + 0x00000000, 422 + 0x00000000, 423 + 0x5c004000, 424 + 0x00000000, 425 + 0x00000000, 426 + 0x00000000, 427 + 0x60004000, 428 + 0x00000000, 429 + 0x00000000, 430 + 0x00000000, 431 + 0x64004000, 432 + 0x00000000, 433 + 0x00000000, 434 + 0x00000000, 435 + 0x68004000, 436 + 0x00000000, 437 + 0x00000000, 438 + 0x00000000, 439 + 0x6c004000, 440 + 0x00000000, 441 + 0x00000000, 442 + 0x00000000, 443 + 0x70004000, 444 + 0x00000000, 445 + 0x00000000, 446 + 0x00000000, 447 + 0x74004000, 448 + 0x00000000, 449 + 0x00000000, 450 + 0x00000000, 451 + 0x78004000, 452 + 0x00000000, 453 + 0x00000000, 454 + 0x00000000, 455 + 0x7c004000, 456 + 0x00000000, 457 + 0x00000000, 458 + 0x00000000, 459 + 0x80004000, 460 + 0x00000000, 461 + 0x00000000, 462 + 0x00000000, 463 + 0x78090043, 578 464 0x02000000, 579 465 0x22220000, 580 - 0x02f60000, 581 - 0x11230000, 582 - 0x02850004, 583 - 0x11230000, 584 - 0x784b0000, 585 - 0x0000000f, 586 - 0x78490001, 587 466 0x00000000, 588 467 0x00000000, 468 + 0x00000000, 469 + 0x00000000, 470 + 0x00000000, 471 + 0x00000000, 472 + 0x00000000, 473 + 0x00000000, 474 + 0x00000000, 475 + 0x00000000, 476 + 0x00000000, 477 + 0x00000000, 478 + 0x00000000, 479 + 0x00000000, 480 + 0x00000000, 481 + 0x00000000, 482 + 0x00000000, 483 + 0x00000000, 484 + 0x00000000, 485 + 0x00000000, 486 + 0x00000000, 487 + 0x00000000, 488 + 0x00000000, 489 + 0x00000000, 490 + 0x00000000, 491 + 0x00000000, 492 + 0x00000000, 493 + 0x00000000, 494 + 0x00000000, 495 + 0x00000000, 496 + 0x00000000, 497 + 0x00000000, 498 + 0x00000000, 499 + 0x00000000, 500 + 0x00000000, 501 + 0x00000000, 502 + 0x00000000, 503 + 0x00000000, 504 + 0x00000000, 505 + 0x00000000, 506 + 0x00000000, 507 + 0x00000000, 508 + 0x00000000, 509 + 0x00000000, 510 + 0x00000000, 511 + 0x00000000, 512 + 0x00000000, 513 + 0x00000000, 514 + 0x00000000, 515 + 0x00000000, 516 + 0x00000000, 517 + 0x00000000, 518 + 0x00000000, 519 + 0x00000000, 520 + 0x00000000, 521 + 0x00000000, 522 + 0x00000000, 523 + 0x00000000, 524 + 0x00000000, 525 + 0x00000000, 526 + 0x00000000, 527 + 0x00000000, 528 + 0x00000000, 529 + 0x00000000, 530 + 0x00000000, 531 + 0x00000000, 532 + 0x680b0001, 533 + 0x78260000, 534 + 0x00000000, 535 + 0x78270000, 536 + 0x00000000, 537 + 0x78280000, 538 + 0x00000000, 539 + 0x78290000, 540 + 0x00000000, 541 + 0x782a0000, 542 + 0x00000000, 543 + 0x780e0000, 544 + 0x00000dc1, 545 + 0x78240000, 546 + 0x00000e01, 547 + 0x784f0000, 548 + 0x80000100, 549 + 0x784d0000, 550 + 0x40000000, 551 + 0x782b0000, 552 + 0x00000000, 553 + 0x782c0000, 554 + 0x00000000, 555 + 0x782d0000, 556 + 0x00000000, 557 + 0x782e0000, 558 + 0x00000000, 559 + 0x782f0000, 560 + 0x00000000, 561 + 0x780f0000, 562 + 0x00000000, 563 + 0x78230000, 564 + 0x00000e60, 565 + 0x78210000, 566 + 0x00000e80, 589 567 0x7b000005, 590 - 0x00000000, 591 - 0x00000003, 568 + 0x00000004, 569 + 0x00000001, 592 570 0x00000000, 593 571 0x00000001, 594 572 0x00000000, ··· 889 289 0x00000000, 890 290 0x00000000, 891 291 0x00000000, 892 - 0x00000000, 893 - 0x00000000, 894 - 0x00000000, 895 - 0x00000000, 896 - 0x00000000, 897 - 0x00000000, 898 - 0x00000000, 899 - 0x00000000, 900 - 0x000004c0, /* state start */ 901 - 0x00000500, 902 - 0x00000000, 903 - 0x00000000, 904 - 0x00000000, 905 - 0x00000000, 906 - 0x00000000, 907 - 0x00000000, 908 - 0x00000000, 909 - 0x00000000, 910 - 0x00000000, 911 - 0x00000000, 912 - 0x00000000, 913 - 0x00000000, 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 - 0x00000092, 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 - 0x0060005a, 965 - 0x21403ae8, 966 - 0x3a0000c0, 967 - 0x008d0040, 968 - 0x0060005a, 969 - 0x21603ae8, 970 - 0x3a0000c0, 971 - 0x008d0080, 972 - 0x0060005a, 973 - 0x21803ae8, 974 - 0x3a0000d0, 975 - 0x008d0040, 976 - 0x0060005a, 977 - 0x21a03ae8, 978 - 0x3a0000d0, 979 - 0x008d0080, 980 - 0x02800031, 981 - 0x2e0022e8, 982 - 0x0e000140, 983 - 0x08840001, 984 - 0x05800031, 985 - 0x200022e0, 986 - 0x0e000e00, 987 - 0x90031000, 988 - 0x00000000, 989 - 0x00000000, 990 - 0x00000000, 991 - 0x00000000, 992 - 0x00000000, 993 - 0x00000000, 994 - 0x00000000, 995 - 0x00000000, 996 - 0x00000000, 997 - 0x00000000, 998 - 0x00000000, 999 - 0x00000000, 1000 - 0x00000000, 1001 - 0x00000000, 1002 - 0x00000000, 1003 - 0x00000000, 1004 - 0x00000000, 1005 - 0x00000000, 1006 - 0x00000000, 1007 - 0x00000000, 1008 - 0x00000000, 1009 - 0x00000000, 1010 - 0x00000000, 1011 - 0x00000000, 1012 - 0x00000000, 1013 - 0x06200000, 1014 - 0x00000002, 1015 - 0x06200000, 1016 - 0x00000002, 1017 - 0x06200000, 1018 - 0x00000002, 1019 - 0x06200000, 1020 - 0x00000002, 1021 - 0x06200000, 1022 - 0x00000002, 1023 - 0x06200000, 1024 - 0x00000002, 1025 - 0x06200000, 1026 - 0x00000002, 1027 - 0x06200000, 1028 - 0x00000002, 1029 - 0x06200000, 1030 - 0x00000002, 1031 - 0x06200000, 1032 - 0x00000002, 1033 - 0x06200000, 1034 - 0x00000002, 1035 - 0x06200000, 1036 - 0x00000002, 1037 - 0x06200000, 1038 - 0x00000002, 1039 - 0x06200000, 1040 - 0x00000002, 1041 - 0x06200000, 1042 - 0x00000002, 1043 - 0x06200000, 1044 - 0x00000002, 1045 - 0x00000000, 1046 - 0x00000000, 1047 - 0x00000000, 1048 - 0x00000000, 1049 - 0x00000000, 1050 - 0x00000000, 1051 - 0x00000000, 1052 - 0xf99a130c, 1053 - 0x799a130c, 1054 - 0x00000000, 1055 - 0x00000000, 1056 - 0x00000000, 1057 - 0x00000000, 1058 - 0x00000000, 1059 - 0x00000000, 1060 - 0x00000000, 1061 - 0x00000000, 1062 - 0x00000000, 1063 - 0x00000000, 1064 - 0x00000000, 1065 - 0x00000000, 1066 - 0x00000000, 1067 - 0x00000000, 292 + 0x00000000, /* state start */ 1068 293 0x00000000, 1069 294 0x3f800000, 1070 - 0x00000000, 1071 295 0x3f800000, 296 + 0x3f800000, 297 + 0x3f800000, 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, 1072 350 0x00000000, 1073 351 0x00000000, 1074 352 0x00000000,
+974
drivers/gpu/drm/i915/intel_renderstate_gen9.c
··· 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);
+5 -2
drivers/gpu/drm/i915/intel_ringbuffer.c
··· 1845 1845 1846 1846 void intel_cleanup_ring_buffer(struct intel_engine_cs *ring) 1847 1847 { 1848 - struct drm_i915_private *dev_priv = to_i915(ring->dev); 1849 - struct intel_ringbuffer *ringbuf = ring->buffer; 1848 + struct drm_i915_private *dev_priv; 1849 + struct intel_ringbuffer *ringbuf; 1850 1850 1851 1851 if (!intel_ring_initialized(ring)) 1852 1852 return; 1853 + 1854 + dev_priv = to_i915(ring->dev); 1855 + ringbuf = ring->buffer; 1853 1856 1854 1857 intel_stop_ring_buffer(ring); 1855 1858 WARN_ON(!IS_GEN2(ring->dev) && (I915_READ_MODE(ring) & MODE_IDLE) == 0);
+14 -6
drivers/gpu/drm/i915/intel_runtime_pm.c
··· 587 587 power_well->data != PIPE_C); 588 588 589 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 595 static void check_power_well_state(struct drm_i915_private *dev_priv, ··· 941 938 .data = PUNIT_POWER_WELL_DISP2D, 942 939 .ops = &vlv_display_power_well_ops, 943 940 }, 941 + #endif 944 942 { 945 943 .name = "pipe-a", 946 - .domains = CHV_PIPE_A_POWER_DOMAINS, 944 + /* 945 + * FIXME: pipe A power well seems to be the new disp2d well. 946 + * At least all registers seem to be housed there. Figure 947 + * out if this a a temporary situation in pre-production 948 + * hardware or a permanent state of affairs. 949 + */ 950 + .domains = CHV_PIPE_A_POWER_DOMAINS | VLV_DISPLAY_POWER_DOMAINS, 947 951 .data = PIPE_A, 948 952 .ops = &chv_pipe_power_well_ops, 949 953 }, 954 + #if 0 950 955 { 951 956 .name = "pipe-b", 952 957 .domains = CHV_PIPE_B_POWER_DOMAINS, ··· 1148 1137 struct i915_power_well *disp2d = 1149 1138 lookup_power_well(dev_priv, PUNIT_POWER_WELL_DISP2D); 1150 1139 1151 - /* nothing to do if common lane is already off */ 1152 - if (!cmn->ops->is_enabled(dev_priv, cmn)) 1153 - return; 1154 - 1155 1140 /* If the display might be already active skip this */ 1156 - if (disp2d->ops->is_enabled(dev_priv, disp2d) && 1141 + if (cmn->ops->is_enabled(dev_priv, cmn) && 1142 + disp2d->ops->is_enabled(dev_priv, disp2d) && 1157 1143 I915_READ(DPIO_CTL) & DPIO_CMNRST) 1158 1144 return; 1159 1145
+126 -44
drivers/gpu/drm/i915/intel_sprite.c
··· 37 37 #include <drm/i915_drm.h> 38 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 54 static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs) 41 55 { 42 56 /* paranoia */ ··· 60 46 return DIV_ROUND_UP(usecs * mode->crtc_clock, 1000 * mode->crtc_htotal); 61 47 } 62 48 63 - static bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl_count) 49 + /** 50 + * intel_pipe_update_start() - start update of a set of display registers 51 + * @crtc: the crtc of which the registers are going to be updated 52 + * @start_vbl_count: vblank counter return pointer used for error checking 53 + * 54 + * Mark the start of an update to pipe registers that should be updated 55 + * atomically regarding vblank. If the next vblank will happens within 56 + * the next 100 us, this function waits until the vblank passes. 57 + * 58 + * After a successful call to this function, interrupts will be disabled 59 + * until a subsequent call to intel_pipe_update_end(). That is done to 60 + * avoid random delays. The value written to @start_vbl_count should be 61 + * supplied to intel_pipe_update_end() for error checking. 62 + * 63 + * Return: true if the call was successful 64 + */ 65 + bool intel_pipe_update_start(struct intel_crtc *crtc, uint32_t *start_vbl_count) 64 66 { 65 67 struct drm_device *dev = crtc->base.dev; 66 68 const struct drm_display_mode *mode = &crtc->config.adjusted_mode; ··· 85 55 int scanline, min, max, vblank_start; 86 56 wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base); 87 57 DEFINE_WAIT(wait); 88 - 89 - WARN_ON(!drm_modeset_is_locked(&crtc->base.mutex)); 90 58 91 59 vblank_start = mode->crtc_vblank_start; 92 60 if (mode->flags & DRM_MODE_FLAG_INTERLACE) ··· 140 112 return true; 141 113 } 142 114 143 - static void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count) 115 + /** 116 + * intel_pipe_update_end() - end update of a set of display registers 117 + * @crtc: the crtc of which the registers were updated 118 + * @start_vbl_count: start vblank counter (used for error checking) 119 + * 120 + * Mark the end of an update started with intel_pipe_update_start(). This 121 + * re-enables interrupts and verifies the update was actually completed 122 + * before a vblank using the value of @start_vbl_count. 123 + */ 124 + void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count) 144 125 { 145 126 struct drm_device *dev = crtc->base.dev; 146 127 enum pipe pipe = crtc->pipe; ··· 357 320 } 358 321 359 322 static void 323 + chv_update_csc(struct intel_plane *intel_plane, uint32_t format) 324 + { 325 + struct drm_i915_private *dev_priv = intel_plane->base.dev->dev_private; 326 + int plane = intel_plane->plane; 327 + 328 + /* Seems RGB data bypasses the CSC always */ 329 + if (!format_is_yuv(format)) 330 + return; 331 + 332 + /* 333 + * BT.601 limited range YCbCr -> full range RGB 334 + * 335 + * |r| | 6537 4769 0| |cr | 336 + * |g| = |-3330 4769 -1605| x |y-64| 337 + * |b| | 0 4769 8263| |cb | 338 + * 339 + * Cb and Cr apparently come in as signed already, so no 340 + * need for any offset. For Y we need to remove the offset. 341 + */ 342 + I915_WRITE(SPCSCYGOFF(plane), SPCSC_OOFF(0) | SPCSC_IOFF(-64)); 343 + I915_WRITE(SPCSCCBOFF(plane), SPCSC_OOFF(0) | SPCSC_IOFF(0)); 344 + I915_WRITE(SPCSCCROFF(plane), SPCSC_OOFF(0) | SPCSC_IOFF(0)); 345 + 346 + I915_WRITE(SPCSCC01(plane), SPCSC_C1(4769) | SPCSC_C0(6537)); 347 + I915_WRITE(SPCSCC23(plane), SPCSC_C1(-3330) | SPCSC_C0(0)); 348 + I915_WRITE(SPCSCC45(plane), SPCSC_C1(-1605) | SPCSC_C0(4769)); 349 + I915_WRITE(SPCSCC67(plane), SPCSC_C1(4769) | SPCSC_C0(0)); 350 + I915_WRITE(SPCSCC8(plane), SPCSC_C0(8263)); 351 + 352 + I915_WRITE(SPCSCYGICLAMP(plane), SPCSC_IMAX(940) | SPCSC_IMIN(64)); 353 + I915_WRITE(SPCSCCBICLAMP(plane), SPCSC_IMAX(448) | SPCSC_IMIN(-448)); 354 + I915_WRITE(SPCSCCRICLAMP(plane), SPCSC_IMAX(448) | SPCSC_IMIN(-448)); 355 + 356 + I915_WRITE(SPCSCYGOCLAMP(plane), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); 357 + I915_WRITE(SPCSCCBOCLAMP(plane), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); 358 + I915_WRITE(SPCSCCROCLAMP(plane), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); 359 + } 360 + 361 + static void 360 362 vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, 361 363 struct drm_framebuffer *fb, 362 364 struct drm_i915_gem_object *obj, int crtc_x, int crtc_y, ··· 506 430 507 431 intel_update_primary_plane(intel_crtc); 508 432 433 + if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) 434 + chv_update_csc(intel_plane, fb->pixel_format); 435 + 509 436 I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]); 510 437 I915_WRITE(SPPOS(pipe, plane), (crtc_y << 16) | crtc_x); 511 438 ··· 516 437 I915_WRITE(SPTILEOFF(pipe, plane), (y << 16) | x); 517 438 else 518 439 I915_WRITE(SPLINOFF(pipe, plane), linear_offset); 440 + 441 + I915_WRITE(SPCONSTALPHA(pipe, plane), 0); 519 442 520 443 I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); 521 444 I915_WRITE(SPCNTR(pipe, plane), sprctl); ··· 1083 1002 key->flags = I915_SET_COLORKEY_NONE; 1084 1003 } 1085 1004 1086 - static bool 1087 - format_is_yuv(uint32_t format) 1088 - { 1089 - switch (format) { 1090 - case DRM_FORMAT_YUYV: 1091 - case DRM_FORMAT_UYVY: 1092 - case DRM_FORMAT_VYUY: 1093 - case DRM_FORMAT_YVYU: 1094 - return true; 1095 - default: 1096 - return false; 1097 - } 1098 - } 1099 - 1100 1005 static bool colorkey_enabled(struct intel_plane *intel_plane) 1101 1006 { 1102 1007 struct drm_intel_sprite_colorkey key; ··· 1099 1032 struct intel_crtc *intel_crtc = to_intel_crtc(state->crtc); 1100 1033 struct intel_plane *intel_plane = to_intel_plane(plane); 1101 1034 struct drm_framebuffer *fb = state->fb; 1102 - struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 1103 - struct drm_i915_gem_object *obj = intel_fb->obj; 1035 + struct drm_i915_gem_object *obj = intel_fb_obj(fb); 1104 1036 int crtc_x, crtc_y; 1105 1037 unsigned int crtc_w, crtc_h; 1106 1038 uint32_t src_x, src_y, src_w, src_h; ··· 1258 1192 } 1259 1193 1260 1194 static int 1261 - intel_commit_sprite_plane(struct drm_plane *plane, 1262 - struct intel_plane_state *state) 1195 + intel_prepare_sprite_plane(struct drm_plane *plane, 1196 + struct intel_plane_state *state) 1263 1197 { 1264 1198 struct drm_device *dev = plane->dev; 1265 1199 struct drm_crtc *crtc = state->crtc; 1266 1200 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1267 - struct intel_plane *intel_plane = to_intel_plane(plane); 1268 1201 enum pipe pipe = intel_crtc->pipe; 1269 1202 struct drm_framebuffer *fb = state->fb; 1270 - struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); 1271 - struct drm_i915_gem_object *obj = intel_fb->obj; 1272 - struct drm_i915_gem_object *old_obj = intel_plane->obj; 1273 - int crtc_x, crtc_y; 1274 - unsigned int crtc_w, crtc_h; 1275 - uint32_t src_x, src_y, src_w, src_h; 1276 - struct drm_rect *dst = &state->dst; 1277 - const struct drm_rect *clip = &state->clip; 1278 - bool primary_enabled; 1203 + struct drm_i915_gem_object *obj = intel_fb_obj(fb); 1204 + struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); 1279 1205 int ret; 1280 - 1281 - /* 1282 - * If the sprite is completely covering the primary plane, 1283 - * we can disable the primary and save power. 1284 - */ 1285 - primary_enabled = !drm_rect_equals(dst, clip) || colorkey_enabled(intel_plane); 1286 - WARN_ON(!primary_enabled && !state->visible && intel_crtc->active); 1287 - 1288 1206 1289 1207 if (old_obj != obj) { 1290 1208 mutex_lock(&dev->struct_mutex); ··· 1279 1229 * the sprite planes only require 128KiB alignment and 32 PTE 1280 1230 * padding. 1281 1231 */ 1282 - ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); 1232 + ret = intel_pin_and_fence_fb_obj(plane, fb, NULL); 1283 1233 if (ret == 0) 1284 1234 i915_gem_track_fb(old_obj, obj, 1285 1235 INTEL_FRONTBUFFER_SPRITE(pipe)); ··· 1287 1237 if (ret) 1288 1238 return ret; 1289 1239 } 1240 + 1241 + return 0; 1242 + } 1243 + 1244 + static void 1245 + intel_commit_sprite_plane(struct drm_plane *plane, 1246 + struct intel_plane_state *state) 1247 + { 1248 + struct drm_device *dev = plane->dev; 1249 + struct drm_crtc *crtc = state->crtc; 1250 + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1251 + struct intel_plane *intel_plane = to_intel_plane(plane); 1252 + enum pipe pipe = intel_crtc->pipe; 1253 + struct drm_framebuffer *fb = state->fb; 1254 + struct drm_i915_gem_object *obj = intel_fb_obj(fb); 1255 + struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb); 1256 + int crtc_x, crtc_y; 1257 + unsigned int crtc_w, crtc_h; 1258 + uint32_t src_x, src_y, src_w, src_h; 1259 + struct drm_rect *dst = &state->dst; 1260 + const struct drm_rect *clip = &state->clip; 1261 + bool primary_enabled; 1262 + 1263 + /* 1264 + * If the sprite is completely covering the primary plane, 1265 + * we can disable the primary and save power. 1266 + */ 1267 + primary_enabled = !drm_rect_equals(dst, clip) || colorkey_enabled(intel_plane); 1268 + WARN_ON(!primary_enabled && !state->visible && intel_crtc->active); 1290 1269 1291 1270 intel_plane->crtc_x = state->orig_dst.x1; 1292 1271 intel_plane->crtc_y = state->orig_dst.y1; ··· 1377 1298 intel_unpin_fb_obj(old_obj); 1378 1299 mutex_unlock(&dev->struct_mutex); 1379 1300 } 1380 - 1381 - return 0; 1382 1301 } 1383 1302 1384 1303 static int ··· 1416 1339 if (ret) 1417 1340 return ret; 1418 1341 1419 - return intel_commit_sprite_plane(plane, &state); 1342 + ret = intel_prepare_sprite_plane(plane, &state); 1343 + if (ret) 1344 + return ret; 1345 + 1346 + intel_commit_sprite_plane(plane, &state); 1347 + return 0; 1420 1348 } 1421 1349 1422 1350 static int
+184 -8
drivers/gpu/drm/i915/intel_uncore.c
··· 194 194 static void __vlv_force_wake_get(struct drm_i915_private *dev_priv, 195 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 197 /* Check for Render Engine */ 205 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 205 __raw_i915_write32(dev_priv, FORCEWAKE_VLV, 208 206 _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); ··· 214 216 215 217 /* Check for Media Engine */ 216 218 if (FORCEWAKE_MEDIA & fw_engine) { 219 + if (wait_for_atomic((__raw_i915_read32(dev_priv, 220 + FORCEWAKE_ACK_MEDIA_VLV) & 221 + FORCEWAKE_KERNEL) == 0, 222 + FORCEWAKE_ACK_TIMEOUT_MS)) 223 + DRM_ERROR("Timed out: Media forcewake old ack to clear.\n"); 217 224 218 225 __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_VLV, 219 226 _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); ··· 299 296 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); 300 297 } 301 298 299 + static void __gen9_gt_force_wake_mt_reset(struct drm_i915_private *dev_priv) 300 + { 301 + __raw_i915_write32(dev_priv, FORCEWAKE_RENDER_GEN9, 302 + _MASKED_BIT_DISABLE(0xffff)); 303 + 304 + __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_GEN9, 305 + _MASKED_BIT_DISABLE(0xffff)); 306 + 307 + __raw_i915_write32(dev_priv, FORCEWAKE_BLITTER_GEN9, 308 + _MASKED_BIT_DISABLE(0xffff)); 309 + } 310 + 311 + static void 312 + __gen9_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine) 313 + { 314 + /* Check for Render Engine */ 315 + if (FORCEWAKE_RENDER & fw_engine) { 316 + if (wait_for_atomic((__raw_i915_read32(dev_priv, 317 + FORCEWAKE_ACK_RENDER_GEN9) & 318 + FORCEWAKE_KERNEL) == 0, 319 + FORCEWAKE_ACK_TIMEOUT_MS)) 320 + DRM_ERROR("Timed out: Render forcewake old ack to clear.\n"); 321 + 322 + __raw_i915_write32(dev_priv, FORCEWAKE_RENDER_GEN9, 323 + _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); 324 + 325 + if (wait_for_atomic((__raw_i915_read32(dev_priv, 326 + FORCEWAKE_ACK_RENDER_GEN9) & 327 + FORCEWAKE_KERNEL), 328 + FORCEWAKE_ACK_TIMEOUT_MS)) 329 + DRM_ERROR("Timed out: waiting for Render to ack.\n"); 330 + } 331 + 332 + /* Check for Media Engine */ 333 + if (FORCEWAKE_MEDIA & fw_engine) { 334 + if (wait_for_atomic((__raw_i915_read32(dev_priv, 335 + FORCEWAKE_ACK_MEDIA_GEN9) & 336 + FORCEWAKE_KERNEL) == 0, 337 + FORCEWAKE_ACK_TIMEOUT_MS)) 338 + DRM_ERROR("Timed out: Media forcewake old ack to clear.\n"); 339 + 340 + __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_GEN9, 341 + _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); 342 + 343 + if (wait_for_atomic((__raw_i915_read32(dev_priv, 344 + FORCEWAKE_ACK_MEDIA_GEN9) & 345 + FORCEWAKE_KERNEL), 346 + FORCEWAKE_ACK_TIMEOUT_MS)) 347 + DRM_ERROR("Timed out: waiting for Media to ack.\n"); 348 + } 349 + 350 + /* Check for Blitter Engine */ 351 + if (FORCEWAKE_BLITTER & fw_engine) { 352 + if (wait_for_atomic((__raw_i915_read32(dev_priv, 353 + FORCEWAKE_ACK_BLITTER_GEN9) & 354 + FORCEWAKE_KERNEL) == 0, 355 + FORCEWAKE_ACK_TIMEOUT_MS)) 356 + DRM_ERROR("Timed out: Blitter forcewake old ack to clear.\n"); 357 + 358 + __raw_i915_write32(dev_priv, FORCEWAKE_BLITTER_GEN9, 359 + _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); 360 + 361 + if (wait_for_atomic((__raw_i915_read32(dev_priv, 362 + FORCEWAKE_ACK_BLITTER_GEN9) & 363 + FORCEWAKE_KERNEL), 364 + FORCEWAKE_ACK_TIMEOUT_MS)) 365 + DRM_ERROR("Timed out: waiting for Blitter to ack.\n"); 366 + } 367 + } 368 + 369 + static void 370 + __gen9_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) 371 + { 372 + /* Check for Render Engine */ 373 + if (FORCEWAKE_RENDER & fw_engine) 374 + __raw_i915_write32(dev_priv, FORCEWAKE_RENDER_GEN9, 375 + _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); 376 + 377 + /* Check for Media Engine */ 378 + if (FORCEWAKE_MEDIA & fw_engine) 379 + __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_GEN9, 380 + _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); 381 + 382 + /* Check for Blitter Engine */ 383 + if (FORCEWAKE_BLITTER & fw_engine) 384 + __raw_i915_write32(dev_priv, FORCEWAKE_BLITTER_GEN9, 385 + _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); 386 + } 387 + 388 + static void 389 + gen9_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine) 390 + { 391 + unsigned long irqflags; 392 + 393 + spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); 394 + 395 + if (FORCEWAKE_RENDER & fw_engine) { 396 + if (dev_priv->uncore.fw_rendercount++ == 0) 397 + dev_priv->uncore.funcs.force_wake_get(dev_priv, 398 + FORCEWAKE_RENDER); 399 + } 400 + 401 + if (FORCEWAKE_MEDIA & fw_engine) { 402 + if (dev_priv->uncore.fw_mediacount++ == 0) 403 + dev_priv->uncore.funcs.force_wake_get(dev_priv, 404 + FORCEWAKE_MEDIA); 405 + } 406 + 407 + if (FORCEWAKE_BLITTER & fw_engine) { 408 + if (dev_priv->uncore.fw_blittercount++ == 0) 409 + dev_priv->uncore.funcs.force_wake_get(dev_priv, 410 + FORCEWAKE_BLITTER); 411 + } 412 + 413 + spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); 414 + } 415 + 416 + static void 417 + gen9_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) 418 + { 419 + unsigned long irqflags; 420 + 421 + spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); 422 + 423 + if (FORCEWAKE_RENDER & fw_engine) { 424 + WARN_ON(dev_priv->uncore.fw_rendercount == 0); 425 + if (--dev_priv->uncore.fw_rendercount == 0) 426 + dev_priv->uncore.funcs.force_wake_put(dev_priv, 427 + FORCEWAKE_RENDER); 428 + } 429 + 430 + if (FORCEWAKE_MEDIA & fw_engine) { 431 + WARN_ON(dev_priv->uncore.fw_mediacount == 0); 432 + if (--dev_priv->uncore.fw_mediacount == 0) 433 + dev_priv->uncore.funcs.force_wake_put(dev_priv, 434 + FORCEWAKE_MEDIA); 435 + } 436 + 437 + if (FORCEWAKE_BLITTER & fw_engine) { 438 + WARN_ON(dev_priv->uncore.fw_blittercount == 0); 439 + if (--dev_priv->uncore.fw_blittercount == 0) 440 + dev_priv->uncore.funcs.force_wake_put(dev_priv, 441 + FORCEWAKE_BLITTER); 442 + } 443 + 444 + spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); 445 + } 446 + 302 447 static void gen6_force_wake_timer(unsigned long arg) 303 448 { 304 449 struct drm_i915_private *dev_priv = (void *)arg; ··· 485 334 if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev)) 486 335 __gen7_gt_force_wake_mt_reset(dev_priv); 487 336 337 + if (IS_GEN9(dev)) 338 + __gen9_gt_force_wake_mt_reset(dev_priv); 339 + 488 340 if (restore) { /* If reset with a user forcewake, try to restore */ 489 341 unsigned fw = 0; 490 342 ··· 497 343 498 344 if (dev_priv->uncore.fw_mediacount) 499 345 fw |= FORCEWAKE_MEDIA; 346 + } else if (IS_GEN9(dev)) { 347 + if (dev_priv->uncore.fw_rendercount) 348 + fw |= FORCEWAKE_RENDER; 349 + 350 + if (dev_priv->uncore.fw_mediacount) 351 + fw |= FORCEWAKE_MEDIA; 352 + 353 + if (dev_priv->uncore.fw_blittercount) 354 + fw |= FORCEWAKE_BLITTER; 500 355 } else { 501 356 if (dev_priv->uncore.forcewake_count) 502 357 fw = FORCEWAKE_ALL; ··· 577 414 578 415 intel_runtime_pm_get(dev_priv); 579 416 417 + /* Redirect to Gen9 specific routine */ 418 + if (IS_GEN9(dev_priv->dev)) 419 + return gen9_force_wake_get(dev_priv, fw_engine); 420 + 580 421 /* Redirect to VLV specific routine */ 581 422 if (IS_VALLEYVIEW(dev_priv->dev)) 582 423 return vlv_force_wake_get(dev_priv, fw_engine); ··· 601 434 602 435 if (!dev_priv->uncore.funcs.force_wake_put) 603 436 return; 437 + 438 + /* Redirect to Gen9 specific routine */ 439 + if (IS_GEN9(dev_priv->dev)) { 440 + gen9_force_wake_put(dev_priv, fw_engine); 441 + goto out; 442 + } 604 443 605 444 /* Redirect to VLV specific routine */ 606 445 if (IS_VALLEYVIEW(dev_priv->dev)) { ··· 1028 855 1029 856 __intel_uncore_early_sanitize(dev, false); 1030 857 1031 - if (IS_VALLEYVIEW(dev)) { 858 + if (IS_GEN9(dev)) { 859 + dev_priv->uncore.funcs.force_wake_get = __gen9_force_wake_get; 860 + dev_priv->uncore.funcs.force_wake_put = __gen9_force_wake_put; 861 + } else if (IS_VALLEYVIEW(dev)) { 1032 862 dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get; 1033 863 dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put; 1034 864 } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
+6
include/uapi/drm/i915_drm.h
··· 876 876 * mmap mapping. 877 877 */ 878 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 887 struct drm_i915_gem_get_aperture {