This is a note to let you know that I've just added the patch titled Revert "drm/i915: Do not rely on wm preservation for ILK watermarks" to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-drm-i915-do-not-rely-on-wm-preservation-for-ilk-watermarks.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Tue Nov 28 10:15:23 CET 2017 Date: Tue, 28 Nov 2017 10:15:23 +0100 To: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Subject: Revert "drm/i915: Do not rely on wm preservation for ILK watermarks" This reverts commit 7de694782cbe7840f2c0de6f1e70f41fc1b8b6e8 which is commit 8777b927b92cf5b6c29f9f9d3c737addea9ac8a7 upstream. It was reported to cause flickering and other regressions. Reported-by: Rainer Fiebig <jrf@xxxxxxxxxxx> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Cc: Matt Roper <matthew.d.roper@xxxxxxxxx> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> reverted: --- drivers/gpu/drm/i915/intel_drv.h | 1 drivers/gpu/drm/i915/intel_pm.c | 52 ++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 22 deletions(-) --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -457,6 +457,7 @@ struct intel_crtc_scaler_state { struct intel_pipe_wm { struct intel_wm_level wm[5]; + struct intel_wm_level raw_wm[5]; uint32_t linetime; bool fbc_wm_enabled; bool pipe_enabled; --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -27,7 +27,6 @@ #include <linux/cpufreq.h> #include <drm/drm_plane_helper.h> -#include <drm/drm_atomic_helper.h> #include "i915_drv.h" #include "intel_drv.h" #include "../../../platform/x86/intel_ips.h" @@ -2018,9 +2017,9 @@ static void ilk_compute_wm_level(const s const struct intel_crtc *intel_crtc, int level, struct intel_crtc_state *cstate, - const struct intel_plane_state *pristate, - const struct intel_plane_state *sprstate, - const struct intel_plane_state *curstate, + struct intel_plane_state *pristate, + struct intel_plane_state *sprstate, + struct intel_plane_state *curstate, struct intel_wm_level *result) { uint16_t pri_latency = dev_priv->wm.pri_latency[level]; @@ -2342,24 +2341,28 @@ static int ilk_compute_pipe_wm(struct in struct intel_pipe_wm *pipe_wm; struct drm_device *dev = state->dev; const struct drm_i915_private *dev_priv = to_i915(dev); - struct drm_plane *plane; - const struct drm_plane_state *plane_state; - const struct intel_plane_state *pristate = NULL; - const struct intel_plane_state *sprstate = NULL; - const struct intel_plane_state *curstate = NULL; + struct intel_plane *intel_plane; + struct intel_plane_state *pristate = NULL; + struct intel_plane_state *sprstate = NULL; + struct intel_plane_state *curstate = NULL; int level, max_level = ilk_wm_max_level(dev), usable_level; struct ilk_wm_maximums max; pipe_wm = &cstate->wm.ilk.optimal; - drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, &cstate->base) { - const struct intel_plane_state *ps = to_intel_plane_state(plane_state); + for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) { + struct intel_plane_state *ps; - if (plane->type == DRM_PLANE_TYPE_PRIMARY) + ps = intel_atomic_get_existing_plane_state(state, + intel_plane); + if (!ps) + continue; + + if (intel_plane->base.type == DRM_PLANE_TYPE_PRIMARY) pristate = ps; - else if (plane->type == DRM_PLANE_TYPE_OVERLAY) + else if (intel_plane->base.type == DRM_PLANE_TYPE_OVERLAY) sprstate = ps; - else if (plane->type == DRM_PLANE_TYPE_CURSOR) + else if (intel_plane->base.type == DRM_PLANE_TYPE_CURSOR) curstate = ps; } @@ -2381,9 +2384,11 @@ static int ilk_compute_pipe_wm(struct in if (pipe_wm->sprites_scaled) usable_level = 0; - memset(&pipe_wm->wm, 0, sizeof(pipe_wm->wm)); ilk_compute_wm_level(dev_priv, intel_crtc, 0, cstate, - pristate, sprstate, curstate, &pipe_wm->wm[0]); + pristate, sprstate, curstate, &pipe_wm->raw_wm[0]); + + memset(&pipe_wm->wm, 0, sizeof(pipe_wm->wm)); + pipe_wm->wm[0] = pipe_wm->raw_wm[0]; if (IS_HASWELL(dev) || IS_BROADWELL(dev)) pipe_wm->linetime = hsw_compute_linetime_wm(cstate); @@ -2393,8 +2398,8 @@ static int ilk_compute_pipe_wm(struct in ilk_compute_wm_reg_maximums(dev, 1, &max); - for (level = 1; level <= usable_level; level++) { - struct intel_wm_level *wm = &pipe_wm->wm[level]; + for (level = 1; level <= max_level; level++) { + struct intel_wm_level *wm = &pipe_wm->raw_wm[level]; ilk_compute_wm_level(dev_priv, intel_crtc, level, cstate, pristate, sprstate, curstate, wm); @@ -2404,10 +2409,13 @@ static int ilk_compute_pipe_wm(struct in * register maximums since such watermarks are * always invalid. */ - if (!ilk_validate_wm_level(level, &max, wm)) { - memset(wm, 0, sizeof(*wm)); - break; - } + if (level > usable_level) + continue; + + if (ilk_validate_wm_level(level, &max, wm)) + pipe_wm->wm[level] = *wm; + else + usable_level = level; } return 0; Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-4.9/sched-make-resched_cpu-unconditional.patch queue-4.9/media-rc-check-for-integer-overflow.patch queue-4.9/kvm-nvmx-set-idtr-and-gdtr-limits-when-loading-l1-host-state.patch queue-4.9/rtlwifi-fix-uninitialized-rtlhal-last_suspend_sec-time.patch queue-4.9/libnvdimm-pfn-make-resource-attribute-only-readable-by-root.patch queue-4.9/mips-fix-an-n32-core-file-generation-regset-support-regression.patch queue-4.9/x86-decoder-add-new-test-instruction-pattern.patch queue-4.9/mtd-nand-fix-writing-mtdoops-to-nand-flash.patch queue-4.9/i40evf-use-smp_rmb-rather-than-read_barrier_depends.patch queue-4.9/revert-drm-i915-do-not-rely-on-wm-preservation-for-ilk-watermarks.patch queue-4.9/ecryptfs-use-after-free-in-ecryptfs_release_messaging.patch queue-4.9/s390-disassembler-add-missing-end-marker-for-e7-table.patch queue-4.9/dm-allocate-struct-mapped_device-with-kvzalloc.patch queue-4.9/kvm-svm-obey-guest-pat.patch queue-4.9/block-fix-a-race-between-blk_cleanup_queue-and-timeout-handling.patch queue-4.9/cx231xx-cards-fix-null-deref-on-missing-association-descriptor.patch queue-4.9/s390-disassembler-increase-show_code-buffer-size.patch queue-4.9/alsa-timer-remove-kernel-warning-at-compat-ioctl-error-paths.patch queue-4.9/igb-use-smp_rmb-rather-than-read_barrier_depends.patch queue-4.9/mtd-nand-mtk-fix-infinite-ecc-decode-irq-issue.patch queue-4.9/s390-fix-transactional-execution-control-register-handling.patch queue-4.9/lib-mpi-call-cond_resched-from-mpi_powm-loop.patch queue-4.9/nfs-avoid-rcu-usage-in-tracepoints.patch queue-4.9/alsa-hda-add-raven-pci-id.patch queue-4.9/dm-fix-race-between-dm_get_from_kobject-and-__dm_destroy.patch queue-4.9/clk-ti-dra7-atl-clock-fix-child-node-lookups.patch queue-4.9/arm-8722-1-mm-make-strict_kernel_rwx-effective-for-lpae.patch queue-4.9/nfs-fix-ugly-referral-attributes.patch queue-4.9/target-fix-queue_full-scsi-task-attribute-handling.patch queue-4.9/mips-bcm47xx-fix-led-inversion-for-wrt54gsv1.patch queue-4.9/vsock-use-new-wait-api-for-vsock_stream_sendmsg.patch queue-4.9/lockd-double-unregister-of-inetaddr-notifiers.patch queue-4.9/autofs-don-t-fail-mount-for-transient-error.patch queue-4.9/net-9p-switch-to-wait_event_killable.patch queue-4.9/media-v4l2-ctrl-fix-flags-field-on-control-events.patch queue-4.9/p54-don-t-unregister-leds-when-they-are-not-initialized.patch queue-4.9/e1000e-fix-error-path-in-link-detection.patch queue-4.9/mips-ralink-fix-mt7628-pinmux.patch queue-4.9/e1000e-separate-signaling-for-link-check-link-up.patch queue-4.9/x86-entry-64-add-missing-irqflags-tracing-to-native_load_gs_index.patch queue-4.9/iscsi-target-fix-non-immediate-tmr-reference-leak.patch queue-4.9/alsa-usb-audio-add-sanity-checks-in-v2-clock-parsers.patch queue-4.9/rt2x00usb-mark-device-removed-when-get-enoent-usb-error.patch queue-4.9/isofs-fix-timestamps-beyond-2027.patch queue-4.9/nfs-fix-typo-in-nomigration-mount-option.patch queue-4.9/alsa-hda-fix-too-short-hdmi-dp-chmap-reporting.patch queue-4.9/fs-9p-compare-qid.path-in-v9fs_test_inode.patch queue-4.9/x86-mm-fix-use-after-free-of-vma-during-userfaultfd-fault.patch queue-4.9/alsa-hda-realtek-fix-alc700-family-no-sound-issue.patch queue-4.9/pm-opp-add-missing-of_node_put-np.patch queue-4.9/ixgbevf-use-smp_rmb-rather-than-read_barrier_depends.patch queue-4.9/sched-rt-simplify-the-ipi-based-rt-balancing-logic.patch queue-4.9/igbvf-use-smp_rmb-rather-than-read_barrier_depends.patch queue-4.9/e1000e-fix-return-value-test.patch queue-4.9/s390-runtime-instrumention-fix-possible-memory-corruption.patch queue-4.9/nfsd-deal-with-revoked-delegations-appropriately.patch queue-4.9/arm-8721-1-mm-dump-check-hardware-ro-bit-for-lpae.patch queue-4.9/ata-fixes-kernel-crash-while-tracing-ata_eh_link_autopsy-event.patch queue-4.9/ipv6-only-call-ip6_route_dev_notify-once-for-netdev_unregister.patch queue-4.9/fm10k-use-smp_rmb-rather-than-read_barrier_depends.patch queue-4.9/pci-set-cavium-acs-capability-quirk-flags-to-assert-rr-cr-sv-uf.patch queue-4.9/bcache-check-ca-alloc_thread-initialized-before-wake-up-it.patch queue-4.9/ixgbe-fix-skb-list-corruption-on-power-systems.patch queue-4.9/alsa-usb-audio-fix-potential-out-of-bound-access-at-parsing-su.patch queue-4.9/mips-fix-odd-fp-register-warnings-with-mips64r2.patch queue-4.9/acpi-ec-fix-regression-related-to-triggering-source-of-ec-event-handling.patch queue-4.9/alsa-pcm-update-tstamp-only-if-audio_tstamp-changed.patch queue-4.9/fscrypt-lock-mutex-before-checking-for-bounce-page-pool.patch queue-4.9/parisc-fix-validity-check-of-pointer-size-argument-in-new-cas-implementation.patch queue-4.9/e1000e-avoid-receiver-overrun-interrupt-bursts.patch queue-4.9/mips-pci-remove-kern_warn-instance-inside-the-mt7620-driver.patch queue-4.9/fix-a-page-leak-in-vhost_scsi_iov_to_sgl-error-recovery.patch queue-4.9/mips-ralink-fix-typo-in-mt7628-pinmux-function.patch queue-4.9/powerpc-signal-properly-handle-return-value-from-uprobe_deny_signal.patch queue-4.9/dm-bufio-fix-integer-overflow-when-limiting-maximum-cache-size.patch queue-4.9/mips-dts-remove-bogus-bcm96358nb4ser.dtb-from-dtb-y-entry.patch queue-4.9/nilfs2-fix-race-condition-that-causes-file-system-corruption.patch queue-4.9/ib-srp-avoid-that-a-cable-pull-can-trigger-a-kernel-crash.patch queue-4.9/irqchip-gic-v3-fix-ppi-partitions-lookup.patch queue-4.9/libnvdimm-namespace-make-resource-attribute-only-readable-by-root.patch queue-4.9/ib-srpt-do-not-accept-invalid-initiator-port-names.patch queue-4.9/nfc-fix-device-allocation-error-return.patch queue-4.9/rtlwifi-rtl8192ee-fix-memory-leak-when-loading-firmware.patch queue-4.9/arm64-implement-arch-specific-pte_access_permitted.patch queue-4.9/mtd-nand-omap2-fix-subpage-write.patch queue-4.9/libceph-don-t-warn-if-user-tries-to-add-invalid-key.patch queue-4.9/media-don-t-do-dma-on-stack-for-firmware-upload-in-the-as102-driver.patch queue-4.9/i40e-use-smp_rmb-rather-than-read_barrier_depends.patch queue-4.9/libnvdimm-namespace-fix-label-initialization-to-use-valid-seq-numbers.patch queue-4.9/alsa-usb-audio-add-sanity-checks-to-fe-parser.patch queue-4.9/sunrpc-fix-tracepoint-storage-issues-with-svc_recv-and-svc_rqst_status.patch queue-4.9/ext4-fix-interaction-between-i_size-fallocate-and-delalloc-after-a-crash.patch