diff options
author | Waldo Bastian <waldo.bastian@intel.com> | 2007-11-07 10:47:56 -0800 |
---|---|---|
committer | Waldo Bastian <waldo.bastian@intel.com> | 2007-11-07 10:47:56 -0800 |
commit | d2e4f9b2a5e144081223c905304a1b97fa51eb91 (patch) | |
tree | 39de228842af1f5c483986712afd595527ae9ead /src | |
parent | a0e81bbb0b3a4756b8ef3fe50733786ded414922 (diff) | |
download | libva-d2e4f9b2a5e144081223c905304a1b97fa51eb91.tar.gz |
Update to VA API 0.26
- Combine vaCreateBuffer and vaBufferData
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/va.c | 28 | ||||
-rwxr-xr-x | src/va.h | 45 | ||||
-rwxr-xr-x | src/va_backend.h | 14 |
4 files changed, 33 insertions, 56 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 755799d..1eed0c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,7 +22,7 @@ libva_la_LTLIBRARIES = libva.la libva_ladir = $(libdir) -libva_la_LDFLAGS = -version-number 0:25:0 -no-undefined +libva_la_LDFLAGS = -version-number 0:26:0 -no-undefined libva_la_LIBADD = -ldl -lX11 -lXext libva_la_SOURCES = va_dri.c va.c va_dristr.h @@ -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_25" +#define DRIVER_INIT_FUNC "__vaDriverInit_0_26" #define CTX(dpy) ((VADriverContextP) dpy ); #define CHECK_CONTEXT(dpy) if( !vaContextIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; } @@ -279,7 +279,6 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name) CHECK_VTABLE(vaStatus, ctx, CreateContext); CHECK_VTABLE(vaStatus, ctx, DestroyContext); CHECK_VTABLE(vaStatus, ctx, CreateBuffer); - CHECK_VTABLE(vaStatus, ctx, BufferData); CHECK_VTABLE(vaStatus, ctx, BufferSetNumElements); CHECK_VTABLE(vaStatus, ctx, MapBuffer); CHECK_VTABLE(vaStatus, ctx, UnmapBuffer); @@ -656,30 +655,19 @@ VAStatus vaDestroyContext ( VAStatus vaCreateBuffer ( VADisplay dpy, - VABufferType type, /* in */ - VABufferID *buf_id /* out */ + VAContextID context, /* in */ + VABufferType type, /* in */ + unsigned int size, /* in */ + unsigned int num_elements, /* in */ + void *data, /* in */ + VABufferID *buf_id /* out */ ) { VADriverContextP ctx = CTX(dpy); CHECK_CONTEXT(ctx); TRACE(vaCreateBuffer); - return ctx->vtable.vaCreateBuffer( ctx, type, buf_id); -} - -VAStatus vaBufferData ( - VADisplay dpy, - VABufferID buf_id, /* in */ - unsigned int size, /* in */ - unsigned int num_elements, /* in */ - void *data /* in */ -) -{ - VADriverContextP ctx = CTX(dpy); - CHECK_CONTEXT(ctx); - - TRACE(vaBufferData); - return ctx->vtable.vaBufferData( ctx, buf_id, size, num_elements, data); + return ctx->vtable.vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id); } VAStatus vaBufferSetNumElements ( @@ -45,6 +45,7 @@ * rev 0.23 (09/11/2007 Jonathan Bian) - Fixed some issues with images and subpictures. * 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 * * Acknowledgements: * Some concepts borrowed from XvMC and XvImage. @@ -939,33 +940,27 @@ typedef struct _VASliceParameterBufferH264 /* Buffer functions */ /* - * Creates a buffer for storing a certain type of data, no data store allocated - * Note: image buffers are created by the library, not the client. Please see - * vaCreateImage on how image buffers are managed. - */ -VAStatus vaCreateBuffer ( - VADisplay dpy, - VABufferType type, /* in */ - VABufferID *buf_id /* out */ -); - -/* - * Create data store for the buffer and initalize with "data". + * Creates a buffer for "num_elements" elements of "size" bytes and + * initalize with "data". * if "data" is null, then the contents of the buffer data store * are undefined. * Basically there are two ways to get buffer data to the server side. One is - * to call vaBufferData() with a non-null "data", which results the data being + * to call vaCreateBuffer() with a non-null "data", which results the data being * copied to the data store on the server side. A different method that - * eliminates this copy is to pass null as "data" when calling vaBufferData(), + * eliminates this copy is to pass null as "data" when calling vaCreateBuffer(), * and then use vaMapBuffer() to map the data store from the server side to the * client address space for access. + * Note: image buffers are created by the library, not the client. Please see + * vaCreateImage on how image buffers are managed. */ -VAStatus vaBufferData ( +VAStatus vaCreateBuffer ( VADisplay dpy, - VABufferID buf_id, /* in */ + VAContextID context, + VABufferType type, /* in */ unsigned int size, /* in */ unsigned int num_elements, /* in */ - void *data /* in */ + void *data, /* in */ + VABufferID *buf_id /* out */ ); /* @@ -982,7 +977,7 @@ VAStatus vaBufferSetNumElements ( /* * Map data store of the buffer into the client's address space - * vaBufferData() needs to be called with "data" set to NULL before + * vaCreateBuffer() needs to be called with "data" set to NULL before * calling vaMapBuffer() */ VAStatus vaMapBuffer ( @@ -1003,6 +998,7 @@ VAStatus vaUnmapBuffer ( /* * After this call, the buffer is deleted and this buffer_id is no longer valid + * Only call this if the buffer is not going to be passed to vaRenderBuffer */ VAStatus vaDestroyBuffer ( VADisplay dpy, @@ -1028,6 +1024,7 @@ VAStatus vaBeginPicture ( /* * Send decode buffers to the server. + * Buffers are automatically destroyed afterwards */ VAStatus vaRenderPicture ( VADisplay dpy, @@ -1552,8 +1549,7 @@ Mostly to demonstrate program flow with no error handling ... /* Create a picture parameter buffer for this frame */ VABufferID picture_buf; VAPictureParameterBufferMPEG2 *picture_param; - vaCreateBuffer(dpy, VAPictureParameterBufferType, &picture_buf); - vaBufferData(dpy, picture_buf, sizeof(VAPictureParameterBufferMPEG2), NULL); + vaCreateBuffer(dpy, context, VAPictureParameterBufferType, sizeof(VAPictureParameterBufferMPEG2), 1, NULL, &picture_buf); vaMapBuffer(dpy, picture_buf, &picture_param); picture_param->horizontal_size = 720; picture_param->vertical_size = 480; @@ -1564,8 +1560,7 @@ Mostly to demonstrate program flow with no error handling ... /* Create an IQ matrix buffer for this frame */ VABufferID iq_buf; VAIQMatrixBufferMPEG2 *iq_matrix; - vaCreateBuffer(dpy, VAIQMatrixBufferType, &iq_buf); - vaBufferData(dpy, iq_buf, sizeof(VAIQMatrixBufferMPEG2), NULL); + vaCreateBuffer(dpy, context, VAIQMatrixBufferType, sizeof(VAIQMatrixBufferMPEG2), 1, NULL, &iq_buf); vaMapBuffer(dpy, iq_buf, &iq_matrix); /* fill values for IQ_matrix here */ vaUnmapBuffer(dpy, iq_buf); @@ -1586,8 +1581,7 @@ Mostly to demonstrate program flow with no error handling ... /* Create a slice parameter buffer */ VABufferID slice_param_buf; VASliceParameterBufferMPEG2 *slice_param; - vaCreateBuffer(dpy, VASliceParameterBufferType, &slice_param_buf); - vaBufferData(dpy, slice_param_buf, sizeof(VASliceParameterBufferMPEG2), NULL); + vaCreateBuffer(dpy, context, VASliceParameterBufferType, sizeof(VASliceParameterBufferMPEG2), 1, NULL, &slice_param_buf); vaMapBuffer(dpy, slice_param_buf, &slice_param); slice_param->slice_data_offset = 0; /* Let's say all slices in this bit-stream has 64-bit header */ @@ -1602,8 +1596,7 @@ Mostly to demonstrate program flow with no error handling ... /* Create a slice data buffer */ unsigned char *slice_data; VABufferID slice_data_buf; - vaCreateBuffer(dpy, VASliceDataBufferType, slice_data_buf); - vaBufferData(dpy, slice_data_buf, x /* decoder figure out how big */, NULL); + vaCreateBuffer(dpy, context, VASliceDataBufferType, x /* decoder figure out how big */, 1, NULL, &slice_data_buf); vaMapBuffer(dpy, slice_data_buf, &slice_data); /* decoder fill in slice_data */ vaUnmapBuffer(dpy, slice_data_buf); diff --git a/src/va_backend.h b/src/va_backend.h index 890b07e..9304088 100755 --- a/src/va_backend.h +++ b/src/va_backend.h @@ -118,16 +118,12 @@ struct VADriverVTable VAStatus (*vaCreateBuffer) ( VADriverContextP ctx, - VABufferType type, /* in */ - VABufferID *buf_desc /* out */ - ); - - VAStatus (*vaBufferData) ( - VADriverContextP ctx, - VABufferID buf_id, /* in */ - unsigned int size, /* in */ + VAContextID context, /* in */ + VABufferType type, /* in */ + unsigned int size, /* in */ unsigned int num_elements, /* in */ - void *data /* in */ + void *data, /* in */ + VABufferID *buf_id /* out */ ); VAStatus (*vaBufferSetNumElements) ( |