drm/i915: Flush everything on switching to the kernel_context
authorChris Wilson <[email protected]>
Sun, 26 Nov 2017 21:48:56 +0000 (21:48 +0000)
committerChris Wilson <[email protected]>
Mon, 27 Nov 2017 16:37:15 +0000 (16:37 +0000)
Even though all rendering should have been flushed at the end of the
previous requests, add an extra flush after switching to the
kernel_context. As the switch to the kernel_context is used when idling
the gpu (e.g. suspend), having an extra layer of paranoia to ensure
everything is flushed to memory seems sensible.

Signed-off-by: Chris Wilson <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Joonas Lahtinen <[email protected]>
drivers/gpu/drm/i915/i915_gem_context.c

index aee0f6d72d337478e325b46cce0003678ac232ca..ce3139e5ec4c4406d50b84fe041559e5c62d1683 100644 (file)
@@ -620,7 +620,14 @@ int i915_gem_switch_to_kernel_context(struct drm_i915_private *dev_priv)
                                                                 GFP_KERNEL);
                }
 
-               i915_add_request(req);
+               /*
+                * Force a flush after the switch to ensure that all rendering
+                * and operations prior to switching to the kernel context hits
+                * memory. This should be guaranteed by the previous request,
+                * but an extra layer of paranoia before we declare the system
+                * idle (on suspend etc) is advisable!
+                */
+               __i915_add_request(req, true);
        }
 
        return 0;