From 95f3734dd69b82e007095a599cc21f4c63d6ec00 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 30 Jan 2012 11:40:02 +0000 Subject: [PATCH] sna: Allow creation of proxies to proxies Just update the offset of the new bo by the offset of the existing proxy. Signed-off-by: Chris Wilson --- src/sna/kgem.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 64f729ba..30c46fb7 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -3105,20 +3105,25 @@ struct kgem_bo *kgem_create_proxy(struct kgem_bo *target, DBG(("%s: target handle=%d, offset=%d, length=%d, io=%d\n", __FUNCTION__, target->handle, offset, length, target->io)); - assert(target->proxy == NULL); bo = __kgem_bo_alloc(target->handle, length); if (bo == NULL) return NULL; + bo->reusable = false; bo->size.bytes = length; + bo->io = target->io; bo->dirty = target->dirty; bo->tiling = target->tiling; bo->pitch = target->pitch; + + if (target->proxy) { + offset += target->delta; + target = target->proxy; + } bo->proxy = kgem_bo_reference(target); bo->delta = offset; - bo->reusable = false; return bo; }