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 <ch...@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursu...@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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to