Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5361 → Rev 5362

/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/Makefile.am
0,0 → 1,58
# 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.
 
AM_CPPFLAGS = \
-DLINUX \
-I$(top_srcdir) \
-I$(top_srcdir)/va \
$(X11_CFLAGS) \
$(XEXT_CFLAGS) \
$(XFIXES_CFLAGS) \
$(DRM_CFLAGS) \
$(NULL)
 
source_c = \
dri2_util.c \
va_dri2.c \
va_dricommon.c \
va_fglrx.c \
va_nvctrl.c \
va_x11.c \
$(NULL)
 
source_h = \
va_dri2.h \
va_dricommon.h \
$(NULL)
 
source_h_priv = \
va_dri2str.h \
va_dri2tokens.h \
va_fglrx.h \
va_nvctrl.h \
$(NULL)
 
noinst_LTLIBRARIES = libva_x11.la
libva_x11includedir = ${includedir}/va
libva_x11include_HEADERS = $(source_h)
libva_x11_la_SOURCES = $(source_c)
noinst_HEADERS = $(source_h_priv)
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/Makefile.in
0,0 → 1,728
# 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) 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.
 
 
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/x11
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(libva_x11include_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_x11_la_LIBADD =
am__objects_1 = dri2_util.lo va_dri2.lo va_dricommon.lo va_fglrx.lo \
va_nvctrl.lo va_x11.lo
am_libva_x11_la_OBJECTS = $(am__objects_1)
libva_x11_la_OBJECTS = $(am_libva_x11_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_x11_la_SOURCES)
DIST_SOURCES = $(libva_x11_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_x11includedir)"
HEADERS = $(libva_x11include_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 \
$(X11_CFLAGS) \
$(XEXT_CFLAGS) \
$(XFIXES_CFLAGS) \
$(DRM_CFLAGS) \
$(NULL)
 
source_c = \
dri2_util.c \
va_dri2.c \
va_dricommon.c \
va_fglrx.c \
va_nvctrl.c \
va_x11.c \
$(NULL)
 
source_h = \
va_dri2.h \
va_dricommon.h \
$(NULL)
 
source_h_priv = \
va_dri2str.h \
va_dri2tokens.h \
va_fglrx.h \
va_nvctrl.h \
$(NULL)
 
noinst_LTLIBRARIES = libva_x11.la
libva_x11includedir = ${includedir}/va
libva_x11include_HEADERS = $(source_h)
libva_x11_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/x11/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu va/x11/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_x11.la: $(libva_x11_la_OBJECTS) $(libva_x11_la_DEPENDENCIES) $(EXTRA_libva_x11_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(libva_x11_la_OBJECTS) $(libva_x11_la_LIBADD) $(LIBS)
 
mostlyclean-compile:
-rm -f *.$(OBJEXT)
 
distclean-compile:
-rm -f *.tab.c
 
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri2_util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/va_dri2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/va_dricommon.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/va_fglrx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/va_nvctrl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/va_x11.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_x11includeHEADERS: $(libva_x11include_HEADERS)
@$(NORMAL_INSTALL)
@list='$(libva_x11include_HEADERS)'; test -n "$(libva_x11includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(libva_x11includedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(libva_x11includedir)" || 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_x11includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(libva_x11includedir)" || exit $$?; \
done
 
uninstall-libva_x11includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libva_x11include_HEADERS)'; test -n "$(libva_x11includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(libva_x11includedir)'; $(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_x11includedir)"; 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_x11includeHEADERS
 
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_x11includeHEADERS
 
.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_x11includeHEADERS 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_x11includeHEADERS
 
 
# 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/x11/dri2_util.c
0,0 → 1,239
/*
* Copyright (c) 2012 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 <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
 
#include <xf86drm.h>
 
#include <X11/Xlibint.h>
#include <X11/Xlib.h>
#include "va.h"
#include "va_backend.h"
 
#include "va_dri2.h"
#include "va_dri2tokens.h"
#include "va_dricommon.h"
 
#define __DRI_BUFFER_FRONT_LEFT 0
#define __DRI_BUFFER_BACK_LEFT 1
#define __DRI_BUFFER_FRONT_RIGHT 2
#define __DRI_BUFFER_BACK_RIGHT 3
#define __DRI_BUFFER_DEPTH 4
#define __DRI_BUFFER_STENCIL 5
#define __DRI_BUFFER_ACCUM 6
#define __DRI_BUFFER_FAKE_FRONT_LEFT 7
#define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
 
struct dri2_drawable
{
struct dri_drawable base;
union dri_buffer buffers[5];
int width;
int height;
int has_backbuffer;
int back_index;
int front_index;
};
 
static int gsDRI2SwapAvailable;
 
static struct dri_drawable *
dri2CreateDrawable(VADriverContextP ctx, XID x_drawable)
{
struct dri2_drawable *dri2_drawable;
 
dri2_drawable = calloc(1, sizeof(*dri2_drawable));
 
if (!dri2_drawable)
return NULL;
 
dri2_drawable->base.x_drawable = x_drawable;
dri2_drawable->base.x = 0;
dri2_drawable->base.y = 0;
VA_DRI2CreateDrawable(ctx->native_dpy, x_drawable);
 
return &dri2_drawable->base;
}
 
static void
dri2DestroyDrawable(VADriverContextP ctx, struct dri_drawable *dri_drawable)
{
VA_DRI2DestroyDrawable(ctx->native_dpy, dri_drawable->x_drawable);
free(dri_drawable);
}
 
static void
dri2SwapBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
{
struct dri2_drawable *dri2_drawable = (struct dri2_drawable *)dri_drawable;
XRectangle xrect;
XserverRegion region;
 
if (dri2_drawable->has_backbuffer) {
if (gsDRI2SwapAvailable) {
CARD64 ret;
VA_DRI2SwapBuffers(ctx->native_dpy, dri_drawable->x_drawable, 0, 0,
0, &ret);
} else {
xrect.x = 0;
xrect.y = 0;
xrect.width = dri2_drawable->width;
xrect.height = dri2_drawable->height;
 
region = XFixesCreateRegion(ctx->native_dpy, &xrect, 1);
VA_DRI2CopyRegion(ctx->native_dpy, dri_drawable->x_drawable, region,
DRI2BufferFrontLeft, DRI2BufferBackLeft);
XFixesDestroyRegion(ctx->native_dpy, region);
}
}
}
 
static union dri_buffer *
dri2GetRenderingBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
{
struct dri2_drawable *dri2_drawable = (struct dri2_drawable *)dri_drawable;
int i;
int count;
unsigned int attachments[5];
VA_DRI2Buffer *buffers;
i = 0;
if (dri_drawable->is_window)
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
else
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
 
buffers = VA_DRI2GetBuffers(ctx->native_dpy, dri_drawable->x_drawable,
&dri2_drawable->width, &dri2_drawable->height,
attachments, i, &count);
assert(buffers);
if (buffers == NULL)
return NULL;
 
dri2_drawable->has_backbuffer = 0;
 
for (i = 0; i < count; i++) {
dri2_drawable->buffers[i].dri2.attachment = buffers[i].attachment;
dri2_drawable->buffers[i].dri2.name = buffers[i].name;
dri2_drawable->buffers[i].dri2.pitch = buffers[i].pitch;
dri2_drawable->buffers[i].dri2.cpp = buffers[i].cpp;
dri2_drawable->buffers[i].dri2.flags = buffers[i].flags;
if (buffers[i].attachment == __DRI_BUFFER_BACK_LEFT) {
dri2_drawable->has_backbuffer = 1;
dri2_drawable->back_index = i;
}
 
if (buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT)
dri2_drawable->front_index = i;
}
dri_drawable->width = dri2_drawable->width;
dri_drawable->height = dri2_drawable->height;
Xfree(buffers);
 
if (dri2_drawable->has_backbuffer)
return &dri2_drawable->buffers[dri2_drawable->back_index];
 
return &dri2_drawable->buffers[dri2_drawable->front_index];
}
 
void
dri2Close(VADriverContextP ctx)
{
struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
 
free_drawable_hashtable(ctx);
 
if (dri_state->base.fd >= 0);
close(dri_state->base.fd);
}
 
Bool
isDRI2Connected(VADriverContextP ctx, char **driver_name)
{
struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
int major, minor;
int error_base;
int event_base;
char *device_name = NULL;
drm_magic_t magic;
*driver_name = NULL;
dri_state->base.fd = -1;
dri_state->base.auth_type = VA_NONE;
if (!VA_DRI2QueryExtension(ctx->native_dpy, &event_base, &error_base))
goto err_out;
 
if (!VA_DRI2QueryVersion(ctx->native_dpy, &major, &minor))
goto err_out;
 
 
if (!VA_DRI2Connect(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen),
driver_name, &device_name))
goto err_out;
 
dri_state->base.fd = open(device_name, O_RDWR);
assert(dri_state->base.fd >= 0);
 
if (dri_state->base.fd < 0)
goto err_out;
 
if (drmGetMagic(dri_state->base.fd, &magic))
goto err_out;
 
if (!VA_DRI2Authenticate(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen),
magic))
goto err_out;
 
dri_state->base.auth_type = VA_DRI2;
dri_state->createDrawable = dri2CreateDrawable;
dri_state->destroyDrawable = dri2DestroyDrawable;
dri_state->swapBuffer = dri2SwapBuffer;
dri_state->getRenderingBuffer = dri2GetRenderingBuffer;
dri_state->close = dri2Close;
gsDRI2SwapAvailable = (minor >= 2);
 
if (device_name)
Xfree(device_name);
 
return True;
 
err_out:
if (device_name)
Xfree(device_name);
 
if (*driver_name)
Xfree(*driver_name);
 
if (dri_state->base.fd >= 0)
close(dri_state->base.fd);
 
*driver_name = NULL;
dri_state->base.fd = -1;
return False;
}
 
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_dri2.c
0,0 → 1,368
/*
* 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 "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)
*/
 
 
#define NEED_REPLIES
#include <X11/Xlibint.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#include "xf86drm.h"
#include "va_dri2.h"
#include "va_dri2str.h"
#include "va_dri2tokens.h"
 
#ifndef DRI2DriverDRI
#define DRI2DriverDRI 0
#endif
 
static int
VA_DRI2Error(Display *dpy, xError *err, XExtCodes *codes, int *ret_code);
 
static char va_dri2ExtensionName[] = DRI2_NAME;
static XExtensionInfo _va_dri2_info_data;
static XExtensionInfo *va_dri2Info = &_va_dri2_info_data;
static XEXT_GENERATE_CLOSE_DISPLAY (VA_DRI2CloseDisplay, va_dri2Info)
static /* const */ XExtensionHooks va_dri2ExtensionHooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
VA_DRI2CloseDisplay, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
VA_DRI2Error, /* error */
NULL, /* error_string */
};
 
static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, va_dri2Info,
va_dri2ExtensionName,
&va_dri2ExtensionHooks,
0, NULL)
 
