On pe, 2016-10-07 at 10:46 +0100, Chris Wilson wrote:
> @@ -1499,25 +1523,40 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, 
> void *data,
>                                  MAX_SCHEDULE_TIMEOUT,
>                                  to_rps_client(file));
>       if (ret)
> -             goto err;
> +             goto err_unlocked;
> +
> +     /* Flush and acquire obj->pages so that we are coherent through
> +      * direct access in memory with previous cached writes through
> +      * shmemfs and that our cache domain tracking remains valid.
> +      * For example, if the obj->filp was moved to swap without us
> +      * being notified and releasing the pages, we would mistakenly
> +      * continue to assume that the obj remained out of the CPU cached
> +      * domain.
> +      */
> +     ret = i915_gem_object_pin_pages(obj);
> +     if (ret)
> +             goto err_unlocked;
>  
>       ret = i915_mutex_lock_interruptible(dev);
>       if (ret)
> -             goto err;
> +             goto err_pages;
>  
>       if (read_domains & I915_GEM_DOMAIN_GTT)
>               ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0);
>       else
>               ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0);
>  
> -     if (write_domain != 0)
> -             intel_fb_obj_invalidate(obj, write_origin(obj, write_domain));
> +     /* And bump the LRU for this access */
> +     i915_gem_object_bump_inactive_ggtt(obj);
>  
> -     i915_gem_object_put(obj);
>       mutex_unlock(&dev->struct_mutex);
> -     return ret;
>  
> -err:
> +     if (write_domain != 0)
> +             intel_fb_obj_invalidate(obj, write_origin(obj, write_domain));
> +
> +err_pages:

out_pages: as it's a shared path now.

Code motion would still be great as separate patches.

Reviewed-by: Joonas Lahtinen <joonas.lahti...@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to