Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5361 → Rev 5362

/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/Makefile.am
0,0 → 1,51
# Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
AM_CPPFLAGS = \
-DLINUX \
-I$(top_srcdir) \
-I$(top_srcdir)/va \
-I$(top_srcdir)/va/x11 \
$(X11_CFLAGS) \
$(GLX_CFLAGS) \
$(NULL)
 
source_c = \
va_glx.c \
va_glx_impl.c \
$(NULL)
 
source_h = \
va_backend_glx.h \
va_glx.h \
$(NULL)
 
source_h_priv = \
va_glx_impl.h \
va_glx_private.h \
$(NULL)
 
noinst_LTLIBRARIES = libva_glx.la
libva_glxincludedir = ${includedir}/va
libva_glxinclude_HEADERS = $(source_h)
libva_glx_la_SOURCES = $(source_c)
noinst_HEADERS = $(source_h_priv)
/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/Makefile.in
0,0 → 1,716
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
 
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
 
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
 
@SET_MAKE@
 
# Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = va/glx
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(libva_glxinclude_HEADERS) \
$(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libva_glx_la_LIBADD =
am__objects_1 = va_glx.lo va_glx_impl.lo
am_libva_glx_la_OBJECTS = $(am__objects_1)
libva_glx_la_OBJECTS = $(am_libva_glx_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libva_glx_la_SOURCES)
DIST_SOURCES = $(libva_glx_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libva_glxincludedir)"
HEADERS = $(libva_glxinclude_HEADERS) $(noinst_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN = @DOXYGEN@
DRM_CFLAGS = @DRM_CFLAGS@
DRM_LIBS = @DRM_LIBS@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGL_CFLAGS = @EGL_CFLAGS@
EGL_LIBS = @EGL_LIBS@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GLX_CFLAGS = @GLX_CFLAGS@
GLX_LIBS = @GLX_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDRM_VERSION = @LIBDRM_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBVA_DRIVERS_PATH = @LIBVA_DRIVERS_PATH@
LIBVA_LT_LDFLAGS = @LIBVA_LT_LDFLAGS@
LIBVA_LT_VERSION = @LIBVA_LT_VERSION@
LIBVA_MAJOR_VERSION = @LIBVA_MAJOR_VERSION@
LIBVA_MICRO_VERSION = @LIBVA_MICRO_VERSION@
LIBVA_MINOR_VERSION = @LIBVA_MINOR_VERSION@
LIBVA_VERSION = @LIBVA_VERSION@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TODAY = @TODAY@
VA_API_MAJOR_VERSION = @VA_API_MAJOR_VERSION@
VA_API_MICRO_VERSION = @VA_API_MICRO_VERSION@
VA_API_MINOR_VERSION = @VA_API_MINOR_VERSION@
VA_API_VERSION = @VA_API_VERSION@
VERSION = @VERSION@
WAYLAND_API_VERSION = @WAYLAND_API_VERSION@
WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
WAYLAND_LIBS = @WAYLAND_LIBS@
WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@
WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@
X11_CFLAGS = @X11_CFLAGS@
X11_LIBS = @X11_LIBS@
XEXT_CFLAGS = @XEXT_CFLAGS@
XEXT_LIBS = @XEXT_LIBS@
XFIXES_CFLAGS = @XFIXES_CFLAGS@
XFIXES_LIBS = @XFIXES_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgconfigdir = @pkgconfigdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
wayland_protocoldir = @wayland_protocoldir@
wayland_scanner = @wayland_scanner@
AM_CPPFLAGS = \
-DLINUX \
-I$(top_srcdir) \
-I$(top_srcdir)/va \
-I$(top_srcdir)/va/x11 \
$(X11_CFLAGS) \
$(GLX_CFLAGS) \
$(NULL)
 
source_c = \
va_glx.c \
va_glx_impl.c \
$(NULL)
 
source_h = \
va_backend_glx.h \
va_glx.h \
$(NULL)
 
source_h_priv = \
va_glx_impl.h \
va_glx_private.h \
$(NULL)
 
noinst_LTLIBRARIES = libva_glx.la
libva_glxincludedir = ${includedir}/va
libva_glxinclude_HEADERS = $(source_h)
libva_glx_la_SOURCES = $(source_c)
noinst_HEADERS = $(source_h_priv)
all: all-am
 
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu va/glx/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu va/glx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
 
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
 
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
 
libva_glx.la: $(libva_glx_la_OBJECTS) $(libva_glx_la_DEPENDENCIES) $(EXTRA_libva_glx_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(libva_glx_la_OBJECTS) $(libva_glx_la_LIBADD) $(LIBS)
 
mostlyclean-compile:
-rm -f *.$(OBJEXT)
 
distclean-compile:
-rm -f *.tab.c
 
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/va_glx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/va_glx_impl.Plo@am__quote@
 
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
mostlyclean-libtool:
-rm -f *.lo
 
clean-libtool:
-rm -rf .libs _libs
install-libva_glxincludeHEADERS: $(libva_glxinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(libva_glxinclude_HEADERS)'; test -n "$(libva_glxincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libva_glxincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libva_glxincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libva_glxincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(libva_glxincludedir)" || exit $$?; \
done
 
uninstall-libva_glxincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libva_glxinclude_HEADERS)'; test -n "$(libva_glxincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(libva_glxincludedir)'; $(am__uninstall_files_from_dir)
 
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
 
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
 
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
 
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
 
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
 
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libva_glxincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
 
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
 
clean-generic:
 
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
 
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
 
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
 
dvi: dvi-am
 
dvi-am:
 
html: html-am
 
html-am:
 
info: info-am
 
info-am:
 
install-data-am: install-libva_glxincludeHEADERS
 
install-dvi: install-dvi-am
 
install-dvi-am:
 
install-exec-am:
 
install-html: install-html-am
 
install-html-am:
 
install-info: install-info-am
 
install-info-am:
 
install-man:
 
install-pdf: install-pdf-am
 
install-pdf-am:
 
install-ps: install-ps-am
 
install-ps-am:
 
installcheck-am:
 
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
 
mostlyclean: mostlyclean-am
 
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
 
pdf: pdf-am
 
pdf-am:
 
ps: ps-am
 
ps-am:
 
uninstall-am: uninstall-libva_glxincludeHEADERS
 
.MAKE: install-am install-strip
 
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libva_glxincludeHEADERS install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-libva_glxincludeHEADERS
 
 
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/va_backend_glx.h
0,0 → 1,54
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
 
#ifndef VA_BACKEND_GLX_H
#define VA_BACKEND_GLX_H
 
struct VADriverContext;
 
struct VADriverVTableGLX {
/* Optional: create a surface used for display to OpenGL */
VAStatus (*vaCreateSurfaceGLX)(
struct VADriverContext *ctx,
unsigned int gl_target,
unsigned int gl_texture,
void **gl_surface
);
 
/* Optional: destroy a VA/GLX surface */
VAStatus (*vaDestroySurfaceGLX)(
struct VADriverContext *ctx,
void *gl_surface
);
 
/* Optional: copy a VA surface to a VA/GLX surface */
VAStatus (*vaCopySurfaceGLX)(
struct VADriverContext *ctx,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
);
};
 
#endif /* VA_BACKEND_GLX_H */
/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/va_glx.c
0,0 → 1,166
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
 
#include <stdlib.h>
#include "va_glx_private.h"
#include "va_glx_impl.h"
 
#define INIT_CONTEXT(ctx, dpy) do { \
if (!vaDisplayIsValid(dpy)) \
return VA_STATUS_ERROR_INVALID_DISPLAY; \
\
ctx = ((VADisplayContextP)(dpy))->pDriverContext; \
if (!(ctx)) \
return VA_STATUS_ERROR_INVALID_DISPLAY; \
\
VAStatus status = va_glx_init_context(ctx); \
if (status != VA_STATUS_SUCCESS) \
return status; \
} while (0)
 
#define INVOKE(ctx, func, args) do { \
VADriverVTableGLXP vtable; \
vtable = &VA_DRIVER_CONTEXT_GLX(ctx)->vtable; \
if (!vtable->va##func##GLX) \
return VA_STATUS_ERROR_UNIMPLEMENTED; \
status = vtable->va##func##GLX args; \
} while (0)
 
 
// Destroy VA/GLX display context
static void va_DisplayContextDestroy(VADisplayContextP pDisplayContext)
{
VADisplayContextGLXP pDisplayContextGLX;
VADriverContextP pDriverContext;
VADriverContextGLXP pDriverContextGLX;
 
if (!pDisplayContext)
return;
 
pDriverContext = pDisplayContext->pDriverContext;
pDriverContextGLX = pDriverContext->glx;
if (pDriverContextGLX) {
free(pDriverContextGLX);
pDriverContext->glx = NULL;
}
 
pDisplayContextGLX = pDisplayContext->opaque;
if (pDisplayContextGLX) {
vaDestroyFunc vaDestroy = pDisplayContextGLX->vaDestroy;
free(pDisplayContextGLX);
pDisplayContext->opaque = NULL;
if (vaDestroy)
vaDestroy(pDisplayContext);
}
}
 
// Return a suitable VADisplay for VA API
VADisplay vaGetDisplayGLX(Display *native_dpy)
{
VADisplay dpy = NULL;
VADisplayContextP pDisplayContext = NULL;
VADisplayContextGLXP pDisplayContextGLX = NULL;
VADriverContextP pDriverContext;
VADriverContextGLXP pDriverContextGLX = NULL;
 
dpy = vaGetDisplay(native_dpy);
if (!dpy)
return NULL;
pDisplayContext = (VADisplayContextP)dpy;
pDriverContext = pDisplayContext->pDriverContext;
 
pDisplayContextGLX = calloc(1, sizeof(*pDisplayContextGLX));
if (!pDisplayContextGLX)
goto error;
 
pDriverContextGLX = calloc(1, sizeof(*pDriverContextGLX));
if (!pDriverContextGLX)
goto error;
 
pDriverContext->display_type = VA_DISPLAY_GLX;
pDisplayContextGLX->vaDestroy = pDisplayContext->vaDestroy;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->opaque = pDisplayContextGLX;
pDriverContext->glx = pDriverContextGLX;
return dpy;
 
error:
free(pDriverContextGLX);
free(pDisplayContextGLX);
pDisplayContext->vaDestroy(pDisplayContext);
return NULL;
}
 
// Create a surface used for display to OpenGL
VAStatus vaCreateSurfaceGLX(
VADisplay dpy,
GLenum target,
GLuint texture,
void **gl_surface
)
{
VADriverContextP ctx;
VAStatus status;
 
/* Make sure it is a valid GL texture object */
if (!glIsTexture(texture))
return VA_STATUS_ERROR_INVALID_PARAMETER;
 
INIT_CONTEXT(ctx, dpy);
 
INVOKE(ctx, CreateSurface, (ctx, target, texture, gl_surface));
return status;
}
 
// Destroy a VA/GLX surface
VAStatus vaDestroySurfaceGLX(
VADisplay dpy,
void *gl_surface
)
{
VADriverContextP ctx;
VAStatus status;
 
INIT_CONTEXT(ctx, dpy);
 
INVOKE(ctx, DestroySurface, (ctx, gl_surface));
return status;
}
 
// Copy a VA surface to a VA/GLX surface
VAStatus vaCopySurfaceGLX(
VADisplay dpy,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
)
{
VADriverContextP ctx;
VAStatus status;
 
INIT_CONTEXT(ctx, dpy);
 
INVOKE(ctx, CopySurface, (ctx, gl_surface, surface, flags));
return status;
}
/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/va_glx.h
0,0 → 1,109
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
 
#ifndef VA_GLX_H
#define VA_GLX_H
 
#include <va/va.h>
#include <GL/glx.h>
 
#ifdef __cplusplus
extern "C" {
#endif
 
/**
* Return a suitable VADisplay for VA API
*
* @param[in] dpy the X11 display
* @return a VADisplay
*/
VADisplay vaGetDisplayGLX(
Display *dpy
);
 
/**
* Create a surface used for display to OpenGL
*
* The application shall maintain the live GLX context itself.
* Implementations are free to use glXGetCurrentContext() and
* glXGetCurrentDrawable() functions for internal purposes.
*
* @param[in] dpy the VA display
* @param[in] target the GL target to which the texture needs to be bound
* @param[in] texture the GL texture
* @param[out] gl_surface the VA/GLX surface
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus vaCreateSurfaceGLX(
VADisplay dpy,
GLenum target,
GLuint texture,
void **gl_surface
);
 
/**
* Destroy a VA/GLX surface
*
* The application shall maintain the live GLX context itself.
* Implementations are free to use glXGetCurrentContext() and
* glXGetCurrentDrawable() functions for internal purposes.
*
* @param[in] dpy the VA display
* @param[in] gl_surface the VA surface
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus vaDestroySurfaceGLX(
VADisplay dpy,
void *gl_surface
);
 
/**
* Copy a VA surface to a VA/GLX surface
*
* This function will not return until the copy is completed. At this
* point, the underlying GL texture will contain the surface pixels
* in an RGB format defined by the user.
*
* The application shall maintain the live GLX context itself.
* Implementations are free to use glXGetCurrentContext() and
* glXGetCurrentDrawable() functions for internal purposes.
*
* @param[in] dpy the VA display
* @param[in] gl_surface the VA/GLX destination surface
* @param[in] surface the VA source surface
* @param[in] flags the PutSurface flags
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus vaCopySurfaceGLX(
VADisplay dpy,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
);
 
#ifdef __cplusplus
}
#endif
 
#endif /* VA_GLX_H */
/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/va_glx_impl.c
0,0 → 1,1103
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
 
#define _GNU_SOURCE 1
#include "va_glx_private.h"
#include "va_glx_impl.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <dlfcn.h>
 
static void va_glx_error_message(const char *format, ...)
{
va_list args;
va_start(args, format);
fprintf(stderr, "libva-glx error: ");
vfprintf(stderr, format, args);
va_end(args);
}
 
// X error trap
static int x11_error_code = 0;
static int (*old_error_handler)(Display *, XErrorEvent *);
 
static int error_handler(Display *dpy, XErrorEvent *error)
{
x11_error_code = error->error_code;
return 0;
}
 
static void x11_trap_errors(void)
{
x11_error_code = 0;
old_error_handler = XSetErrorHandler(error_handler);
}
 
static int x11_untrap_errors(void)
{
XSetErrorHandler(old_error_handler);
return x11_error_code;
}
 
// Returns a string representation of an OpenGL error
static const char *gl_get_error_string(GLenum error)
{
static const struct {
GLenum val;
const char *str;
}
gl_errors[] = {
{ GL_NO_ERROR, "no error" },
{ GL_INVALID_ENUM, "invalid enumerant" },
{ GL_INVALID_VALUE, "invalid value" },
{ GL_INVALID_OPERATION, "invalid operation" },
{ GL_STACK_OVERFLOW, "stack overflow" },
{ GL_STACK_UNDERFLOW, "stack underflow" },
{ GL_OUT_OF_MEMORY, "out of memory" },
#ifdef GL_INVALID_FRAMEBUFFER_OPERATION_EXT
{ GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "invalid framebuffer operation" },
#endif
{ ~0, NULL }
};
 
int i;
for (i = 0; gl_errors[i].str; i++) {
if (gl_errors[i].val == error)
return gl_errors[i].str;
}
return "unknown";
}
 
static inline int gl_do_check_error(int report)
{
GLenum error;
int is_error = 0;
while ((error = glGetError()) != GL_NO_ERROR) {
if (report)
va_glx_error_message("glError: %s caught\n",
gl_get_error_string(error));
is_error = 1;
}
return is_error;
}
 
static inline void gl_purge_errors(void)
{
gl_do_check_error(0);
}
 
static inline int gl_check_error(void)
{
return gl_do_check_error(1);
}
 
// glGetTexLevelParameteriv() wrapper
static int gl_get_texture_param(GLenum param, unsigned int *pval)
{
GLint val;
 
gl_purge_errors();
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, param, &val);
if (gl_check_error())
return 0;
if (pval)
*pval = val;
return 1;
}
 
// Returns the OpenGL VTable
static inline VAOpenGLVTableP gl_get_vtable(VADriverContextP ctx)
{
return &VA_DRIVER_CONTEXT_GLX(ctx)->gl_vtable;
}
 
// Lookup for a GLX function
typedef void (*GLFuncPtr)(void);
typedef GLFuncPtr (*GLXGetProcAddressProc)(const char *);
 
static GLFuncPtr get_proc_address_default(const char *name)
{
return NULL;
}
 
static GLXGetProcAddressProc get_proc_address_func(void)
{
GLXGetProcAddressProc get_proc_func;
 
dlerror();
get_proc_func = (GLXGetProcAddressProc)
dlsym(RTLD_DEFAULT, "glXGetProcAddress");
if (!dlerror())
return get_proc_func;
 
get_proc_func = (GLXGetProcAddressProc)
dlsym(RTLD_DEFAULT, "glXGetProcAddressARB");
if (!dlerror())
return get_proc_func;
 
return get_proc_address_default;
}
 
static inline GLFuncPtr get_proc_address(const char *name)
{
static GLXGetProcAddressProc get_proc_func = NULL;
if (!get_proc_func)
get_proc_func = get_proc_address_func();
return get_proc_func(name);
}
 
// Check for GLX extensions (TFP, FBO)
static int check_extension(const char *name, const char *ext)
{
const char *end;
int name_len, n;
 
if (!name || !ext)
return 0;
 
end = ext + strlen(ext);
name_len = strlen(name);
while (ext < end) {
n = strcspn(ext, " ");
if (n == name_len && strncmp(name, ext, n) == 0)
return 1;
ext += (n + 1);
}
return 0;
}
 
static int check_tfp_extensions(VADriverContextP ctx)
{
const char *gl_extensions;
const char *glx_extensions;
 
gl_extensions = (const char *)glGetString(GL_EXTENSIONS);
if (!check_extension("GL_ARB_texture_non_power_of_two", gl_extensions))
return 0;
 
glx_extensions = glXQueryExtensionsString(ctx->native_dpy, ctx->x11_screen);
if (!check_extension("GLX_EXT_texture_from_pixmap", glx_extensions))
return 0;
return 1;
}
 
static int check_fbo_extensions(VADriverContextP ctx)
{
const char *gl_extensions;
 
gl_extensions = (const char *)glGetString(GL_EXTENSIONS);
if (check_extension("GL_ARB_framebuffer_object", gl_extensions))
return 1;
if (check_extension("GL_EXT_framebuffer_object", gl_extensions))
return 1;
return 0;
}
 
// Load GLX extensions
static int load_tfp_extensions(VADriverContextP ctx)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
pOpenGLVTable->glx_create_pixmap = (PFNGLXCREATEPIXMAPPROC)
get_proc_address("glXCreatePixmap");
if (!pOpenGLVTable->glx_create_pixmap)
return 0;
pOpenGLVTable->glx_destroy_pixmap = (PFNGLXDESTROYPIXMAPPROC)
get_proc_address("glXDestroyPixmap");
if (!pOpenGLVTable->glx_destroy_pixmap)
return 0;
pOpenGLVTable->glx_bind_tex_image = (PFNGLXBINDTEXIMAGEEXTPROC)
get_proc_address("glXBindTexImageEXT");
if (!pOpenGLVTable->glx_bind_tex_image)
return 0;
pOpenGLVTable->glx_release_tex_image = (PFNGLXRELEASETEXIMAGEEXTPROC)
get_proc_address("glXReleaseTexImageEXT");
if (!pOpenGLVTable->glx_release_tex_image)
return 0;
return 1;
}
 
static int load_fbo_extensions(VADriverContextP ctx)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
pOpenGLVTable->gl_gen_framebuffers = (PFNGLGENFRAMEBUFFERSEXTPROC)
get_proc_address("glGenFramebuffersEXT");
if (!pOpenGLVTable->gl_gen_framebuffers)
return 0;
pOpenGLVTable->gl_delete_framebuffers = (PFNGLDELETEFRAMEBUFFERSEXTPROC)
get_proc_address("glDeleteFramebuffersEXT");
if (!pOpenGLVTable->gl_delete_framebuffers)
return 0;
pOpenGLVTable->gl_bind_framebuffer = (PFNGLBINDFRAMEBUFFEREXTPROC)
get_proc_address("glBindFramebufferEXT");
if (!pOpenGLVTable->gl_bind_framebuffer)
return 0;
pOpenGLVTable->gl_gen_renderbuffers = (PFNGLGENRENDERBUFFERSEXTPROC)
get_proc_address("glGenRenderbuffersEXT");
if (!pOpenGLVTable->gl_gen_renderbuffers)
return 0;
pOpenGLVTable->gl_delete_renderbuffers = (PFNGLDELETERENDERBUFFERSEXTPROC)
get_proc_address("glDeleteRenderbuffersEXT");
if (!pOpenGLVTable->gl_delete_renderbuffers)
return 0;
pOpenGLVTable->gl_bind_renderbuffer = (PFNGLBINDRENDERBUFFEREXTPROC)
get_proc_address("glBindRenderbufferEXT");
if (!pOpenGLVTable->gl_bind_renderbuffer)
return 0;
pOpenGLVTable->gl_renderbuffer_storage = (PFNGLRENDERBUFFERSTORAGEEXTPROC)
get_proc_address("glRenderbufferStorageEXT");
if (!pOpenGLVTable->gl_renderbuffer_storage)
return 0;
pOpenGLVTable->gl_framebuffer_renderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
get_proc_address("glFramebufferRenderbufferEXT");
if (!pOpenGLVTable->gl_framebuffer_renderbuffer)
return 0;
pOpenGLVTable->gl_framebuffer_texture_2d = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
get_proc_address("glFramebufferTexture2DEXT");
if (!pOpenGLVTable->gl_framebuffer_texture_2d)
return 0;
pOpenGLVTable->gl_check_framebuffer_status = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
get_proc_address("glCheckFramebufferStatusEXT");
if (!pOpenGLVTable->gl_check_framebuffer_status)
return 0;
return 1;
}
 
 
/* ========================================================================= */
/* === VA/GLX helpers === */
/* ========================================================================= */
 