static int
VA_DRI2Error(Display *dpy, xError *err, XExtCodes *codes, int *ret_code)
{
/*
* If the X drawable was destroyed before the VA drawable, the DRI2 drawable
* will be gone by the time we call VA_DRI2DestroyDrawable(). So, simply
* ignore BadDrawable errors in that case.
*/
if (err->majorCode == codes->major_opcode &&
err->errorCode == BadDrawable &&
err->minorCode == X_DRI2DestroyDrawable)
return True;
 
return False;
}
 
Bool VA_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 VA_DRI2QueryVersion(Display *dpy, int *major, int *minor)
{
XExtDisplayInfo *info = DRI2FindDisplay (dpy);
xDRI2QueryVersionReply rep;
xDRI2QueryVersionReq *req;
 
XextCheckExtension (dpy, info, va_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 VA_DRI2Connect(Display *dpy, XID window,
char **driverName, char **deviceName)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2ConnectReply rep;
xDRI2ConnectReq *req;
 
XextCheckExtension (dpy, info, va_dri2ExtensionName, False);
 
LockDisplay(dpy);
GetReq(DRI2Connect, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2Connect;
req->window = window;
req->driverType = DRI2DriverDRI;
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;
}
 
Bool VA_DRI2Authenticate(Display *dpy, XID window, drm_magic_t magic)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2AuthenticateReq *req;
xDRI2AuthenticateReply rep;
 
XextCheckExtension (dpy, info, va_dri2ExtensionName, False);
 
LockDisplay(dpy);
GetReq(DRI2Authenticate, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2Authenticate;
req->window = window;
req->magic = magic;
 
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
 
UnlockDisplay(dpy);
SyncHandle();
 
return rep.authenticated;
}
 
void VA_DRI2CreateDrawable(Display *dpy, XID drawable)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2CreateDrawableReq *req;
 
XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
 
LockDisplay(dpy);
GetReq(DRI2CreateDrawable, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2CreateDrawable;
req->drawable = drawable;
UnlockDisplay(dpy);
SyncHandle();
}
 
void VA_DRI2DestroyDrawable(Display *dpy, XID drawable)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2DestroyDrawableReq *req;
 
XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
 
XSync(dpy, False);
 
LockDisplay(dpy);
GetReq(DRI2DestroyDrawable, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2DestroyDrawable;
req->drawable = drawable;
UnlockDisplay(dpy);
SyncHandle();
}
 
VA_DRI2Buffer *VA_DRI2GetBuffers(Display *dpy, XID drawable,
int *width, int *height,
unsigned int *attachments, int count,
int *outCount)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2GetBuffersReply rep;
xDRI2GetBuffersReq *req;
VA_DRI2Buffer *buffers;
xDRI2Buffer repBuffer;
CARD32 *p;
int i;
 
XextCheckExtension (dpy, info, va_dri2ExtensionName, False);
 
LockDisplay(dpy);
GetReqExtra(DRI2GetBuffers, count * 4, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2GetBuffers;
req->drawable = drawable;
req->count = count;
p = (CARD32 *) &req[1];
for (i = 0; i < count; i++)
p[i] = attachments[i];
 
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return NULL;
}
 
*width = rep.width;
*height = rep.height;
*outCount = rep.count;
 
buffers = Xmalloc(rep.count * sizeof buffers[0]);
if (buffers == NULL) {
_XEatData(dpy, rep.count * sizeof repBuffer);
UnlockDisplay(dpy);
SyncHandle();
return NULL;
}
 
for (i = 0; i < rep.count; i++) {
_XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
buffers[i].attachment = repBuffer.attachment;
buffers[i].name = repBuffer.name;
buffers[i].pitch = repBuffer.pitch;
buffers[i].cpp = repBuffer.cpp;
buffers[i].flags = repBuffer.flags;
}
 
UnlockDisplay(dpy);
SyncHandle();
 
return buffers;
}
 
void VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
CARD32 dest, CARD32 src)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2CopyRegionReq *req;
xDRI2CopyRegionReply rep;
 
XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
 
LockDisplay(dpy);
GetReq(DRI2CopyRegion, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2CopyRegion;
req->drawable = drawable;
req->region = region;
req->dest = dest;
req->src = src;
 
_XReply(dpy, (xReply *)&rep, 0, xFalse);
 
UnlockDisplay(dpy);
SyncHandle();
}
 
static void
load_swap_req(xDRI2SwapBuffersReq *req, CARD64 target, CARD64 divisor,
CARD64 remainder)
{
req->target_msc_hi = target >> 32;
req->target_msc_lo = target & 0xffffffff;
req->divisor_hi = divisor >> 32;
req->divisor_lo = divisor & 0xffffffff;
req->remainder_hi = remainder >> 32;
req->remainder_lo = remainder & 0xffffffff;
}
 
static CARD64
vals_to_card64(CARD32 lo, CARD32 hi)
{
return (CARD64)hi << 32 | lo;
}
 
void VA_DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc,
CARD64 divisor, CARD64 remainder, CARD64 *count)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2SwapBuffersReq *req;
xDRI2SwapBuffersReply rep;
 
XextSimpleCheckExtension (dpy, info, va_dri2ExtensionName);
 
LockDisplay(dpy);
GetReq(DRI2SwapBuffers, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2SwapBuffers;
req->drawable = drawable;
load_swap_req(req, target_msc, divisor, remainder);
 
_XReply(dpy, (xReply *)&rep, 0, xFalse);
 
*count = vals_to_card64(rep.swap_lo, rep.swap_hi);
 
UnlockDisplay(dpy);
SyncHandle();
}
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_dri2.h
0,0 → 1,73
/*
* Copyright © 2007,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 "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)
*/
 
#ifndef _VA_DRI2_H_
#define _VA_DRI2_H_
 
#include <X11/Xproto.h>
#include <X11/extensions/Xfixes.h>
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
 
typedef struct {
unsigned int attachment;
unsigned int name;
unsigned int pitch;
unsigned int cpp;
unsigned int flags;
} VA_DRI2Buffer;
 
extern Bool
VA_DRI2QueryExtension(Display *display, int *eventBase, int *errorBase);
extern Bool
VA_DRI2QueryVersion(Display *display, int *major, int *minor);
extern Bool
VA_DRI2Connect(Display *display, XID window,
char **driverName, char **deviceName);
extern Bool
VA_DRI2Authenticate(Display *display, XID window, drm_magic_t magic);
extern void
VA_DRI2CreateDrawable(Display *display, XID drawable);
extern void
VA_DRI2DestroyDrawable(Display *display, XID handle);
extern VA_DRI2Buffer *
VA_DRI2GetBuffers(Display *dpy, XID drawable,
int *width, int *height,
unsigned int *attachments, int count,
int *outCount);
extern void
VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
CARD32 dest, CARD32 src);
extern void
VA_DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
CARD64 remainder, CARD64 *count);
#endif
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_dri2str.h
0,0 → 1,227
/*
* 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 "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)
*/
 
#ifndef _DRI2_PROTO_H_
#define _DRI2_PROTO_H_
 
#define DRI2_NAME "DRI2"
#define DRI2_MAJOR 1
#define DRI2_MINOR 2
 
#define DRI2NumberErrors 0
#define DRI2NumberEvents 2
#define DRI2NumberRequests 13
 
#define X_DRI2QueryVersion 0
#define X_DRI2Connect 1
#define X_DRI2Authenticate 2
#define X_DRI2CreateDrawable 3
#define X_DRI2DestroyDrawable 4
#define X_DRI2GetBuffers 5
#define X_DRI2CopyRegion 6
#define X_DRI2GetBuffersWithFormat 7
#define X_DRI2SwapBuffers 8
#define X_DRI2GetMSC 9
#define X_DRI2WaitMSC 10
#define X_DRI2WaitSBC 11
#define X_DRI2SwapInterval 12
 
typedef struct {
CARD32 attachment B32;
CARD32 name B32;
CARD32 pitch B32;
CARD32 cpp B32;
CARD32 flags B32;
} xDRI2Buffer;
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
} xDRI2QueryVersionReq;
#define sz_xDRI2QueryVersionReq 12
 
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xDRI2QueryVersionReply;
#define sz_xDRI2QueryVersionReply 32
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 window B32;
CARD32 driverType B32;
} xDRI2ConnectReq;
#define sz_xDRI2ConnectReq 12
 
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 driverNameLength B32;
CARD32 deviceNameLength B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xDRI2ConnectReply;
#define sz_xDRI2ConnectReply 32
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 window B32;
CARD32 magic B32;
} xDRI2AuthenticateReq;
#define sz_xDRI2AuthenticateReq 12
 
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 authenticated B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xDRI2AuthenticateReply;
#define sz_xDRI2AuthenticateReply 32
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 drawable B32;
} xDRI2CreateDrawableReq;
#define sz_xDRI2CreateDrawableReq 8
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 drawable B32;
} xDRI2DestroyDrawableReq;
#define sz_xDRI2DestroyDrawableReq 8
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 drawable B32;
CARD32 count B32;
} xDRI2GetBuffersReq;
#define sz_xDRI2GetBuffersReq 12
 
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 width B32;
CARD32 height B32;
CARD32 count B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
} xDRI2GetBuffersReply;
#define sz_xDRI2GetBuffersReply 32
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 drawable B32;
CARD32 region B32;
CARD32 dest B32;
CARD32 src B32;
} xDRI2CopyRegionReq;
#define sz_xDRI2CopyRegionReq 20
 
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xDRI2CopyRegionReply;
#define sz_xDRI2CopyRegionReply 32
 
typedef struct {
CARD8 reqType;
CARD8 dri2ReqType;
CARD16 length B16;
CARD32 drawable B32;
CARD32 target_msc_hi B32;
CARD32 target_msc_lo B32;
CARD32 divisor_hi B32;
CARD32 divisor_lo B32;
CARD32 remainder_hi B32;
CARD32 remainder_lo B32;
} xDRI2SwapBuffersReq;
#define sz_xDRI2SwapBuffersReq 32
 
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 swap_hi B32;
CARD32 swap_lo B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xDRI2SwapBuffersReply;
#define sz_xDRI2SwapBuffersReply 32
 
#endif
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_dri2tokens.h
0,0 → 1,48
/*
* 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 "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)
*/
 
#ifndef _DRI2_TOKENS_H_
#define _DRI2_TOKENS_H_
 
#define DRI2BufferFrontLeft 0
#define DRI2BufferBackLeft 1
#define DRI2BufferFrontRight 2
#define DRI2BufferBackRight 3
#define DRI2BufferDepth 4
#define DRI2BufferStencil 5
#define DRI2BufferAccum 6
#define DRI2BufferFakeFrontLeft 7
#define DRI2BufferFakeFrontRight 8
 
#define DRI2DriverDRI 0
 
#endif
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_dricommon.c
0,0 → 1,137
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "va_dricommon.h"
 
// 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;
}
 
static int
is_window(Display *dpy, Drawable drawable)
{
XWindowAttributes wattr;
 
x11_trap_errors();
XGetWindowAttributes(dpy, drawable, &wattr);
return x11_untrap_errors() == 0;
}
 
static struct dri_drawable *
do_drawable_hash(VADriverContextP ctx, XID drawable)
{
struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
int index = drawable % DRAWABLE_HASH_SZ;
struct dri_drawable *dri_drawable = dri_state->drawable_hash[index];
 
while (dri_drawable) {
if (dri_drawable->x_drawable == drawable)
return dri_drawable;
dri_drawable = dri_drawable->next;
}
 
dri_drawable = dri_state->createDrawable(ctx, drawable);
dri_drawable->x_drawable = drawable;
dri_drawable->is_window = is_window(ctx->native_dpy, drawable);
dri_drawable->next = dri_state->drawable_hash[index];
dri_state->drawable_hash[index] = dri_drawable;
 
return dri_drawable;
}
 
void
free_drawable(VADriverContextP ctx, struct dri_drawable* dri_drawable)
{
struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
int i = 0;
 
while (i++ < DRAWABLE_HASH_SZ) {
if (dri_drawable == dri_state->drawable_hash[i]) {
dri_state->destroyDrawable(ctx, dri_drawable);
dri_state->drawable_hash[i] = NULL;
}
}
}
 
void
free_drawable_hashtable(VADriverContextP ctx)
{
struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
int i;
struct dri_drawable *dri_drawable, *prev;
 
for (i = 0; i < DRAWABLE_HASH_SZ; i++) {
dri_drawable = dri_state->drawable_hash[i];
 
while (dri_drawable) {
prev = dri_drawable;
dri_drawable = prev->next;
dri_state->destroyDrawable(ctx, prev);
}
 
dri_state->drawable_hash[i] = NULL;
}
}
 
struct dri_drawable *
dri_get_drawable(VADriverContextP ctx, XID drawable)
{
return do_drawable_hash(ctx, drawable);
}
 
void
dri_swap_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
{
struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
 
dri_state->swapBuffer(ctx, dri_drawable);
}
 
union dri_buffer *
dri_get_rendering_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
{
struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
return dri_state->getRenderingBuffer(ctx, dri_drawable);
}
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_dricommon.h
0,0 → 1,94
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _VA_DRICOMMON_H_
#define _VA_DRICOMMON_H_
 
#ifndef ANDROID
#include <X11/Xlib.h>
#include <xf86drm.h>
#include <drm.h>
#include <drm_sarea.h>
#endif
 
#include <va/va_backend.h>
#include <va/va_drmcommon.h>
 
#ifdef ANDROID
#define XID unsigned int
#define Bool int
#endif
 
enum {
/* Compatibility. Do not use for newly-written code. */
VA_NONE = VA_DRM_AUTH_NONE,
VA_DRI1 = VA_DRM_AUTH_DRI1,
VA_DRI2 = VA_DRM_AUTH_DRI2,
VA_DUMMY = VA_DRM_AUTH_CUSTOM
};
 
union dri_buffer
{
struct {
unsigned int attachment;
unsigned int name;
unsigned int pitch;
unsigned int cpp;
unsigned int flags;
} dri2;
};
 
struct dri_drawable
{
XID x_drawable;
int is_window;
int x;
int y;
unsigned int width;
unsigned int height;
struct dri_drawable *next;
};
 
#define DRAWABLE_HASH_SZ 32
struct dri_state
{
struct drm_state base;
#ifndef ANDROID
struct dri_drawable *drawable_hash[DRAWABLE_HASH_SZ];
 
struct dri_drawable *(*createDrawable)(VADriverContextP ctx, XID x_drawable);
void (*destroyDrawable)(VADriverContextP ctx, struct dri_drawable *dri_drawable);
void (*swapBuffer)(VADriverContextP ctx, struct dri_drawable *dri_drawable);
union dri_buffer *(*getRenderingBuffer)(VADriverContextP ctx, struct dri_drawable *dri_drawable);
void (*close)(VADriverContextP ctx);
#endif
};
 
Bool isDRI2Connected(VADriverContextP ctx, char **driver_name);
void free_drawable(VADriverContextP ctx, struct dri_drawable* dri_drawable);
void free_drawable_hashtable(VADriverContextP ctx);
struct dri_drawable *dri_get_drawable(VADriverContextP ctx, XID drawable);
void dri_swap_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable);
union dri_buffer *dri_get_rendering_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable);
 
#endif /* _VA_DRICOMMON_H_ */
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_fglrx.c
0,0 → 1,246
/*
* Copyright (C) 2010 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <X11/Xlib.h>
 
#define ADL_OK 0
#define ADL_MAX_PATH 256
 
/*
* Based on public AMD Display Library (ADL) SDK:
* <http://developer.amd.com/gpu/adlsdk/Pages/default.aspx>
*/
typedef struct AdapterInfo {
int iSize;
int iAdapterIndex;
char strUDID[ADL_MAX_PATH];
int iBusNumber;
int iDeviceNumber;
int iFunctionNumber;
int iVendorID;
char strAdapterName[ADL_MAX_PATH];
char strDisplayName[ADL_MAX_PATH];
int iPresent;
int iXScreenNum;
int iDrvIndex;
char strXScreenConfigName[ADL_MAX_PATH];
} AdapterInfo, *LPAdapterInfo;
 
typedef struct XScreenInfo {
int iXScreenNum;
char strXScreenConfigName[ADL_MAX_PATH];
} XScreenInfo, *LPXScreenInfo;
 
typedef void *(*ADL_MAIN_MALLOC_CALLBACK)(int);
typedef int (*ADL_MAIN_CONTROL_CREATE)(ADL_MAIN_MALLOC_CALLBACK, int);
typedef int (*ADL_MAIN_CONTROL_DESTROY)(void);
typedef int (*ADL_ADAPTER_NUMBEROFADAPTERS_GET)(int *);
typedef int (*ADL_ADAPTER_ADAPTERINFO_GET)(LPAdapterInfo, int);
typedef int (*ADL_ADAPTER_XSCREENINFO_GET)(LPXScreenInfo, int);
 
static void *ADL_Main_Memory_Alloc(int iSize)
{
return malloc(iSize);
}
 
static void ADL_Main_Memory_Free(void *arg)
{
void ** const lpBuffer = arg;
 
if (lpBuffer && *lpBuffer) {
free(*lpBuffer);
*lpBuffer = NULL;
}
}
 
static int get_display_name_length(const char *name)
{
const char *m;
 
if (!name)
return 0;
 
/* Strip out screen number */
m = strchr(name, ':');
if (m) {
m = strchr(m, '.');
if (m)
return m - name;
}
return strlen(name);
}
 
static int match_display_name(Display *x11_dpy, const char *display_name)
{
Display *test_dpy;
char *test_dpy_name, *x11_dpy_name;
int test_dpy_namelen, x11_dpy_namelen;
int m;
 
test_dpy = XOpenDisplay(display_name);
if (!test_dpy)
return 0;
 
test_dpy_name = XDisplayString(test_dpy);
test_dpy_namelen = get_display_name_length(test_dpy_name);
x11_dpy_name = XDisplayString(x11_dpy);
x11_dpy_namelen = get_display_name_length(x11_dpy_name);
 
m = (test_dpy_namelen == x11_dpy_namelen &&
(test_dpy_namelen == 0 ||
(test_dpy_namelen > 0 &&
strncmp(test_dpy_name, x11_dpy_name, test_dpy_namelen) == 0)));
 
XCloseDisplay(test_dpy);
return m;
}
 
Bool VA_FGLRXGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName )
{
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get;
ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get;
ADL_ADAPTER_XSCREENINFO_GET ADL_Adapter_XScreenInfo_Get;
 
LPAdapterInfo lpAdapterInfo = NULL;
LPXScreenInfo lpXScreenInfo = NULL;
void *libadl_handle = NULL;
Bool success = False;
int is_adl_initialized = 0;
int i, num_adapters, lpAdapterInfo_size, lpXScreenInfo_size;
 
if (ddxDriverMajorVersion)
*ddxDriverMajorVersion = 0;
if (ddxDriverMinorVersion)
*ddxDriverMinorVersion = 0;
if (ddxDriverPatchVersion)
*ddxDriverPatchVersion = 0;
if (clientDriverName)
*clientDriverName = NULL;
 
libadl_handle = dlopen("libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL);
if (!libadl_handle)
goto end;
 
dlerror();
ADL_Main_Control_Create = (ADL_MAIN_CONTROL_CREATE)
dlsym(libadl_handle,"ADL_Main_Control_Create");
if (dlerror())
goto end;
 
ADL_Main_Control_Destroy = (ADL_MAIN_CONTROL_DESTROY)
dlsym(libadl_handle,"ADL_Main_Control_Destroy");
if (dlerror())
goto end;
 
ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET)
dlsym(libadl_handle,"ADL_Adapter_NumberOfAdapters_Get");
if (dlerror())
goto end;
 
ADL_Adapter_AdapterInfo_Get = (ADL_ADAPTER_ADAPTERINFO_GET)
dlsym(libadl_handle,"ADL_Adapter_AdapterInfo_Get");
if (dlerror())
goto end;
 
ADL_Adapter_XScreenInfo_Get = (ADL_ADAPTER_XSCREENINFO_GET)
dlsym(libadl_handle,"ADL_Adapter_XScreenInfo_Get");
if (dlerror())
goto end;
 
if (ADL_Main_Control_Create(ADL_Main_Memory_Alloc, 1) != ADL_OK)
goto end;
is_adl_initialized = 1;
 
if (ADL_Adapter_NumberOfAdapters_Get(&num_adapters) != ADL_OK)
goto end;
if (num_adapters <= 0)
goto end;
 
lpAdapterInfo_size = num_adapters * sizeof(*lpAdapterInfo);
lpAdapterInfo = ADL_Main_Memory_Alloc(lpAdapterInfo_size);
if (!lpAdapterInfo)
goto end;
memset(lpAdapterInfo, 0, lpAdapterInfo_size);
 
for (i = 0; i < num_adapters; i++)
lpAdapterInfo[i].iSize = sizeof(lpAdapterInfo[i]);
 
lpXScreenInfo_size = num_adapters * sizeof(*lpXScreenInfo);
lpXScreenInfo = ADL_Main_Memory_Alloc(lpXScreenInfo_size);
if (!lpXScreenInfo)
goto end;
memset(lpXScreenInfo, 0, lpXScreenInfo_size);
 
if (ADL_Adapter_AdapterInfo_Get(lpAdapterInfo, lpAdapterInfo_size) != ADL_OK)
goto end;
 
if (ADL_Adapter_XScreenInfo_Get(lpXScreenInfo, lpXScreenInfo_size) != ADL_OK)
goto end;
 
for (i = 0; i < num_adapters; i++) {
LPXScreenInfo const lpCurrXScreenInfo = &lpXScreenInfo[i];
LPAdapterInfo const lpCurrAdapterInfo = &lpAdapterInfo[i];
if (!lpCurrAdapterInfo->iPresent)
continue;
#if 0
printf("Adapter %d:\n", i);
printf(" iAdapterIndex: %d\n", lpCurrAdapterInfo->iAdapterIndex);
printf(" strUDID: '%s'\n", lpCurrAdapterInfo->strUDID);
printf(" iBusNumber: %d\n", lpCurrAdapterInfo->iBusNumber);
printf(" iDeviceNumber: %d\n", lpCurrAdapterInfo->iDeviceNumber);
printf(" iFunctionNumber: %d\n", lpCurrAdapterInfo->iFunctionNumber);
printf(" iVendorID: 0x%04x\n", lpCurrAdapterInfo->iVendorID);
printf(" strAdapterName: '%s'\n", lpCurrAdapterInfo->strAdapterName);
printf(" strDisplayName: '%s'\n", lpCurrAdapterInfo->strDisplayName);
printf(" iPresent: %d\n", lpCurrAdapterInfo->iPresent);
printf(" iXScreenNum: %d\n", lpCurrXScreenInfo->iXScreenNum);
#endif
if (screen == lpCurrXScreenInfo->iXScreenNum &&
match_display_name(dpy, lpCurrAdapterInfo->strDisplayName)) {
if (clientDriverName)
*clientDriverName = strdup("fglrx");
success = True;
break;
}
}
 
end:
if (lpXScreenInfo)
ADL_Main_Memory_Free(&lpXScreenInfo);
if (lpAdapterInfo)
ADL_Main_Memory_Free(&lpAdapterInfo);
if (is_adl_initialized)
ADL_Main_Control_Destroy();
if (libadl_handle)
dlclose(libadl_handle);
return success;
}
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_fglrx.h
0,0 → 1,34
/*
* Copyright (C) 2010 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_FGLRX_H
#define VA_FGLRX_H
 
#include <X11/Xlib.h>
 
Bool VA_FGLRXGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName );
 
#endif /* VA_FGLRX_H */
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_nvctrl.c
0,0 → 1,399
/*
* Copyright (c) 2008 NVIDIA, Corporation
*
* 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, sublicense, 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS 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 <string.h>
 
#define NEED_REPLIES
#include <stdlib.h>
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#include "va_nvctrl.h"
 
#define NV_CONTROL_ERRORS 0
#define NV_CONTROL_EVENTS 5
#define NV_CONTROL_NAME "NV-CONTROL"
 
#define NV_CTRL_TARGET_TYPE_X_SCREEN 0
#define NV_CTRL_TARGET_TYPE_GPU 1
#define NV_CTRL_TARGET_TYPE_FRAMELOCK 2
#define NV_CTRL_TARGET_TYPE_VCSC 3 /* Visual Computing System */
 
#define NV_CTRL_STRING_NVIDIA_DRIVER_VERSION 3 /* R--G */
 
#define X_nvCtrlQueryExtension 0
#define X_nvCtrlIsNv 1
#define X_nvCtrlQueryStringAttribute 4
 
typedef struct {
CARD8 reqType;
CARD8 nvReqType;
CARD16 length B16;
} xnvCtrlQueryExtensionReq;
#define sz_xnvCtrlQueryExtensionReq 4
 
typedef struct {
BYTE type; /* X_Reply */
CARD8 padb1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 major B16;
CARD16 minor B16;
CARD32 padl4 B32;
CARD32 padl5 B32;
CARD32 padl6 B32;
CARD32 padl7 B32;
CARD32 padl8 B32;
} xnvCtrlQueryExtensionReply;
#define sz_xnvCtrlQueryExtensionReply 32
 
typedef struct {
CARD8 reqType;
CARD8 nvReqType;
CARD16 length B16;
CARD32 screen B32;
} xnvCtrlIsNvReq;
#define sz_xnvCtrlIsNvReq 8
 
typedef struct {
BYTE type; /* X_Reply */
CARD8 padb1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 isnv B32;
CARD32 padl4 B32;
CARD32 padl5 B32;
CARD32 padl6 B32;
CARD32 padl7 B32;
CARD32 padl8 B32;
} xnvCtrlIsNvReply;
#define sz_xnvCtrlIsNvReply 32
 
typedef struct {
CARD8 reqType;
CARD8 nvReqType;
CARD16 length B16;
CARD16 target_id B16; /* X screen number or GPU number */
CARD16 target_type B16; /* X screen or GPU */
CARD32 display_mask B32;
CARD32 attribute B32;
} xnvCtrlQueryStringAttributeReq;
#define sz_xnvCtrlQueryStringAttributeReq 16
 
