drm/i915: Handle incomplete Z_FINISH for compressed error states
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 3 Oct 2018 08:24:22 +0000 (09:24 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 3 Oct 2018 10:39:31 +0000 (11:39 +0100)
commit83bc0f5b432f60394466deef16fc753e27371d0b
treed0a900df733cce689774ed1240dcbbd78721d5d3
parent5ec244f4afd0a08c0e814381df3b17b463e8d634
drm/i915: Handle incomplete Z_FINISH for compressed error states

The final call to zlib_deflate(Z_FINISH) may require more output
space to be allocated and so needs to re-invoked. Failure to do so in
the current code leads to incomplete zlib streams (albeit intact due to
the use of Z_SYNC_FLUSH) resulting in the occasional short object
capture.

v2: Check against overrunning our pre-allocated page array
v3: Drop Z_SYNC_FLUSH entirely

Testcase: igt/i915-error-capture.js
Fixes: 0a97015d45ee ("drm/i915: Compress GPU objects in error state")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.10+
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181003082422.23214-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_gpu_error.h