Commit e1b1327b authored by Austin Yuan's avatar Austin Yuan

Apply the patch to split va and display/x11 from Gwenole Beauchesne...

Apply the patch to split va and display/x11 from Gwenole Beauchesne [mailto:gbeauchesne@splitted-desktop.com]

Bellow is his explanation:

> Finally, looking further at <va_x11.h>, I think it should be enough to have
> vaInitialize() in display-dependent headers/libs. The va_x11_getDriverName()
> suggestion was to factor out the thing at the implementation (source
> code/files) level.
>
> Or we could keep vaInitialize() in common lib and rather have vaGetDisplay()
> in the display-specific part? And, while being at it, also rename the
> function to vaCreateDisplay(), to be meaningful about the API change?
>
> Besides, for a different windowing system, we probably would need more than
> just the Display (as we have in X11 land) anyway. e.g. what about OpenGL,
> OpenGL E|S? I don't know, it's just an idea.
>
> I read that Canmore/Sodaville are using the same engines as the Poulsbo
> (SGX535 and VXD370). However, the former platforms only support OpenGL E|S.
> So, how does video acceleration work here? I know it works, I saw it but
> since we still haven't received the machines, I just don't know about the
> actual API. You'd probably want libVA there too.
>
> Splitting libVA between a Core API and a Display API would make it possible
> to reduce code duplication from a player point of view. i.e. I don't think
> it's necessary to have client applications implement
> vaBeginPicture()..vaEndPicture() sequences themselves. I think it should be
> the role of the codec library (ffmpeg, in my case), and it should be able to
> do so without an explicit dependency on X11.
>
> On the other hand, the Core API won't be useful/functional alone. So, that
> could be confusing too.
>
> In practise, I would like to have it working as follows. It's my ideal
> vision, not necessarily the right/correct one. ;-)
>
> Roles of a codec implementation library:
> - Create buffers
> - Render the pictures, in the vaBeginPicture()..vaEndPicture(),
> vaRenderPicture() sense
>
> Roles of a player application:
> - Create display, surfaces, and decode pipeline for the codec library
> - Render the picture, visually, i.e. in the vaPutSurface() sense
>
> Example use:
> VApplication|initialize display
> CodecLibrary|characterise bitstream (codec and other useful info)
> VApplication|create decode pipeline
> VApplication|create surfaces
> CodecLibrary|create buffers	(1)
> CodecLibrary|render picture	(2)
> VApplication|display picture	(3)
> repeat (1) -> (3) while the end of stream is not reached
> VApplication|destroy everything
>
> Have CodecLibrary linked against libva-core-VERSION.so.MAJOR, without any
> dependency on windowing system library.
>
> Have VApplication linked against libva-x11-VERSION.so.MAJOR, itself linked
> against libva-core-VERSION.so.MAJOR and other windowing system libraries.
>
> Regards,
> Gwenole.
>
Signed-off-by: default avatarAustin Yuan <shengquan.yuan@intel.com>
parent f08cc6d5
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AC_PREREQ(2.57) AC_PREREQ(2.57)
AC_INIT([libva], 0.29, [waldo.bastian@intel.com], libva) AC_INIT([libva], 0.30, [waldo.bastian@intel.com], libva)
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2]) AM_INIT_AUTOMAKE([dist-bzip2])
...@@ -36,11 +36,12 @@ AC_SYS_LARGEFILE ...@@ -36,11 +36,12 @@ AC_SYS_LARGEFILE
PKG_CHECK_MODULES([X11], [x11]) PKG_CHECK_MODULES([X11], [x11])
PKG_CHECK_MODULES([XEXT], [xext]) PKG_CHECK_MODULES([XEXT], [xext])
PKG_CHECK_MODULES([XDAMAGE], [xfixes]) PKG_CHECK_MODULES([Xfixes], [xfixes])
PKG_CHECK_MODULES([XDAMAGE], [xdamage]) PKG_CHECK_MODULES([XDAMAGE], [xdamage])
PKG_CHECK_MODULES([libva_la], [libdrm]) PKG_CHECK_MODULES([DRM], [libdrm])
#PKG_CHECK_MODULES([libva_la], [libdrm])
pkgconfigdir=${libdir}/pkgconfig pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir) AC_SUBST(pkgconfigdir)
AC_OUTPUT([Makefile src/Makefile dummy_drv_video/Makefile test/Makefile libva.pc]) AC_OUTPUT([Makefile src/Makefile src/x11/Makefile dummy_drv_video/Makefile test/Makefile libva.pc])
...@@ -4,7 +4,7 @@ libdir=@libdir@ ...@@ -4,7 +4,7 @@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
Name: libva Name: libva
Description: Userspace Video Acceleration (VA) interface Description: Userspace Video Acceleration (VA) core interface
Version: @PACKAGE_VERSION@ Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lva Libs: -L${libdir} -lva
Cflags: -I${includedir} Cflags: -I${includedir}
...@@ -23,11 +23,13 @@ ...@@ -23,11 +23,13 @@
libva_la_LTLIBRARIES = libva.la libva_la_LTLIBRARIES = libva.la
libva_ladir = $(libdir) libva_ladir = $(libdir)
libva_la_LDFLAGS = -version-number 0:30:0 -no-undefined libva_la_LDFLAGS = -version-number 0:30:0 -no-undefined
libva_la_LIBADD = -ldl -lX11 -lXext -lXfixes -lXdamage libva_la_LIBADD = -ldl -lX11 -lXext -lXfixes -lXdamage x11/libva_x11.la
libva_la_SOURCES = va_dri.c va.c va_dristr.h SUBDIRS = x11
libva_la_SOURCES = va.c
libvaincludedir = ${includedir} libvaincludedir = ${includedir}
libvainclude_HEADERS = va.h va_x11.h va_dri.h va_backend.h libvainclude_HEADERS = va.h va_backend.h
EXTRA_DIST = ChangeLog TODO EXTRA_DIST = ChangeLog TODO
This diff is collapsed.
...@@ -134,10 +134,6 @@ const char *vaErrorStr(VAStatus error_status); ...@@ -134,10 +134,6 @@ const char *vaErrorStr(VAStatus error_status);
*/ */
typedef void* NativeDisplay; /* window system dependent */ typedef void* NativeDisplay; /* window system dependent */
VADisplay vaGetDisplay (
NativeDisplay native_dpy /* implementation specific */
);
/* /*
* Initialize the library * Initialize the library
*/ */
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
typedef struct VADriverContext *VADriverContextP; typedef struct VADriverContext *VADriverContextP;
typedef struct VADisplayContext *VADisplayContextP;
struct VADriverVTable struct VADriverVTable
{ {
...@@ -390,7 +391,7 @@ struct VADriverVTable ...@@ -390,7 +391,7 @@ struct VADriverVTable
struct VADriverContext struct VADriverContext
{ {
VADriverContextP pNext; void *old_pNext; /* preserved for binary compatibility */
void *pDriverData; void *pDriverData;
struct VADriverVTable vtable; struct VADriverVTable vtable;
...@@ -411,6 +412,25 @@ struct VADriverContext ...@@ -411,6 +412,25 @@ struct VADriverContext
void *handle; /* dlopen handle */ void *handle; /* dlopen handle */
}; };
struct VADisplayContext
{
VADisplayContextP pNext;
VADriverContextP pDriverContext;
int (*vaIsValid) (
VADisplayContextP ctx
);
void (*vaDestroy) (
VADisplayContextP ctx
);
VAStatus (*vaGetDriverName) (
VADisplayContextP ctx,
char **driver_name
);
};
typedef VAStatus (*VADriverInit) ( typedef VAStatus (*VADriverInit) (
VADriverContextP driver_context VADriverContextP driver_context
); );
......
This diff is collapsed.
# INTEL CONFIDENTIAL
# Copyright 2007 Intel Corporation. All Rights Reserved.
#
# The source code contained or described herein and all documents related to
# the source code ("Material") are owned by Intel Corporation or its suppliers
# or licensors. Title to the Material remains with Intel Corporation or its
# suppliers and licensors. The Material may contain trade secrets and
# proprietary and confidential information of Intel Corporation and its
# suppliers and licensors, and is protected by worldwide copyright and trade
# secret laws and treaty provisions. No part of the Material may be used,
# copied, reproduced, modified, published, uploaded, posted, transmitted,
# distributed, or disclosed in any way without Intel's prior express written
# permission.
#
# No license under any patent, copyright, trade secret or other intellectual
# property right is granted to or conferred upon you by disclosure or delivery
# of the Materials, either expressly, by implication, inducement, estoppel or
# otherwise. Any license under such intellectual property rights must be
# express and approved by Intel in writing.
AM_CFLAGS = -DLINUX -I$(top_srcdir)/src $(DRM_CFLAGS)
noinst_LTLIBRARIES = libva_x11.la
libva_x11includedir = ${includedir}
libva_x11include_HEADERS = va_x11.h va_dri.h
libva_x11_la_SOURCES = va_x11.c va_dri.c
This diff is collapsed.
# libva_x11.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.24 (1.1220.2.456 2007/06/24 02:25:32)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libva_x11.a'
# Libraries that this one depends upon.
dependency_libs=''
# Version information for libva_x11.
current=
age=
revision=
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir=''
# va_dri.lo - a libtool object file
# Generated by ltmain.sh - GNU libtool 1.5.24 (1.1220.2.456 2007/06/24 02:25:32)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/va_dri.o'
# Name of the non-PIC object.
non_pic_object=none
/*
* 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 "config.h"
#include "va.h"
#include "va_backend.h"
#include "va_x11.h"
#include "va_dri.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
static VADisplayContextP pDisplayContexts = NULL;
static void va_errorMessage(const char *msg, ...)
{
va_list args;
fprintf(stderr, "libva error: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
}
static void va_infoMessage(const char *msg, ...)
{
va_list args;
fprintf(stderr, "libva: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
}
static int va_DisplayContextIsValid (
VADisplayContextP pDisplayContext
)
{
VADisplayContextP ctx = pDisplayContexts;
while (ctx)
{
if (ctx == pDisplayContext && pDisplayContext->pDriverContext)
return 1;
ctx = ctx->pNext;
}
return 0;
}
static void va_DisplayContextDestroy (
VADisplayContextP pDisplayContext
)
{
VADisplayContextP *ctx = &pDisplayContexts;
/* Throw away pDisplayContext */
while (*ctx)
{
if (*ctx == pDisplayContext)
{
*ctx = pDisplayContext->pNext;
pDisplayContext->pNext = NULL;
break;
}
ctx = &((*ctx)->pNext);
}
free(pDisplayContext->pDriverContext);
free(pDisplayContext);
}
static VAStatus va_DisplayContextGetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
int direct_capable;
int driver_major;
int driver_minor;
int driver_patch;
Bool result = True;
char *x_driver_name = NULL;
if (driver_name)
*driver_name = NULL;
if (geteuid() == getuid())
{
/* don't allow setuid apps to use LIBVA_DRIVER_NAME */
if (getenv("LIBVA_DRIVER_NAME"))
{
/* For easier debugging */
*driver_name = strdup(getenv("LIBVA_DRIVER_NAME"));
return VA_STATUS_SUCCESS;
}
}
if (result)
{
result = VA_DRIQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen, &direct_capable);
if (!result)
{
va_errorMessage("VA_DRIQueryDirectRenderingCapable failed\n");
}
}
if (result)
{
result = direct_capable;
if (!result)
{
va_errorMessage("VA_DRIQueryDirectRenderingCapable returned false\n");
}
}
if (result)
{
result = VA_DRIGetClientDriverName(ctx->x11_dpy, ctx->x11_screen, &driver_major, &driver_minor,
&driver_patch, &x_driver_name);
if (!result)
{
va_errorMessage("VA_DRIGetClientDriverName returned false\n");
}
}
if (result)
{
vaStatus = VA_STATUS_SUCCESS;
va_infoMessage("VA_DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n",
driver_major, driver_minor, driver_patch, x_driver_name, ctx->x11_screen);
if (driver_name)
*driver_name = strdup(x_driver_name);
}
if (x_driver_name)
XFree(x_driver_name);
return vaStatus;
}
VADisplay vaGetDisplay (
Display *native_dpy
)
{
VADisplay dpy = NULL;
VADisplayContextP pDisplayContext = pDisplayContexts;
if (!native_dpy)
return NULL;
while (pDisplayContext)
{
if (pDisplayContext->pDriverContext &&
pDisplayContext->pDriverContext->x11_dpy == native_dpy)
{
dpy = (VADisplay)pDisplayContext;
break;
}
pDisplayContext = pDisplayContext->pNext;
}
if (!dpy)
{
/* create new entry */
VADriverContextP pDriverContext;
pDisplayContext = calloc(1, sizeof(*pDisplayContext));
pDriverContext = calloc(1, sizeof(*pDriverContext));
if (pDisplayContext && pDriverContext)
{
pDriverContext->old_pNext = (void *)(unsigned long)0xdeadbeef;
pDriverContext->x11_dpy = native_dpy;
pDisplayContext->pNext = pDisplayContexts;
pDisplayContext->pDriverContext = pDriverContext;
pDisplayContext->vaIsValid = va_DisplayContextIsValid;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
pDisplayContexts = pDisplayContext;
dpy = (VADisplay)pDisplayContext;
}
else
{
if (pDisplayContext)
free(pDisplayContext);
if (pDriverContext)
free(pDriverContext);
}
}
return dpy;
}
...@@ -17,12 +17,20 @@ ...@@ -17,12 +17,20 @@
#ifndef _VA_X11_H_ #ifndef _VA_X11_H_
#define _VA_X11_H_ #define _VA_X11_H_
#include "va.h" #include <va.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*
* Returns a suitable VADisplay for VA API
*/
VADisplay vaGetDisplay (
Display *dpy
);
/* /*
* Output rendering * Output rendering
* Following is the rendering interface for X windows, * Following is the rendering interface for X windows,
......
# va_x11.lo - a libtool object file
# Generated by ltmain.sh - GNU libtool 1.5.24 (1.1220.2.456 2007/06/24 02:25:32)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/va_x11.o'
# Name of the non-PIC object.
non_pic_object=none
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "va.h" #include <va_x11.h>
#include "X11/Xlib.h"
#include "assert.h" #include "assert.h"
#include <stdarg.h> #include <stdarg.h>
......
...@@ -24,16 +24,13 @@ ...@@ -24,16 +24,13 @@
#define TEST_DESCRIPTION "Sample MPEG2 VLD Decoding" #define TEST_DESCRIPTION "Sample MPEG2 VLD Decoding"
#include <va_x11.h>
#include "test_common.c" #include "test_common.c"
#include <X11/Xlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "va_x11.h"
void pre() void pre()
{ {
test_init(); test_init();
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "va.h" #include <va_x11.h>
#include "X11/Xlib.h"
#include "assert.h" #include "assert.h"
#include <stdarg.h> #include <stdarg.h>
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "va.h" #include <va_x11.h>
#include "X11/Xlib.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.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