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;
/* /*
......
...@@ -34,23 +34,87 @@ ...@@ -34,23 +34,87 @@
#include <string.h> #include <string.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
/*
* Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio:
* .LIBVA_TRACE=log_file: general VA parameters saved into log_file
* .LIBVA_TRACE_BUFDATA: dump VA buffer data into log_file (if not set, just calculate a checksum)
* .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file coded_clip_file
* .LIBVA_TRACE_SURFACE=decoded_yuv_file: save the decoded YUV file decoded_yuv_file
* .LIBVA_TRACE_LOGSIZE=numeric number: truncate the log_file or coded_clip_file, or decoded_yuv_file
* when the size is bigger than the number
*/
/* global settings */
/* LIBVA_TRACE */
unsigned int trace_flag = 0; unsigned int trace_flag = 0;
static const char *trace_file = 0; /* LIBVA_TRACE_LOGSIZE */
static FILE *trace_fp = 0; static unsigned int trace_logsize = 0xffffffff; /* truncate the log when the size is bigger than it */
/* LIBVA_TRACE_BUFDATA */
static unsigned int trace_buffer_data; /* dump buffer data or not */
#define TRACE_CONTEXT_MAX 4
/* per context settings */
static struct _trace_context {
VADisplay dpy; /* should use context as the key */
/* LIBVA_TRACE */
FILE *trace_fp_log; /* save the log into a file */
char trace_log_fn[1024]; /* file name */
/* LIBVA_TRACE_CODEDBUF */
FILE *trace_fp_codedbuf; /* save the encode result into a file */
char trace_codedbuf_fn[1024]; /* file name */
/* LIBVA_TRACE_SURFACE */
FILE *trace_fp_surface; /* save the surface YUV into a file */
char trace_surface_fn[1024]; /* file name */
VAContextID trace_context; /* current context */
VASurfaceID trace_rendertarget; /* current render target */
VAProfile trace_profile; /* current profile for buffers */
VAEntrypoint trace_entrypoint; /* current entrypoint */
VABufferID trace_codedbuf;
unsigned int trace_frame_no; /* current frame NO */
unsigned int trace_slice_no; /* current slice NO */
unsigned int trace_slice_size; /* current slice buffer size */
unsigned int trace_frame_width; /* current frame width */
unsigned int trace_frame_height; /* current frame height */
unsigned int trace_sequence_start; /* get a new sequence for encoding or not */
} trace_context[TRACE_CONTEXT_MAX] = { {0} }; /* trace five context at the same time */
#define DPY2INDEX(dpy) \
int idx; \
\
for (idx = 0; idx < TRACE_CONTEXT_MAX; idx++) \
if (trace_context[idx].dpy == dpy) \
break; \
\
if (idx == TRACE_CONTEXT_MAX) \
return;
#define TRACE_FUNCNAME(idx) va_TraceMsg(idx, "==========%s\n", __func__);
static VASurfaceID trace_rendertarget; /* current render target */ /* Prototype declarations (functions defined in va.c) */
static VAProfile trace_profile; /* current entrypoint for buffers */
static unsigned int trace_frame; void va_errorMessage(const char *msg, ...);
static unsigned int trace_slice; void va_infoMessage(const char *msg, ...);
static unsigned int trace_width; int va_parseConfig(char *env, char *env_value);
static unsigned int trace_height;
/* Prototypes (functions defined in va.c) */ VAStatus vaBufferInfo(
VAStatus vaBufferInfo (
VADisplay dpy, VADisplay dpy,
VAContextID context, /* in */ VAContextID context, /* in */
VABufferID buf_id, /* in */ VABufferID buf_id, /* in */
...@@ -76,45 +140,263 @@ VAStatus vaUnlockSurface(VADisplay dpy, ...@@ -76,45 +140,263 @@ VAStatus vaUnlockSurface(VADisplay dpy,
VASurfaceID surface VASurfaceID surface
); );
void va_TraceInit(void)
void va_TraceInit(VADisplay dpy)
{ {
trace_file = (const char *)getenv("LIBVA_TRACE"); char env_value[1024];
if (trace_file) { unsigned int suffix = 0xffff & ((unsigned int)time(NULL));
trace_fp = fopen(trace_file, "w"); int trace_index = 0;
if (trace_fp) FILE *tmp;
trace_flag = 1;
for (trace_index = 0; trace_index < TRACE_CONTEXT_MAX; trace_index++)
if (trace_context[trace_index].dpy == 0)
break;
if (trace_index == TRACE_CONTEXT_MAX)
return;
if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
trace_flag = 1;
sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
tmp = fopen(env_value, "w");
if (tmp) {
trace_context[trace_index].trace_fp_log = tmp;
strcpy(trace_context[trace_index].trace_log_fn, env_value);
} else {
trace_context[trace_index].trace_fp_log = stderr;
strcpy(trace_context[trace_index].trace_codedbuf_fn, "/dev/stderr");
}
va_infoMessage("LIBVA_TRACE is on, save log into %s\n", trace_context[trace_index].trace_log_fn);
}
if (trace_flag == 0)
return;
/* may re-get the global settings for multiple context */
if (va_parseConfig("LIBVA_TRACE_LOGSIZE", &env_value[0]) == 0) {
trace_logsize = atoi(env_value);
va_infoMessage("LIBVA_TRACE_LOGSIZE is on, size is %d\n", trace_logsize);
}
if (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0) {
trace_buffer_data = 1; /* dump buffer data */
va_infoMessage("LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
}
/* per-context setting */
if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) {
sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
tmp = fopen(env_value, "w");
if (tmp) {
trace_context[trace_index].trace_fp_codedbuf = tmp;
strcpy(trace_context[trace_index].trace_codedbuf_fn, env_value);
} else {
trace_context[trace_index].trace_fp_codedbuf = stderr;
strcpy(trace_context[trace_index].trace_codedbuf_fn, "/dev/stderr");
}
va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save coded clip into %s\n", trace_context[trace_index].trace_codedbuf_fn);
}
if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) {
sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
tmp = fopen(env_value, "w");
if (tmp) {
trace_context[trace_index].trace_fp_surface = tmp;
strcpy(trace_context[trace_index].trace_surface_fn, env_value);
} else {
trace_context[trace_index].trace_fp_surface = stderr;
strcpy(trace_context[trace_index].trace_surface_fn, "/dev/stderr");
}
va_infoMessage("LIBVA_TRACE_SURFACE is on, save coded clip into %s\n", trace_context[trace_index].trace_surface_fn);
} }
trace_context[trace_index].dpy = dpy;
} }
void va_TraceEnd(void)
void va_TraceEnd(VADisplay dpy)
{ {
if (trace_file && trace_fp) { DPY2INDEX(dpy);
fclose(trace_fp);
if (trace_context[idx].trace_fp_log && (trace_context[idx].trace_fp_log != stderr))
fclose(trace_context[idx].trace_fp_log);
if (trace_context[idx].trace_fp_codedbuf && (trace_context[idx].trace_fp_codedbuf != stderr))
fclose(trace_context[idx].trace_fp_codedbuf);
if (trace_context[idx].trace_fp_surface && (trace_context[idx].trace_fp_surface != stderr))
fclose(trace_context[idx].trace_fp_surface);
memset(&trace_context[idx], sizeof(struct _trace_context), 0);
}
trace_file = NULL; static unsigned int file_size(FILE *fp)
trace_fp = NULL; {
struct stat buf;
trace_flag = 0; fstat(fileno(fp), &buf);
trace_width = 0; return buf.st_size;
trace_height = 0;
}
} }
void va_TraceMsg(const char *msg, ...)
static void truncate_file(FILE *fp)
{
ftruncate(fileno(fp), 0);
rewind(fp);
}
void va_TraceMsg(int idx, const char *msg, ...)
{ {
va_list args; va_list args;
if (file_size(trace_context[idx].trace_fp_log) >= trace_logsize)
truncate_file(trace_context[idx].trace_fp_log);
if (msg) { if (msg) {
va_start(args, msg); va_start(args, msg);
vfprintf(trace_fp, msg, args); vfprintf(trace_context[idx].trace_fp_log, msg, args);
va_end(args); va_end(args);
} else { } else
fflush(trace_fp); fflush(trace_context[idx].trace_fp_log);
}
void va_TraceCodedBuf(VADisplay dpy)
{
VACodedBufferSegment *buf_list = NULL;
VAStatus va_status;
unsigned char check_sum = 0;
DPY2INDEX(dpy);
/* can only truncate at a sequence boudary */
if (((file_size(trace_context[idx].trace_fp_log) >= trace_logsize))
&& trace_context[idx].trace_sequence_start) {
va_TraceMsg(idx, "==========truncate file %s\n", trace_context[idx].trace_codedbuf_fn);
truncate_file(trace_context[idx].trace_fp_log);
} }
trace_context[idx].trace_sequence_start = 0; /* only truncate coded file when meet next new sequence */
va_status = vaMapBuffer(dpy, trace_context[idx].trace_codedbuf, (void **)(&buf_list));
if (va_status != VA_STATUS_SUCCESS)
return;
va_TraceMsg(idx, "==========dump codedbuf into file %s\n", trace_context[idx].trace_codedbuf_fn);
while (buf_list != NULL) {
unsigned int i;
va_TraceMsg(idx, "\tsize = %d\n", buf_list->size);
if (trace_context[idx].trace_fp_log)
fwrite(buf_list->buf, buf_list->size, 1, trace_context[idx].trace_fp_codedbuf);
for (i=0; i<buf_list->size; i++)
check_sum ^= *((unsigned char *)buf_list->buf + i);
buf_list = buf_list->next;
}
vaUnmapBuffer(dpy,trace_context[idx].trace_codedbuf);
va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum);
} }
void va_TraceSurface(VADisplay dpy)
{
unsigned int i, j;
unsigned int fourcc; /* following are output argument */
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 = NULL;
unsigned char *Y_data, *UV_data, *tmp;
VAStatus va_status;
unsigned char check_sum = 0;
DPY2INDEX(dpy);
va_TraceMsg(idx, "==========dump surface data in file %s\n", trace_context[idx].trace_surface_fn);
if ((file_size(trace_context[idx].trace_fp_surface) >= trace_logsize)) {
va_TraceMsg(idx, "==========truncate file %s\n", trace_context[idx].trace_surface_fn);
truncate_file(trace_context[idx].trace_fp_surface);
}
va_status = vaLockSurface(dpy, trace_context[idx].trace_rendertarget, &fourcc,
&luma_stride, &chroma_u_stride, &chroma_v_stride,
&luma_offset, &chroma_u_offset, &chroma_v_offset,
&buffer_name, &buffer);
if (va_status != VA_STATUS_SUCCESS) {
va_TraceMsg(idx, "Error:vaLockSurface failed\n");
return;
}
va_TraceMsg(idx, "\tfourcc = 0x%08x\n", fourcc);
va_TraceMsg(idx, "\twidth = %d\n", trace_context[idx].trace_frame_width);
va_TraceMsg(idx, "\theight = %d\n", trace_context[idx].trace_frame_height);
va_TraceMsg(idx, "\tluma_stride = %d\n", luma_stride);
va_TraceMsg(idx, "\tchroma_u_stride = %d\n", chroma_u_stride);
va_TraceMsg(idx, "\tchroma_v_stride = %d\n", chroma_v_stride);
va_TraceMsg(idx, "\tluma_offset = %d\n", luma_offset);
va_TraceMsg(idx, "\tchroma_u_offset = %d\n", chroma_u_offset);
va_TraceMsg(idx, "\tchroma_v_offset = %d\n", chroma_v_offset);
if (*(unsigned int *)buffer == 0) {
va_TraceMsg(idx, "Error:vaLockSurface return NULL buffer\n");
vaUnlockSurface(dpy, trace_context[idx].trace_rendertarget);
return;
}
va_TraceMsg(idx, "\tbuffer location = 0x%08x\n", buffer);
Y_data = buffer;
UV_data = buffer + chroma_u_offset;
tmp = Y_data;
for (i=0; i<trace_context[idx].trace_frame_height; i++) {
for (j=0; j<trace_context[idx].trace_frame_width; j++)
check_sum ^= tmp[j];
if (trace_context[idx].trace_fp_surface)
fwrite(tmp, trace_context[idx].trace_frame_width, 1, trace_context[idx].trace_fp_surface);
tmp = Y_data + i * luma_stride;
}
tmp = UV_data;
if (fourcc == VA_FOURCC_NV12) {
for (i=0; i<trace_context[idx].trace_frame_height/2; i++) {
for (j=0; j<trace_context[idx].trace_frame_width; j++)
check_sum ^= tmp[j];
if (trace_context[idx].trace_fp_surface)
fwrite(tmp, trace_context[idx].trace_frame_width, 1, trace_context[idx].trace_fp_surface);
tmp = UV_data + i * chroma_u_stride;
}
}
vaUnlockSurface(dpy, trace_context[idx].trace_rendertarget);
va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum & 0xff);
}
void va_TraceCreateConfig( void va_TraceCreateConfig(
VADisplay dpy, VADisplay dpy,
VAProfile profile, VAProfile profile,
...@@ -122,19 +404,23 @@ void va_TraceCreateConfig( ...@@ -122,19 +404,23 @@ void va_TraceCreateConfig(
VAConfigAttrib *attrib_list, VAConfigAttrib *attrib_list,
int num_attribs, int num_attribs,
VAConfigID *config_id /* out */ VAConfigID *config_id /* out */
) )
{ {
int i; int i;
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
va_TraceMsg("\tprofile = %d\n", profile); va_TraceMsg(idx, "\tprofile = %d\n", profile);
va_TraceMsg("\tentrypoint = %d\n", entrypoint); va_TraceMsg(idx, "\tentrypoint = %d\n", entrypoint);
va_TraceMsg("\tnum_attribs = %d\n", num_attribs); va_TraceMsg(idx, "\tnum_attribs = %d\n", num_attribs);
for (i = 0; i < num_attribs; i++) { for (i = 0; i < num_attribs; i++) {
va_TraceMsg("\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type); va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
va_TraceMsg("\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value); va_TraceMsg(idx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
} }
trace_profile = profile; trace_context[idx].trace_profile = profile;
trace_context[idx].trace_entrypoint = entrypoint;
} }
...@@ -145,17 +431,20 @@ void va_TraceCreateSurface( ...@@ -145,17 +431,20 @@ void va_TraceCreateSurface(
int format, int format,
int num_surfaces, int num_surfaces,
VASurfaceID *surfaces /* out */ VASurfaceID *surfaces /* out */
) )
{ {
int i; int i;
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
va_TraceMsg("\twidth = %d\n", width); va_TraceMsg(idx, "\twidth = %d\n", width);
va_TraceMsg("\theight = %d\n", height); va_TraceMsg(idx, "\theight = %d\n", height);
va_TraceMsg("\tformat = %d\n", format); va_TraceMsg(idx, "\tformat = %d\n", format);
va_TraceMsg("\tnum_surfaces = %d\n", num_surfaces); va_TraceMsg(idx, "\tnum_surfaces = %d\n", num_surfaces);
for (i = 0; i < num_surfaces; i++) for (i = 0; i < num_surfaces; i++)
va_TraceMsg("\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]); va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
} }
...@@ -168,24 +457,29 @@ void va_TraceCreateContext( ...@@ -168,24 +457,29 @@ void va_TraceCreateContext(
VASurfaceID *render_targets, VASurfaceID *render_targets,
int num_render_targets, int num_render_targets,
VAContextID *context /* out */ VAContextID *context /* out */
) )
{ {
int i; int i;
DPY2INDEX(dpy);
va_TraceMsg("\twidth = %d\n", picture_width); TRACE_FUNCNAME(idx);
va_TraceMsg("\theight = %d\n", picture_height);
va_TraceMsg("\tflag = 0x%08x\n", flag); va_TraceMsg(idx, "\twidth = %d\n", picture_width);
va_TraceMsg("\tnum_render_targets = %d\n", num_render_targets); va_TraceMsg(idx, "\theight = %d\n", picture_height);
va_TraceMsg(idx, "\tflag = 0x%08x\n", flag);
va_TraceMsg(idx, "\tnum_render_targets = %d\n", num_render_targets);
for (i=0; i<num_render_targets; i++) for (i=0; i<num_render_targets; i++)
va_TraceMsg("\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]); va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
va_TraceMsg("\tcontext = 0x%08x\n", context); va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context);
trace_frame = 0; trace_context[idx].trace_context = *context;
trace_slice = 0;
trace_width = picture_width; trace_context[idx].trace_frame_no = 0;
trace_height = picture_height; trace_context[idx].trace_slice_no = 0;
trace_context[idx].trace_frame_width = picture_width;
trace_context[idx].trace_frame_height = picture_height;
} }
...@@ -207,12 +501,55 @@ static char * buffer_type_to_string(int type) ...@@ -207,12 +501,55 @@ static char * buffer_type_to_string(int type)
case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType"; case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType";
case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType"; case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType";
case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType"; case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType";
case VAEncMiscParameterBufferType: return "VAEncMiscParameterBufferType";
default: return "UnknowBuffer"; default: return "UnknowBuffer";
} }
} }
void va_TraceMapBuffer (
VADisplay dpy,
VABufferID buf_id, /* in */
void **pbuf /* out */
)
{
VABufferType type;
unsigned int size;
unsigned int num_elements;
VACodedBufferSegment *buf_list;
int i = 0;
DPY2INDEX(dpy);
vaBufferInfo(dpy, trace_context[idx].trace_context, buf_id, &type, &size, &num_elements);
/*
va_TraceMsg(idx, "\tbuf_id=0x%x\n", buf_id);
va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
va_TraceMsg(idx, "\tbuf_size=%s\n", size);
va_TraceMsg(idx, "\tbuf_elements=%s\n", &num_elements);
*/
/* only trace CodedBuffer */
if (type != VAEncCodedBufferType)
return;
buf_list = (VACodedBufferSegment *)(*pbuf);
while (buf_list != NULL) {
va_TraceMsg(idx, "\tCodedbuf[%d] =\n", i++);
va_TraceMsg(idx, "\t size = %d\n", buf_list->size);
va_TraceMsg(idx, "\t bit_offset = %d\n", buf_list->bit_offset);
va_TraceMsg(idx, "\t status = 0x%08x\n", buf_list->status);
va_TraceMsg(idx, "\t reserved = 0x%08x\n", buf_list->reserved);
va_TraceMsg(idx, "\t buf = 0x%08x\n", buf_list->buf);
buf_list = buf_list->next;
}
}
static int va_TraceVABuffers( static void va_TraceVABuffers(
VADisplay dpy, VADisplay dpy,
VAContextID context, VAContextID context,
VABufferID buffer, VABufferID buffer,
...@@ -220,21 +557,30 @@ static int va_TraceVABuffers( ...@@ -220,21 +557,30 @@ static int va_TraceVABuffers(
unsigned int size, unsigned int size,
unsigned int num_elements, unsigned int num_elements,
void *pbuf void *pbuf
) )
{ {
int i; unsigned int i;
unsigned char *p = pbuf; unsigned char *p = pbuf;
unsigned int *pi = (unsigned int *)pbuf; unsigned char check_sum = 0;
DPY2INDEX(dpy);
va_TraceMsg(idx, "%s\n", buffer_type_to_string(type));
va_TraceMsg("***Buffer Data***");
for (i=0; i<size; i++) { for (i=0; i<size; i++) {
if ((i%16) == 0) unsigned char value = p[i];
va_TraceMsg("\n0x%08x:", i);
va_TraceMsg(" %02x", p[i]); if ((trace_buffer_data) && ((i%16) == 0))
va_TraceMsg(idx, "\n0x%08x:", i);
if (trace_buffer_data)
va_TraceMsg(idx, " %02x", value);
check_sum ^= value;
} }
va_TraceMsg("\n"); va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum & 0xff);
return 0;
return;
} }
...@@ -247,6 +593,8 @@ static void va_TraceVAPictureParameterBufferMPEG2( ...@@ -247,6 +593,8 @@ static void va_TraceVAPictureParameterBufferMPEG2(
unsigned int num_elements, unsigned int num_elements,
void *data) void *data)
{ {
DPY2INDEX(dpy);
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
return; return;
...@@ -262,6 +610,8 @@ static void va_TraceVAIQMatrixBufferMPEG2( ...@@ -262,6 +610,8 @@ static void va_TraceVAIQMatrixBufferMPEG2(
unsigned int num_elements, unsigned int num_elements,
void *data) void *data)
{ {
DPY2INDEX(dpy);
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
return; return;
...@@ -277,6 +627,12 @@ static void va_TraceVASliceParameterBufferMPEG2( ...@@ -277,6 +627,12 @@ static void va_TraceVASliceParameterBufferMPEG2(
unsigned int num_elements, unsigned int num_elements,
void *data) void *data)
{ {
DPY2INDEX(dpy);
trace_context[idx].trace_slice_no++;
/* todo: log TraceVASliceParameterBufferMPEG2 */
/* trace_context[idx].trace_slice_size = p->slice_data_size; */
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
return; return;
...@@ -293,6 +649,8 @@ static void va_TraceVAPictureParameterBufferMPEG4( ...@@ -293,6 +649,8 @@ static void va_TraceVAPictureParameterBufferMPEG4(
unsigned int num_elements, unsigned int num_elements,
void *data) void *data)
{ {
DPY2INDEX(dpy);
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
return; return;
...@@ -308,6 +666,9 @@ static void va_TraceVAIQMatrixBufferMPEG4( ...@@ -308,6 +666,9 @@ static void va_TraceVAIQMatrixBufferMPEG4(
unsigned int num_elements, unsigned int num_elements,
void *data) void *data)
{ {
DPY2INDEX(dpy);
/* todo: log VAIQMatrixBufferMPEG4 */
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
return; return;
...@@ -323,6 +684,12 @@ static void va_TraceVASliceParameterBufferMPEG4( ...@@ -323,6 +684,12 @@ static void va_TraceVASliceParameterBufferMPEG4(
unsigned int num_elements, unsigned int num_elements,
void *data) void *data)
{ {
DPY2INDEX(dpy);
trace_context[idx].trace_slice_no++;
/* todo: log VASliceParameterBufferMPEG4 */
/* trace_context[idx].trace_slice_size = p->slice_data_size; */
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
return; return;
...@@ -339,76 +706,59 @@ static void va_TraceVAPictureParameterBufferH264( ...@@ -339,76 +706,59 @@ static void va_TraceVAPictureParameterBufferH264(
void *data) void *data)
{ {
int i; int i;
DPY2INDEX(dpy);
VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data; VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data;
va_TraceMsg ("==========H264PicParameterBuffer============\n"); va_TraceMsg(idx, "VAPictureParameterBufferH264\n");
#if 0
if (p->num_ref_frames > 4)
{
int num = 0;
for (i = 15; i >= 0; i--)
{
if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID)
{
num++;
}
if (num > 4)
{
p->ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID;
}
}
p->num_ref_frames = 4;
}
#endif
#if 1
va_TraceMsg("picture id: %d\n", p->CurrPic.picture_id);
va_TraceMsg("frame idx: %d\n", p->CurrPic.frame_idx);
va_TraceMsg("picture flags: %d\n", p->CurrPic.flags);
va_TraceMsg("top field order count: %d\n", p->CurrPic.TopFieldOrderCnt);
va_TraceMsg("bottom field order count: %d\n", p->CurrPic.BottomFieldOrderCnt);
va_TraceMsg(idx, "\tCurrPic.picture_id = %d\n", p->CurrPic.picture_id);
va_TraceMsg(idx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
va_TraceMsg(idx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
va_TraceMsg(idx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
va_TraceMsg(idx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
va_TraceMsg("Reference frames: \n"); va_TraceMsg(idx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx:\n");
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) {
{ va_TraceMsg(idx, "\t\t%d-%d-%d-%d\n",
//va_TraceMsg("%d-%d; ", p->ReferenceFrames[i].TopFieldOrderCnt, p->ReferenceFrames[i].BottomFieldOrderCnt); p->ReferenceFrames[i].TopFieldOrderCnt,
va_TraceMsg("%d-%d-%d-%d; ", p->ReferenceFrames[i].TopFieldOrderCnt, p->ReferenceFrames[i].BottomFieldOrderCnt, p->ReferenceFrames[i].picture_id, p->ReferenceFrames[i].frame_idx); p->ReferenceFrames[i].BottomFieldOrderCnt,
} p->ReferenceFrames[i].picture_id,
p->ReferenceFrames[i].frame_idx);
} else
va_TraceMsg(idx, "\t\t%inv-%inv-%inv-%inv\n");
} }
va_TraceMsg("\n"); va_TraceMsg(idx, "\n");
#endif
va_TraceMsg("picture_width_in_mbs_minus1: %d\n", p->picture_width_in_mbs_minus1); va_TraceMsg(idx, "\tpicture_width_in_mbs_minus1 = %d\n", p->picture_width_in_mbs_minus1);
va_TraceMsg("picture_height_in_mbs_minus1: %d\n", p->picture_height_in_mbs_minus1); va_TraceMsg(idx, "\tpicture_height_in_mbs_minus1 = %d\n", p->picture_height_in_mbs_minus1);
va_TraceMsg("bit_depth_luma_minus8: %d\n", p->bit_depth_luma_minus8); va_TraceMsg(idx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
va_TraceMsg("bit_depth_chroma_minus8: %d\n", p->bit_depth_chroma_minus8); va_TraceMsg(idx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
va_TraceMsg("num_ref_frames: %d\n", p->num_ref_frames); va_TraceMsg(idx, "\tnum_ref_frames = %d\n", p->num_ref_frames);
va_TraceMsg("seq fields: %d\n", p->seq_fields.value); va_TraceMsg(idx, "\tseq fields = %d\n", p->seq_fields.value);
va_TraceMsg("\t chroma_format_idc: %d\n", p->seq_fields.bits.chroma_format_idc); va_TraceMsg(idx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
va_TraceMsg("\t residual_colour_transform_flag: %d\n", p->seq_fields.bits.residual_colour_transform_flag); va_TraceMsg(idx, "\tresidual_colour_transform_flag = %d\n", p->seq_fields.bits.residual_colour_transform_flag);
va_TraceMsg("\t frame_mbs_only_flag: %d\n", p->seq_fields.bits.frame_mbs_only_flag); va_TraceMsg(idx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
va_TraceMsg("\t mb_adaptive_frame_field_flag: %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag); va_TraceMsg(idx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
va_TraceMsg("\t direct_8x8_inference_flag: %d\n", p->seq_fields.bits.direct_8x8_inference_flag); va_TraceMsg(idx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
va_TraceMsg("\t MinLumaBiPredSize8x8: %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8); va_TraceMsg(idx, "\tMinLumaBiPredSize8x8 = %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8);
va_TraceMsg("num_slice_groups_minus1: %d\n", p->num_slice_groups_minus1); va_TraceMsg(idx, "\tnum_slice_groups_minus1 = %d\n", p->num_slice_groups_minus1);
va_TraceMsg("slice_group_map_type: %d\n", p->slice_group_map_type); va_TraceMsg(idx, "\tslice_group_map_type = %d\n", p->slice_group_map_type);
va_TraceMsg("slice_group_change_rate_minus1: %d\n", p->slice_group_change_rate_minus1); va_TraceMsg(idx, "\tslice_group_change_rate_minus1 = %d\n", p->slice_group_change_rate_minus1);
va_TraceMsg("pic_init_qp_minus26: %d\n", p->pic_init_qp_minus26); va_TraceMsg(idx, "\tpic_init_qp_minus26 = %d\n", p->pic_init_qp_minus26);
va_TraceMsg("pic_init_qs_minus26: %d\n", p->pic_init_qs_minus26); va_TraceMsg(idx, "\tpic_init_qs_minus26 = %d\n", p->pic_init_qs_minus26);
va_TraceMsg("chroma_qp_index_offset: %d\n", p->chroma_qp_index_offset); va_TraceMsg(idx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
va_TraceMsg("second_chroma_qp_index_offset: %d\n", p->second_chroma_qp_index_offset); va_TraceMsg(idx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
va_TraceMsg("pic_fields: %d\n", p->pic_fields.value); va_TraceMsg(idx, "\tpic_fields = %d\n", p->pic_fields.value);
va_TraceMsg("\t entropy_coding_mode_flag: %d\n", p->pic_fields.bits.entropy_coding_mode_flag); va_TraceMsg(idx, "\tentropy_coding_mode_flag = %d\n", p->pic_fields.bits.entropy_coding_mode_flag);
va_TraceMsg("\t weighted_pred_flag: %d\n", p->pic_fields.bits.weighted_pred_flag); va_TraceMsg(idx, "\tweighted_pred_flag = %d\n", p->pic_fields.bits.weighted_pred_flag);
va_TraceMsg("\t weighted_bipred_idc: %d\n", p->pic_fields.bits.weighted_bipred_idc); va_TraceMsg(idx, "\tweighted_bipred_idc = %d\n", p->pic_fields.bits.weighted_bipred_idc);
va_TraceMsg("\t transform_8x8_mode_flag: %d\n", p->pic_fields.bits.transform_8x8_mode_flag); va_TraceMsg(idx, "\ttransform_8x8_mode_flag = %d\n", p->pic_fields.bits.transform_8x8_mode_flag);
va_TraceMsg("\t field_pic_flag: %d\n", p->pic_fields.bits.field_pic_flag); va_TraceMsg(idx, "\tfield_pic_flag = %d\n", p->pic_fields.bits.field_pic_flag);
va_TraceMsg("\t constrained_intra_pred_flag: %d\n", p->pic_fields.bits.constrained_intra_pred_flag); va_TraceMsg(idx, "\tconstrained_intra_pred_flag = %d\n", p->pic_fields.bits.constrained_intra_pred_flag);
va_TraceMsg("frame_num: %d\n", p->frame_num); va_TraceMsg(idx, "\tframe_num = %d\n", p->frame_num);
return; return;
} }
...@@ -424,93 +774,78 @@ static void va_TraceVASliceParameterBufferH264( ...@@ -424,93 +774,78 @@ static void va_TraceVASliceParameterBufferH264(
{ {
int i; int i;
VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data; VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data;
DPY2INDEX(dpy);
va_TraceMsg ("========== SLICE HEADER ============.\n");
va_TraceMsg("slice_data_size: %d\n", p->slice_data_size); trace_context[idx].trace_slice_no++;
va_TraceMsg("slice_data_offset: %d\n", p->slice_data_offset); trace_context[idx].trace_slice_size = p->slice_data_size;
va_TraceMsg("slice_data_flag: %d\n", p->slice_data_flag);
va_TraceMsg("slice_data_bit_offset: %d\n", p->slice_data_bit_offset); va_TraceMsg(idx, "VASliceParameterBufferH264\n");
va_TraceMsg("first_mb_in_slice: %d\n", p->first_mb_in_slice); va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size);
va_TraceMsg("slice_type: %d\n", p->slice_type); va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset);
va_TraceMsg("direct_spatial_mv_pred_flag: %d\n", p->direct_spatial_mv_pred_flag); va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag);
va_TraceMsg("num_ref_idx_l0_active_minus1: %d\n", p->num_ref_idx_l0_active_minus1); va_TraceMsg(idx, "\tslice_data_bit_offset = %d\n", p->slice_data_bit_offset);
va_TraceMsg("num_ref_idx_l1_active_minus1: %d\n", p->num_ref_idx_l1_active_minus1); va_TraceMsg(idx, "\tfirst_mb_in_slice = %d\n", p->first_mb_in_slice);
va_TraceMsg("cabac_init_idc: %d\n", p->cabac_init_idc); va_TraceMsg(idx, "\tslice_type = %d\n", p->slice_type);
va_TraceMsg("slice_qp_delta: %d\n", p->slice_qp_delta); va_TraceMsg(idx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
va_TraceMsg("disable_deblocking_filter_idc: %d\n", p->disable_deblocking_filter_idc); va_TraceMsg(idx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
va_TraceMsg("slice_alpha_c0_offset_div2: %d\n", p->slice_alpha_c0_offset_div2); va_TraceMsg(idx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
va_TraceMsg("slice_beta_offset_div2: %d\n", p->slice_beta_offset_div2); va_TraceMsg(idx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
va_TraceMsg(idx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
#if 1 va_TraceMsg(idx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
if (p->slice_type == 0 || p->slice_type == 1) va_TraceMsg(idx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
{ va_TraceMsg(idx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
va_TraceMsg("RefPicList0:\n");
for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) if (p->slice_type == 0 || p->slice_type == 1) {
{ va_TraceMsg(idx, "\tRefPicList0 =");
//va_TraceMsg("%d-%d; ", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt); for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) {
va_TraceMsg("%d-%d-%d-%d; ", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx); va_TraceMsg(idx, "%d-%d-%d-%d\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx);
} }
va_TraceMsg("\n"); if (p->slice_type == 1) {
if (p->slice_type == 1) va_TraceMsg(idx, "\tRefPicList1 =");
{
va_TraceMsg("RefPicList1:\n");
for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1; i++) for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1; i++)
{ {
//va_TraceMsg("%d-%d; ", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt); va_TraceMsg(idx, "%d-%d-%d-%d\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
va_TraceMsg("%d-%d-%d-%d; ", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
} }
} }
va_TraceMsg("\n");
} }
#endif
va_TraceMsg(idx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
va_TraceMsg("luma_log2_weight_denom: %d\n", p->luma_log2_weight_denom); va_TraceMsg(idx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
va_TraceMsg("chroma_log2_weight_denom: %d\n", p->chroma_log2_weight_denom); va_TraceMsg(idx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
va_TraceMsg("luma_weight_l0_flag: %d\n", p->luma_weight_l0_flag); if (p->luma_weight_l0_flag) {
if (p->luma_weight_l0_flag) for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
{ va_TraceMsg(idx, "\t%d ", p->luma_weight_l0[i]);
for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) va_TraceMsg(idx, "\t%d ", p->luma_offset_l0[i]);
{
va_TraceMsg("%d ", p->luma_weight_l0[i]);
va_TraceMsg("%d ", p->luma_offset_l0[i]);
} }
va_TraceMsg("\n");
} }
va_TraceMsg("chroma_weight_l0_flag: %d\n", p->chroma_weight_l0_flag); va_TraceMsg(idx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
if (p->chroma_weight_l0_flag) if (p->chroma_weight_l0_flag) {
{ for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][0]);
{ va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][0]);
va_TraceMsg("%d ", p->chroma_weight_l0[i][0]); va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][1]);
va_TraceMsg("%d ", p->chroma_offset_l0[i][0]); va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][1]);
va_TraceMsg("%d ", p->chroma_weight_l0[i][1]);
va_TraceMsg("%d ", p->chroma_offset_l0[i][1]);
} }
va_TraceMsg("\n");
} }
va_TraceMsg("luma_weight_l1_flag: %d\n", p->luma_weight_l1_flag);
if (p->luma_weight_l1_flag) va_TraceMsg(idx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
{ if (p->luma_weight_l1_flag) {
for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
{ va_TraceMsg(idx, "\t\t%d ", p->luma_weight_l1[i]);
va_TraceMsg("%d ", p->luma_weight_l1[i]); va_TraceMsg(idx, "\t\t%d ", p->luma_offset_l1[i]);
va_TraceMsg("%d ", p->luma_offset_l1[i]);
} }
va_TraceMsg("\n");
} }
va_TraceMsg("chroma_weight_l1_flag: %d\n", p->chroma_weight_l1_flag);
if (p->chroma_weight_l1_flag) va_TraceMsg(idx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
{ if (p->chroma_weight_l1_flag) {
for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
{ va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][0]);
va_TraceMsg("%d ", p->chroma_weight_l1[i][0]); va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][0]);
va_TraceMsg("%d ", p->chroma_offset_l1[i][0]); va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][1]);
va_TraceMsg("%d ", p->chroma_weight_l1[i][1]); va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][1]);
va_TraceMsg("%d ", p->chroma_offset_l1[i][1]);
} }
va_TraceMsg("\n"); va_TraceMsg(idx, "\n");
} }
} }
...@@ -524,30 +859,171 @@ static void va_TraceVAIQMatrixBufferH264( ...@@ -524,30 +859,171 @@ static void va_TraceVAIQMatrixBufferH264(
void *data void *data
) )
{ {
va_TraceMsg("========== IQMatrix ============.\n");
VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data; VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
int i, j; int i, j;
for (i = 0; i < 6; i++) DPY2INDEX(dpy);
{
for (j = 0; j < 16; j++) va_TraceMsg(idx, "VAIQMatrixBufferH264\n");
{
va_TraceMsg("%d\t", p->ScalingList4x4[i][j]); va_TraceMsg(idx, "\tScalingList4x4[6][16]=\n");
for (i = 0; i < 6; i++) {
for (j = 0; j < 16; j++) {
va_TraceMsg(idx, "\t%d\t", p->ScalingList4x4[i][j]);
if ((j + 1) % 8 == 0) if ((j + 1) % 8 == 0)
va_TraceMsg("\n"); va_TraceMsg(idx, "\n");
} }
} }
for (i = 0; i < 2; i++) va_TraceMsg(idx, "\tScalingList8x8[2][64]=\n");
{ for (i = 0; i < 2; i++) {
for (j = 0; j < 64; j++) for (j = 0; j < 64; j++) {
{ va_TraceMsg(idx, "\t%d", p->ScalingList8x8[i][j]);
va_TraceMsg("%d\t", p->ScalingList8x8[i][j]);
if ((j + 1) % 8 == 0) if ((j + 1) % 8 == 0)
va_TraceMsg("\n"); va_TraceMsg(idx, "\n");
} }
} }
} }
static void va_TraceVAEncSequenceParameterBufferH264(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncSequenceParameterBufferH264 *p = (VAEncSequenceParameterBufferH264 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncSequenceParameterBufferH264\n");
va_TraceMsg(idx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
va_TraceMsg(idx, "\tlevel_idc = %d\n", p->level_idc);
va_TraceMsg(idx, "\tintra_period = %d\n", p->intra_period);
va_TraceMsg(idx, "\tintra_idr_period = %d\n", p->intra_idr_period);
va_TraceMsg(idx, "\tpicture_width_in_mbs = %d\n", p->picture_width_in_mbs);
va_TraceMsg(idx, "\tpicture_height_in_mbs = %d\n", p->picture_height_in_mbs);
va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
va_TraceMsg(idx, "\tframe_rate = %d\n", p->frame_rate);
va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
va_TraceMsg(idx, "\tbasic_unit_size = %d\n", p->basic_unit_size);
va_TraceMsg(idx, "\tvui_flag = %d\n", p->vui_flag);
/* start a new sequce, coded log file can be truncated */
trace_context[idx].trace_sequence_start = 1;
return;
}
static void va_TraceVAEncPictureParameterBufferH264(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncPictureParameterBufferH264 *p = (VAEncPictureParameterBufferH264 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncSequenceParameterBufferH264\n");
va_TraceMsg(idx, "\treference_picture = 0x%08x\n", p->reference_picture);
va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
va_TraceMsg(idx, "\tlast_picture = 0x%08x\n", p->last_picture);
trace_context[idx].trace_codedbuf = p->coded_buf;
return;
}
static void va_TraceVAEncSliceParameterBuffer(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncSliceParameterBuffer* p = (VAEncSliceParameterBuffer*)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncSliceParameterBuffer\n");
va_TraceMsg(idx, "\tstart_row_number = %d\n", p->start_row_number);
va_TraceMsg(idx, "\tslice_height = %d\n", p->slice_height);
va_TraceMsg(idx, "\tslice_flags.is_intra = %d\n", p->slice_flags.bits.is_intra);
va_TraceMsg(idx, "\tslice_flags.disable_deblocking_filter_idc = %d\n", p->slice_flags.bits.disable_deblocking_filter_idc);
return;
}
static void va_TraceVAEncMiscParameterBuffer(
VADisplay dpy,
VAContextID context,
VABufferID buffer,
VABufferType type,
unsigned int size,
unsigned int num_elements,
void *data)
{
VAEncMiscParameterBuffer* tmp = (VAEncMiscParameterBuffer*)data;
DPY2INDEX(dpy);
switch (tmp->type) {
case VAEncMiscParameterTypeFrameRate:
{
VAEncMiscParameterFrameRate *p = (VAEncMiscParameterFrameRate *)tmp->data;
va_TraceMsg(idx, "VAEncMiscParameterFrameRate\n");
va_TraceMsg(idx, "\tframerate = %d\n", p->framerate);
break;
}
case VAEncMiscParameterTypeRateControl:
{
VAEncMiscParameterRateControl *p = (VAEncMiscParameterRateControl *)tmp->data;
va_TraceMsg(idx, "VAEncMiscParameterRateControl\n");
va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
va_TraceMsg(idx, "\twindow_size = %d\n", p->window_size);
va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
break;
}
case VAEncMiscParameterTypeMaxSliceSize:
{
VAEncMiscParameterMaxSliceSize *p = (VAEncMiscParameterMaxSliceSize *)tmp->data;
va_TraceMsg(idx, "VAEncMiscParameterTypeMaxSliceSize\n");
va_TraceMsg(idx, "\tmax_slice_size = %d\n", p->max_slice_size);
break;
}
case VAEncMiscParameterTypeAIR:
{
VAEncMiscParameterAIR *p = (VAEncMiscParameterAIR *)tmp->data;
va_TraceMsg(idx, "VAEncMiscParameterAIR\n");
va_TraceMsg(idx, "\tair_num_mbs = %d\n", p->air_num_mbs);
va_TraceMsg(idx, "\tair_threshold = %d\n", p->air_threshold);
va_TraceMsg(idx, "\tair_auto = %d\n", p->air_auto);
break;
}
default:
va_TraceMsg(idx, "invalid VAEncMiscParameterBuffer type = %d\n", tmp->type);
break;
}
return;
}
static void va_TraceVAPictureParameterBufferVC1( static void va_TraceVAPictureParameterBufferVC1(
VADisplay dpy, VADisplay dpy,
VAContextID context, VAContextID context,
...@@ -559,174 +1035,96 @@ static void va_TraceVAPictureParameterBufferVC1( ...@@ -559,174 +1035,96 @@ static void va_TraceVAPictureParameterBufferVC1(
) )
{ {
VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data; VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data;
DPY2INDEX(dpy);
va_TraceMsg("\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture);
va_TraceMsg("\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture); va_TraceMsg(idx, "VAPictureParameterBufferVC1\n");
va_TraceMsg("\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture);
va_TraceMsg(idx, "\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture);
va_TraceMsg("\tpulldown = %d\n", p->sequence_fields.bits.pulldown); va_TraceMsg(idx, "\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture);
va_TraceMsg("\tinterlace = %d\n", p->sequence_fields.bits.interlace); va_TraceMsg(idx, "\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture);
va_TraceMsg("\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag);
va_TraceMsg("\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag); va_TraceMsg(idx, "\tpulldown = %d\n", p->sequence_fields.bits.pulldown);
va_TraceMsg("\tpsf = %d.\n", va_TraceMsg(idx, "\tinterlace = %d\n", p->sequence_fields.bits.interlace);
p->sequence_fields.bits.psf); va_TraceMsg(idx, "\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag);
va_TraceMsg("\tmultires = %d.\n", va_TraceMsg(idx, "\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag);
p->sequence_fields.bits.multires); va_TraceMsg(idx, "\tpsf = %d\n", p->sequence_fields.bits.psf);
va_TraceMsg("\toverlap = %d.\n", va_TraceMsg(idx, "\tmultires = %d\n", p->sequence_fields.bits.multires);
p->sequence_fields.bits.overlap); va_TraceMsg(idx, "\toverlap = %d\n", p->sequence_fields.bits.overlap);
va_TraceMsg("\tsyncmarker = %d.\n", va_TraceMsg(idx, "\tsyncmarker = %d\n", p->sequence_fields.bits.syncmarker);
p->sequence_fields.bits.syncmarker); va_TraceMsg(idx, "\trangered = %d\n", p->sequence_fields.bits.rangered);
va_TraceMsg("\trangered = %d.\n", va_TraceMsg(idx, "\tmax_b_frames = %d\n", p->sequence_fields.bits.max_b_frames);
p->sequence_fields.bits.rangered); va_TraceMsg(idx, "\tcoded_width = %d\n", p->coded_width);
va_TraceMsg("\tmax_b_frames = %d.\n", va_TraceMsg(idx, "\tcoded_height = %d\n", p->coded_height);
p->sequence_fields.bits.max_b_frames); va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
va_TraceMsg("\tcoded_width = %d.\n", va_TraceMsg(idx, "\tbroken_link = %d\n", p->entrypoint_fields.bits.broken_link);
p->coded_width); va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
va_TraceMsg("\tcoded_height = %d.\n", va_TraceMsg(idx, "\tpanscan_flag = %d\n", p->entrypoint_fields.bits.panscan_flag);
p->coded_height); va_TraceMsg(idx, "\tloopfilter = %d\n", p->entrypoint_fields.bits.loopfilter);
va_TraceMsg("\tclosed_entry = %d.\n", va_TraceMsg(idx, "\tconditional_overlap_flag = %d\n", p->conditional_overlap_flag);
p->entrypoint_fields.bits.closed_entry); va_TraceMsg(idx, "\tfast_uvmc_flag = %d\n", p->fast_uvmc_flag);
va_TraceMsg("\tbroken_link = %d.\n", va_TraceMsg(idx, "\trange_mapping_luma_flag = %d\n", p->range_mapping_fields.bits.luma_flag);
p->entrypoint_fields.bits.broken_link); va_TraceMsg(idx, "\trange_mapping_luma = %d\n", p->range_mapping_fields.bits.luma);
va_TraceMsg("\tclosed_entry = %d.\n", va_TraceMsg(idx, "\trange_mapping_chroma_flag = %d\n", p->range_mapping_fields.bits.chroma_flag);
p->entrypoint_fields.bits.closed_entry); va_TraceMsg(idx, "\trange_mapping_chroma = %d\n", p->range_mapping_fields.bits.chroma);
va_TraceMsg("\tpanscan_flag = %d.\n", va_TraceMsg(idx, "\tb_picture_fraction = %d\n", p->b_picture_fraction);
p->entrypoint_fields.bits.panscan_flag); va_TraceMsg(idx, "\tcbp_table = %d\n", p->cbp_table);
va_TraceMsg("\tloopfilter = %d.\n", va_TraceMsg(idx, "\tmb_mode_table = %d\n", p->mb_mode_table);
p->entrypoint_fields.bits.loopfilter); va_TraceMsg(idx, "\trange_reduction_frame = %d\n", p->range_reduction_frame);
va_TraceMsg("\tconditional_overlap_flag = %d.\n", va_TraceMsg(idx, "\trounding_control = %d\n", p->rounding_control);
p->conditional_overlap_flag); va_TraceMsg(idx, "\tpost_processing = %d\n", p->post_processing);
va_TraceMsg("\tfast_uvmc_flag = %d.\n", va_TraceMsg(idx, "\tpicture_resolution_index = %d\n", p->picture_resolution_index);
p->fast_uvmc_flag); va_TraceMsg(idx, "\tluma_scale = %d\n", p->luma_scale);
va_TraceMsg("\trange_mapping_luma_flag = %d.\n", va_TraceMsg(idx, "\tluma_shift = %d\n", p->luma_shift);
p->range_mapping_fields.bits.luma_flag); va_TraceMsg(idx, "\tpicture_type = %d\n", p->picture_fields.bits.picture_type);
va_TraceMsg("\trange_mapping_luma = %d.\n", va_TraceMsg(idx, "\tframe_coding_mode = %d\n", p->picture_fields.bits.frame_coding_mode);
p->range_mapping_fields.bits.luma); va_TraceMsg(idx, "\ttop_field_first = %d\n", p->picture_fields.bits.top_field_first);
va_TraceMsg("\trange_mapping_chroma_flag = %d.\n", va_TraceMsg(idx, "\tis_first_field = %d\n", p->picture_fields.bits.is_first_field);
p->range_mapping_fields.bits.chroma_flag); va_TraceMsg(idx, "\tintensity_compensation = %d\n", p->picture_fields.bits.intensity_compensation);
va_TraceMsg("\trange_mapping_chroma = %d.\n", va_TraceMsg(idx, "\tmv_type_mb = %d\n", p->raw_coding.flags.mv_type_mb);
p->range_mapping_fields.bits.chroma); va_TraceMsg(idx, "\tdirect_mb = %d\n", p->raw_coding.flags.direct_mb);
va_TraceMsg("\tb_picture_fraction = %d.\n", va_TraceMsg(idx, "\tskip_mb = %d\n", p->raw_coding.flags.skip_mb);
p->b_picture_fraction); va_TraceMsg(idx, "\tfield_tx = %d\n", p->raw_coding.flags.field_tx);
va_TraceMsg("\tcbp_table = %d.\n", va_TraceMsg(idx, "\tforward_mb = %d\n", p->raw_coding.flags.forward_mb);
p->cbp_table); va_TraceMsg(idx, "\tac_pred = %d\n", p->raw_coding.flags.ac_pred);
va_TraceMsg("\tmb_mode_table = %d.\n", va_TraceMsg(idx, "\toverflags = %d\n", p->raw_coding.flags.overflags);
p->mb_mode_table); va_TraceMsg(idx, "\tbp_mv_type_mb = %d\n", p->bitplane_present.flags.bp_mv_type_mb);
va_TraceMsg("\trange_reduction_frame = %d.\n", va_TraceMsg(idx, "\tbp_direct_mb = %d\n", p->bitplane_present.flags.bp_direct_mb);
p->range_reduction_frame); va_TraceMsg(idx, "\tbp_skip_mb = %d\n", p->bitplane_present.flags.bp_skip_mb);
va_TraceMsg("\trounding_control = %d.\n", va_TraceMsg(idx, "\tbp_field_tx = %d\n", p->bitplane_present.flags.bp_field_tx);
p->rounding_control); va_TraceMsg(idx, "\tbp_forward_mb = %d\n", p->bitplane_present.flags.bp_forward_mb);
va_TraceMsg("\tpost_processing = %d.\n", va_TraceMsg(idx, "\tbp_ac_pred = %d\n", p->bitplane_present.flags.bp_ac_pred);
p->post_processing); va_TraceMsg(idx, "\tbp_overflags = %d\n", p->bitplane_present.flags.bp_overflags);
va_TraceMsg("\tpicture_resolution_index = %d.\n", va_TraceMsg(idx, "\treference_distance_flag = %d\n", p->reference_fields.bits.reference_distance_flag);
p->picture_resolution_index); va_TraceMsg(idx, "\treference_distance = %d\n", p->reference_fields.bits.reference_distance);
va_TraceMsg("\tluma_scale = %d.\n", va_TraceMsg(idx, "\tnum_reference_pictures = %d\n", p->reference_fields.bits.num_reference_pictures);
p->luma_scale); va_TraceMsg(idx, "\treference_field_pic_indicator = %d\n", p->reference_fields.bits.reference_field_pic_indicator);
va_TraceMsg("\tluma_shift = %d.\n", va_TraceMsg(idx, "\tmv_mode = %d\n", p->mv_fields.bits.mv_mode);
p->luma_shift); va_TraceMsg(idx, "\tmv_mode2 = %d\n", p->mv_fields.bits.mv_mode2);
va_TraceMsg("\tpicture_type = %d.\n", va_TraceMsg(idx, "\tmv_table = %d\n", p->mv_fields.bits.mv_table);
p->picture_fields.bits.picture_type); va_TraceMsg(idx, "\ttwo_mv_block_pattern_table = %d\n", p->mv_fields.bits.two_mv_block_pattern_table);
va_TraceMsg("\tframe_coding_mode = %d.\n", va_TraceMsg(idx, "\tfour_mv_switch = %d\n", p->mv_fields.bits.four_mv_switch);
p->picture_fields.bits.frame_coding_mode); va_TraceMsg(idx, "\tfour_mv_block_pattern_table = %d\n", p->mv_fields.bits.four_mv_block_pattern_table);
va_TraceMsg("\ttop_field_first = %d.\n", va_TraceMsg(idx, "\textended_mv_flag = %d\n", p->mv_fields.bits.extended_mv_flag);
p->picture_fields.bits.top_field_first); va_TraceMsg(idx, "\textended_mv_range = %d\n", p->mv_fields.bits.extended_mv_range);
va_TraceMsg("\tis_first_field = %d.\n", va_TraceMsg(idx, "\textended_dmv_flag = %d\n", p->mv_fields.bits.extended_dmv_flag);
p->picture_fields.bits.is_first_field); va_TraceMsg(idx, "\textended_dmv_range = %d\n", p->mv_fields.bits.extended_dmv_range);
va_TraceMsg("\tintensity_compensation = %d.\n", va_TraceMsg(idx, "\tdquant = %d\n", p->pic_quantizer_fields.bits.dquant);
p->picture_fields.bits.intensity_compensation); va_TraceMsg(idx, "\tquantizer = %d\n", p->pic_quantizer_fields.bits.quantizer);
va_TraceMsg(" ---------------------------------\n"); va_TraceMsg(idx, "\thalf_qp = %d\n", p->pic_quantizer_fields.bits.half_qp);
va_TraceMsg("\tmv_type_mb = %d.\n", va_TraceMsg(idx, "\tpic_quantizer_scale = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_scale);
p->raw_coding.flags.mv_type_mb); va_TraceMsg(idx, "\tpic_quantizer_type = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_type);
va_TraceMsg("\tdirect_mb = %d.\n", va_TraceMsg(idx, "\tdq_frame = %d\n", p->pic_quantizer_fields.bits.dq_frame);
p->raw_coding.flags.direct_mb); va_TraceMsg(idx, "\tdq_profile = %d\n", p->pic_quantizer_fields.bits.dq_profile);
va_TraceMsg("\tskip_mb = %d.\n", va_TraceMsg(idx, "\tdq_sb_edge = %d\n", p->pic_quantizer_fields.bits.dq_sb_edge);
p->raw_coding.flags.skip_mb); va_TraceMsg(idx, "\tdq_db_edge = %d\n", p->pic_quantizer_fields.bits.dq_db_edge);
va_TraceMsg("\tfield_tx = %d.\n", va_TraceMsg(idx, "\tdq_binary_level = %d\n", p->pic_quantizer_fields.bits.dq_binary_level);
p->raw_coding.flags.field_tx); va_TraceMsg(idx, "\talt_pic_quantizer = %d\n", p->pic_quantizer_fields.bits.alt_pic_quantizer);
va_TraceMsg("\tforward_mb = %d.\n", va_TraceMsg(idx, "\tvariable_sized_transform_flag = %d\n", p->transform_fields.bits.variable_sized_transform_flag);
p->raw_coding.flags.forward_mb); va_TraceMsg(idx, "\tmb_level_transform_type_flag = %d\n", p->transform_fields.bits.mb_level_transform_type_flag);
va_TraceMsg("\tac_pred = %d.\n", va_TraceMsg(idx, "\tframe_level_transform_type = %d\n", p->transform_fields.bits.frame_level_transform_type);
p->raw_coding.flags.ac_pred); va_TraceMsg(idx, "\ttransform_ac_codingset_idx1 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx1);
va_TraceMsg("\toverflags = %d.\n", va_TraceMsg(idx, "\ttransform_ac_codingset_idx2 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx2);
p->raw_coding.flags.overflags); va_TraceMsg(idx, "\tintra_transform_dc_table = %d\n", p->transform_fields.bits.intra_transform_dc_table);
va_TraceMsg(" ---------------------------------\n");
va_TraceMsg("\tbp_mv_type_mb = %d.\n",
p->bitplane_present.flags.bp_mv_type_mb);
va_TraceMsg("\tbp_direct_mb = %d.\n",
p->bitplane_present.flags.bp_direct_mb);
va_TraceMsg("\tbp_skip_mb = %d.\n",
p->bitplane_present.flags.bp_skip_mb);
va_TraceMsg("\tbp_field_tx = %d.\n",
p->bitplane_present.flags.bp_field_tx);
va_TraceMsg("\tbp_forward_mb = %d.\n",
p->bitplane_present.flags.bp_forward_mb);
va_TraceMsg("\tbp_ac_pred = %d.\n",
p->bitplane_present.flags.bp_ac_pred);
va_TraceMsg("\tbp_overflags = %d.\n",
p->bitplane_present.flags.bp_overflags);
va_TraceMsg(" ---------------------------------\n");
va_TraceMsg("\treference_distance_flag = %d.\n",
p->reference_fields.bits.reference_distance_flag);
va_TraceMsg("\treference_distance = %d.\n",
p->reference_fields.bits.reference_distance);
va_TraceMsg("\tnum_reference_pictures = %d.\n",
p->reference_fields.bits.num_reference_pictures);
va_TraceMsg("\treference_field_pic_indicator = %d.\n",
p->reference_fields.bits.reference_field_pic_indicator);
va_TraceMsg("\tmv_mode = %d.\n",
p->mv_fields.bits.mv_mode);
va_TraceMsg("\tmv_mode2 = %d.\n",
p->mv_fields.bits.mv_mode2);
va_TraceMsg("\tmv_table = %d.\n",
p->mv_fields.bits.mv_table);
va_TraceMsg("\ttwo_mv_block_pattern_table = %d.\n",
p->mv_fields.bits.two_mv_block_pattern_table);
va_TraceMsg("\tfour_mv_switch = %d.\n",
p->mv_fields.bits.four_mv_switch);
va_TraceMsg("\tfour_mv_block_pattern_table = %d.\n",
p->mv_fields.bits.four_mv_block_pattern_table);
va_TraceMsg("\textended_mv_flag = %d.\n",
p->mv_fields.bits.extended_mv_flag);
va_TraceMsg("\textended_mv_range = %d.\n",
p->mv_fields.bits.extended_mv_range);
va_TraceMsg("\textended_dmv_flag = %d.\n",
p->mv_fields.bits.extended_dmv_flag);
va_TraceMsg("\textended_dmv_range = %d.\n",
p->mv_fields.bits.extended_dmv_range);
va_TraceMsg("\tdquant = %d.\n",
p->pic_quantizer_fields.bits.dquant);
va_TraceMsg("\tquantizer = %d.\n",
p->pic_quantizer_fields.bits.quantizer);
va_TraceMsg("\thalf_qp = %d.\n",
p->pic_quantizer_fields.bits.half_qp);
va_TraceMsg("\tpic_quantizer_scale = %d.\n",
p->pic_quantizer_fields.bits.pic_quantizer_scale);
va_TraceMsg("\tpic_quantizer_type = %d.\n",
p->pic_quantizer_fields.bits.pic_quantizer_type);
va_TraceMsg("\tdq_frame = %d.\n",
p->pic_quantizer_fields.bits.dq_frame);
va_TraceMsg("\tdq_profile = %d.\n",
p->pic_quantizer_fields.bits.dq_profile);
va_TraceMsg("\tdq_sb_edge = %d.\n",
p->pic_quantizer_fields.bits.dq_sb_edge);
va_TraceMsg("\tdq_db_edge = %d.\n",
p->pic_quantizer_fields.bits.dq_db_edge);
va_TraceMsg("\tdq_binary_level = %d.\n",
p->pic_quantizer_fields.bits.dq_binary_level);
va_TraceMsg("\talt_pic_quantizer = %d.\n",
p->pic_quantizer_fields.bits.alt_pic_quantizer);
va_TraceMsg("\tvariable_sized_transform_flag = %d.\n",
p->transform_fields.bits.variable_sized_transform_flag);
va_TraceMsg("\tmb_level_transform_type_flag = %d.\n",
p->transform_fields.bits.mb_level_transform_type_flag);
va_TraceMsg("\tframe_level_transform_type = %d.\n",
p->transform_fields.bits.frame_level_transform_type);
va_TraceMsg("\ttransform_ac_codingset_idx1 = %d.\n",
p->transform_fields.bits.transform_ac_codingset_idx1);
va_TraceMsg("\ttransform_ac_codingset_idx2 = %d.\n",
p->transform_fields.bits.transform_ac_codingset_idx2);
va_TraceMsg("\tintra_transform_dc_table = %d.\n",
p->transform_fields.bits.intra_transform_dc_table);
} }
static void va_TraceVASliceParameterBufferVC1( static void va_TraceVASliceParameterBufferVC1(
...@@ -740,13 +1138,17 @@ static void va_TraceVASliceParameterBufferVC1( ...@@ -740,13 +1138,17 @@ static void va_TraceVASliceParameterBufferVC1(
) )
{ {
VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data; VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data;
DPY2INDEX(dpy);
trace_context[idx].trace_slice_no++;
trace_context[idx].trace_slice_size = p->slice_data_size;
va_TraceMsg ("========== SLICE NUMBER ==========\n"); va_TraceMsg(idx, "VASliceParameterBufferVC1\n");
va_TraceMsg (" slice_data_size = %d\n", p->slice_data_size); va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size);
va_TraceMsg (" slice_data_offset = %d\n", p->slice_data_offset); va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset);
va_TraceMsg (" slice_data_flag = %d\n", p->slice_data_flag); va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag);
va_TraceMsg (" macroblock_offset = %d\n", p->macroblock_offset); va_TraceMsg(idx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
va_TraceMsg (" slice_vertical_position = %d\n", p->slice_vertical_position); va_TraceMsg(idx, "\tslice_vertical_position = %d\n", p->slice_vertical_position);
} }
void va_TraceBeginPicture( void va_TraceBeginPicture(
...@@ -755,15 +1157,17 @@ void va_TraceBeginPicture( ...@@ -755,15 +1157,17 @@ void va_TraceBeginPicture(
VASurfaceID render_target VASurfaceID render_target
) )
{ {
int i; DPY2INDEX(dpy);
va_TraceMsg("\tcontext = 0x%08x\n", context); TRACE_FUNCNAME(idx);
va_TraceMsg("\t\trender_targets = 0x%08x\n", render_target);
va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
va_TraceMsg(idx, "\trender_targets = 0x%08x\n", render_target);
trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */ trace_context[idx].trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */
trace_frame++; trace_context[idx].trace_frame_no++;
trace_slice = 0; trace_context[idx].trace_slice_no = 0;
} }
static void va_TraceMPEG2Buf( static void va_TraceMPEG2Buf(
...@@ -784,25 +1188,30 @@ static void va_TraceMPEG2Buf( ...@@ -784,25 +1188,30 @@ static void va_TraceMPEG2Buf(
va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VABitPlaneBufferType: case VABitPlaneBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceGroupMapBufferType: case VASliceGroupMapBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceParameterBufferType: case VASliceParameterBufferType:
trace_slice++;
va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceDataBufferType: case VASliceDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAMacroblockParameterBufferType: case VAMacroblockParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAResidualDataBufferType: case VAResidualDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VADeblockingParameterBufferType: case VADeblockingParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAImageBufferType: case VAImageBufferType:
break; break;
case VAProtectedSliceDataBufferType: case VAProtectedSliceDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncCodedBufferType: case VAEncCodedBufferType:
break; break;
...@@ -816,6 +1225,8 @@ static void va_TraceMPEG2Buf( ...@@ -816,6 +1225,8 @@ static void va_TraceMPEG2Buf(
break; break;
case VAEncH264SEIBufferType: case VAEncH264SEIBufferType:
break; break;
default:
break;
} }
} }
...@@ -837,6 +1248,7 @@ static void va_TraceMPEG4Buf( ...@@ -837,6 +1248,7 @@ static void va_TraceMPEG4Buf(
va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VABitPlaneBufferType: case VABitPlaneBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceGroupMapBufferType: case VASliceGroupMapBufferType:
break; break;
...@@ -847,10 +1259,13 @@ static void va_TraceMPEG4Buf( ...@@ -847,10 +1259,13 @@ static void va_TraceMPEG4Buf(
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAMacroblockParameterBufferType: case VAMacroblockParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAResidualDataBufferType: case VAResidualDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VADeblockingParameterBufferType: case VADeblockingParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAImageBufferType: case VAImageBufferType:
break; break;
...@@ -860,10 +1275,13 @@ static void va_TraceMPEG4Buf( ...@@ -860,10 +1275,13 @@ static void va_TraceMPEG4Buf(
case VAEncCodedBufferType: case VAEncCodedBufferType:
break; break;
case VAEncSequenceParameterBufferType: case VAEncSequenceParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncPictureParameterBufferType: case VAEncPictureParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncSliceParameterBufferType: case VAEncSliceParameterBufferType:
va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncH264VUIBufferType: case VAEncH264VUIBufferType:
break; break;
...@@ -885,6 +1303,8 @@ static void va_TraceH264Buf( ...@@ -885,6 +1303,8 @@ static void va_TraceH264Buf(
void *pbuf void *pbuf
) )
{ {
DPY2INDEX(dpy);
switch (type) { switch (type) {
case VAPictureParameterBufferType: case VAPictureParameterBufferType:
va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
...@@ -893,20 +1313,25 @@ static void va_TraceH264Buf( ...@@ -893,20 +1313,25 @@ static void va_TraceH264Buf(
va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VABitPlaneBufferType: case VABitPlaneBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceGroupMapBufferType: case VASliceGroupMapBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceParameterBufferType: case VASliceParameterBufferType:
va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceDataBufferType: case VASliceDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVABuffers(dpy, context, buffer, type, trace_context[idx].trace_slice_size, num_elements, pbuf);
break; break;
case VAMacroblockParameterBufferType: case VAMacroblockParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAResidualDataBufferType: case VAResidualDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VADeblockingParameterBufferType: case VADeblockingParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAImageBufferType: case VAImageBufferType:
break; break;
...@@ -916,14 +1341,22 @@ static void va_TraceH264Buf( ...@@ -916,14 +1341,22 @@ static void va_TraceH264Buf(
case VAEncCodedBufferType: case VAEncCodedBufferType:
break; break;
case VAEncSequenceParameterBufferType: case VAEncSequenceParameterBufferType:
va_TraceVAEncSequenceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncPictureParameterBufferType: case VAEncPictureParameterBufferType:
va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncSliceParameterBufferType: case VAEncSliceParameterBufferType:
va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncH264VUIBufferType: case VAEncH264VUIBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncH264SEIBufferType: case VAEncH264SEIBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncMiscParameterBufferType:
va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
default: default:
break; break;
...@@ -941,6 +1374,8 @@ static void va_TraceVC1Buf( ...@@ -941,6 +1374,8 @@ static void va_TraceVC1Buf(
void *pbuf void *pbuf
) )
{ {
DPY2INDEX(dpy);
switch (type) { switch (type) {
case VAPictureParameterBufferType: case VAPictureParameterBufferType:
va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
...@@ -951,18 +1386,22 @@ static void va_TraceVC1Buf( ...@@ -951,18 +1386,22 @@ static void va_TraceVC1Buf(
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceGroupMapBufferType: case VASliceGroupMapBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceParameterBufferType: case VASliceParameterBufferType:
va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VASliceDataBufferType: case VASliceDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); va_TraceVABuffers(dpy, context, buffer, type, trace_context[idx].trace_slice_size, num_elements, pbuf);
break; break;
case VAMacroblockParameterBufferType: case VAMacroblockParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAResidualDataBufferType: case VAResidualDataBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VADeblockingParameterBufferType: case VADeblockingParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAImageBufferType: case VAImageBufferType:
break; break;
...@@ -972,14 +1411,13 @@ static void va_TraceVC1Buf( ...@@ -972,14 +1411,13 @@ static void va_TraceVC1Buf(
case VAEncCodedBufferType: case VAEncCodedBufferType:
break; break;
case VAEncSequenceParameterBufferType: case VAEncSequenceParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncPictureParameterBufferType: case VAEncPictureParameterBufferType:
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
break; break;
case VAEncSliceParameterBufferType: case VAEncSliceParameterBufferType:
break; va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
case VAEncH264VUIBufferType:
break;
case VAEncH264SEIBufferType:
break; break;
default: default:
break; break;
...@@ -997,44 +1435,74 @@ void va_TraceRenderPicture( ...@@ -997,44 +1435,74 @@ void va_TraceRenderPicture(
unsigned int size; unsigned int size;
unsigned int num_elements; unsigned int num_elements;
int i; int i;
DPY2INDEX(dpy);
va_TraceMsg("\tcontext = 0x%08x\n", context); TRACE_FUNCNAME(idx);
va_TraceMsg("\tnum_buffers = %d\n", num_buffers);
va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
va_TraceMsg(idx, "\tnum_buffers = %d\n", num_buffers);
for (i = 0; i < num_buffers; i++) { for (i = 0; i < num_buffers; i++) {
void *pbuf; void *pbuf;
unsigned int j;
/* get buffer type information */ /* get buffer type information */
vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements); vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements);
va_TraceMsg("\t\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
va_TraceMsg("\t\t\ttype = %s\n", buffer_type_to_string(type));
va_TraceMsg("\t\t\tsize = %d\n", size);
va_TraceMsg("\t\t\tnum_elements = %d\n", num_elements);
va_TraceMsg(idx, "\t---------------------------\n");
va_TraceMsg(idx, "\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
va_TraceMsg(idx, "\t type = %s\n", buffer_type_to_string(type));
va_TraceMsg(idx, "\t size = %d\n", size);
va_TraceMsg(idx, "\t num_elements = %d\n", num_elements);
vaMapBuffer(dpy, buffers[i], &pbuf); vaMapBuffer(dpy, buffers[i], &pbuf);
switch (trace_profile) { switch (trace_context[idx].trace_profile) {
case VAProfileMPEG2Simple: case VAProfileMPEG2Simple:
case VAProfileMPEG2Main: case VAProfileMPEG2Main:
va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break; break;
case VAProfileMPEG4Simple: case VAProfileMPEG4Simple:
case VAProfileMPEG4AdvancedSimple: case VAProfileMPEG4AdvancedSimple:
case VAProfileMPEG4Main: case VAProfileMPEG4Main:
va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break; break;
case VAProfileH264Baseline: case VAProfileH264Baseline:
case VAProfileH264Main: case VAProfileH264Main:
case VAProfileH264High: case VAProfileH264High:
va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break; break;
case VAProfileVC1Simple: case VAProfileVC1Simple:
case VAProfileVC1Main: case VAProfileVC1Main:
case VAProfileVC1Advanced: case VAProfileVC1Advanced:
va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf); for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break; break;
case VAProfileH263Baseline: case VAProfileH263Baseline:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break;
default:
break; break;
} }
...@@ -1048,80 +1516,149 @@ void va_TraceEndPicture( ...@@ -1048,80 +1516,149 @@ void va_TraceEndPicture(
VAContextID context VAContextID context
) )
{ {
int i, j; DPY2INDEX(dpy);
unsigned int fourcc; /* following are output argument */
unsigned int luma_stride; TRACE_FUNCNAME(idx);
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;
char *Y_data, *UV_data, *tmp;
VAStatus va_status;
va_TraceMsg("\tcontext = 0x%08x\n", context);
va_TraceMsg("\t\trender_targets = 0x%08x\n", trace_rendertarget);
/* force the pipleline finish rendering */ va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
vaSyncSurface(dpy, trace_rendertarget); va_TraceMsg(idx, "\trender_targets = 0x%08x\n", trace_context[idx].trace_rendertarget);
va_TraceMsg("***dump surface data***\n", trace_rendertarget);
va_status = vaLockSurface(dpy, trace_rendertarget, &fourcc, &luma_stride, &chroma_u_stride, &chroma_v_stride, /* want to trace codedbuf, and it is encode */
&luma_offset, &chroma_u_offset, &chroma_v_offset, &buffer_name, &buffer); if (trace_context[idx].trace_fp_codedbuf &&
((trace_context[idx].trace_entrypoint == VAEntrypointEncSlice) ||
(trace_context[idx].trace_entrypoint == VAEntrypointEncPicture))) {
/* force the pipleline finish rendering */
vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
va_TraceCodedBuf(dpy);
}
if (va_status != VA_STATUS_SUCCESS) /* trace decoded surface for decoding, or the source sourface for encoding */
return; if (trace_context[idx].trace_fp_surface) {
/* force the pipleline finish rendering */
va_TraceMsg("\tfourcc=0x%08x\n", fourcc); vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
va_TraceMsg("\twidth=%d\n", trace_width);
va_TraceMsg("\theight=%d\n", trace_height); va_TraceSurface(dpy);
va_TraceMsg("\tluma_stride=%d\n", luma_stride);
va_TraceMsg("\tchroma_u_stride=%d\n", chroma_u_stride);
va_TraceMsg("\tchroma_v_stride=%d\n", chroma_v_stride);
va_TraceMsg("\tluma_offset=%d\n", luma_offset);
va_TraceMsg("\tchroma_u_offset=%d\n", chroma_u_offset);
va_TraceMsg("\tchroma_v_offset=%d\n", chroma_v_offset);
if (!buffer) {
vaUnlockSurface(dpy, trace_rendertarget);
return;
} }
}
Y_data = buffer;
UV_data = buffer + luma_offset;
tmp = Y_data; void va_TraceMaxNumDisplayAttributes (
va_TraceMsg("**Y data**\n"); VADisplay dpy,
for (i=0; i<trace_height; i++) { int number
for (j=0; j<trace_width; j++) { )
if ((j%16) == 0) {
va_TraceMsg("\n0x%08x:", j + i*trace_width); DPY2INDEX(dpy);
va_TraceMsg(" %02x", tmp[j]);
}
va_TraceMsg("\n"); TRACE_FUNCNAME(idx);
tmp = Y_data + i * luma_stride;
va_TraceMsg(idx, "\t>max_display_attributes = %d\n", number);
}
void va_TraceQueryDisplayAttributes (
VADisplay dpy,
VADisplayAttribute *attr_list, /* out */
int *num_attributes /* out */
)
{
int i;
DPY2INDEX(dpy);
va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes);
for (i=0; i<*num_attributes; i++) {
va_TraceMsg(idx, "\tattr_list[%d] =\n");
va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value);
va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value);
va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value);
va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags);
} }
}
tmp = UV_data;
if (fourcc == VA_FOURCC_NV12) {
va_TraceMsg("**UV data**\n");
for (i=0; i<trace_height/2; i++) {
for (j=0; j<trace_width; j++) {
if ((j%16) == 0)
va_TraceMsg("\n0x%08x:", j + i*trace_width);
va_TraceMsg(" %02x", tmp[j]);
}
va_TraceMsg("\n"); static void va_TraceDisplayAttributes (
tmp = UV_data + i * chroma_u_stride; VADisplay dpy,
} VADisplayAttribute *attr_list,
int num_attributes
)
{
int i;
DPY2INDEX(dpy);
va_TraceMsg(idx, "\tnum_attributes = %d\n", num_attributes);
for (i=0; i<num_attributes; i++) {
va_TraceMsg(idx, "\tattr_list[%d] =\n");
va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value);
va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value);
va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value);
va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags);
} }
}
void va_TraceGetDisplayAttributes (
VADisplay dpy,
VADisplayAttribute *attr_list,
int num_attributes
)
{
DPY2INDEX(dpy);
vaUnlockSurface(dpy, trace_rendertarget); TRACE_FUNCNAME(idx);
va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
}
void va_TraceSetDisplayAttributes (
VADisplay dpy,
VADisplayAttribute *attr_list,
int num_attributes
)
{
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
}
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 */
)
{
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface);
va_TraceMsg(idx, "\tdraw = 0x%08x\n", draw);
va_TraceMsg(idx, "\tsrcx = %d\n", surface);
va_TraceMsg(idx, "\tsrcy = %d\n", surface);
va_TraceMsg(idx, "\tsrcw = %d\n", surface);
va_TraceMsg(idx, "\tsrch = %d\n", surface);
va_TraceMsg(idx, "\tdestx = %d\n", surface);
va_TraceMsg(idx, "\tdesty = %d\n", surface);
va_TraceMsg(idx, "\tdestw = %d\n", destw);
va_TraceMsg(idx, "\tdesth = %d\n", desth);
va_TraceMsg(idx, "\tcliprects = 0x%08x\n", cliprects);
va_TraceMsg(idx, "\tnumber_cliprects = %d\n", number_cliprects);
va_TraceMsg(idx, "\tflags = 0x%08x\n", flags);
} }
...@@ -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