summaryrefslogtreecommitdiff
path: root/src/sna/sna_dri2.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-08-17 20:38:57 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-08-17 20:57:54 +0100
commit07eee812b2047642c76190d043ee4aa4ce338c64 (patch)
treea21fd734448f0706c5cd030062bd01c4400998f7 /src/sna/sna_dri2.c
parent1b3cf1efe3c091f5c4c519c81381475fb2587383 (diff)
sna/dri2: Avoid pushing the triple buffer into the cache list twice
A side effect of commit 4cea8037984c3d5e171be22710384f66660ca4c6 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Sat Aug 8 22:10:20 2015 +0100 sna/dri2: Restore caching of fullscreen triple buffers was that we discovered that we had been inserting the buffer into the cache list multiple times. Reported-by: Dan Doel <dan.doel@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=91658#c5 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.c78
1 files changed, 6 insertions, 72 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 43898164..1d311f01 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -205,61 +205,6 @@ static struct dri2_window *dri2_window(WindowPtr win)
}
static void
-sna_dri2_cache_bo(struct sna *sna,
- DrawablePtr draw,
- struct kgem_bo *bo,
- uint32_t name,
- uint32_t size,
- uint32_t flags)
-{
- struct dri_bo *c;
-
- DBG(("%s(handle=%d, name=%d)\n", __FUNCTION__, bo->handle, name));
-
- if (draw == NULL) {
- DBG(("%s: no draw, releasing handle=%d\n",
- __FUNCTION__, bo->handle));
- goto err;
- }
-
- if (bo->refcnt > 1) {
- DBG(("%s: multiple references [%d], releasing handle\n",
- __FUNCTION__, bo->refcnt, bo->handle));
- goto err;
- }
-
- if ((draw->height << 16 | draw->width) != size) {
- DBG(("%s: wrong size [%dx%d], releasing handle\n",
- __FUNCTION__,
- size & 0xffff, size >> 16,
- bo->handle));
- goto err;
- }
-
- if (bo->scanout && front_pitch(draw) != bo->pitch) {
- DBG(("%s: scanout with pitch change [%d %= %d], releasing handle\n",
- __FUNCTION__, bo->pitch, front_pitch(draw), bo->handle));
- goto err;
- }
-
- c = malloc(sizeof(*c));
- if (!c)
- goto err;
-
- DBG(("%s: caching handle=%d (name=%d, flags=%d, active_scanout=%d)\n", __FUNCTION__, bo->handle, name, flags, bo->active_scanout));
-
- c->bo = bo;
- c->name = name;
- c->flags = flags;
- list_add(&c->link, &dri2_window((WindowPtr)draw)->cache);
- return;
-
-err:
- assert(bo->active_scanout == 0 || bo->scanout);
- kgem_bo_destroy(&sna->kgem, bo);
-}
-
-static void
sna_dri2_get_back(struct sna *sna,
DrawablePtr draw,
DRI2BufferPtr back)
@@ -843,11 +788,7 @@ static void _sna_dri2_destroy_buffer(struct sna *sna,
if (private->copy.bo) {
assert(private->copy.bo->active_scanout);
private->copy.bo->active_scanout--;
- sna_dri2_cache_bo(sna, draw,
- private->copy.bo,
- private->copy.name,
- private->copy.size,
- private->copy.flags);
+ kgem_bo_destroy(&sna->kgem, private->copy.bo);
}
if (private->pixmap) {
@@ -2405,13 +2346,9 @@ static void chain_swap(struct sna_dri2_event *chain)
chain->back->flags = tmp.flags;
chain->back->pitch = tmp.bo->pitch;
- sna_dri2_cache_bo(chain->sna, chain->draw,
- get_private(chain->back)->copy.bo,
- get_private(chain->back)->copy.name,
- get_private(chain->back)->copy.size,
- get_private(chain->back)->copy.flags);
- } else
- kgem_bo_destroy(&chain->sna->kgem, tmp.bo);
+ tmp.bo = get_private(chain->back)->copy.bo;
+ }
+ kgem_bo_destroy(&chain->sna->kgem, tmp.bo);
get_private(chain->back)->copy.bo = ref(get_private(chain->back)->bo);
get_private(chain->back)->copy.name = chain->back->name;
@@ -2698,11 +2635,8 @@ sna_dri2_immediate_blit(struct sna *sna,
if (get_private(info->back)->copy.bo) {
assert(get_private(info->back)->copy.bo->active_scanout);
get_private(info->back)->copy.bo->active_scanout--;
- sna_dri2_cache_bo(sna, info->draw,
- get_private(info->back)->copy.bo,
- get_private(info->back)->copy.name,
- get_private(info->back)->copy.size,
- get_private(info->back)->copy.flags);
+ kgem_bo_destroy(&sna->kgem,
+ get_private(info->back)->copy.bo);
}
get_private(info->back)->copy.bo = ref(get_private(info->back)->bo);
get_private(info->back)->copy.name = info->back->name;