On Thu, Jun 25, 2015 at 5:45 AM, Topi Pohjolainen
<topi.pohjolai...@intel.com> wrote:
> Current logic re-writes the same data when existing data is found.
> Not that this actually matters at the moment in practice, the
> contraint for finding matching data is too severe to ever allow
> data to be shared between two items in the cache.
>
> CC: Kenneth Graunke <kenn...@whitecape.org>
> Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_state_cache.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c 
> b/src/mesa/drivers/dri/i965/brw_state_cache.c
> index 97a41b9..d42b4b4 100644
> --- a/src/mesa/drivers/dri/i965/brw_state_cache.c
> +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
> @@ -314,6 +314,13 @@ brw_upload_cache(struct brw_cache *cache,
>      */
>     if (!brw_try_upload_using_copy(cache, item, data, aux)) {
>        item->offset = brw_alloc_item_data(cache, data_size);
> +
> +      /* Copy data to the buffer */
> +      if (brw->has_llc) {
> +         memcpy((char *)cache->bo->virtual + item->offset, data, data_size);
> +      } else {
> +         drm_intel_bo_subdata(cache->bo, item->offset, data_size, data);
> +      }
>     }
>
>     /* Set up the memory containing the key and aux_data */
> @@ -332,13 +339,6 @@ brw_upload_cache(struct brw_cache *cache,
>     cache->items[hash] = item;
>     cache->n_items++;
>
> -   /* Copy data to the buffer */
> -   if (brw->has_llc) {
> -      memcpy((char *) cache->bo->virtual + item->offset, data, data_size);
> -   } else {
> -      drm_intel_bo_subdata(cache->bo, item->offset, data_size, data);
> -   }
> -
>     *out_offset = item->offset;
>     *(void **)out_aux = (void *)((char *)item->key + item->key_size);
>     cache->brw->ctx.NewDriverState |= 1 << cache_id;
> --
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Sounds like a right thing to do. It's worth waiting to see comments
from other people before pushing it upstream.

Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to