Commit 341eb374 authored by ceros-guest's avatar ceros-guest

Imported Upstream version 0.4

git-svn-id: svn://svn.debian.org/svn/pkg-nvidia/packages/libvdpau/branches/upstream@710 b6a4b1ba-b714-0410-8a2d-fc0b36c6496e
parent 42b43f14
Copyright (c) 2008 NVIDIA, Corporation
Copyright © 2008-2010 NVIDIA Corporation
Copyright © 2008 Red Hat, Inc.
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
......
commit 76fdf83a7690ce366edbd4816b3c4b6728eeb9ee
Author: Aaron Plattner <aplattner@nvidia.com>
Date: Thu Jan 28 15:01:25 2010 -0800
Bump version to 0.4
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
commit 341c7e49b8c98f1a7b1a3ae719f15acd694719ca
Author: Stephen Warren <swarren@nvidia.com>
Date: Thu Jan 28 15:00:32 2010 -0800
trace: Fix a picture info bracket mismatch.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
commit f3bbd295d310d6ea44f00fa6c787a7427f01cd05
Author: Stephen Warren <swarren@nvidia.com>
Date: Thu Jan 28 14:58:40 2010 -0800
YV12 documentation fix.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
commit 4e2b6f38f640f341ec49336aaaccfb136decbdff
Author: Stephen Warren <swarren@nvidia.com>
Date: Thu Jan 28 14:56:59 2010 -0800
Documentation enhancements for Uoti from ffmpeg.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
commit 97331f1c8ee7c83f0dd6dff0ecc5bc51bf78022b
Author: Aaron Plattner <aplattner@nvidia.com>
Date: Wed Jan 27 18:17:23 2010 -0800
Update the COPYING copyright date to include recent changes
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
commit 3c02e5c68ef9480a0f9e5c3af5b09e6b3dcd981d
Author: Aaron Plattner <aplattner@nvidia.com>
Date: Wed Jan 27 18:16:41 2010 -0800
Query DRI2 for the driver name.
If the VDPAU_DRIVER environment variable is not set, use DRI2Connect to query
the VDPAU driver name from the X server.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
commit a9c69d294ae41fffadb432caa66917a4e7d107a8
Author: Aaron Plattner <aplattner@nvidia.com>
Date: Mon Dec 14 10:52:41 2009 -0800
$(docdir) apparently requires autoconf 2.60
commit 72c3ea0d5705ac5b21e5096742d9ec57573e543d
Author: Aaron Plattner <aplattner@nvidia.com>
Date: Fri Nov 20 11:54:36 2009 -0800
......
......@@ -198,6 +198,8 @@ STRIP = @STRIP@
VERSION = @VERSION@
X11_CFLAGS = @X11_CFLAGS@
X11_LIBS = @X11_LIBS@
XEXT_CFLAGS = @XEXT_CFLAGS@
XEXT_LIBS = @XEXT_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
......@@ -221,6 +223,8 @@ datadir = @datadir@
datarootdir = @datarootdir@
distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
dri2proto_CFLAGS = @dri2proto_CFLAGS@
dri2proto_LIBS = @dri2proto_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
......
/* config.h.in. Generated from configure.ac by autoheader. */
/* Request driver name from DRI2 */
#undef DRI2
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
......
This diff is collapsed.
AC_PREREQ(2.57)
AC_PREREQ(2.60)
AC_INIT(libvdpau, 0.3, [xorg@lists.freedesktop.org], libvdpau)
AC_INIT(libvdpau, 0.4, [xorg@lists.freedesktop.org], libvdpau)
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
......@@ -20,6 +20,23 @@ PKG_CHECK_MODULES(X11, x11)
AC_SUBST(X11_CFLAGS)
AC_SUBST(X11_LIBS)
# Check for optional dependencies.
AC_ARG_ENABLE(dri2, AS_HELP_STRING([--disable-dri2], [Disable driver name query through DRI2 (default: auto)]), [DRI2=$enableval], [DRI2=auto])
PKG_CHECK_MODULES(dri2proto, dri2proto >= 2.2, [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
case "$DRI2,$HAVE_DRI2PROTO" in
yes,no)
AC_MSG_ERROR([DRI2 queries require dri2proto >= 2.2])
;;
yes,yes | auto,yes)
AC_DEFINE(DRI2, 1, [Request driver name from DRI2])
DRI2=yes
PKG_CHECK_MODULES(XEXT, xext)
AC_SUBST([XEXT_CFLAGS])
AC_SUBST([XEXT_LIBS])
;;
esac
AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
......
......@@ -119,6 +119,8 @@ STRIP = @STRIP@
VERSION = @VERSION@
X11_CFLAGS = @X11_CFLAGS@
X11_LIBS = @X11_LIBS@
XEXT_CFLAGS = @XEXT_CFLAGS@
XEXT_LIBS = @XEXT_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
......@@ -142,6 +144,8 @@ datadir = @datadir@
datarootdir = @datarootdir@
distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
dri2proto_CFLAGS = @dri2proto_CFLAGS@
dri2proto_LIBS = @dri2proto_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
......
......@@ -828,7 +828,7 @@ typedef uint32_t VdpYCbCrFormat;
* \hideinitializer
* \brief The "YV12" YCbCr surface format.
*
* This format has a three planes, a Y plane, a U plane, and a V
* This format has a three planes, a Y plane, a V plane, and a U
* plane.
*
* Each of the planes is an array of byte-sized components.
......@@ -2144,6 +2144,22 @@ typedef enum {
/**
* \brief Complete blending operation definition.
*
* A "blend state" operation controls the math behind certain rendering
* operations.
*
* The blend math is the familiar OpenGL blend math:
* \f[
* dst.a = equation(blendFactorDstAlpha*dst.a,
* blendFactorSrcAlpha*src.a);
* \f]
* \f[
* dst.rgb = equation(blendFactorDstColor*dst.rgb,
* blendFactorSrcColor*src.rgb);
* \f]
*
* Note that when equation is MIN or MAX, the blend factors and constants
* are ignored, and are treated as if they were 1.0.
*/
typedef struct {
/**
......@@ -2237,16 +2253,9 @@ typedef struct {
* blend state will be used for the composite operation. If
* NULL, blending is effectively disabled, which is
* equivalent to a blend equation of ADD, source blend
* factors of ONE and destination blend factors of ZERO. The
* blend math is the familiar OpenGL blend math:
* \f[
* dst.a = equation(blendFactorDstAlpha*dst.a,
* blendFactorSrcAlpha*src.a);
* \f]
* \f[
* dst.rgb = equation(blendFactorDstColor*dst.rgb,
* blendFactorSrcColor*src.rgb);
* \f]
* factors of ONE and destination blend factors of ZERO.
* See \ref VdpOutputSurfaceRenderBlendState for details
* regarding the mathematics of the blending operation.
* \param[in] flags A set of flags influencing how the
* compositing operation works.
* \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
......@@ -2324,16 +2333,9 @@ typedef VdpStatus VdpOutputSurfaceRenderOutputSurface(
* blend state will be used for the composite operation. If
* NULL, blending is effectively disabled, which is
* equivalent to a blend equation of ADD, source blend
* factors of ONE and destination blend factors of ZERO. The
* blend math is the familiar OpenGL blend math:
* \f[
* dst.a = equation(blendFactorDstAlpha*dst.a,
* blendFactorSrcAlpha*src.a);
* \f]
* \f[
* dst.rgb = equation(blendFactorDstColor*dst.rgb,
* blendFactorSrcColor*src.rgb);
* \f]
* factors of ONE and destination blend factors of ZERO.
* See \ref VdpOutputSurfaceRenderBlendState for details
* regarding the mathematics of the blending operation.
* \param[in] flags A set of flags influencing how the
* compositing operation works.
* \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
......@@ -3990,6 +3992,14 @@ typedef VdpStatus VdpPresentationQueueGetTime(
* Using this technique, an application's response to window resizing may
* simply be to render to, and display, a different region of the surface,
* rather than de-/re-allocation of surfaces to match the updated window size.
*
* Implementations may impose an upper bound on the number of entries
* contained by the presentation queue at a given time. This limit is likely
* different to the number of \ref VdpOutputSurface "VdpOutputSurface"s that
* may be allocated at a given time. This limit applies to entries in the
* QUEUED or VISIBLE state only. In other words, entries that have
* transitioned from a QUEUED or VISIBLE state to an IDLE state do not count
* toward this limit.
*/
typedef VdpStatus VdpPresentationQueueDisplay(
VdpPresentationQueue presentation_queue,
......@@ -4008,10 +4018,11 @@ typedef VdpStatus VdpPresentationQueueDisplay(
* that 0 means the surface was never displayed.
* \return VdpStatus The completion status of the operation.
*
* Note that this API will block indefinitely if queried about
* the surface most recently added to a presentation queue,
* since there is no other surface that could possibly replace
* the queried surface.
* Note that this API would block forever if queried about the surface most
* recently added to a presentation queue. That is because there would be no
* other surface that could possibly replace that surface as the currently
* displayed surface, and hence that surface would never become idle. For
* that reason, this function will return an error in that case.
*/
typedef VdpStatus VdpPresentationQueueBlockUntilSurfaceIdle(
VdpPresentationQueue presentation_queue,
......
AM_CFLAGS = \
-I$(top_srcdir)/include \
-DVDPAU_MODULEDIR="\"$(moduledir)\"" \
$(X11_CFLAGS)
$(X11_CFLAGS) \
$(XEXT_CFLAGS)
lib_LTLIBRARIES = libvdpau.la
libvdpau_la_SOURCES = \
vdpau_wrapper.c
vdpau_wrapper.c \
$(DRI2_SOURCES)
if DRI2
DRI2_SOURCES = \
mesa_dri2.c \
mesa_dri2.h
endif
libvdpau_la_LIBADD = \
$(DLOPEN_LIBS)
$(DLOPEN_LIBS) \
$(XEXT_LIBS)
libvdpau_la_LDFLAGS = -version-info 1:0:0 -no-undefined
......
......@@ -72,8 +72,10 @@ am__installdirs = "$(DESTDIR)$(libdir)" \
"$(DESTDIR)$(libvdpauincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libvdpau_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libvdpau_la_OBJECTS = vdpau_wrapper.lo
libvdpau_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am__libvdpau_la_SOURCES_DIST = vdpau_wrapper.c mesa_dri2.c mesa_dri2.h
@DRI2_TRUE@am__objects_1 = mesa_dri2.lo
am_libvdpau_la_OBJECTS = vdpau_wrapper.lo $(am__objects_1)
libvdpau_la_OBJECTS = $(am_libvdpau_la_OBJECTS)
libvdpau_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
......@@ -92,7 +94,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libvdpau_la_SOURCES)
DIST_SOURCES = $(libvdpau_la_SOURCES)
DIST_SOURCES = $(am__libvdpau_la_SOURCES_DIST)
HEADERS = $(libvdpauinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
......@@ -169,6 +171,8 @@ STRIP = @STRIP@
VERSION = @VERSION@
X11_CFLAGS = @X11_CFLAGS@
X11_LIBS = @X11_LIBS@
XEXT_CFLAGS = @XEXT_CFLAGS@
XEXT_LIBS = @XEXT_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
......@@ -192,6 +196,8 @@ datadir = @datadir@
datarootdir = @datarootdir@
distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
dri2proto_CFLAGS = @dri2proto_CFLAGS@
dri2proto_LIBS = @dri2proto_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
......@@ -227,14 +233,21 @@ top_srcdir = @top_srcdir@
AM_CFLAGS = \
-I$(top_srcdir)/include \
-DVDPAU_MODULEDIR="\"$(moduledir)\"" \
$(X11_CFLAGS)
$(X11_CFLAGS) \
$(XEXT_CFLAGS)
lib_LTLIBRARIES = libvdpau.la
libvdpau_la_SOURCES = \
vdpau_wrapper.c
vdpau_wrapper.c \
$(DRI2_SOURCES)
@DRI2_TRUE@DRI2_SOURCES = \
@DRI2_TRUE@ mesa_dri2.c \
@DRI2_TRUE@ mesa_dri2.h
libvdpau_la_LIBADD = \
$(DLOPEN_LIBS)
$(DLOPEN_LIBS) \
$(XEXT_LIBS)
libvdpau_la_LDFLAGS = -version-info 1:0:0 -no-undefined
libvdpauincludedir = $(includedir)/vdpau
......@@ -316,6 +329,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mesa_dri2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vdpau_wrapper.Plo@am__quote@
.c.o:
......
/*
* Copyright © 2008 Red Hat, Inc.
* Copyright © 2010 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kristian Høgsberg (krh@redhat.com)
* Modified for VDPAU by Aaron Plattner (aplattner@nvidia.com)
*/
#define NEED_REPLIES
#include <X11/Xlibint.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#include <X11/extensions/dri2proto.h>
#include "mesa_dri2.h"
static char dri2ExtensionName[] = DRI2_NAME;
static XExtensionInfo *dri2Info;
static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
static /* const */ XExtensionHooks dri2ExtensionHooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
DRI2CloseDisplay, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
dri2Info,
dri2ExtensionName,
&dri2ExtensionHooks,
0, NULL)
Bool
_vdp_DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
if (XextHasExtension(info)) {
*eventBase = info->codes->first_event;
*errorBase = info->codes->first_error;
return True;
}
return False;
}
Bool
_vdp_DRI2QueryVersion(Display * dpy, int *major, int *minor)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2QueryVersionReply rep;
xDRI2QueryVersionReq *req;
XextCheckExtension(dpy, info, dri2ExtensionName, False);
LockDisplay(dpy);
GetReq(DRI2QueryVersion, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2QueryVersion;
req->majorVersion = DRI2_MAJOR;
req->minorVersion = DRI2_MINOR;
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*major = rep.majorVersion;
*minor = rep.minorVersion;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
Bool
_vdp_DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2ConnectReply rep;
xDRI2ConnectReq *req;
XextCheckExtension(dpy, info, dri2ExtensionName, False);
LockDisplay(dpy);
GetReq(DRI2Connect, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2Connect;
req->window = window;
req->driverType = DRI2DriverVDPAU;
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*driverName = Xmalloc(rep.driverNameLength + 1);
if (*driverName == NULL) {
_XEatData(dpy,
((rep.driverNameLength + 3) & ~3) +
((rep.deviceNameLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
return False;
}
_XReadPad(dpy, *driverName, rep.driverNameLength);
(*driverName)[rep.driverNameLength] = '\0';
*deviceName = Xmalloc(rep.deviceNameLength + 1);
if (*deviceName == NULL) {
Xfree(*driverName);
_XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
return False;
}
_XReadPad(dpy, *deviceName, rep.deviceNameLength);
(*deviceName)[rep.deviceNameLength] = '\0';
UnlockDisplay(dpy);
SyncHandle();
return True;
}
/*
* Copyright © 2007,2008 Red Hat, Inc.
* Copyright © 2010 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kristian Høgsberg (krh@redhat.com)
* Modified for VDPAU by Aaron Plattner (aplattner@nvidia.com)
*/
#ifndef _VDP_DRI2_H_
#define _VDP_DRI2_H_
#include <X11/extensions/dri2tokens.h>
extern Bool
_vdp_DRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
extern Bool
_vdp_DRI2QueryVersion(Display * display, int *major, int *minor);
extern Bool
_vdp_DRI2Connect(Display * display, XID window, char **driverName,
char **deviceName);
#endif
......@@ -21,12 +21,20 @@
* SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <dlfcn.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vdpau/vdpau_x11.h>
#if DRI2
#include "mesa_dri2.h"
#include <X11/Xlib.h>
#endif
typedef void SetDllHandle(
void * driver_dll_handle
......@@ -49,6 +57,36 @@ static void _vdp_wrapper_error_breakpoint(char const * file, int line, char cons
#define DRIVER_LIB_FORMAT "%slibvdpau_%s.so%s"
static char * _vdp_get_driver_name_from_dri2(
Display * display,
int screen
)
{
char * driver_name = NULL;
#if DRI2
Window root = RootWindow(display, screen);
int event_base, error_base;
int major, minor;
char * device_name;
if (!_vdp_DRI2QueryExtension(display, &event_base, &error_base)) {
return NULL;
}
if (!_vdp_DRI2QueryVersion(display, &major, &minor) ||
(major < 1 || (major == 1 && minor < 2))) {
return NULL;
}
if (!_vdp_DRI2Connect(display, root, &driver_name, &device_name)) {
return NULL;
}
XFree(device_name);
#endif /* DRI2 */
return driver_name;
}
VdpStatus vdp_device_create_x11(
Display * display,
int screen,
......@@ -58,6 +96,7 @@ VdpStatus vdp_device_create_x11(
)
{
char const * vdpau_driver;
char * vdpau_driver_dri2 = NULL;
char vdpau_driver_lib[PATH_MAX];
void * backend_dll;
char const * vdpau_trace;
......@@ -65,8 +104,11 @@ VdpStatus vdp_device_create_x11(
VdpDeviceCreateX11 * vdp_imp_device_create_x11;
/* FIXME: Determine driver name using an X extension */
vdpau_driver = getenv("VDPAU_DRIVER");
if (!vdpau_driver) {
vdpau_driver = vdpau_driver_dri2 =
_vdp_get_driver_name_from_dri2(display, screen);
}
if (!vdpau_driver) {
vdpau_driver = "nvidia";
}
......@@ -75,6 +117,10 @@ VdpStatus vdp_device_create_x11(
VDPAU_MODULEDIR "/", vdpau_driver, ".1") >=
sizeof(vdpau_driver_lib)) {
fprintf(stderr, "Failed to construct driver path: path too long\n");
if (vdpau_driver_dri2) {
XFree(vdpau_driver_dri2);
vdpau_driver_dri2 = NULL;
}
_VDP_ERROR_BREAKPOINT();
return VDP_STATUS_NO_IMPLEMENTATION;
}
......@@ -88,6 +134,11 @@ VdpStatus vdp_device_create_x11(
backend_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
}
if (vdpau_driver_dri2) {
XFree(vdpau_driver_dri2);
vdpau_driver_dri2 = NULL;
}
if (!backend_dll) {
fprintf(stderr, "Failed to open VDPAU backend %s\n", dlerror());
_VDP_ERROR_BREAKPOINT();
......
......@@ -169,6 +169,8 @@ STRIP = @STRIP@
VERSION = @VERSION@
X11_CFLAGS = @X11_CFLAGS@
X11_LIBS = @X11_LIBS@
XEXT_CFLAGS = @XEXT_CFLAGS@
XEXT_LIBS = @XEXT_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
......@@ -192,6 +194,8 @@ datadir = @datadir@
datarootdir = @datarootdir@
distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
dri2proto_CFLAGS = @dri2proto_CFLAGS@
dri2proto_LIBS = @dri2proto_LIBS@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
......
......@@ -397,7 +397,7 @@ static void _vdp_cap_dump_picture_info(
(uint32_t)rf->frame_idx
);
}
fputs("}", _vdp_cap_data.fp);
fputs("}}", _vdp_cap_data.fp);
}
break;
case VDP_DECODER_PROFILE_VC1_SIMPLE:
......
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