summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/vdpau/bitmap.c57
-rw-r--r--src/gallium/state_trackers/vdpau/decode.c405
-rw-r--r--src/gallium/state_trackers/vdpau/device.c115
-rw-r--r--src/gallium/state_trackers/vdpau/mixer.c185
-rw-r--r--src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c199
-rw-r--r--src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h36
-rw-r--r--src/gallium/state_trackers/vdpau/output.c50
-rw-r--r--src/gallium/state_trackers/vdpau/preemption.c18
-rw-r--r--src/gallium/state_trackers/vdpau/presentation.c132
-rw-r--r--src/gallium/state_trackers/vdpau/query.c60
-rw-r--r--src/gallium/state_trackers/vdpau/vdpau_private.h16
11 files changed, 615 insertions, 658 deletions
diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c
index f1a9d9a6828..b570f2752e4 100644
--- a/src/gallium/state_trackers/vdpau/bitmap.c
+++ b/src/gallium/state_trackers/vdpau/bitmap.c
@@ -30,46 +30,45 @@
#include <util/u_debug.h>
VdpStatus
-vlVdpBitmapSurfaceCreate( VdpDevice device,
- VdpRGBAFormat rgba_format,
- uint32_t width, uint32_t height,
- VdpBool frequently_accessed,
- VdpBitmapSurface *surface)
+vlVdpBitmapSurfaceCreate(VdpDevice device,
+ VdpRGBAFormat rgba_format,
+ uint32_t width, uint32_t height,
+ VdpBool frequently_accessed,
+ VdpBitmapSurface *surface)
{
- debug_printf("[VDPAU] Creating a bitmap surface\n");
- if (!surface)
- return VDP_STATUS_INVALID_POINTER;
+ debug_printf("[VDPAU] Creating a bitmap surface\n");
+ if (!surface)
+ return VDP_STATUS_INVALID_POINTER;
- return VDP_STATUS_NO_IMPLEMENTATION;
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpBitmapSurfaceDestroy ( VdpBitmapSurface surface )
+vlVdpBitmapSurfaceDestroy(VdpBitmapSurface surface)
{
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpBitmapSurfaceGetParameters ( VdpBitmapSurface surface,
- VdpRGBAFormat *rgba_format,
- uint32_t *width, uint32_t *height,
- VdpBool *frequently_accessed)
+vlVdpBitmapSurfaceGetParameters(VdpBitmapSurface surface,
+ VdpRGBAFormat *rgba_format,
+ uint32_t *width, uint32_t *height,
+ VdpBool *frequently_accessed)
{
- if (!(rgba_format && width && height && frequently_accessed))
- return VDP_STATUS_INVALID_POINTER;
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ if (!(rgba_format && width && height && frequently_accessed))
+ return VDP_STATUS_INVALID_POINTER;
+
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpBitmapSurfacePutBitsNative ( VdpBitmapSurface surface,
- void const *const *source_data,
- uint32_t const *source_pitches,
- VdpRect const *destination_rect )
+vlVdpBitmapSurfacePutBitsNative(VdpBitmapSurface surface,
+ void const *const *source_data,
+ uint32_t const *source_pitches,
+ VdpRect const *destination_rect )
{
- if (!(source_data && source_pitches && destination_rect))
- return VDP_STATUS_INVALID_POINTER;
-
- return VDP_STATUS_NO_IMPLEMENTATION;
-} \ No newline at end of file
+ if (!(source_data && source_pitches && destination_rect))
+ return VDP_STATUS_INVALID_POINTER;
+
+ return VDP_STATUS_NO_IMPLEMENTATION;
+}
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index 44f0ecc2622..8bc54d7fc7d 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -33,280 +33,271 @@
#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;
+ enum pipe_video_profile p_profile = PIPE_VIDEO_PROFILE_UNKNOWN;
+ VdpStatus ret = VDP_STATUS_OK;
+ vlVdpDecoder *vldecoder = NULL;
- debug_printf("[VDPAU] Creating decoder\n");
+ debug_printf("[VDPAU] Creating decoder\n");
- if (!decoder)
- return VDP_STATUS_INVALID_POINTER;
+ if (!decoder)
+ return VDP_STATUS_INVALID_POINTER;
- if (!(width && height))
- return VDP_STATUS_INVALID_VALUE;
+ if (!(width && height))
+ return VDP_STATUS_INVALID_VALUE;
vlVdpDevice *dev = vlGetDataHTAB(device);
- if (!dev) {
+ if (!dev) {
ret = VDP_STATUS_INVALID_HANDLE;
goto inv_device;
}
vldecoder = CALLOC(1,sizeof(vlVdpDecoder));
- if (!vldecoder) {
- ret = VDP_STATUS_RESOURCES;
- goto no_decoder;
+ 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;
- goto inv_profile;
+ ret = VDP_STATUS_INVALID_DECODER_PROFILE;
+ goto inv_profile;
}
- // TODO: Define max_references. Used mainly for H264
+ // TODO: Define max_references. Used mainly for H264
- vldecoder->profile = p_profile;
- vldecoder->height = height;
- vldecoder->width = width;
- vldecoder->device = dev;
- vldecoder->vctx = NULL;
+ vldecoder->profile = p_profile;
+ vldecoder->height = height;
+ vldecoder->width = width;
+ vldecoder->device = dev;
+ vldecoder->vctx = NULL;
- *decoder = vlAddDataHTAB(vldecoder);
- if (*decoder == 0) {
+ *decoder = vlAddDataHTAB(vldecoder);
+ if (*decoder == 0) {
ret = VDP_STATUS_ERROR;
goto no_handle;
- }
- debug_printf("[VDPAU] Decoder created succesfully\n");
+ }
+ debug_printf("[VDPAU] Decoder created succesfully\n");
- return VDP_STATUS_OK;
+ return VDP_STATUS_OK;
- no_handle:
- FREE(vldecoder);
- inv_profile:
- no_screen:
- no_decoder:
- inv_device:
+no_handle:
+ FREE(vldecoder);
+ inv_profile:
+no_screen:
+no_decoder:
+inv_device:
return ret;
}
VdpStatus
-vlVdpDecoderDestroy (VdpDecoder decoder
-)
+vlVdpDecoderDestroy(VdpDecoder decoder)
{
- debug_printf("[VDPAU] Destroying decoder\n");
- vlVdpDecoder *vldecoder;
+ debug_printf("[VDPAU] Destroying decoder\n");
+ vlVdpDecoder *vldecoder;
- vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder);
- if (!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) {
+ if (vldecoder->vctx->vscreen)
+ vl_screen_destroy(vldecoder->vctx->vscreen);
+ }
- if (vldecoder->vctx)
- vl_video_destroy(vldecoder->vctx);
+ if (vldecoder->vctx)
+ vl_video_destroy(vldecoder->vctx);
- FREE(vldecoder);
+ FREE(vldecoder);
- return VDP_STATUS_OK;
+ return VDP_STATUS_OK;
}
VdpStatus
-vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder,
- vlVdpSurface *vlsurf
-)
+vlVdpCreateSurfaceTarget(vlVdpDecoder *vldecoder, vlVdpSurface *vlsurf)
{
- struct pipe_surface surf_template;
- struct pipe_resource tmplt;
- struct pipe_resource *surf_tex;
- struct pipe_video_context *vctx;
+ 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");
+ debug_printf("[VDPAU] Creating surface\n");
- if(!(vldecoder && vlsurf))
- return VDP_STATUS_INVALID_POINTER;
+ if(!(vldecoder && vlsurf))
+ return VDP_STATUS_INVALID_POINTER;
- vctx = vldecoder->vctx->vpipe;
+ 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);
- tmplt.last_level = 0;
+ memset(&tmplt, 0, sizeof(struct pipe_resource));
+ tmplt.target = PIPE_TEXTURE_2D;
+ tmplt.format = vctx->get_param(vctx,PIPE_CAP_DECODE_TARGET_PREFERRED_FORMAT);
+ tmplt.last_level = 0;
- if (vctx->is_format_supported(vctx, tmplt.format,
- PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
- PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO)) {
+ if (vctx->is_format_supported(vctx, tmplt.format,
+ PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
+ PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO)) {
tmplt.width0 = vlsurf->width;
tmplt.height0 = vlsurf->height;
- }
- else {
+ } else {
assert(vctx->is_format_supported(vctx, tmplt.format,
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
PIPE_TEXTURE_GEOM_NON_SQUARE));
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;
+ 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);
+ surf_tex = vctx->screen->resource_create(vctx->screen, &tmplt);
- 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);
+ 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);
+ pipe_resource_reference(&surf_tex, NULL);
- if (!vlsurf->psurface)
- return VDP_STATUS_RESOURCES;
- debug_printf("[VDPAU] Done creating surface\n");
+ if (!vlsurf->psurface)
+ return VDP_STATUS_RESOURCES;
+ debug_printf("[VDPAU] Done creating surface\n");
- return VDP_STATUS_OK;
+ return VDP_STATUS_OK;
}
VdpStatus
-vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder,
- vlVdpSurface *vlsurf,
- VdpPictureInfoMPEG1Or2 *picture_info,
- uint32_t bitstream_buffer_count,
- VdpBitstreamBuffer const *bitstream_buffers
- )
+vlVdpDecoderRenderMpeg2(vlVdpDecoder *vldecoder,
+ vlVdpSurface *vlsurf,
+ VdpPictureInfoMPEG1Or2 *picture_info,
+ uint32_t bitstream_buffer_count,
+ VdpBitstreamBuffer const *bitstream_buffers)
{
- struct pipe_video_context *vpipe;
- vlVdpSurface *t_vdp_surf;
- vlVdpSurface *p_vdp_surf;
- vlVdpSurface *f_vdp_surf;
- struct pipe_surface *t_surf;
- struct pipe_surface *p_surf;
- struct pipe_surface *f_surf;
- 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)
- p_vdp_surf = NULL;
- else {
- p_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference);
- if (!p_vdp_surf)
- return VDP_STATUS_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;
-
- if (vlVdpMPEG2BitstreamToMacroblock(vpipe->screen, bitstream_buffers, bitstream_buffer_count,
- &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;
+ struct pipe_video_context *vpipe;
+ vlVdpSurface *t_vdp_surf;
+ vlVdpSurface *p_vdp_surf;
+ vlVdpSurface *f_vdp_surf;
+ struct pipe_surface *t_surf;
+ struct pipe_surface *p_surf;
+ struct pipe_surface *f_surf;
+ 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)
+ p_vdp_surf = NULL;
+ else {
+ p_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference);
+ if (!p_vdp_surf)
+ return VDP_STATUS_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;
+
+ if (vlVdpMPEG2BitstreamToMacroblock(vpipe->screen, bitstream_buffers, bitstream_buffer_count,
+ &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,
- VdpBitstreamBuffer const *bitstream_buffers
-)
+vlVdpDecoderRender(VdpDecoder decoder,
+ VdpVideoSurface target,
+ VdpPictureInfo const *picture_info,
+ uint32_t bitstream_buffer_count,
+ VdpBitstreamBuffer const *bitstream_buffers)
{
- vlVdpDecoder *vldecoder;
- vlVdpSurface *vlsurf;
- 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;
-
- 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:
- case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
- ret = vlVdpDecoderRenderMpeg2(vldecoder,vlsurf,(VdpPictureInfoMPEG1Or2 *)picture_info,
- bitstream_buffer_count,bitstream_buffers);
- break;
- default:
- return VDP_STATUS_INVALID_DECODER_PROFILE;
- }
- assert(0);
-
- return ret;
+ vlVdpDecoder *vldecoder;
+ vlVdpSurface *vlsurf;
+ 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;
+
+ 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:
+ case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
+ ret = vlVdpDecoderRenderMpeg2(vldecoder,vlsurf,(VdpPictureInfoMPEG1Or2 *)picture_info,
+ bitstream_buffer_count,bitstream_buffers);
+ break;
+ default:
+ return VDP_STATUS_INVALID_DECODER_PROFILE;
+ }
+ assert(0);
+
+ return ret;
}
VdpStatus
-vlVdpGenerateCSCMatrix(
- VdpProcamp *procamp,
- VdpColorStandard standard,
- VdpCSCMatrix *csc_matrix)
+vlVdpGenerateCSCMatrix(VdpProcamp *procamp,
+ VdpColorStandard standard,
+ VdpCSCMatrix *csc_matrix)
{
- debug_printf("[VDPAU] Generating CSCMatrix\n");
- if (!(csc_matrix && procamp))
- return VDP_STATUS_INVALID_POINTER;
+ debug_printf("[VDPAU] Generating CSCMatrix\n");
+ if (!(csc_matrix && procamp))
+ return VDP_STATUS_INVALID_POINTER;
- return VDP_STATUS_OK;
+ return VDP_STATUS_OK;
}
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c
index 496e2b8def0..0f9b7b6f5d8 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -34,9 +34,10 @@
PUBLIC VdpStatus
-vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGetProcAddress **get_proc_address)
+vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device,
+ VdpGetProcAddress **get_proc_address)
{
- VdpStatus ret;
+ VdpStatus ret;
vlVdpDevice *dev = NULL;
if (!(display && device && get_proc_address))
@@ -67,7 +68,7 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
ret = VDP_STATUS_ERROR;
goto no_handle;
}
-
+
*get_proc_address = &vlVdpGetProcAddress;
debug_printf("[VDPAU] Device created succesfully\n");
@@ -83,17 +84,18 @@ no_htab:
return ret;
}
-PUBLIC VdpStatus
-vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable,VdpPresentationQueueTarget *target)
+PUBLIC VdpStatus
+vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable,
+ VdpPresentationQueueTarget *target)
{
VdpStatus ret;
vlVdpPresentationQueueTarget *pqt = NULL;
-
+
debug_printf("[VDPAU] Creating PresentationQueueTarget\n");
if (!drawable)
return VDP_STATUS_INVALID_HANDLE;
-
+
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
@@ -101,10 +103,10 @@ vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable,VdpPre
pqt = CALLOC(1, sizeof(vlVdpPresentationQueue));
if (!pqt)
return VDP_STATUS_RESOURCES;
-
+
pqt->device = dev;
pqt->drawable = drawable;
-
+
*target = vlAddDataHTAB(pqt);
if (*target == 0) {
ret = VDP_STATUS_ERROR;
@@ -112,17 +114,17 @@ vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable,VdpPre
}
- return VDP_STATUS_OK;
- no_handle:
- FREE(dev);
- return ret;
+ return VDP_STATUS_OK;
+no_handle:
+ FREE(dev);
+ return ret;
}
-VdpStatus
+VdpStatus
vlVdpDeviceDestroy(VdpDevice device)
{
debug_printf("[VDPAU] Destroying destroy\n");
-
+
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
@@ -134,7 +136,7 @@ vlVdpDeviceDestroy(VdpDevice device)
return VDP_STATUS_OK;
}
-VdpStatus
+VdpStatus
vlVdpGetProcAddress(VdpDevice device, VdpFuncId function_id, void **function_pointer)
{
vlVdpDevice *dev = vlGetDataHTAB(device);
@@ -150,49 +152,44 @@ vlVdpGetProcAddress(VdpDevice device, VdpFuncId function_id, void **function_poi
return VDP_STATUS_OK;
}
-#define _ERROR_TYPE(TYPE,STRING) \
- case TYPE: \
- return STRING; \
- break
+#define _ERROR_TYPE(TYPE,STRING) case TYPE: return STRING;
-char const *
-vlVdpGetErrorString (
-VdpStatus status)
+char const *
+vlVdpGetErrorString (VdpStatus status)
{
- switch (status)
- {
- _ERROR_TYPE(VDP_STATUS_OK,"The operation completed successfully; no error.");
- _ERROR_TYPE(VDP_STATUS_NO_IMPLEMENTATION,"No backend implementation could be loaded.");
- _ERROR_TYPE(VDP_STATUS_DISPLAY_PREEMPTED,"The display was preempted, or a fatal error occurred. The application must re-initialize VDPAU.");
- _ERROR_TYPE(VDP_STATUS_INVALID_HANDLE,"An invalid handle value was provided. Either the handle does not exist at all, or refers to an object of an incorrect type.");
- _ERROR_TYPE(VDP_STATUS_INVALID_POINTER ,"An invalid pointer was provided. Typically, this means that a NULL pointer was provided for an 'output' parameter.");
- _ERROR_TYPE(VDP_STATUS_INVALID_CHROMA_TYPE ,"An invalid/unsupported VdpChromaType value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_Y_CB_CR_FORMAT,"An invalid/unsupported VdpYCbCrFormat value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_RGBA_FORMAT,"An invalid/unsupported VdpRGBAFormat value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_INDEXED_FORMAT,"An invalid/unsupported VdpIndexedFormat value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_STANDARD,"An invalid/unsupported VdpColorStandard value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,"An invalid/unsupported VdpColorTableFormat value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_FACTOR,"An invalid/unsupported VdpOutputSurfaceRenderBlendFactor value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_EQUATION,"An invalid/unsupported VdpOutputSurfaceRenderBlendEquation value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_FLAG,"An invalid/unsupported flag value/combination was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_DECODER_PROFILE,"An invalid/unsupported VdpDecoderProfile value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,"An invalid/unsupported VdpVideoMixerFeature value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER ,"An invalid/unsupported VdpVideoMixerParameter value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,"An invalid/unsupported VdpVideoMixerAttribute value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,"An invalid/unsupported VdpVideoMixerPictureStructure value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_FUNC_ID,"An invalid/unsupported VdpFuncId value was supplied.");
- _ERROR_TYPE(VDP_STATUS_INVALID_SIZE,"The size of a supplied object does not match the object it is being used with.\
- For example, a VdpVideoMixer is configured to process VdpVideoSurface objects of a specific size.\
- If presented with a VdpVideoSurface of a different size, this error will be raised.");
- _ERROR_TYPE(VDP_STATUS_INVALID_VALUE,"An invalid/unsupported value was supplied.\
- This is a catch-all error code for values of type other than those with a specific error code.");
- _ERROR_TYPE(VDP_STATUS_INVALID_STRUCT_VERSION,"An invalid/unsupported structure version was specified in a versioned structure. \
- This implies that the implementation is older than the header file the application was built against.");
- _ERROR_TYPE(VDP_STATUS_RESOURCES,"The system does not have enough resources to complete the requested operation at this time.");
- _ERROR_TYPE(VDP_STATUS_HANDLE_DEVICE_MISMATCH,"The set of handles supplied are not all related to the same VdpDevice.When performing operations \
- that operate on multiple surfaces, such as VdpOutputSurfaceRenderOutputSurface or VdpVideoMixerRender, \
- all supplied surfaces must have been created within the context of the same VdpDevice object. \
- This error is raised if they were not.");
- _ERROR_TYPE(VDP_STATUS_ERROR,"A catch-all error, used when no other error code applies.");
- }
+ switch (status) {
+ _ERROR_TYPE(VDP_STATUS_OK,"The operation completed successfully; no error.");
+ _ERROR_TYPE(VDP_STATUS_NO_IMPLEMENTATION,"No backend implementation could be loaded.");
+ _ERROR_TYPE(VDP_STATUS_DISPLAY_PREEMPTED,"The display was preempted, or a fatal error occurred. The application must re-initialize VDPAU.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_HANDLE,"An invalid handle value was provided. Either the handle does not exist at all, or refers to an object of an incorrect type.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_POINTER ,"An invalid pointer was provided. Typically, this means that a NULL pointer was provided for an 'output' parameter.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_CHROMA_TYPE ,"An invalid/unsupported VdpChromaType value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_Y_CB_CR_FORMAT,"An invalid/unsupported VdpYCbCrFormat value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_RGBA_FORMAT,"An invalid/unsupported VdpRGBAFormat value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_INDEXED_FORMAT,"An invalid/unsupported VdpIndexedFormat value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_STANDARD,"An invalid/unsupported VdpColorStandard value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,"An invalid/unsupported VdpColorTableFormat value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_FACTOR,"An invalid/unsupported VdpOutputSurfaceRenderBlendFactor value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_EQUATION,"An invalid/unsupported VdpOutputSurfaceRenderBlendEquation value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_FLAG,"An invalid/unsupported flag value/combination was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_DECODER_PROFILE,"An invalid/unsupported VdpDecoderProfile value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,"An invalid/unsupported VdpVideoMixerFeature value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER ,"An invalid/unsupported VdpVideoMixerParameter value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,"An invalid/unsupported VdpVideoMixerAttribute value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,"An invalid/unsupported VdpVideoMixerPictureStructure value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_FUNC_ID,"An invalid/unsupported VdpFuncId value was supplied.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_SIZE,"The size of a supplied object does not match the object it is being used with.\
+ For example, a VdpVideoMixer is configured to process VdpVideoSurface objects of a specific size.\
+ If presented with a VdpVideoSurface of a different size, this error will be raised.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_VALUE,"An invalid/unsupported value was supplied.\
+ This is a catch-all error code for values of type other than those with a specific error code.");
+ _ERROR_TYPE(VDP_STATUS_INVALID_STRUCT_VERSION,"An invalid/unsupported structure version was specified in a versioned structure. \
+ This implies that the implementation is older than the header file the application was built against.");
+ _ERROR_TYPE(VDP_STATUS_RESOURCES,"The system does not have enough resources to complete the requested operation at this time.");
+ _ERROR_TYPE(VDP_STATUS_HANDLE_DEVICE_MISMATCH,"The set of handles supplied are not all related to the same VdpDevice.When performing operations \
+ that operate on multiple surfaces, such as VdpOutputSurfaceRenderOutputSurface or VdpVideoMixerRender, \
+ all supplied surfaces must have been created within the context of the same VdpDevice object. \
+ This error is raised if they were not.");
+ _ERROR_TYPE(VDP_STATUS_ERROR,"A catch-all error, used when no other error code applies.");
+ }
}
diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index 124125ebaad..808ff9e9ce8 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -24,117 +24,112 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
-
- #include <vdpau/vdpau.h>
- #include <util/u_memory.h>
- #include <util/u_debug.h>
- #include "vdpau_private.h"
-
-
- VdpStatus
- vlVdpVideoMixerCreate (VdpDevice device,
- uint32_t feature_count,
- VdpVideoMixerFeature const *features,
- uint32_t parameter_count,
- VdpVideoMixerParameter const *parameters,
- void const *const *parameter_values,
- VdpVideoMixer *mixer)
+
+#include <vdpau/vdpau.h>
+#include <util/u_memory.h>
+#include <util/u_debug.h>
+#include "vdpau_private.h"
+
+VdpStatus
+vlVdpVideoMixerCreate(VdpDevice device,
+ uint32_t feature_count,
+ VdpVideoMixerFeature const *features,
+ uint32_t parameter_count,
+ VdpVideoMixerParameter const *parameters,
+ void const *const *parameter_values,
+ VdpVideoMixer *mixer)
{
- VdpStatus ret;
- vlVdpVideoMixer *vmixer = NULL;
-
- debug_printf("[VDPAU] Creating VideoMixer\n");
-
- vlVdpDevice *dev = vlGetDataHTAB(device);
- if (!dev)
+ VdpStatus ret;
+ vlVdpVideoMixer *vmixer = NULL;
+
+ debug_printf("[VDPAU] Creating VideoMixer\n");
+
+ vlVdpDevice *dev = vlGetDataHTAB(device);
+ if (!dev)
return VDP_STATUS_INVALID_HANDLE;
-
- vmixer = CALLOC(1, sizeof(vlVdpVideoMixer));
- if (!vmixer)
+
+ vmixer = CALLOC(1, sizeof(vlVdpVideoMixer));
+ if (!vmixer)
return VDP_STATUS_RESOURCES;
-
- vmixer->device = dev;
- /*
- * TODO: Handle features and parameters
- * */
-
- *mixer = vlAddDataHTAB(vmixer);
- if (*mixer == 0) {
+
+ vmixer->device = dev;
+ /*
+ * TODO: Handle features and parameters
+ * */
+
+ *mixer = vlAddDataHTAB(vmixer);
+ if (*mixer == 0) {
ret = VDP_STATUS_ERROR;
goto no_handle;
- }
-
-
+ }
+
return VDP_STATUS_OK;
- no_handle:
+no_handle:
return ret;
}
VdpStatus
-vlVdpVideoMixerSetFeatureEnables (
- VdpVideoMixer mixer,
- uint32_t feature_count,
- VdpVideoMixerFeature const *features,
- VdpBool const *feature_enables)
+vlVdpVideoMixerSetFeatureEnables(VdpVideoMixer mixer,
+ uint32_t feature_count,
+ VdpVideoMixerFeature const *features,
+ VdpBool const *feature_enables)
{
- debug_printf("[VDPAU] Setting VideoMixer features\n");
-
- if (!(features && feature_enables))
- return VDP_STATUS_INVALID_POINTER;
-
- vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
- if (!vmixer)
- return VDP_STATUS_INVALID_HANDLE;
-
- /*
- * TODO: Set features
- * */
-
-
- return VDP_STATUS_OK;
+ debug_printf("[VDPAU] Setting VideoMixer features\n");
+
+ if (!(features && feature_enables))
+ return VDP_STATUS_INVALID_POINTER;
+
+ vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
+ if (!vmixer)
+ return VDP_STATUS_INVALID_HANDLE;
+
+ /*
+ * TODO: Set features
+ * */
+
+ return VDP_STATUS_OK;
}
-VdpStatus vlVdpVideoMixerRender (
- VdpVideoMixer mixer,
- VdpOutputSurface background_surface,
- VdpRect const *background_source_rect,
- VdpVideoMixerPictureStructure current_picture_structure,
- uint32_t video_surface_past_count,
- VdpVideoSurface const *video_surface_past,
- VdpVideoSurface video_surface_current,
- uint32_t video_surface_future_count,
- VdpVideoSurface const *video_surface_future,
- VdpRect const *video_source_rect,
- VdpOutputSurface destination_surface,
- VdpRect const *destination_rect,
- VdpRect const *destination_video_rect,
- uint32_t layer_count,
- VdpLayer const *layers)
+VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
+ VdpOutputSurface background_surface,
+ VdpRect const *background_source_rect,
+ VdpVideoMixerPictureStructure current_picture_structure,
+ uint32_t video_surface_past_count,
+ VdpVideoSurface const *video_surface_past,
+ VdpVideoSurface video_surface_current,
+ uint32_t video_surface_future_count,
+ VdpVideoSurface const *video_surface_future,
+ VdpRect const *video_source_rect,
+ VdpOutputSurface destination_surface,
+ VdpRect const *destination_rect,
+ VdpRect const *destination_video_rect,
+ uint32_t layer_count,
+ VdpLayer const *layers)
{
- if (!(background_source_rect && video_surface_past && video_surface_future && video_source_rect && destination_rect && destination_video_rect && layers))
- return VDP_STATUS_INVALID_POINTER;
+ if (!(background_source_rect && video_surface_past && video_surface_future &&
+ video_source_rect && destination_rect && destination_video_rect && layers))
+ return VDP_STATUS_INVALID_POINTER;
- return VDP_STATUS_NO_IMPLEMENTATION;
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpVideoMixerSetAttributeValues (
- VdpVideoMixer mixer,
- uint32_t attribute_count,
- VdpVideoMixerAttribute const *attributes,
- void const *const *attribute_values)
+vlVdpVideoMixerSetAttributeValues(VdpVideoMixer mixer,
+ uint32_t attribute_count,
+ VdpVideoMixerAttribute const *attributes,
+ void const *const *attribute_values)
{
- if (!(attributes && attribute_values))
- return VDP_STATUS_INVALID_POINTER;
-
- vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
- if (!vmixer)
- return VDP_STATUS_INVALID_HANDLE;
-
- /*
- * TODO: Implement the function
- *
- * */
-
- return VDP_STATUS_OK;
-} \ No newline at end of file
+ if (!(attributes && attribute_values))
+ return VDP_STATUS_INVALID_POINTER;
+
+ vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
+ if (!vmixer)
+ return VDP_STATUS_INVALID_HANDLE;
+
+ /*
+ * TODO: Implement the function
+ *
+ * */
+
+ return VDP_STATUS_OK;
+}
diff --git a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c
index 90936584893..7b285079a19 100644
--- a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c
+++ b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c
@@ -31,119 +31,102 @@
int
vlVdpMPEG2NextStartCode(struct vdpMPEG2BitstreamParser *parser)
{
- uint32_t integer = 0xffffff00;
- uint8_t * ptr_read = parser->ptr_bitstream;
- int8_t * bytes_to_end;
-
- bytes_to_end = parser->ptr_bitstream_end - parser->ptr_bitstream;
-
- /* Read byte after byte, until startcode is found */
- while(integer != 0x00000100)
- {
- if (bytes_to_end <= 0)
- {
- parser->state = MPEG2_BITSTREAM_DONE;
- parser->code = 0;
- return 0;
- }
- integer = ( integer | *ptr_read++ ) << 8;
- bytes_to_end--;
- }
- parser->ptr_bitstream = ptr_read;
- parser->code = parser->ptr_bitstream;
- /* start_code found. rewind cursor a byte */
- //parser->cursor -= 8;
-
- return 0;
+ uint32_t integer = 0xffffff00;
+ uint8_t * ptr_read = parser->ptr_bitstream;
+ int8_t * bytes_to_end;
+
+ bytes_to_end = parser->ptr_bitstream_end - parser->ptr_bitstream;
+
+ /* Read byte after byte, until startcode is found */
+ while(integer != 0x00000100) {
+ if (bytes_to_end <= 0) {
+ parser->state = MPEG2_BITSTREAM_DONE;
+ parser->code = 0;
+ return 0;
+ }
+ integer = ( integer | *ptr_read++ ) << 8;
+ bytes_to_end--;
+ }
+ parser->ptr_bitstream = ptr_read;
+ parser->code = parser->ptr_bitstream;
+ /* start_code found. rewind cursor a byte */
+ //parser->cursor -= 8;
+
+ return 0;
}
int
-vlVdpMPEG2BitstreamToMacroblock (
- struct pipe_screen *screen,
- VdpBitstreamBuffer const *bitstream_buffers,
- uint32_t bitstream_buffer_count,
- unsigned int *num_macroblocks,
- struct pipe_mpeg12_macroblock **pipe_macroblocks)
+vlVdpMPEG2BitstreamToMacroblock(struct pipe_screen *screen,
+ VdpBitstreamBuffer const *bitstream_buffers,
+ uint32_t bitstream_buffer_count,
+ unsigned int *num_macroblocks,
+ struct pipe_mpeg12_macroblock **pipe_macroblocks)
{
- bool b_header_done = false;
- struct vdpMPEG2BitstreamParser parser;
-
- #if(1)
- FILE *fp;
-
- if ((fp = fopen("binout", "w"))==NULL) {
- printf("Cannot open file.\n");
- exit(1);
+ bool b_header_done = false;
+ struct vdpMPEG2BitstreamParser parser;
+
+#if(1)
+ FILE *fp;
+
+ if ((fp = fopen("binout", "w"))==NULL) {
+ printf("Cannot open file.\n");
+ exit(1);
+ }
+ fwrite(bitstream_buffers[0].bitstream, 1, bitstream_buffers[0].bitstream_bytes, fp);
+ fclose(fp);
+
+#endif
+
+ debug_printf("[VDPAU] Starting decoding MPEG2 stream\n");
+
+ num_macroblocks[0] = 0;
+
+ memset(&parser,0,sizeof(parser));
+ parser.state = MPEG2_HEADER_START_CODE;
+ parser.ptr_bitstream = (unsigned char *)bitstream_buffers[0].bitstream;
+ parser.ptr_bitstream_end = parser.ptr_bitstream + bitstream_buffers[0].bitstream_bytes;
+
+ /* Main header parser loop */
+ while(!b_header_done) {
+ switch (parser.state) {
+ case MPEG2_SEEK_HEADER:
+ if (vlVdpMPEG2NextStartCode(&parser))
+ exit(1);
+ break;
+ /* Start_code found */
+ switch (parser.code) {
+ /* sequence_header_code */
+ case 0xB3:
+ debug_printf("[VDPAU][Bitstream parser] Sequence header code found\n");
+ /* We dont need to read this, because we already have this information */
+ break;
+ case 0xB5:
+ debug_printf("[VDPAU][Bitstream parser] Extension start code found\n");
+ //exit(1);
+ break;
+ case 0xB8:
+ debug_printf("[VDPAU][Bitstream parser] Extension start code found\n");
+ //exit(1);
+ break;
+ }
+ break;
+ case MPEG2_BITSTREAM_DONE:
+ if (parser.cur_bitstream < bitstream_buffer_count - 1) {
+ debug_printf("[VDPAU][Bitstream parser] Done parsing current bitstream. Moving to the next\n");
+ parser.cur_bitstream++;
+ parser.ptr_bitstream = (unsigned char *)bitstream_buffers[parser.cur_bitstream].bitstream;
+ parser.ptr_bitstream_end = parser.ptr_bitstream + bitstream_buffers[parser.cur_bitstream].bitstream_bytes;
+ parser.state = MPEG2_HEADER_START_CODE;
+ }
+ else {
+ debug_printf("[VDPAU][Bitstream parser] Done with frame\n");
+ exit(0);
+ // return 0;
+ }
+ break;
}
- fwrite(bitstream_buffers[0].bitstream, 1, bitstream_buffers[0].bitstream_bytes, fp);
- fclose(fp);
-
- #endif
-
-
- debug_printf("[VDPAU] Starting decoding MPEG2 stream\n");
-
- num_macroblocks[0] = 0;
-
- memset(&parser,0,sizeof(parser));
- parser.state = MPEG2_HEADER_START_CODE;
- parser.ptr_bitstream = (unsigned char *)bitstream_buffers[0].bitstream;
- parser.ptr_bitstream_end = parser.ptr_bitstream + bitstream_buffers[0].bitstream_bytes;
-
- /* Main header parser loop */
- while(!b_header_done)
- {
- switch (parser.state)
- {
- case MPEG2_SEEK_HEADER:
- if (vlVdpMPEG2NextStartCode(&parser))
- exit(1);
- break;
- /* Start_code found */
- switch (parser.code)
- {
- /* sequence_header_code */
- case 0xB3:
- debug_printf("[VDPAU][Bitstream parser] Sequence header code found\n");
-
- /* We dont need to read this, because we already have this information */
- break;
- case 0xB5:
- debug_printf("[VDPAU][Bitstream parser] Extension start code found\n");
- //exit(1);
- break;
-
- case 0xB8:
- debug_printf("[VDPAU][Bitstream parser] Extension start code found\n");
- //exit(1);
- break;
-
- }
-
- break;
- case MPEG2_BITSTREAM_DONE:
- if (parser.cur_bitstream < bitstream_buffer_count - 1)
- {
- debug_printf("[VDPAU][Bitstream parser] Done parsing current bitstream. Moving to the next\n");
- parser.cur_bitstream++;
- parser.ptr_bitstream = (unsigned char *)bitstream_buffers[parser.cur_bitstream].bitstream;
- parser.ptr_bitstream_end = parser.ptr_bitstream + bitstream_buffers[parser.cur_bitstream].bitstream_bytes;
- parser.state = MPEG2_HEADER_START_CODE;
- }
- else
- {
- debug_printf("[VDPAU][Bitstream parser] Done with frame\n");
- exit(0);
- // return 0;
- }
- break;
-
- }
-
-
- }
-
+ }
- return 0;
+ return 0;
}
diff --git a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h
index 25f3516f821..1fa425fdcdb 100644
--- a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h
+++ b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h
@@ -34,32 +34,30 @@
enum vdpMPEG2States
{
- MPEG2_SEEK_HEADER,
- MPEG2_HEADER_DONE,
- MPEG2_BITSTREAM_DONE,
- MPEG2_HEADER_START_CODE
+ MPEG2_SEEK_HEADER,
+ MPEG2_HEADER_DONE,
+ MPEG2_BITSTREAM_DONE,
+ MPEG2_HEADER_START_CODE
};
-
struct vdpMPEG2BitstreamParser
{
- enum vdpMPEG2States state;
- uint32_t cur_bitstream;
- const uint8_t *ptr_bitstream_end;
- const uint8_t *ptr_bitstream;
- uint8_t code;
-
- /* The decoded bitstream goes here: */
- /* Sequence_header_info */
- uint32_t horizontal_size_value;
+ enum vdpMPEG2States state;
+ uint32_t cur_bitstream;
+ const uint8_t *ptr_bitstream_end;
+ const uint8_t *ptr_bitstream;
+ uint8_t code;
+
+ /* The decoded bitstream goes here: */
+ /* Sequence_header_info */
+ uint32_t horizontal_size_value;
};
int
vlVdpMPEG2BitstreamToMacroblock(struct pipe_screen *screen,
- VdpBitstreamBuffer const *bitstream_buffers,
- uint32_t bitstream_buffer_count,
- unsigned int *num_macroblocks,
- struct pipe_mpeg12_macroblock **pipe_macroblocks);
-
+ VdpBitstreamBuffer const *bitstream_buffers,
+ uint32_t bitstream_buffer_count,
+ unsigned int *num_macroblocks,
+ struct pipe_mpeg12_macroblock **pipe_macroblocks);
#endif // MPEG2_BITSTREAM_PARSER_H
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
index 20097eaf98c..90c66481d0a 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -31,34 +31,34 @@
#include <util/u_memory.h>
VdpStatus
-vlVdpOutputSurfaceCreate ( VdpDevice device,
- VdpRGBAFormat rgba_format,
- uint32_t width, uint32_t height,
- VdpOutputSurface *surface)
+vlVdpOutputSurfaceCreate(VdpDevice device,
+ VdpRGBAFormat rgba_format,
+ uint32_t width, uint32_t height,
+ VdpOutputSurface *surface)
{
- vlVdpOutputSurface *vlsurface = NULL;
-
- debug_printf("[VDPAU] Creating output surface\n");
- if (!(width && height))
- return VDP_STATUS_INVALID_SIZE;
-
- vlVdpDevice *dev = vlGetDataHTAB(device);
- if (!dev)
+ vlVdpOutputSurface *vlsurface = NULL;
+
+ debug_printf("[VDPAU] Creating output surface\n");
+ if (!(width && height))
+ return VDP_STATUS_INVALID_SIZE;
+
+ vlVdpDevice *dev = vlGetDataHTAB(device);
+ if (!dev)
return VDP_STATUS_INVALID_HANDLE;
-
- vlsurface = CALLOC(1, sizeof(vlVdpOutputSurface));
- if (!vlsurface)
+
+ vlsurface = CALLOC(1, sizeof(vlVdpOutputSurface));
+ if (!vlsurface)
return VDP_STATUS_RESOURCES;
-
- vlsurface->width = width;
- vlsurface->height = height;
- vlsurface->format = FormatRGBAToPipe(rgba_format);
-
- *surface = vlAddDataHTAB(vlsurface);
+
+ vlsurface->width = width;
+ vlsurface->height = height;
+ vlsurface->format = FormatRGBAToPipe(rgba_format);
+
+ *surface = vlAddDataHTAB(vlsurface);
if (*surface == 0) {
FREE(dev);
- return VDP_STATUS_ERROR;
+ return VDP_STATUS_ERROR;
}
-
- return VDP_STATUS_OK;
-} \ No newline at end of file
+
+ return VDP_STATUS_OK;
+}
diff --git a/src/gallium/state_trackers/vdpau/preemption.c b/src/gallium/state_trackers/vdpau/preemption.c
index 4572bdcfe6d..fa70bb09cbc 100644
--- a/src/gallium/state_trackers/vdpau/preemption.c
+++ b/src/gallium/state_trackers/vdpau/preemption.c
@@ -24,16 +24,16 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
-
+
#include <vdpau/vdpau.h>
-
- void vlVdpPreemptionCallback (VdpDevice device, void *context)
+
+ void vlVdpPreemptionCallback(VdpDevice device, void *context)
{
- /* TODO: Implement preemption */
+ /* TODO: Implement preemption */
}
-
- VdpStatus vlVdpPreemptionCallbackRegister (VdpDevice device, VdpPreemptionCallback callback, void *context)
+
+ VdpStatus vlVdpPreemptionCallbackRegister(VdpDevice device, VdpPreemptionCallback callback,
+ void *context)
{
-
- return VDP_STATUS_OK;
- } \ No newline at end of file
+ return VDP_STATUS_OK;
+ }
diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
index 5f545d0bb27..d4f67379ed2 100644
--- a/src/gallium/state_trackers/vdpau/presentation.c
+++ b/src/gallium/state_trackers/vdpau/presentation.c
@@ -31,119 +31,115 @@
#include <util/u_memory.h>
VdpStatus
-vlVdpPresentationQueueTargetDestroy (VdpPresentationQueueTarget presentation_queue_target)
+vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queue_target)
{
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpPresentationQueueCreate ( VdpDevice device,
- VdpPresentationQueueTarget presentation_queue_target,
- VdpPresentationQueue *presentation_queue)
+vlVdpPresentationQueueCreate(VdpDevice device,
+ VdpPresentationQueueTarget presentation_queue_target,
+ VdpPresentationQueue *presentation_queue)
{
- debug_printf("[VDPAU] Creating PresentationQueue\n");
- VdpStatus ret;
- vlVdpPresentationQueue *pq = NULL;
-
- if (!presentation_queue)
- return VDP_STATUS_INVALID_POINTER;
-
+ debug_printf("[VDPAU] Creating PresentationQueue\n");
+ VdpStatus ret;
+ vlVdpPresentationQueue *pq = NULL;
+
+ if (!presentation_queue)
+ return VDP_STATUS_INVALID_POINTER;
+
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
vlVdpPresentationQueueTarget *pqt = vlGetDataHTAB(presentation_queue_target);
if (!pqt)
- return VDP_STATUS_INVALID_HANDLE;
-
- if (dev != pqt->device)
- return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
+ return VDP_STATUS_INVALID_HANDLE;
+
+ if (dev != pqt->device)
+ return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
pq = CALLOC(1, sizeof(vlVdpPresentationQueue));
if (!pq)
return VDP_STATUS_RESOURCES;
-
- *presentation_queue = vlAddDataHTAB(pq);
+
+ *presentation_queue = vlAddDataHTAB(pq);
if (*presentation_queue == 0) {
ret = VDP_STATUS_ERROR;
goto no_handle;
}
-
- return VDP_STATUS_OK;
- no_handle:
- FREE(pq);
- return ret;
+ return VDP_STATUS_OK;
+no_handle:
+ FREE(pq);
+ return ret;
}
VdpStatus
-vlVdpPresentationQueueDestroy (VdpPresentationQueue presentation_queue)
+vlVdpPresentationQueueDestroy(VdpPresentationQueue presentation_queue)
{
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpPresentationQueueSetBackgroundColor ( VdpPresentationQueue presentation_queue,
- VdpColor *const background_color)
+vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue,
+ VdpColor *const background_color)
{
- if (!background_color)
- return VDP_STATUS_INVALID_POINTER;
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ if (!background_color)
+ return VDP_STATUS_INVALID_POINTER;
+
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpPresentationQueueGetBackgroundColor ( VdpPresentationQueue presentation_queue,
- VdpColor *const background_color)
+vlVdpPresentationQueueGetBackgroundColor(VdpPresentationQueue presentation_queue,
+ VdpColor *const background_color)
{
- if (!background_color)
- return VDP_STATUS_INVALID_POINTER;
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ if (!background_color)
+ return VDP_STATUS_INVALID_POINTER;
+
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpPresentationQueueGetTime ( VdpPresentationQueue presentation_queue,
- VdpTime *current_time)
+vlVdpPresentationQueueGetTime(VdpPresentationQueue presentation_queue,
+ VdpTime *current_time)
{
- if (!current_time)
- return VDP_STATUS_INVALID_POINTER;
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ if (!current_time)
+ return VDP_STATUS_INVALID_POINTER;
+
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpPresentationQueueDisplay ( VdpPresentationQueue presentation_queue,
- VdpOutputSurface surface,
- uint32_t clip_width,
- uint32_t clip_height,
- VdpTime earliest_presentation_time)
+vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
+ VdpOutputSurface surface,
+ uint32_t clip_width,
+ uint32_t clip_height,
+ VdpTime earliest_presentation_time)
{
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpPresentationQueueBlockUntilSurfaceIdle ( VdpPresentationQueue presentation_queue,
- VdpOutputSurface surface,
- VdpTime *first_presentation_time)
+vlVdpPresentationQueueBlockUntilSurfaceIdle(VdpPresentationQueue presentation_queue,
+ VdpOutputSurface surface,
+ VdpTime *first_presentation_time)
{
- if (!first_presentation_time)
- return VDP_STATUS_INVALID_POINTER;
-
- return VDP_STATUS_NO_IMPLEMENTATION;
+ if (!first_presentation_time)
+ return VDP_STATUS_INVALID_POINTER;
+
+ return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
-vlVdpPresentationQueueQuerySurfaceStatus ( VdpPresentationQueue presentation_queue,
- VdpOutputSurface surface,
- VdpPresentationQueueStatus *status,
- VdpTime *first_presentation_time)
+vlVdpPresentationQueueQuerySurfaceStatus(VdpPresentationQueue presentation_queue,
+ VdpOutputSurface surface,
+ VdpPresentationQueueStatus *status,
+ VdpTime *first_presentation_time)
{
- if (!(status && first_presentation_time))
- return VDP_STATUS_INVALID_POINTER;
-
- return VDP_STATUS_NO_IMPLEMENTATION;
-} \ No newline at end of file
+ if (!(status && first_presentation_time))
+ return VDP_STATUS_INVALID_POINTER;
+
+ return VDP_STATUS_NO_IMPLEMENTATION;
+}
diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c
index a3a8500a6f7..74a3bd925cf 100644
--- a/src/gallium/state_trackers/vdpau/query.c
+++ b/src/gallium/state_trackers/vdpau/query.c
@@ -61,7 +61,7 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
struct vl_screen *vlscreen;
uint32_t max_2d_texture_level;
VdpStatus ret;
-
+
debug_printf("[VDPAU] Querying video surfaces\n");
if (!(is_supported && max_width && max_height))
@@ -70,12 +70,12 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
-
+
vlscreen = vl_screen_create(dev->display, dev->screen);
if (!vlscreen)
return VDP_STATUS_RESOURCES;
- /* XXX: Current limits */
+ /* XXX: Current limits */
*is_supported = true;
if (surface_chroma_type != VDP_CHROMA_TYPE_420) {
*is_supported = false;
@@ -90,9 +90,9 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
/* I am not quite sure if it is max_2d_texture_level-1 or just max_2d_texture_level */
*max_width = *max_height = pow(2,max_2d_texture_level-1);
-
+
vl_screen_destroy(vlscreen);
-
+
return VDP_STATUS_OK;
no_sup:
return ret;
@@ -103,10 +103,10 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
VdpYCbCrFormat bits_ycbcr_format,
VdpBool *is_supported)
{
- struct vl_screen *vlscreen;
-
- debug_printf("[VDPAU] Querying get put video surfaces\n");
-
+ struct vl_screen *vlscreen;
+
+ debug_printf("[VDPAU] Querying get put video surfaces\n");
+
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
@@ -118,16 +118,16 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
if (!vlscreen)
return VDP_STATUS_RESOURCES;
- if (bits_ycbcr_format != VDP_YCBCR_FORMAT_Y8U8V8A8 && bits_ycbcr_format != VDP_YCBCR_FORMAT_V8U8Y8A8)
- *is_supported = vlscreen->pscreen->is_format_supported(vlscreen->pscreen,
- FormatToPipe(bits_ycbcr_format),
- PIPE_TEXTURE_2D,
- 1,
- PIPE_BIND_RENDER_TARGET,
- PIPE_TEXTURE_GEOM_NON_SQUARE );
-
+ if (bits_ycbcr_format != VDP_YCBCR_FORMAT_Y8U8V8A8 && bits_ycbcr_format != VDP_YCBCR_FORMAT_V8U8Y8A8)
+ *is_supported = vlscreen->pscreen->is_format_supported(vlscreen->pscreen,
+ FormatToPipe(bits_ycbcr_format),
+ PIPE_TEXTURE_2D,
+ 1,
+ PIPE_BIND_RENDER_TARGET,
+ PIPE_TEXTURE_GEOM_NON_SQUARE);
+
vl_screen_destroy(vlscreen);
-
+
return VDP_STATUS_OK;
}
@@ -141,16 +141,16 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
uint32_t max_decode_height;
uint32_t max_2d_texture_level;
struct vl_screen *vlscreen;
-
+
debug_printf("[VDPAU] Querying decoder\n");
-
+
if (!(is_supported && max_level && max_macroblocks && max_width && max_height))
return VDP_STATUS_INVALID_POINTER;
-
+
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
-
+
vlscreen = vl_screen_create(dev->display, dev->screen);
if (!vlscreen)
return VDP_STATUS_RESOURCES;
@@ -160,24 +160,24 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
*is_supported = false;
return VDP_STATUS_OK;
}
-
+
if (p_profile != PIPE_VIDEO_PROFILE_MPEG2_SIMPLE && p_profile != PIPE_VIDEO_PROFILE_MPEG2_MAIN) {
*is_supported = false;
return VDP_STATUS_OK;
}
-
+
/* XXX hack, need to implement something more sane when the decoders have been implemented */
max_2d_texture_level = vlscreen->pscreen->get_param( vlscreen->pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS );
max_decode_width = max_decode_height = pow(2,max_2d_texture_level-2);
- if (!(max_decode_width && max_decode_height))
+ if (!(max_decode_width && max_decode_height))
return VDP_STATUS_RESOURCES;
-
+
*is_supported = true;
*max_width = max_decode_width;
*max_height = max_decode_height;
*max_level = 16;
*max_macroblocks = (max_decode_width/16) * (max_decode_height/16);
-
+
vl_screen_destroy(vlscreen);
return VDP_STATUS_OK;
@@ -186,10 +186,10 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
VdpStatus
vlVdpOutputSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format,
VdpBool *is_supported, uint32_t *max_width, uint32_t *max_height)
-{
+{
if (!(is_supported && max_width && max_height))
return VDP_STATUS_INVALID_POINTER;
-
+
debug_printf("[VDPAU] Querying ouput surfaces\n");
return VDP_STATUS_NO_IMPLEMENTATION;
@@ -200,7 +200,7 @@ vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities(VdpDevice device, VdpRGBAFor
VdpBool *is_supported)
{
debug_printf("[VDPAU] Querying output surfaces get put native cap\n");
-
+
if (!is_supported)
return VDP_STATUS_INVALID_POINTER;
diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
index 1deea3a67d3..d04c517733d 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -28,7 +28,6 @@
#ifndef VDPAU_PRIVATE_H
#define VDPAU_PRIVATE_H
-
#include <vdpau/vdpau.h>
#include <vdpau/vdpau_x11.h>
#include <pipe/p_compiler.h>
@@ -182,7 +181,7 @@ typedef struct
typedef struct
{
- vlVdpDevice *device;
+ vlVdpDevice *device;
} vlVdpVideoMixer;
typedef struct
@@ -206,12 +205,12 @@ typedef struct
typedef struct
{
- vlVdpDevice *device;
- struct vl_context *vctx;
- enum pipe_video_chroma_format chroma_format;
- enum pipe_video_profile profile;
- uint32_t width;
- uint32_t height;
+ vlVdpDevice *device;
+ struct vl_context *vctx;
+ enum pipe_video_chroma_format chroma_format;
+ enum pipe_video_profile profile;
+ uint32_t width;
+ uint32_t height;
} vlVdpDecoder;
typedef uint32_t vlHandle;
@@ -274,5 +273,4 @@ VdpVideoMixerRender vlVdpVideoMixerRender;
VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues;
VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix;
-
#endif // VDPAU_PRIVATE_H