From 14cf9e44fde1d86e7753e98a82420da97459c2c8 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 26 Aug 2015 17:10:13 +0100 Subject: [PATCH 2/8] nouveau: remove nouveau_vp3_bsp to use begin/next/end https://bugs.freedesktop.org/show_bug.cgi?id=89969 Signed-off-by: Julien Isorce --- src/gallium/drivers/nouveau/nouveau_vp3_video.h | 6 -- .../drivers/nouveau/nouveau_vp3_video_bsp.c | 79 ---------------------- src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c | 5 +- src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c | 5 +- 4 files changed, 6 insertions(+), 89 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.h b/src/gallium/drivers/nouveau/nouveau_vp3_video.h index 16563de..42f1539 100644 --- a/src/gallium/drivers/nouveau/nouveau_vp3_video.h +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.h @@ -213,12 +213,6 @@ nouveau_vp3_load_firmware(struct nouveau_vp3_decoder *dec, enum pipe_video_profile profile, unsigned chipset); -uint32_t -nouveau_vp3_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, - struct nouveau_vp3_video_buffer *target, - unsigned comm_seq, unsigned num_buffers, - const void *const *data, const unsigned *num_bytes); - void nouveau_vp3_bsp_begin(struct nouveau_vp3_decoder *dec); diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c index 10dd23b..70e88ba 100644 --- a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c @@ -230,85 +230,6 @@ nouveau_vp3_fill_picparm_h264_bsp(struct nouveau_vp3_decoder *dec, return caps | 3; } -uint32_t -nouveau_vp3_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, - struct nouveau_vp3_video_buffer *target, - unsigned comm_seq, unsigned num_buffers, - const void *const *data, const unsigned *num_bytes) -{ - enum pipe_video_format codec = u_reduce_video_profile(dec->base.profile); - struct nouveau_bo *bsp_bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; - char *bsp; - uint32_t endmarker, caps; - struct strparm_bsp *str_bsp; - int i; - - bsp = bsp_bo->map; - /* - * 0x000..0x100: picparm_bsp - * 0x200..0x500: picparm_vp - * 0x500..0x700: comm - * 0x700..onward: raw bitstream - */ - - switch (codec){ - case PIPE_VIDEO_FORMAT_MPEG12: - endmarker = 0xb7010000; - caps = nouveau_vp3_fill_picparm_mpeg12_bsp(dec, desc.mpeg12, bsp); - break; - case PIPE_VIDEO_FORMAT_MPEG4: - endmarker = 0xb1010000; - caps = nouveau_vp3_fill_picparm_mpeg4_bsp(dec, desc.mpeg4, bsp); - break; - case PIPE_VIDEO_FORMAT_VC1: { - endmarker = 0x0a010000; - caps = nouveau_vp3_fill_picparm_vc1_bsp(dec, desc.vc1, bsp); - break; - } - case PIPE_VIDEO_FORMAT_MPEG4_AVC: { - endmarker = 0x0b010000; - caps = nouveau_vp3_fill_picparm_h264_bsp(dec, desc.h264, bsp); - break; - } - default: assert(0); return -1; - } - - caps |= 0 << 16; // reset struct comm if flag is set - caps |= 1 << 17; // enable watchdog - caps |= 0 << 18; // do not report error to VP, so it can continue decoding what we have - caps |= 0 << 19; // if enabled, use crypto crap? - bsp += 0x100; - - str_bsp = (struct strparm_bsp *)bsp; - memset(str_bsp, 0, 0x80); - str_bsp->w0[0] = 16; - str_bsp->w1[0] = 0x1; - bsp += 0x100; - /* Reserved for picparm_vp */ - bsp += 0x300; - /* Reserved for comm */ -#if !NOUVEAU_VP3_DEBUG_FENCE - memset(bsp, 0, 0x200); -#endif - bsp += 0x200; - for (i = 0; i < num_buffers; ++i) { - memcpy(bsp, data[i], num_bytes[i]); - bsp += num_bytes[i]; - str_bsp->w0[0] += num_bytes[i]; - } - - /* Append end sequence */ - *(uint32_t *)bsp = endmarker; - bsp += 4; - *(uint32_t *)bsp = 0x00000000; - bsp += 4; - *(uint32_t *)bsp = endmarker; - bsp += 4; - *(uint32_t *)bsp = 0x00000000; - - return caps; -} - void nouveau_vp3_bsp_begin(struct nouveau_vp3_decoder *dec) { diff --git a/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c b/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c index 6058c22..ff38acf 100644 --- a/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c +++ b/src/gallium/drivers/nouveau/nv50/nv98_video_bsp.c @@ -106,8 +106,9 @@ nv98_decoder_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, return -1; } - caps = nouveau_vp3_bsp(dec, desc, target, comm_seq, - num_buffers, data, num_bytes); + nouveau_vp3_bsp_begin(dec); + nouveau_vp3_bsp_next(dec, num_buffers, data, num_bytes); + caps = nouveau_vp3_bsp_end(dec, desc); nouveau_vp3_vp_caps(dec, desc, target, comm_seq, vp_caps, is_ref, refs); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c index 9139bc1..385af20 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c @@ -114,8 +114,9 @@ nvc0_decoder_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, return -1; } - caps = nouveau_vp3_bsp(dec, desc, target, comm_seq, - num_buffers, data, num_bytes); + nouveau_vp3_bsp_begin(dec); + nouveau_vp3_bsp_next(dec, num_buffers, data, num_bytes); + caps = nouveau_vp3_bsp_end(dec, desc); nouveau_vp3_vp_caps(dec, desc, target, comm_seq, vp_caps, is_ref, refs); -- 1.9.1