Commit 4d74a235 authored by Waldo Bastian's avatar Waldo Bastian

libva 0.23

parents
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.
# 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.
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src dummy_drv_video test
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libva.pc
EXTRA_DIST = libva.pc.in
#! /bin/sh
autoreconf -v --install
./configure "$@"
# 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.
AC_PREREQ(2.57)
AC_INIT([libva], 0.22, [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])
# 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.
dummy_drv_video_la_LTLIBRARIES = dummy_drv_video.la
dummy_drv_video_ladir = /usr/X11R6/lib/modules/dri
dummy_drv_video_la_LDFLAGS = -no-undefined -module -Wl,--no-undefined
dummy_drv_video_la_LIBADD = -lva
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 (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.
*/
#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
#define DUMMY_MAX_IMAGE_FORMATS 10
#define DUMMY_MAX_SUBPIC_FORMATS 4
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 (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.
*/
#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 (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.
*/
#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 (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.
libva_la_LTLIBRARIES = libva.la
libva_ladir = $(libdir)
libva_la_LDFLAGS = -version-number 0:22:0 -no-undefined
libva_la_LIBADD = -ldl -lX11 -lXext
libva_la_SOURCES = va_dri.c va.c va_dristr.h
libvaincludedir = ${includedir}
libvainclude_HEADERS = va.h va_x11.h va_dri.h va_backend.h
EXTRA_DIST = ChangeLog TODO
This diff is collapsed.
This diff is collapsed.
/*
* 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.
*/
/*
* Video Decode Acceleration -Backend API
*/
#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;
int max_image_formats;
int max_subpic_formats;
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,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
int flags /* de-interlacing flags */
);
VAStatus (*vaCopySurfaceToGLXPbuffer) (
VADriverContextP ctx,
VASurface *surface,
XID pbuffer_id,
short srcx,
short srcy,
unsigned short width,
unsigned short height,
short destx,
short desty,
unsigned int draw_buffer,
unsigned int flags /* de-interlacing flags */
);
VAStatus (*vaQueryImageFormats) (
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
int *num_formats /* out */
);
VAStatus (*vaCreateImage) (
VADriverContextP ctx,
VAImageFormat *format,
int width,
int height,
VAImage *image /* out */
);
VAStatus (*vaDestroyImage) (
VADriverContextP ctx,
VAImage *image
);
VAStatus (*vaGetImage) (
VADriverContextP ctx,
VASurface *surface,
int x, /* coordinates of the upper left source pixel */
int y,
unsigned int width, /* width and height of the region */
unsigned int height,
VAImage *image
);
VAStatus (*vaPutImage) (
VADriverContextP ctx,
VASurface *surface,
VAImage *image,
int src_x,
int src_y,
unsigned int width,
unsigned int height,
int dest_x,
int dest_y
);
VAStatus (*vaQuerySubpictureFormats) (
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
unsigned int *flags, /* out */
unsigned int *num_formats /* out */
);
VAStatus (*vaCreateSubpicture) (
VADriverContextP ctx,
VAImage *image,
VASubpicture *subpicture /* out */
);
VAStatus (*vaDestroySubpicture) (
VADriverContextP ctx,
VASubpicture *subpicture
);
VAStatus (*vaSetSubpictureImage) (
VADriverContextP ctx,
VASubpicture *subpicture,
VAImage *image
);
VAStatus (*vaSetSubpicturePalette) (
VADriverContextP ctx,
VASubpicture *subpicture,
/*
* pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components
* in the palette is described by the component_order in VASubpicture struct
*/
unsigned char *palette
);
VAStatus (*vaSetSubpictureChromakey) (
VADriverContextP ctx,
VASubpicture *subpicture,
unsigned int chromakey_min,
unsigned int chromakey_max
);
VAStatus (*vaSetSubpictureGlobalAlpha) (
VADriverContextP ctx,
VASubpicture *subpicture,
float global_alpha
);
VAStatus (*vaAssociateSubpicture) (
VADriverContextP ctx,
VASurface *target_surface,
VASubpicture *subpicture,
short src_x, /* upper left offset in subpicture */
short src_y,
short dest_x, /* upper left offset in surface */
short dest_y,
unsigned short width,
unsigned short height,
/*
* whether to enable chroma-keying or global-alpha
* see VA_SUBPICTURE_XXX values
*/
unsigned int 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_ */
This diff is collapsed.
/* $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.
Copyright 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.
**************************************************************************/
/**
* \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 _VA_DRI_H_
#define _VA_DRI_H_
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
#define X_VA_DRIQueryVersion 0
#define X_VA_DRIQueryDirectRenderingCapable 1
#define X_VA_DRIOpenConnection 2
#define X_VA_DRICloseConnection 3
#define X_VA_DRIGetClientDriverName 4
#define X_VA_DRICreateContext 5
#define X_VA_DRIDestroyContext 6
#define X_VA_DRICreateDrawable 7
#define X_VA_DRIDestroyDrawable 8
#define X_VA_DRIGetDrawableInfo 9
#define X_VA_DRIGetDeviceInfo 10
#define X_VA_DRIAuthConnection 11
#define X_VA_DRIOpenFullScreen 12 /* Deprecated */
#define X_VA_DRICloseFullScreen 13 /* Deprecated */
#define VA_DRINumberEvents 0
#define VA_DRIClientNotLocal 0
#define VA_DRIOperationNotSupported 1
#define VA_DRINumberErrors (VA_DRIOperationNotSupported + 1)
typedef unsigned long __DRIid;
typedef void __DRInativeDisplay;
_XFUNCPROTOBEGIN
Bool VA_DRIQueryExtension( Display *dpy, int *event_base, int *error_base );
Bool VA_DRIQueryVersion( Display *dpy, int *majorVersion, int *minorVersion,
int *patchVersion );
Bool VA_DRIQueryDirectRenderingCapable( Display *dpy, int screen,
Bool *isCapable );
Bool VA_DRIOpenConnection( Display *dpy, int screen, drm_handle_t *hSAREA,
char **busIDString );
Bool VA_DRIAuthConnection( Display *dpy, int screen, drm_magic_t magic );
Bool VA_DRICloseConnection( Display *dpy, int screen );
Bool VA_DRIGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName );
Bool VA_DRICreateContext( Display *dpy, int screen, Visual *visual,
XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
Bool VA_DRICreateContextWithConfig( Display *dpy, int screen, int configID,
XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
Bool VA_DRIDestroyContext( __DRInativeDisplay *dpy, int screen,
__DRIid context_id );
Bool VA_DRICreateDrawable( __DRInativeDisplay *dpy, int screen,
__DRIid drawable, drm_drawable_t *hHWDrawable );
Bool VA_DRIDestroyDrawable( __DRInativeDisplay *dpy, int screen,
__DRIid drawable);
Bool VA_DRIGetDrawableInfo( 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 VA_DRIGetDeviceInfo( Display *dpy, int screen,
drm_handle_t *hFrameBuffer, int *fbOrigin, int *fbSize,
int *fbStride, int *devPrivateSize, void **pDevPrivate );
_XFUNCPROTOEND
#endif /* _VA_DRI_H_ */
This diff is collapsed.
/*
* 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
*/
/* de-interlace flags for vaPutSurface */
#define VA_TOP_FIELD 0x00000001
#define VA_BOTTOM_FIELD 0x00000002
#define VA_FRAME_PICTURE 0x00000004 /* weave */
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,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
int flags /* de-interlacing flags */
);
/*
This function copies a rectangle of dimension "width" by "height"
from the VASurface indicated by "surface" to the GLXPbuffer
identified by its XID "pbuffer_id". The locations of source and
destination rectangles are specified differently for the VASurface
source and the GLXPbuffer destination as follows. On the VASurface,
the rectangle location is specified in the usual X-Window fashion
with srcx and srcy indicating the location of the upper left hand
corner of the rectangle relative to the VASurface origin (the upper
left hand corner of the XvMCSurface with positive Y axis going in the
down direction). On the GLXPbuffer the rectangle location is
specified in the usual OpenGL fashion with the dstx and dsty
indicating the location of the lower left hand corner of the
rectangle relative to the GLXPbuffer origin (the lower left hand
corner of the GLXPbuffer with the positive Y axis going in the
up direction).
The "draw_buffer" takes the same OpenGL enums that glDrawBuffer()
takes (ie. GL_FRONT_LEFT, GL_FRONT_RIGHT, GL_BACK_LEFT, GL_BACK_RIGHT,
GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT or GL_FRONT_AND_BACK). This
indicates which buffer of the GLXPbuffer is to be used for the
destination of the copy. Buffers specified in the "draw_buffer"
that do not exist in the GLXPbuffer are ignored.
"flags" may be VA_TOP_FIELD, VA_BOTTOM_FIELD or VA_FRAME_PICTURE.
If flags is not VA_FRAME_PICTURE, the srcy and height are in field
coordinates, not frame. That is, the total copyable height is half
the height of the VASurface.
*/
VAStatus vaCopySurfaceToGLXPbuffer (
VADisplay dpy,
VASurface *surface,
XID pbuffer_id,
short srcx,
short srcy,
unsigned short width,
unsigned short height,
short destx,
short desty,
unsigned int draw_buffer,
unsigned int flags /* de-interlacing flags */
);
#ifdef __cplusplus
}
#endif
#endif /* _VA_X11_H_ */
# 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.
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)
/*
* 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.
*/
#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