From 8e041bd19fd7f9c116e7c7961ccc0d09fdd1ca5f Mon Sep 17 00:00:00 2001 From: "Justin M. Forbes" Date: Thu, 12 Oct 2017 14:43:07 -0500 Subject: [PATCH] Linux v4.14-rc4-84-gff5abbe799e2 --- ...cks-if-we-miss-the-pageflip-s-vblank.patch | 200 ++++++++++++++++++ gitrev | 2 +- kernel.spec | 8 +- sources | 2 +- 4 files changed, 209 insertions(+), 3 deletions(-) create mode 100644 drm-i915-Boost-GPU-clocks-if-we-miss-the-pageflip-s-vblank.patch diff --git a/drm-i915-Boost-GPU-clocks-if-we-miss-the-pageflip-s-vblank.patch b/drm-i915-Boost-GPU-clocks-if-we-miss-the-pageflip-s-vblank.patch new file mode 100644 index 000000000..07f81116a --- /dev/null +++ b/drm-i915-Boost-GPU-clocks-if-we-miss-the-pageflip-s-vblank.patch @@ -0,0 +1,200 @@ +From patchwork Thu Aug 17 12:37:06 2017 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Subject: drm/i915: Boost GPU clocks if we miss the pageflip's vblank +From: Chris Wilson +X-Patchwork-Id: 172204 +Message-Id: <20170817123706.6777-1-chris@chris-wilson.co.uk> +To: intel-gfx@lists.freedesktop.org +Cc: Daniel Vetter +Date: Thu, 17 Aug 2017 13:37:06 +0100 + +If we miss the current vblank because the gpu was busy, that may cause a +jitter as the frame rate temporarily drops. We try to limit the impact +of this by then boosting the GPU clock to deliver the frame as quickly +as possible. Originally done in commit 6ad790c0f5ac ("drm/i915: Boost GPU +frequency if we detect outstanding pageflips") but was never forward +ported to atomic and finally dropped in commit fd3a40242e87 ("drm/i915: +Rip out legacy page_flip completion/irq handling"). + +References: https://bugs.freedesktop.org/show_bug.cgi?id=102199 +Signed-off-by: Chris Wilson +Cc: Maarten Lankhorst +Cc: Ville Syrjälä +Cc: Daniel Vetter +Tested-by: Lyude Paul +Reviewed-by: Radoslaw Szwichtenberg +--- + drivers/gpu/drm/i915/intel_display.c | 59 ++++++++++++++++++++++++++++++++++++ + drivers/gpu/drm/i915/intel_drv.h | 1 - + drivers/gpu/drm/i915/intel_pm.c | 42 ++----------------------- + 3 files changed, 62 insertions(+), 40 deletions(-) + +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c +index 0e93ec201fe3..7d5b19553637 100644 +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -12636,6 +12636,55 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { + .set_crc_source = intel_crtc_set_crc_source, + }; + ++struct wait_rps_boost { ++ struct wait_queue_entry wait; ++ ++ struct drm_crtc *crtc; ++ struct drm_i915_gem_request *request; ++}; ++ ++static int do_rps_boost(struct wait_queue_entry *_wait, ++ unsigned mode, int sync, void *key) ++{ ++ struct wait_rps_boost *wait = container_of(_wait, typeof(*wait), wait); ++ struct drm_i915_gem_request *rq = wait->request; ++ ++ gen6_rps_boost(rq, NULL); ++ i915_gem_request_put(rq); ++ ++ drm_crtc_vblank_put(wait->crtc); ++ ++ list_del(&wait->wait.entry); ++ kfree(wait); ++ return 1; ++} ++ ++static void add_rps_boost_after_vblank(struct drm_crtc *crtc, ++ struct dma_fence *fence) ++{ ++ struct wait_rps_boost *wait; ++ ++ if (!dma_fence_is_i915(fence)) ++ return; ++ ++ if (drm_crtc_vblank_get(crtc)) ++ return; ++ ++ wait = kmalloc(sizeof(*wait), GFP_KERNEL); ++ if (!wait) { ++ drm_crtc_vblank_put(crtc); ++ return; ++ } ++ ++ wait->request = to_request(dma_fence_get(fence)); ++ wait->crtc = crtc; ++ ++ wait->wait.func = do_rps_boost; ++ wait->wait.flags = 0; ++ ++ add_wait_queue(drm_crtc_vblank_waitqueue(crtc), &wait->wait); ++} ++ + /** + * intel_prepare_plane_fb - Prepare fb for usage on plane + * @plane: drm plane to prepare for +@@ -12733,12 +12782,22 @@ intel_prepare_plane_fb(struct drm_plane *plane, + return ret; + + if (!new_state->fence) { /* implicit fencing */ ++ struct dma_fence *fence; ++ + ret = i915_sw_fence_await_reservation(&intel_state->commit_ready, + obj->resv, NULL, + false, I915_FENCE_TIMEOUT, + GFP_KERNEL); + if (ret < 0) + return ret; ++ ++ fence = reservation_object_get_excl_rcu(obj->resv); ++ if (fence) { ++ add_rps_boost_after_vblank(new_state->crtc, fence); ++ dma_fence_put(fence); ++ } ++ } else { ++ add_rps_boost_after_vblank(new_state->crtc, new_state->fence); + } + + return 0; +diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h +index fa47285918f4..e092354b4d63 100644 +--- a/drivers/gpu/drm/i915/intel_drv.h ++++ b/drivers/gpu/drm/i915/intel_drv.h +@@ -1844,7 +1844,6 @@ void gen6_rps_reset_ei(struct drm_i915_private *dev_priv); + void gen6_rps_idle(struct drm_i915_private *dev_priv); + void gen6_rps_boost(struct drm_i915_gem_request *rq, + struct intel_rps_client *rps); +-void intel_queue_rps_boost_for_request(struct drm_i915_gem_request *req); + void g4x_wm_get_hw_state(struct drm_device *dev); + void vlv_wm_get_hw_state(struct drm_device *dev); + void ilk_wm_get_hw_state(struct drm_device *dev); +diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c +index ed662937ec3c..c9fa2eb1903c 100644 +--- a/drivers/gpu/drm/i915/intel_pm.c ++++ b/drivers/gpu/drm/i915/intel_pm.c +@@ -6169,6 +6169,7 @@ void gen6_rps_boost(struct drm_i915_gem_request *rq, + struct intel_rps_client *rps) + { + struct drm_i915_private *i915 = rq->i915; ++ unsigned long flags; + bool boost; + + /* This is intentionally racy! We peek at the state here, then +@@ -6178,13 +6179,13 @@ void gen6_rps_boost(struct drm_i915_gem_request *rq, + return; + + boost = false; +- spin_lock_irq(&rq->lock); ++ spin_lock_irqsave(&rq->lock, flags); + if (!rq->waitboost && !i915_gem_request_completed(rq)) { + atomic_inc(&i915->rps.num_waiters); + rq->waitboost = true; + boost = true; + } +- spin_unlock_irq(&rq->lock); ++ spin_unlock_irqrestore(&rq->lock, flags); + if (!boost) + return; + +@@ -9132,43 +9133,6 @@ int intel_freq_opcode(struct drm_i915_private *dev_priv, int val) + return DIV_ROUND_CLOSEST(val, GT_FREQUENCY_MULTIPLIER); + } + +-struct request_boost { +- struct work_struct work; +- struct drm_i915_gem_request *req; +-}; +- +-static void __intel_rps_boost_work(struct work_struct *work) +-{ +- struct request_boost *boost = container_of(work, struct request_boost, work); +- struct drm_i915_gem_request *req = boost->req; +- +- if (!i915_gem_request_completed(req)) +- gen6_rps_boost(req, NULL); +- +- i915_gem_request_put(req); +- kfree(boost); +-} +- +-void intel_queue_rps_boost_for_request(struct drm_i915_gem_request *req) +-{ +- struct request_boost *boost; +- +- if (req == NULL || INTEL_GEN(req->i915) < 6) +- return; +- +- if (i915_gem_request_completed(req)) +- return; +- +- boost = kmalloc(sizeof(*boost), GFP_ATOMIC); +- if (boost == NULL) +- return; +- +- boost->req = i915_gem_request_get(req); +- +- INIT_WORK(&boost->work, __intel_rps_boost_work); +- queue_work(req->i915->wq, &boost->work); +-} +- + void intel_pm_setup(struct drm_i915_private *dev_priv) + { + mutex_init(&dev_priv->rps.hw_lock); diff --git a/gitrev b/gitrev index 6711532f4..2dcd7dc3b 100644 --- a/gitrev +++ b/gitrev @@ -1 +1 @@ -56ae414e9d2718bcbfda9ba3797c39005e2f90fb +ff5abbe799e29099695cb8b5b2f198dd8b8bdf26 diff --git a/kernel.spec b/kernel.spec index 7837fd830..e01ceedc9 100644 --- a/kernel.spec +++ b/kernel.spec @@ -69,7 +69,7 @@ Summary: The Linux kernel # The rc snapshot level %global rcrev 4 # The git snapshot level -%define gitrev 2 +%define gitrev 3 # Set rpm version accordingly %define rpmversion 4.%{upstream_sublevel}.0 %endif @@ -655,6 +655,9 @@ Patch619: input-rmi4-remove-the-need-for-artifical-IRQ.patch # fix gnome 3.26+ not working under VirtualBox, submitted upstream, Cc: Stable Patch620: 0001-staging-vboxvideo-Fix-reporting-invalid-suggested-of.patch +# Headed upstream +Patch621: drm-i915-Boost-GPU-clocks-if-we-miss-the-pageflip-s-vblank.patch + # END OF PATCH DEFINITIONS %endif @@ -2209,6 +2212,9 @@ fi # # %changelog +* Thu Oct 12 2017 Justin M. Forbes - 4.14.0-0.rc4.git3.1 +- Linux v4.14-rc4-84-gff5abbe799e2 + * Thu Oct 12 2017 Hans de Goede - Fix vboxvideo causing gnome 3.26+ to not work under VirtualBox diff --git a/sources b/sources index 278f82ab2..aa48ad27c 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ SHA512 (linux-4.13.tar.xz) = a557c2f0303ae618910b7106ff63d9978afddf470f03cb72aa748213e099a0ecd5f3119aea6cbd7b61df30ca6ef3ec57044d524b7babbaabddf8b08b8bafa7d2 SHA512 (perf-man-4.13.tar.gz) = 9bcc2cd8e56ec583ed2d8e0b0c88e7a94035a1915e40b3177bb02d6c0f10ddd4df9b097b1f5af59efc624226b613e240ddba8ddc2156f3682f992d5455fc5c03 SHA512 (patch-4.14-rc4.xz) = 11edc0714c9b7ff34986d1534c490987f5977940afc5b176a424a23e437d572d83f8d689b4505128371bf6d4c5956a2042c9c4d222eb72363b977b69c819b3e3 -SHA512 (patch-4.14-rc4-git2.xz) = 96a5bbce69897d0a280dd0c86e95e9874c9062770f51b313b5838e690c8019482b8310a0c8614ad3bebf51d54b9ca5916fdc8f2e3527b434c364a023bbbc2719 +SHA512 (patch-4.14-rc4-git3.xz) = f9bbea88ccbc409243205099da8a5d355c97427c642343a8161969ada916e8fee3db1c81de243dedf84cc133d494167570810b493538a7f46c8e0487f6adbe69