diff options
author | Christian König <[email protected]> | 2011-07-12 11:08:12 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-07-12 11:08:12 +0200 |
commit | 5e5d7acc2f93ddad8212b00c845dbd6381ee4119 (patch) | |
tree | 1098e38c8722fad83b5962d6e54e20b2fd917264 /src/gallium/state_trackers/va | |
parent | efc7fda4627919b5355952d955ee4a2c98505e56 (diff) |
vaapi: cleanup the source and let the st at least compile again
Diffstat (limited to 'src/gallium/state_trackers/va')
-rw-r--r-- | src/gallium/state_trackers/va/ftab.c | 194 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/htab.c | 22 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_buffer.c | 76 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_config.c | 136 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_context.c | 109 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_display.c | 45 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_image.c | 175 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_picture.c | 35 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_private.h | 19 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_subpicture.c | 148 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_surface.c | 169 |
11 files changed, 517 insertions, 611 deletions
diff --git a/src/gallium/state_trackers/va/ftab.c b/src/gallium/state_trackers/va/ftab.c index 999287e7a7e..dc9513e2d7c 100644 --- a/src/gallium/state_trackers/va/ftab.c +++ b/src/gallium/state_trackers/va/ftab.c @@ -26,111 +26,111 @@ **************************************************************************/ #include <assert.h> + #include <va/va.h> #include <va/va_backend.h> -#include "va_private.h" -struct VADriverVTable vlVaGetVtable(); +#include "va_private.h" static struct VADriverVTable vtable = { - &vlVaTerminate, /* VAStatus (*vaTerminate) ( VADriverContextP ctx ); */ - &vlVaQueryConfigProfiles, /* VAStatus (*vaQueryConfigProfiles) ( VADriverContextP ctx, VAProfile *profile_list,int *num_profiles); */ - &vlVaQueryConfigEntrypoints, /* VAStatus (*vaQueryConfigEntrypoints) ( VADriverContextP ctx, VAProfile profile, VAEntrypoint *entrypoint_list, int *num_entrypoints ); */ - &vlVaGetConfigAttributes, /* VAStatus (*vaGetConfigAttributes) ( VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs ); */ - &vlVaCreateConfig, /* VAStatus (*vaCreateConfig) ( VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id); */ - &vlVaDestroyConfig, /* VAStatus (*vaDestroyConfig) ( VADriverContextP ctx, VAConfigID config_id); */ - &vlVaQueryConfigAttributes, /* VAStatus (*vaQueryConfigAttributes) ( VADriverContextP ctx, VAConfigID config_id, VAProfile *profile, VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs); */ - &vlVaCreateSurfaces, /* VAStatus (*vaCreateSurfaces) ( VADriverContextP ctx,int width,int height,int format,int num_surfaces,VASurfaceID *surfaces); */ - &vlVaDestroySurfaces, /* VAStatus (*vaDestroySurfaces) ( VADriverContextP ctx, VASurfaceID *surface_list, int num_surfaces ); */ - &vlVaCreateContext, /* VAStatus (*vaCreateContext) (VADriverContextP ctx,VAConfigID config_id,int picture_width,int picture_height,int flag,VASurfaceID *render_targets,int num_render_targets,VAContextID *context); */ - &vlVaDestroyContext, /* VAStatus (*vaDestroyContext) (VADriverContextP ctx,VAContextID context); */ - &vlVaCreateBuffer, /* VAStatus (*vaCreateBuffer) (VADriverContextP ctx,VAContextID context,VABufferType type,unsigned int size,unsigned int num_elements,void *data,VABufferID *buf_id); */ - &vlVaBufferSetNumElements, /* VAStatus (*vaBufferSetNumElements) (VADriverContextP ctx,VABufferID buf_id,unsigned int num_elements); */ - &vlVaMapBuffer, /* VAStatus (*vaMapBuffer) (VADriverContextP ctx,VABufferID buf_id,void **pbuf); */ - &vlVaUnmapBuffer, /* VAStatus (*vaUnmapBuffer) (VADriverContextP ctx,VABufferID buf_id); */ - &vlVaDestroyBuffer, /* VAStatus (*vaDestroyBuffer) (VADriverContextP ctx,VABufferID buffer_id); */ - &vlVaBeginPicture, /* VAStatus (*vaBeginPicture) (VADriverContextP ctx,VAContextID context,VASurfaceID render_target); */ - &vlVaRenderPicture, /* VAStatus (*vaRenderPicture) (VADriverContextP ctx,VAContextID context,VABufferID *buffers,int num_buffers); */ - &vlVaEndPicture, /* VAStatus (*vaEndPicture) (VADriverContextP ctx,VAContextID context); */ - &vlVaSyncSurface, /* VAStatus (*vaSyncSurface) (VADriverContextP ctx,VASurfaceID render_target); */ - &vlVaQuerySurfaceStatus, /* VAStatus (*vaQuerySurfaceStatus) (VADriverContextP ctx,VASurfaceID render_target,VASurfaceStatus *status); */ - &vlVaPutSurface, /* VAStatus (*vaPutSurface) ( - VADriverContextP ctx, - VASurfaceID surface, - void* draw, - short srcx, - short srcy, - unsigned short srcw, - unsigned short srch, - short destx, - short desty, - unsigned short destw, - unsigned short desth, - VARectangle *cliprects, - unsigned int number_cliprects, - unsigned int flags); */ - &vlVaQueryImageFormats, /* VAStatus (*vaQueryImageFormats) ( VADriverContextP ctx, VAImageFormat *format_list,int *num_formats); */ - &vlVaCreateImage, /* VAStatus (*vaCreateImage) (VADriverContextP ctx,VAImageFormat *format,int width,int height,VAImage *image); */ - &vlVaDeriveImage, /* VAStatus (*vaDeriveImage) (VADriverContextP ctx,VASurfaceID surface,VAImage *image); */ - &vlVaDestroyImage, /* VAStatus (*vaDestroyImage) (VADriverContextP ctx,VAImageID image); */ - &vlVaSetImagePalette, /* VAStatus (*vaSetImagePalette) (VADriverContextP ctx,VAImageID image, unsigned char *palette); */ - &vlVaGetImage, /* VAStatus (*vaGetImage) (VADriverContextP ctx,VASurfaceID surface,int x,int y,unsigned int width,unsigned int height,VAImageID image); */ - &vlVaPutImage, /* VAStatus (*vaPutImage) ( - VADriverContextP ctx, - VASurfaceID surface, - VAImageID image, - int src_x, - int src_y, - unsigned int src_width, - unsigned int src_height, - int dest_x, - int dest_y, - unsigned int dest_width, - unsigned int dest_height - ); */ - &vlVaQuerySubpictureFormats, /* VAStatus (*vaQuerySubpictureFormats) (VADriverContextP ctx,VAImageFormat *format_list,unsigned int *flags,unsigned int *num_formats); */ - &vlVaCreateSubpicture, /* VAStatus (*vaCreateSubpicture) (VADriverContextP ctx,VAImageID image,VASubpictureID *subpicture); */ - &vlVaDestroySubpicture, /* VAStatus (*vaDestroySubpicture) (VADriverContextP ctx,VASubpictureID subpicture); */ - &vlVaSubpictureImage, /* VAStatus (*vaSetSubpictureImage) (VADriverContextP ctx,VASubpictureID subpicture,VAImageID image); */ - &vlVaSetSubpictureChromakey, /* VAStatus (*vaSetSubpictureChromakey) (VADriverContextP ctx,VASubpictureID subpicture,unsigned int chromakey_min,unsigned int chromakey_max,unsigned int chromakey_mask); */ - &vlVaSetSubpictureGlobalAlpha, /* VAStatus (*vaSetSubpictureGlobalAlpha) (VADriverContextP ctx,VASubpictureID subpicture,float global_alpha); */ - &vlVaAssociateSubpicture, /* VAStatus (*vaAssociateSubpicture) ( - VADriverContextP ctx, - VASubpictureID subpicture, - VASurfaceID *target_surfaces, - int num_surfaces, - short src_x, - short src_y, - unsigned short src_width, - unsigned short src_height, - short dest_x, - short dest_y, - unsigned short dest_width, - unsigned short dest_height, - unsigned int flags); */ - &vlVaDeassociateSubpicture, /* VAStatus (*vaDeassociateSubpicture) (VADriverContextP ctx,VASubpictureID subpicture,VASurfaceID *target_surfaces,int num_surfaces); */ - &vlVaQueryDisplayAttributes, /* VAStatus (*vaQueryDisplayAttributes) (VADriverContextP ctx,VADisplayAttribute *attr_list,int *num_attributes); */ - &vlVaGetDisplayAttributes, /* VAStatus (*vaGetDisplayAttributes) (VADriverContextP ctx,VADisplayAttribute *attr_list,int num_attributes); */ - &vlVaSetDisplayAttributes, /* VAStatus (*vaSetDisplayAttributes) (VADriverContextP ctx,VADisplayAttribute *attr_list,int num_attributes); */ - &vlVaBufferInfo, /* VAStatus (*vaBufferInfo) (VADriverContextP ctx,VAContextID context,VABufferID buf_id,VABufferType *type,unsigned int *size,unsigned int *num_elements); */ - &vlVaLockSurface, /* VAStatus (*vaLockSurface) ( - VADriverContextP ctx, - VASurfaceID surface, - unsigned int *fourcc, - unsigned int *luma_stride, - unsigned int *chroma_u_stride, - unsigned int *chroma_v_stride, - unsigned int *luma_offset, - unsigned int *chroma_u_offset, - unsigned int *chroma_v_offset, - unsigned int *buffer_name, - void **buffer); */ - &vlVaUnlockSurface, /* VAStatus (*vaUnlockSurface) (VADriverContextP ctx,VASurfaceID surface); */ - NULL /* struct VADriverVTableGLX *glx; "Optional" */ + &vlVaTerminate, /* VAStatus (*vaTerminate) ( VADriverContextP ctx ); */ + &vlVaQueryConfigProfiles, /* VAStatus (*vaQueryConfigProfiles) ( VADriverContextP ctx, VAProfile *profile_list,int *num_profiles); */ + &vlVaQueryConfigEntrypoints, /* VAStatus (*vaQueryConfigEntrypoints) ( VADriverContextP ctx, VAProfile profile, VAEntrypoint *entrypoint_list, int *num_entrypoints ); */ + &vlVaGetConfigAttributes, /* VAStatus (*vaGetConfigAttributes) ( VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs ); */ + &vlVaCreateConfig, /* VAStatus (*vaCreateConfig) ( VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id); */ + &vlVaDestroyConfig, /* VAStatus (*vaDestroyConfig) ( VADriverContextP ctx, VAConfigID config_id); */ + &vlVaQueryConfigAttributes, /* VAStatus (*vaQueryConfigAttributes) ( VADriverContextP ctx, VAConfigID config_id, VAProfile *profile, VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs); */ + &vlVaCreateSurfaces, /* VAStatus (*vaCreateSurfaces) ( VADriverContextP ctx,int width,int height,int format,int num_surfaces,VASurfaceID *surfaces); */ + &vlVaDestroySurfaces, /* VAStatus (*vaDestroySurfaces) ( VADriverContextP ctx, VASurfaceID *surface_list, int num_surfaces ); */ + &vlVaCreateContext, /* VAStatus (*vaCreateContext) (VADriverContextP ctx,VAConfigID config_id,int picture_width,int picture_height,int flag,VASurfaceID *render_targets,int num_render_targets,VAContextID *context); */ + &vlVaDestroyContext, /* VAStatus (*vaDestroyContext) (VADriverContextP ctx,VAContextID context); */ + &vlVaCreateBuffer, /* VAStatus (*vaCreateBuffer) (VADriverContextP ctx,VAContextID context,VABufferType type,unsigned int size,unsigned int num_elements,void *data,VABufferID *buf_id); */ + &vlVaBufferSetNumElements, /* VAStatus (*vaBufferSetNumElements) (VADriverContextP ctx,VABufferID buf_id,unsigned int num_elements); */ + &vlVaMapBuffer, /* VAStatus (*vaMapBuffer) (VADriverContextP ctx,VABufferID buf_id,void **pbuf); */ + &vlVaUnmapBuffer, /* VAStatus (*vaUnmapBuffer) (VADriverContextP ctx,VABufferID buf_id); */ + &vlVaDestroyBuffer, /* VAStatus (*vaDestroyBuffer) (VADriverContextP ctx,VABufferID buffer_id); */ + &vlVaBeginPicture, /* VAStatus (*vaBeginPicture) (VADriverContextP ctx,VAContextID context,VASurfaceID render_target); */ + &vlVaRenderPicture, /* VAStatus (*vaRenderPicture) (VADriverContextP ctx,VAContextID context,VABufferID *buffers,int num_buffers); */ + &vlVaEndPicture, /* VAStatus (*vaEndPicture) (VADriverContextP ctx,VAContextID context); */ + &vlVaSyncSurface, /* VAStatus (*vaSyncSurface) (VADriverContextP ctx,VASurfaceID render_target); */ + &vlVaQuerySurfaceStatus, /* VAStatus (*vaQuerySurfaceStatus) (VADriverContextP ctx,VASurfaceID render_target,VASurfaceStatus *status); */ + &vlVaPutSurface, /* VAStatus (*vaPutSurface) ( + VADriverContextP ctx, + VASurfaceID surface, + void* draw, + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + VARectangle *cliprects, + unsigned int number_cliprects, + unsigned int flags); */ + &vlVaQueryImageFormats, /* VAStatus (*vaQueryImageFormats) ( VADriverContextP ctx, VAImageFormat *format_list,int *num_formats); */ + &vlVaCreateImage, /* VAStatus (*vaCreateImage) (VADriverContextP ctx,VAImageFormat *format,int width,int height,VAImage *image); */ + &vlVaDeriveImage, /* VAStatus (*vaDeriveImage) (VADriverContextP ctx,VASurfaceID surface,VAImage *image); */ + &vlVaDestroyImage, /* VAStatus (*vaDestroyImage) (VADriverContextP ctx,VAImageID image); */ + &vlVaSetImagePalette, /* VAStatus (*vaSetImagePalette) (VADriverContextP ctx,VAImageID image, unsigned char *palette); */ + &vlVaGetImage, /* VAStatus (*vaGetImage) (VADriverContextP ctx,VASurfaceID surface,int x,int y,unsigned int width,unsigned int height,VAImageID image); */ + &vlVaPutImage, /* VAStatus (*vaPutImage) ( + VADriverContextP ctx, + VASurfaceID surface, + VAImageID image, + int src_x, + int src_y, + unsigned int src_width, + unsigned int src_height, + int dest_x, + int dest_y, + unsigned int dest_width, + unsigned int dest_height + ); */ + &vlVaQuerySubpictureFormats, /* VAStatus (*vaQuerySubpictureFormats) (VADriverContextP ctx,VAImageFormat *format_list,unsigned int *flags,unsigned int *num_formats); */ + &vlVaCreateSubpicture, /* VAStatus (*vaCreateSubpicture) (VADriverContextP ctx,VAImageID image,VASubpictureID *subpicture); */ + &vlVaDestroySubpicture, /* VAStatus (*vaDestroySubpicture) (VADriverContextP ctx,VASubpictureID subpicture); */ + &vlVaSubpictureImage, /* VAStatus (*vaSetSubpictureImage) (VADriverContextP ctx,VASubpictureID subpicture,VAImageID image); */ + &vlVaSetSubpictureChromakey, /* VAStatus (*vaSetSubpictureChromakey) (VADriverContextP ctx,VASubpictureID subpicture,unsigned int chromakey_min,unsigned int chromakey_max,unsigned int chromakey_mask); */ + &vlVaSetSubpictureGlobalAlpha, /* VAStatus (*vaSetSubpictureGlobalAlpha) (VADriverContextP ctx,VASubpictureID subpicture,float global_alpha); */ + &vlVaAssociateSubpicture, /* VAStatus (*vaAssociateSubpicture) ( + VADriverContextP ctx, + VASubpictureID subpicture, + VASurfaceID *target_surfaces, + int num_surfaces, + short src_x, + short src_y, + unsigned short src_width, + unsigned short src_height, + short dest_x, + short dest_y, + unsigned short dest_width, + unsigned short dest_height, + unsigned int flags); */ + &vlVaDeassociateSubpicture, /* VAStatus (*vaDeassociateSubpicture) (VADriverContextP ctx,VASubpictureID subpicture,VASurfaceID *target_surfaces,int num_surfaces); */ + &vlVaQueryDisplayAttributes, /* VAStatus (*vaQueryDisplayAttributes) (VADriverContextP ctx,VADisplayAttribute *attr_list,int *num_attributes); */ + &vlVaGetDisplayAttributes, /* VAStatus (*vaGetDisplayAttributes) (VADriverContextP ctx,VADisplayAttribute *attr_list,int num_attributes); */ + &vlVaSetDisplayAttributes, /* VAStatus (*vaSetDisplayAttributes) (VADriverContextP ctx,VADisplayAttribute *attr_list,int num_attributes); */ + &vlVaBufferInfo, /* VAStatus (*vaBufferInfo) (VADriverContextP ctx,VAContextID context,VABufferID buf_id,VABufferType *type,unsigned int *size,unsigned int *num_elements); */ + &vlVaLockSurface, /* VAStatus (*vaLockSurface) ( + VADriverContextP ctx, + VASurfaceID surface, + unsigned int *fourcc, + unsigned int *luma_stride, + unsigned int *chroma_u_stride, + unsigned int *chroma_v_stride, + unsigned int *luma_offset, + unsigned int *chroma_u_offset, + unsigned int *chroma_v_offset, + unsigned int *buffer_name, + void **buffer); */ + &vlVaUnlockSurface, /* VAStatus (*vaUnlockSurface) (VADriverContextP ctx,VASurfaceID surface); */ + NULL /* struct VADriverVTableGLX *glx; "Optional" */ }; struct VADriverVTable vlVaGetVtable() { - return vtable; + return vtable; } diff --git a/src/gallium/state_trackers/va/htab.c b/src/gallium/state_trackers/va/htab.c index 2187507c6a4..40b9edac819 100644 --- a/src/gallium/state_trackers/va/htab.c +++ b/src/gallium/state_trackers/va/htab.c @@ -27,24 +27,20 @@ #include <util/u_handle_table.h> #include <os/os_thread.h> -#include "va_private.h" -boolean vlCreateHTAB(void); -void vlDestroyHTAB(void); -vlHandle vlAddDataHTAB(void *data); -void* vlGetDataHTAB(vlHandle handle); +#include "va_private.h" #ifdef VL_HANDLES static struct handle_table *htab = NULL; pipe_static_mutex(htab_lock); #endif -boolean vlCreateHTAB(void) +bool vlCreateHTAB(void) { #ifdef VL_HANDLES - boolean ret; - /* Make sure handle table handles match VDPAU handles. */ - assert(sizeof(unsigned) <= sizeof(vlHandle)); + bool ret; + /* Make sure handle table handles match VAAPI handles. */ + assert(sizeof(unsigned) <= sizeof(VAGenericID)); pipe_mutex_lock(htab_lock); if (!htab) htab = handle_table_create(); @@ -68,22 +64,22 @@ void vlDestroyHTAB(void) #endif } -vlHandle vlAddDataHTAB(void *data) +VAGenericID vlAddDataHTAB(void *data) { assert(data); #ifdef VL_HANDLES - vlHandle handle = 0; + VAGenericID handle = 0; pipe_mutex_lock(htab_lock); if (htab) handle = handle_table_add(htab, data); pipe_mutex_unlock(htab_lock); return handle; #else - return (vlHandle)data; + return (VAGenericID)data; #endif } -void* vlGetDataHTAB(vlHandle handle) +void* vlGetDataHTAB(VAGenericID handle) { assert(handle); #ifdef VL_HANDLES diff --git a/src/gallium/state_trackers/va/va_buffer.c b/src/gallium/state_trackers/va/va_buffer.c index 7608a4264ff..d14e06d69e4 100644 --- a/src/gallium/state_trackers/va/va_buffer.c +++ b/src/gallium/state_trackers/va/va_buffer.c @@ -27,70 +27,62 @@ #include <va/va.h> #include <va/va_backend.h> -#include "va_private.h" +#include "va_private.h" -VAStatus vlVaCreateBuffer( VADriverContextP ctx, - VAContextID context, - VABufferType type, - unsigned int size, - unsigned int num_elements, - void *data, - VABufferID *buf_id) +VAStatus +vlVaCreateBuffer(VADriverContextP ctx, VAContextID context, VABufferType type, + unsigned int size, unsigned int num_elements, void *data, + VABufferID *buf_id) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaBufferSetNumElements( VADriverContextP ctx, - VABufferID buf_id, - unsigned int num_elements) +VAStatus +vlVaBufferSetNumElements(VADriverContextP ctx, VABufferID buf_id, unsigned int num_elements) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaMapBuffer( VADriverContextP ctx, - VABufferID buf_id, - void **pbuff) +VAStatus +vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaUnmapBuffer( VADriverContextP ctx, - VABufferID buf_id) +VAStatus +vlVaUnmapBuffer(VADriverContextP ctx, VABufferID buf_id) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaDestroyBuffer( VADriverContextP ctx, - VABufferID buffer_id) +VAStatus +vlVaDestroyBuffer(VADriverContextP ctx, VABufferID buffer_id) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaBufferInfo( VADriverContextP ctx, - VAContextID context, - VABufferID buf_id, - VABufferType *type, - unsigned int *size, - unsigned int *num_elements) +VAStatus +vlVaBufferInfo(VADriverContextP ctx, VAContextID context, VABufferID buf_id, + VABufferType *type, unsigned int *size, unsigned int *num_elements) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } diff --git a/src/gallium/state_trackers/va/va_config.c b/src/gallium/state_trackers/va/va_config.c index 1589abf7cfa..6f1cb78bb53 100644 --- a/src/gallium/state_trackers/va/va_config.c +++ b/src/gallium/state_trackers/va/va_config.c @@ -27,105 +27,95 @@ #include <va/va.h> #include <va/va_backend.h> + #include <util/u_debug.h> + #include "va_private.h" -VAStatus vlVaQueryConfigProfiles( VADriverContextP ctx, - VAProfile *profile_list, - int *num_profiles) +VAStatus +vlVaQueryConfigProfiles(VADriverContextP ctx, VAProfile *profile_list, int *num_profiles) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - int i = 0; + int i = 0; - profile_list[i++] = VAProfileMPEG2Simple; - *num_profiles = i; + profile_list[i++] = VAProfileMPEG2Simple; + *num_profiles = i; - return VA_STATUS_SUCCESS; + return VA_STATUS_SUCCESS; } -VAStatus vlVaQueryConfigEntrypoints( VADriverContextP ctx, - VAProfile profile, - VAEntrypoint *entrypoint_list, - int *num_entrypoints) +VAStatus +vlVaQueryConfigEntrypoints(VADriverContextP ctx, VAProfile profile, + VAEntrypoint *entrypoint_list, int *num_entrypoints) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - VAStatus vaStatus = VA_STATUS_SUCCESS; - - switch (profile) { - case VAProfileMPEG2Simple: - case VAProfileMPEG2Main: - VA_INFO("Using profile %08x\n",profile); - *num_entrypoints = 1; - entrypoint_list[0] = VAEntrypointMoComp; - break; - - case VAProfileH264Baseline: - case VAProfileH264Main: - case VAProfileH264High: - vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE; - *num_entrypoints = 0; - break; - - default: - VA_ERROR("Unsupported profile %08x\n",profile); - vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE; - *num_entrypoints = 0; - break; - } - - return vaStatus; + VAStatus vaStatus = VA_STATUS_SUCCESS; + + switch (profile) { + case VAProfileMPEG2Simple: + case VAProfileMPEG2Main: + VA_INFO("Using profile %08x\n",profile); + entrypoint_list[0] = VAEntrypointMoComp; + *num_entrypoints = 1; + break; + + case VAProfileH264Baseline: + case VAProfileH264Main: + case VAProfileH264High: + vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE; + *num_entrypoints = 0; + break; + + default: + VA_ERROR("Unsupported profile %08x\n",profile); + vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE; + *num_entrypoints = 0; + break; + } + + return vaStatus; } - -VAStatus vlVaGetConfigAttributes( VADriverContextP ctx, - VAProfile profile, - VAEntrypoint entrypoint, - VAConfigAttrib *attrib_list, - int num_attribs) +VAStatus +vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, + VAConfigAttrib *attrib_list, int num_attribs) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaCreateConfig( VADriverContextP ctx, - VAProfile profile, - VAEntrypoint entrypoint, - VAConfigAttrib *attrib_list, - int num_attribs, - VAConfigID *config_id) +VAStatus +vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, + VAConfigAttrib *attrib_list, int num_attribs, VAConfigID *config_id) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaDestroyConfig( VADriverContextP ctx, - VAConfigID config_id) +VAStatus +vlVaDestroyConfig(VADriverContextP ctx, VAConfigID config_id) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaQueryConfigAttributes( VADriverContextP ctx, - VAConfigID config_id, - VAProfile *profile, - VAEntrypoint *entrypoint, - VAConfigAttrib *attrib_list, - int *num_attribs) +VAStatus +vlVaQueryConfigAttributes(VADriverContextP ctx, VAConfigID config_id, VAProfile *profile, + VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } - diff --git a/src/gallium/state_trackers/va/va_context.c b/src/gallium/state_trackers/va/va_context.c index cdb20cc0eb2..62ba3d24ae3 100644 --- a/src/gallium/state_trackers/va/va_context.c +++ b/src/gallium/state_trackers/va/va_context.c @@ -25,83 +25,82 @@ * **************************************************************************/ -#include <pipe/p_compiler.h> -#include <pipe/p_video_context.h> +#include <va/va.h> +#include <va/va_backend.h> + #include <pipe/p_screen.h> -#include <vl_winsys.h> +#include <pipe/p_screen.h> +#include <pipe/p_video_decoder.h> + #include <util/u_debug.h> #include <util/u_memory.h> -#include <va/va.h> -#include <va/va_backend.h> -#include "va_private.h" -//struct VADriverVTable vlVaGetVtable(); +#include <vl_winsys.h> + +#include "va_private.h" -PUBLIC -VAStatus __vaDriverInit_0_31 (VADriverContextP ctx) +PUBLIC VAStatus +__vaDriverInit_0_31(VADriverContextP ctx) { - vlVaDriverContextPriv *driver_context = NULL; + vlVaDriverContextPriv *driver_context = NULL; - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - /* Create private driver context */ - driver_context = CALLOC(1,sizeof(vlVaDriverContextPriv)); - if (!driver_context) - return VA_STATUS_ERROR_ALLOCATION_FAILED; + /* Create private driver context */ + driver_context = CALLOC(1,sizeof(vlVaDriverContextPriv)); + if (!driver_context) + return VA_STATUS_ERROR_ALLOCATION_FAILED; - driver_context->vscreen = vl_screen_create(ctx->native_dpy, ctx->x11_screen); - if (!driver_context->vscreen) - { - FREE(driver_context); - return VA_STATUS_ERROR_ALLOCATION_FAILED; - } + driver_context->vscreen = vl_screen_create(ctx->native_dpy, ctx->x11_screen); + if (!driver_context->vscreen) { + FREE(driver_context); + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } - ctx->str_vendor = "mesa gallium vaapi"; - ctx->vtable = vlVaGetVtable(); - ctx->max_attributes = 1; - ctx->max_display_attributes = 1; - ctx->max_entrypoints = VA_MAX_ENTRYPOINTS; - ctx->max_image_formats = VA_MAX_IMAGE_FORMATS_SUPPORTED; - ctx->max_profiles = 1; - ctx->max_subpic_formats = VA_MAX_SUBPIC_FORMATS_SUPPORTED; - ctx->version_major = 3; - ctx->version_minor = 1; - ctx->pDriverData = (void *)driver_context; + ctx->str_vendor = "mesa gallium vaapi"; + ctx->vtable = vlVaGetVtable(); + ctx->max_attributes = 1; + ctx->max_display_attributes = 1; + ctx->max_entrypoints = VA_MAX_ENTRYPOINTS; + ctx->max_image_formats = VA_MAX_IMAGE_FORMATS_SUPPORTED; + ctx->max_profiles = 1; + ctx->max_subpic_formats = VA_MAX_SUBPIC_FORMATS_SUPPORTED; + ctx->version_major = 3; + ctx->version_minor = 1; + ctx->pDriverData = (void *)driver_context; - VA_INFO("vl_screen_pointer %p\n",ctx->native_dpy); + VA_INFO("vl_screen_pointer %p\n",ctx->native_dpy); - return VA_STATUS_SUCCESS; + return VA_STATUS_SUCCESS; } -VAStatus vlVaCreateContext( VADriverContextP ctx, - VAConfigID config_id, - int picture_width, - int picture_height, - int flag, - VASurfaceID *render_targets, - int num_render_targets, - VAContextID *conext) +VAStatus +vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, + int picture_height, int flag, VASurfaceID *render_targets, + int num_render_targets, VAContextID *conext) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaDestroyContext( VADriverContextP ctx, - VAContextID context) +VAStatus +vlVaDestroyContext(VADriverContextP ctx, VAContextID context) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaTerminate( VADriverContextP ctx) +VAStatus +vlVaTerminate(VADriverContextP ctx) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; + + return VA_STATUS_ERROR_UNIMPLEMENTED; } diff --git a/src/gallium/state_trackers/va/va_display.c b/src/gallium/state_trackers/va/va_display.c index 1aaaf7ccc53..11116d0c00a 100644 --- a/src/gallium/state_trackers/va/va_display.c +++ b/src/gallium/state_trackers/va/va_display.c @@ -27,44 +27,37 @@ #include <va/va.h> #include <va/va_backend.h> + #include "va_private.h" - -VAStatus vlVaQueryDisplayAttributes( VADriverContextP ctx, - VADisplayAttribute *attr_list, - int *num_attributes) +VAStatus +vlVaQueryDisplayAttributes(VADriverContextP ctx, VADisplayAttribute *attr_list, int *num_attributes) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - if (!(attr_list && num_attributes)) - return VA_STATUS_ERROR_UNKNOWN; + if (!(attr_list && num_attributes)) + return VA_STATUS_ERROR_UNKNOWN; - *num_attributes = 0; + *num_attributes = 0; - return VA_STATUS_SUCCESS; + return VA_STATUS_SUCCESS; } -VAStatus vlVaGetDisplayAttributes( VADriverContextP ctx, - VADisplayAttribute *attr_list, - int num_attributes) +VAStatus +vlVaGetDisplayAttributes(VADriverContextP ctx, VADisplayAttribute *attr_list, int num_attributes) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; - + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaSetDisplayAttributes( VADriverContextP ctx, - VADisplayAttribute *attr_list, - int num_attributes) +VAStatus +vlVaSetDisplayAttributes(VADriverContextP ctx, VADisplayAttribute *attr_list, int num_attributes) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; - + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } - - diff --git a/src/gallium/state_trackers/va/va_image.c b/src/gallium/state_trackers/va/va_image.c index 8d20bfa9174..43c3a946737 100644 --- a/src/gallium/state_trackers/va/va_image.c +++ b/src/gallium/state_trackers/va/va_image.c @@ -25,154 +25,127 @@ * **************************************************************************/ +#include <va/va.h> +#include <va/va_backend.h> + +#include <pipe/p_format.h> + #include <util/u_memory.h> #include <util/u_format.h> #include <util/u_debug.h> -#include <pipe/p_format.h> -#include <va/va.h> -#include <va/va_backend.h> + #include "va_private.h" typedef struct { - enum pipe_format pipe_format; - VAImageFormat va_format; + enum pipe_format pipe_format; + VAImageFormat va_format; } va_image_formats_supported_t; static const va_image_formats_supported_t va_image_formats_supported[VA_MAX_IMAGE_FORMATS_SUPPORTED] = { - { PIPE_FORMAT_B8G8R8A8_UNORM, + { PIPE_FORMAT_B8G8R8A8_UNORM, { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }}, - { PIPE_FORMAT_R8G8B8A8_UNORM, - { VA_FOURCC_RGBA, VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }} + { PIPE_FORMAT_R8G8B8A8_UNORM, + { VA_FOURCC_RGBA, VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }} }; -boolean vlCreateHTAB(void); -void vlDestroyHTAB(void); -vlHandle vlAddDataHTAB(void *data); -void* vlGetDataHTAB(vlHandle handle); - VAStatus -vlVaQueryImageFormats ( VADriverContextP ctx, - VAImageFormat *format_list, - int *num_formats) +vlVaQueryImageFormats(VADriverContextP ctx, VAImageFormat *format_list, int *num_formats) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - if (!(format_list && num_formats)) - return VA_STATUS_ERROR_UNKNOWN; + if (!(format_list && num_formats)) + return VA_STATUS_ERROR_UNKNOWN; - int n = 0; + int n = 0; - num_formats[0] = VA_MAX_IMAGE_FORMATS_SUPPORTED; + num_formats[0] = VA_MAX_IMAGE_FORMATS_SUPPORTED; - /* Query supported formats */ - for (n = 0; n < VA_MAX_IMAGE_FORMATS_SUPPORTED; n++) - { - format_list[n] = va_image_formats_supported[n].va_format; - } + /* Query supported formats */ + for (n = 0; n < VA_MAX_IMAGE_FORMATS_SUPPORTED; n++) { + format_list[n] = va_image_formats_supported[n].va_format; + } - return VA_STATUS_SUCCESS; + return VA_STATUS_SUCCESS; } -VAStatus vlVaCreateImage( VADriverContextP ctx, - VAImageFormat *format, - int width, - int height, - VAImage *image) +VAStatus +vlVaCreateImage(VADriverContextP ctx, VAImageFormat *format, int width, int height, VAImage *image) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - if(!format) - return VA_STATUS_ERROR_UNKNOWN; + if(!format) + return VA_STATUS_ERROR_UNKNOWN; - if (!(width && height)) - return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; + if (!(width && height)) + return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; - if (!vlCreateHTAB()) - return VA_STATUS_ERROR_UNKNOWN; + if (!vlCreateHTAB()) + return VA_STATUS_ERROR_UNKNOWN; - switch (format->fourcc) { - case VA_FOURCC('B','G','R','A'): - VA_INFO("Creating BGRA image of size %dx%d\n",width,height); - break; - case VA_FOURCC_RGBA: - VA_INFO("Creating RGBA image of size %dx%d\n",width,height); - break; - default: - VA_ERROR("Couldn't create image of type %0x08\n",format->fourcc); - return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT; - break; - } + switch (format->fourcc) { + case VA_FOURCC('B','G','R','A'): + VA_INFO("Creating BGRA image of size %dx%d\n",width,height); + break; + case VA_FOURCC_RGBA: + VA_INFO("Creating RGBA image of size %dx%d\n",width,height); + break; + default: + VA_ERROR("Couldn't create image of type %0x08\n",format->fourcc); + return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT; + } - VA_INFO("Image %p created successfully\n",format); + VA_INFO("Image %p created successfully\n",format); - return VA_STATUS_SUCCESS; + return VA_STATUS_SUCCESS; } -VAStatus vlVaDeriveImage( VADriverContextP ctx, - VASurfaceID surface, - VAImage *image) +VAStatus +vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; - + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaDestroyImage( VADriverContextP ctx, - VAImageID image) +VAStatus +vlVaDestroyImage(VADriverContextP ctx, VAImageID image) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaSetImagePalette( VADriverContextP ctx, - VAImageID image, - unsigned char *palette) +VAStatus +vlVaSetImagePalette(VADriverContextP ctx, VAImageID image, unsigned char *palette) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaGetImage( VADriverContextP ctx, - VASurfaceID surface, - int x, - int y, - unsigned int width, - unsigned int height, - VAImageID image) +VAStatus +vlVaGetImage(VADriverContextP ctx, VASurfaceID surface, int x, int y, + unsigned int width, unsigned int height, VAImageID image) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; - + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaPutImage( VADriverContextP ctx, - VASurfaceID surface, - VAImageID image, - int src_x, - int src_y, - unsigned int src_width, - unsigned int src_height, - int dest_x, - int dest_y, - unsigned int dest_width, - unsigned int dest_height) +VAStatus +vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image, + int src_x, int src_y, unsigned int src_width, unsigned int src_height, + int dest_x, int dest_y, unsigned int dest_width, unsigned int dest_height) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; - + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } diff --git a/src/gallium/state_trackers/va/va_picture.c b/src/gallium/state_trackers/va/va_picture.c index 3603dfb6fed..3b52a6a7e10 100644 --- a/src/gallium/state_trackers/va/va_picture.c +++ b/src/gallium/state_trackers/va/va_picture.c @@ -27,35 +27,34 @@ #include <va/va.h> #include <va/va_backend.h> + #include <util/u_debug.h> + #include "va_private.h" -VAStatus vlVaBeginPicture( VADriverContextP ctx, - VAContextID context, - VASurfaceID render_target) +VAStatus +vlVaBeginPicture(VADriverContextP ctx, VAContextID context, VASurfaceID render_target) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaRenderPicture( VADriverContextP ctx, - VAContextID context, - VABufferID *buffers, - int num_buffers) +VAStatus +vlVaRenderPicture(VADriverContextP ctx, VAContextID context, VABufferID *buffers, int num_buffers) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaEndPicture( VADriverContextP ctx, - VAContextID context) +VAStatus +vlVaEndPicture(VADriverContextP ctx, VAContextID context) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h index 625c6cdbe1b..f1023dbf87b 100644 --- a/src/gallium/state_trackers/va/va_private.h +++ b/src/gallium/state_trackers/va/va_private.h @@ -30,6 +30,7 @@ #include <va/va.h> #include <va/va_backend.h> + #include <pipe/p_format.h> #include <pipe/p_state.h> @@ -44,18 +45,16 @@ #define VL_HANDLES -typedef unsigned int vlHandle; - typedef struct { - struct vl_screen *vscreen; - struct pipe_surface *backbuffer; + struct vl_screen *vscreen; + struct pipe_surface *backbuffer; } vlVaDriverContextPriv; typedef struct { - unsigned int width; - unsigned int height; - enum pipe_video_chroma_format format; - VADriverContextP ctx; + unsigned int width; + unsigned int height; + enum pipe_video_chroma_format format; + VADriverContextP ctx; } vlVaSurfacePriv; // Public functions: @@ -64,6 +63,10 @@ VAStatus __vaDriverInit_0_31 (VADriverContextP ctx); // Private functions: struct VADriverVTable vlVaGetVtable(); +bool vlCreateHTAB(void); +void vlDestroyHTAB(void); +VAGenericID vlAddDataHTAB(void *data); +void* vlGetDataHTAB(VAGenericID handle); // Vtable functions: VAStatus vlVaTerminate (VADriverContextP ctx); diff --git a/src/gallium/state_trackers/va/va_subpicture.c b/src/gallium/state_trackers/va/va_subpicture.c index 910e5bd7b70..3f370e5889f 100644 --- a/src/gallium/state_trackers/va/va_subpicture.c +++ b/src/gallium/state_trackers/va/va_subpicture.c @@ -27,131 +27,117 @@ #include <va/va.h> #include <va/va_backend.h> + #include <pipe/p_format.h> -#include "va_private.h" +#include "va_private.h" typedef struct { - enum pipe_format pipe_format; - VAImageFormat va_format; - unsigned int va_flags; + enum pipe_format pipe_format; + VAImageFormat va_format; + unsigned int va_flags; } va_subpicture_formats_supported_t; static const va_subpicture_formats_supported_t va_subpicture_formats_supported[VA_MAX_SUBPIC_FORMATS_SUPPORTED + 1] = { - { PIPE_FORMAT_B8G8R8A8_UNORM, + { PIPE_FORMAT_B8G8R8A8_UNORM, { VA_FOURCC('B','G','R','A'), VA_LSB_FIRST, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, 0 }, - { PIPE_FORMAT_R8G8B8A8_UNORM, - { VA_FOURCC_RGBA, VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, + { PIPE_FORMAT_R8G8B8A8_UNORM, + { VA_FOURCC_RGBA, VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, 0 } }; VAStatus -vlVaQuerySubpictureFormats( VADriverContextP ctx, - VAImageFormat *format_list, - unsigned int *flags, - unsigned int *num_formats) +vlVaQuerySubpictureFormats(VADriverContextP ctx, VAImageFormat *format_list, + unsigned int *flags, unsigned int *num_formats) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - if (!(format_list && flags && num_formats)) - return VA_STATUS_ERROR_UNKNOWN; + if (!(format_list && flags && num_formats)) + return VA_STATUS_ERROR_UNKNOWN; - num_formats[0] = VA_MAX_SUBPIC_FORMATS_SUPPORTED; + num_formats[0] = VA_MAX_SUBPIC_FORMATS_SUPPORTED; - int n = 0; - /* Query supported formats */ - for (n = 0; n < VA_MAX_SUBPIC_FORMATS_SUPPORTED ; n++) - { - const va_subpicture_formats_supported_t * const format_map = &va_subpicture_formats_supported[n]; - flags[n] = format_map->va_flags; - format_list[n] = format_map->va_format; - } - - return VA_STATUS_SUCCESS; + int n = 0; + /* Query supported formats */ + for (n = 0; n < VA_MAX_SUBPIC_FORMATS_SUPPORTED ; n++) { + const va_subpicture_formats_supported_t * const format_map = &va_subpicture_formats_supported[n]; + flags[n] = format_map->va_flags; + format_list[n] = format_map->va_format; + } + + return VA_STATUS_SUCCESS; } - -VAStatus vlVaCreateSubpicture( VADriverContextP ctx, - VAImageID image, - VASubpictureID *subpicture) +VAStatus +vlVaCreateSubpicture(VADriverContextP ctx, VAImageID image, VASubpictureID *subpicture) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaDestroySubpicture( VADriverContextP ctx, - VASubpictureID subpicture) +VAStatus +vlVaDestroySubpicture(VADriverContextP ctx, VASubpictureID subpicture) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaSubpictureImage( VADriverContextP ctx, - VASubpictureID subpicture, - VAImageID image) +VAStatus +vlVaSubpictureImage(VADriverContextP ctx, VASubpictureID subpicture, VAImageID image) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaSetSubpictureChromakey( VADriverContextP ctx, - VASubpictureID subpicture, - unsigned int chromakey_min, - unsigned int chromakey_max, - unsigned int chromakey_mask) +VAStatus +vlVaSetSubpictureChromakey(VADriverContextP ctx, VASubpictureID subpicture, + unsigned int chromakey_min, unsigned int chromakey_max, unsigned int chromakey_mask) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaSetSubpictureGlobalAlpha( VADriverContextP ctx, - VASubpictureID subpicture, - float global_alpha) +VAStatus +vlVaSetSubpictureGlobalAlpha(VADriverContextP ctx, VASubpictureID subpicture, float global_alpha) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaAssociateSubpicture( VADriverContextP ctx, - VASubpictureID subpicture, - VASurfaceID *target_surfaces, - int num_surfaces, - short src_x, - short src_y, - unsigned short src_width, - unsigned short src_height, - short dest_x, - short dest_y, - unsigned short dest_width, - unsigned short dest_height, - unsigned int flags) +VAStatus +vlVaAssociateSubpicture(VADriverContextP ctx, VASubpictureID subpicture, VASurfaceID *target_surfaces, + int num_surfaces, short src_x, short src_y, + unsigned short src_width, unsigned short src_height, + short dest_x, short dest_y, + unsigned short dest_width, + unsigned short dest_height, + unsigned int flags) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaDeassociateSubpicture( VADriverContextP ctx, - VASubpictureID subpicture, - VASurfaceID *target_surfaces, - int num_surfaces) +VAStatus +vlVaDeassociateSubpicture(VADriverContextP ctx, VASubpictureID subpicture, + VASurfaceID *target_surfaces, int num_surfaces) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } diff --git a/src/gallium/state_trackers/va/va_surface.c b/src/gallium/state_trackers/va/va_surface.c index a86c806248a..b7f9732d248 100644 --- a/src/gallium/state_trackers/va/va_surface.c +++ b/src/gallium/state_trackers/va/va_surface.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian. + * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -31,137 +31,112 @@ #include <util/u_memory.h> #include "va_private.h" -boolean vlCreateHTAB(void); -void vlDestroyHTAB(void); -vlHandle vlAddDataHTAB(void *data); -void* vlGetDataHTAB(vlHandle handle); - -static enum pipe_video_chroma_format VaRTFormatToPipe(unsigned int va_type) +static enum pipe_video_chroma_format +VaRTFormatToPipe(unsigned int va_type) { switch (va_type) { - case VA_RT_FORMAT_YUV420: - return PIPE_VIDEO_CHROMA_FORMAT_420; - case VA_RT_FORMAT_YUV422: - return PIPE_VIDEO_CHROMA_FORMAT_422; - case VA_RT_FORMAT_YUV444: - return PIPE_VIDEO_CHROMA_FORMAT_444; - default: - assert(0); + case VA_RT_FORMAT_YUV420: + return PIPE_VIDEO_CHROMA_FORMAT_420; + case VA_RT_FORMAT_YUV422: + return PIPE_VIDEO_CHROMA_FORMAT_422; + case VA_RT_FORMAT_YUV444: + return PIPE_VIDEO_CHROMA_FORMAT_444; + default: + assert(0); } return -1; } -VAStatus vlVaCreateSurfaces( VADriverContextP ctx, - int width, - int height, - int format, - int num_surfaces, - VASurfaceID *surfaces) +VAStatus +vlVaCreateSurfaces(VADriverContextP ctx, int width, int height, int format, + int num_surfaces, VASurfaceID *surfaces) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - /* We only support one format */ - if (VA_RT_FORMAT_YUV420 != format) - return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT; + /* We only support one format */ + if (VA_RT_FORMAT_YUV420 != format) + return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT; - if (!(width && height)) - return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; + if (!(width && height)) + return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; - if (!vlCreateHTAB()) - return VA_STATUS_ERROR_UNKNOWN; + if (!vlCreateHTAB()) + return VA_STATUS_ERROR_UNKNOWN; - vlVaSurfacePriv *va_surface = (vlVaSurfacePriv *)CALLOC(num_surfaces,sizeof(vlVaSurfacePriv)); - if (!va_surface) - return VA_STATUS_ERROR_ALLOCATION_FAILED; + vlVaSurfacePriv *va_surface = (vlVaSurfacePriv *)CALLOC(num_surfaces,sizeof(vlVaSurfacePriv)); + if (!va_surface) + return VA_STATUS_ERROR_ALLOCATION_FAILED; - int n = 0; - for (n = 0; n < num_surfaces; n++) - { - va_surface[n].width = width; - va_surface[n].height = height; - va_surface[n].format = VaRTFormatToPipe(format); - va_surface[n].ctx = ctx; - surfaces[n] = (VASurfaceID *)vlAddDataHTAB((void *)(va_surface + n)); - } - - return VA_STATUS_SUCCESS; + int n = 0; + for (n = 0; n < num_surfaces; n++) { + va_surface[n].width = width; + va_surface[n].height = height; + va_surface[n].format = VaRTFormatToPipe(format); + va_surface[n].ctx = ctx; + surfaces[n] = vlAddDataHTAB((void *)(va_surface + n)); + } + + return VA_STATUS_SUCCESS; } -VAStatus vlVaDestroySurfaces( VADriverContextP ctx, - VASurfaceID *surface_list, - int num_surfaces) +VAStatus +vlVaDestroySurfaces(VADriverContextP ctx, VASurfaceID *surface_list, int num_surfaces) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaSyncSurface( VADriverContextP ctx, - VASurfaceID render_target) +VAStatus +vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaQuerySurfaceStatus( VADriverContextP ctx, - VASurfaceID render_target, - VASurfaceStatus *status) +VAStatus +vlVaQuerySurfaceStatus(VADriverContextP ctx, VASurfaceID render_target, VASurfaceStatus *status) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaPutSurface( VADriverContextP ctx, - VASurfaceID surface, - void* draw, - short srcx, - short srcy, - unsigned short srcw, - unsigned short srch, - short destx, - short desty, - unsigned short destw, - unsigned short desth, - VARectangle *cliprects, - unsigned int number_cliprects, - unsigned int flags) +VAStatus +vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface, void* draw, short srcx, short srcy, + unsigned short srcw, unsigned short srch, short destx, short desty, + unsigned short destw, unsigned short desth, VARectangle *cliprects, + unsigned int number_cliprects, unsigned int flags) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaLockSurface( VADriverContextP ctx, - VASurfaceID surface, - unsigned int *fourcc, - unsigned int *luma_stride, - unsigned int *chroma_u_stride, - unsigned int *chroma_v_stride, - unsigned int *luma_offset, - unsigned int *chroma_u_offset, - unsigned int *chroma_v_offset, - unsigned int *buffer_name, - void **buffer) +VAStatus +vlVaLockSurface(VADriverContextP ctx, VASurfaceID surface, unsigned int *fourcc, + unsigned int *luma_stride, unsigned int *chroma_u_stride, unsigned int *chroma_v_stride, + unsigned int *luma_offset, unsigned int *chroma_u_offset, unsigned int *chroma_v_offset, + unsigned int *buffer_name, void **buffer) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } -VAStatus vlVaUnlockSurface( VADriverContextP ctx, - VASurfaceID surface) +VAStatus +vlVaUnlockSurface(VADriverContextP ctx, VASurfaceID surface) { - if (!ctx) - return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!ctx) + return VA_STATUS_ERROR_INVALID_CONTEXT; - return VA_STATUS_ERROR_UNIMPLEMENTED; + return VA_STATUS_ERROR_UNIMPLEMENTED; } |