From: Austin Yuan Date: Wed, 27 Oct 2010 23:26:04 +0000 (+0800) Subject: Added the missing files X-Git-Tag: libva-1.0.6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2Flibva-1.0.6;p=profile%2Fivi%2Flibva.git Added the missing files --- diff --git a/config.h b/config.h new file mode 100644 index 0000000..25a1499 --- /dev/null +++ b/config.h @@ -0,0 +1,75 @@ +/* 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 header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GL_GLX_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GL_GL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the 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 */ diff --git a/libva.spec b/libva.spec new file mode 100644 index 0000000..c150576 --- /dev/null +++ b/libva.spec @@ -0,0 +1,169 @@ +#%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 +Source: %{name}-%{version}.tar.bz2 +Group: Development/Libraries +Summary: Video Acceleration (VA) API for Linux +URL: http://freedesktop.org/wiki/Software/vaapi +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +Requires: xorg-x11-server-Xorg + +BuildRequires: libtool xorg-x11-server-devel pkgconfig(xv) pkgconfig(xrandr) +BuildRequires: libdrm-devel libX11-devel libXext-devel libXdamage-devel libXfixes-devel xorg-x11-proto-dri2proto +BuildRequires: xorg-x11-proto-damageproto xorg-x11-proto-kbproto xorg-x11-proto-xproto xorg-x11-proto-xextproto xorg-x11-proto-fixesproto + +%description +The libva library implements the Video Acceleration (VA) API for Linux. +The library loads a hardware dependendent driver. + +%package devel +Summary: Video Acceleration (VA) API for Linux -- development files +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +The libva library implements the Video Acceleration (VA) API for Linux. +The library loads a hardware dependendent driver. + +This package provides the development environment for libva. + +%prep +%setup -q + +%build +unset LD_AS_NEEDED +%autogen +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 + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%{_libdir}/libva.so.1 +%{_libdir}/libva.so.1.0.6 +%{_libdir}/libva-tpi.so.1 +%{_libdir}/libva-tpi.so.1.0.6 +%{_libdir}/libva-x11.so.1 +%{_libdir}/libva-x11.so.1.0.6 +%{_libdir}/libva-glx.so.1 +%{_libdir}/libva-glx.so.1.0.6 +%{_bindir}/vainfo +%{_bindir}/test_* +%{_bindir}/h264encode +%{_bindir}/mpeg2vldemo +%{_bindir}/putsurface + +%{driverdir}/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_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,-) +%dir %{_includedir}/va +%{_includedir}/va/* +%{_libdir}/libva.so +%{_libdir}/libva-tpi.so +%{_libdir}/libva-x11.so +%{_libdir}/libva-glx.so +%{_libdir}/pkgconfig/libva.pc +%{_libdir}/pkgconfig/libva-x11.pc + +%changelog +* Wed Dec 23 2009 Prajwal Mohan 1.0.1 +- Updated libva source to IMG Alpha7 +* Fri Dec 18 2009 Prajwal Mohan 0.31.0 +- Updated libva source to IMG Alpha6 +* Tue Nov 24 2009 Prajwal Mohan 0.31.0 +- Updated libva source +* Mon Nov 9 2009 Prajwal Mohan 0.31.0 +- Update to version 0.31.0 +* Tue Jul 7 2009 Prajwal Mohan 0.30.4 +- Update to version 0.30.4 +* Wed Jun 24 2009 Prajwal Mohan 0.30.20090618 +- Update to version 0.30.20090618_Alpha2.3 +* Thu Jun 11 2009 Priya Vijayan 0.30.20090608 +- Update to version 0.30.20090608 +* Tue Jun 2 2009 Anas Nashif - 0.30~20090514 +- unset LD_AS_NEEDED +* Fri May 15 2009 Anas Nashif 0.30~20090514 +- Update to latest snapshot 20090514 +* Wed Apr 29 2009 Anas Nashif 0.30~20090428 +- Update to 20090428 snpashot +* Sun Apr 26 2009 Anas Nashif 0.30~20090423 +- Update libva.pc with new includedir +* Sun Apr 26 2009 Anas Nashif 0.30~20090423 +- Update to latest snapshot 20090423 +* Sun Apr 26 2009 Anas Nashif 0.30~20090423 +- Update to latest snapshot: 20090423 +* Mon Mar 23 2009 Anas Nashif 0.30~20090323 +- Update to 0.30~20090323 +* Fri Jan 16 2009 Priya Vijayan 0.31 +- Fixing vainfo.c +* Fri Jan 16 2009 Priya Vijayan 0.31 +- fixing va_backend.h +* Fri Jan 16 2009 Priya Vijayan 0.31 +- Updating source +* Tue Jan 6 2009 Priya Vijayan 0.30 +- Update to 0.28-working combination with X Server +* Fri Dec 19 2008 Priya Vijayan 0.30.0 +- Added definition of FOURCC IYUV + * Dec 16 2008 Priya Vijayan +- Initial Import to MRST +* Mon Oct 13 2008 shengquan.yuan@intel.com +- packaged mrst-video-decode-src version 0.0.1 using the buildservice spec file wizard diff --git a/test/Android.mk b/test/Android.mk new file mode 100644 index 0000000..b7c0c0b --- /dev/null +++ b/test/Android.mk @@ -0,0 +1,22 @@ +# 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) + diff --git a/va/va_fool.c b/va/va_fool.c new file mode 100644 index 0000000..519304d --- /dev/null +++ b/va/va_fool.c @@ -0,0 +1,545 @@ +/* + * Copyright (c) 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. + */ + +#define _GNU_SOURCE 1 +#include "va.h" +#include "va_backend.h" +#include "va_trace.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 + * We export env "VA_FOOL", with which, we can do fake decode/encode: + * + * 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. + * . VA CONTEXT/CONFIG/SURFACE will call into drivers, but VA Buffer creation is done in here + * . Bypass all ~SvaBeginPic/vaRenderPic/vaEndPic~T + * LIBVA_FOOL_POSTP: + * . if set, do nothing for vaPutSurface + */ + + +/* global settings */ + +/* LIBVA_FOOL_DECODE/LIBVA_FOOL_ENCODE/LIBVA_FOOL_POSTP */ +static int fool_decode = 0; +static int fool_encode = 0; +int fool_postp = 0; + +#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*/ + + /* 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] + * the size is ignored here + */ + char *fool_buf[VABufferTypeMax]; /* memory of fool buffers */ + unsigned int fool_buf_size[VABufferTypeMax]; /* size of memory of fool buffers */ + unsigned int fool_buf_count[VABufferTypeMax]; /* count of created buffers */ + VAContextID context; +} fool_context[FOOL_CONTEXT_MAX] = { {0} }; /* trace five context at the same time */ + +#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)) + + + +#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) */ + +void va_errorMessage(const char *msg, ...); +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 */ +); + +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 +); + +VAStatus vaUnlockSurface(VADisplay dpy, + VASurfaceID surface +); + + +void va_FoolInit(VADisplay dpy) +{ + char env_value[1024]; + int fool_index = 0; + + for (fool_index = 0; fool_index < FOOL_CONTEXT_MAX; fool_index++) + if (fool_context[fool_index].dpy == 0) + break; + + if (fool_index == FOOL_CONTEXT_MAX) + return; + + if (va_parseConfig("LIBVA_FOOL_POSTP", NULL) == 0) { + 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"); + + if (tmp) + fool_context[fool_index].fool_fp_codedclip = tmp; + + fool_encode = 1; + + va_infoMessage("LIBVA_FOOL_ENCODE is on, dummy encode\n"); + } + + if (fool_encode || fool_decode) + fool_context[fool_index].dpy = dpy; +} + + +int va_FoolEnd(VADisplay dpy) +{ + int i; + + DPY2INDEX(dpy); + + for (i = 0; i < VABufferTypeMax; i++) /* free memory */ + if (fool_context[idx].fool_buf[i]) + free(fool_context[idx].fool_buf[i]); + + memset(&fool_context[idx], sizeof(struct _fool_context), 0); + return 0; +} + +int va_FoolCodedBuf(VADisplay dpy) +{ + /* do nothing */ + return 0; +} + + +int va_FoolCreateConfig( + 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; + return 0; +} + +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 row; + + /* copy Y plane */ + for (row=0;row (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 */