Commit 881b49c5 authored by Austin Yuan's avatar Austin Yuan

libva-1.0.6

 1) Refinement for VA_TRACE, new LIBVA_FOOL, see the description in va_trace.c/va_fool.c
 2) vaPutSurface flag VA_ENABLE_BLEND to blend the surface with a color
 3) libva.spec for RPM package
 4) Update VAAPI for dynamic bit rate control/AIR/maximum slice size ctrl
 5) Added VA_STATUS_ERROR_DECODING/ENCODING_ERROR to report decode/encode error
 6) Add config.h/va_vesion.h for Android
 7) Update "vainfo.c" for Android
Signed-off-by: default avatarAustin Yuan <shengquan.yuan@gmail.com>
Signed-off-by: default avatarBinglin Chen <binglin.chen@intel.com>
Signed-off-by: default avatarFei Jiang <fei.jiang@intel.com>
Signed-off-by: default avatarElaine Wang <elaine.wang@intel.com>
Signed-off-by: default avatarRen Zhaohan <zhaohan.ren@intel.com>
Signed-off-by: default avatarJerry Dong <jerry.dong@intel.com>
Signed-off-by: default avatarAustin Yuan <shengquan.yuan@gmail.com>
parent 6c372035
# Recursive call sub-folder Android.mk # Recursive call sub-folder Android.mk
# #
# include $(call all-subdir-makefiles)
LOCAL_PATH := $(my-dir) LOCAL_PATH := $(my-dir)
include $(LOCAL_PATH)/va/Android.mk include $(LOCAL_PATH)/va/Android.mk
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
distribute, sub license, and/or sell copies of the Software, and to distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to permit persons to whom the Software is furnished to do so, subject to
the following conditions: the following conditions:
The above copyright notice and this permission notice (including the The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions next paragraph) shall be included in all copies or substantial portions
of the Software. of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
# distribute, sub license, and/or sell copies of the Software, and to # distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to # permit persons to whom the Software is furnished to do so, subject to
# the following conditions: # the following conditions:
# #
# The above copyright notice and this permission notice (including the # The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions # next paragraph) shall be included in all copies or substantial portions
# of the Software. # of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
...@@ -29,7 +29,7 @@ m4_define([libva_version], ...@@ -29,7 +29,7 @@ m4_define([libva_version],
[libva_major_version.libva_minor_version.libva_micro_version]) [libva_major_version.libva_minor_version.libva_micro_version])
# if the library source code has changed, increment revision # if the library source code has changed, increment revision
m4_define([libva_lt_revision], [5]) m4_define([libva_lt_revision], [6])
# if any interface was added/removed/changed, then inc current, reset revision # if any interface was added/removed/changed, then inc current, reset revision
m4_define([libva_lt_current], [1]) m4_define([libva_lt_current], [1])
# if any interface was added since last public release, then increment age # if any interface was added since last public release, then increment age
......
...@@ -1058,7 +1058,7 @@ VAStatus dummy_PutSurface( ...@@ -1058,7 +1058,7 @@ VAStatus dummy_PutSurface(
Drawable drawable = (Drawable)draw; Drawable drawable = (Drawable)draw;
(void)drawable; (void)drawable;
return VA_STATUS_ERROR_UNKNOWN; return VA_STATUS_ERROR_UNKNOWN;
} }
......
...@@ -22,7 +22,12 @@ ...@@ -22,7 +22,12 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef ANDROID
#include <va/va_x11.h> #include <va/va_x11.h>
#else
#include "va/va_android.h"
#define Display unsigned int
#endif
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
...@@ -87,7 +92,11 @@ int main(int argc, const char* argv[]) ...@@ -87,7 +92,11 @@ int main(int argc, const char* argv[])
else else
name = argv[0]; name = argv[0];
#ifndef ANDROID
dpy = XOpenDisplay(":0.0"); dpy = XOpenDisplay(":0.0");
#else
dpy = (Display*)malloc(sizeof(Display));
#endif
if (NULL == dpy) if (NULL == dpy)
{ {
fprintf(stderr, "%s: Error, can't open display: '%s'\n", name, display ? display : ""); fprintf(stderr, "%s: Error, can't open display: '%s'\n", name, display ? display : "");
......
...@@ -13,6 +13,7 @@ include $(CLEAR_VARS) ...@@ -13,6 +13,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
va.c \ va.c \
va_trace.c \ va_trace.c \
va_fool.c
LOCAL_CFLAGS += \ LOCAL_CFLAGS += \
-DANDROID \ -DANDROID \
......
...@@ -27,7 +27,7 @@ INCLUDES = \ ...@@ -27,7 +27,7 @@ INCLUDES = \
LDADD = \ LDADD = \
$(LIBVA_LT_LDFLAGS) $(LIBVA_LT_LDFLAGS)
libva_la_SOURCES = va.c va_trace.c libva_la_SOURCES = va.c va_trace.c va_fool.c
libva_ladir = $(libdir) libva_ladir = $(libdir)
libva_la_LDFLAGS = $(LDADD) -no-undefined libva_la_LDFLAGS = $(LDADD) -no-undefined
libva_la_LIBADD = $(LIBVA_LIBS) -ldl libva_la_LIBADD = $(LIBVA_LIBS) -ldl
......
...@@ -250,7 +250,7 @@ VADisplay vaGetDisplay ( ...@@ -250,7 +250,7 @@ VADisplay vaGetDisplay (
pDisplayContext->vaDestroy = va_DisplayContextDestroy; pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName; pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
pDisplayContexts = pDisplayContext; pDisplayContexts = pDisplayContext;
pDriverContext->dri_state = dri_state; pDriverContext->dri_state = dri_state;
dpy = (VADisplay)pDisplayContext; dpy = (VADisplay)pDisplayContext;
} }
else else
...@@ -272,6 +272,33 @@ VADisplay vaGetDisplay ( ...@@ -272,6 +272,33 @@ VADisplay vaGetDisplay (
#ifdef ANDROID #ifdef ANDROID
extern "C" {
extern int fool_postp; /* do nothing for vaPutSurface if set */
extern int trace_flag; /* trace vaPutSurface parameters */
void va_TracePutSurface (
VADisplay dpy,
VASurfaceID surface,
void *draw, /* the target Drawable */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
);
}
#define VA_TRACE(trace_func,...) \
if (trace_flag) { \
trace_func(__VA_ARGS__); \
}
VAStatus vaPutSurface ( VAStatus vaPutSurface (
VADisplay dpy, VADisplay dpy,
VASurfaceID surface, VASurfaceID surface,
...@@ -291,8 +318,16 @@ VAStatus vaPutSurface ( ...@@ -291,8 +318,16 @@ VAStatus vaPutSurface (
{ {
VADriverContextP ctx; VADriverContextP ctx;
if (fool_postp)
return VA_STATUS_SUCCESS;
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
VA_TRACE(va_TracePutSurface, dpy, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch,
destx, desty, destw, desth,
cliprects, number_cliprects, flags );
return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch, return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch,
destx, desty, destw, desth, destx, desty, destw, desth,
cliprects, number_cliprects, flags ); cliprects, number_cliprects, flags );
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "va.h" #include "va.h"
#include "va_backend.h" #include "va_backend.h"
#include "va_trace.h" #include "va_trace.h"
#include "va_fool.h"
#include "config.h" #include "config.h"
#include <assert.h> #include <assert.h>
...@@ -57,17 +58,65 @@ ...@@ -57,17 +58,65 @@
extern int trace_flag; extern int trace_flag;
#define VA_TRACE(trace_func,...) \ #define VA_TRACE(trace_func,...) \
if (trace_flag) { \ if (trace_flag) { \
va_TraceMsg("========%s========\n", __func__); \
trace_func(__VA_ARGS__); \ trace_func(__VA_ARGS__); \
} }
/*
* read a config "env" for libva.conf or from environment setting
* liva.conf has higher priority
* return 0: the "env" is set, and the value is copied into env_value
* 1: the env is not set
*/
int va_parseConfig(char *env, char *env_value)
{
char *token, *value, *saveptr;
char oneline[1024];
FILE *fp=NULL;
if (env == NULL)
return 1;
fp = fopen("/etc/libva.conf", "r");
while (fp && (fgets(oneline, 1024, fp) != NULL)) {
if (strlen(oneline) == 1)
continue;
token = strtok_r(oneline, "=\n", &saveptr);
value = strtok_r(NULL, "=\n", &saveptr);
if (NULL == token || NULL == value)
continue;
if (strcmp(token, env) == 0) {
if (env_value)
strncpy(env_value,value, 1024);
fclose(fp);
return 0;
}
}
if (fp)
fclose(fp);
/* no setting in config file, use env setting */
if (getenv(env)) {
if (env_value)
strncpy(env_value, getenv(env), 1024);
return 0;
}
return 1;
}
int vaDisplayIsValid(VADisplay dpy) int vaDisplayIsValid(VADisplay dpy)
{ {
VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext); return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);
} }
static void va_errorMessage(const char *msg, ...) void va_errorMessage(const char *msg, ...)
{ {
va_list args; va_list args;
...@@ -77,7 +126,7 @@ static void va_errorMessage(const char *msg, ...) ...@@ -77,7 +126,7 @@ static void va_errorMessage(const char *msg, ...)
va_end(args); va_end(args);
} }
static void va_infoMessage(const char *msg, ...) void va_infoMessage(const char *msg, ...)
{ {
va_list args; va_list args;
...@@ -340,7 +389,9 @@ VAStatus vaInitialize ( ...@@ -340,7 +389,9 @@ VAStatus vaInitialize (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
va_TraceInit(); va_TraceInit(dpy);
va_FoolInit(dpy);
va_infoMessage("libva version %s\n", VA_VERSION_S); va_infoMessage("libva version %s\n", VA_VERSION_S);
...@@ -397,7 +448,9 @@ VAStatus vaTerminate ( ...@@ -397,7 +448,9 @@ VAStatus vaTerminate (
if (VA_STATUS_SUCCESS == vaStatus) if (VA_STATUS_SUCCESS == vaStatus)
pDisplayContext->vaDestroy(pDisplayContext); pDisplayContext->vaDestroy(pDisplayContext);
va_TraceEnd(); va_TraceEnd(dpy);
va_FoolEnd(dpy);
return vaStatus; return vaStatus;
} }
...@@ -511,6 +564,7 @@ VAStatus vaCreateConfig ( ...@@ -511,6 +564,7 @@ VAStatus vaCreateConfig (
ctx = CTX(dpy); ctx = CTX(dpy);
VA_TRACE(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id); VA_TRACE(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
va_FoolCreateConfig(dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id ); return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
} }
...@@ -552,11 +606,15 @@ VAStatus vaCreateSurfaces ( ...@@ -552,11 +606,15 @@ VAStatus vaCreateSurfaces (
) )
{ {
VADriverContextP ctx; VADriverContextP ctx;
VAStatus ret;
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
VA_TRACE(va_TraceCreateSurface, dpy, width, height, format, num_surfaces, surfaces); VA_TRACE(va_TraceCreateSurface, dpy, width, height, format, num_surfaces, surfaces);
return ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
ret = ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
va_FoolCreateSurfaces(dpy, width, height, format, num_surfaces, surfaces);
return ret;
} }
...@@ -619,6 +677,8 @@ VAStatus vaCreateBuffer ( ...@@ -619,6 +677,8 @@ VAStatus vaCreateBuffer (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
if (va_FoolCreateBuffer(dpy, context, type, size, num_elements, data, buf_id))
return VA_STATUS_SUCCESS;
return ctx->vtable.vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id); return ctx->vtable.vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
} }
...@@ -643,10 +703,19 @@ VAStatus vaMapBuffer ( ...@@ -643,10 +703,19 @@ VAStatus vaMapBuffer (
) )
{ {
VADriverContextP ctx; VADriverContextP ctx;
VAStatus va_status;
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
if (va_FoolMapBuffer(dpy, buf_id, pbuf))
return VA_STATUS_SUCCESS;
va_status = ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf );
return ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf ); if (va_status == VA_STATUS_SUCCESS)
VA_TRACE(va_TraceMapBuffer, dpy, buf_id, pbuf);
return va_status;
} }
VAStatus vaUnmapBuffer ( VAStatus vaUnmapBuffer (
...@@ -658,6 +727,8 @@ VAStatus vaUnmapBuffer ( ...@@ -658,6 +727,8 @@ VAStatus vaUnmapBuffer (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
if (va_FoolUnmapBuffer(dpy, buf_id))
return VA_STATUS_SUCCESS;
return ctx->vtable.vaUnmapBuffer( ctx, buf_id ); return ctx->vtable.vaUnmapBuffer( ctx, buf_id );
} }
...@@ -699,7 +770,11 @@ VAStatus vaBeginPicture ( ...@@ -699,7 +770,11 @@ VAStatus vaBeginPicture (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
VA_TRACE(va_TraceBeginPicture, ctx, context, render_target); VA_TRACE(va_TraceBeginPicture, dpy, context, render_target);
if (va_FoolBeginPicture(dpy, context, render_target))
return VA_STATUS_SUCCESS;
return ctx->vtable.vaBeginPicture( ctx, context, render_target ); return ctx->vtable.vaBeginPicture( ctx, context, render_target );
} }
...@@ -714,7 +789,11 @@ VAStatus vaRenderPicture ( ...@@ -714,7 +789,11 @@ VAStatus vaRenderPicture (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
if (va_FoolRenderPicture(dpy, context, buffers, num_buffers))
return VA_STATUS_SUCCESS;
VA_TRACE(va_TraceRenderPicture, dpy, context, buffers, num_buffers); VA_TRACE(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers ); return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers );
} }
...@@ -728,8 +807,15 @@ VAStatus vaEndPicture ( ...@@ -728,8 +807,15 @@ VAStatus vaEndPicture (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
if (va_FoolEndPicture(dpy, context)) {
VA_TRACE(va_TraceEndPicture, dpy, context);
return VA_STATUS_SUCCESS;
}
va_status = ctx->vtable.vaEndPicture( ctx, context ); va_status = ctx->vtable.vaEndPicture( ctx, context );
VA_TRACE(va_TraceEndPicture, dpy, context); VA_TRACE(va_TraceEndPicture, dpy, context);
return va_status; return va_status;
} }
...@@ -742,6 +828,9 @@ VAStatus vaSyncSurface ( ...@@ -742,6 +828,9 @@ VAStatus vaSyncSurface (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
if (va_FoolSyncSurface( dpy, render_target))
return VA_STATUS_SUCCESS;
return ctx->vtable.vaSyncSurface( ctx, render_target ); return ctx->vtable.vaSyncSurface( ctx, render_target );
} }
...@@ -953,6 +1042,8 @@ VAStatus vaQuerySubpictureFormats ( ...@@ -953,6 +1042,8 @@ VAStatus vaQuerySubpictureFormats (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
if (va_FoolQuerySubpictureFormats(dpy, format_list, flags, num_formats))
return VA_STATUS_SUCCESS;
return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats); return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
} }
...@@ -1096,10 +1187,16 @@ int vaMaxNumDisplayAttributes ( ...@@ -1096,10 +1187,16 @@ int vaMaxNumDisplayAttributes (
VADisplay dpy VADisplay dpy
) )
{ {
int tmp;
if( !vaDisplayIsValid(dpy) ) if( !vaDisplayIsValid(dpy) )
return 0; return 0;
return CTX(dpy)->max_display_attributes; tmp = CTX(dpy)->max_display_attributes;
VA_TRACE(va_TraceMaxNumDisplayAttributes, dpy, tmp);
return tmp;
} }
/* /*
...@@ -1118,7 +1215,14 @@ VAStatus vaQueryDisplayAttributes ( ...@@ -1118,7 +1215,14 @@ VAStatus vaQueryDisplayAttributes (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
return ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes ); VAStatus va_status;
va_status = ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
VA_TRACE(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
return va_status;
} }
/* /*
...@@ -1137,7 +1241,13 @@ VAStatus vaGetDisplayAttributes ( ...@@ -1137,7 +1241,13 @@ VAStatus vaGetDisplayAttributes (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
return ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes ); VAStatus va_status;
va_status = ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
VA_TRACE(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
return va_status;
} }
/* /*
...@@ -1156,6 +1266,9 @@ VAStatus vaSetDisplayAttributes ( ...@@ -1156,6 +1266,9 @@ VAStatus vaSetDisplayAttributes (
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
VA_TRACE(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes ); return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
} }
......
...@@ -128,6 +128,8 @@ typedef int VAStatus; /* Return status type from functions */ ...@@ -128,6 +128,8 @@ typedef int VAStatus; /* Return status type from functions */
#define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014 #define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014
#define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015 #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015
#define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016 #define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016
#define VA_STATUS_ERROR_DECODING_ERROR 0x00000017
#define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
/* De-interlacing flags for vaPutSurface() */ /* De-interlacing flags for vaPutSurface() */
...@@ -135,12 +137,20 @@ typedef int VAStatus; /* Return status type from functions */ ...@@ -135,12 +137,20 @@ typedef int VAStatus; /* Return status type from functions */
#define VA_TOP_FIELD 0x00000001 #define VA_TOP_FIELD 0x00000001
#define VA_BOTTOM_FIELD 0x00000002 #define VA_BOTTOM_FIELD 0x00000002
/*
* Enabled the positioning/cropping/blending feature:
* 1, specify the video playback position in the isurface
* 2, specify the cropping info for video playback
* 3, encoded video will blend with background color
*/
#define VA_ENABLE_BLEND 0x00000004 /* video area blend with the constant color */
/* /*
* Clears the drawable with background color. * Clears the drawable with background color.
* for hardware overlay based implementation this flag * for hardware overlay based implementation this flag
* can be used to turn off the overlay * can be used to turn off the overlay
*/ */
#define VA_CLEAR_DRAWABLE 0x00000008 #define VA_CLEAR_DRAWABLE 0x00000008
/* Color space conversion flags for vaPutSurface() */ /* Color space conversion flags for vaPutSurface() */
#define VA_SRC_BT601 0x00000010 #define VA_SRC_BT601 0x00000010
...@@ -273,6 +283,7 @@ typedef struct _VAConfigAttrib { ...@@ -273,6 +283,7 @@ typedef struct _VAConfigAttrib {
#define VA_RC_NONE 0x00000001 #define VA_RC_NONE 0x00000001
#define VA_RC_CBR 0x00000002 #define VA_RC_CBR 0x00000002
#define VA_RC_VBR 0x00000004 #define VA_RC_VBR 0x00000004
#define VA_RC_VCM 0x00000008 /* video conference mode */
/* /*
* if an attribute is not applicable for a given * if an attribute is not applicable for a given
...@@ -502,8 +513,75 @@ typedef enum ...@@ -502,8 +513,75 @@ typedef enum
VAEncSliceParameterBufferType = 24, VAEncSliceParameterBufferType = 24,
VAEncH264VUIBufferType = 25, VAEncH264VUIBufferType = 25,
VAEncH264SEIBufferType = 26, VAEncH264SEIBufferType = 26,
VAEncMiscParameterBufferType = 27,
VABufferTypeMax = 0xff
} VABufferType; } VABufferType;
typedef enum
{
VAEncMiscParameterTypeFrameRate = 0,
VAEncMiscParameterTypeRateControl = 1,
VAEncMiscParameterTypeMaxSliceSize = 2,
VAEncMiscParameterTypeAIR = 3,
} VAEncMiscParameterType;
/*
* For application, e.g. set a new bitrate
* VABufferID buf_id;
* VAEncMiscParameterBuffer *misc_param;
* VAEncMiscParameterRateControl *misc_rate_ctrl;
*
* vaCreateBuffer(dpy, context, VAEncMiscParameterBufferType,
* sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterRateControl),
* 1, NULL, &buf_id);
*
* vaMapBuffer(dpy,buf_id,(void **)&misc_param);
* misc_param->type = VAEncMiscParameterTypeRateControl;
* misc_rate_ctrl= (VAEncMiscParameterRateControl *)misc_param->data;
* misc_rate_ctrl->bits_per_second = 6400000;
* vaUnmapBuffer(dpy, buf_id);
* vaRenderPicture(dpy, context, &buf_id, 1);
*/
typedef struct _VAEncMiscParameterBuffer
{
VAEncMiscParameterType type;
unsigned int data[0];
} VAEncMiscParameterBuffer;
typedef struct _VAEncMiscParameterRateControl
{
unsigned int bits_per_second; /* this is the maximum bit-rate to be constrained by the rate control implementation */
unsigned int target_percentage; /* this is the bit-rate the rate control is targeting, as a percentage of the maximum bit-rate */
/* for example if target_percentage is 95 then the rate control will target a bit-rate that is */
/* 95% of the maximum bit-rate */
unsigned int window_size; /* windows size in milliseconds. For example if this is set to 500, then the rate control will guarantee the */
/* target bit-rate over a 500 ms window */
unsigned int initial_qp; /* initial QP at I frames */
unsigned int min_qp;
} VAEncMiscParameterRateControl;
typedef struct _VAEncMiscParameterFrameRate
{
unsigned int framerate;
} VAEncMiscParameterFrameRate;
/*
* Allow a maximum slice size to be specified (in bits).
* The encoder will attempt to make sure that individual slices do not exceed this size
* Or to signal applicate if the slice size exceed this size, see "status" of VACodedBufferSegment
*/
typedef struct _VAEncMiscParameterMaxSliceSize
{
unsigned int max_slice_size;
} VAEncMiscParameterMaxSliceSize;
typedef struct _VAEncMiscParameterAIR
{
unsigned int air_num_mbs;
unsigned int air_threshold;
unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
} VAEncMiscParameterAIR;
/* /*
* There will be cases where the bitstream buffer will not have enough room to hold * There will be cases where the bitstream buffer will not have enough room to hold
...@@ -1115,6 +1193,8 @@ typedef struct _VAEncSequenceParameterBufferH264 ...@@ -1115,6 +1193,8 @@ typedef struct _VAEncSequenceParameterBufferH264
unsigned char vui_flag; unsigned char vui_flag;
} VAEncSequenceParameterBufferH264; } VAEncSequenceParameterBufferH264;
#define H264_LAST_PICTURE_EOSEQ 0x01 /* the last picture in the sequence */
#define H264_LAST_PICTURE_EOSTREAM 0x02 /* the last picture in the stream */
typedef struct _VAEncPictureParameterBufferH264 typedef struct _VAEncPictureParameterBufferH264
{ {
VASurfaceID reference_picture; VASurfaceID reference_picture;
...@@ -1122,9 +1202,7 @@ typedef struct _VAEncPictureParameterBufferH264 ...@@ -1122,9 +1202,7 @@ typedef struct _VAEncPictureParameterBufferH264
VABufferID coded_buf; VABufferID coded_buf;
unsigned short picture_width; unsigned short picture_width;
unsigned short picture_height; unsigned short picture_height;
unsigned char last_picture; /* if set to 1 it indicates the last picture in the sequence unsigned char last_picture;
* if set to 2 it indicates the last picture of the stream
*/
} VAEncPictureParameterBufferH264; } VAEncPictureParameterBufferH264;
/**************************** /****************************
...@@ -1225,9 +1303,26 @@ VAStatus vaBufferSetNumElements ( ...@@ -1225,9 +1303,26 @@ VAStatus vaBufferSetNumElements (
/* /*
* device independent data structure for codedbuffer * device independent data structure for codedbuffer
*/ */
typedef struct _VACodedBufferSegment {
unsigned int size; /* size of the data buffer in the coded buffer segment, in bytes */ /*
unsigned int bit_offset;/* bit offset into the data buffer where valid bitstream data begins */ * FICTURE_AVE_QP(bit7-0): The average Qp value used during this frame
* LARGE_SLICE(bit8):At least one slice in the current frame was large
* enough for the encoder to attempt to limit its size.
* SLICE_OVERFLOW(bit9): At least one slice in the current frame has
* exceeded the maximum slice size specified.
*/
#define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK 0xff
#define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK 0x100
#define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK 0x200
/*
* device independent data structure for codedbuffer
*/
typedef struct _VACodedBufferSegment {
unsigned int size;/* size of the data buffer in the coded buffer segment, in bytes */
unsigned int bit_offset; /* bit offset into the data buffer where valid bitstream data begins */
unsigned int status; /* status set by the driver on the coded buffer*/
unsigned int reserved; /* for future use */
void *buf; /* pointer to the beginning of the data buffer in the coded buffer segment */ void *buf; /* pointer to the beginning of the data buffer in the coded buffer segment */
void *next; /* pointer to the next VACodedBufferSegment */ void *next; /* pointer to the next VACodedBufferSegment */
} VACodedBufferSegment; } VACodedBufferSegment;
...@@ -1713,7 +1808,10 @@ typedef enum ...@@ -1713,7 +1808,10 @@ typedef enum
VADisplayAttribContrast = 1, VADisplayAttribContrast = 1,
VADisplayAttribHue = 2, VADisplayAttribHue = 2,
VADisplayAttribSaturation = 3, VADisplayAttribSaturation = 3,
/* client can specifiy a background color for the target window */ /* client can specifiy a background color for the target window
* the new feature of video conference,
* the uncovered area of the surface is filled by this color
* also it will blend with the decoded video color*/
VADisplayAttribBackgroundColor = 4, VADisplayAttribBackgroundColor = 4,
/* /*
* this is a gettable only attribute. For some implementations that use the * this is a gettable only attribute. For some implementations that use the
...@@ -1739,7 +1837,15 @@ typedef enum ...@@ -1739,7 +1837,15 @@ typedef enum
* For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color
* conversion matrix. Each element in the matrix is float-point * conversion matrix. Each element in the matrix is float-point
*/ */
VADisplayAttribCSCMatrix = 12 VADisplayAttribCSCMatrix = 12,
/* specify the constant color used to blend with video surface
* Cd = Cv*Cc*Ac + Cb *(1 - Ac) C means the constant RGB
* d: the final color to overwrite into the frame buffer
* v: decoded video after color conversion,
* c: video color specified by VADisplayAttribBlendColor
* b: background color of the drawable
*/
VADisplayAttribBlendColor = 13,
} VADisplayAttribType; } VADisplayAttribType;
/* flags for VADisplayAttribute */ /* flags for VADisplayAttribute */
......
...@@ -19,8 +19,8 @@ VADisplay vaGetDisplay ( ...@@ -19,8 +19,8 @@ VADisplay vaGetDisplay (
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
#ifdef ANDROID #ifdef ANDROID
#include <ui/ISurface.h> #include <surfaceflinger/ISurface.h>
using namespace android; using namespace android;
/* /*
......
This diff is collapsed.
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
#ifndef VA_TRACE_H #ifndef VA_TRACE_H
#define VA_TRACE_H #define VA_TRACE_H
void va_TraceInit(void); void va_TraceInit(VADisplay dpy);
void va_TraceEnd(void); void va_TraceEnd(VADisplay dpy);
void va_TraceMsg(const char *msg, ...); void va_TraceMsg(int idx, const char *msg, ...);
void va_TraceCreateConfig( void va_TraceCreateConfig(
VADisplay dpy, VADisplay dpy,
...@@ -59,6 +59,14 @@ void va_TraceCreateContext( ...@@ -59,6 +59,14 @@ void va_TraceCreateContext(
VAContextID *context /* out */ VAContextID *context /* out */
); );
void va_TraceMapBuffer (
VADisplay dpy,
VABufferID buf_id, /* in */
void **pbuf /* out */
);
void va_TraceBeginPicture( void va_TraceBeginPicture(
VADisplay dpy, VADisplay dpy,
VAContextID context, VAContextID context,
...@@ -77,4 +85,48 @@ void va_TraceEndPicture( ...@@ -77,4 +85,48 @@ void va_TraceEndPicture(
VAContextID context VAContextID context
); );
void va_TraceMaxNumDisplayAttributes (
VADisplay dpy,
int number
);
void va_TraceQueryDisplayAttributes (
VADisplay dpy,
VADisplayAttribute *attr_list, /* out */
int *num_attributes /* out */
);
void va_TraceGetDisplayAttributes (
VADisplay dpy,
VADisplayAttribute *attr_list,
int num_attributes
);
void va_TraceSetDisplayAttributes (
VADisplay dpy,
VADisplayAttribute *attr_list,
int num_attributes
);
/* extern function called by display side */
void va_TracePutSurface (
VADisplay dpy,
VASurfaceID surface,
void *draw, /* the target Drawable */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
);
#endif /* VA_TRACE_H */ #endif /* VA_TRACE_H */
...@@ -231,6 +231,31 @@ VADisplay vaGetDisplay ( ...@@ -231,6 +231,31 @@ VADisplay vaGetDisplay (
#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext) #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
#define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; } #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
extern int fool_postp; /* do nothing for vaPutSurface if set */
extern int trace_flag; /* trace vaPutSurface parameters */
#define VA_TRACE(trace_func,...) \
if (trace_flag) { \
trace_func(__VA_ARGS__); \
}
void va_TracePutSurface (
VADisplay dpy,
VASurfaceID surface,
void *draw, /* the target Drawable */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
);
VAStatus vaPutSurface ( VAStatus vaPutSurface (
VADisplay dpy, VADisplay dpy,
VASurfaceID surface, VASurfaceID surface,
...@@ -250,9 +275,16 @@ VAStatus vaPutSurface ( ...@@ -250,9 +275,16 @@ VAStatus vaPutSurface (
{ {
VADriverContextP ctx; VADriverContextP ctx;
if (fool_postp)
return VA_STATUS_SUCCESS;
CHECK_DISPLAY(dpy); CHECK_DISPLAY(dpy);
ctx = CTX(dpy); ctx = CTX(dpy);
VA_TRACE(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch,
destx, desty, destw, desth,
cliprects, number_cliprects, flags );
return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch, return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
destx, desty, destw, desth, destx, desty, destw, desth,
cliprects, number_cliprects, flags ); cliprects, number_cliprects, flags );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment