diff options
author | Marek Olšák <[email protected]> | 2011-03-08 08:20:31 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-03-08 08:23:29 +0100 |
commit | 5650a719f0c69c00954e47bd7a7b3e9433cb551d (patch) | |
tree | 3aff20999b60e66b84d9949c50dffeb963104989 /src/gallium/winsys/radeon/drm/radeon_drm_bo.c | |
parent | 6051f26b78917d430e7f4eb9b92b20de17aea4cc (diff) |
r300g: decide whether a flush should be asynchronous when calling it
Thread offloading is not sometimes desirable, e.g. when mapping a buffer.
Diffstat (limited to 'src/gallium/winsys/radeon/drm/radeon_drm_bo.c')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 3094337a3cd..9eb833454df 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -172,7 +172,7 @@ static void *radeon_bo_map_internal(struct pb_buffer *_buf, /* DONTBLOCK doesn't make sense with UNSYNCHRONIZED. */ if (flags & PB_USAGE_DONTBLOCK) { if (radeon_bo_is_referenced_by_cs(cs, bo)) { - cs->flush_cs(cs->flush_data); + cs->flush_cs(cs->flush_data, R300_FLUSH_ASYNC); return NULL; } @@ -181,7 +181,11 @@ static void *radeon_bo_map_internal(struct pb_buffer *_buf, } } else { if (radeon_bo_is_referenced_by_cs(cs, bo)) { - cs->flush_cs(cs->flush_data); + cs->flush_cs(cs->flush_data, 0); + } else { + /* Try to avoid busy-waiting in radeon_bo_wait. */ + if (p_atomic_read(&bo->num_active_ioctls)) + radeon_drm_cs_sync_flush(cs); } radeon_bo_wait((struct r300_winsys_bo*)bo); @@ -406,8 +410,7 @@ static void radeon_bo_set_tiling(struct r300_winsys_bo *_buf, /* Tiling determines how DRM treats the buffer data. * We must flush CS when changing it if the buffer is referenced. */ if (cs && radeon_bo_is_referenced_by_cs(cs, bo)) { - radeon_drm_cs_flush(rcs); - radeon_drm_cs_sync_flush(rcs); + cs->flush_cs(cs->flush_data, 0); } while (p_atomic_read(&bo->num_active_ioctls)) { |