Otherwise, the gl-1.0-long-dlist Piglit test crashes.
Fixes: db7757 ("virgl: modify how we handle GL_MAP_FLUSH_EXPLICIT_BIT")
Reported by airlied@
v2: Exit on any invalid range (Erik)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109190
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
if (trans->base.usage & PIPE_TRANSFER_WRITE) {
struct virgl_screen *vs = virgl_screen(ctx->screen);
if (transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT) {
+ if (trans->range.end <= trans->range.start)
+ goto out;
+
transfer->box.x += trans->range.start;
transfer->box.width = trans->range.end - trans->range.start;
trans->offset = transfer->box.x;
}
+out:
virgl_resource_destroy_transfer(vctx, trans);
}