]> git.baikalelectronics.ru Git - kernel.git/commit
drm/ttm: add a way to bo_wait for either the last read or last write
authorMarek Olšák <maraeo@gmail.com>
Sat, 13 Aug 2011 20:32:11 +0000 (20:32 +0000)
committerDave Airlie <airlied@redhat.com>
Wed, 31 Aug 2011 18:25:35 +0000 (19:25 +0100)
commit0d7761d6b5d0d53a500c08e9370b6a082847709d
tree0a6e00b5fa56d9f5a5b4dc833e3057e4660efd1c
parente71a10ff6ceebb688c015a893b9cb6db9b49abe8
drm/ttm: add a way to bo_wait for either the last read or last write

Sometimes we want to know whether a buffer is busy and wait for it (bo_wait).
However, sometimes it would be more useful to be able to query whether
a buffer is busy and being either read or written, and wait until it's stopped
being either read or written. The point of this is to be able to avoid
unnecessary waiting, e.g. if a GPU has written something to a buffer and is now
reading that buffer, and a CPU wants to map that buffer for read, it needs to
only wait for the last write. If there were no write, there wouldn't be any
waiting needed.

This, or course, requires user space drivers to send read/write flags
with each relocation (like we have read/write domains in radeon, so we can
actually use those for something useful now).

Now how this patch works:

The read/write flags should passed to ttm_validate_buffer. TTM maintains
separate sync objects of the last read and write for each buffer, in addition
to the sync object of the last use of a buffer. ttm_bo_wait then operates
with one the sync objects.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/nouveau/nouveau_gem.c
drivers/gpu/drm/radeon/radeon_cs.c
drivers/gpu/drm/radeon/radeon_object.h
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/ttm/ttm_bo_vm.c
drivers/gpu/drm/ttm/ttm_execbuf_util.c
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
include/drm/ttm/ttm_bo_api.h
include/drm/ttm/ttm_execbuf_util.h