[Intel-gfx] [PATCH v2] drm/i915: Use memcpy_from_wc for GPU error capture
Chris Wilson
chris at chris-wilson.co.uk
Tue Dec 6 12:39:50 UTC 2016
On Tue, Dec 06, 2016 at 12:22:03PM +0000, Chris Wilson wrote:
> On all platforms we now always read the contents of buffers via the GTT,
> i.e. using WC cpu access. Reads are slow, but they can be accelerated
> with an internal read buffer using sse4.1 (movntqda). This is our
> i915_memcpy_from_wc() routine which also checks for sse4.1 support and
> so we can fallback to using a regular slow memcpy if we need to.
>
> When compressing the pages, the reads are currently done inside zlib's
> fill_window() routine and so we must copy the page into a temporary
> which is then already inside the CPU cache and fast for zlib's
> compression. When not compressing the pages, we don't need a temporary
> and can just use the accelerated read from WC into the destination.
>
> v2: Use zstream locals to reduce diff and allocate the additional
> temporary storage if sse4.1 is supported.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_gpu_error.c | 50 ++++++++++++++++++++++++++---------
> 1 file changed, 37 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index a14f7badc337..70e2c955afc6 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -176,9 +176,14 @@ static void i915_error_puts(struct drm_i915_error_state_buf *e,
>
> #ifdef CONFIG_DRM_I915_COMPRESS_ERROR
>
> -static bool compress_init(struct z_stream_s *zstream)
> +struct compress {
> + struct z_stream_s zstream;
> + void *tmp;
> +};
> +
> +static bool compress_init(struct compress *c)
> {
> - memset(zstream, 0, sizeof(*zstream));
> + struct z_stream_s *zstream = memset(&c->zstream, 0, sizeof(c->zstream));
>
> zstream->workspace =
> kmalloc(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
> @@ -191,14 +196,22 @@ static bool compress_init(struct z_stream_s *zstream)
> return false;
> }
>
> + c->tmp = NULL;
> + if (i915_memcpy_from_wc(NULL, 0, PAGE_SIZE))
s/PAGE_SIZE/0/ here bah.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list