*/
void iris_bo_unreference(struct iris_bo *bo);
-#define MAP_READ 0x01
-#define MAP_WRITE 0x02
-#define MAP_ASYNC 0x20
-#define MAP_PERSISTENT 0x40
-#define MAP_COHERENT 0x80
+#define MAP_READ PIPE_TRANSFER_READ
+#define MAP_WRITE PIPE_TRANSFER_WRITE
+#define MAP_ASYNC PIPE_TRANSFER_UNSYNCHRONIZED
+#define MAP_PERSISTENT PIPE_TRANSFER_PERSISTENT
+#define MAP_COHERENT PIPE_TRANSFER_COHERENT
/* internal */
#define MAP_INTERNAL_MASK (0xff << 24)
#define MAP_RAW (0x01 << 24)
* transfer
*/
static void *
-iris_transfer_map(struct pipe_context *pipe,
+iris_transfer_map(struct pipe_context *ctx,
struct pipe_resource *resource,
unsigned level,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
struct pipe_transfer **ptransfer)
{
- struct pipe_transfer *transfer;
+ struct iris_context *ice = (struct iris_context *)ctx;
struct iris_resource *res = (struct iris_resource *)resource;
+ struct pipe_transfer *transfer;
+
+ // PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE
+ // PIPE_TRANSFER_DISCARD_RANGE
+ // PIPE_TRANSFER_MAP_DIRECTLY
transfer = calloc(1, sizeof(struct pipe_transfer));
if (!transfer)
return NULL;
+
pipe_resource_reference(&transfer->resource, resource);
transfer->level = level;
transfer->usage = usage;
transfer->layer_stride = 1;
*ptransfer = transfer;
- return NULL;
+#if 0
+ if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
+ iris_batch_references(&ice->batch, res->bo)) {
+ iris_batch_flush(&ice->batch);
+ }
+#endif
+
+ if ((usage & PIPE_TRANSFER_DONTBLOCK) && iris_bo_busy(res->bo))
+ return NULL;
+
+ usage &= (PIPE_TRANSFER_READ |
+ PIPE_TRANSFER_WRITE |
+ PIPE_TRANSFER_UNSYNCHRONIZED |
+ PIPE_TRANSFER_PERSISTENT |
+ PIPE_TRANSFER_COHERENT);
+
+ return iris_bo_map(&ice->dbg, res->bo, usage);
}
static void