From 20ca2cf458a7e620f314f11ee563e58a736442e8 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Fri, 17 Jul 2015 11:00:07 +0100 Subject: [PATCH] nouveau: add support for chunk decoding --- src/gallium/drivers/nouveau/nouveau_vp3_video.h | 15 ++ .../drivers/nouveau/nouveau_vp3_video_bsp.c | 188 ++++++++++++------- src/gallium/drivers/nouveau/nvc0/nvc0_video.c | 65 +++++-- src/gallium/drivers/nouveau/nvc0/nvc0_video.h | 13 ++ src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c | 206 +++++++++++++++++++++ 5 files changed, 404 insertions(+), 83 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.h b/src/gallium/drivers/nouveau/nouveau_vp3_video.h index 33e3bef..7800cef 100644 --- a/src/gallium/drivers/nouveau/nouveau_vp3_video.h +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.h @@ -89,6 +89,10 @@ struct nouveau_vp3_decoder { struct nouveau_bo *bsp_bo[NOUVEAU_VP3_VIDEO_QDEPTH]; + char *bsp_ptr; + unsigned bsp_size; + unsigned int nb_slices; + // bo's used by each cycle: // bsp_bo: contains raw bitstream data and parameters for BSP and VP. @@ -208,6 +212,17 @@ nouveau_vp3_load_firmware(struct nouveau_vp3_decoder *dec, enum pipe_video_profile profile, unsigned chipset); + +void +nouveau_vp3_bsp_begin(struct nouveau_vp3_decoder *dec); + +void +nouveau_vp3_bsp_next(struct nouveau_vp3_decoder *dec, unsigned num_buffers, + const void *const *data, const unsigned *num_bytes); + +uint32_t +nouveau_vp3_bsp_end(struct nouveau_vp3_decoder *dec, union pipe_desc desc); + uint32_t nouveau_vp3_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, struct nouveau_vp3_video_buffer *target, diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c index 6d968c1..d5e2734 100644 --- a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c @@ -22,6 +22,7 @@ #include "nouveau_vp3_video.h" + struct strparm_bsp { uint32_t w0[4]; // bits 0-23 length, bits 24-31 addr_hi uint32_t w1[4]; // bit 8-24 addr_lo @@ -126,7 +127,10 @@ nouveau_vp3_fill_picparm_mpeg12_bsp(struct nouveau_vp3_decoder *dec, pic_bsp->intra_vlc_format = desc->intra_vlc_format; pic_bsp->pad = 0; for (i = 0; i < 4; ++i) - pic_bsp->f_code[i/2][i%2] = desc->f_code[i/2][i%2] + 1; // FU + pic_bsp->f_code[i/2][i%2] = desc->f_code[i/2][i%2] + 1; // FU + + if (desc->num_slices == 0) + desc->num_slices = dec->nb_slices; return (desc->num_slices << 4) | (dec->base.profile != PIPE_VIDEO_PROFILE_MPEG1); } @@ -230,81 +234,127 @@ 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) +void +nouveau_vp3_bsp_begin(struct nouveau_vp3_decoder *dec) { - enum pipe_video_format codec = u_reduce_video_profile(dec->base.profile); + uint32_t comm_seq = dec->fence_seq; + struct nouveau_bo *bsp_bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; + struct strparm_bsp *str_bsp = NULL; + + unsigned ret = 0; + + dec->bsp_ptr = NULL; + + ret = nouveau_bo_map(bsp_bo, NOUVEAU_BO_WR, dec->client); + if (ret) { + debug_printf("map failed: %i %s\n", ret, strerror(-ret)); + assert(ret == 0); + } + + dec->bsp_ptr = bsp_bo->map; + dec->bsp_size = NOUVEAU_VP3_BSP_RESERVED_SIZE; + dec->nb_slices = 0; + + dec->bsp_ptr += 0x100; + + str_bsp = (struct strparm_bsp *)dec->bsp_ptr; + memset(str_bsp, 0, 0x80); + str_bsp->w0[0] = 16; + str_bsp->w1[0] = 0x1; + dec->bsp_ptr += 0x100; + /* Reserved for picparm_vp */ + dec->bsp_ptr += 0x300; + /* Reserved for comm */ + #if !NOUVEAU_VP3_DEBUG_FENCE + memset(dec->bsp_ptr, 0, 0x200); + #endif + dec->bsp_ptr += 0x200; +} + +void +nouveau_vp3_bsp_next(struct nouveau_vp3_decoder *dec, unsigned num_buffers, + const void *const *data, const unsigned *num_bytes) +{ + uint32_t comm_seq = dec->fence_seq; 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; + char *bsp_origin = bsp_bo->map; + struct strparm_bsp *str_bsp = NULL; + int i = 0; - 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; - } + ++dec->nb_slices; + + bsp_origin += 0x100; + str_bsp = (struct strparm_bsp *)bsp_origin; - 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]; + memcpy(dec->bsp_ptr, data[i], num_bytes[i]); + dec->bsp_ptr += num_bytes[i]; str_bsp->w0[0] += num_bytes[i]; } +} + +uint32_t +nouveau_vp3_bsp_end(struct nouveau_vp3_decoder *dec, union pipe_desc desc) +{ + uint32_t comm_seq = dec->fence_seq; + struct nouveau_bo *bsp_bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; + enum pipe_video_format codec = u_reduce_video_profile(dec->base.profile); + uint32_t caps = 0; + uint32_t endmarker = 0; + + /* + * 0x000..0x100: picparm_bsp + * 0x200..0x500: picparm_vp + * 0x500..0x700: comm + * 0x700..onward: raw bitstream + */ + + switch (codec){ + case PIPE_VIDEO_FORMAT_MPEG12: + caps = nouveau_vp3_fill_picparm_mpeg12_bsp(dec, desc.mpeg12, bsp_bo->map); + endmarker = 0xb7010000; + break; + case PIPE_VIDEO_FORMAT_MPEG4: + caps = nouveau_vp3_fill_picparm_mpeg4_bsp(dec, desc.mpeg4, bsp_bo->map); + endmarker = 0xb1010000; + break; + case PIPE_VIDEO_FORMAT_VC1: + caps = nouveau_vp3_fill_picparm_vc1_bsp(dec, desc.vc1, bsp_bo->map); + endmarker = 0x0a010000; + break; + case PIPE_VIDEO_FORMAT_MPEG4_AVC: + caps = nouveau_vp3_fill_picparm_h264_bsp(dec, desc.h264, bsp_bo->map); + endmarker = 0x0b010000; + 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? + } - /* 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; + /* Append end sequence */ + *(uint32_t *)dec->bsp_ptr = endmarker; + dec->bsp_ptr += 4; + *(uint32_t *)dec->bsp_ptr = 0x00000000; + dec->bsp_ptr += 4; + *(uint32_t *)dec->bsp_ptr = endmarker; + dec->bsp_ptr += 4; + *(uint32_t *)dec->bsp_ptr = 0x00000000; + + return caps; +} + +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) +{ + nouveau_vp3_bsp_begin(dec); + nouveau_vp3_bsp_next(dec, num_buffers, data, num_bytes); + uint32_t caps = nouveau_vp3_bsp_end(dec, desc); - return caps; + return caps; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video.c index 48ffac1..1816a27 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video.c @@ -26,6 +26,22 @@ #include "util/u_format.h" static void +nvc0_decoder_begin_frame(struct pipe_video_codec *decoder, + struct pipe_video_buffer *target, + struct pipe_picture_desc *picture) +{ + struct nouveau_vp3_decoder *dec = (struct nouveau_vp3_decoder *)decoder; + + assert(dec); + assert(target); + assert(target->base.buffer_format == PIPE_FORMAT_NV12); + + ++dec->fence_seq; + + nouveau_vp3_bsp_begin(dec); +} + +static void nvc0_decoder_decode_bitstream(struct pipe_video_codec *decoder, struct pipe_video_buffer *video_target, struct pipe_picture_desc *picture, @@ -34,26 +50,45 @@ nvc0_decoder_decode_bitstream(struct pipe_video_codec *decoder, const unsigned *num_bytes) { struct nouveau_vp3_decoder *dec = (struct nouveau_vp3_decoder *)decoder; - struct nouveau_vp3_video_buffer *target = (struct nouveau_vp3_video_buffer *)video_target; - uint32_t comm_seq = ++dec->fence_seq; - union pipe_desc desc; + uint32_t comm_seq = dec->fence_seq; + unsigned ret = 0; - unsigned vp_caps, is_ref, ret; - struct nouveau_vp3_video_buffer *refs[16] = {}; + assert(dec); - desc.base = picture; + ret = nvc0_decoder_bsp_next_chunk(dec, comm_seq, num_buffers, data, num_bytes); - assert(target->base.buffer_format == PIPE_FORMAT_NV12); + assert(ret == 2); +} - ret = nvc0_decoder_bsp(dec, desc, target, comm_seq, - num_buffers, data, num_bytes, - &vp_caps, &is_ref, refs); +static void +nvc0_decoder_end_frame(struct pipe_video_codec *decoder, + struct pipe_video_buffer *video_target, + struct pipe_picture_desc *picture) +{ + struct nouveau_vp3_decoder *dec = (struct nouveau_vp3_decoder *)decoder; + struct nouveau_vp3_video_buffer *target = (struct nouveau_vp3_video_buffer *)video_target; + uint32_t comm_seq = dec->fence_seq; + uint32_t caps = 0; + union pipe_desc desc; + unsigned vp_caps = 0; + unsigned is_ref = 0; + unsigned ret = 0; - /* did we decode bitstream correctly? */ - assert(ret == 2); + struct nouveau_vp3_video_buffer *refs[16] = {}; + + assert(dec); + + desc.base = picture; + + caps = nouveau_vp3_bsp_end(dec, desc); + + ret = nvc0_decoder_bsp_end_frame(dec, desc, target, comm_seq, caps, &vp_caps, &is_ref, refs); + + /* did we decode bitstream correctly? */ + assert(ret == 2); - nvc0_decoder_vp(dec, desc, target, comm_seq, vp_caps, is_ref, refs); - nvc0_decoder_ppp(dec, desc, target, comm_seq); + nvc0_decoder_vp(dec, desc, target, comm_seq, vp_caps, is_ref, refs); + nvc0_decoder_ppp(dec, desc, target, comm_seq); } struct pipe_video_codec * @@ -164,7 +199,9 @@ nvc0_create_decoder(struct pipe_context *context, PUSH_DATA (push[2], dec->ppp->handle); dec->base.context = context; + dec->base.begin_frame = nvc0_decoder_begin_frame; dec->base.decode_bitstream = nvc0_decoder_decode_bitstream; + dec->base.end_frame = nvc0_decoder_end_frame; for (i = 0; i < NOUVEAU_VP3_VIDEO_QDEPTH && !ret; ++i) ret = nouveau_bo_new(screen->device, NOUVEAU_BO_VRAM, diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video.h b/src/gallium/drivers/nouveau/nvc0/nvc0_video.h index 9ee0280..f5ab8d4 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video.h +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video.h @@ -29,6 +29,19 @@ #include "util/u_video.h" + +extern unsigned +nvc0_decoder_bsp_next_chunk(struct nouveau_vp3_decoder *dec, + unsigned comm_seq, unsigned num_buffers, + const void *const *data, const unsigned *num_bytes); + +extern unsigned +nvc0_decoder_bsp_end_frame(struct nouveau_vp3_decoder *dec, union pipe_desc desc, + struct nouveau_vp3_video_buffer *target, + unsigned comm_seq, + uint32_t caps, unsigned *vp_caps, unsigned *is_ref, + struct nouveau_vp3_video_buffer *refs[16]); + extern unsigned nvc0_decoder_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, struct nouveau_vp3_video_buffer *target, diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c index 9139bc1..786d2a7 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c @@ -31,6 +31,212 @@ static void dump_comm_bsp(struct comm *comm) } #endif + +unsigned +nvc0_decoder_bsp_next_chunk(struct nouveau_vp3_decoder *dec, + unsigned comm_seq, unsigned num_buffers, + const void *const *data, const unsigned *num_bytes) +{ + struct nouveau_bo *bsp_bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; + struct nouveau_bo *inter_bo = dec->inter_bo[comm_seq & 1]; + uint32_t bsp_size = 0; + uint32_t i = 0; + unsigned ret = 0; + + bsp_size = dec->bsp_size; + for (i = 0; i < num_buffers; i++) + bsp_size += num_bytes[i]; + bsp_size += 256; /* the 4 end markers */ + + if (!bsp_bo || bsp_size > bsp_bo->size) { + union nouveau_bo_config cfg; + struct nouveau_bo *tmp_bo = NULL; + + 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); + + printf(" *** TODOD need to resize nouveau_bo \n"); + + ret = nouveau_bo_new(dec->bitplane_bo->device, NOUVEAU_BO_VRAM, 0, bsp_size, &cfg, &tmp_bo); + if (ret) { + debug_printf("reallocating bsp %u -> %u failed with %i\n", + bsp_bo ? (unsigned)bsp_bo->size : 0, bsp_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; + } + nouveau_bo_map(bsp_bo, NOUVEAU_BO_RD, dec->client); + memcpy(tmp_bo->map, bsp_bo->map, bsp_size);*/ + // TODO map again ? + + nouveau_bo_ref(NULL, &bsp_bo); + dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH] = bsp_bo = tmp_bo; + } + + if (!inter_bo || bsp_bo->size * 4 > inter_bo->size) { + union nouveau_bo_config cfg; + struct nouveau_bo *tmp_bo = NULL; + + cfg.nvc0.tile_mode = 0x10; + cfg.nvc0.memtype = 0xfe; + + ret = nouveau_bo_new(dec->bitplane_bo->device, NOUVEAU_BO_VRAM, 0, bsp_bo->size * 4, &cfg, &tmp_bo); + if (ret) { + debug_printf("reallocating inter %u -> %u failed with %i\n", + inter_bo ? (unsigned)inter_bo->size : 0, (unsigned)bsp_bo->size * 4, 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; + } + nouveau_bo_map(inter_bo, NOUVEAU_BO_RD, dec->client); + memcpy(tmp_bo->map, inter_bo->map, bsp_bo->size * 4);*/ + // TODO map again ? + + nouveau_bo_ref(NULL, &inter_bo); + dec->inter_bo[comm_seq & 1] = inter_bo = tmp_bo; + } + + dec->bsp_size = bsp_size - 256; + + // move this to resize + /*ret = nouveau_bo_map(bsp_bo, NOUVEAU_BO_WR, dec->client); + if (ret) { + debug_printf("map failed: %i %s\n", ret, strerror(-ret)); + return -1; + }*/ + + nouveau_vp3_bsp_next(dec, num_buffers, data, num_bytes); + + return 2; +} + + +unsigned +nvc0_decoder_bsp_end_frame(struct nouveau_vp3_decoder *dec, union pipe_desc desc, + struct nouveau_vp3_video_buffer *target, + unsigned comm_seq, + uint32_t caps, unsigned *vp_caps, unsigned *is_ref, + struct nouveau_vp3_video_buffer *refs[16]) +{ + struct nouveau_pushbuf *push = dec->pushbuf[0]; + enum pipe_video_format codec = u_reduce_video_profile(dec->base.profile); + uint32_t bsp_addr, comm_addr, inter_addr; + uint32_t slice_size, bucket_size, ring_size; + struct nouveau_bo *bsp_bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; + struct nouveau_bo *inter_bo = dec->inter_bo[comm_seq & 1]; + unsigned fence_extra = 0; + struct nouveau_pushbuf_refn bo_refs[] = { + { bsp_bo, NOUVEAU_BO_RD | NOUVEAU_BO_VRAM }, + { inter_bo, NOUVEAU_BO_WR | NOUVEAU_BO_VRAM }, + #if NOUVEAU_VP3_DEBUG_FENCE + { dec->fence_bo, NOUVEAU_BO_WR | NOUVEAU_BO_GART }, + #endif + { dec->bitplane_bo, NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM }, + }; + int num_refs = sizeof(bo_refs)/sizeof(*bo_refs); + + if (!dec->bitplane_bo) + num_refs--; + + #if NOUVEAU_VP3_DEBUG_FENCE + fence_extra = 4; + #endif + + bo_refs[0].bo = dec->bsp_bo[comm_seq % NOUVEAU_VP3_VIDEO_QDEPTH]; + bo_refs[1].bo = dec->inter_bo[comm_seq & 1]; + + nouveau_vp3_vp_caps(dec, desc, target, comm_seq, vp_caps, is_ref, refs); + + nouveau_pushbuf_space(push, 6 + (codec == PIPE_VIDEO_FORMAT_MPEG4_AVC ? 9 : 7) + fence_extra + 2, num_refs, 0); + nouveau_pushbuf_refn(push, bo_refs, num_refs); + + bsp_addr = bsp_bo->offset >> 8; + inter_addr = inter_bo->offset >> 8; + + #if NOUVEAU_VP3_DEBUG_FENCE + memset(dec->comm, 0, 0x200); + comm_addr = (dec->fence_bo->offset + COMM_OFFSET) >> 8; + #else + comm_addr = bsp_addr + (COMM_OFFSET>>8); + #endif + + BEGIN_NVC0(push, SUBC_BSP(0x700), 5); + PUSH_DATA (push, caps); // 700 cmd + PUSH_DATA (push, bsp_addr + 1); // 704 strparm_bsp + PUSH_DATA (push, bsp_addr + 7); // 708 str addr + PUSH_DATA (push, comm_addr); // 70c comm + PUSH_DATA (push, comm_seq); // 710 seq + + if (codec != PIPE_VIDEO_FORMAT_MPEG4_AVC) { + u32 bitplane_addr; + + bitplane_addr = dec->bitplane_bo->offset >> 8; + + nouveau_vp3_inter_sizes(dec, 1, &slice_size, &bucket_size, &ring_size); + BEGIN_NVC0(push, SUBC_BSP(0x400), 6); + PUSH_DATA (push, bsp_addr); // 400 picparm addr + PUSH_DATA (push, inter_addr); // 404 interparm addr + PUSH_DATA (push, inter_addr + slice_size + bucket_size); // 408 interdata addr + PUSH_DATA (push, ring_size << 8); // 40c interdata_size + PUSH_DATA (push, bitplane_addr); // 410 BITPLANE_DATA + PUSH_DATA (push, 0x400); // 414 BITPLANE_DATA_SIZE + } else { + nouveau_vp3_inter_sizes(dec, desc.h264->slice_count, &slice_size, &bucket_size, &ring_size); + BEGIN_NVC0(push, SUBC_BSP(0x400), 8); + PUSH_DATA (push, bsp_addr); // 400 picparm addr + PUSH_DATA (push, inter_addr); // 404 interparm addr + PUSH_DATA (push, slice_size << 8); // 408 interparm size? + PUSH_DATA (push, inter_addr + slice_size + bucket_size); // 40c interdata addr + PUSH_DATA (push, ring_size << 8); // 410 interdata size + PUSH_DATA (push, inter_addr + slice_size); // 414 bucket? + PUSH_DATA (push, bucket_size << 8); // 418 bucket size? unshifted.. + PUSH_DATA (push, 0); // 41c targets + // TODO: Double check 414 / 418 with nvidia trace + } + + #if NOUVEAU_VP3_DEBUG_FENCE + BEGIN_NVC0(push, SUBC_BSP(0x240), 3); + PUSH_DATAh(push, dec->fence_bo->offset); + PUSH_DATA (push, dec->fence_bo->offset); + PUSH_DATA (push, dec->fence_seq); + + BEGIN_NVC0(push, SUBC_BSP(0x300), 1); + PUSH_DATA (push, 1); + PUSH_KICK (push); + + { + unsigned spin = 0; + do { + usleep(100); + if ((spin++ & 0xff) == 0xff) { + debug_printf("b%u: %u\n", dec->fence_seq, dec->fence_map[0]); + dump_comm_bsp(dec->comm); + } + } while (dec->fence_seq > dec->fence_map[0]); + } + + dump_comm_bsp(dec->comm); + return dec->comm->status[comm_seq & 0xf]; + #else + BEGIN_NVC0(push, SUBC_BSP(0x300), 1); + PUSH_DATA (push, 0); + PUSH_KICK (push); + return 2; + #endif +} + unsigned nvc0_decoder_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, struct nouveau_vp3_video_buffer *target, -- 1.9.1