typedef struct {
BYTE type;
BYTE pad0;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 flags B32;
CARD32 n B32; /* Length of string */
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xnvCtrlQueryStringAttributeReply;
#define sz_xnvCtrlQueryStringAttributeReply 32
 
#define NVCTRL_EXT_NEED_CHECK (XPointer)(~0)
#define NVCTRL_EXT_NEED_NOTHING (XPointer)(0)
#define NVCTRL_EXT_NEED_TARGET_SWAP (XPointer)(1)
 
static XExtensionInfo _nvctrl_ext_info_data;
static XExtensionInfo *nvctrl_ext_info = &_nvctrl_ext_info_data;
static /* const */ char *nvctrl_extension_name = NV_CONTROL_NAME;
 
#define XNVCTRLCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, nvctrl_extension_name, val)
#define XNVCTRLSimpleCheckExtension(dpy,i) \
XextSimpleCheckExtension (dpy, i, nvctrl_extension_name)
 
static int close_display();
static /* const */ XExtensionHooks nvctrl_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
 
static XEXT_GENERATE_FIND_DISPLAY (find_display, nvctrl_ext_info,
nvctrl_extension_name,
&nvctrl_extension_hooks,
NV_CONTROL_EVENTS, NVCTRL_EXT_NEED_CHECK)
 
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, nvctrl_ext_info)
 
static Bool XNVCTRLQueryVersion (Display *dpy, int *major, int *minor);
 
/*
* NV-CONTROL versions 1.8 and 1.9 pack the target_type and target_id
* fields in reversed order. In order to talk to one of these servers,
* we need to swap these fields.
*/
static void XNVCTRLCheckTargetData(Display *dpy, XExtDisplayInfo *info,
int *target_type, int *target_id)
{
/* Find out what the server's NV-CONTROL version is and
* setup for swapping if we need to.
*/
if (info->data == NVCTRL_EXT_NEED_CHECK) {
int major, minor;
 
if (XNVCTRLQueryVersion(dpy, &major, &minor)) {
if (major == 1 &&
(minor == 8 || minor == 9)) {
info->data = NVCTRL_EXT_NEED_TARGET_SWAP;
} else {
info->data = NVCTRL_EXT_NEED_NOTHING;
}
} else {
info->data = NVCTRL_EXT_NEED_NOTHING;
}
}
 
/* We need to swap the target_type and target_id */
if (info->data == NVCTRL_EXT_NEED_TARGET_SWAP) {
int tmp;
tmp = *target_type;
*target_type = *target_id;
*target_id = tmp;
}
}
 
 
static Bool XNVCTRLQueryExtension (
Display *dpy,
int *event_basep,
int *error_basep
){
XExtDisplayInfo *info = find_display (dpy);
 
if (XextHasExtension(info)) {
if (event_basep) *event_basep = info->codes->first_event;
if (error_basep) *error_basep = info->codes->first_error;
return True;
} else {
return False;
}
}
 
 
static Bool XNVCTRLQueryVersion (
Display *dpy,
int *major,
int *minor
){
XExtDisplayInfo *info = find_display (dpy);
xnvCtrlQueryExtensionReply rep;
xnvCtrlQueryExtensionReq *req;
 
if(!XextHasExtension(info))
return False;
 
XNVCTRLCheckExtension (dpy, info, False);
 
LockDisplay (dpy);
GetReq (nvCtrlQueryExtension, req);
req->reqType = info->codes->major_opcode;
req->nvReqType = X_nvCtrlQueryExtension;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
if (major) *major = rep.major;
if (minor) *minor = rep.minor;
UnlockDisplay (dpy);
SyncHandle ();
return True;
}
 
 
static Bool XNVCTRLIsNvScreen (
Display *dpy,
int screen
){
XExtDisplayInfo *info = find_display (dpy);
xnvCtrlIsNvReply rep;
xnvCtrlIsNvReq *req;
Bool isnv;
 
if(!XextHasExtension(info))
return False;
 
XNVCTRLCheckExtension (dpy, info, False);
 
LockDisplay (dpy);
GetReq (nvCtrlIsNv, req);
req->reqType = info->codes->major_opcode;
req->nvReqType = X_nvCtrlIsNv;
req->screen = screen;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
isnv = rep.isnv;
UnlockDisplay (dpy);
SyncHandle ();
return isnv;
}
 
 
static Bool XNVCTRLQueryTargetStringAttribute (
Display *dpy,
int target_type,
int target_id,
unsigned int display_mask,
unsigned int attribute,
char **ptr
){
XExtDisplayInfo *info = find_display (dpy);
xnvCtrlQueryStringAttributeReply rep;
xnvCtrlQueryStringAttributeReq *req;
Bool exists;
int length, numbytes, slop;
 
if (!ptr) return False;
 
if(!XextHasExtension(info))
return False;
 
XNVCTRLCheckExtension (dpy, info, False);
XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);
 
LockDisplay (dpy);
GetReq (nvCtrlQueryStringAttribute, req);
req->reqType = info->codes->major_opcode;
req->nvReqType = X_nvCtrlQueryStringAttribute;
req->target_type = target_type;
req->target_id = target_id;
req->display_mask = display_mask;
req->attribute = attribute;
if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
length = rep.length;
numbytes = rep.n;
slop = numbytes & 3;
*ptr = (char *) Xmalloc(numbytes);
if (! *ptr) {
_XEatData(dpy, length);
UnlockDisplay (dpy);
SyncHandle ();
return False;
} else {
_XRead(dpy, (char *) *ptr, numbytes);
if (slop) _XEatData(dpy, 4-slop);
}
exists = rep.flags;
UnlockDisplay (dpy);
SyncHandle ();
return exists;
}
 
static Bool XNVCTRLQueryStringAttribute (
Display *dpy,
int screen,
unsigned int display_mask,
unsigned int attribute,
char **ptr
){
return XNVCTRLQueryTargetStringAttribute(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN,
screen, display_mask,
attribute, ptr);
}
 
 
Bool VA_NVCTRLQueryDirectRenderingCapable( Display *dpy, int screen,
Bool *isCapable )
{
int event_base;
int error_base;
 
if (isCapable)
*isCapable = False;
 
if (!XNVCTRLQueryExtension(dpy, &event_base, &error_base))
return False;
 
if (isCapable && XNVCTRLIsNvScreen(dpy, screen))
*isCapable = True;
 
return True;
}
 
