1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2010 Younes Manton & Thomas Balling Sørensen. 4bf215546Sopenharmony_ci * All Rights Reserved. 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 12bf215546Sopenharmony_ci * the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 16bf215546Sopenharmony_ci * of the Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci **************************************************************************/ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci#include <assert.h> 29bf215546Sopenharmony_ci 30bf215546Sopenharmony_ci#include "util/u_memory.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#include "vdpau_private.h" 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_cistatic void* ftab[67] = 35bf215546Sopenharmony_ci{ 36bf215546Sopenharmony_ci &vlVdpGetErrorString, /* VDP_FUNC_ID_GET_ERROR_STRING */ 37bf215546Sopenharmony_ci &vlVdpGetProcAddress, /* VDP_FUNC_ID_GET_PROC_ADDRESS */ 38bf215546Sopenharmony_ci &vlVdpGetApiVersion, /* VDP_FUNC_ID_GET_API_VERSION */ 39bf215546Sopenharmony_ci NULL, /* DUMMY */ 40bf215546Sopenharmony_ci &vlVdpGetInformationString, /* VDP_FUNC_ID_GET_INFORMATION_STRING */ 41bf215546Sopenharmony_ci &vlVdpDeviceDestroy, /* VDP_FUNC_ID_DEVICE_DESTROY */ 42bf215546Sopenharmony_ci &vlVdpGenerateCSCMatrix, /* VDP_FUNC_ID_GENERATE_CSC_MATRIX */ 43bf215546Sopenharmony_ci &vlVdpVideoSurfaceQueryCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES */ 44bf215546Sopenharmony_ci &vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES */ 45bf215546Sopenharmony_ci &vlVdpVideoSurfaceCreate, /* VDP_FUNC_ID_VIDEO_SURFACE_CREATE */ 46bf215546Sopenharmony_ci &vlVdpVideoSurfaceDestroy, /* VDP_FUNC_ID_VIDEO_SURFACE_DESTROY */ 47bf215546Sopenharmony_ci &vlVdpVideoSurfaceGetParameters, /* VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS */ 48bf215546Sopenharmony_ci &vlVdpVideoSurfaceGetBitsYCbCr, /* VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR */ 49bf215546Sopenharmony_ci &vlVdpVideoSurfacePutBitsYCbCr, /* VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR */ 50bf215546Sopenharmony_ci &vlVdpOutputSurfaceQueryCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES */ 51bf215546Sopenharmony_ci &vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES */ 52bf215546Sopenharmony_ci &vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES */ 53bf215546Sopenharmony_ci &vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES */ 54bf215546Sopenharmony_ci &vlVdpOutputSurfaceCreate, /* VDP_FUNC_ID_OUTPUT_SURFACE_CREATE */ 55bf215546Sopenharmony_ci &vlVdpOutputSurfaceDestroy, /* VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY */ 56bf215546Sopenharmony_ci &vlVdpOutputSurfaceGetParameters, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS */ 57bf215546Sopenharmony_ci &vlVdpOutputSurfaceGetBitsNative, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE */ 58bf215546Sopenharmony_ci &vlVdpOutputSurfacePutBitsNative, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE */ 59bf215546Sopenharmony_ci &vlVdpOutputSurfacePutBitsIndexed, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED */ 60bf215546Sopenharmony_ci &vlVdpOutputSurfacePutBitsYCbCr, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR */ 61bf215546Sopenharmony_ci &vlVdpBitmapSurfaceQueryCapabilities, /* VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES */ 62bf215546Sopenharmony_ci &vlVdpBitmapSurfaceCreate, /* VDP_FUNC_ID_BITMAP_SURFACE_CREATE */ 63bf215546Sopenharmony_ci &vlVdpBitmapSurfaceDestroy, /* VDP_FUNC_ID_BITMAP_SURFACE_DESTROY */ 64bf215546Sopenharmony_ci &vlVdpBitmapSurfaceGetParameters, /* VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS */ 65bf215546Sopenharmony_ci &vlVdpBitmapSurfacePutBitsNative, /* VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE */ 66bf215546Sopenharmony_ci NULL, /* DUMMY */ 67bf215546Sopenharmony_ci NULL, /* DUMMY */ 68bf215546Sopenharmony_ci NULL, /* DUMMY */ 69bf215546Sopenharmony_ci &vlVdpOutputSurfaceRenderOutputSurface, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE */ 70bf215546Sopenharmony_ci &vlVdpOutputSurfaceRenderBitmapSurface, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE */ 71bf215546Sopenharmony_ci NULL, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA */ 72bf215546Sopenharmony_ci &vlVdpDecoderQueryCapabilities, /* VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES */ 73bf215546Sopenharmony_ci &vlVdpDecoderCreate, /* VDP_FUNC_ID_DECODER_CREATE */ 74bf215546Sopenharmony_ci &vlVdpDecoderDestroy, /* VDP_FUNC_ID_DECODER_DESTROY */ 75bf215546Sopenharmony_ci &vlVdpDecoderGetParameters, /* VDP_FUNC_ID_DECODER_GET_PARAMETERS */ 76bf215546Sopenharmony_ci &vlVdpDecoderRender, /* VDP_FUNC_ID_DECODER_RENDER */ 77bf215546Sopenharmony_ci &vlVdpVideoMixerQueryFeatureSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT */ 78bf215546Sopenharmony_ci &vlVdpVideoMixerQueryParameterSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT */ 79bf215546Sopenharmony_ci &vlVdpVideoMixerQueryAttributeSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT */ 80bf215546Sopenharmony_ci &vlVdpVideoMixerQueryParameterValueRange, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE */ 81bf215546Sopenharmony_ci &vlVdpVideoMixerQueryAttributeValueRange, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE */ 82bf215546Sopenharmony_ci &vlVdpVideoMixerCreate, /* VDP_FUNC_ID_VIDEO_MIXER_CREATE */ 83bf215546Sopenharmony_ci &vlVdpVideoMixerSetFeatureEnables, /* VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES */ 84bf215546Sopenharmony_ci &vlVdpVideoMixerSetAttributeValues, /* VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES */ 85bf215546Sopenharmony_ci &vlVdpVideoMixerGetFeatureSupport, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT */ 86bf215546Sopenharmony_ci &vlVdpVideoMixerGetFeatureEnables, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES */ 87bf215546Sopenharmony_ci &vlVdpVideoMixerGetParameterValues, /* VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES */ 88bf215546Sopenharmony_ci &vlVdpVideoMixerGetAttributeValues, /* VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES */ 89bf215546Sopenharmony_ci &vlVdpVideoMixerDestroy, /* VDP_FUNC_ID_VIDEO_MIXER_DESTROY */ 90bf215546Sopenharmony_ci &vlVdpVideoMixerRender, /* VDP_FUNC_ID_VIDEO_MIXER_RENDER */ 91bf215546Sopenharmony_ci &vlVdpPresentationQueueTargetDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY */ 92bf215546Sopenharmony_ci &vlVdpPresentationQueueCreate, /* VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE */ 93bf215546Sopenharmony_ci &vlVdpPresentationQueueDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY */ 94bf215546Sopenharmony_ci &vlVdpPresentationQueueSetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR */ 95bf215546Sopenharmony_ci &vlVdpPresentationQueueGetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR */ 96bf215546Sopenharmony_ci NULL, /* DUMMY */ 97bf215546Sopenharmony_ci NULL, /* DUMMY */ 98bf215546Sopenharmony_ci &vlVdpPresentationQueueGetTime, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME */ 99bf215546Sopenharmony_ci &vlVdpPresentationQueueDisplay, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY */ 100bf215546Sopenharmony_ci &vlVdpPresentationQueueBlockUntilSurfaceIdle, /* VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE */ 101bf215546Sopenharmony_ci &vlVdpPresentationQueueQuerySurfaceStatus, /* VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS */ 102bf215546Sopenharmony_ci &vlVdpPreemptionCallbackRegister /* VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER */ 103bf215546Sopenharmony_ci}; 104bf215546Sopenharmony_ci 105bf215546Sopenharmony_cistatic void* ftab_winsys[1] = 106bf215546Sopenharmony_ci{ 107bf215546Sopenharmony_ci &vlVdpPresentationQueueTargetCreateX11 /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 */ 108bf215546Sopenharmony_ci}; 109bf215546Sopenharmony_ci 110bf215546Sopenharmony_cistatic void* ftab_driver[4] = 111bf215546Sopenharmony_ci{ 112bf215546Sopenharmony_ci &vlVdpVideoSurfaceGallium, /* VDP_FUNC_ID_SURFACE_GALLIUM */ 113bf215546Sopenharmony_ci &vlVdpOutputSurfaceGallium, /* VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM */ 114bf215546Sopenharmony_ci &vlVdpVideoSurfaceDMABuf, /* VDP_FUNC_ID_VIDEO_SURFACE_DMA_BUF */ 115bf215546Sopenharmony_ci &vlVdpOutputSurfaceDMABuf /* VDP_FUNC_ID_OUTPUT_SURFACE_DMA_BUF */ 116bf215546Sopenharmony_ci}; 117bf215546Sopenharmony_ci 118bf215546Sopenharmony_ciboolean vlGetFuncFTAB(VdpFuncId function_id, void **func) 119bf215546Sopenharmony_ci{ 120bf215546Sopenharmony_ci assert(func); 121bf215546Sopenharmony_ci *func = NULL; 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ci if (function_id < VDP_FUNC_ID_BASE_WINSYS) { 124bf215546Sopenharmony_ci if (function_id < ARRAY_SIZE(ftab)) 125bf215546Sopenharmony_ci *func = ftab[function_id]; 126bf215546Sopenharmony_ci 127bf215546Sopenharmony_ci } else if (function_id < VDP_FUNC_ID_BASE_DRIVER) { 128bf215546Sopenharmony_ci function_id -= VDP_FUNC_ID_BASE_WINSYS; 129bf215546Sopenharmony_ci if (function_id < ARRAY_SIZE(ftab_winsys)) 130bf215546Sopenharmony_ci *func = ftab_winsys[function_id]; 131bf215546Sopenharmony_ci 132bf215546Sopenharmony_ci } else { 133bf215546Sopenharmony_ci function_id -= VDP_FUNC_ID_BASE_DRIVER; 134bf215546Sopenharmony_ci if (function_id < ARRAY_SIZE(ftab_driver)) 135bf215546Sopenharmony_ci *func = ftab_driver[function_id]; 136bf215546Sopenharmony_ci } 137bf215546Sopenharmony_ci 138bf215546Sopenharmony_ci return *func != NULL; 139bf215546Sopenharmony_ci} 140