r600g: Buffer object maps imply a wait.
authorHenri Verbeet <hverbeet@gmail.com>
Sun, 19 Sep 2010 17:27:30 +0000 (19:27 +0200)
committerHenri Verbeet <hverbeet@gmail.com>
Sun, 19 Sep 2010 17:43:05 +0000 (19:43 +0200)
Unless e.g. PB_USAGE_DONTBLOCK or PB_USAGE_UNSYNCHRONIZED would be specified.

src/gallium/drivers/r600/r600.h
src/gallium/drivers/r600/r600_query.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/r600/radeon.h
src/gallium/winsys/r600/drm/radeon_bo_pb.c
src/gallium/winsys/r600/drm/radeon_ws_bo.c

index bce2707e7702fbb8e1c4de25895d6c032b1db6da..7cbacea89a1321a7b6705e8ffbad18acc2055509 100644 (file)
@@ -92,26 +92,6 @@ enum radeon_family {
 
 enum radeon_family r600_get_family(struct radeon *rw);
 
-/*
- * radeon object functions
- */
-#if 0
-struct radeon_bo {
-       unsigned                        refcount;
-       unsigned                        handle;
-       unsigned                        size;
-       unsigned                        alignment;
-       unsigned                        map_count;
-       void                            *data;
-};
-struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
-                       unsigned size, unsigned alignment, void *ptr);
-int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo);
-void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo);
-struct radeon_bo *radeon_bo_incref(struct radeon *radeon, struct radeon_bo *bo);
-struct radeon_bo *radeon_bo_decref(struct radeon *radeon, struct radeon_bo *bo);
-int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo);
-#endif
 /* lowlevel WS bo */
 struct radeon_ws_bo;
 struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon,
@@ -122,7 +102,6 @@ void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned
 void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo);
 void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst,
                            struct radeon_ws_bo *src);
-int radeon_ws_bo_wait(struct radeon *radeon, struct radeon_ws_bo *bo);
 
 /* R600/R700 STATES */
 #define R600_GROUP_MAX                 16
index 12900cce1145c9455b17ac91c30d47c90b6e5481..298cc4eadd5569c1b586133ae47d05501db59d07 100644 (file)
@@ -108,7 +108,6 @@ static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquer
        u32 *results;
        int i;
 
-       radeon_ws_bo_wait(rscreen->rw, rquery->buffer);
        results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, r600_context(ctx));
        for (i = 0; i < rquery->num_results; i += 4) {
                start = (u64)results[i] | (u64)results[i + 1] << 32;
index b7a12edc20b025dd3c4e3c27dd45e40ad7587626..d41150c93841e7cbaf5b1d19fcef18b0724c26f0 100644 (file)
@@ -347,7 +347,6 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
        if (!map) {
                return NULL;
        }
-       radeon_ws_bo_wait(radeon, bo);
 
        return map + offset;
 }
index 5f9f21db1b4ac82ab4259316d68f7844a1425127..5249194eb1907b863f84cce3d9db9593636c7aea 100644 (file)
@@ -100,7 +100,6 @@ void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned
 void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo);
 void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst,
                            struct radeon_ws_bo *src);
-int radeon_ws_bo_wait(struct radeon *radeon, struct radeon_ws_bo *bo);
 
 struct radeon_stype_info;
 /*
index 8cf6a781306bf8dc1e24145bf245f27e81686f83..b8744b00eb4e2302872e3f4e101a968fa5148ff8 100644 (file)
@@ -63,20 +63,26 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf,
                }
        }
 
-       if (buf->bo->data != NULL) {
-               LIST_DELINIT(&buf->maplist);
-               return buf->bo->data;
-       }
-
        if (flags & PB_USAGE_DONTBLOCK) {
                uint32_t domain;
                if (radeon_bo_busy(buf->mgr->radeon, buf->bo, &domain))
                        return NULL;
        }
 
-       if (radeon_bo_map(buf->mgr->radeon, buf->bo)) {
-               return NULL;
+       if (buf->bo->data != NULL) {
+               if (radeon_bo_wait(buf->mgr->radeon, buf->bo)) {
+                       return NULL;
+               }
+       } else {
+               if (radeon_bo_map(buf->mgr->radeon, buf->bo)) {
+                       return NULL;
+               }
+               if (radeon_bo_wait(buf->mgr->radeon, buf->bo)) {
+                       radeon_bo_unmap(buf->mgr->radeon, buf->bo);
+                       return NULL;
+               }
        }
+
        LIST_DELINIT(&buf->maplist);
        return buf->bo->data;
 }
index 8114526a14aa1db732ade15f039560b306675002..daaf2cbc51a97990a0b45943eb9da4fbbb2da0a5 100644 (file)
@@ -72,17 +72,6 @@ void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst,
        *dst = src;
 }
 
-int radeon_ws_bo_wait(struct radeon *radeon, struct radeon_ws_bo *pb_bo)
-{
-       /* TODO */
-       struct radeon_bo *bo;
-       bo = radeon_bo_pb_get_bo(pb_bo->pb);
-       if (!bo)
-               return 0;
-       radeon_bo_wait(radeon, bo);
-       return 0;
-}
-
 unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo)
 {
        struct radeon_bo *bo;