// OpenGL context state
typedef struct OpenGLContextState *OpenGLContextStateP;
 
struct OpenGLContextState {
Display *display;
Window window;
GLXContext context;
};
 
static void
gl_destroy_context(OpenGLContextStateP cs)
{
if (!cs)
return;
 
if (cs->display && cs->context) {
if (glXGetCurrentContext() == cs->context)
glXMakeCurrent(cs->display, None, NULL);
glXDestroyContext(cs->display, cs->context);
cs->display = NULL;
cs->context = NULL;
}
free(cs);
}
 
static OpenGLContextStateP
gl_create_context(VADriverContextP ctx, OpenGLContextStateP parent)
{
OpenGLContextStateP cs;
GLXFBConfig *fbconfigs = NULL;
int fbconfig_id, val, n, n_fbconfigs;
Status status;
 
static GLint fbconfig_attrs[] = {
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, True,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
None
};
 
cs = malloc(sizeof(*cs));
if (!cs)
goto error;
 
if (parent) {
cs->display = parent->display;
cs->window = parent->window;
}
else {
cs->display = ctx->native_dpy;
cs->window = None;
}
cs->context = NULL;
 
if (parent && parent->context) {
status = glXQueryContext(
parent->display,
parent->context,
GLX_FBCONFIG_ID, &fbconfig_id
);
if (status != Success)
goto error;
 
if (fbconfig_id == GLX_DONT_CARE)
goto choose_fbconfig;
 
fbconfigs = glXGetFBConfigs(
parent->display,
DefaultScreen(parent->display),
&n_fbconfigs
);
if (!fbconfigs)
goto error;
 
/* Find out a GLXFBConfig compatible with the parent context */
for (n = 0; n < n_fbconfigs; n++) {
status = glXGetFBConfigAttrib(
cs->display,
fbconfigs[n],
GLX_FBCONFIG_ID, &val
);
if (status == Success && val == fbconfig_id)
break;
}
if (n == n_fbconfigs)
goto error;
}
else {
choose_fbconfig:
fbconfigs = glXChooseFBConfig(
ctx->native_dpy,
ctx->x11_screen,
fbconfig_attrs, &n_fbconfigs
);
if (!fbconfigs)
goto error;
 
/* Select the first one */
n = 0;
}
 
cs->context = glXCreateNewContext(
cs->display,
fbconfigs[n],
GLX_RGBA_TYPE,
parent ? parent->context : NULL,
True
);
if (cs->context)
goto end;
 
error:
gl_destroy_context(cs);
cs = NULL;
end:
if (fbconfigs)
XFree(fbconfigs);
return cs;
}
 
