nvc0: fix push_space checks for video decoding
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>
Wed, 26 Jun 2013 14:18:42 +0000 (16:18 +0200)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Wed, 26 Jun 2013 14:18:42 +0000 (16:18 +0200)
src/gallium/drivers/nvc0/nvc0_video.c
src/gallium/drivers/nvc0/nvc0_video_bsp.c
src/gallium/drivers/nvc0/nvc0_video_ppp.c
src/gallium/drivers/nvc0/nvc0_video_vp.c

index cf61804bd0f961d748a2bf771502dedc7a8a4182..ad40b9456f62b208db880671a7f8d05127f9a29a 100644 (file)
@@ -450,7 +450,7 @@ nvc0_create_decoder(struct pipe_context *context,
    dec->comm = (struct comm *)(dec->fence_map + (COMM_OFFSET/sizeof(*dec->fence_map)));
 
    /* So lets test if the fence is working? */
-   PUSH_SPACE(push[0], 6);
+   nouveau_pushbuf_space(push[0], 6, 1, 0);
    PUSH_REFN (push[0], dec->fence_bo, NOUVEAU_BO_GART|NOUVEAU_BO_RDWR);
    BEGIN_NVC0(push[0], SUBC_BSP(0x240), 3);
    PUSH_DATAh(push[0], dec->fence_bo->offset);
@@ -461,7 +461,7 @@ nvc0_create_decoder(struct pipe_context *context,
    PUSH_DATA (push[0], 0);
    PUSH_KICK (push[0]);
 
-   PUSH_SPACE(push[1], 6);
+   nouveau_pushbuf_space(push[1], 6, 1, 0);
    PUSH_REFN (push[1], dec->fence_bo, NOUVEAU_BO_GART|NOUVEAU_BO_RDWR);
    BEGIN_NVC0(push[1], SUBC_VP(0x240), 3);
    PUSH_DATAh(push[1], (dec->fence_bo->offset + 0x10));
@@ -472,7 +472,7 @@ nvc0_create_decoder(struct pipe_context *context,
    PUSH_DATA (push[1], 0);
    PUSH_KICK (push[1]);
 
-   PUSH_SPACE(push[2], 6);
+   nouveau_pushbuf_space(push[2], 6, 1, 0);
    PUSH_REFN (push[2], dec->fence_bo, NOUVEAU_BO_GART|NOUVEAU_BO_RDWR);
    BEGIN_NVC0(push[2], SUBC_PPP(0x240), 3);
    PUSH_DATAh(push[2], (dec->fence_bo->offset + 0x20));
index 09e78aa5059632b3af9a35477c217be4d10eaaa4..450dc2bb528b0c38c8df4b27eaa358ea04fa6372 100644 (file)
@@ -268,6 +268,9 @@ nvc0_decoder_bsp(struct nvc0_decoder *dec, union pipe_desc desc,
    };
    int num_refs = sizeof(bo_refs)/sizeof(*bo_refs);
 
+   if (!dec->bitplane_bo)
+      num_refs--;
+
 #ifdef NVC0_DEBUG_FENCE
    fence_extra = 4;
 #endif
@@ -309,9 +312,7 @@ nvc0_decoder_bsp(struct nvc0_decoder *dec, union pipe_desc desc,
 
    nvc0_decoder_vp_caps(dec, desc, target, comm_seq, vp_caps, is_ref, refs);
 
-   PUSH_SPACE(push, 6 + (codec == PIPE_VIDEO_CODEC_MPEG4_AVC ? 9 : 7) + fence_extra + 2);
-   if (!dec->bitplane_bo)
-      num_refs--;
+   nouveau_pushbuf_space(push, 6 + (codec == PIPE_VIDEO_CODEC_MPEG4_AVC ? 9 : 7) + fence_extra + 2, num_refs, 0);
    nouveau_pushbuf_refn(push, bo_refs, num_refs);
 
    caps |= 0 << 16; // reset struct comm if flag is set
index 4eb5932e051cb9990fd1258c292115ad489f686e..efa25270e8d949b412dfd851d5114423f4c9cb3f 100644 (file)
@@ -99,7 +99,7 @@ nvc0_decoder_ppp(struct nvc0_decoder *dec, union pipe_desc desc, struct nvc0_vid
    fence_extra = 4;
 #endif
 
-   PUSH_SPACE(push, 11 + (codec == PIPE_VIDEO_CODEC_VC1 ? 2 : 0) + 3 + fence_extra + 2);
+   nouveau_pushbuf_space(push, 11 + (codec == PIPE_VIDEO_CODEC_VC1 ? 2 : 0) + 3 + fence_extra + 2, 4, 0);
 
    switch (codec) {
    case PIPE_VIDEO_CODEC_MPEG12: {
index eab544da2d34b234adddfb4e717203c30abdc927..1ecdd2d91f033f8c13efd91d18100a5e32d7e2be 100644 (file)
@@ -580,8 +580,8 @@ nvc0_decoder_vp(struct nvc0_decoder *dec, union pipe_desc desc,
    if (!is_ref)
       nvc0_decoder_kick_ref(dec, target);
 
-   PUSH_SPACE(push, 8 + 3 * (codec != PIPE_VIDEO_CODEC_MPEG12) +
-              6 + codec_extra + fence_extra + 2);
+   nouveau_pushbuf_space(push, 8 + 3 * (codec != PIPE_VIDEO_CODEC_MPEG12) +
+              6 + codec_extra + fence_extra + 2, num_refs, 0);
 
    nouveau_pushbuf_refn(push, bo_refs, num_refs);