From 8150b1a276af390a2c5097235806f24d05b36b1b Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 26 Aug 2015 16:49:44 +0100 Subject: [PATCH 4/8] nouveau: preserve content buffer when calling nvc0_decoder_bsp_next https://bugs.freedesktop.org/show_bug.cgi?id=89969 Signed-off-by: Julien Isorce --- src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c index 0c5d288..0d3ef7b 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c @@ -249,6 +249,21 @@ nvc0_decoder_bsp_next(struct nouveau_vp3_decoder *dec, return -1; } + if (dec->nb_slices > 0) { + /* Preserve previous buffer. */ + ret = nouveau_bo_map(tmp_bo, NOUVEAU_BO_WR, dec->client); + if (ret) { + debug_printf("map failed: %i %s\n", ret, strerror(-ret)); + return -1; + } + nouveau_bo_map(bsp_bo, NOUVEAU_BO_RD, dec->client); + if (ret) { + debug_printf("map failed: %i %s\n", ret, strerror(-ret)); + return -1; + } + memcpy(tmp_bo->map, bsp_bo->map, bsp_size); + } + nouveau_bo_ref(NULL, &bsp_bo); dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH] = bsp_bo = tmp_bo; } @@ -267,6 +282,21 @@ nvc0_decoder_bsp_next(struct nouveau_vp3_decoder *dec, return -1; } + if (dec->nb_slices > 0) { + /* Preserve previous buffer. */ + ret = nouveau_bo_map(tmp_bo, NOUVEAU_BO_WR, dec->client); + if (ret) { + debug_printf("map failed: %i %s\n", ret, strerror(-ret)); + return -1; + } + nouveau_bo_map(inter_bo, NOUVEAU_BO_RD, dec->client); + if (ret) { + debug_printf("map failed: %i %s\n", ret, strerror(-ret)); + return -1; + } + memcpy(tmp_bo->map, inter_bo->map, bsp_bo->size * 4); + } + nouveau_bo_ref(NULL, &inter_bo); dec->inter_bo[comm_seq & 1] = inter_bo = tmp_bo; } -- 1.9.1