diff options
author | Christian König <[email protected]> | 2011-03-18 00:26:34 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2011-03-19 00:06:46 +0100 |
commit | b90f569a0f8578a20b9ee2997396b6c3ddd3b573 (patch) | |
tree | d78c729ae9ace13ca54452184ddfe17628f2b926 /src/gallium/state_trackers | |
parent | 0719fdee2ecd8433eb687a2fb38a2cbcb1cea14a (diff) |
vdpau: merge fixes for vdpau state tracker
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/vdpau/decode.c | 119 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/surface.c | 2 |
2 files changed, 62 insertions, 59 deletions
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 5d3674c5eb2..44f0ecc2622 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -33,37 +33,37 @@ #include <util/u_debug.h> VdpStatus -vlVdpDecoderCreate ( VdpDevice device, - VdpDecoderProfile profile, - uint32_t width, uint32_t height, - uint32_t max_references, - VdpDecoder *decoder +vlVdpDecoderCreate ( VdpDevice device, + VdpDecoderProfile profile, + uint32_t width, uint32_t height, + uint32_t max_references, + VdpDecoder *decoder ) { enum pipe_video_profile p_profile = PIPE_VIDEO_PROFILE_UNKNOWN; VdpStatus ret = VDP_STATUS_OK; vlVdpDecoder *vldecoder = NULL; - + debug_printf("[VDPAU] Creating decoder\n"); - + if (!decoder) return VDP_STATUS_INVALID_POINTER; - + if (!(width && height)) return VDP_STATUS_INVALID_VALUE; - + vlVdpDevice *dev = vlGetDataHTAB(device); if (!dev) { ret = VDP_STATUS_INVALID_HANDLE; goto inv_device; } - + vldecoder = CALLOC(1,sizeof(vlVdpDecoder)); if (!vldecoder) { ret = VDP_STATUS_RESOURCES; goto no_decoder; } - + p_profile = ProfileToPipe(profile); if (p_profile == PIPE_VIDEO_PROFILE_UNKNOWN) { ret = VDP_STATUS_INVALID_DECODER_PROFILE; @@ -71,22 +71,22 @@ vlVdpDecoderCreate ( VdpDevice device, } // TODO: Define max_references. Used mainly for H264 - + vldecoder->profile = p_profile; vldecoder->height = height; vldecoder->width = width; vldecoder->device = dev; vldecoder->vctx = NULL; - + *decoder = vlAddDataHTAB(vldecoder); if (*decoder == 0) { ret = VDP_STATUS_ERROR; goto no_handle; } debug_printf("[VDPAU] Decoder created succesfully\n"); - + return VDP_STATUS_OK; - + no_handle: FREE(vldecoder); inv_profile: @@ -102,23 +102,23 @@ vlVdpDecoderDestroy (VdpDecoder decoder { debug_printf("[VDPAU] Destroying decoder\n"); vlVdpDecoder *vldecoder; - + vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder); if (!vldecoder) { return VDP_STATUS_INVALID_HANDLE; } - + if (vldecoder->vctx) { if (vldecoder->vctx->vscreen) vl_screen_destroy(vldecoder->vctx->vscreen); } - + if (vldecoder->vctx) vl_video_destroy(vldecoder->vctx); - + FREE(vldecoder); - + return VDP_STATUS_OK; } @@ -127,17 +127,18 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, vlVdpSurface *vlsurf ) { + struct pipe_surface surf_template; struct pipe_resource tmplt; struct pipe_resource *surf_tex; struct pipe_video_context *vctx; - + debug_printf("[VDPAU] Creating surface\n"); - + if(!(vldecoder && vlsurf)) return VDP_STATUS_INVALID_POINTER; - + vctx = vldecoder->vctx->vpipe; - + memset(&tmplt, 0, sizeof(struct pipe_resource)); tmplt.target = PIPE_TEXTURE_2D; tmplt.format = vctx->get_param(vctx,PIPE_CAP_DECODE_TARGET_PREFERRED_FORMAT); @@ -156,23 +157,25 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, tmplt.width0 = util_next_power_of_two(vlsurf->width); tmplt.height0 = util_next_power_of_two(vlsurf->height); } - + tmplt.depth0 = 1; tmplt.usage = PIPE_USAGE_DEFAULT; tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; tmplt.flags = 0; - + surf_tex = vctx->screen->resource_create(vctx->screen, &tmplt); - - vlsurf->psurface = vctx->screen->get_tex_surface(vctx->screen, surf_tex, 0, 0, 0, - PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET); - + + memset(&surf_template, 0, sizeof(surf_template)); + surf_template.format = surf_tex->format; + surf_template.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; + vlsurf->psurface = vctx->create_surface(vctx->screen, surf_tex, &surf_template); + pipe_resource_reference(&surf_tex, NULL); - + if (!vlsurf->psurface) return VDP_STATUS_RESOURCES; debug_printf("[VDPAU] Done creating surface\n"); - + return VDP_STATUS_OK; } @@ -194,13 +197,13 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, uint32_t num_macroblocks; struct pipe_mpeg12_macroblock *pipe_macroblocks; VdpStatus ret; - + debug_printf("[VDPAU] Decoding MPEG2\n"); t_vdp_surf = vlsurf; - + /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */ - if (picture_info->backward_reference == VDP_INVALID_HANDLE) + if (picture_info->backward_reference == VDP_INVALID_HANDLE) p_vdp_surf = NULL; else { p_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference); @@ -208,17 +211,17 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, return VDP_STATUS_INVALID_HANDLE; } - if (picture_info->forward_reference == VDP_INVALID_HANDLE) + if (picture_info->forward_reference == VDP_INVALID_HANDLE) f_vdp_surf = NULL; else { f_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference); if (!f_vdp_surf) return VDP_STATUS_INVALID_HANDLE; } - - + + if (f_vdp_surf == VDP_INVALID_HANDLE) f_vdp_surf = NULL; - + ret = vlVdpCreateSurfaceTarget(vldecoder,t_vdp_surf); vpipe = vldecoder->vctx->vpipe; @@ -227,23 +230,23 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, &num_macroblocks, &pipe_macroblocks)) { debug_printf("[VDPAU] Error in frame-header. Skipping.\n"); - + ret = VDP_STATUS_OK; goto skip_frame; } - + vpipe->set_decode_target(vpipe,t_surf); vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL); - + skip_frame: return ret; } VdpStatus -vlVdpDecoderRender (VdpDecoder decoder, - VdpVideoSurface target, - VdpPictureInfo const *picture_info, - uint32_t bitstream_buffer_count, +vlVdpDecoderRender (VdpDecoder decoder, + VdpVideoSurface target, + VdpPictureInfo const *picture_info, + uint32_t bitstream_buffer_count, VdpBitstreamBuffer const *bitstream_buffers ) { @@ -252,11 +255,11 @@ vlVdpDecoderRender (VdpDecoder decoder, struct vl_screen *vscreen; VdpStatus ret; debug_printf("[VDPAU] Decoding\n"); - + if (!(picture_info && bitstream_buffers)) return VDP_STATUS_INVALID_POINTER; - - + + vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder); if (!vldecoder) return VDP_STATUS_INVALID_HANDLE; @@ -264,22 +267,22 @@ vlVdpDecoderRender (VdpDecoder decoder, vlsurf = (vlVdpSurface *)vlGetDataHTAB(target); if (!vlsurf) return VDP_STATUS_INVALID_HANDLE; - + if (vlsurf->device != vldecoder->device) return VDP_STATUS_HANDLE_DEVICE_MISMATCH; - + /* Test doesn't make sence */ /*if (vlsurf->chroma_format != vldecoder->chroma_format) return VDP_STATUS_INVALID_CHROMA_TYPE;*/ - + vscreen = vl_screen_create(vldecoder->device->display, vldecoder->device->screen); if (!vscreen) return VDP_STATUS_RESOURCES; - + vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->chroma_format, vldecoder->width, vldecoder->height); if (!vldecoder->vctx) return VDP_STATUS_RESOURCES; - + // TODO: Right now only mpeg2 is supported. switch (vldecoder->vctx->vpipe->profile) { case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE: @@ -295,15 +298,15 @@ vlVdpDecoderRender (VdpDecoder decoder, return ret; } -VdpStatus +VdpStatus vlVdpGenerateCSCMatrix( - VdpProcamp *procamp, + VdpProcamp *procamp, VdpColorStandard standard, VdpCSCMatrix *csc_matrix) { debug_printf("[VDPAU] Generating CSCMatrix\n"); if (!(csc_matrix && procamp)) return VDP_STATUS_INVALID_POINTER; - + return VDP_STATUS_OK; -}
\ No newline at end of file +} diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 9b6dac9c3f4..0ebfd12d988 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -104,7 +104,7 @@ vlVdpVideoSurfaceDestroy ( VdpVideoSurface surface ) if (p_surf->psurface) { if (p_surf->psurface->texture) { if (p_surf->psurface->texture->screen) - p_surf->psurface->texture->screen->tex_surface_destroy(p_surf->psurface); + p_surf->psurface->context->surface_destroy(p_surf->psurface->context, p_surf->psurface); } } FREE(p_surf); |