struct threaded_resource *tres, unsigned usage,
unsigned offset, unsigned size)
{
+ /* Never invalidate inside the driver and never infer "unsynchronized". */
+ unsigned tc_flags = TC_TRANSFER_MAP_NO_INVALIDATE |
+ TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED;
+
+ /* Prevent a reentry. */
+ if (usage & tc_flags)
+ return usage;
+
/* Sparse buffers can't be mapped directly and can't be reallocated
* (fully invalidated). That may just be a radeonsi limitation, but
* the threaded context must obey it with radeonsi.
return usage;
}
+ usage |= tc_flags;
+
/* Handle CPU reads trivially. */
if (usage & PIPE_TRANSFER_READ) {
/* Drivers aren't allowed to do buffer invalidations. */
- return (usage & ~PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) |
- TC_TRANSFER_MAP_NO_INVALIDATE |
- TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED;
+ return usage & ~PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
}
/* See if the buffer range being mapped has never been initialized,
usage |= TC_TRANSFER_MAP_THREADED_UNSYNC; /* notify the driver */
}
- /* Never invalidate inside the driver and never infer "unsynchronized". */
- return usage |
- TC_TRANSFER_MAP_NO_INVALIDATE |
- TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED;
+ return usage;
}
static void *