static void gl_get_current_context(OpenGLContextStateP cs)
{
cs->display = glXGetCurrentDisplay();
cs->window = glXGetCurrentDrawable();
cs->context = glXGetCurrentContext();
}
 
static int
gl_set_current_context(OpenGLContextStateP new_cs, OpenGLContextStateP old_cs)
{
/* If display is NULL, this could be that new_cs was retrieved from
gl_get_current_context() with none set previously. If that case,
the other fields are also NULL and we don't return an error */
if (!new_cs->display)
return !new_cs->window && !new_cs->context;
 
if (old_cs) {
if (old_cs == new_cs)
return 1;
gl_get_current_context(old_cs);
if (old_cs->display == new_cs->display &&
old_cs->window == new_cs->window &&
old_cs->context == new_cs->context)
return 1;
}
return glXMakeCurrent(new_cs->display, new_cs->window, new_cs->context);
}
 
/** Unique VASurfaceGLX identifier */
#define VA_SURFACE_GLX_MAGIC VA_FOURCC('V','A','G','L')
 
struct VASurfaceGLX {
uint32_t magic; ///< Magic number identifying a VASurfaceGLX
GLenum target; ///< GL target to which the texture is bound
GLuint texture; ///< GL texture
VASurfaceID surface; ///< Associated VA surface
unsigned int width;
unsigned int height;
OpenGLContextStateP gl_context;
int is_bound;
Pixmap pixmap;
GLuint pix_texture;
GLXPixmap glx_pixmap;
GLuint fbo;
};
 
// Create Pixmaps for GLX texture-from-pixmap extension
static int create_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAOpenGLVTableP const pOpenGLVTable = gl_get_vtable(ctx);
const unsigned int width = pSurfaceGLX->width;
const unsigned int height = pSurfaceGLX->height;
Pixmap pixmap = None;
GLXFBConfig *fbconfig = NULL;
GLXPixmap glx_pixmap = None;
Window root_window;
XWindowAttributes wattr;
int *attrib;
int n_fbconfig_attrs;
 
root_window = RootWindow(ctx->native_dpy, ctx->x11_screen);
XGetWindowAttributes(ctx->native_dpy, root_window, &wattr);
if (wattr.depth != 24 && wattr.depth != 32)
return 0;
pixmap = XCreatePixmap(
ctx->native_dpy,
root_window,
width,
height,
wattr.depth
);
if (!pixmap)
return 0;
pSurfaceGLX->pixmap = pixmap;
 
int fbconfig_attrs[32] = {
GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
GLX_DOUBLEBUFFER, GL_TRUE,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_X_RENDERABLE, GL_TRUE,
GLX_Y_INVERTED_EXT, GL_TRUE,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
/*
* depth test isn't enabled in the implementaion of VA GLX,
* so depth buffer is unnecessary. However to workaround a
* bug in older verson of xorg-server, always require a depth
* buffer.
*
* See https://bugs.freedesktop.org/show_bug.cgi?id=76755
*/
GLX_DEPTH_SIZE, 1,
GL_NONE,
};
for (attrib = fbconfig_attrs; *attrib != GL_NONE; attrib += 2)
;
if (wattr.depth == 32) {
*attrib++ = GLX_ALPHA_SIZE; *attrib++ = 8;
*attrib++ = GLX_BIND_TO_TEXTURE_RGBA_EXT; *attrib++ = GL_TRUE;
}
else {
*attrib++ = GLX_BIND_TO_TEXTURE_RGB_EXT; *attrib++ = GL_TRUE;
}
*attrib++ = GL_NONE;
 
