https://bugs.freedesktop.org/show_bug.cgi?id=89969 Signed-off-by: Julien Isorce <j.iso...@samsung.com> --- src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c | 34 +++++++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c index 0c5d288..c1e7164 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c @@ -234,23 +234,36 @@ nvc0_decoder_bsp_next(struct nouveau_vp3_decoder *dec, if (!bsp_bo || bsp_size > bsp_bo->size) { union nouveau_bo_config cfg; struct nouveau_bo *tmp_bo = NULL; + uint32_t bsp_new_size = bsp_size; + + /* round up to the nearest mb */ + bsp_new_size += (1 << 20) - 1; + bsp_new_size &= ~((1 << 20) - 1); cfg.nvc0.tile_mode = 0x10; cfg.nvc0.memtype = 0xfe; - /* round up to the nearest mb */ - bsp_size += (1 << 20) - 1; - bsp_size &= ~((1 << 20) - 1); - - ret = nouveau_bo_new(dec->bitplane_bo->device, NOUVEAU_BO_VRAM, 0, bsp_size, &cfg, &tmp_bo); + ret = nouveau_bo_new(dec->bitplane_bo->device, NOUVEAU_BO_VRAM, 0, bsp_new_size, &cfg, &tmp_bo); if (ret) { debug_printf("resizing bsp %u -> %u failed with %i\n", - bsp_bo ? (unsigned)bsp_bo->size : 0, bsp_size, ret); + bsp_bo ? (unsigned)bsp_bo->size : 0, bsp_new_size, ret); + return -1; + } + + 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; } + /* Preserve previous buffer. */ + memcpy(tmp_bo->map, bsp_bo->map, bsp_bo->size); + nouveau_bo_ref(NULL, &bsp_bo); dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH] = bsp_bo = tmp_bo; + + /* update position to current chunk */ + dec->bsp_ptr = bsp_bo->map + dec->bsp_size; } if (!inter_bo || bsp_bo->size * 4 > inter_bo->size) { @@ -267,6 +280,15 @@ nvc0_decoder_bsp_next(struct nouveau_vp3_decoder *dec, return -1; } + 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; + } + + /* Preserve previous buffer. */ + 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 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev