[Mesa-dev] [PATCH 11/16] i965: Replace brw_bo_map_unsynchronized with MAP_ASYNC
Chris Wilson
chris at chris-wilson.co.uk
Thu May 25 06:37:13 UTC 2017
On Wed, May 24, 2017 at 01:04:53PM -0700, Matt Turner wrote:
> This way we can let brw_bo_map() choose the best mapping type.
>
> Part of the patch inlines map_gtt() into brw_bo_map_gtt() (and removes
> map_gtt()). brw_bo_map_gtt() just wrapped map_gtt() with locking and a
> call to set_domain(). map_gtt() is called by brw_bo_map_unsynchronized()
> to avoid the call to set_domain(). With the MAP_ASYNC flag, we now have
> the same behavior previously provided by brw_bo_map_unsynchronized().
One thing this reminds me is that the bufmgr->lock used here can be
moved into the bo, and in many cases dropped altogether. (E.g. there is
no point locking a call to set-domain, if the upper level is racing
between two threads, the state of the buffer is undefined irrespective
of whether the call to the ioctl is serialised. Then assignments of the
mmap can be optimistically, e.g.:
if (!bo->map_cpu) {
void *map = __brw_bo_map_cpu(bo);
if (unlikely(cmpxchg(&bo->map_cpu, NULL, map))
/* lost the race */
munmap(map, bo->size);
}
And map_count is not used, or useful, for mesa.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the mesa-dev
mailing list