fbconfig = glXChooseFBConfig(
ctx->native_dpy,
ctx->x11_screen,
fbconfig_attrs,
&n_fbconfig_attrs
);
if (!fbconfig)
return 0;
 
int pixmap_attrs[10] = {
GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
GLX_MIPMAP_TEXTURE_EXT, GL_FALSE,
GL_NONE,
};
for (attrib = pixmap_attrs; *attrib != GL_NONE; attrib += 2)
;
*attrib++ = GLX_TEXTURE_FORMAT_EXT;
if (wattr.depth == 32)
*attrib++ = GLX_TEXTURE_FORMAT_RGBA_EXT;
else
*attrib++ = GLX_TEXTURE_FORMAT_RGB_EXT;
*attrib++ = GL_NONE;
 
x11_trap_errors();
glx_pixmap = pOpenGLVTable->glx_create_pixmap(
ctx->native_dpy,
fbconfig[0],
pixmap,
pixmap_attrs
);
free(fbconfig);
if (x11_untrap_errors() != 0)
return 0;
pSurfaceGLX->glx_pixmap = glx_pixmap;
 
glGenTextures(1, &pSurfaceGLX->pix_texture);
glBindTexture(GL_TEXTURE_2D, pSurfaceGLX->pix_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
return 1;
}
 
// Destroy Pixmaps used for TFP
static void destroy_tfp_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAOpenGLVTableP const pOpenGLVTable = gl_get_vtable(ctx);
 
if (pSurfaceGLX->pix_texture) {
glDeleteTextures(1, &pSurfaceGLX->pix_texture);
pSurfaceGLX->pix_texture = 0;
}
 
if (pSurfaceGLX->glx_pixmap) {
pOpenGLVTable->glx_destroy_pixmap(ctx->native_dpy, pSurfaceGLX->glx_pixmap);
pSurfaceGLX->glx_pixmap = None;
}
 
if (pSurfaceGLX->pixmap) {
XFreePixmap(ctx->native_dpy, pSurfaceGLX->pixmap);
pSurfaceGLX->pixmap = None;
}
}
 
// Bind GLX Pixmap to texture
static int bind_pixmap(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
if (pSurfaceGLX->is_bound)
return 1;
 
glBindTexture(GL_TEXTURE_2D, pSurfaceGLX->pix_texture);
 
x11_trap_errors();
pOpenGLVTable->glx_bind_tex_image(
ctx->native_dpy,
pSurfaceGLX->glx_pixmap,
GLX_FRONT_LEFT_EXT,
NULL
);
XSync(ctx->native_dpy, False);
if (x11_untrap_errors() != 0) {
va_glx_error_message("failed to bind pixmap\n");
return 0;
}
 
pSurfaceGLX->is_bound = 1;
return 1;
}
 
// Release GLX Pixmap from texture
static int unbind_pixmap(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
if (!pSurfaceGLX->is_bound)
return 1;
 
x11_trap_errors();
pOpenGLVTable->glx_release_tex_image(
ctx->native_dpy,
pSurfaceGLX->glx_pixmap,
GLX_FRONT_LEFT_EXT
);
XSync(ctx->native_dpy, False);
if (x11_untrap_errors() != 0) {
va_glx_error_message("failed to release pixmap\n");
return 0;
}
 
glBindTexture(GL_TEXTURE_2D, 0);
 
pSurfaceGLX->is_bound = 0;
return 1;
}
 
// Render GLX Pixmap to texture
static void render_pixmap(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
const unsigned int w = pSurfaceGLX->width;
const unsigned int h = pSurfaceGLX->height;
 
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
{
glTexCoord2f(0.0f, 0.0f); glVertex2i(0, 0);
glTexCoord2f(0.0f, 1.0f); glVertex2i(0, h);
glTexCoord2f(1.0f, 1.0f); glVertex2i(w, h);
glTexCoord2f(1.0f, 0.0f); glVertex2i(w, 0);
}
glEnd();
}
 
// Create offscreen surface
static int create_fbo_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
GLuint fbo;
GLenum status;
 
pOpenGLVTable->gl_gen_framebuffers(1, &fbo);
pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, fbo);
pOpenGLVTable->gl_framebuffer_texture_2d(
GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D,
pSurfaceGLX->texture,
0
);
 
status = pOpenGLVTable->gl_check_framebuffer_status(GL_DRAW_FRAMEBUFFER_EXT);
pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, 0);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
return 0;
 
pSurfaceGLX->fbo = fbo;
return 1;
}
 
// Destroy offscreen surface
static void destroy_fbo_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
if (pSurfaceGLX->fbo) {
pOpenGLVTable->gl_delete_framebuffers(1, &pSurfaceGLX->fbo);
pSurfaceGLX->fbo = 0;
}
}
 
// Setup matrices to match the FBO texture dimensions
static void fbo_enter(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
const unsigned int width = pSurfaceGLX->width;
const unsigned int height = pSurfaceGLX->height;
 
pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, pSurfaceGLX->fbo);
glPushAttrib(GL_VIEWPORT_BIT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glViewport(0, 0, width, height);
glTranslatef(-1.0f, -1.0f, 0.0f);
glScalef(2.0f / width, 2.0f / height, 1.0f);
}
 
// Restore original OpenGL matrices
static void fbo_leave(VADriverContextP ctx)
{
VAOpenGLVTableP pOpenGLVTable = gl_get_vtable(ctx);
 
glPopAttrib();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
pOpenGLVTable->gl_bind_framebuffer(GL_FRAMEBUFFER_EXT, 0);
}
 
// Check internal texture format is supported
static int is_supported_internal_format(GLenum format)
{
/* XXX: we don't support other textures than RGBA */
switch (format) {
case 4:
case GL_RGBA:
case GL_RGBA8:
return 1;
}
return 0;
}
 
// Destroy VA/GLX surface
static void
destroy_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
unbind_pixmap(ctx, pSurfaceGLX);
destroy_fbo_surface(ctx, pSurfaceGLX);
destroy_tfp_surface(ctx, pSurfaceGLX);
free(pSurfaceGLX);
}
 
// Create VA/GLX surface
static VASurfaceGLXP
create_surface(VADriverContextP ctx, GLenum target, GLuint texture)
{
VASurfaceGLXP pSurfaceGLX = NULL;
unsigned int internal_format, border_width, width, height;
int is_error = 1;
 
pSurfaceGLX = malloc(sizeof(*pSurfaceGLX));
if (!pSurfaceGLX)
goto end;
 
pSurfaceGLX->magic = VA_SURFACE_GLX_MAGIC;
pSurfaceGLX->target = target;
pSurfaceGLX->texture = texture;
pSurfaceGLX->surface = VA_INVALID_SURFACE;
pSurfaceGLX->gl_context = NULL;
pSurfaceGLX->is_bound = 0;
pSurfaceGLX->pixmap = None;
pSurfaceGLX->pix_texture = 0;
pSurfaceGLX->glx_pixmap = None;
pSurfaceGLX->fbo = 0;
 
glEnable(target);
glBindTexture(target, texture);
if (!gl_get_texture_param(GL_TEXTURE_INTERNAL_FORMAT, &internal_format))
goto end;
if (!is_supported_internal_format(internal_format))
goto end;
 
/* Check texture dimensions */
if (!gl_get_texture_param(GL_TEXTURE_BORDER, &border_width))
goto end;
if (!gl_get_texture_param(GL_TEXTURE_WIDTH, &width))
goto end;
if (!gl_get_texture_param(GL_TEXTURE_HEIGHT, &height))
goto end;
 
width -= 2 * border_width;
height -= 2 * border_width;
if (width == 0 || height == 0)
goto end;
 
pSurfaceGLX->width = width;
pSurfaceGLX->height = height;
 
/* Create TFP objects */
if (!create_tfp_surface(ctx, pSurfaceGLX))
goto end;
 
/* Create FBO objects */
if (!create_fbo_surface(ctx, pSurfaceGLX))
goto end;
 
is_error = 0;
end:
if (is_error && pSurfaceGLX) {
destroy_surface(ctx, pSurfaceGLX);
pSurfaceGLX = NULL;
}
return pSurfaceGLX;
}
 
 
/* ========================================================================= */
/* === VA/GLX implementation from the driver (fordward calls) === */
/* ========================================================================= */
 
#define INVOKE(ctx, func, args) do { \
VADriverVTableGLXP vtable = (ctx)->vtable_glx; \
if (!vtable->va##func##GLX) \
return VA_STATUS_ERROR_UNIMPLEMENTED; \
\
VAStatus status = vtable->va##func##GLX args; \
if (status != VA_STATUS_SUCCESS) \
return status; \
} while (0)
 
static VAStatus
vaCreateSurfaceGLX_impl_driver(
VADriverContextP ctx,
GLenum target,
GLuint texture,
void **gl_surface
)
{
INVOKE(ctx, CreateSurface, (ctx, target, texture, gl_surface));
return VA_STATUS_SUCCESS;
}
 
static VAStatus
vaDestroySurfaceGLX_impl_driver(VADriverContextP ctx, void *gl_surface)
{
INVOKE(ctx, DestroySurface, (ctx, gl_surface));
return VA_STATUS_SUCCESS;
}
 
static VAStatus
vaCopySurfaceGLX_impl_driver(
VADriverContextP ctx,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
)
{
INVOKE(ctx, CopySurface, (ctx, gl_surface, surface, flags));
return VA_STATUS_SUCCESS;
}
 
#undef INVOKE
 
 
/* ========================================================================= */
/* === VA/GLX implementation from libVA (generic and suboptimal path) === */
/* ========================================================================= */
 
#define INIT_SURFACE(surface, surface_arg) do { \
surface = (VASurfaceGLXP)(surface_arg); \
if (!check_surface(surface)) \
return VA_STATUS_ERROR_INVALID_SURFACE; \
} while (0)
 
// Check VASurfaceGLX is valid
static inline int check_surface(VASurfaceGLXP pSurfaceGLX)
{
return pSurfaceGLX && pSurfaceGLX->magic == VA_SURFACE_GLX_MAGIC;
}
 
static VAStatus
vaCreateSurfaceGLX_impl_libva(
VADriverContextP ctx,
GLenum target,
GLuint texture,
void **gl_surface
)
{
VASurfaceGLXP pSurfaceGLX;
struct OpenGLContextState old_cs, *new_cs;
 
gl_get_current_context(&old_cs);
new_cs = gl_create_context(ctx, &old_cs);
if (!new_cs)
goto error;
if (!gl_set_current_context(new_cs, NULL))
goto error;
 
pSurfaceGLX = create_surface(ctx, target, texture);
if (!pSurfaceGLX)
goto error;
 
pSurfaceGLX->gl_context = new_cs;
*gl_surface = pSurfaceGLX;
 
gl_set_current_context(&old_cs, NULL);
return VA_STATUS_SUCCESS;
 
error:
if (new_cs)
gl_destroy_context(new_cs);
 
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
 
static VAStatus
vaDestroySurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface)
{
VASurfaceGLXP pSurfaceGLX;
struct OpenGLContextState old_cs, *new_cs;
 
INIT_SURFACE(pSurfaceGLX, gl_surface);
 
new_cs = pSurfaceGLX->gl_context;
if (!gl_set_current_context(new_cs, &old_cs))
return VA_STATUS_ERROR_OPERATION_FAILED;
 
destroy_surface(ctx, pSurfaceGLX);
 
gl_destroy_context(new_cs);
gl_set_current_context(&old_cs, NULL);
return VA_STATUS_SUCCESS;
}
 
static inline VAStatus
deassociate_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
if (!unbind_pixmap(ctx, pSurfaceGLX))
return VA_STATUS_ERROR_OPERATION_FAILED;
 
pSurfaceGLX->surface = VA_INVALID_SURFACE;
return VA_STATUS_SUCCESS;
}
 
static VAStatus
associate_surface(
VADriverContextP ctx,
VASurfaceGLXP pSurfaceGLX,
VASurfaceID surface,
unsigned int flags
)
{
VAStatus status;
 
/* XXX: optimise case where we are associating the same VA surface
as before an no changed occurred to it */
status = deassociate_surface(ctx, pSurfaceGLX);
if (status != VA_STATUS_SUCCESS)
return status;
 
x11_trap_errors();
status = ctx->vtable->vaPutSurface(
ctx,
surface,
(void *)pSurfaceGLX->pixmap,
0, 0, pSurfaceGLX->width, pSurfaceGLX->height,
0, 0, pSurfaceGLX->width, pSurfaceGLX->height,
NULL, 0,
flags
);
XSync(ctx->native_dpy, False);
if (x11_untrap_errors() != 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
if (status != VA_STATUS_SUCCESS)
return status;
 
pSurfaceGLX->surface = surface;
return VA_STATUS_SUCCESS;
}
 
static inline VAStatus
sync_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
if (pSurfaceGLX->surface == VA_INVALID_SURFACE)
return VA_STATUS_ERROR_INVALID_SURFACE;
 
return ctx->vtable->vaSyncSurface(ctx, pSurfaceGLX->surface);
}
 
static inline VAStatus
begin_render_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
VAStatus status;
 
status = sync_surface(ctx, pSurfaceGLX);
if (status != VA_STATUS_SUCCESS)
return status;
 
if (!bind_pixmap(ctx, pSurfaceGLX))
return VA_STATUS_ERROR_OPERATION_FAILED;
 
return VA_STATUS_SUCCESS;
}
 
static inline VAStatus
end_render_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
{
if (!unbind_pixmap(ctx, pSurfaceGLX))
return VA_STATUS_ERROR_OPERATION_FAILED;
 
return VA_STATUS_SUCCESS;
}
 
