# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AC_PREREQ(2.57)
-AC_INIT([libva], 0.26, [waldo.bastian@intel.com], libva)
+AC_INIT([libva], 0.28, [waldo.bastian@intel.com], libva)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2])
-libva-dev_0.20-1_i386.deb libdevel extra
-libva1_0.20-1_i386.deb libs extra
+libva-dev_0.24-1_i386.deb libdevel extra
+libva1_0.24-1_i386.deb libs extra
return VA_STATUS_SUCCESS;
}
+VAStatus dummy_DeriveImage(
+ VADriverContextP ctx,
+ VASurfaceID surface,
+ VAImage *image /* out */
+)
+{
+ INIT_DRIVER_DATA
+
+ /* TODO */
+ return VA_STATUS_SUCCESS;
+}
+
VAStatus dummy_DestroyImage(
VADriverContextP ctx,
VAImageID image
return VA_STATUS_SUCCESS;
}
+VAStatus dummy_PutImage2(
+ 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
+)
+{
+ INIT_DRIVER_DATA
+
+ /* TODO */
+ return VA_STATUS_SUCCESS;
+}
+
VAStatus dummy_QuerySubpictureFormats(
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
return VA_STATUS_SUCCESS;
}
+VAStatus dummy_AssociateSubpicture2(
+ VADriverContextP ctx,
+ VASubpictureID subpicture,
+ VASurfaceID *target_surfaces,
+ int num_surfaces,
+ short src_x, /* upper left offset in subpicture */
+ short src_y,
+ unsigned short src_width,
+ unsigned short src_height,
+ short dest_x, /* upper left offset in surface */
+ short dest_y,
+ unsigned short dest_width,
+ unsigned short dest_height,
+ /*
+ * whether to enable chroma-keying or global-alpha
+ * see VA_SUBPICTURE_XXX values
+ */
+ unsigned int flags
+)
+{
+ INIT_DRIVER_DATA
+
+ /* TODO */
+ return VA_STATUS_SUCCESS;
+}
+
VAStatus dummy_DeassociateSubpicture(
VADriverContextP ctx,
VASubpictureID subpicture,
return VA_STATUS_SUCCESS;
}
-VAStatus __vaDriverInit_0_26( VADriverContextP ctx )
+VAStatus __vaDriverInit_0_28( VADriverContextP ctx )
{
object_base_p obj;
int result;
int i;
ctx->version_major = 0;
- ctx->version_minor = 26;
+ ctx->version_minor = 28;
ctx->max_profiles = DUMMY_MAX_PROFILES;
ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
ctx->vtable.vaPutSurface = dummy_PutSurface;
ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
ctx->vtable.vaCreateImage = dummy_CreateImage;
+ ctx->vtable.vaDeriveImage = dummy_DeriveImage;
ctx->vtable.vaDestroyImage = dummy_DestroyImage;
ctx->vtable.vaSetImagePalette = dummy_SetImagePalette;
ctx->vtable.vaGetImage = dummy_GetImage;
ctx->vtable.vaPutImage = dummy_PutImage;
+ ctx->vtable.vaPutImage2 = dummy_PutImage2;
ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
+ ctx->vtable.vaAssociateSubpicture2 = dummy_AssociateSubpicture2;
ctx->vtable.vaDeassociateSubpicture = dummy_DeassociateSubpicture;
ctx->vtable.vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
#define DUMMY_MAX_IMAGE_FORMATS 10
#define DUMMY_MAX_SUBPIC_FORMATS 4
#define DUMMY_MAX_DISPLAY_ATTRIBUTES 4
-#define DUMMY_STR_VENDOR "Dummy-dummy-1.0-dummy"
+#define DUMMY_STR_VENDOR "Dummy Driver 1.0"
struct dummy_driver_data {
struct object_heap config_heap;
libva_la_LTLIBRARIES = libva.la
libva_ladir = $(libdir)
-libva_la_LDFLAGS = -version-number 0:26:0 -no-undefined
+libva_la_LDFLAGS = -version-number 0:28:0 -no-undefined
libva_la_LIBADD = -ldl -lX11 -lXext
libva_la_SOURCES = va_dri.c va.c va_dristr.h
#include "va_dri.h"
#define VA_MAJOR_VERSION 0
-#define VA_MINOR_VERSION 26
-#define DRIVER_INIT_FUNC "__vaDriverInit_0_26"
+#define VA_MINOR_VERSION 28
+#define DRIVER_INIT_FUNC "__vaDriverInit_0_28"
#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
#define DRIVER_EXTENSION "_drv_video.so"
static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name)
{
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
- char *search_path;
+ char *search_path = NULL;
char *saveptr;
char *driver_dir;
CHECK_VTABLE(vaStatus, ctx, PutSurface);
CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
CHECK_VTABLE(vaStatus, ctx, CreateImage);
+ CHECK_VTABLE(vaStatus, ctx, DeriveImage);
CHECK_VTABLE(vaStatus, ctx, DestroyImage);
CHECK_VTABLE(vaStatus, ctx, SetImagePalette);
CHECK_VTABLE(vaStatus, ctx, GetImage);
CHECK_VTABLE(vaStatus, ctx, PutImage);
+ CHECK_VTABLE(vaStatus, ctx, PutImage2);
CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
+ CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture2);
CHECK_VTABLE(vaStatus, ctx, DeassociateSubpicture);
CHECK_VTABLE(vaStatus, ctx, QueryDisplayAttributes);
CHECK_VTABLE(vaStatus, ctx, GetDisplayAttributes);
return vaStatus;
}
+VAPrivFunc vaGetLibFunc(VADisplay dpy, const char *func)
+{
+ VADriverContextP ctx = CTX(dpy);
+ if( !vaContextIsValid(ctx) )
+ return NULL;
+
+ if (NULL == ctx->handle)
+ return NULL;
+
+ return (VAPrivFunc) dlsym(ctx->handle, func);
+}
+
/*
* Returns a short english description of error_status
return ctx->vtable.vaPutImage ( ctx, surface, image, src_x, src_y, width, height, dest_x, dest_y );
}
+/*
+ * Similar to vaPutImage but with additional destination width
+ * and height arguments to enable scaling
+ */
+VAStatus vaPutImage2 (
+ VADisplay dpy,
+ 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
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ CHECK_CONTEXT(ctx);
+
+ TRACE(vaPutImage2);
+ return ctx->vtable.vaPutImage2 ( ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height );
+}
+
+/*
+ * Derive an VAImage from an existing surface.
+ * This interface will derive a VAImage and corresponding image buffer from
+ * an existing VA Surface. The image buffer can then be mapped/unmapped for
+ * direct CPU access. This operation is only possible on implementations with
+ * direct rendering capabilities and internal surface formats that can be
+ * represented with a VAImage. When the operation is not possible this interface
+ * will return VA_STATUS_ERROR_OPERATION_FAILED. Clients should then fall back
+ * to using vaCreateImage + vaPutImage to accomplish the same task in an
+ * indirect manner.
+ *
+ * Implementations should only return success when the resulting image buffer
+ * would be useable with vaMap/Unmap.
+ *
+ * When directly accessing a surface special care must be taken to insure
+ * proper synchronization with the graphics hardware. Clients should call
+ * vaQuerySurfaceStatus to insure that a surface is not the target of concurrent
+ * rendering or currently being displayed by an overlay.
+ *
+ * Additionally nothing about the contents of a surface should be assumed
+ * following a vaPutSurface. Implementations are free to modify the surface for
+ * scaling or subpicture blending within a call to vaPutImage.
+ *
+ * Calls to vaPutImage or vaGetImage using the same surface from which the image
+ * has been derived will return VA_STATUS_ERROR_SURFACE_BUSY. vaPutImage or
+ * vaGetImage with other surfaces is supported.
+ *
+ * An image created with vaDeriveImage should be freed with vaDestroyImage. The
+ * image and image buffer structures will be destroyed; however, the underlying
+ * surface will remain unchanged until freed with vaDestroySurfaces.
+ */
+VAStatus vaDeriveImage (
+ VADisplay dpy,
+ VASurfaceID surface,
+ VAImage *image /* out */
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ CHECK_CONTEXT(ctx);
+
+ TRACE(vaDeriveImage);
+ return ctx->vtable.vaDeriveImage ( ctx, surface, image );
+}
+
+
/* Get maximum number of subpicture formats supported by the implementation */
int vaMaxNumSubpictureFormats (
VADisplay dpy
return ctx->vtable.vaSetSubpictureImage ( ctx, subpicture, image);
}
-
+#warning TODO: Remove vaSetSubpicturePalette in rev 0.29
VAStatus vaSetSubpicturePalette (
VADisplay dpy,
VASubpictureID subpicture,
return ctx->vtable.vaAssociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces, src_x, src_y, dest_x, dest_y, width, height, flags );
}
+VAStatus vaAssociateSubpicture2 (
+ VADisplay dpy,
+ VASubpictureID subpicture,
+ VASurfaceID *target_surfaces,
+ int num_surfaces,
+ short src_x, /* upper left offset in subpicture */
+ short src_y,
+ unsigned short src_width,
+ unsigned short src_height,
+ short dest_x, /* upper left offset in surface */
+ short dest_y,
+ unsigned short dest_width,
+ unsigned short dest_height,
+ /*
+ * whether to enable chroma-keying or global-alpha
+ * see VA_SUBPICTURE_XXX values
+ */
+ unsigned int flags
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ CHECK_CONTEXT(ctx);
+
+ TRACE(vaAssociateSubpicture2);
+ return ctx->vtable.vaAssociateSubpicture2 ( ctx, subpicture, target_surfaces, num_surfaces, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, flags );
+}
+
/*
* vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
*/
}
-
+#warning TODO: Remove vaDbgCopySurfaceToBuffer in rev 0.29
VAStatus vaDbgCopySurfaceToBuffer(VADisplay dpy,
VASurfaceID surface,
void **buffer, /* out */
/*
* Video Decode Acceleration API Specification
*
- * Rev. 0.25
+ * Rev. 0.28
* <jonathan.bian@intel.com>
*
* Revision History:
* rev 0.24 (09/18/2007 Jonathan Bian) - Added display attributes.
* rev 0.25 (10/18/2007 Jonathan Bian) - Changed to use IDs only for some types.
* rev 0.26 (11/07/2007 Waldo Bastian) - Change vaCreateBuffer semantics
+ * rev 0.27 (11/19/2007 Matt Sottek) - Added DeriveImage
+ * rev 0.28 (12/06/2007 Jonathan Bian) - Added new versions of PutImage and AssociateSubpicture
+ * to enable scaling
*
* Acknowledgements:
* Some concepts borrowed from XvMC and XvImage.
/*
* vaQueryVendorString returns a pointer to a zero-terminated string
* describing some aspects of the VA implemenation on a specific
- * hardware accelerator. The format of the returned string is:
- * <vendorname>-<major_version>-<minor_version>-<addtional_info>
+ * hardware accelerator. The format of the returned string is vendor
+ * specific and at the discretion of the implementer.
* e.g. for the Intel GMA500 implementation, an example would be:
- * "IntelGMA500-1.0-0.2-patch3
+ * "Intel GMA500 - 2.0.0.32L.0005"
*/
const char *vaQueryVendorString (
VADisplay dpy
);
+typedef int (*VAPrivFunc)();
+
+/*
+ * Return a function pointer given a function name in the library.
+ * This allows private interfaces into the library
+ */
+VAPrivFunc vaGetLibFunc (
+ VADisplay dpy,
+ const char *func
+);
+
/* Currently defined profiles */
typedef enum
{
typedef struct _VASliceParameterBufferH264
{
unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
- unsigned int slice_data_offset;/* the offset to first byte of slice data */
+ unsigned int slice_data_offset;/* the offset to the NAL start code for this slice */
unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
- unsigned short slice_data_bit_offset; /* bit offset in the first byte of valid data */
+ unsigned short slice_data_bit_offset; /* bit offset from NAL start code to the beginning of slice data */
unsigned short first_mb_in_slice;
unsigned char slice_type;
unsigned char direct_spatial_mv_pred_flag;
VASurfaceStatus *status /* out */
);
-
-/*
- * Copies the surface to a buffer
- * The stride of the surface will be stored in *stride
- * Caller should free the returned buffer with free() when done.
- */
-VAStatus vaDbgCopySurfaceToBuffer(VADisplay dpy,
- VASurfaceID surface,
- void **buffer, /* out */
- unsigned int *stride /* out */
-);
-
/*
* Images and Subpictures
* VAImage is used to either get the surface data to client memory, or
int dest_y
);
+ /*
+ * Similar to vaPutImage but with additional destination width
+ * and height arguments to enable scaling
+ */
+VAStatus vaPutImage2 (
+ VADisplay dpy,
+ 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
+);
+
+/*
+ * Derive an VAImage from an existing surface.
+ * This interface will derive a VAImage and corresponding image buffer from
+ * an existing VA Surface. The image buffer can then be mapped/unmapped for
+ * direct CPU access. This operation is only possible on implementations with
+ * direct rendering capabilities and internal surface formats that can be
+ * represented with a VAImage. When the operation is not possible this interface
+ * will return VA_STATUS_ERROR_OPERATION_FAILED. Clients should then fall back
+ * to using vaCreateImage + vaPutImage to accomplish the same task in an
+ * indirect manner.
+ *
+ * Implementations should only return success when the resulting image buffer
+ * would be useable with vaMap/Unmap.
+ *
+ * When directly accessing a surface special care must be taken to insure
+ * proper synchronization with the graphics hardware. Clients should call
+ * vaQuerySurfaceStatus to insure that a surface is not the target of concurrent
+ * rendering or currently being displayed by an overlay.
+ *
+ * Additionally nothing about the contents of a surface should be assumed
+ * following a vaPutSurface. Implementations are free to modify the surface for
+ * scaling or subpicture blending within a call to vaPutImage.
+ *
+ * Calls to vaPutImage or vaGetImage using the same surface from which the image
+ * has been derived will return VA_STATUS_ERROR_SURFACE_BUSY. vaPutImage or
+ * vaGetImage with other surfaces is supported.
+ *
+ * An image created with vaDeriveImage should be freed with vaDestroyImage. The
+ * image and image buffer structures will be destroyed; however, the underlying
+ * surface will remain unchanged until freed with vaDestroySurfaces.
+ */
+VAStatus vaDeriveImage (
+ VADisplay dpy,
+ VASurfaceID surface,
+ VAImage *image /* out */
+);
+
+
+
/*
* Subpictures
* Subpicture is a special type of image that can be blended
VAImageID image
);
-VAStatus vaSetSubpicturePalette (
- VADisplay dpy,
- VASubpictureID subpicture,
- /*
- * pointer to an array holding the palette data. The size of the array is
- * num_palette_entries * entry_bytes in size. The order of the components
- * in the palette is described by the component_order in VAImage struct
- */
- unsigned char *palette
-);
-
/*
* If chromakey is enabled, then the area where the source value falls within
* the chromakey [min, max] range is transparent
);
/*
+ * Similar to vaAssociateSubpicture but with additional destination width
+ * and height to enable scaling
+ */
+VAStatus vaAssociateSubpicture2 (
+ VADisplay dpy,
+ VASubpictureID subpicture,
+ VASurfaceID *target_surfaces,
+ int num_surfaces,
+ short src_x, /* upper left offset in subpicture */
+ short src_y,
+ unsigned short src_width,
+ unsigned short src_height,
+ short dest_x, /* upper left offset in surface */
+ short dest_y,
+ unsigned short dest_width,
+ unsigned short dest_height,
+ /*
+ * whether to enable chroma-keying or global-alpha
+ * see VA_SUBPICTURE_XXX values
+ */
+ unsigned int flags
+);
+
+/*
* vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
*/
VAStatus vaDeassociateSubpicture (
int max_num_profiles, max_num_entrypoints, max_num_attribs;
max_num_profiles = vaMaxNumProfiles(dpy);
- max_num_entrypoints = vaMaxNumProfiles(dpy);
- max_num_attribs = vaMaxNumProfiles(dpy);
+ max_num_entrypoints = vaMaxNumEntrypoints(dpy);
+ max_num_attribs = vaMaxNumAttributes(dpy);
/* find out whether MPEG2 MP is supported */
VAProfile *profiles = malloc(sizeof(VAProfile)*max_num_profiles);
VAImage *image /* out */
);
+ VAStatus (*vaDeriveImage) (
+ VADriverContextP ctx,
+ VASurfaceID surface,
+ VAImage *image /* out */
+ );
+
VAStatus (*vaDestroyImage) (
VADriverContextP ctx,
VAImageID image
int dest_y
);
+ VAStatus (*vaPutImage2) (
+ 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 (*vaQuerySubpictureFormats) (
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
unsigned int flags
);
+ VAStatus (*vaAssociateSubpicture2) (
+ VADriverContextP ctx,
+ VASubpictureID subpicture,
+ VASurfaceID *target_surfaces,
+ int num_surfaces,
+ short src_x, /* upper left offset in subpicture */
+ short src_y,
+ unsigned short src_width,
+ unsigned short src_height,
+ short dest_x, /* upper left offset in surface */
+ short dest_y,
+ unsigned short dest_width,
+ unsigned short dest_height,
+ /*
+ * whether to enable chroma-keying or global-alpha
+ * see VA_SUBPICTURE_XXX values
+ */
+ unsigned int flags
+ );
+
VAStatus (*vaDeassociateSubpicture) (
VADriverContextP ctx,
VASubpictureID subpicture,
*/
/* de-interlace flags for vaPutSurface */
+#define VA_FRAME_PICTURE 0x00000000
#define VA_TOP_FIELD 0x00000001
#define VA_BOTTOM_FIELD 0x00000002
-#define VA_FRAME_PICTURE 0x00000004 /* weave */
/*
* clears the drawable with background color.
* for hardware overlay based implementation this flag
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-
+#include <stdlib.h>
int main(int argc, const char* argv[])
{
{
fprintf(stderr, "%s: vaInitialize failed with error code %d (%s)\n",
name, va_status, vaErrorStr(va_status));
+ return 3;
}
- printf("%s: VA API version: %d.%d\n", name, major_version, minor_version);
+
driver = vaQueryVendorString(va_dpy);
printf("%s: Driver version: %s\n", name, driver ? driver : "<unknown>");
vaTerminate(va_dpy);