Commit 3f722958 authored by root's avatar root

Initial commit of libva

parents
*~
Makefile.in
Makefile
# @COPYRIGHT@ Intel Confidential - Unreleased Software
#
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src dummy_drv_video test
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libva.pc
EXTRA_DIST = libva.pc.in
#! /bin/sh
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd`
cd $srcdir
autoreconf -v --install || exit 1
cd $ORIGDIR || exit $?
$srcdir/configure --enable-maintainer-mode "$@"
# @COPYRIGHT@ Intel Confidential - Unreleased Software
AC_PREREQ(2.57)
AC_INIT([libva], 0.1, [waldo.bastian@intel.com], libva)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2])
AM_CONFIG_HEADER([src/config.h])
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_CC
AC_HEADER_STDC
AC_SYS_LARGEFILE
PKG_CHECK_MODULES([libva_la], [libdrm])
pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir)
AC_OUTPUT([Makefile src/Makefile dummy_drv_video/Makefile test/Makefile libva.pc])
libva for Debian
----------------
This library implements the Video Acceleration (VA) API for Linux.
It will load a hardware dependendent video acceleration driver.
-- Waldo Bastian <waldo.bastian@intel.com> Mon, 18 Jun 2007 21:35:31 -0700
libva (0.18-1) unstable; urgency=low
* Initial release of libva
-- Waldo Bastian <waldo.bastian@intel.com> Mon, 18 Jun 2007 21:35:31 -0700
Source: libva
Priority: extra
Maintainer: Waldo Bastian <waldo.bastian@intel.com>
Build-Depends: debhelper (>= 5),
autotools-dev,
libdrm-dev (>= 2.3.0),
mesa-common-dev,
x11proto-gl-dev,
pkg-config
Standards-Version: 3.7.2
Section: libs
Package: libva-dev
Section: libdevel
Architecture: any
Depends: libva1 (= ${binary:Version}),
libdrm-dev (>= 2.3.0),
pkg-config
Description: Video Acceleration (VA) API for Linux -- development files
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.
Package: libva1
Section: libs
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
libdrm2 (>= 2.3.0)
Description: Video Acceleration (VA) API for Linux -- runtime
The libva library implements the Video Acceleration (VA) API for Linux.
The library loads a hardware dependendent driver.
This package was debianized by Waldo Bastian <waldo.bastian@intel.com> on
Mon, 18 Jun 2007 21:35:31 -0700.
It was downloaded from <url://example.com>
Upstream Author(s):
Waldo Bastian <waldo.bastian@intel.com>
Jonathan Bian <jonathan.bian@intel.com>
Copyright:
(C) Copyright IBM Corporation 2004
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
Copyright 2007 Intel Corportation
License:
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.
The Debian packaging is (C) 2007, Intel Corporation and
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
usr/bin
usr/sbin
libva-dev_0.18-1_i386.deb libdevel extra
libva1_0.18-1_i386.deb libs extra
usr/lib
usr/include
debian/tmp/usr/include/va.h
debian/tmp/usr/include/va_x11.h
debian/tmp/usr/lib/dummy_drv_video.*
debian/tmp/usr/lib/libva.la
debian/tmp/usr/lib/libva.so
debian/tmp/usr/lib/pkgconfig/libva.pc
shlibs:Depends=libc6 (>= 2.5-5)
debian/tmp/usr/lib/libva.so.*
shlibs:Depends=libc6 (>= 2.5-5), libx11-6, libxext6
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
# shared library versions, option 1
#version=2.0.5
#major=2
# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
version=`ls src/.libs/lib*.so.* | \
awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
#major=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
config.status: configure
dh_testdir
# Add here commands to configure the package.
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
build: build-stamp
build-stamp: config.status
dh_testdir
# Add here commands to compile the package.
$(MAKE)
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
-$(MAKE) distclean
rm -f config.sub config.guess
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/tmp
$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
# dh_python
# dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
# @COPYRIGHT@ Intel Confidential - Unreleased Software
dummy_drv_video_la_LTLIBRARIES = dummy_drv_video.la
dummy_drv_video_ladir = $(libdir)
dummy_drv_video_la_LDFLAGS = -no-undefined -module
dummy_drv_video_la_LIBADD =
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/../../include/kmd
dummy_drv_video_la_SOURCES = dummy_drv_video.c object_heap.c
This diff is collapsed.
/*
* @COPYRIGHT@ Intel Confidential - Unreleased Software
*/
#ifndef _DUMMY_DRV_VIDEO_H_
#define _DUMMY_DRV_VIDEO_H_
#include "va.h"
#include "object_heap.h"
#define DUMMY_MAX_PROFILES 11
#define DUMMY_MAX_ENTRYPOINTS 5
#define DUMMY_MAX_CONFIG_ATTRIBUTES 10
struct dummy_driver_data {
struct object_heap config_heap;
struct object_heap context_heap;
struct object_heap surface_heap;
struct object_heap buffer_heap;
};
struct object_config {
struct object_base base;
VAProfile profile;
VAEntrypoint entrypoint;
VAConfigAttrib attrib_list[DUMMY_MAX_CONFIG_ATTRIBUTES];
int attrib_count;
};
struct object_context {
struct object_base base;
VAContext *context;
VAConfigID config;
VASurfaceID current_render_target;
};
struct object_surface {
struct object_base base;
VASurface *surface;
};
struct object_buffer {
struct object_base base;
void *buffer_data;
int max_num_elements;
int num_elements;
};
typedef struct object_config *object_config_p;
typedef struct object_context *object_context_p;
typedef struct object_surface *object_surface_p;
typedef struct object_buffer *object_buffer_p;
#endif /* _DUMMY_DRV_VIDEO_H_ */
/*
* @COPYRIGHT@ Intel Confidential - Unreleased Software
*/
#include "object_heap.h"
#include "assert.h"
#include <stdio.h>
#include <string.h>
#define ASSERT assert
#define LAST_FREE -1
#define ALLOCATED -2
/*
* Expands the heap
* Return 0 on success, -1 on error
*/
static int object_heap_expand( object_heap_p heap )
{
int i;
void *new_heap_index;
int next_free;
int new_heap_size = heap->heap_size + heap->heap_increment;
new_heap_index = (void *) realloc( heap->heap_index, new_heap_size * heap->object_size );
if ( NULL == new_heap_index )
{
return -1; /* Out of memory */
}
heap->heap_index = new_heap_index;
next_free = heap->next_free;
for(i = new_heap_size; i-- > heap->heap_size; )
{
object_base_p obj = (object_base_p) (heap->heap_index + i * heap->object_size);
obj->id = i + heap->id_offset;
obj->next_free = next_free;
next_free = i;
}
heap->next_free = next_free;
heap->heap_size = new_heap_size;
return 0; /* Success */
}
/*
* Return 0 on success, -1 on error
*/
int object_heap_init( object_heap_p heap, int object_size, int id_offset)
{
heap->object_size = object_size;
heap->id_offset = id_offset & OBJECT_HEAP_OFFSET_MASK;
heap->heap_size = 0;
heap->heap_increment = 16;
heap->heap_index = NULL;
heap->next_free = LAST_FREE;
return object_heap_expand(heap);
}
/*
* Allocates an object
* Returns the object ID on success, returns -1 on error
*/
int object_heap_allocate( object_heap_p heap )
{
object_base_p obj;
if ( LAST_FREE == heap->next_free )
{
if( -1 == object_heap_expand( heap ) )
{
return -1; /* Out of memory */
}
}
ASSERT( heap->next_free >= 0 );
obj = (object_base_p) (heap->heap_index + heap->next_free * heap->object_size);
heap->next_free = obj->next_free;
obj->next_free = ALLOCATED;
return obj->id;
}
/*
* Lookup an object by object ID
* Returns a pointer to the object on success, returns NULL on error
*/
object_base_p object_heap_lookup( object_heap_p heap, int id )
{
object_base_p obj;
if ( (id < heap->id_offset) || (id > (heap->heap_size+heap->id_offset)) )
{
return NULL;
}
id &= OBJECT_HEAP_ID_MASK;
obj = (object_base_p) (heap->heap_index + id * heap->object_size);
/* Check if the object has in fact been allocated */
if ( obj->next_free != ALLOCATED )
{
return NULL;
}
return obj;
}
/*
* Iterate over all objects in the heap.
* Returns a pointer to the first object on the heap, returns NULL if heap is empty.
*/
object_base_p object_heap_first( object_heap_p heap, object_heap_iterator *iter )
{
*iter = -1;
return object_heap_next( heap, iter );
}
/*
* Iterate over all objects in the heap.
* Returns a pointer to the next object on the heap, returns NULL if heap is empty.
*/
object_base_p object_heap_next( object_heap_p heap, object_heap_iterator *iter )
{
object_base_p obj;
int i = *iter + 1;
while ( i < heap->heap_size)
{
obj = (object_base_p) (heap->heap_index + i * heap->object_size);
if (obj->next_free == ALLOCATED)
{
*iter = i;
return obj;
}
i++;
}
*iter = i;
return NULL;
}
/*
* Frees an object
*/
void object_heap_free( object_heap_p heap, object_base_p obj )
{
/* Don't complain about NULL pointers */
if (NULL != obj)
{
/* Check if the object has in fact been allocated */
ASSERT( obj->next_free == ALLOCATED );
obj->next_free = heap->next_free;
heap->next_free = obj->id & OBJECT_HEAP_ID_MASK;
}
}
/*
* Destroys a heap, the heap must be empty.
*/
void object_heap_destroy( object_heap_p heap )
{
object_base_p obj;
int i;
/* Check if heap is empty */
for (i = 0; i < heap->heap_size; i++)
{
/* Check if object is not still allocated */
obj = (object_base_p) (heap->heap_index + i * heap->object_size);
ASSERT( obj->next_free != ALLOCATED );
}
free(heap->heap_index);
heap->heap_size = 0;
heap->heap_index = NULL;
heap->next_free = LAST_FREE;
}
/*
* @COPYRIGHT@ Intel Confidential - Unreleased Software
*/
#ifndef _OBJECT_HEAP_H_
#define _OBJECT_HEAP_H_
#define OBJECT_HEAP_OFFSET_MASK 0x7F000000
#define OBJECT_HEAP_ID_MASK 0x00FFFFFF
typedef struct object_base *object_base_p;
typedef struct object_heap *object_heap_p;
struct object_base {
int id;
int next_free;
};
struct object_heap {
int object_size;
int id_offset;
void *heap_index;
int next_free;
int heap_size;
int heap_increment;
};
typedef int object_heap_iterator;
/*
* Return 0 on success, -1 on error
*/
int object_heap_init( object_heap_p heap, int object_size, int id_offset);
/*
* Allocates an object
* Returns the object ID on success, returns -1 on error
*/
int object_heap_allocate( object_heap_p heap );
/*
* Lookup an allocated object by object ID
* Returns a pointer to the object on success, returns NULL on error
*/
object_base_p object_heap_lookup( object_heap_p heap, int id );
/*
* Iterate over all objects in the heap.
* Returns a pointer to the first object on the heap, returns NULL if heap is empty.
*/
object_base_p object_heap_first( object_heap_p heap, object_heap_iterator *iter );
/*
* Iterate over all objects in the heap.
* Returns a pointer to the next object on the heap, returns NULL if heap is empty.
*/
object_base_p object_heap_next( object_heap_p heap, object_heap_iterator *iter );
/*
* Frees an object
*/
void object_heap_free( object_heap_p heap, object_base_p obj );
/*
* Destroys a heap, the heap must be empty.
*/
void object_heap_destroy( object_heap_p heap );
#endif /* _OBJECT_HEAP_H_ */
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libva
Description: Userspace Video Acceleration (VA) interface
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lva
Cflags: -I${includedir}
# @COPYRIGHT@ Intel Confidential - Unreleased Software
libva_la_LTLIBRARIES = libva.la
libva_ladir = $(libdir)
libva_la_LDFLAGS = -version-number 0:1:0 -no-undefined
libva_la_LIBADD = -ldl -lX11 -lXext
libva_la_SOURCES = XF86dri.c xf86dri.h xf86dristr.h va.c
libvaincludedir = ${includedir}
libvainclude_HEADERS = va.h va_x11.h
EXTRA_DIST = ChangeLog TODO
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Video Decode Acceleration -Backend API
*
* @COPYRIGHT@ Intel Confidential - Unreleased Software
*/
#ifndef _VA_BACKEND_H_
#define _VA_BACKEND_H_
#include "va.h"
#include "va_x11.h"
#include <stdlib.h>
typedef struct VADriverContext *VADriverContextP;
struct VADriverContext
{
VADriverContextP pNext;
Display *x11_dpy;
int x11_screen;
int version_major;
int version_minor;
int max_profiles;
int max_entrypoints;
int max_attributes;
void *handle; /* dlopen handle */
void *pDriverData;
struct
{
VAStatus (*vaTerminate) ( VADriverContextP ctx );
VAStatus (*vaQueryConfigProfiles) (
VADriverContextP ctx,
VAProfile *profile_list, /* out */
int *num_profiles /* out */
);
VAStatus (*vaQueryConfigEntrypoints) (
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint *entrypoint_list, /* out */
int *num_entrypoints /* out */
);
VAStatus (*vaQueryConfigAttributes) (
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list, /* in/out */
int num_attribs
);
VAStatus (*vaCreateConfig) (
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list,
int num_attribs,
VAConfigID *config_id /* out */
);
VAStatus (*vaGetConfigAttributes) (
VADriverContextP ctx,
VAConfigID config_id,
VAProfile *profile, /* out */
VAEntrypoint *entrypoint, /* out */
VAConfigAttrib *attrib_list, /* out */
int *num_attribs /* out */
);
VAStatus (*vaCreateSurfaces) (
VADriverContextP ctx,
int width,
int height,
int format,
int num_surfaces,
VASurface *surfaces /* out */
);
VAStatus (*vaDestroySurface) (
VADriverContextP ctx,
VASurface *surface_list,
int num_surfaces
);
VAStatus (*vaCreateContext) (
VADriverContextP ctx,
VAConfigID config_id,
int picture_width,
int picture_height,
int flag,
VASurface *render_targets,
int num_render_targets,
VAContext *context /* out */
);
VAStatus (*vaDestroyContext) (
VADriverContextP ctx,
VAContext *context
);
VAStatus (*vaCreateBuffer) (
VADriverContextP ctx,
VABufferType type, /* in */
VABufferID *buf_desc /* out */
);
VAStatus (*vaBufferData) (
VADriverContextP ctx,
VABufferID buf_id, /* in */
unsigned int size, /* in */
unsigned int num_elements, /* in */
void *data /* in */
);
VAStatus (*vaBufferSetNumElements) (
VADriverContextP ctx,
VABufferID buf_id, /* in */
unsigned int num_elements /* in */
);
VAStatus (*vaMapBuffer) (
VADriverContextP ctx,
VABufferID buf_id, /* in */
void **pbuf /* out */
);
VAStatus (*vaUnmapBuffer) (
VADriverContextP ctx,
VABufferID buf_id /* in */
);
VAStatus (*vaDestroyBuffer) (
VADriverContextP ctx,
VABufferID buffer_id
);
VAStatus (*vaBeginPicture) (
VADriverContextP ctx,
VAContext *context,
VASurface *render_target
);
VAStatus (*vaRenderPicture) (
VADriverContextP ctx,
VAContext *context,
VABufferID *buffers,
int num_buffers
);
VAStatus (*vaEndPicture) (
VADriverContextP ctx,
VAContext *context
);
VAStatus (*vaSyncSurface) (
VADriverContextP ctx,
VAContext *context,
VASurface *render_target
);
VAStatus (*vaQuerySurfaceStatus) (
VADriverContextP ctx,
VAContext *context,
VASurface *render_target,
VASurfaceStatus *status /* out */
);
VAStatus (*vaPutSurface) (
VADriverContextP ctx,
VASurface *surface,
Drawable draw, /* X Drawable */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
int flags /* de-interlacing flags */
);
VAStatus (*vaDbgCopySurfaceToBuffer) (
VADriverContextP ctx,
VASurface *surface,
void **buffer, /* out */
unsigned int *stride /* out */
);
} vtable;
};
typedef VAStatus (*VADriverInit) (
VADriverContextP driver_context
);
#endif /* _VA_BACKEND_H_ */
/*
* Video Decode Acceleration API, X11 specific functions
*
* Rev. 0.15
* <jonathan.bian@intel.com>
*
* Revision History:
* rev 0.1 (12/10/06 Jonathan Bian) - Initial draft
* rev 0.11 (12/15/06 Jonathan Bian) - Fixed some errors
* rev 0.12 (02/05/07 Jonathan Bian) - Added VC-1 data structures
* rev 0.13 (02/28/07 Jonathan Bian) - Added GetDisplay()
* rev 0.14 (04/13/07 Jonathan Bian) - Fixed MPEG-2 PictureParameter struct, cleaned up a few funcs.
* rev 0.15 (04/20/07 Jonathan Bian) - Overhauled buffer management
*
*/
#ifndef _VA_X11_H_
#define _VA_X11_H_
#include "va.h"
#include <X11/Xlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Output rendering
* Following is the rendering interface for X windows,
* to get the decode output surface to a X drawable
* It basically performs a de-interlacing (if needed),
* color space conversion and scaling to the destination
* rectangle
*/
VAStatus vaPutSurface (
VADisplay dpy,
VASurface *surface,
Drawable draw, /* X Drawable */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
int flags /* de-interlacing flags */
);
#ifdef __cplusplus
}
#endif
#endif /* _VA_X11_H_ */
/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
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.
**************************************************************************/
/**
* \file xf86dri.h
* Protocol numbers and function prototypes for DRI X protocol.
*
* \author Kevin E. Martin <martin@valinux.com>
* \author Jens Owen <jens@tungstengraphics.com>
* \author Rickard E. (Rik) Faith <faith@valinux.com>
*/
#ifndef _XF86DRI_H_
#define _XF86DRI_H_
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
#define X_XF86DRIQueryVersion 0
#define X_XF86DRIQueryDirectRenderingCapable 1
#define X_XF86DRIOpenConnection 2
#define X_XF86DRICloseConnection 3
#define X_XF86DRIGetClientDriverName 4
#define X_XF86DRICreateContext 5
#define X_XF86DRIDestroyContext 6
#define X_XF86DRICreateDrawable 7
#define X_XF86DRIDestroyDrawable 8
#define X_XF86DRIGetDrawableInfo 9
#define X_XF86DRIGetDeviceInfo 10
#define X_XF86DRIAuthConnection 11
#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
#define X_XF86DRICloseFullScreen 13 /* Deprecated */
#define XF86DRINumberEvents 0
#define XF86DRIClientNotLocal 0
#define XF86DRIOperationNotSupported 1
#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
#ifndef _XF86DRI_SERVER_
#include "dri_interface.h"
_XFUNCPROTOBEGIN
Bool XF86DRIQueryExtension( Display *dpy, int *event_base, int *error_base );
Bool XF86DRIQueryVersion( Display *dpy, int *majorVersion, int *minorVersion,
int *patchVersion );
Bool XF86DRIQueryDirectRenderingCapable( Display *dpy, int screen,
Bool *isCapable );
Bool XF86DRIOpenConnection( Display *dpy, int screen, drm_handle_t *hSAREA,
char **busIDString );
Bool XF86DRIAuthConnection( Display *dpy, int screen, drm_magic_t magic );
Bool XF86DRICloseConnection( Display *dpy, int screen );
Bool XF86DRIGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName );
Bool XF86DRICreateContext( Display *dpy, int screen, Visual *visual,
XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
Bool XF86DRICreateContextWithConfig( Display *dpy, int screen, int configID,
XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
extern GLboolean XF86DRIDestroyContext( __DRInativeDisplay *dpy, int screen,
__DRIid context_id );
extern GLboolean XF86DRICreateDrawable( __DRInativeDisplay *dpy, int screen,
__DRIid drawable, drm_drawable_t *hHWDrawable );
extern GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay *dpy, int screen,
__DRIid drawable);
Bool XF86DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable,
unsigned int *index, unsigned int *stamp,
int *X, int *Y, int *W, int *H,
int *numClipRects, drm_clip_rect_t ** pClipRects,
int *backX, int *backY,
int *numBackClipRects, drm_clip_rect_t **pBackClipRects );
Bool XF86DRIGetDeviceInfo( Display *dpy, int screen,
drm_handle_t *hFrameBuffer, int *fbOrigin, int *fbSize,
int *fbStride, int *devPrivateSize, void **pDevPrivate );
_XFUNCPROTOEND
#endif /* _XF86DRI_SERVER_ */
#endif /* _XF86DRI_H_ */
This diff is collapsed.
# @COPYRIGHT@ Intel Confidential - Unreleased Software
check_PROGRAMS = test
testdir = $(bindir)
# This gives better backtraces when running valgrind:
# test_LDADD = ../src/libva.la ../../psb-video/src/psb_drv_video.la
test_LDADD = ../src/libva.la
AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src
test_SOURCES = test.c
TESTS = $(check_PROGRAMS)
\ No newline at end of file
/*
* @COPYRIGHT@ Intel Confidential - Unreleased Software
*/
#include "va.h"
#include "X11/Xlib.h"
#include "assert.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#define ASSERT assert
int main(int argc, const char* argv[])
{
Display *dpy;
VADisplay va_dpy;
VAStatus va_status;
int major_version, minor_version;
dpy = XOpenDisplay(NULL);
ASSERT( dpy );
printf("XOpenDisplay: dpy = %08x\n", dpy);
va_dpy = vaGetDisplay(dpy);
ASSERT( va_dpy );
printf("vaGetDisplay: va_dpy = %08x\n", va_dpy);
va_status = vaInitialize(va_dpy, &major_version, &minor_version);
ASSERT( VA_STATUS_SUCCESS == va_status );
printf("vaInitialize: major = %d minor = %d\n", major_version, minor_version);
{
VASurface surfaces[21];
int i;
surfaces[20].surface_id = -1;
va_status = vaCreateSurfaces(va_dpy, 720, 480, VA_RT_FORMAT_YUV420, 20, surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( -1 == surfaces[20].surface_id ); /* bounds check */
for(i = 0; i < 20; i++)
{
printf("Surface %d surface_id = %08x\n", i, surfaces[i].surface_id);
}
Window win = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0, 0, 720, 480, 0, 0, WhitePixel(dpy, 0));
printf("Window = %08x\n", win);
XMapWindow(dpy, win);
XSync(dpy, False);
vaPutSurface(va_dpy, &(surfaces[0]), win, 0, 0, 720, 480, 0, 0, 720, 480, 0);
sleep(10);
va_status = vaDestroySurface(va_dpy, surfaces, 20);
ASSERT( VA_STATUS_SUCCESS == va_status );
}
{
int num_profiles;
int i;
VAProfile *profiles = malloc(vaMaxNumProfiles(va_dpy) * sizeof(VAProfile));
ASSERT(profiles);
printf("vaMaxNumProfiles = %d\n", vaMaxNumProfiles(va_dpy));
va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles);
ASSERT( VA_STATUS_SUCCESS == va_status );
printf("vaQueryConfigProfiles reports %d profiles\n", num_profiles);
for(i = 0; i < num_profiles; i++)
{
printf("Profile %d\n", profiles[i]);
}
}
{
VASurface surfaces[20];
VAContext context;
VAConfigAttrib attrib;
VAConfigID config_id;
int i;
attrib.type = VAConfigAttribRTFormat;
va_status = vaQueryConfigAttributes(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD,
&attrib, 1);
ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT(attrib.value & VA_RT_FORMAT_YUV420);
/* Found desired RT format, keep going */
va_status = vaCreateConfig(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD, &attrib, 1,
&config_id);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateSurfaces(va_dpy, 720, 480, VA_RT_FORMAT_YUV420, 20, surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateContext(va_dpy, config_id, 720, 480, 0 /* flag */, surfaces, 20, &context);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyContext(va_dpy, &context);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroySurface(va_dpy, surfaces, 20);
ASSERT( VA_STATUS_SUCCESS == va_status );
}
{
VABufferID picture_buf[3];
va_status = vaCreateBuffer(va_dpy, VAPictureParameterBufferType, &picture_buf[0]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateBuffer(va_dpy, VAPictureParameterBufferType, &picture_buf[1]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateBuffer(va_dpy, VAPictureParameterBufferType, &picture_buf[2]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyBuffer(va_dpy, picture_buf[0]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyBuffer(va_dpy, picture_buf[2]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyBuffer(va_dpy, picture_buf[1]);
ASSERT( VA_STATUS_SUCCESS == va_status );
}
va_status = vaTerminate(va_dpy);
ASSERT( VA_STATUS_SUCCESS == va_status );
printf("vaTerminate\n");
XCloseDisplay(dpy);
return 0;
}
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