Quoting Kenneth Graunke (2017-07-12 08:22:23)
> From: Chris Wilson <[email protected]>
> +static void *
>  brw_bo_map_gtt(struct brw_context *brw, struct brw_bo *bo, unsigned flags)
>  {
>     struct brw_bufmgr *bufmgr = bo->bufmgr;
> @@ -824,10 +831,30 @@ brw_bo_map(struct brw_context *brw, struct brw_bo *bo, 
> unsigned flags)
>  {
>     if (bo->tiling_mode != I915_TILING_NONE && !(flags & MAP_RAW))
>        return brw_bo_map_gtt(brw, bo, flags);
> -   else if (can_map_cpu(bo, flags))
> -      return brw_bo_map_cpu(brw, bo, flags);
> +
> +   void *map;
> +
> +   if (can_map_cpu(bo, flags))
> +      map = brw_bo_map_cpu(brw, bo, flags);
>     else
> -      return brw_bo_map_gtt(brw, bo, flags);
> +      map = brw_bo_map_wc(brw, bo, flags);
> +
> +   /* Allow the attempt to fail by falling back to the GTT where necessary.
> +    *
> +    * Not every buffer can be mmaped directly using the CPU (or WC), for
> +    * example buffers that wrap stolen memory or are imported from other
> +    * devices. For those, we have little choice but to use a GTT mmapping.
> +    * However, if we use a slow GTT mmapping for reads where we expected fast
> +    * access, that order of magnitude difference in throughput will be 
> clearly
> +    * expressed by angry users.
> +    */
> +   if (!map) {

One more issue, we should not supply a GTT fallback for MAP_RAW (at
least not without removing the fence detiling), so this should be

if (!map && !(flags & MAP_RAW)) {
-Chris
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to