summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Yuan <shengquan.yuan@intel.com>2007-09-13 10:12:28 +0800
committerAustin Yuan <shengquan.yuan@intel.com>2007-09-13 10:12:28 +0800
commit42c28c46f7f20f153d61f08f70f967c9ff96c5e9 (patch)
tree49df22699bfdd0421df1370dffaa359c4da22216
parentf579969bf67d236cf53125a8f63c60d952d6fb71 (diff)
downloadlibva-42c28c46f7f20f153d61f08f70f967c9ff96c5e9.tar.gz
bump libva to 23
-rw-r--r--dummy_drv_video/dummy_drv_video.c35
-rw-r--r--src/va.c41
-rwxr-xr-xsrc/va.h48
-rwxr-xr-xsrc/va_backend.h20
-rwxr-xr-xsrc/va_x11.h50
5 files changed, 179 insertions, 15 deletions
diff --git a/dummy_drv_video/dummy_drv_video.c b/dummy_drv_video/dummy_drv_video.c
index 740cabc..ce600aa 100644
--- a/dummy_drv_video/dummy_drv_video.c
+++ b/dummy_drv_video/dummy_drv_video.c
@@ -517,6 +517,18 @@ VAStatus dummy_DestroySubpicture(
return VA_STATUS_SUCCESS;
}
+VAStatus dummy_SetSubpictureImage(
+ VADriverContextP ctx,
+ VASubpicture *subpicture,
+ VAImage *image
+)
+{
+ INIT_DRIVER_DATA
+
+ /* TODO */
+ return VA_STATUS_SUCCESS;
+}
+
VAStatus dummy_SetSubpicturePalette(
VADriverContextP ctx,
VASubpicture *subpicture,
@@ -1005,6 +1017,25 @@ VAStatus dummy_PutSurface(
return VA_STATUS_ERROR_UNKNOWN;
}
+
+VAStatus dummy_CopySurfaceToGLXPbuffer (
+ VADriverContextP ctx,
+ VASurface *surface,
+ XID pbuffer_id,
+ short srcx,
+ short srcy,
+ unsigned short width,
+ unsigned short height,
+ short destx,
+ short desty,
+ unsigned int draw_buffer,
+ unsigned int flags /* de-interlacing flags */
+)
+{
+ /* TODO */
+ return VA_STATUS_ERROR_UNKNOWN;
+}
+
VAStatus dummy_DbgCopySurfaceToBuffer(
VADriverContextP ctx,
VASurface *surface,
@@ -1056,7 +1087,7 @@ VAStatus dummy_Terminate( VADriverContextP ctx )
return VA_STATUS_SUCCESS;
}
-VAStatus __vaDriverInit_0_22( VADriverContextP ctx )
+VAStatus __vaDriverInit_0_23( VADriverContextP ctx )
{
object_base_p obj;
int result;
@@ -1094,6 +1125,7 @@ VAStatus __vaDriverInit_0_22( VADriverContextP ctx )
ctx->vtable.vaSyncSurface = dummy_SyncSurface;
ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
ctx->vtable.vaPutSurface = dummy_PutSurface;
+ ctx->vtable.vaCopySurfaceToGLXPbuffer = dummy_CopySurfaceToGLXPbuffer;
ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
ctx->vtable.vaCreateImage = dummy_CreateImage;
ctx->vtable.vaDestroyImage = dummy_DestroyImage;
@@ -1102,6 +1134,7 @@ VAStatus __vaDriverInit_0_22( VADriverContextP ctx )
ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
+ ctx->vtable.vaSetSubpictureImage = dummy_SetSubpictureImage;
ctx->vtable.vaSetSubpicturePalette = dummy_SetSubpicturePalette;
ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
diff --git a/src/va.c b/src/va.c
index d4c83be..9a3aca5 100644
--- a/src/va.c
+++ b/src/va.c
@@ -36,7 +36,7 @@
#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
#define DRIVER_EXTENSION "_drv_video.so"
-#define DRIVER_INIT_FUNC "__vaDriverInit_0_22"
+#define DRIVER_INIT_FUNC "__vaDriverInit_0_23"
#define CTX(dpy) ((VADriverContextP) dpy );
#define ASSERT_CONTEXT(dpy) assert( vaDbgContextIsValid(dpy) )
@@ -276,6 +276,7 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name)
CHECK_VTABLE(vaStatus, ctx, SyncSurface);
CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
CHECK_VTABLE(vaStatus, ctx, PutSurface);
+ CHECK_VTABLE(vaStatus, ctx, CopySurfaceToGLXPbuffer);
CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
CHECK_VTABLE(vaStatus, ctx, CreateImage);
CHECK_VTABLE(vaStatus, ctx, DestroyImage);
@@ -284,6 +285,7 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name)
CHECK_VTABLE(vaStatus, ctx, QuerySubpictureFormats);
CHECK_VTABLE(vaStatus, ctx, CreateSubpicture);
CHECK_VTABLE(vaStatus, ctx, DestroySubpicture);
+ CHECK_VTABLE(vaStatus, ctx, SetSubpictureImage);
CHECK_VTABLE(vaStatus, ctx, SetSubpicturePalette);
CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
@@ -762,6 +764,29 @@ VAStatus vaPutSurface (
cliprects, number_cliprects, flags );
}
+VAStatus vaCopySurfaceToGLXPbuffer (
+ VADisplay dpy,
+ VASurface *surface,
+ XID pbuffer_id,
+ short srcx,
+ short srcy,
+ unsigned short width,
+ unsigned short height,
+ short destx,
+ short desty,
+ unsigned int draw_buffer,
+ unsigned int flags /* de-interlacing flags */
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaCopySurfaceToGLXPbuffer);
+ return ctx->vtable.vaCopySurfaceToGLXPbuffer( ctx, surface, pbuffer_id,
+ srcx,srcy,width, height,destx,desty,
+ draw_buffer, flags );
+}
+
/* Get maximum number of image formats supported by the implementation */
int vaMaxNumImageFormats (
VADisplay dpy
@@ -931,6 +956,20 @@ VAStatus vaDestroySubpicture (
return ctx->vtable.vaDestroySubpicture ( ctx, subpicture);
}
+VAStatus vaSetSubpictureImage (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ VAImage *image
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaSetSubpictureImage);
+ return ctx->vtable.vaSetSubpictureImage ( ctx, subpicture, image);
+}
+
+
VAStatus vaSetSubpicturePalette (
VADisplay dpy,
VASubpicture *subpicture,
diff --git a/src/va.h b/src/va.h
index 6bdf5a2..2343412 100755
--- a/src/va.h
+++ b/src/va.h
@@ -24,7 +24,7 @@
/*
* Video Decode Acceleration API Specification
*
- * Rev. 0.22
+ * Rev. 0.23
* <jonathan.bian@intel.com>
*
* Revision History:
@@ -41,7 +41,8 @@
* rev 0.19 (08/06/2007 Jonathan Bian) - Removed extra type for bitplane data.
* rev 0.20 (08/08/2007 Jonathan Bian) - Added missing fields to VC-1 PictureParameter structure.
* rev 0.21 (08/20/2007 Jonathan Bian) - Added image and subpicture support.
- * rev 0.22 (08/27/2007 Jonathan Bian) - Added support for chroma-keying and global alpha.
+ * rev 0.22 (08/27/2007 Jonathan Bian) - Added support for chroma-keying and global alpha.
+ * rev 0.23 (09/07/2007 Jonathan Bian) - Fixed some issues with images and subpictures.
*
* Acknowledgements:
* Some concepts borrowed from XvMC and XvImage.
@@ -397,7 +398,8 @@ typedef enum
VASliceDataBufferType = 5,
VAMacroblockParameterBufferType = 6,
VAResidualDataBufferType = 7,
- VADeblockingParameterBufferType = 8
+ VADeblockingParameterBufferType = 8,
+ VAImageBufferType = 9
} VABufferType;
/****************************
@@ -430,7 +432,9 @@ typedef struct _VAPictureParameterBufferMPEG2
unsigned char alternate_scan : 1;
unsigned char repeat_first_field : 1;
unsigned char progressive_frame : 1;
- unsigned char is_first_field : 1;/* indicate whether the current field is the first field for field picture */
+ unsigned char is_first_field : 1; /* indicate whether the current field
+ * is the first field for field picture
+ */
};
unsigned int picture_coding_extension;
};
@@ -1030,6 +1034,7 @@ VAStatus vaQuerySurfaceStatus (
VASurfaceStatus *status /* out */
);
+
/*
* Copies the surface to a buffer
* The stride of the surface will be stored in *stride
@@ -1075,10 +1080,18 @@ typedef int VAImageID;
typedef struct _VAImage
{
VAImageID image_id; /* uniquely identify this image */
- VASurfaceID surface_id; /* which surface will this image be associated with */
VAImageFormat format;
- unsigned char *data; /* image data pointer */
- /* The following fields are set by the library */
+ VABufferID buf; /* image data buffer */
+ /*
+ * Image data will be stored in a buffer of type VAImageBufferType to facilitate
+ * data store on the server side for optimal performance.
+ * It is expected that the client will first call vaCreateImage which returns a VAImage
+ * structure with the following fields filled by the library. It will then
+ * create the "buf" with vaBufferCreate. For PutImage, then client will call
+ * vaBufferData() with the image data before calling PutImage, and for GetImage
+ * the client will call vaBufferData() with a NULL data pointer, and then call GetImage.
+ * After that the client can use the Map/Unmap buffer functions to access the image data.
+ */
unsigned short width;
unsigned short height;
unsigned int data_size;
@@ -1090,7 +1103,7 @@ typedef struct _VAImage
unsigned int *pitches;
/*
* An array of size num_planes indicating the byte offset from
- * "data" t the start of each plane.
+ * the beginning of the image data to the start of each plane.
*/
unsigned int *offsets;
} VAImage;
@@ -1113,12 +1126,13 @@ VAStatus vaQueryImageFormats (
);
/*
+ * Create a VAImage structure
* The width and height fields returned in the VAImage structure may get
* enlarged for some YUV formats. The size of the data buffer that needs
* to be allocated will be given in the "data_size" field in VAImage.
- * Image data is not allocated by this function. The client should
- * allocate the memory and fill in the VAImage structure's data field
- * after looking at "data_size" returned from the library.
+ * Image data is not allocated by this function. The client should
+ * allocate the memory required for the data and fill in the data field after
+ * looking at "data_size" returned from this call.
*/
VAStatus vaCreateImage (
VADisplay dpy,
@@ -1244,6 +1258,16 @@ VAStatus vaDestroySubpicture (
VASubpicture *subpicture
);
+/*
+ * Bind an image to the subpicture. This image will now be associated with
+ * the subpicture instead of the one at creation.
+ */
+VAStatus vaSetSubpictureImage (
+ VADisplay dpy,
+ VASubpicture *subpicture,
+ VAImage *image
+);
+
VAStatus vaSetSubpicturePalette (
VADisplay dpy,
VASubpicture *subpicture,
@@ -1453,7 +1477,7 @@ Mostly to demonstrate program flow with no error handling ...
VASubpicture subpicture;
unsigned char sub_data[128][16];
/* fill sub_data with subtitle in AI44 */
- vaCreateImage(dpy, surfaces, sub_formats, 128, 16, sub_data, &sub_image);
+ vaCreateImage(dpy, sub_formats, 128, 16,&sub_image);
vaCreateSubpicture(dpy, &sub_image, &subpicture);
unsigned char palette[3][16];
/* fill the palette data */
diff --git a/src/va_backend.h b/src/va_backend.h
index 5cfef4e..c474925 100755
--- a/src/va_backend.h
+++ b/src/va_backend.h
@@ -208,6 +208,20 @@ struct VADriverContext
int flags /* de-interlacing flags */
);
+ VAStatus (*vaCopySurfaceToGLXPbuffer) (
+ VADriverContextP ctx,
+ VASurface *surface,
+ XID pbuffer_id,
+ short srcx,
+ short srcy,
+ unsigned short width,
+ unsigned short height,
+ short destx,
+ short desty,
+ unsigned int draw_buffer,
+ unsigned int flags /* de-interlacing flags */
+ );
+
VAStatus (*vaQueryImageFormats) (
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
@@ -267,6 +281,12 @@ struct VADriverContext
VASubpicture *subpicture
);
+ VAStatus (*vaSetSubpictureImage) (
+ VADriverContextP ctx,
+ VASubpicture *subpicture,
+ VAImage *image
+ );
+
VAStatus (*vaSetSubpicturePalette) (
VADriverContextP ctx,
VASubpicture *subpicture,
diff --git a/src/va_x11.h b/src/va_x11.h
index a6ed9a7..e49c6c5 100755
--- a/src/va_x11.h
+++ b/src/va_x11.h
@@ -31,7 +31,11 @@ extern "C" {
* color space conversion and scaling to the destination
* rectangle
*/
-
+
+/* de-interlace flags for vaPutSurface */
+#define VA_TOP_FIELD 0x00000001
+#define VA_BOTTOM_FIELD 0x00000002
+#define VA_FRAME_PICTURE 0x00000004 /* weave */
VAStatus vaPutSurface (
VADisplay dpy,
VASurface *surface,
@@ -49,6 +53,50 @@ VAStatus vaPutSurface (
int flags /* de-interlacing flags */
);
+/*
+ This function copies a rectangle of dimension "width" by "height"
+ from the VASurface indicated by "surface" to the GLXPbuffer
+ identified by its XID "pbuffer_id". The locations of source and
+ destination rectangles are specified differently for the VASurface
+ source and the GLXPbuffer destination as follows. On the VASurface,
+ the rectangle location is specified in the usual X-Window fashion
+ with srcx and srcy indicating the location of the upper left hand
+ corner of the rectangle relative to the VASurface origin (the upper
+ left hand corner of the XvMCSurface with positive Y axis going in the
+ down direction). On the GLXPbuffer the rectangle location is
+ specified in the usual OpenGL fashion with the dstx and dsty
+ indicating the location of the lower left hand corner of the
+ rectangle relative to the GLXPbuffer origin (the lower left hand
+ corner of the GLXPbuffer with the positive Y axis going in the
+ up direction).
+
+ The "draw_buffer" takes the same OpenGL enums that glDrawBuffer()
+ takes (ie. GL_FRONT_LEFT, GL_FRONT_RIGHT, GL_BACK_LEFT, GL_BACK_RIGHT,
+ GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT or GL_FRONT_AND_BACK). This
+ indicates which buffer of the GLXPbuffer is to be used for the
+ destination of the copy. Buffers specified in the "draw_buffer"
+ that do not exist in the GLXPbuffer are ignored.
+
+ "flags" may be VA_TOP_FIELD, VA_BOTTOM_FIELD or VA_FRAME_PICTURE.
+ If flags is not VA_FRAME_PICTURE, the srcy and height are in field
+ coordinates, not frame. That is, the total copyable height is half
+ the height of the VASurface.
+*/
+VAStatus vaCopySurfaceToGLXPbuffer (
+ VADisplay dpy,
+ VASurface *surface,
+ XID pbuffer_id,
+ short srcx,
+ short srcy,
+ unsigned short width,
+ unsigned short height,
+ short destx,
+ short desty,
+ unsigned int draw_buffer,
+ unsigned int flags /* de-interlacing flags */
+);
+
+
#ifdef __cplusplus
}
#endif