util: Move gallium's PIPE_FORMAT utils to /util/format/
[mesa.git] / src / gallium / state_trackers / vdpau / decode.c
index 3233799d6503eb89b0eceb331bb54f118b09cf17..48dfb0e000370c85876744b0b8ac5b10c0a34c49 100644 (file)
@@ -71,7 +71,7 @@ vlVdpDecoderCreate(VdpDevice device,
    pipe = dev->context;
    screen = dev->vscreen->pscreen;
 
-   pipe_mutex_lock(dev->mutex);
+   mtx_lock(&dev->mutex);
 
    supported = screen->get_video_param
    (
@@ -81,7 +81,7 @@ vlVdpDecoderCreate(VdpDevice device,
       PIPE_VIDEO_CAP_SUPPORTED
    );
    if (!supported) {
-      pipe_mutex_unlock(dev->mutex);
+      mtx_unlock(&dev->mutex);
       return VDP_STATUS_INVALID_DECODER_PROFILE;
    }
 
@@ -100,13 +100,13 @@ vlVdpDecoderCreate(VdpDevice device,
       PIPE_VIDEO_CAP_MAX_HEIGHT
    );
    if (width > maxwidth || height > maxheight) {
-      pipe_mutex_unlock(dev->mutex);
+      mtx_unlock(&dev->mutex);
       return VDP_STATUS_INVALID_SIZE;
    }
 
    vldecoder = CALLOC(1,sizeof(vlVdpDecoder));
    if (!vldecoder) {
-      pipe_mutex_unlock(dev->mutex);
+      mtx_unlock(&dev->mutex);
       return VDP_STATUS_RESOURCES;
    }
 
@@ -136,8 +136,8 @@ vlVdpDecoderCreate(VdpDevice device,
       goto error_handle;
    }
 
-   pipe_mutex_init(vldecoder->mutex);
-   pipe_mutex_unlock(dev->mutex);
+   (void) mtx_init(&vldecoder->mutex, mtx_plain);
+   mtx_unlock(&dev->mutex);
 
    return VDP_STATUS_OK;
 
@@ -145,7 +145,7 @@ error_handle:
    vldecoder->decoder->destroy(vldecoder->decoder);
 
 error_decoder:
-   pipe_mutex_unlock(dev->mutex);
+   mtx_unlock(&dev->mutex);
    DeviceReference(&vldecoder->device, NULL);
    FREE(vldecoder);
    return ret;
@@ -163,10 +163,10 @@ vlVdpDecoderDestroy(VdpDecoder decoder)
    if (!vldecoder)
       return VDP_STATUS_INVALID_HANDLE;
 
-   pipe_mutex_lock(vldecoder->mutex);
+   mtx_lock(&vldecoder->mutex);
    vldecoder->decoder->destroy(vldecoder->decoder);
-   pipe_mutex_unlock(vldecoder->mutex);
-   pipe_mutex_destroy(vldecoder->mutex);
+   mtx_unlock(&vldecoder->mutex);
+   mtx_destroy(&vldecoder->mutex);
 
    vlRemoveDataHTAB(decoder);
    DeviceReference(&vldecoder->device, NULL);
@@ -518,6 +518,7 @@ vlVdpDecoderRenderH265(struct pipe_h265_picture_desc *picture,
    memcpy(picture->RefPicSetStCurrBefore, picture_info->RefPicSetStCurrBefore, 8);
    memcpy(picture->RefPicSetStCurrAfter, picture_info->RefPicSetStCurrAfter, 8);
    memcpy(picture->RefPicSetLtCurr, picture_info->RefPicSetLtCurr, 8);
+   picture->UseRefPicList = false;
 
    return VDP_STATUS_OK;
 }
@@ -526,7 +527,7 @@ static void
 vlVdpDecoderFixVC1Startcode(uint32_t *num_buffers, const void *buffers[], unsigned sizes[])
 {
    static const uint8_t vc1_startcode[] = { 0x00, 0x00, 0x01, 0x0D };
-   struct vl_vlc vlc;
+   struct vl_vlc vlc = {};
    unsigned i;
 
    /* search the first 64 bytes for a startcode */
@@ -613,7 +614,7 @@ vlVdpDecoderRender(VdpDecoder decoder,
                                           dec->profile, PIPE_VIDEO_ENTRYPOINT_BITSTREAM) ||
        !buffer_support[vlsurf->video_buffer->interlaced]) {
 
-      pipe_mutex_lock(vlsurf->device->mutex);
+      mtx_lock(&vlsurf->device->mutex);
 
       /* destroy the old one */
       if (vlsurf->video_buffer)
@@ -632,11 +633,11 @@ vlVdpDecoderRender(VdpDecoder decoder,
 
       /* still no luck? get me out of here... */
       if (!vlsurf->video_buffer) {
-         pipe_mutex_unlock(vlsurf->device->mutex);
+         mtx_unlock(&vlsurf->device->mutex);
          return VDP_STATUS_NO_IMPLEMENTATION;
       }
       vlVdpVideoSurfaceClear(vlsurf);
-      pipe_mutex_unlock(vlsurf->device->mutex);
+      mtx_unlock(&vlsurf->device->mutex);
    }
 
    for (i = 0; i < bitstream_buffer_count; ++i) {
@@ -673,10 +674,10 @@ vlVdpDecoderRender(VdpDecoder decoder,
    if (ret != VDP_STATUS_OK)
       return ret;
 
-   pipe_mutex_lock(vldecoder->mutex);
+   mtx_lock(&vldecoder->mutex);
    dec->begin_frame(dec, vlsurf->video_buffer, &desc.base);
    dec->decode_bitstream(dec, vlsurf->video_buffer, &desc.base, bitstream_buffer_count, buffers, sizes);
    dec->end_frame(dec, vlsurf->video_buffer, &desc.base);
-   pipe_mutex_unlock(vldecoder->mutex);
+   mtx_unlock(&vldecoder->mutex);
    return ret;
 }