[Mesa-dev] [PATCH 4/8] nouveau: preserve content buffer when calling nvc0_decoder_bsp_next
Julien Isorce
j.isorce at samsung.com
Thu Aug 27 07:16:02 PDT 2015
https://bugs.freedesktop.org/show_bug.cgi?id=89969
Signed-off-by: Julien Isorce <j.isorce at 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
More information about the mesa-dev
mailing list