summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-02-15 03:43:57 +0100
committerMarek Olšák <[email protected]>2011-02-15 04:00:47 +0100
commit45e1cd522bd26a5aa3d424ea49975b90feef8450 (patch)
treecf9583b523c3c24ed22d7ddcf786c82f4ba1ef35 /src/gallium/winsys/radeon
parent8decb0a96de0accfc8361890cbcf9db89f8fe8ba (diff)
r300g: handle interaction between UNSYNCHRONIZED and DONTBLOCK flags in bo_map
The VBO module uses both, but they are somewhat opposite to each other. In this case, we pick UNSYNCHRONIZED and ignore DONTBLOCK.
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 6de1ff7745d..e3c6195d5f6 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -158,30 +158,26 @@ static void *radeon_bo_map_internal(struct pb_buffer *_buf,
struct radeon_drm_cs *cs = flush_ctx;
struct drm_radeon_gem_mmap args = {};
void *ptr;
- /* prevents a call to radeon_bo_wait if (usage & DONTBLOCK) and
- * radeon_is_busy returns FALSE. */
- boolean may_be_busy = TRUE;
-
- if (flags & PB_USAGE_DONTBLOCK) {
- if (radeon_bo_is_referenced_by_cs(cs, bo)) {
- cs->flush_cs(cs->flush_data);
- return NULL;
- }
- if (radeon_bo_is_busy((struct r300_winsys_bo*)bo)) {
- return NULL;
- }
+ /* If it's not unsynchronized bo_map, flush CS if needed and then wait. */
+ if (!(flags & PB_USAGE_UNSYNCHRONIZED)) {
+ /* 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);
+ return NULL;
+ }
- may_be_busy = FALSE;
- }
+ if (radeon_bo_is_busy((struct r300_winsys_bo*)bo)) {
+ return NULL;
+ }
+ } else {
+ if (radeon_bo_is_referenced_by_cs(cs, bo)) {
+ cs->flush_cs(cs->flush_data);
+ }
- /* If it's not unsynchronized bo_map, flush CS if needed and then wait. */
- if (may_be_busy && !(flags & PB_USAGE_UNSYNCHRONIZED)) {
- if (radeon_bo_is_referenced_by_cs(cs, bo)) {
- cs->flush_cs(cs->flush_data);
+ radeon_bo_wait((struct r300_winsys_bo*)bo);
}
-
- radeon_bo_wait((struct r300_winsys_bo*)bo);
}
/* Return the pointer if it's already mapped. */