Bool VA_NVCTRLGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName )
{
if (ddxDriverMajorVersion)
*ddxDriverMajorVersion = 0;
if (ddxDriverMinorVersion)
*ddxDriverMinorVersion = 0;
if (ddxDriverPatchVersion)
*ddxDriverPatchVersion = 0;
if (clientDriverName)
*clientDriverName = NULL;
 
char *nvidia_driver_version = NULL;
if (!XNVCTRLQueryStringAttribute(dpy, screen, 0, NV_CTRL_STRING_NVIDIA_DRIVER_VERSION, &nvidia_driver_version))
return False;
 
char *end, *str = nvidia_driver_version;
unsigned long v = strtoul(str, &end, 10);
if (end && end != str) {
if (ddxDriverMajorVersion)
*ddxDriverMajorVersion = v;
if (*(str = end) == '.') {
v = strtoul(str + 1, &end, 10);
if (end && end != str && (*end == '.' || *end == '\0')) {
if (ddxDriverMinorVersion)
*ddxDriverMinorVersion = v;
if (*(str = end) == '.') {
v = strtoul(str + 1, &end, 10);
if (end && end != str && *end == '\0') {
if (ddxDriverPatchVersion)
*ddxDriverPatchVersion = v;
}
}
}
}
}
Xfree(nvidia_driver_version);
 
if (clientDriverName)
*clientDriverName = strdup("nvidia");
 
return True;
}
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_nvctrl.h
0,0 → 1,36
/*
* Copyright (c) 2008 NVIDIA, Corporation
*
* 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, sublicense, 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS 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_NVCTRLLIB_H
#define VA_NVCTRLLIB_H
 
#include <X11/Xlib.h>
 
Bool VA_NVCTRLQueryDirectRenderingCapable( Display *dpy, int screen,
Bool *isCapable );
 
Bool VA_NVCTRLGetClientDriverName( Display *dpy, int screen,
int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion, char **clientDriverName );
 
#endif /* VA_NVCTRLLIB_H */
/contrib/sdk/sources/vaapi/libva-1.4.1/va/x11/va_x11.c
0,0 → 1,250
/*
* 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.
*/
 
#define _GNU_SOURCE 1
#include "sysdeps.h"
#include "va.h"
#include "va_backend.h"
#include "va_trace.h"
#include "va_fool.h"
#include "va_x11.h"
#include "va_dri2.h"
#include "va_dricommon.h"
#include "va_nvctrl.h"
#include "va_fglrx.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
 
static int va_DisplayContextIsValid (
VADisplayContextP pDisplayContext
)
{
return (pDisplayContext != NULL &&
pDisplayContext->pDriverContext != NULL);
}
 
static void va_DisplayContextDestroy (
VADisplayContextP pDisplayContext
)
{
VADriverContextP ctx;
struct dri_state *dri_state;
 
if (pDisplayContext == NULL)
return;
 
ctx = pDisplayContext->pDriverContext;
dri_state = ctx->drm_state;
 
if (dri_state && dri_state->close)
dri_state->close(ctx);
 
free(pDisplayContext->pDriverContext->drm_state);
free(pDisplayContext->pDriverContext);
free(pDisplayContext);
}
 
 
static VAStatus va_DRI2GetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
 
if (!isDRI2Connected(ctx, driver_name))
return VA_STATUS_ERROR_UNKNOWN;
 
return VA_STATUS_SUCCESS;
}
 
static VAStatus va_NVCTRL_GetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
int direct_capable, driver_major, driver_minor, driver_patch;
Bool result;
 
result = VA_NVCTRLQueryDirectRenderingCapable(ctx->native_dpy, ctx->x11_screen,
&direct_capable);
if (!result || !direct_capable)
return VA_STATUS_ERROR_UNKNOWN;
 
result = VA_NVCTRLGetClientDriverName(ctx->native_dpy, ctx->x11_screen,
&driver_major, &driver_minor,
&driver_patch, driver_name);
if (!result)
return VA_STATUS_ERROR_UNKNOWN;
 
return VA_STATUS_SUCCESS;
}
 
static VAStatus va_FGLRX_GetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
int driver_major, driver_minor, driver_patch;
Bool result;
 
result = VA_FGLRXGetClientDriverName(ctx->native_dpy, ctx->x11_screen,
&driver_major, &driver_minor,
&driver_patch, driver_name);
if (!result)
return VA_STATUS_ERROR_UNKNOWN;
 
return VA_STATUS_SUCCESS;
}
 
static VAStatus va_DisplayContextGetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
{
VAStatus vaStatus;
 
if (driver_name)
*driver_name = NULL;
else
return VA_STATUS_ERROR_UNKNOWN;
vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name);
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name);
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_FGLRX_GetDriverName(pDisplayContext, driver_name);
return vaStatus;
}
 
 
VADisplay vaGetDisplay (
Display *native_dpy /* implementation specific */
)
{
VADisplay dpy = NULL;
VADisplayContextP pDisplayContext;
 
if (!native_dpy)
return NULL;
 
if (!dpy)
{
/* create new entry */
VADriverContextP pDriverContext;
struct dri_state *dri_state;
pDisplayContext = calloc(1, sizeof(*pDisplayContext));
pDriverContext = calloc(1, sizeof(*pDriverContext));
dri_state = calloc(1, sizeof(*dri_state));
if (pDisplayContext && pDriverContext && dri_state)
{
pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
 
pDriverContext->native_dpy = (void *)native_dpy;
pDriverContext->display_type = VA_DISPLAY_X11;
pDisplayContext->pDriverContext = pDriverContext;
pDisplayContext->vaIsValid = va_DisplayContextIsValid;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
pDisplayContext->opaque = NULL;
pDriverContext->drm_state = dri_state;
dpy = (VADisplay)pDisplayContext;
}
else
{
if (pDisplayContext)
free(pDisplayContext);
if (pDriverContext)
free(pDriverContext);
if (dri_state)
free(dri_state);
}
}
return dpy;
}
 
#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
#define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
 
void va_TracePutSurface (
VADisplay dpy,
VASurfaceID surface,
void *draw, /* the target Drawable */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
);
 
 
VAStatus vaPutSurface (
VADisplay dpy,
VASurfaceID surface,
Drawable draw, /* X Drawable */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
)
{
VADriverContextP ctx;
 
if (fool_postp)
return VA_STATUS_SUCCESS;
 
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
VA_TRACE_LOG(va_TracePutSurface, dpy, surface, (void *)draw, srcx, srcy, srcw, srch,
destx, desty, destw, desth,
cliprects, number_cliprects, flags );
return ctx->vtable->vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
destx, desty, destw, desth,
cliprects, number_cliprects, flags );
}