From 6ada38d29a9b6eb01ad21e9b1ec089bf42d497da Mon Sep 17 00:00:00 2001 From: Thomas Balling Sørensen Date: Thu, 22 Jul 2010 01:46:40 +0200 Subject: Added stubs for the rest of the vdpau interface --- src/gallium/state_trackers/vdpau/mixer.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/gallium/state_trackers/vdpau/mixer.c (limited to 'src/gallium/state_trackers/vdpau/mixer.c') diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3 From 65fe0866aec7b5608419f6d184cb1fa4fe1dc45a Mon Sep 17 00:00:00 2001 From: Thomas Balling Sørensen Date: Wed, 6 Oct 2010 23:30:08 +0200 Subject: vl: implemented a few functions and made stubs to get mplayer running --- src/gallium/auxiliary/vl/vl_compositor.c | 1 + src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 1 + src/gallium/state_trackers/vdpau/Makefile | 4 +- src/gallium/state_trackers/vdpau/decode.c | 26 +++- src/gallium/state_trackers/vdpau/device.c | 45 ++++++- src/gallium/state_trackers/vdpau/ftab.c | 60 ++++----- src/gallium/state_trackers/vdpau/header.c | 0 src/gallium/state_trackers/vdpau/mixer.c | 135 +++++++++++++++++++++ .../state_trackers/vdpau/mpeg2_bitstream_parser.c | 2 + src/gallium/state_trackers/vdpau/output.c | 23 +++- src/gallium/state_trackers/vdpau/preemption.c | 39 ++++++ src/gallium/state_trackers/vdpau/presentation.c | 34 +++++- src/gallium/state_trackers/vdpau/render.c | 0 src/gallium/state_trackers/vdpau/vdpau_private.h | 61 ++++++++++ 14 files changed, 387 insertions(+), 44 deletions(-) delete mode 100644 src/gallium/state_trackers/vdpau/header.c delete mode 100644 src/gallium/state_trackers/vdpau/render.c (limited to 'src/gallium/state_trackers/vdpau/mixer.c') diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index ee7bf070037..1dbf14ee7b9 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include "vl_csc.h" diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 8a8c155e8ec..264ab3d4566 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #define DEFAULT_BUF_ALIGNMENT 1 diff --git a/src/gallium/state_trackers/vdpau/Makefile b/src/gallium/state_trackers/vdpau/Makefile index ad37676b95e..0e68d4fe007 100644 --- a/src/gallium/state_trackers/vdpau/Makefile +++ b/src/gallium/state_trackers/vdpau/Makefile @@ -20,7 +20,9 @@ C_SOURCES = htab.c \ presentation.c \ bitmap.c \ mpeg2_bitstream_parser.c \ - output.c + output.c \ + preemption.c \ + mixer.c include ../../Makefile.template diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 03764a7f33d..f6003304668 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -98,6 +98,7 @@ VdpStatus vlVdpDecoderDestroy (VdpDecoder decoder ) { + debug_printf("[VDPAU] Destroying decoder\n"); vlVdpDecoder *vldecoder; vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder); @@ -105,8 +106,11 @@ vlVdpDecoderDestroy (VdpDecoder decoder return VDP_STATUS_INVALID_HANDLE; } - 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); @@ -124,6 +128,8 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, struct pipe_resource tmplt; struct pipe_resource *surf_tex; struct pipe_video_context *vpipe; + + debug_printf("[VDPAU] Creating surface\n"); if(!(vldecoder && vlsurf)) return VDP_STATUS_INVALID_POINTER; @@ -185,6 +191,7 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, struct pipe_mpeg12_macroblock *pipe_macroblocks; VdpStatus ret; + debug_printf("[VDPAU] Decoding MPEG2\n"); vpipe = vldecoder->vctx->vpipe; t_vdp_surf = vlsurf; @@ -221,7 +228,7 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, } vpipe->set_decode_target(vpipe,t_surf); - vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL); + //vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL); skip_frame: return ret; @@ -283,3 +290,16 @@ vlVdpDecoderRender (VdpDecoder decoder, return ret; } + +VdpStatus +vlVdpGenerateCSCMatrix( + 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/device.c b/src/gallium/state_trackers/vdpau/device.c index d370d1c6610..4ca198e874d 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2010 Younes Manton. + * Copyright 2010 Younes Manton og Thomas Balling Sørensen. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,21 +25,18 @@ * **************************************************************************/ -#include #include #include #include #include #include "vdpau_private.h" -VdpDeviceCreateX11 vdp_imp_device_create_x11; PUBLIC VdpStatus vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGetProcAddress **get_proc_address) { VdpStatus ret; vlVdpDevice *dev = NULL; - struct vl_screen *vlscreen = NULL; if (!(display && device && get_proc_address)) return VDP_STATUS_INVALID_POINTER; @@ -62,9 +59,8 @@ 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"); return VDP_STATUS_OK; @@ -77,9 +73,46 @@ no_htab: return ret; } +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; + + 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; + goto no_handle; + } + + + return VDP_STATUS_OK; + no_handle: + FREE(dev); + return ret; +} + VdpStatus vlVdpDeviceDestroy(VdpDevice device) { + debug_printf("[VDPAU] Destroying destroy\n"); + vlVdpDevice *dev = vlGetDataHTAB(device); if (!dev) return VDP_STATUS_INVALID_HANDLE; diff --git a/src/gallium/state_trackers/vdpau/ftab.c b/src/gallium/state_trackers/vdpau/ftab.c index 1842c4da0ea..2142dcd4f6a 100644 --- a/src/gallium/state_trackers/vdpau/ftab.c +++ b/src/gallium/state_trackers/vdpau/ftab.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2010 Younes Manton. + * Copyright 2010 Younes Manton & Thomas Balling Sørensen. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -33,10 +33,10 @@ static void* ftab[67] = &vlVdpGetErrorString, /* VDP_FUNC_ID_GET_ERROR_STRING */ &vlVdpGetProcAddress, /* VDP_FUNC_ID_GET_PROC_ADDRESS */ &vlVdpGetApiVersion, /* VDP_FUNC_ID_GET_API_VERSION */ - 0, + 0x555, /* DUMMY */ &vlVdpGetInformationString, /* VDP_FUNC_ID_GET_INFORMATION_STRING */ &vlVdpDeviceDestroy, /* VDP_FUNC_ID_DEVICE_DESTROY */ - 0, /* VDP_FUNC_ID_GENERATE_CSC_MATRIX */ + &vlVdpGenerateCSCMatrix, /* VDP_FUNC_ID_GENERATE_CSC_MATRIX */ &vlVdpVideoSurfaceQueryCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES */ &vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES */ &vlVdpVideoSurfaceCreate, /* VDP_FUNC_ID_VIDEO_SURFACE_CREATE */ @@ -46,62 +46,62 @@ static void* ftab[67] = &vlVdpVideoSurfacePutBitsYCbCr, /* VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR */ &vlVdpOutputSurfaceQueryCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES */ &vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES */ + 0x2, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES */ &vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES */ &vlVdpOutputSurfaceCreate, /* VDP_FUNC_ID_OUTPUT_SURFACE_CREATE */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR */ + 0x3, /* VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY */ + 0x4, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS */ + 0x5, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE */ + 0x6, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE */ + 0x7, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED */ + 0x8, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR */ &vlVdpBitmapSurfaceQueryCapabilities, /* VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES */ &vlVdpBitmapSurfaceCreate, /* VDP_FUNC_ID_BITMAP_SURFACE_CREATE */ &vlVdpBitmapSurfaceDestroy, /* VDP_FUNC_ID_BITMAP_SURFACE_DESTROY */ &vlVdpBitmapSurfaceGetParameters, /* VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS */ &vlVdpBitmapSurfacePutBitsNative, /* VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE */ - 0, - 0, - 0, - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE */ - 0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA */ + 0x55, /* DUMMY */ + 0x55, /* DUMMY */ + 0x55, /* DUMMY */ + 0x9, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE */ + 0x10, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE */ + 0x11, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA */ &vlVdpDecoderQueryCapabilities, /* VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES */ &vlVdpDecoderCreate, /* VDP_FUNC_ID_DECODER_CREATE */ &vlVdpDecoderDestroy, /* VDP_FUNC_ID_DECODER_DESTROY */ - 0, /* VDP_FUNC_ID_DECODER_GET_PARAMETERS */ + 0x12, /* VDP_FUNC_ID_DECODER_GET_PARAMETERS */ &vlVdpDecoderRender, /* VDP_FUNC_ID_DECODER_RENDER */ &vlVdpVideoMixerQueryFeatureSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT */ &vlVdpVideoMixerQueryParameterSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT */ &vlVdpVideoMixerQueryAttributeSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT */ &vlVdpVideoMixerQueryParameterValueRange, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE */ &vlVdpVideoMixerQueryAttributeValueRange, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_CREATE */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_DESTROY */ - 0, /* VDP_FUNC_ID_VIDEO_MIXER_RENDER */ + &vlVdpVideoMixerCreate, /* VDP_FUNC_ID_VIDEO_MIXER_CREATE */ + &vlVdpVideoMixerSetFeatureEnables, /* VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES */ + &vlVdpVideoMixerSetAttributeValues, /* VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES */ + 0x16, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT */ + 0x17, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES */ + 0x18, /* VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES */ + 0x19, /* VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES */ + 0x20, /* VDP_FUNC_ID_VIDEO_MIXER_DESTROY */ + &vlVdpVideoMixerRender, /* VDP_FUNC_ID_VIDEO_MIXER_RENDER */ &vlVdpPresentationQueueTargetDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY */ &vlVdpPresentationQueueCreate, /* VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE */ &vlVdpPresentationQueueDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY */ &vlVdpPresentationQueueSetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR */ &vlVdpPresentationQueueGetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR */ - 0, - 0, + 0x55, /* DUMMY */ + 0x55, /* DUMMY */ &vlVdpPresentationQueueGetTime, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME */ &vlVdpPresentationQueueDisplay, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY */ &vlVdpPresentationQueueBlockUntilSurfaceIdle, /* VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE */ &vlVdpPresentationQueueQuerySurfaceStatus, /* VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS */ - 0 /* VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER */ + &vlVdpPreemptionCallbackRegister /* VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER */ }; static void* ftab_winsys[1] = { - 0 /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 */ + &vlVdpPresentationQueueTargetCreateX11 /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 */ }; boolean vlGetFuncFTAB(VdpFuncId function_id, void **func) diff --git a/src/gallium/state_trackers/vdpau/header.c b/src/gallium/state_trackers/vdpau/header.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index e69de29bb2d..8bf42f53ff2 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -0,0 +1,135 @@ +/************************************************************************** + * + * Copyright 2010 Thomas Balling Sørensen. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + #include + #include + #include + #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) + return VDP_STATUS_INVALID_HANDLE; + + 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) { + ret = VDP_STATUS_ERROR; + goto no_handle; + } + + + return VDP_STATUS_OK; + no_handle: + return ret; +} + +VdpStatus +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; +} + +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; + + return VDP_STATUS_NO_IMPLEMENTATION; +} + +VdpStatus +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; + + return VDP_STATUS_OK; +} \ No newline at end of file diff --git a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c index d88afb495f7..3c456a07ca1 100644 --- a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c +++ b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c @@ -73,6 +73,8 @@ vlVdpMPEG2BitstreamToMacroblock ( bool b_header_done = false; struct vdpMPEG2BitstreamParser parser; + debug_printf("[VDPAU] Starting decoding MPEG2 stream"); + num_macroblocks[0] = 0; memset(&parser,0,sizeof(parser)); diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index c5f06896c58..20097eaf98c 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -28,6 +28,7 @@ #include "vdpau_private.h" #include #include +#include VdpStatus vlVdpOutputSurfaceCreate ( VdpDevice device, @@ -35,9 +36,29 @@ vlVdpOutputSurfaceCreate ( VdpDevice device, 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) + return VDP_STATUS_INVALID_HANDLE; + + 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); + if (*surface == 0) { + FREE(dev); + return VDP_STATUS_ERROR; + } - return VDP_STATUS_NO_IMPLEMENTATION; + return VDP_STATUS_OK; } \ No newline at end of file diff --git a/src/gallium/state_trackers/vdpau/preemption.c b/src/gallium/state_trackers/vdpau/preemption.c index e69de29bb2d..4572bdcfe6d 100644 --- a/src/gallium/state_trackers/vdpau/preemption.c +++ b/src/gallium/state_trackers/vdpau/preemption.c @@ -0,0 +1,39 @@ +/************************************************************************** + * + * Copyright 2010 Thomas Balling Sørensen. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + #include + + void vlVdpPreemptionCallback (VdpDevice device, void *context) + { + /* TODO: Implement preemption */ + } + + VdpStatus vlVdpPreemptionCallbackRegister (VdpDevice device, VdpPreemptionCallback callback, void *context) + { + + return VDP_STATUS_OK; + } \ No newline at end of file diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 8200cf04326..5f545d0bb27 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -28,6 +28,7 @@ #include "vdpau_private.h" #include #include +#include VdpStatus vlVdpPresentationQueueTargetDestroy (VdpPresentationQueueTarget presentation_queue_target) @@ -41,12 +42,39 @@ vlVdpPresentationQueueCreate ( VdpDevice device, VdpPresentationQueueTarget presentation_queue_target, VdpPresentationQueue *presentation_queue) { - debug_printf("[VDPAU] Creating presentation queue\n"); + debug_printf("[VDPAU] Creating PresentationQueue\n"); + VdpStatus ret; + vlVdpPresentationQueue *pq = NULL; if (!presentation_queue) return VDP_STATUS_INVALID_POINTER; - - return VDP_STATUS_NO_IMPLEMENTATION; + + 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; + + pq = CALLOC(1, sizeof(vlVdpPresentationQueue)); + if (!pq) + return VDP_STATUS_RESOURCES; + + *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; } VdpStatus diff --git a/src/gallium/state_trackers/vdpau/render.c b/src/gallium/state_trackers/vdpau/render.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index 635d6c8acdb..36ef124c13d 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -30,6 +30,7 @@ #include +#include #include #include #include @@ -73,6 +74,7 @@ static VdpChromaType PipeToType(enum pipe_video_chroma_format pipe_type) return -1; } + static enum pipe_format FormatToPipe(VdpYCbCrFormat vdpau_format) { switch (vdpau_format) { @@ -95,6 +97,26 @@ static enum pipe_format FormatToPipe(VdpYCbCrFormat vdpau_format) return -1; } +static enum pipe_format FormatRGBAToPipe(VdpRGBAFormat vdpau_format) +{ + switch (vdpau_format) { + case VDP_RGBA_FORMAT_A8: + return PIPE_FORMAT_A8_UNORM; + case VDP_RGBA_FORMAT_B10G10R10A2: + return PIPE_FORMAT_B10G10R10A2_UNORM; + case VDP_RGBA_FORMAT_B8G8R8A8: + return PIPE_FORMAT_B8G8R8A8_UNORM; + case VDP_RGBA_FORMAT_R10G10B10A2: + return PIPE_FORMAT_R10G10B10A2_UNORM; + case VDP_RGBA_FORMAT_R8G8B8A8: + return PIPE_FORMAT_R8G8B8A8_UNORM; + default: + assert(0); + } + + return -1; +} + static VdpYCbCrFormat PipeToFormat(enum pipe_format p_format) { switch (p_format) { @@ -145,6 +167,23 @@ typedef struct int screen; } vlVdpDevice; +typedef struct +{ + vlVdpDevice *device; + Drawable drawable; +} vlVdpPresentationQueueTarget; + +typedef struct +{ + vlVdpDevice *device; + Drawable drawable; +} vlVdpPresentationQueue; + +typedef struct +{ + vlVdpDevice *device; +} vlVdpVideoMixer; + typedef struct { vlVdpDevice *device; @@ -157,6 +196,14 @@ typedef struct uint8_t *data; } vlVdpSurface; +typedef struct +{ + vlVdpDevice *device; + uint32_t width; + uint32_t height; + enum pipe_format format; +} vlVdpOutputSurface; + typedef struct { vlVdpDevice *device; @@ -174,6 +221,11 @@ vlHandle vlAddDataHTAB(void *data); void* vlGetDataHTAB(vlHandle handle); boolean vlGetFuncFTAB(VdpFuncId function_id, void **func); +/* Public functions */ +VdpDeviceCreateX11 vdp_imp_device_create_x11; +VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11; + +/* Internal function pointers */ VdpGetErrorString vlVdpGetErrorString; VdpDeviceDestroy vlVdpDeviceDestroy; VdpGetProcAddress vlVdpGetProcAddress; @@ -213,4 +265,13 @@ VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime; VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay; VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle; VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus; +VdpPreemptionCallback vlVdpPreemptionCallback; +VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister; +VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables; +VdpVideoMixerCreate vlVdpVideoMixerCreate; +VdpVideoMixerRender vlVdpVideoMixerRender; +VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues; +VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix; + + #endif // VDPAU_PRIVATE_H -- cgit v1.2.3 From bff1ac875c2c62ba5045bb953f800253c49361cb Mon Sep 17 00:00:00 2001 From: Thomas Balling Sørensen Date: Thu, 7 Oct 2010 00:26:46 +0200 Subject: vl: some more fixes and addition to the decoder handling --- src/gallium/state_trackers/vdpau/decode.c | 27 ++++++++++++++---------- src/gallium/state_trackers/vdpau/device.c | 10 +++++++++ src/gallium/state_trackers/vdpau/mixer.c | 5 +++++ src/gallium/state_trackers/vdpau/vdpau_private.h | 8 ++++--- 4 files changed, 36 insertions(+), 14 deletions(-) (limited to 'src/gallium/state_trackers/vdpau/mixer.c') diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index f6003304668..1b49b4b2520 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -74,7 +74,10 @@ 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) { @@ -127,27 +130,27 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, { struct pipe_resource tmplt; struct pipe_resource *surf_tex; - struct pipe_video_context *vpipe; + struct pipe_video_context *vctx; debug_printf("[VDPAU] Creating surface\n"); if(!(vldecoder && vlsurf)) return VDP_STATUS_INVALID_POINTER; - vpipe = vldecoder->vctx; + vctx = vldecoder->vctx; memset(&tmplt, 0, sizeof(struct pipe_resource)); tmplt.target = PIPE_TEXTURE_2D; tmplt.format = vlsurf->format; tmplt.last_level = 0; - if (vpipe->is_format_supported(vpipe, tmplt.format, + 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 { - assert(vpipe->is_format_supported(vpipe, tmplt.format, + 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); @@ -158,9 +161,9 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; tmplt.flags = 0; - surf_tex = vpipe->screen->resource_create(vpipe->screen, &tmplt); + surf_tex = vctx->screen->resource_create(vctx->screen, &tmplt); - vlsurf->psurface = vpipe->screen->get_tex_surface(vpipe->screen, surf_tex, 0, 0, 0, + vlsurf->psurface = vctx->screen->get_tex_surface(vctx->screen, surf_tex, 0, 0, 0, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET); pipe_resource_reference(&surf_tex, NULL); @@ -193,7 +196,6 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, debug_printf("[VDPAU] Decoding MPEG2\n"); - vpipe = vldecoder->vctx->vpipe; t_vdp_surf = vlsurf; /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */ @@ -218,6 +220,8 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, ret = vlVdpCreateSurfaceTarget(vldecoder,t_vdp_surf); + vpipe = vldecoder->vctx->vpipe; + if (vlVdpMPEG2BitstreamToMacroblock(vpipe->screen, bitstream_buffers, bitstream_buffer_count, &num_macroblocks, &pipe_macroblocks)) { @@ -228,7 +232,7 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder, } vpipe->set_decode_target(vpipe,t_surf); - //vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL); + vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL); skip_frame: return ret; @@ -263,14 +267,15 @@ vlVdpDecoderRender (VdpDecoder decoder, if (vlsurf->device != vldecoder->device) return VDP_STATUS_HANDLE_DEVICE_MISMATCH; - if (vlsurf->chroma_format != vldecoder->chroma_format) - return VDP_STATUS_INVALID_CHROMA_TYPE; + /* 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->format, vlsurf->width, vlsurf->height); + vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->format, vldecoder->width, vldecoder->height); if (!vldecoder->vctx) return VDP_STATUS_RESOURCES; diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c index 4ca198e874d..496e2b8def0 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -26,6 +26,7 @@ **************************************************************************/ #include +#include #include #include #include @@ -51,8 +52,15 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe ret = VDP_STATUS_RESOURCES; goto no_dev; } + dev->display = display; dev->screen = screen; + dev->vscreen = vl_screen_create(display, screen); + if (!dev->vscreen) + { + ret = VDP_STATUS_RESOURCES; + goto no_vscreen; + } *device = vlAddDataHTAB(dev); if (*device == 0) { @@ -66,6 +74,8 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe return VDP_STATUS_OK; no_handle: + /* Destroy vscreen */ +no_vscreen: FREE(dev); no_dev: vlDestroyHTAB(); diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index 8bf42f53ff2..124125ebaad 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -130,6 +130,11 @@ vlVdpVideoMixerSetAttributeValues ( 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 diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index 36ef124c13d..de206365ce2 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -163,8 +163,9 @@ static enum pipe_video_profile ProfileToPipe(VdpDecoderProfile vdpau_profile) typedef struct { - void *display; + Display *display; int screen; + struct vl_screen *vscreen; } vlVdpDevice; typedef struct @@ -207,10 +208,11 @@ typedef struct typedef struct { vlVdpDevice *device; - struct vl_screen *vlscreen; - struct vl_context *vctx; + 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; -- cgit v1.2.3