diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-08-18 11:36:46 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-08-18 11:58:21 +0100 |
commit | b86974ffd435b2339cd873131e0f90aedc9c4a42 (patch) | |
tree | 9c31418268a3501f953a2152a14cb72b69cde59c /src/sna/sna_dri2.c | |
parent | 79fc9a923cdfa4218868f4c371ca80fd40f41253 (diff) |
sna/dri2: Do full exchanges of back/pending around deferred swaps
References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_dri2.c')
-rw-r--r-- | src/sna/sna_dri2.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index 0d9ce00f..2f958c97 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -2325,6 +2325,15 @@ static void chain_swap(struct sna_dri2_event *chain) get_private(chain->back)->size = get_private(chain->back)->copy.size; chain->back->flags = get_private(chain->back)->copy.flags; chain->back->pitch = get_private(chain->back)->copy.bo->pitch; + get_private(chain->back)->copy.bo = tmp.bo; + get_private(chain->back)->copy.name = tmp.name; + get_private(chain->back)->copy.size = tmp.size; + get_private(chain->back)->copy.flags = tmp.flags; + + DBG(("%s: adding active marker [%d] to handle=%d\n", + __FUNCTION__, + tmp.bo->active_scanout, tmp.bo->handle)); + tmp.bo->active_scanout++; } if (can_xchg(chain->sna, chain->draw, chain->front, chain->back)) { @@ -2339,27 +2348,34 @@ static void chain_swap(struct sna_dri2_event *chain) } if (get_private(chain->back)->copy.bo) { - if (get_private(chain->back)->copy.bo == get_private(chain->back)->bo) { - get_private(chain->back)->bo = tmp.bo; - chain->back->name = tmp.name; - get_private(chain->back)->size = tmp.size; - chain->back->flags = tmp.flags; - chain->back->pitch = tmp.bo->pitch; - - tmp.bo = get_private(chain->back)->copy.bo; - } - kgem_bo_destroy(&chain->sna->kgem, tmp.bo); + tmp.bo = get_private(chain->back)->copy.bo; + DBG(("%s: removing active marker [%d] from handle=%d\n", + __FUNCTION__, + tmp.bo->active_scanout, tmp.bo->handle)); + assert(tmp.bo->active_scanout); + tmp.bo->active_scanout--; + + tmp.bo = get_private(chain->back)->bo; + tmp.name = chain->back->name; + tmp.size = get_private(chain->back)->size; + tmp.flags = chain->back->flags; + + get_private(chain->back)->bo = get_private(chain->back)->copy.bo; + chain->back->name = get_private(chain->back)->copy.name; + get_private(chain->back)->size = get_private(chain->back)->copy.size; + chain->back->flags = get_private(chain->back)->copy.flags; + chain->back->pitch = get_private(chain->back)->copy.bo->pitch; + get_private(chain->back)->copy.bo = tmp.bo; + get_private(chain->back)->copy.name = tmp.name; + get_private(chain->back)->copy.size = tmp.size; + get_private(chain->back)->copy.flags = tmp.flags; - get_private(chain->back)->copy.bo = ref(get_private(chain->back)->bo); - get_private(chain->back)->copy.name = chain->back->name; - get_private(chain->back)->copy.size = get_private(chain->back)->size; - get_private(chain->back)->copy.flags = chain->back->flags; DBG(("%s: adding active marker [%d] to handle=%d\n", __FUNCTION__, - get_private(chain->back)->bo->active_scanout, - get_private(chain->back)->bo->handle)); - get_private(chain->back)->bo->active_scanout++; + tmp.bo->active_scanout, tmp.bo->handle)); + tmp.bo->active_scanout++; } + assert(get_private(chain->back)->bo != get_private(chain->front)->bo); case SWAP: break; @@ -3287,6 +3303,7 @@ skip: goto fake; *target_msc = current_msc + 1; + swap_limit(draw, 1); } else { fake: /* XXX Use a Timer to throttle the client? */ @@ -3295,7 +3312,6 @@ fake: if (info) sna_dri2_event_free(info); } - swap_limit(draw, 1); DBG(("%s: reported target_msc=%llu\n", __FUNCTION__, *target_msc)); return TRUE; } |