vdpau_private.h revision 3299997bcc5a672617095adb560b3834dced39a6
1/************************************************************************** 2 * 3 * Copyright 2010 Younes Manton. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28#ifndef VDPAU_PRIVATE_H 29#define VDPAU_PRIVATE_H 30 31 32#include <vdpau/vdpau.h> 33#include <pipe/p_compiler.h> 34#include <vl_winsys.h> 35#include <assert.h> 36 37#define INFORMATION G3DVL VDPAU Driver Shared Library version VER_MAJOR.VER_MINOR 38#define QUOTEME(x) #x 39#define TOSTRING(x) QUOTEME(x) 40#define INFORMATION_STRING TOSTRING(INFORMATION) 41#define VL_HANDLES 42 43static enum pipe_video_chroma_format TypeToPipe(VdpChromaType vdpau_type) 44{ 45 switch (vdpau_type) { 46 case VDP_CHROMA_TYPE_420: 47 return PIPE_VIDEO_CHROMA_FORMAT_420; 48 case VDP_CHROMA_TYPE_422: 49 return PIPE_VIDEO_CHROMA_FORMAT_422; 50 case VDP_CHROMA_TYPE_444: 51 return PIPE_VIDEO_CHROMA_FORMAT_444; 52 default: 53 assert(0); 54 } 55 56 return -1; 57} 58 59static VdpChromaType PipeToType(enum pipe_video_chroma_format pipe_type) 60{ 61 switch (pipe_type) { 62 case PIPE_VIDEO_CHROMA_FORMAT_420: 63 return VDP_CHROMA_TYPE_420; 64 case PIPE_VIDEO_CHROMA_FORMAT_422: 65 return VDP_CHROMA_TYPE_422; 66 case PIPE_VIDEO_CHROMA_FORMAT_444: 67 return VDP_CHROMA_TYPE_444; 68 default: 69 assert(0); 70 } 71 72 return -1; 73} 74 75static enum pipe_format FormatToPipe(VdpYCbCrFormat vdpau_format) 76{ 77 switch (vdpau_format) { 78 case VDP_YCBCR_FORMAT_NV12: 79 return PIPE_FORMAT_NV12; 80 case VDP_YCBCR_FORMAT_YV12: 81 return PIPE_FORMAT_YV12; 82 case VDP_YCBCR_FORMAT_UYVY: 83 return PIPE_FORMAT_UYVY; 84 case VDP_YCBCR_FORMAT_YUYV: 85 return PIPE_FORMAT_YUYV; 86 case VDP_YCBCR_FORMAT_Y8U8V8A8: /* Not defined in p_format.h */ 87 return 0; 88 case VDP_YCBCR_FORMAT_V8U8Y8A8: 89 return PIPE_FORMAT_VUYA; 90 default: 91 assert(0); 92 } 93 94 return -1; 95} 96 97static VdpYCbCrFormat PipeToFormat(enum pipe_format p_format) 98{ 99 switch (p_format) { 100 case PIPE_FORMAT_NV12: 101 return VDP_YCBCR_FORMAT_NV12; 102 case PIPE_FORMAT_YV12: 103 return VDP_YCBCR_FORMAT_YV12; 104 case PIPE_FORMAT_UYVY: 105 return VDP_YCBCR_FORMAT_UYVY; 106 case PIPE_FORMAT_YUYV: 107 return VDP_YCBCR_FORMAT_YUYV; 108 //case PIPE_FORMAT_YUVA: 109 // return VDP_YCBCR_FORMAT_Y8U8V8A8; 110 case PIPE_FORMAT_VUYA: 111 return VDP_YCBCR_FORMAT_V8U8Y8A8; 112 default: 113 assert(0); 114 } 115 116 return -1; 117} 118 119typedef struct 120{ 121 void *display; 122 int screen; 123 struct vl_screen *vlscreen; 124 struct vl_context *vctx; 125} vlVdpDevice; 126 127typedef struct 128{ 129 struct vl_screen *vlscreen; 130 struct pipe_surface *psurface; 131 enum pipe_video_chroma_format chroma_format; 132} vlVdpSurface; 133 134typedef uint32_t vlHandle; 135 136boolean vlCreateHTAB(void); 137void vlDestroyHTAB(void); 138vlHandle vlAddDataHTAB(void *data); 139void* vlGetDataHTAB(vlHandle handle); 140boolean vlGetFuncFTAB(VdpFuncId function_id, void **func); 141 142VdpDeviceDestroy vlVdpDeviceDestroy; 143VdpGetProcAddress vlVdpGetProcAddress; 144VdpGetApiVersion vlVdpGetApiVersion; 145VdpGetInformationString vlVdpGetInformationString; 146VdpVideoSurfaceQueryCapabilities vlVdpVideoSurfaceQueryCapabilities; 147VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities; 148VdpDecoderQueryCapabilities vlVdpDecoderQueryCapabilities; 149VdpOutputSurfaceQueryCapabilities vlVdpOutputSurfaceQueryCapabilities; 150VdpOutputSurfaceQueryGetPutBitsNativeCapabilities vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities; 151VdpOutputSurfaceQueryPutBitsYCbCrCapabilities vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities; 152VdpBitmapSurfaceQueryCapabilities vlVdpBitmapSurfaceQueryCapabilities; 153VdpVideoMixerQueryFeatureSupport vlVdpVideoMixerQueryFeatureSupport; 154VdpVideoMixerQueryParameterSupport vlVdpVideoMixerQueryParameterSupport; 155VdpVideoMixerQueryParameterValueRange vlVdpVideoMixerQueryParameterValueRange; 156VdpVideoMixerQueryAttributeSupport vlVdpVideoMixerQueryAttributeSupport; 157VdpVideoMixerQueryAttributeValueRange vlVdpVideoMixerQueryAttributeValueRange; 158VdpVideoSurfaceCreate vlVdpVideoSurfaceCreate; 159VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy; 160VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters; 161VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr; 162VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr; 163 164#endif // VDPAU_PRIVATE_H