static VAStatus
copy_surface(
VADriverContextP ctx,
VASurfaceGLXP pSurfaceGLX,
VASurfaceID surface,
unsigned int flags
)
{
VAStatus status;
 
/* Associate VA surface */
status = associate_surface(ctx, pSurfaceGLX, surface, flags);
if (status != VA_STATUS_SUCCESS)
return status;
 
/* Render to FBO */
fbo_enter(ctx, pSurfaceGLX);
status = begin_render_surface(ctx, pSurfaceGLX);
if (status == VA_STATUS_SUCCESS) {
render_pixmap(ctx, pSurfaceGLX);
status = end_render_surface(ctx, pSurfaceGLX);
}
fbo_leave(ctx);
if (status != VA_STATUS_SUCCESS)
return status;
 
return deassociate_surface(ctx, pSurfaceGLX);
}
 
static VAStatus
vaCopySurfaceGLX_impl_libva(
VADriverContextP ctx,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
)
{
VASurfaceGLXP pSurfaceGLX;
VAStatus status;
struct OpenGLContextState old_cs;
 
INIT_SURFACE(pSurfaceGLX, gl_surface);
 
if (!gl_set_current_context(pSurfaceGLX->gl_context, &old_cs))
return VA_STATUS_ERROR_OPERATION_FAILED;
 
status = copy_surface(ctx, pSurfaceGLX, surface, flags);
 
gl_set_current_context(&old_cs, NULL);
return status;
}
 
#undef INIT_SURFACE
 
 
/* ========================================================================= */
/* === Private VA/GLX vtable initialization === */
/* ========================================================================= */
 
// Initialize GLX driver context
VAStatus va_glx_init_context(VADriverContextP ctx)
{
VADriverContextGLXP glx_ctx = VA_DRIVER_CONTEXT_GLX(ctx);
VADriverVTableGLXP vtable = &glx_ctx->vtable;
int glx_major, glx_minor;
 
if (glx_ctx->is_initialized)
return VA_STATUS_SUCCESS;
 
if (ctx->vtable_glx && ctx->vtable_glx->vaCopySurfaceGLX) {
vtable->vaCreateSurfaceGLX = vaCreateSurfaceGLX_impl_driver;
vtable->vaDestroySurfaceGLX = vaDestroySurfaceGLX_impl_driver;
vtable->vaCopySurfaceGLX = vaCopySurfaceGLX_impl_driver;
}
else {
vtable->vaCreateSurfaceGLX = vaCreateSurfaceGLX_impl_libva;
vtable->vaDestroySurfaceGLX = vaDestroySurfaceGLX_impl_libva;
vtable->vaCopySurfaceGLX = vaCopySurfaceGLX_impl_libva;
 
if (!glXQueryVersion(ctx->native_dpy, &glx_major, &glx_minor))
return VA_STATUS_ERROR_UNIMPLEMENTED;
 
if (!check_tfp_extensions(ctx) || !load_tfp_extensions(ctx))
return VA_STATUS_ERROR_UNIMPLEMENTED;
 
if (!check_fbo_extensions(ctx) || !load_fbo_extensions(ctx))
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
 
glx_ctx->is_initialized = 1;
return VA_STATUS_SUCCESS;
}
/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/va_glx_impl.h
0,0 → 1,37
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
 
#ifndef VA_GLX_IMPL_H
#define VA_GLX_IMPL_H
 
/**
* Initialize GLX driver context
*
* @param[in] ctx the VA driver context
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus va_glx_init_context(VADriverContextP ctx);
/* ATTRIBUTE_HIDDEN; */
 
#endif /* VA_GLX_IMPL_H */
/contrib/sdk/sources/vaapi/libva-1.4.1/va/glx/va_glx_private.h
0,0 → 1,86
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
 
#ifndef VA_GLX_PRIVATE_H
#define VA_GLX_PRIVATE_H
 
#include "sysdeps.h"
#include "va.h"
#include "va_backend.h"
#include "va_x11.h"
#include "va_glx.h"
#include "va_backend_glx.h"
#include <GL/glxext.h>
 
#if GLX_GLXEXT_VERSION < 18
typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *);
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
#endif
 
#if GLX_GLXEXT_VERSION < 27
/* XXX: this is not exactly that version but this is the only means to
make sure we have the correct <GL/glx.h> with those signatures */
typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
#endif
 
typedef struct VAOpenGLVTable *VAOpenGLVTableP;
 
struct VAOpenGLVTable {
PFNGLXCREATEPIXMAPPROC glx_create_pixmap;
PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap;
PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image;
PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image;
PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers;
PFNGLDELETEFRAMEBUFFERSEXTPROC gl_delete_framebuffers;
PFNGLBINDFRAMEBUFFEREXTPROC gl_bind_framebuffer;
PFNGLGENRENDERBUFFERSEXTPROC gl_gen_renderbuffers;
PFNGLDELETERENDERBUFFERSEXTPROC gl_delete_renderbuffers;
PFNGLBINDRENDERBUFFEREXTPROC gl_bind_renderbuffer;
PFNGLRENDERBUFFERSTORAGEEXTPROC gl_renderbuffer_storage;
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC gl_framebuffer_renderbuffer;
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC gl_framebuffer_texture_2d;
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC gl_check_framebuffer_status;
};
 
typedef struct VADisplayContextGLX *VADisplayContextGLXP;
typedef struct VADriverContextGLX *VADriverContextGLXP;
typedef struct VASurfaceGLX *VASurfaceGLXP;
typedef struct VADriverVTableGLX *VADriverVTableGLXP;
 
typedef void (*vaDestroyFunc)(VADisplayContextP);
 
struct VADisplayContextGLX {
vaDestroyFunc vaDestroy;
};
 
#define VA_DRIVER_CONTEXT_GLX(ctx) ((VADriverContextGLXP)((ctx)->glx))
 
struct VADriverContextGLX {
struct VADriverVTableGLX vtable;
struct VAOpenGLVTable gl_vtable;
unsigned int is_initialized : 1;
};
 
#endif /* VA_GLX_PRIVATE_H */