Commit 7d6bbcfc authored by Austin Yuan's avatar Austin Yuan

Added the missing files

parent 881b49c5
/* 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 */
#%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 <prajwal.karur.mohan@intel.com> 1.0.1
- Updated libva source to IMG Alpha7
* Fri Dec 18 2009 Prajwal Mohan <prajwal.karur.mohan@intel.com> 0.31.0
- Updated libva source to IMG Alpha6
* Tue Nov 24 2009 Prajwal Mohan <prajwal.karur.mohan@intel.com> 0.31.0
- Updated libva source
* Mon Nov 9 2009 Prajwal Mohan <prajwal.karur.mohan@intel.com> 0.31.0
- Update to version 0.31.0
* Tue Jul 7 2009 Prajwal Mohan <prajwal.karur.mohan@intel.com> 0.30.4
- Update to version 0.30.4
* Wed Jun 24 2009 Prajwal Mohan <prajwal.karur.mohan@intel.com> 0.30.20090618
- Update to version 0.30.20090618_Alpha2.3
* Thu Jun 11 2009 Priya Vijayan <priya.vijayan@intel.com> 0.30.20090608
- Update to version 0.30.20090608
* Tue Jun 2 2009 Anas Nashif <anas.nashif@intel.com> - 0.30~20090514
- unset LD_AS_NEEDED
* Fri May 15 2009 Anas Nashif <anas.nashif@intel.com> 0.30~20090514
- Update to latest snapshot 20090514
* Wed Apr 29 2009 Anas Nashif <anas.nashif@intel.com> 0.30~20090428
- Update to 20090428 snpashot
* Sun Apr 26 2009 Anas Nashif <anas.nashif@intel.com> 0.30~20090423
- Update libva.pc with new includedir
* Sun Apr 26 2009 Anas Nashif <anas.nashif@intel.com> 0.30~20090423
- Update to latest snapshot 20090423
* Sun Apr 26 2009 Anas Nashif <anas.nashif@intel.com> 0.30~20090423
- Update to latest snapshot: 20090423
* Mon Mar 23 2009 Anas Nashif <anas.nashif@intel.com> 0.30~20090323
- Update to 0.30~20090323
* Fri Jan 16 2009 Priya Vijayan <priya.vijayan@intel.com> 0.31
- Fixing vainfo.c
* Fri Jan 16 2009 Priya Vijayan <priya.vijayan@intel.com> 0.31
- fixing va_backend.h
* Fri Jan 16 2009 Priya Vijayan <priya.vijayan@intel.com> 0.31
- Updating source
* Tue Jan 6 2009 Priya Vijayan <priya.vijayan@intel.com> 0.30
- Update to 0.28-working combination with X Server
* Fri Dec 19 2008 Priya Vijayan <priya.vijayan@intel.com> 0.30.0
- Added definition of FOURCC IYUV
* Dec 16 2008 Priya Vijayan <priya.vijayan@intel.com>
- 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
# 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) 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 <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#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
* 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<height;row++) {
unsigned char *Y_row = Y_start + row * Y_pitch;
int jj, xpos, ypos;
ypos = (row / box_width) & 0x1;
/* fill garbage data into the other field */
if (((field == VA_TOP_FIELD) && (row &1))
|| ((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))) {
value = 0xff;
}
if (UV_interleave) {
unsigned short *UV_row = (unsigned short *)(U_start + row * U_pitch);
memset(UV_row, value, width);
} 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);
}
}
return 0;
}
int va_FoolCreateSurfaces(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces /* out */
)
{
int i;
unsigned int fourcc; /* following are output argument */
unsigned int luma_stride;
unsigned int chroma_u_stride;
unsigned int chroma_v_stride;
unsigned int luma_offset;
unsigned int chroma_u_offset;
unsigned int chroma_v_offset;
unsigned int buffer_name;
void *buffer = NULL;
unsigned char *Y_data, *U_data, *V_data;
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 */
}
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 */
)
{
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)
fool_context[idx].fool_buf[type] = realloc(fool_context[idx].fool_buf, new_size);
if (fool_context[idx].fool_buf[type] == NULL) {
va_FoolEnd(dpy);
return 0; /* let driver go */
}
/* because we ignore the vaRenderPicture,
* all buffers with same type share same real memory
* bufferID = (buffer count << 8) | type
*/
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 */
)
{
VABufferType type;
unsigned int size;
unsigned int num_elements;
DPY2INDEX(dpy);
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;
/* buf_id is the buffer type */
if (fool_context[idx].fool_buf[buf_idx] != NULL)
*pbuf = fool_context[idx].fool_buf[buf_idx];
else
*pbuf = NULL;
/* 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 */
}
return 1; /* don't call into driver */
}
return 0; /* let driver go ... */
}
int va_FoolBeginPicture(
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;
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
)
{
DPY2INDEX(dpy);
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx))
return 1; /* don't call into driver level */
return 0; /* let driver go ... */
}
int va_FoolEndPicture(
VADisplay dpy,
VAContextID context
)
{
DPY2INDEX(dpy);
/* don't call into driver level */
/* do real fooling operation here */
/* only support H264 encoding currently */
if (FOOL_ENCODE(idx)) {
/* expect vaMapBuffer will handle it
* or else, need to save the codedbuf ID,
* and fool encode it here
*/
/* va_FoolCodedBuf(dpy); */
return 1; /* don't call into driver level */
}
if (FOOL_DECODE(idx))
return 1; /* don't call into driver level */
return 0; /* let driver go ... */
}
int va_FoolSyncSurface(
VADisplay dpy,
VASurfaceID render_target)
{
DPY2INDEX(dpy);
/*Fill in black and white squares. */
if (FOOL_DECODE(idx) || FOOL_DECODE(idx))
{
return 1;
}
return 0;
}
VAStatus va_FoolUnmapBuffer (
VADisplay dpy,
VABufferID buf_id /* in */
)
{
DPY2INDEX(dpy);
if (FOOL_ENCODE(idx) || FOOL_DECODE(idx)) { /* fool buffer creation */
return 1;
}
return 0;
}
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;
}
return 0;
}
/*
* 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.
*/
#ifndef VA_FOOL_H
#define VA_FOOL_H
void va_FoolInit(VADisplay dpy);
int va_FoolEnd(VADisplay dpy);
int va_FoolCodedBuf(VADisplay dpy);
int va_FoolCreateConfig(
VADisplay dpy,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list,
int num_attribs,
VAConfigID *config_id /* out */
);
int va_FoolCreateSurfaces(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces /* out */
);
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 */
);
VAStatus va_FoolMapBuffer (
VADisplay dpy,
VABufferID buf_id, /* in */
void **pbuf /* out */
);
int va_FoolBeginPicture(
VADisplay dpy,
VAContextID context,
VASurfaceID render_target
);
int va_FoolRenderPicture(
VADisplay dpy,
VAContextID context,
VABufferID *buffers,
int num_buffers
);
int va_FoolEndPicture(
VADisplay dpy,
VAContextID context
);
VAStatus va_FoolUnmapBuffer (
VADisplay dpy,
VABufferID buf_id /* in */
);
VAStatus va_FoolQuerySubpictureFormats (
VADisplay dpy,
VAImageFormat *format_list,
unsigned int *flags,
unsigned int *num_formats
);
int va_FoolSyncSurface(
VADisplay dpy,
VASurfaceID render_target
);
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* 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