Commit b7849f39 authored by Austin Yuan's avatar Austin Yuan

Refine VA_FOOL, and delete the hard coded clip va_fool_264.h

    Move test/vainfo into test/vainfo/*
    Add prototype of vaCreateSurfacesForUserPtr for V4L2 user pointer support
    Fix klocwork critical issues. Use strnlen and snprintf instead of strlen and sprintf.
    New interface vaQuerySrufaceError for decode error report and concealment
    Encode data structure change (long term reference picture interface)
    Add h264 constrained baseline profile support.
Signed-off-by: default avatarElaine Wang <elaine.wang@intel.com>
Signed-off-by: default avatarBignlin Chen <binglin.chen.wang@intel.com>
Signed-off-by: default avatarYan Zhuang <yanx.zhunag@intel.com>
Signed-off-by: default avatarGuoliang Ji <guoliangx.ji@intel.com>
parent aa7a8a0b
# Recursive call sub-folder Android.mk
#
# include $(call all-subdir-makefiles)
LOCAL_PATH := $(my-dir)
include $(LOCAL_PATH)/va/Android.mk
include $(call all-subdir-makefiles)
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <GL/glx.h> header file. */
#define HAVE_GL_GLX_H 1
/* Define to 1 if you have the <GL/gl.h> header file. */
#define HAVE_GL_GL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "libva"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "waldo.bastian@intel.com"
/* Define to the full name of this package. */
#define PACKAGE_NAME "libva"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libva 0.31.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libva"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.31.1"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.31.1"
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
......@@ -170,6 +170,7 @@ AC_OUTPUT([
test/decode/Makefile
test/putsurface/Makefile
test/encode/Makefile
test/vainfo/Makefile
libva.pc
libva-x11.pc
libva-glx.pc
......
#%define moduledir %(pkg-config xorg-server --variable=moduledir)
%define driverdir %{_libdir}/
%define reldate 04282009
Name: libva
Version: 1.0.6
Release: 0.0
License: MIT
License: MIT license
Source: %{name}-%{version}.tar.bz2
NoSource: 0
Group: Development/Libraries
Summary: Video Acceleration (VA) API for Linux
URL: http://freedesktop.org/wiki/Software/vaapi
......@@ -44,37 +42,7 @@ unset LD_AS_NEEDED
make
%install
rm -rf $RPM_BUILD_ROOT
%make_install
mkdir -p $RPM_BUILD_ROOT%{driverdir}
install -m 755 ./dummy_drv_video/.libs/dummy_drv_video.so $RPM_BUILD_ROOT%{driverdir}/dummy_drv_video.so
install -m 755 ./va/.libs/libva.so.1 $RPM_BUILD_ROOT%{driverdir}/libva.so.1
install -m 755 ./va/.libs/libva.so.1.0.6 $RPM_BUILD_ROOT%{driverdir}/libva.so.1.0.6
install -m 755 ./va/.libs/libva-tpi.so.1 $RPM_BUILD_ROOT%{driverdir}/libva-tpi.so.1
install -m 755 ./va/.libs/libva-tpi.so.1.0.6 $RPM_BUILD_ROOT%{driverdir}/libva-tpi.so.1.0.6
install -m 755 ./va/.libs/libva-x11.so.1 $RPM_BUILD_ROOT%{driverdir}/libva-x11.so.1
install -m 755 ./va/.libs/libva-x11.so.1.0.6 $RPM_BUILD_ROOT%{driverdir}/libva-x11.so.1.0.6
install -m 755 ./va/.libs/libva-glx.so.1 $RPM_BUILD_ROOT%{driverdir}/libva-glx.so.1
install -m 755 ./va/.libs/libva-glx.so.1.0.6 $RPM_BUILD_ROOT%{driverdir}/libva-glx.so.1.0.6
install -m 555 ./test/vainfo $RPM_BUILD_ROOT%{_bindir}/vainfo
install -m 555 ./test/basic/test_* $RPM_BUILD_ROOT%{_bindir}/
install -m 555 ./test/decode/mpeg2vldemo $RPM_BUILD_ROOT%{_bindir}/mpeg4vldemo
install -m 555 ./test/encode/h264encode $RPM_BUILD_ROOT%{_bindir}/h264encode
install -m 555 ./test/putsurface/putsurface $RPM_BUILD_ROOT%{_bindir}/putsurface
install -m 666 ./va/va_tpi.h $RPM_BUILD_ROOT%{_includedir}/va/va_tpi.h
install -m 666 ./va/va_x11.h $RPM_BUILD_ROOT%{_includedir}/va/va_x11.h
install -m 666 ./va/va_version.h $RPM_BUILD_ROOT%{_includedir}/va/va_version.h
install -m 666 ./va/va_backend.h $RPM_BUILD_ROOT%{_includedir}/va/va_backend.h
install -m 666 ./va/x11/va_dri2.h $RPM_BUILD_ROOT%{_includedir}/va/x11/va_dri2.h
install -m 666 ./va/va_dummy.h $RPM_BUILD_ROOT%{_includedir}/va/va_dummy.h
install -m 666 ./va/va_backend_tpi.h $RPM_BUILD_ROOT%{_includedir}/va/va_backend_tpi.h
install -m 666 ./va/va.h $RPM_BUILD_ROOT%{_includedir}/va/va.h
install -m 666 ./va/x11/va_dricommon.h $RPM_BUILD_ROOT%{_includedir}/va/va_dricommon.h
install -m 666 ./va/x11/va_dri.h $RPM_BUILD_ROOT%{_includedir}/va/va_dri.h
install -m 666 ./va/glx/va_glx.h $RPM_BUILD_ROOT%{_includedir}/va/va_glx.h
install -m 666 ./va/glx/va_backend_glx.h $RPM_BUILD_ROOT%{_includedir}/va/va_backend_glx.h
%clean
rm -rf $RPM_BUILD_ROOT
......@@ -85,33 +53,31 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_libdir}/libva.so.1
%{_libdir}/libva.so.1.0.6
%{_libdir}/libva.so.%{version}
%{_libdir}/libva-tpi.so.1
%{_libdir}/libva-tpi.so.1.0.6
%{_libdir}/libva-tpi.so.%{version}
%{_libdir}/libva-x11.so.1
%{_libdir}/libva-x11.so.1.0.6
%{_libdir}/libva-x11.so.%{version}
%{_libdir}/libva-glx.so.1
%{_libdir}/libva-glx.so.1.0.6
%{_libdir}/libva-glx.so.%{version}
%{_bindir}/vainfo
%{_bindir}/test_*
%{_bindir}/h264encode
%{_bindir}/mpeg2vldemo
%{_bindir}/putsurface
%{driverdir}/dummy_drv_video.so
%{_libdir}/dri/dummy_drv_video.so
%{_includedir}/va/va_tpi.h
%{_includedir}/va/va_x11.h
%{_includedir}/va/va_version.h
%{_includedir}/va/va_backend.h
%{_includedir}/va/x11/va_dri2.h
%{_includedir}/va/va_dri2.h
%{_includedir}/va/va_dummy.h
%{_includedir}/va/va_backend_tpi.h
%{_includedir}/va/va.h
%{_includedir}/va/va_dricommon.h
%{_includedir}/va/va_dri.h
%{_includedir}/va/va_glx.h
%{_includedir}/va/va_backend_glx.h
%files devel
%defattr(-,root,root,-)
......@@ -120,9 +86,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libva.so
%{_libdir}/libva-tpi.so
%{_libdir}/libva-x11.so
%{_libdir}/libva-glx.so
%{_libdir}/pkgconfig/libva.pc
%{_libdir}/pkgconfig/libva-tpi.pc
%{_libdir}/pkgconfig/libva-x11.pc
%{_libdir}/pkgconfig/libva-glx.pc
%changelog
* Wed Dec 23 2009 Prajwal Mohan <prajwal.karur.mohan@intel.com> 1.0.1
......
# For vainfo
# =====================================================
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
vainfo.c
LOCAL_CFLAGS += \
-DANDROID
LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva
LOCAL_MODULE := vainfo
LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils
include $(BUILD_EXECUTABLE)
# Recursive call sub-folder Android.mk
#
include $(call all-subdir-makefiles)
......@@ -21,15 +21,7 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bin_PROGRAMS = vainfo
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/test/basic -I$(top_srcdir)/src/x11
vainfo_LDADD = $(top_builddir)/va/$(libvacorelib) $(top_builddir)/va/$(libvabackendlib)
vainfo_DEPENDENCIES = $(top_builddir)/va/$(libvacorelib) $(top_builddir)/va/$(libvabackendlib)
vainfo_SOURCES = vainfo.c
SUBDIRS = basic decode encode putsurface
SUBDIRS = basic decode encode putsurface vainfo
valgrind: vainfo
valgrind --leak-check=full --show-reachable=yes .libs/vainfo;
......@@ -112,7 +112,7 @@ static int save_coded_buf(VABufferID coded_buf, int current_frame, int frame_ski
va_status = vaMapBuffer(va_dpy,coded_buf,(void **)(&buf_list));
CHECK_VASTATUS(va_status,"vaMapBuffer");
while (buf_list != NULL) {
printf("Write %d bytes\n", buf_list->size);
printf("Write %d bytes", buf_list->size);
coded_size += write(coded_fd, buf_list->buf, buf_list->size);
buf_list = buf_list->next;
}
......
# For putsurface
# =====================================================
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
putsurface-android.cpp
LOCAL_CFLAGS += \
-DANDROID
LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva
LOCAL_MODULE := putsurface
LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils libutils libui libsurfaceflinger_client
include $(BUILD_EXECUTABLE)
......@@ -21,8 +21,6 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
static int yuvgen_planar(int width, int height,
unsigned char *Y_start, int Y_pitch,
unsigned char *U_start, int U_pitch,
......@@ -106,9 +104,9 @@ static int upload_surface(VADisplay va_dpy, VASurfaceID surface_id,
/* assume surface is planar format */
yuvgen_planar(surface_image.width, surface_image.height,
surface_p, surface_image.pitches[0],
U_start, surface_image.pitches[1],
V_start, surface_image.pitches[2],
(unsigned char *)surface_p, surface_image.pitches[0],
(unsigned char *)U_start, surface_image.pitches[1],
(unsigned char *)V_start, surface_image.pitches[2],
(surface_image.format.fourcc==VA_FOURCC_NV12),
box_width, row_shift, field);
......
/*
* Copyright (c) 2008-2009 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* 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
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <va/va.h>
#include <va/va_android.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <utils/Log.h>
#include <surfaceflinger/ISurfaceComposer.h>
#include <surfaceflinger/Surface.h>
#include <surfaceflinger/ISurface.h>
#include <surfaceflinger/SurfaceComposerClient.h>
#include <binder/MemoryHeapBase.h>
#define Display unsigned int
#include <assert.h>
#include <pthread.h>
/*currently, if XCheckWindowEvent was called in more than one thread, it would cause
* XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
* after 87 requests (83 known processed) with 0 events remaining.
*
* X Error of failed request: BadGC (invalid GC parameter)
* Major opcode of failed request: 60 (X_FreeGC)
* Resource id in failed request: 0x600034
* Serial number of failed request: 398
* Current serial number in output stream: 399
* The root cause is unknown. */
#define CHECK_VASTATUS(va_status,func) \
if (va_status != VA_STATUS_SUCCESS) { \
fprintf(stderr,"%s:%s (%d) failed,exit\n", __func__, func, __LINE__); \
exit(1); \
}
#include "loadsurface.h"
#define SURFACE_NUM 5
static VASurfaceID surface_id[SURFACE_NUM];
static int surface_width = 352, surface_height = 288;
static int win_width=352, win_height=288;
static int win_thread0 = 0, win_thread1 = 0;
static Display *x11_display;
static VADisplay va_dpy;
static int multi_thread = 0;
static int test_clip = 0;
static int display_field = VA_FRAME_PICTURE;
static int verbose = 0;
static pthread_mutex_t surface_mutex[SURFACE_NUM];
//static pthread_mutex_t gmutex;
static int box_width = 32;
using namespace android;
sp<SurfaceComposerClient> client;
sp<Surface> android_surface;
sp<ISurface> android_isurface;
sp<SurfaceControl> surface_ctrl;
sp<SurfaceComposerClient> client1;
sp<Surface> android_surface1;
sp<ISurface> android_isurface1;
sp<SurfaceControl> surface_ctrl1;
namespace android {
class Test {
public:
static const sp<ISurface>& getISurface(const sp<Surface>& s) {
return s->getISurface();
}
};
};
static int create_window(int width, int height)
{
sp<ProcessState> proc(ProcessState::self());
ProcessState::self()->startThreadPool();
printf("Create window0 for thread0\n");
client = new SurfaceComposerClient();
surface_ctrl = client->createSurface(getpid(), 0, width, height, PIXEL_FORMAT_RGB_565, ISurfaceComposer::ePushBuffers);
android_surface = surface_ctrl->getSurface();
android_isurface = Test::getISurface(android_surface);
client->openTransaction();
surface_ctrl->setPosition(0, 0);
client->closeTransaction();
client->openTransaction();
surface_ctrl->setSize(width, height);
client->closeTransaction();
client->openTransaction();
surface_ctrl->setLayer(0x100000);
client->closeTransaction();
win_thread0 = 1;
if (multi_thread == 0)
return 0;
printf("Create window1 for thread1\n");
client1 = new SurfaceComposerClient();
surface_ctrl1 = client1->createSurface(getpid(), 0, width, height, PIXEL_FORMAT_RGB_565, ISurfaceComposer::ePushBuffers);
android_surface1 = surface_ctrl1->getSurface();
android_isurface1 = Test::getISurface(android_surface1);
client1->openTransaction();
surface_ctrl1->setPosition(width, 0);
client1->closeTransaction();
client1->openTransaction();
surface_ctrl1->setSize(width, height);
client1->closeTransaction();
client1->openTransaction();
surface_ctrl1->setLayer(0x100000);
client1->closeTransaction();
win_thread1 = 2;
return 0;
}
static VASurfaceID get_next_free_surface(int *index)
{
VASurfaceStatus surface_status;
int i;
assert(index);
for (i=0; i<SURFACE_NUM; i++) {
surface_status = (VASurfaceStatus)0;
vaQuerySurfaceStatus(va_dpy, surface_id[i], &surface_status);
if (surface_status == VASurfaceReady)
{
if (0 == pthread_mutex_trylock(&surface_mutex[i]))
{
*index = i;
break;
}
}
}
if (i==SURFACE_NUM)
return VA_INVALID_SURFACE;
else
return surface_id[i];
}
/*
* Helper function for profiling purposes
*/
static unsigned long get_tick_count(void)
{
struct timeval tv;
if (gettimeofday(&tv, NULL))
return 0;
return tv.tv_usec/1000+tv.tv_sec*1000;
}
static void* putsurface_thread(void *data)
{
int width=win_width, height=win_height;
int win = (int)data;
int quit = 0;
VAStatus vaStatus;
int row_shift = 0;
int index = 0;
unsigned int frame_num=0, start_time, putsurface_time;
VARectangle cliprects[2]; /* client supplied clip list */
sp<ISurface> win_isurface;
if (win == win_thread0) {
printf("Enter into thread0\n\n");
win_isurface = android_isurface;
}
if (win == win_thread1) {
printf("Enter into thread1\n\n");
win_isurface = android_isurface1;
}
printf("vaPutSurface into a Window directly\n\n");
putsurface_time = 0;
while (!quit) {
VASurfaceID surface_id = VA_INVALID_SURFACE;
while (surface_id == VA_INVALID_SURFACE)
surface_id = get_next_free_surface(&index);
if (verbose) printf("Thread %x Display surface 0x%p,\n", (unsigned int)win, (void *)surface_id);
upload_surface(va_dpy, surface_id, box_width, row_shift, display_field);
start_time = get_tick_count();
vaStatus = vaPutSurface(va_dpy, surface_id, win_isurface,
0,0,surface_width,surface_height,
0,0,width,height,
(test_clip==0)?NULL:&cliprects[0],
(test_clip==0)?0:2,
display_field);
CHECK_VASTATUS(vaStatus,"vaPutSurface");
putsurface_time += (get_tick_count() - start_time);
if ((frame_num % 0xff) == 0) {
fprintf(stderr, "%.2f FPS \r", 256000.0 / (float)putsurface_time);
putsurface_time = 0;
if (test_clip) {
srand((unsigned)time(NULL));
cliprects[0].x = (rand() % width);
cliprects[0].y = (rand() % height);
cliprects[0].width = (rand() % (width - cliprects[0].x));
cliprects[0].height = (rand() % (height - cliprects[0].y));
cliprects[1].x = (rand() % width);
cliprects[1].y = (rand() % height);
cliprects[1].width = (rand() % (width - cliprects[1].x));
cliprects[1].height = (rand() % (height - cliprects[1].y));
printf("\nTest clip (%d,%d, %d x %d) and (%d,%d, %d x %d) \n",
cliprects[0].x, cliprects[0].y, cliprects[0].width, cliprects[0].height,
cliprects[1].x, cliprects[1].y, cliprects[1].width, cliprects[1].height);
}
}
pthread_mutex_unlock(&surface_mutex[index]);
row_shift++;
if (row_shift==(2*box_width)) row_shift= 0;
frame_num++;
if( frame_num == 0x200 )
quit = 1;
}
if(win == win_thread1)
pthread_exit(NULL);
return 0;
}
int main(int argc,char **argv)
{
int major_ver, minor_ver;
VAStatus va_status;
pthread_t thread1;
int ret;
char c;
int i;
while ((c =getopt(argc,argv,"w:h:d:f:tcep?nv") ) != EOF) {
switch (c) {
case '?':
printf("putsurface <options>\n");
printf(" -d the dimension of black/write square box, default is 32\n");
printf(" -t multi-threads\n");
printf(" -c test clipbox\n");
printf(" -f <1/2> top field, or bottom field\n");
printf(" -v verbose output\n");
exit(0);
break;
case 'w':
win_width = atoi(optarg);
break;
case 'h':
win_height = atoi(optarg);
break;
case 'd':
box_width = atoi(optarg);
break;
case 't':
multi_thread = 1;
printf("Two threads to do vaPutSurface\n");
break;
case 'c':
test_clip = 1;
break;
case 'f':
if (atoi(optarg) == 1) {
printf("Display TOP field\n");
display_field = VA_TOP_FIELD;
} else if (atoi(optarg) == 2) {
printf("Display BOTTOM field\n");
display_field = VA_BOTTOM_FIELD;
} else
printf("The validate input for -f is: 1(top field)/2(bottom field)\n");
break;
case 'v':
verbose = 1;
printf("Enable verbose output\n");
break;
}
}
x11_display = (Display*)malloc(sizeof(Display));
*(x11_display) = 0x18c34078;
if (x11_display == NULL) {
fprintf(stderr, "Can't connect X server!\n");
exit(-1);
}
create_window(win_width, win_height);
va_dpy = vaGetDisplay(x11_display);
va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
CHECK_VASTATUS(va_status, "vaInitialize");
surface_width = win_width;
surface_height = win_height;
va_status = vaCreateSurfaces(va_dpy,surface_width, surface_height,
VA_RT_FORMAT_YUV420, SURFACE_NUM, &surface_id[0]);
CHECK_VASTATUS(va_status, "vaCreateSurfaces");
/*
if (check_event)
pthread_mutex_init(&gmutex, NULL);
*/
for(i = 0; i< SURFACE_NUM; i++)
pthread_mutex_init(&surface_mutex[i], NULL);
if (multi_thread == 1)
ret = pthread_create(&thread1, NULL, putsurface_thread, (void*)win_thread1);
putsurface_thread((void *)win_thread0);
if (multi_thread == 1)
pthread_join(thread1, (void **)&ret);
printf("thread1 is free\n");
vaDestroySurfaces(va_dpy,&surface_id[0],SURFACE_NUM);
vaTerminate(va_dpy);
return 0;
}
......@@ -98,8 +98,8 @@ static Pixmap create_pixmap(int width, int height)
XGetWindowAttributes (x11_display, root, &attr);
printf("Create a pixmap from ROOT window %dx%d\n\n", attr.width, attr.height);
pixmap = XCreatePixmap(x11_display, root, attr.width, attr.height,
printf("Create a pixmap from ROOT window %dx%d, pixmap size %dx%d\n\n", attr.width, attr.height, width, height);
pixmap = XCreatePixmap(x11_display, root, width, height,
DefaultDepth(x11_display, DefaultScreen(x11_display)));
return pixmap;
......
# For vainfo
# =====================================================
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
vainfo.c
LOCAL_CFLAGS += \
-DANDROID
LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva
LOCAL_MODULE := vainfo
LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils
include $(BUILD_EXECUTABLE)
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# 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
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bin_PROGRAMS = vainfo
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/test/basic -I$(top_srcdir)/src/x11
vainfo_LDADD = $(top_builddir)/va/$(libvacorelib) $(top_builddir)/va/$(libvabackendlib)
vainfo_DEPENDENCIES = $(top_builddir)/va/$(libvacorelib) $(top_builddir)/va/$(libvabackendlib)
vainfo_SOURCES = vainfo.c
valgrind: vainfo
valgrind --leak-check=full --show-reachable=yes .libs/vainfo;
......@@ -56,6 +56,7 @@ static char * profile_string(VAProfile profile)
case VAProfileVC1Main: return "VAProfileVC1Main";
case VAProfileVC1Advanced: return "VAProfileVC1Advanced";
case VAProfileH263Baseline: return "VAProfileH263Baseline";
case VAProfileH264ConstrainedBaseline: return "VAProfileH264ConstrainedBaseline";
}
return "<unknown profile>";
}
......
......@@ -10,35 +10,15 @@ include $(CLEAR_VARS)
#LIBVA_MINOR_VERSION := 31
#LIBVA_MAJOR_VERSION := 0
LOCAL_MODULE := libva
LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils
include $(BUILD_SHARED_LIBRARY)
intermediates := $(local-intermediates-dir)
GEN := $(intermediates)/va_version.h
$(GEN): PRIVATE_GEN_VERSION := $(LOCAL_PATH)/../build/gen_version.sh
$(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/va_version.h.in
$(GEN): PRIVATE_CUSTOM_TOOL = sh $(PRIVATE_GEN_VERSION) $(LOCAL_PATH)/.. $(PRIVATE_INPUT_FILE) > $@
$(GEN): $(LOCAL_PATH)/va_version.h
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
LOCAL_SRC_FILES := \
va.c \
va_trace.c \
va_fool.c
va_fool.c
LOCAL_CFLAGS += \
-DANDROID \
-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\""
LOCAL_COPY_HEADERS_TO := libva/va
LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva \
$(LOCAL_PATH)/x11 \
......@@ -51,7 +31,23 @@ LOCAL_COPY_HEADERS := \
va_version.h.in \
x11/va_dricommon.h
LOCAL_COPY_HEADERS_TO := libva/va
LOCAL_MODULE := libva
LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils
include $(BUILD_SHARED_LIBRARY)
intermediates := $(local-intermediates-dir)
GEN := $(intermediates)/va_version.h
$(GEN): PRIVATE_GEN_VERSION := $(LOCAL_PATH)/../build/gen_version.sh
$(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/va_version.h.in
$(GEN): PRIVATE_CUSTOM_TOOL = sh $(PRIVATE_GEN_VERSION) $(LOCAL_PATH)/.. $(PRIVATE_INPUT_FILE) > $@
$(GEN): $(LOCAL_PATH)/va_version.h
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
# For libva-android
# =====================================================
......
......@@ -27,7 +27,7 @@ INCLUDES = \
LDADD = \
$(LIBVA_LT_LDFLAGS)
libva_la_SOURCES = va.c va_trace.c va_fool.c
libva_la_SOURCES = va.c va_trace.c va_fool.c va_fool_getframe.c
libva_ladir = $(libdir)
libva_la_LDFLAGS = $(LDADD) -no-undefined
libva_la_LIBADD = $(LIBVA_LIBS) -ldl
......
......@@ -55,6 +55,13 @@ extern int trace_flag;
trace_func(__VA_ARGS__); \
}
extern int fool_decode;
extern int fool_encode;
#define VA_FOOL(fool_func,...) \
if (fool_decode || fool_encode) { \
ret = fool_func(__VA_ARGS__); \
}
/*
* read a config "env" for libva.conf or from environment setting
* liva.conf has higher priority
......@@ -432,8 +439,7 @@ VAStatus vaTerminate (
CHECK_DISPLAY(dpy);
old_ctx = CTX(dpy);
if (old_ctx->handle)
{
if (old_ctx->handle) {
vaStatus = old_ctx->vtable.vaTerminate(old_ctx);
dlclose(old_ctx->handle);
old_ctx->handle = NULL;
......@@ -554,12 +560,19 @@ VAStatus vaCreateConfig (
)
{
VADriverContextP ctx;
VAStatus vaStatus = VA_STATUS_SUCCESS;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
VA_FOOL(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
vaStatus = ctx->vtable.vaCreateConfig ( ctx, 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 vaStatus;
}
VAStatus vaDestroyConfig (
......@@ -600,15 +613,19 @@ VAStatus vaCreateSurfaces (
)
{
VADriverContextP ctx;
VAStatus ret;
VAStatus vaStatus;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
vaStatus = ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
VA_TRACE(va_TraceCreateSurface, dpy, 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;
VA_FOOL(va_FoolCreateSurfaces, dpy, width, height, format, num_surfaces, surfaces);
return vaStatus;
}
......@@ -637,12 +654,17 @@ VAStatus vaCreateContext (
)
{
VADriverContextP ctx;
VAStatus vaStatus;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
VA_TRACE(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
return ctx->vtable.vaCreateContext( ctx, config_id, picture_width, picture_height,
vaStatus = ctx->vtable.vaCreateContext( ctx, config_id, picture_width, picture_height,
flag, render_targets, num_render_targets, context );
VA_TRACE(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
return vaStatus;
}
VAStatus vaDestroyContext (
......@@ -670,9 +692,12 @@ VAStatus vaCreateBuffer (
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if (va_FoolCreateBuffer(dpy, context, type, size, num_elements, data, buf_id))
int ret = 0;
VA_FOOL(va_FoolCreateBuffer, dpy, context, type, size, num_elements, data, buf_id);
if (ret)
return VA_STATUS_SUCCESS;
return ctx->vtable.vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
}
......@@ -698,12 +723,15 @@ VAStatus vaMapBuffer (
{
VADriverContextP ctx;
VAStatus va_status;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if (va_FoolMapBuffer(dpy, buf_id, pbuf))
VA_FOOL(va_FoolMapBuffer, dpy, buf_id, pbuf);
if (ret)
return VA_STATUS_SUCCESS;
va_status = ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf );
if (va_status == VA_STATUS_SUCCESS)
......@@ -720,9 +748,12 @@ VAStatus vaUnmapBuffer (
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if (va_FoolUnmapBuffer(dpy, buf_id))
int ret = 0;
VA_FOOL(va_FoolUnmapBuffer, dpy, buf_id);
if (ret)
return VA_STATUS_SUCCESS;
return ctx->vtable.vaUnmapBuffer( ctx, buf_id );
}
......@@ -761,12 +792,15 @@ VAStatus vaBeginPicture (
)
{
VADriverContextP ctx;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
VA_TRACE(va_TraceBeginPicture, dpy, context, render_target);
if (va_FoolBeginPicture(dpy, context, render_target))
VA_FOOL(va_FoolBeginPicture, dpy, context, render_target);
if (ret)
return VA_STATUS_SUCCESS;
return ctx->vtable.vaBeginPicture( ctx, context, render_target );
......@@ -780,10 +814,13 @@ VAStatus vaRenderPicture (
)
{
VADriverContextP ctx;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if (va_FoolRenderPicture(dpy, context, buffers, num_buffers))
VA_FOOL(va_FoolRenderPicture, dpy, context, buffers, num_buffers);
if (ret)
return VA_STATUS_SUCCESS;
VA_TRACE(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
......@@ -798,12 +835,15 @@ VAStatus vaEndPicture (
{
VAStatus va_status;
VADriverContextP ctx;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if (va_FoolEndPicture(dpy, context)) {
VA_TRACE(va_TraceEndPicture, dpy, context);
return VA_STATUS_SUCCESS;
VA_FOOL(va_FoolEndPicture, dpy, context);
if (ret) {
VA_TRACE(va_TraceEndPicture, dpy, context);
return VA_STATUS_SUCCESS;
}
va_status = ctx->vtable.vaEndPicture( ctx, context );
......@@ -818,14 +858,21 @@ VAStatus vaSyncSurface (
VASurfaceID render_target
)
{
VAStatus va_status;
VADriverContextP ctx;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if (va_FoolSyncSurface( dpy, render_target))
return VA_STATUS_SUCCESS;
VA_FOOL(va_FoolSyncSurface, dpy, render_target);
if (ret)
return VA_STATUS_SUCCESS;
return ctx->vtable.vaSyncSurface( ctx, render_target );
va_status = ctx->vtable.vaSyncSurface( ctx, render_target );
VA_TRACE(va_TraceSyncSurface, dpy, render_target);
return va_status;
}
VAStatus vaQuerySurfaceStatus (
......@@ -834,11 +881,35 @@ VAStatus vaQuerySurfaceStatus (
VASurfaceStatus *status /* out */
)
{
VAStatus va_status;
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
return ctx->vtable.vaQuerySurfaceStatus( ctx, render_target, status );
va_status = ctx->vtable.vaQuerySurfaceStatus( ctx, render_target, status );
VA_TRACE(va_TraceQuerySurfaceStatus, dpy, render_target, status);
return va_status;
}
VAStatus vaQuerySurfaceError (
VADisplay dpy,
VASurfaceID surface,
VAStatus error_status,
void **error_info /*out*/
)
{
VAStatus va_status;
VADriverContextP ctx;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
va_status = ctx->vtable.vaQuerySurfaceError( ctx, surface, error_status, error_info );
VA_TRACE(va_TraceQuerySurfaceError, dpy, surface, error_status, error_info);
return va_status;
}
/* Get maximum number of image formats supported by the implementation */
......@@ -1033,11 +1104,15 @@ VAStatus vaQuerySubpictureFormats (
)
{
VADriverContextP ctx;
int ret = 0;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
if (va_FoolQuerySubpictureFormats(dpy, format_list, flags, num_formats))
VA_FOOL(va_FoolQuerySubpictureFormats, dpy, format_list, flags, num_formats);
if (ret)
return VA_STATUS_SUCCESS;
return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
}
......
......@@ -234,7 +234,8 @@ typedef enum
VAProfileVC1Main = 9,
VAProfileVC1Advanced = 10,
VAProfileH263Baseline = 11,
VAProfileJPEGBaseline = 12
VAProfileJPEGBaseline = 12,
VAProfileH264ConstrainedBaseline = 13
} VAProfile;
/*
......@@ -1168,6 +1169,8 @@ typedef struct _VAEncSliceParameterBuffer
struct {
unsigned int is_intra : 1;
unsigned int disable_deblocking_filter_idc : 2;
unsigned int uses_long_term_ref :1;
unsigned int is_long_term_ref :1;
} bits;
unsigned int value;
} slice_flags;
......@@ -1183,6 +1186,7 @@ typedef struct _VAEncSequenceParameterBufferH264
unsigned char level_idc;
unsigned int intra_period;
unsigned int intra_idr_period;
unsigned int max_num_ref_frames;
unsigned int picture_width_in_mbs;
unsigned int picture_height_in_mbs;
unsigned int bits_per_second;
......@@ -1310,10 +1314,14 @@ VAStatus vaBufferSetNumElements (
* 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.
* BITRATE_OVERFLOW(bit10): The peak bitrate was exceeded for this frame.
* AIR_MB_OVER_THRESHOLD: the number of MBs adapted to Intra MB
*/
#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
#define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW 0x400
#define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD 0xff0000
/*
* device independent data structure for codedbuffer
......@@ -1434,6 +1442,32 @@ VAStatus vaQuerySurfaceStatus (
VASurfaceStatus *status /* out */
);
/*
* Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns
* an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1
*/
typedef struct _VASurfaceDecodeMBErrors
{
int status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
unsigned int start_mb; /* start mb address with errors */
unsigned int end_mb; /* end mb address with errors */
} VASurfaceDecodeMBErrors;
/*
* After the application gets VA_STATUS_ERROR_DECODING_ERROR after calling vaSyncSurface(),
* it can call vaQuerySurfaceError to find out further details on the particular error.
* VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status",
* upon the return, error_info will point to an array of _VASurfaceDecodeMBErrors structure,
* which is allocated and filled by libVA with detailed information on the missing or error macroblocks.
* The array is terminated if "status==-1" is detected.
*/
VAStatus vaQuerySurfaceError(
VADisplay dpy,
VASurfaceID surface,
VAStatus error_status,
void **error_info
);
/*
* Images and Subpictures
* VAImage is used to either get the surface data to client memory, or
......
......@@ -178,6 +178,13 @@ struct VADriverVTable
VASurfaceStatus *status /* out */
);
VAStatus (*vaQuerySurfaceError) (
VADriverContextP ctx,
VASurfaceID render_target,
VAStatus error_status,
void **error_info /*out*/
);
VAStatus (*vaPutSurface) (
VADriverContextP ctx,
VASurfaceID surface,
......
......@@ -51,6 +51,24 @@ struct VADriverVTableTPI
VASurfaceID *surface /* out */
);
VAStatus (*vaCreateSurfacesForUserPtr)(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces, /* out */
unsigned size, /* total buffer size need to be allocated */
unsigned int fourcc, /* expected fourcc */
unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
unsigned int chroma_u_stride, /* chroma stride */
unsigned int chroma_v_stride,
unsigned int luma_offset, /* could be 0 */
unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
unsigned int chroma_v_offset
);
VAStatus (*vaPutSurfaceBuf) (
VADisplay dpy,
VASurfaceID surface,
......
......@@ -26,6 +26,7 @@
#include "va.h"
#include "va_backend.h"
#include "va_trace.h"
#include "va_fool.h"
#include <assert.h>
#include <stdarg.h>
......@@ -39,9 +40,6 @@
#include <unistd.h>
#include <time.h>
#include "va_fool_264.h"
/*
* Do dummy decode/encode, ignore the input data
* In order to debug memory leak or low performance issues, we need to isolate driver problems
......@@ -49,10 +47,10 @@
*
* LIBVA_FOOL_DECODE:
* . if set, decode does nothing, but fill in some YUV data
* LIBVA_FOOL_ENCODE:
* . if set, encode does nothing, but fill in a hard-coded 720P clip into coded buffer.
* LIBVA_FOOL_ENCODE=<clip name>:
* . if set, encode does nothing, but fill in the coded buffer from a H264 clip.
* . VA CONTEXT/CONFIG/SURFACE will call into drivers, but VA Buffer creation is done in here
* . Bypass all ~SvaBeginPic/vaRenderPic/vaEndPic~T
* . Bypass all "vaBeginPic/vaRenderPic/vaEndPic"
* LIBVA_FOOL_POSTP:
* . if set, do nothing for vaPutSurface
*/
......@@ -61,20 +59,28 @@
/* global settings */
/* LIBVA_FOOL_DECODE/LIBVA_FOOL_ENCODE/LIBVA_FOOL_POSTP */
static int fool_decode = 0;
static int fool_encode = 0;
int fool_decode = 0;
int fool_encode = 0;
int fool_postp = 0;
#define NAL_BUF_SIZE 65536 // maximum NAL unit size
#define RING_BUF_SIZE 8192 // input ring buffer size, MUST be a power of two!
#define MAX_FRAME 16
#define SLICE_NUM 4
#define FOOL_CONTEXT_MAX 4
/* per context settings */
static struct _fool_context {
VADisplay dpy; /* should use context as the key */
VAProfile fool_profile; /* current profile for buffers */
VAEntrypoint fool_entrypoint; /* current entrypoint */
FILE *fool_fp_codedclip; /* load a clip from disk for fooling encode*/
char *frame_buf;
/* all buffers with same type share one malloc-ed memory
* bufferID = (buffer numbers with the same type << 8) || type
* the malloc-ed memory can be find by fool_buf[bufferID & 0xff]
......@@ -88,22 +94,23 @@ static struct _fool_context {
#define FOOL_DECODE(idx) (fool_decode && (fool_context[idx].fool_entrypoint == VAEntrypointVLD))
#define FOOL_ENCODE(idx) \
(fool_encode \
&& (fool_context[idx].fool_entrypoint == VAEntrypointEncSlice) \
&& (fool_context[idx].fool_profile >= VAProfileH264Baseline) \
&& (fool_context[idx].fool_profile <= VAProfileH264High))
(fool_encode \
&& (fool_context[idx].fool_entrypoint == VAEntrypointEncSlice) \
&& (fool_context[idx].fool_profile >= VAProfileH264Baseline) \
&& (fool_context[idx].fool_profile <= VAProfileH264High))
#define DPY2INDEX(dpy) \
int idx; \
\
for (idx = 0; idx < FOOL_CONTEXT_MAX; idx++) \
if (fool_context[idx].dpy == dpy) \
break; \
\
if (idx == FOOL_CONTEXT_MAX) \
return 0; /* let driver go */
#define DPY2INDEX(dpy) \
int idx; \
\
for (idx = 0; idx < FOOL_CONTEXT_MAX; idx++) \
if (fool_context[idx].dpy == dpy) \
break; \
\
if (idx == FOOL_CONTEXT_MAX) \
return 0; /* let driver go */ \
/* Prototype declarations (functions defined in va.c) */
......@@ -113,29 +120,29 @@ void va_infoMessage(const char *msg, ...);
int va_parseConfig(char *env, char *env_value);
VAStatus vaBufferInfo(
VADisplay dpy,
VAContextID context, /* in */
VABufferID buf_id, /* in */
VABufferType *type, /* out */
unsigned int *size, /* out */
unsigned int *num_elements /* out */
VADisplay dpy,
VAContextID context, /* in */
VABufferID buf_id, /* in */
VABufferType *type, /* out */
unsigned int *size, /* out */
unsigned int *num_elements /* out */
);
VAStatus vaLockSurface(VADisplay dpy,
VASurfaceID surface,
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
VASurfaceID surface,
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
);
VAStatus vaUnlockSurface(VADisplay dpy,
VASurfaceID surface
VASurfaceID surface
);
......@@ -155,23 +162,30 @@ void va_FoolInit(VADisplay dpy)
fool_postp = 1;
va_infoMessage("LIBVA_FOOL_POSTP is on, dummy vaPutSurface\n");
}
if (va_parseConfig("LIBVA_FOOL_DECODE", NULL) == 0) {
fool_decode = 1;
va_infoMessage("LIBVA_FOOL_DECODE is on, dummy decode\n");
}
if (va_parseConfig("LIBVA_FOOL_ENCODE", &env_value[0]) == 0) {
FILE *tmp = fopen(env_value, "r");
fool_context[fool_index].fool_fp_codedclip = fopen(env_value, "r");
if (tmp)
fool_context[fool_index].fool_fp_codedclip = tmp;
fool_encode = 1;
if (fool_context[fool_index].fool_fp_codedclip) {
fool_encode = 1;
} else
fool_encode = 0;
va_infoMessage("LIBVA_FOOL_ENCODE is on, dummy encode\n");
if (fool_encode) /* malloc the buffer for fake clip */
fool_context[fool_index].frame_buf = malloc(MAX_FRAME*SLICE_NUM*NAL_BUF_SIZE*sizeof(char));
if (fool_context[fool_index].frame_buf == NULL)
fool_encode = 0;
if (fool_encode)
va_infoMessage("LIBVA_FOOL_ENCODE is on, dummy encode\n");
}
if (fool_encode || fool_decode)
......@@ -182,12 +196,18 @@ void va_FoolInit(VADisplay dpy)
int va_FoolEnd(VADisplay dpy)
{
int i;
DPY2INDEX(dpy);
for (i = 0; i < VABufferTypeMax; i++) /* free memory */
for (i = 0; i < VABufferTypeMax; i++) {/* free memory */
if (fool_context[idx].fool_buf[i])
free(fool_context[idx].fool_buf[i]);
}
if (fool_context[idx].fool_fp_codedclip)
fclose(fool_context[idx].fool_fp_codedclip);
if (fool_context[idx].frame_buf)
free(fool_context[idx].frame_buf);
memset(&fool_context[idx], sizeof(struct _fool_context), 0);
return 0;
......@@ -201,16 +221,16 @@ int va_FoolCodedBuf(VADisplay dpy)
int va_FoolCreateConfig(
VADisplay dpy,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list,
int num_attribs,
VAConfigID *config_id /* out */
VADisplay dpy,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list,
int num_attribs,
VAConfigID *config_id /* out */
)
{
DPY2INDEX(dpy);
/* call into driver level to allocate real context/surface/buffers, etc */
fool_context[idx].fool_profile = profile;
fool_context[idx].fool_entrypoint = entrypoint;
......@@ -218,12 +238,12 @@ int va_FoolCreateConfig(
}
static int yuvgen_planar(
int width, int height,
unsigned char *Y_start, int Y_pitch,
unsigned char *U_start, int U_pitch,
unsigned char *V_start, int V_pitch,
int UV_interleave, int box_width, int row_shift,
int field
int width, int height,
unsigned char *Y_start, int Y_pitch,
unsigned char *U_start, int U_pitch,
unsigned char *V_start, int V_pitch,
int UV_interleave, int box_width, int row_shift,
int field
)
{
int row;
......@@ -237,33 +257,33 @@ static int yuvgen_planar(
/* fill garbage data into the other field */
if (((field == VA_TOP_FIELD) && (row &1))
|| ((field == VA_BOTTOM_FIELD) && ((row &1)==0))) {
|| ((field == VA_BOTTOM_FIELD) && ((row &1)==0))) {
memset(Y_row, 0xff, width);
continue;
}
for (jj=0; jj<width; jj++) {
xpos = ((row_shift + jj) / box_width) & 0x1;
if ((xpos == 0) && (ypos == 0))
Y_row[jj] = 0xeb;
if ((xpos == 1) && (ypos == 1))
Y_row[jj] = 0xeb;
if ((xpos == 1) && (ypos == 0))
Y_row[jj] = 0x10;
if ((xpos == 0) && (ypos == 1))
Y_row[jj] = 0x10;
}
}
/* copy UV data */
for( row =0; row < height/2; row++) {
unsigned short value = 0x80;
/* fill garbage data into the other field */
if (((field == VA_TOP_FIELD) && (row &1))
|| ((field == VA_BOTTOM_FIELD) && ((row &1)==0))) {
|| ((field == VA_BOTTOM_FIELD) && ((row &1)==0))) {
value = 0xff;
}
......@@ -274,7 +294,7 @@ static int yuvgen_planar(
} else {
unsigned char *U_row = U_start + row * U_pitch;
unsigned char *V_row = V_start + row * V_pitch;
memset (U_row,value,width/2);
memset (V_row,value,width/2);
}
......@@ -285,12 +305,12 @@ static int yuvgen_planar(
int va_FoolCreateSurfaces(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces /* out */
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces /* out */
)
{
int i;
......@@ -308,73 +328,73 @@ int va_FoolCreateSurfaces(
int box_width = num_surfaces/2;
int row_shift = 0;
VAStatus va_status;
DPY2INDEX(dpy);
if (FOOL_DECODE(idx)) {
/* call into driver level to allocate real context/surface/buffers, etc
* fill in the YUV data, will be overwrite if it is encode context
*/
for (i = 0; i < num_surfaces; i++) {
/* fool decoder: fill with auto-generated YUV data */
va_status = vaLockSurface(dpy, surfaces[i], &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)
return 0;
if (!buffer) {
vaUnlockSurface(dpy, surfaces[i]);
return 0;
}
Y_data = buffer;
/* UV should be same for NV12 */
U_data = buffer + chroma_u_offset;
V_data = buffer + chroma_v_offset;
yuvgen_planar(width, height,
Y_data, luma_stride,
U_data, chroma_v_stride,
V_data, chroma_v_stride,
(fourcc==VA_FOURCC_NV12),
box_width, row_shift, 0);
vaUnlockSurface(dpy, surfaces[i]);
row_shift++;
if (row_shift==(2*box_width))
row_shift= 0;
}
return 0; /* the return value is ignored */
/* call into driver level to allocate real context/surface/buffers, etc
* fill in the YUV data, will be overwrite if it is encode context
*/
for (i = 0; i < num_surfaces; i++) {
/* fool decoder: fill with auto-generated YUV data */
va_status = vaLockSurface(dpy, surfaces[i], &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)
return 0;
if (!buffer) {
vaUnlockSurface(dpy, surfaces[i]);
return 0;
}
Y_data = buffer;
/* UV should be same for NV12 */
U_data = buffer + chroma_u_offset;
V_data = buffer + chroma_v_offset;
yuvgen_planar(width, height,
Y_data, luma_stride,
U_data, chroma_v_stride,
V_data, chroma_v_stride,
(fourcc==VA_FOURCC_NV12),
box_width, row_shift, 0);
vaUnlockSurface(dpy, surfaces[i]);
row_shift++;
if (row_shift==(2*box_width))
row_shift= 0;
}
return 0; /* the return value is ignored */
}
return 0; /* the return value is ignored */
}
VAStatus va_FoolCreateBuffer (
VADisplay dpy,
VAContextID context, /* in */
VABufferType type, /* in */
unsigned int size, /* in */
unsigned int num_elements, /* in */
void *data, /* in */
VABufferID *buf_id /* out */
VADisplay dpy,
VAContextID context, /* in */
VABufferType type, /* in */
unsigned int size, /* in */
unsigned int num_elements, /* in */
void *data, /* in */
VABufferID *buf_id /* out */
)
{
DPY2INDEX(dpy);
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx)) { /* fool buffer creation */
int new_size = size * num_elements;
if (type == VAEncCodedBufferType) /* only a VACodedBufferSegment */
new_size = sizeof(VACodedBufferSegment);
if (fool_context[idx].fool_buf_size[type] == 0)
fool_context[idx].fool_buf[type] = calloc(1, new_size);
else if (fool_context[idx].fool_buf_size[type] <= new_size)
if (fool_context[idx].fool_buf_size[type] == 0)
fool_context[idx].fool_buf[type] = calloc(1, new_size);
else if (fool_context[idx].fool_buf_size[type] <= new_size)
fool_context[idx].fool_buf[type] = realloc(fool_context[idx].fool_buf, new_size);
if (fool_context[idx].fool_buf[type] == NULL) {
......@@ -388,18 +408,17 @@ VAStatus va_FoolCreateBuffer (
*/
fool_context[idx].fool_buf_count[type]++;
*buf_id = (fool_context[idx].fool_buf_count[type] << 8) | type;
return 1; /* don't call into driver */
}
return 0; /* let driver go ... */
}
VAStatus va_FoolMapBuffer (
VADisplay dpy,
VABufferID buf_id, /* in */
void **pbuf /* out */
VADisplay dpy,
VABufferID buf_id, /* in */
void **pbuf /* out */
)
{
VABufferType type;
......@@ -409,11 +428,11 @@ VAStatus va_FoolMapBuffer (
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx)) { /* fool buffer creation */
unsigned int buf_idx = buf_id & 0xff;
/*Image buffer?*/
vaBufferInfo(dpy, fool_context[idx].context, buf_id, &type, &size, &num_elements);
if (type == VAImageBufferType && FOOL_ENCODE(idx))
return 0;
/* Image buffer? */
vaBufferInfo(dpy, fool_context[idx].context, buf_id, &type, &size, &num_elements);
if (type == VAImageBufferType && FOOL_ENCODE(idx))
return 0;
/* buf_id is the buffer type */
if (fool_context[idx].fool_buf[buf_idx] != NULL)
......@@ -423,47 +442,44 @@ VAStatus va_FoolMapBuffer (
/* expect APP to MapBuffer when get the the coded data */
if (*pbuf && (buf_idx == VAEncCodedBufferType)) { /* it is coded buffer */
/* should read from a clip, here we use the hardcoded h264_720p_nal */
memcpy(*pbuf, &h264_720p_nal[h264_720p_nal_idx], sizeof(VACodedBufferSegment));
h264_720p_nal_idx++;
if (h264_720p_nal_idx == H264_720P_NAL_NUMBER)
h264_720p_nal_idx = 0; /* reset to 0 */
/* read from a clip */
va_FoolGetFrame(fool_context[idx].fool_fp_codedclip,
fool_context[idx].frame_buf);
*pbuf = fool_context[idx].frame_buf;
}
return 1; /* don't call into driver */
}
return 0; /* let driver go ... */
}
int va_FoolBeginPicture(
VADisplay dpy,
VAContextID context,
VASurfaceID render_target
VADisplay dpy,
VAContextID context,
VASurfaceID render_target
)
{
DPY2INDEX(dpy);
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx))
{
if (fool_context[idx].context == 0)
fool_context[idx].context = context;
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx)) {
if (fool_context[idx].context == 0)
fool_context[idx].context = context;
return 1; /* don't call into driver level */
}
return 0; /* let driver go ... */
}
int va_FoolRenderPicture(
VADisplay dpy,
VAContextID context,
VABufferID *buffers,
int num_buffers
VADisplay dpy,
VAContextID context,
VABufferID *buffers,
int num_buffers
)
{
DPY2INDEX(dpy);
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx))
return 1; /* don't call into driver level */
......@@ -472,8 +488,8 @@ int va_FoolRenderPicture(
int va_FoolEndPicture(
VADisplay dpy,
VAContextID context
VADisplay dpy,
VAContextID context
)
{
DPY2INDEX(dpy);
......@@ -499,46 +515,46 @@ int va_FoolEndPicture(
}
int va_FoolSyncSurface(
VADisplay dpy,
VASurfaceID render_target)
VADisplay dpy,
VASurfaceID render_target
)
{
DPY2INDEX(dpy);
/*Fill in black and white squares. */
if (FOOL_DECODE(idx) || FOOL_DECODE(idx))
{
return 1;
}
return 1;
return 0;
}
VAStatus va_FoolUnmapBuffer (
VADisplay dpy,
VABufferID buf_id /* in */
VAStatus va_FoolUnmapBuffer(
VADisplay dpy,
VABufferID buf_id /* in */
)
{
DPY2INDEX(dpy);
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx)) { /* fool buffer creation */
return 1;
}
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx))
return 1; /* fool buffer creation */
return 0;
}
VAStatus va_FoolQuerySubpictureFormats (
VADisplay dpy,
VAImageFormat *format_list,
unsigned int *flags,
unsigned int *num_formats
VAStatus va_FoolQuerySubpictureFormats(
VADisplay dpy,
VAImageFormat *format_list,
unsigned int *flags,
unsigned int *num_formats
)
{
DPY2INDEX(dpy);
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx)) {
if (num_formats)
*num_formats = 0;
return 1;
if (num_formats)
*num_formats = 0;
return 1;
}
return 0;
}
......
......@@ -26,12 +26,18 @@
#ifndef VA_FOOL_H
#define VA_FOOL_H
#include <stdio.h>
void va_FoolInit(VADisplay dpy);
int va_FoolEnd(VADisplay dpy);
int va_FoolGetFrame(FILE *input_fp, char *frame_buf);
int va_FoolCodedBuf(VADisplay dpy);
int va_FoolCreateConfig(
VADisplay dpy,
VAProfile profile,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* The code refers to
* http://keyj.s2000.at/files/projects/h264-src.tar.gz
*/
#include <string.h>
#include <stdio.h>
#define SLICE_NUM 4
#define NAL_BUF_SIZE 65536 // maximum NAL unit size
#define RING_BUF_SIZE 8192 // input ring buffer size, MUST be a power of two!
typedef struct _nal_unit {
int NumBytesInNALunit;
int forbidden_zero_bit;
int nal_ref_idc;
int nal_unit_type;
unsigned char *last_rbsp_byte;
} nal_unit;
typedef struct _slice_header {
int first_mb_in_slice;
} slice_header;
static int get_next_nal_unit(FILE *input_fp, nal_unit *nalu);
static int get_unsigned_exp_golomb();
static void decode_slice_header(slice_header *sh);
static void input_read(FILE *input_fp, unsigned char *dest, int size);
static int input_get_bits(int bit_count);
static unsigned char nal_buf[NAL_BUF_SIZE];
static unsigned char ring_buf[RING_BUF_SIZE];
static int input_remain = 0;
static int ring_pos = 0;
static int nal_pos;
static int nal_bit;
static int frame_no = 0, cur_frame_no = 0;
#define SLICE_NUM 4
#define RING_MOD ((RING_BUF_SIZE)-1)
#define HALF_RING ((RING_BUF_SIZE)/2)
#define gnn_advance() do { \
ring_pos = (ring_pos+1)&RING_MOD; \
--input_remain; \
if (ring_pos==0) input_read(input_fp, &ring_buf[HALF_RING],HALF_RING); \
if (ring_pos==HALF_RING) input_read(input_fp, &ring_buf[0],HALF_RING); \
} while(0)
#define gnn_add_segment(end) do { \
int size = end-segment_start; \
if (size>0) { \
memcpy(&nal_buf[nalu_size],&ring_buf[segment_start],size); \
nalu_size += size; \
} \
segment_start = end&RING_MOD; \
} while(0)
static int input_get_bits(int bit_count)
{
int res = 0;
register unsigned int x =
(nal_buf[nal_pos]<<24)|
(nal_buf[nal_pos+1]<<16)|
(nal_buf[nal_pos+2]<<8)|
nal_buf[nal_pos+3];
res = (x>>(32-bit_count-nal_bit))&((1<<bit_count)-1);
nal_bit += bit_count;
nal_pos += nal_bit>>3;
nal_bit &= 7;
return res;
}
static int input_get_one_bit()
{
int res = (nal_buf[nal_pos]>>(7-nal_bit))&1;
if (++nal_bit>7) {
++nal_pos;
nal_bit = 0;
}
return res;
}
static int get_unsigned_exp_golomb()
{
int exp;
for(exp = 0; !input_get_one_bit(); ++exp);
if (exp)
return (1<<exp) - 1 + input_get_bits(exp);
else
return 0;
}
static void decode_slice_header(slice_header *sh )
{
memset((void*)sh,0,sizeof(slice_header));
sh->first_mb_in_slice = get_unsigned_exp_golomb();
}
static void input_read(FILE *input_fp, unsigned char *dest, int size)
{
int count = fread(dest, 1, size, input_fp);
input_remain += count;
}
static int get_next_nal_unit(FILE *input_fp, nal_unit *nalu)
{
int i,segment_start;
int nalu_size = 0;
int NumBytesInRbsp = 0;
/* search for the next NALU start
* here is the sync that the start of the NALU is 0x00000001
*/
for (;;) {
if (input_remain<= 4) {
/* clip restart */
memset(ring_buf,0,sizeof(char)*RING_BUF_SIZE);
memset(nal_buf,0,sizeof(char)*NAL_BUF_SIZE);
fseek(input_fp,0,SEEK_SET);
input_remain = 0;
input_read(input_fp, ring_buf, RING_BUF_SIZE);
ring_pos = 0;
return 1;
}
if ((!ring_buf[ring_pos]) &&
(!ring_buf[(ring_pos+1)&RING_MOD]) &&
(!ring_buf[(ring_pos+2)&RING_MOD]) &&
( ring_buf[(ring_pos+3)&RING_MOD]==1))
break;
gnn_advance();
}
for(i=0;i<4;++i)
gnn_advance();
/* add bytes to the NALU until the end is found */
segment_start = ring_pos;
while (input_remain) {
if ((!ring_buf[ring_pos]) &&
(!ring_buf[(ring_pos+1)&RING_MOD]) &&
(!ring_buf[(ring_pos+2)&RING_MOD]))
break;
ring_pos = (ring_pos+1)&RING_MOD;
--input_remain;
if (ring_pos==0) {
gnn_add_segment(RING_BUF_SIZE);
input_read(input_fp, &ring_buf[HALF_RING],HALF_RING);
}
if (ring_pos==HALF_RING) {
gnn_add_segment(HALF_RING);
input_read(input_fp, &ring_buf[0], HALF_RING);
}
}
gnn_add_segment(ring_pos);
/* read the NAL unit */
nal_pos = 0; nal_bit = 0;
nalu->forbidden_zero_bit = input_get_bits(1);
nalu->nal_ref_idc = input_get_bits(2);
nalu->nal_unit_type = input_get_bits(5);
nalu->last_rbsp_byte = &nal_buf[nalu_size-1];
nalu->NumBytesInNALunit = nalu_size;
return 1;
}
int va_FoolGetFrame(FILE *input_fp, char *frame_buf)
{
int i = 0, frame_pos = 0;
static slice_header sh;
static nal_unit nalu;
/* save the current frame number */
cur_frame_no = frame_no;
/* read the clip , here is the first frame,
* &let the clip go on frame by frame
*/
if (!frame_no)
input_read(input_fp, ring_buf,RING_BUF_SIZE);
while (get_next_nal_unit(input_fp, &nalu)) {
if (nalu.nal_unit_type == 1 || nalu.nal_unit_type == 5) {
decode_slice_header(&sh);
if (0 == sh.first_mb_in_slice) {
++frame_no;
frame_pos = 0;
}
if (frame_no > (cur_frame_no+1))
break;
memcpy(frame_buf+frame_pos, nal_buf+1, sizeof(char)*(nalu.NumBytesInNALunit-1));
frame_pos += nalu.NumBytesInNALunit;
}
}
return 1;
}
......@@ -98,6 +98,48 @@ VAStatus vaCreateSurfaceFromV4L2Buf(
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
/*
* The surfaces could be shared and accessed with extern devices
* which has special requirements, e.g. stride alignment
* This API is used to force libVA video surfaces are allocated
* according to these external requirements
* Special API for V4L2 user pointer support
*/
VAStatus vaCreateSurfacesForUserPtr(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces, /* out */
unsigned size, /* total buffer size need to be allocated */
unsigned int fourcc, /* expected fourcc */
unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
unsigned int chroma_u_stride, /* chroma stride */
unsigned int chroma_v_stride,
unsigned int luma_offset, /* could be 0 */
unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
unsigned int chroma_v_offset
)
{
VADriverContextP ctx;
struct VADriverVTableTPI *tpi;
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
tpi = (struct VADriverVTableTPI *)ctx->vtable_tpi;
if (tpi && tpi->vaCreateSurfacesForUserPtr) {
return tpi->vaCreateSurfacesForUserPtr( ctx, width, height, format, num_surfaces,
surfaces,size, fourcc, luma_stride, chroma_u_stride,
chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset );
} else
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
VAStatus vaPutSurfaceBuf (
VADisplay dpy,
VASurfaceID surface,
......
......@@ -68,6 +68,31 @@ VAStatus vaPutSurfaceBuf (
unsigned int flags /* de-interlacing flags */
);
/*
* The surfaces could be shared and accessed with extern devices
* which has special requirements, e.g. stride alignment
* This API is used to force libVA video surfaces are allocated
* according to these external requirements
* Special API for V4L2 user pointer support
*/
VAStatus vaCreateSurfacesForUserPtr(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces, /* out */
unsigned size, /* total buffer size need to be allocated */
unsigned int fourcc, /* expected fourcc */
unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
unsigned int chroma_u_stride, /* chroma stride */
unsigned int chroma_v_stride,
unsigned int luma_offset, /* could be 0 */
unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
unsigned int chroma_v_offset
);
#ifdef __cplusplus
}
#endif
......@@ -121,24 +121,24 @@ VAStatus vaBufferInfo(
VABufferType *type, /* out */
unsigned int *size, /* out */
unsigned int *num_elements /* out */
);
);
VAStatus vaLockSurface(VADisplay dpy,
VASurfaceID surface,
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
);
VASurfaceID surface,
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
);
VAStatus vaUnlockSurface(VADisplay dpy,
VASurfaceID surface
);
VASurfaceID surface
);
void va_TraceInit(VADisplay dpy)
......@@ -157,8 +157,12 @@ void va_TraceInit(VADisplay dpy)
if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
trace_flag = 1;
sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
/*Check if there is still room for suffix .%d.%d*/
if (strnlen(env_value, 1024) < (1024 - 8))
snprintf(env_value+strnlen(env_value, 1024),
(1025 - 8 - strnlen(env_value, 1024)),
".%d.%d", trace_index, suffix);
tmp = fopen(env_value, "w");
if (tmp) {
......@@ -189,7 +193,10 @@ void va_TraceInit(VADisplay dpy)
/* per-context setting */
if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) {
sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
if (strnlen(env_value, 1024) < (1024 - 8))
snprintf(env_value+strnlen(env_value, 1024),
(1025 - 8 - strnlen(env_value, 1024)),
".%d.%d", trace_index, suffix);
tmp = fopen(env_value, "w");
......@@ -205,7 +212,7 @@ void va_TraceInit(VADisplay dpy)
}
if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) {
sprintf(env_value+strlen(env_value), ".%d.%d", trace_index, suffix);
sprintf(env_value+strnlen(env_value, 1024), ".%d.%d", trace_index, suffix);
tmp = fopen(env_value, "w");
......@@ -523,10 +530,10 @@ void va_TraceMapBuffer (
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);
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 */
......@@ -545,8 +552,6 @@ void va_TraceMapBuffer (
buf_list = buf_list->next;
}
}
static void va_TraceVABuffers(
......@@ -593,10 +598,31 @@ static void va_TraceVAPictureParameterBufferMPEG2(
unsigned int num_elements,
void *data)
{
VAPictureParameterBufferMPEG2 *p=(VAPictureParameterBufferMPEG2 *)data;
DPY2INDEX(dpy);
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
va_TraceMsg(idx,"VAPictureParameterBufferH264\n");
va_TraceMsg(idx,"\thorizontal size= %d\n", p->horizontal_size);
va_TraceMsg(idx,"\tvertical size= %d\n", p->vertical_size);
va_TraceMsg(idx,"\tforward reference picture= %d\n", p->forward_reference_picture);
va_TraceMsg(idx,"\tbackward reference picture= %d\n", p->backward_reference_picture);
va_TraceMsg(idx,"\tpicture coding type= %d\n", p->picture_coding_type);
va_TraceMsg(idx,"\tf mode= %d\n", p->f_code);
va_TraceMsg(idx,"\tpicture coding extension = %d\n", p->picture_coding_extension.value);
va_TraceMsg(idx,"\tintra_dc_precision= %d\n", p->picture_coding_extension.bits.intra_dc_precision);
va_TraceMsg(idx,"\tpicture_structure= %d\n", p->picture_coding_extension.bits.picture_structure);
va_TraceMsg(idx,"\ttop_field_first= %d\n", p->picture_coding_extension.bits.top_field_first);
va_TraceMsg(idx,"\tframe_pred_frame_dct= %d\n", p->picture_coding_extension.bits.frame_pred_frame_dct);
va_TraceMsg(idx,"\tconcealment_motion_vectors= %d\n", p->picture_coding_extension.bits.concealment_motion_vectors);
va_TraceMsg(idx,"\tq_scale_type= %d\n", p->picture_coding_extension.bits.q_scale_type);
va_TraceMsg(idx,"\tintra_vlc_format= %d\n", p->picture_coding_extension.bits.intra_vlc_format);
va_TraceMsg(idx,"\talternate_scan= %d\n", p->picture_coding_extension.bits.alternate_scan);
va_TraceMsg(idx,"\trepeat_first_field= %d\n", p->picture_coding_extension.bits.repeat_first_field);
va_TraceMsg(idx,"\tprogressive_frame= %d\n", p->picture_coding_extension.bits.progressive_frame);
va_TraceMsg(idx,"\tis_first_field= %d\n", p->picture_coding_extension.bits.is_first_field);
return;
}
......@@ -610,10 +636,20 @@ static void va_TraceVAIQMatrixBufferMPEG2(
unsigned int num_elements,
void *data)
{
VAIQMatrixBufferMPEG2 *p=(VAIQMatrixBufferMPEG2 *)data;
DPY2INDEX(dpy);
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
va_TraceMsg(idx,"VAIQMatrixBufferMPEG2\n");
va_TraceMsg(idx,"\tload_intra_quantiser_matrix = %d\n", p->load_intra_quantiser_matrix);
va_TraceMsg(idx,"\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix);
va_TraceMsg(idx,"\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix);
va_TraceMsg(idx,"\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix);
va_TraceMsg(idx,"\tintra_quantiser_matrix = %d\n", p->intra_quantiser_matrix);
va_TraceMsg(idx,"\tnon_intra_quantiser_matrix = %d\n", p->non_intra_quantiser_matrix);
va_TraceMsg(idx,"\tchroma_intra_quantiser_matrix = %d\n", p->chroma_intra_quantiser_matrix);
va_TraceMsg(idx,"\tchroma_non_intra_quantiser_matrix = %d\n", p->chroma_non_intra_quantiser_matrix);
return;
}
......@@ -627,14 +663,25 @@ static void va_TraceVASliceParameterBufferMPEG2(
unsigned int num_elements,
void *data)
{
VASliceParameterBufferMPEG2 *p=(VASliceParameterBufferMPEG2 *)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);
trace_context[idx].trace_slice_size = p->slice_data_size;
va_TraceMsg(idx,"VASliceParameterBufferMPEG2\n");
va_TraceMsg(idx,"\tslice_data_size = %d\n", p->slice_data_size);
va_TraceMsg(idx,"\tslice_data_offset = %d\n", p->slice_data_offset);
va_TraceMsg(idx,"\tslice_data_flag = %d\n", p->slice_data_flag);
va_TraceMsg(idx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
va_TraceMsg(idx,"\tslice_horizontal_position = %d\n", p->slice_horizontal_position);
va_TraceMsg(idx,"\tslice_vertical_position = %d\n", p->slice_vertical_position);
va_TraceMsg(idx,"\tquantiser_scale_code = %d\n", p->quantiser_scale_code);
va_TraceMsg(idx,"\tintra_slice_flag = %d\n", p->intra_slice_flag);
return;
}
......@@ -649,10 +696,52 @@ static void va_TraceVAPictureParameterBufferMPEG4(
unsigned int num_elements,
void *data)
{
DPY2INDEX(dpy);
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
int i;
VAPictureParameterBufferMPEG4 *p=(VAPictureParameterBufferMPEG4 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx,"*VAPictureParameterBufferMPEG4\n");
va_TraceMsg(idx,"\tvop_width = %d\n", p->vop_width);
va_TraceMsg(idx,"\tvop_height = %d\n", p->vop_height);
va_TraceMsg(idx,"\tforward_reference_picture = %d\n", p->forward_reference_picture);
va_TraceMsg(idx,"\tbackward_reference_picture = %d\n", p->backward_reference_picture);
va_TraceMsg(idx,"\tvol_fields value = %d\n", p->vol_fields.value);
va_TraceMsg(idx,"\tshort_video_header= %d\n", p->vol_fields.bits.short_video_header);
va_TraceMsg(idx,"\tchroma_format= %d\n", p->vol_fields.bits.chroma_format);
va_TraceMsg(idx,"\tinterlaced= %d\n", p->vol_fields.bits.interlaced);
va_TraceMsg(idx,"\tobmc_disable= %d\n", p->vol_fields.bits.obmc_disable);
va_TraceMsg(idx,"\tsprite_enable= %d\n", p->vol_fields.bits.sprite_enable);
va_TraceMsg(idx,"\tsprite_warping_accuracy= %d\n", p->vol_fields.bits.sprite_warping_accuracy);
va_TraceMsg(idx,"\tquant_type= %d\n", p->vol_fields.bits.quant_type);
va_TraceMsg(idx,"\tquarter_sample= %d\n", p->vol_fields.bits.quarter_sample);
va_TraceMsg(idx,"\tdata_partitioned= %d\n", p->vol_fields.bits.data_partitioned);
va_TraceMsg(idx,"\treversible_vlc= %d\n", p->vol_fields.bits.reversible_vlc);
va_TraceMsg(idx,"\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
va_TraceMsg(idx,"\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
va_TraceMsg(idx,"\tsprite_trajectory_du =");
for(i=0;i<3;i++)
va_TraceMsg(idx,"\t%d", p->sprite_trajectory_du[i]);
va_TraceMsg(idx,"\n");
va_TraceMsg(idx,"\tsprite_trajectory_dv =");
for(i=0;i<3;i++)
va_TraceMsg(idx,"\t%d", p->sprite_trajectory_dv[i]);
va_TraceMsg(idx,"\n");
va_TraceMsg(idx,"\tvop_fields value = %d\n", p->vop_fields.value);
va_TraceMsg(idx,"\tvop_coding_type= %d\n", p->vop_fields.bits.vop_coding_type);
va_TraceMsg(idx,"\tbackward_reference_vop_coding_type= %d\n", p->vop_fields.bits.backward_reference_vop_coding_type);
va_TraceMsg(idx,"\tvop_rounding_type= %d\n", p->vop_fields.bits.vop_rounding_type);
va_TraceMsg(idx,"\tintra_dc_vlc_thr= %d\n", p->vop_fields.bits.intra_dc_vlc_thr);
va_TraceMsg(idx,"\ttop_field_first= %d\n", p->vop_fields.bits.top_field_first);
va_TraceMsg(idx,"\talternate_vertical_scan_flag= %d\n", p->vop_fields.bits.alternate_vertical_scan_flag);
va_TraceMsg(idx,"\tvop_fcode_forward = %d\n", p->vop_fcode_forward);
va_TraceMsg(idx,"\tvop_fcode_backward = %d\n", p->vop_fcode_backward);
va_TraceMsg(idx,"\tnum_gobs_in_vop = %d\n", p->num_gobs_in_vop);
va_TraceMsg(idx,"\tnum_macroblocks_in_gob = %d\n", p->num_macroblocks_in_gob);
va_TraceMsg(idx,"\tTRB = %d\n", p->TRB);
va_TraceMsg(idx,"\tTRD = %d\n", p->TRD);
return;
}
......@@ -666,11 +755,22 @@ static void va_TraceVAIQMatrixBufferMPEG4(
unsigned int num_elements,
void *data)
{
int i;
VAIQMatrixBufferMPEG4 *p=(VAIQMatrixBufferMPEG4 *)data;
DPY2INDEX(dpy);
/* todo: log VAIQMatrixBufferMPEG4 */
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
va_TraceMsg(idx,"VAIQMatrixBufferMPEG4\n");
va_TraceMsg(idx,"\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
va_TraceMsg(idx,"\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
va_TraceMsg(idx,"\tintra_quant_mat =\n");
for(i=0;i<64;i++)
va_TraceMsg(idx,"\t\t%d\n", p->intra_quant_mat[i]);
va_TraceMsg(idx,"\tnon_intra_quant_mat =\n");
for(i=0;i<64;i++)
va_TraceMsg(idx,"\t\t%d\n", p->non_intra_quant_mat[i]);
return;
}
......@@ -684,14 +784,23 @@ static void va_TraceVASliceParameterBufferMPEG4(
unsigned int num_elements,
void *data)
{
VASliceParameterBufferMPEG4 *p=(VASliceParameterBufferMPEG4 *)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);
trace_context[idx].trace_slice_size = p->slice_data_size;
va_TraceMsg(idx,"VASliceParameterBufferMPEG4\n");
va_TraceMsg(idx,"\tslice_data_size = %d\n", p->slice_data_size);
va_TraceMsg(idx,"\tslice_data_offset = %d\n", p->slice_data_offset);
va_TraceMsg(idx,"\tslice_data_flag = %d\n", p->slice_data_flag);
va_TraceMsg(idx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
va_TraceMsg(idx,"\tmacroblock_number = %d\n", p->macroblock_number);
va_TraceMsg(idx,"\tquant_scale = %d\n", p->quant_scale);
return;
}
......@@ -706,9 +815,9 @@ static void va_TraceVAPictureParameterBufferH264(
void *data)
{
int i;
DPY2INDEX(dpy);
VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAPictureParameterBufferH264\n");
......@@ -728,7 +837,7 @@ static void va_TraceVAPictureParameterBufferH264(
p->ReferenceFrames[i].picture_id,
p->ReferenceFrames[i].frame_idx);
} else
va_TraceMsg(idx, "\t\t%inv-%inv-%inv-%inv\n");
va_TraceMsg(idx, "\t\tinv-inv-inv-inv\n");
}
va_TraceMsg(idx, "\n");
......@@ -859,8 +968,9 @@ static void va_TraceVAIQMatrixBufferH264(
void *data
)
{
int i, j;
VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
int i, j;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAIQMatrixBufferH264\n");
......@@ -902,6 +1012,7 @@ static void va_TraceVAEncSequenceParameterBufferH264(
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, "\tmax_num_ref_frames = %d\n", p->max_num_ref_frames);
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);
......@@ -929,7 +1040,7 @@ static void va_TraceVAEncPictureParameterBufferH264(
VAEncPictureParameterBufferH264 *p = (VAEncPictureParameterBufferH264 *)data;
DPY2INDEX(dpy);
va_TraceMsg(idx, "VAEncSequenceParameterBufferH264\n");
va_TraceMsg(idx, "VAEncPictureParameterBufferH264\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);
......@@ -961,6 +1072,8 @@ static void va_TraceVAEncSliceParameterBuffer(
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);
va_TraceMsg(idx, "\tslice_flags.uses_long_term_ref = %d\n", p->slice_flags.bits.uses_long_term_ref);
va_TraceMsg(idx, "\tslice_flags.is_long_term_ref = %d\n", p->slice_flags.bits.is_long_term_ref);
return;
}
......@@ -1460,8 +1573,8 @@ void va_TraceRenderPicture(
case VAProfileMPEG2Simple:
case VAProfileMPEG2Main:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMsg(idx, "\telement[%d] = ", j);
va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break;
......@@ -1469,17 +1582,18 @@ void va_TraceRenderPicture(
case VAProfileMPEG4AdvancedSimple:
case VAProfileMPEG4Main:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMsg(idx, "\telement[%d] = ", j);
va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break;
case VAProfileH264Baseline:
case VAProfileH264Main:
case VAProfileH264High:
case VAProfileH264ConstrainedBaseline:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMsg(idx, "\t---------------------------\n", j);
va_TraceMsg(idx, "\telement[%d] = ", j);
va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
......@@ -1488,16 +1602,16 @@ void va_TraceRenderPicture(
case VAProfileVC1Main:
case VAProfileVC1Advanced:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMsg(idx, "\t---------------------------\n", j);
va_TraceMsg(idx, "\telement[%d] = ", j);
va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
break;
case VAProfileH263Baseline:
for (j=0; j<num_elements; j++) {
va_TraceMsg(idx, "\t element[%d] = ", j);
va_TraceMsg(idx, "\t------------------", j);
va_TraceMsg(idx, "\t---------------------------\n", j);
va_TraceMsg(idx, "\telement[%d] = ", j);
va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
}
......@@ -1527,7 +1641,7 @@ void va_TraceEndPicture(
/* want to trace codedbuf, and it is encode */
if (trace_context[idx].trace_fp_codedbuf &&
((trace_context[idx].trace_entrypoint == VAEntrypointEncSlice) ||
(trace_context[idx].trace_entrypoint == VAEntrypointEncPicture))) {
(trace_context[idx].trace_entrypoint == VAEntrypointEncPicture))) {
/* force the pipleline finish rendering */
vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
va_TraceCodedBuf(dpy);
......@@ -1542,6 +1656,56 @@ void va_TraceEndPicture(
}
}
void va_TraceSyncSurface(
VADisplay dpy,
VASurfaceID render_target
)
{
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\trender_target = 0x%08x\n", render_target);
}
void va_TraceQuerySurfaceStatus(
VADisplay dpy,
VASurfaceID render_target,
VASurfaceStatus *status /* out */
)
{
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\trender_target = 0x%08x\n", render_target);
va_TraceMsg(idx, "\tstatus = 0x%08x\n", *status);
}
void va_TraceQuerySurfaceError(
VADisplay dpy,
VASurfaceID surface,
VAStatus error_status,
void **error_info /*out*/
)
{
DPY2INDEX(dpy);
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface);
va_TraceMsg(idx, "\terror_status = 0x%08x\n", error_status);
if (error_status == VA_STATUS_ERROR_DECODING_ERROR) {
VASurfaceDecodeMBErrors *p = *error_info;
while (p->status != -1) {
va_TraceMsg(idx, "\t\tstatus = %d\n", p->status);
va_TraceMsg(idx, "\t\tstart_mb = %d\n", p->start_mb);
va_TraceMsg(idx, "\t\tend_mb = %d\n", p->end_mb);
p++; /* next error record */
}
}
}
void va_TraceMaxNumDisplayAttributes (
VADisplay dpy,
......@@ -1552,7 +1716,7 @@ void va_TraceMaxNumDisplayAttributes (
TRACE_FUNCNAME(idx);
va_TraceMsg(idx, "\t>max_display_attributes = %d\n", number);
va_TraceMsg(idx, "\tmax_display_attributes = %d\n", number);
}
void va_TraceQueryDisplayAttributes (
......
......@@ -85,6 +85,24 @@ void va_TraceEndPicture(
VAContextID context
);
void va_TraceSyncSurface(
VADisplay dpy,
VASurfaceID render_target
);
void va_TraceQuerySurfaceStatus(
VADisplay dpy,
VASurfaceID render_target,
VASurfaceStatus *status /* out */
);
void va_TraceQuerySurfaceError(
VADisplay dpy,
VASurfaceID surface,
VAStatus error_status,
void **error_info /*out*/
);
void va_TraceMaxNumDisplayAttributes (
VADisplay dpy,
......
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* 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
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_VERSION_H
#define VA_VERSION_H
/**
* VA_MAJOR_VERSION:
*
* The major version of the VA library (1, if %VA_VERSION is 1.2.3)
*/
#define VA_MAJOR_VERSION (0)
/**
* VA_MINOR_VERSION:
*
* The minor version of the VA library (2, if %VA_VERSION is 1.2.3)
*/
#define VA_MINOR_VERSION (31)
/**
* VA_MICRO_VERSION:
*
* The micro version of the VA library (3, if %VA_VERSION is 1.2.3)
*/
#define VA_MICRO_VERSION (1)
/**
* VA_VERSION:
*
* The full version of the VA library, like 1.2.3
*/
#define VA_VERSION 0.31.1
/**
* VA_VERSION_S:
*
* The full version of the VA library, in string form (suited for
* string concatenation)
*/
#define VA_VERSION_S "0.31.1"
/**
* VA_VERSION_HEX:
*
* Numerically encoded version of the VA library, like 0x010203
*/
#define VA_VERSION_HEX ((VA_MAJOR_VERSION << 24) | \
(VA_MINOR_VERSION << 16) | \
(VA_MICRO_VERSION << 8))
/**
* VA_CHECK_VERSION:
* @major: major version, like 1 in 1.2.3
* @minor: minor version, like 2 in 1.2.3
* @micro: micro version, like 3 in 1.2.3
*
* Evaluates to %TRUE if the version of the VA library is greater
* than @major, @minor and @micro
*/
#define VA_CHECK_VERSION(major,minor,micro) \
(VA_MAJOR_VERSION > (major) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && VA_MICRO_VERSION >= (micro)))
#endif /* VA_VERSION_H */
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