Commit 63d1ca2d authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Improve safety of transfer_map

parent f93a13d6
......@@ -1613,10 +1613,19 @@ panfrost_transfer_map(struct pipe_context *pctx,
transfer->level = level;
transfer->usage = usage;
transfer->box = *box;
transfer->stride = resource->width0 * 4 /* XXX: non RGBA */;
*out_transfer = transfer;
struct panfrost_resource *rsrc = (struct panfrost_resource *) resource;
assert(!transfer->box.z);
/* Direct mapping are not possible with tiled textures. TODO: Allow
* direct access of linear resources */
if (transfer->usage & PIPE_TRANSFER_MAP_DIRECTLY)
return NULL;
return ((uint8_t *) rsrc->cpu) + transfer->box.x + transfer->box.y * transfer->stride;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment