Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5361 → Rev 5362

/contrib/sdk/sources/vaapi/libva-1.4.1/test/putsurface/Makefile.am
0,0 → 1,59
# 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.
 
bin_PROGRAMS = putsurface
 
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
$(NULL)
 
TEST_CFLAGS = \
-DIN_LIBVA \
$(NULL)
 
TEST_LIBS = \
$(top_builddir)/va/libva.la \
-lpthread \
$(NULL)
 
putsurface_SOURCES = putsurface_x11.c
putsurface_CFLAGS = $(X11_CFLAGS) $(TEST_CFLAGS)
putsurface_LDADD = $(X11_LIBS) $(TEST_LIBS) \
$(top_builddir)/va/libva-x11.la \
$(NULL)
 
if USE_WAYLAND
bin_PROGRAMS += putsurface_wayland
putsurface_wayland_SOURCES = putsurface_wayland.c
putsurface_wayland_CFLAGS = $(WAYLAND_CFLAGS) $(TEST_CFLAGS)
putsurface_wayland_LDADD = $(WAYLAND_LIBS) $(TEST_LIBS) \
$(top_builddir)/va/libva-wayland.la \
$(NULL)
endif
 
EXTRA_DIST = putsurface_common.c
 
valgrind: $(bin_PROGRAMS)
for a in $(bin_PROGRAMS); do \
valgrind --leak-check=full --show-reachable=yes .libs/$$a; \
done
/contrib/sdk/sources/vaapi/libva-1.4.1/test/putsurface/Makefile.in
0,0 → 1,756
# 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@
bin_PROGRAMS = putsurface$(EXEEXT) $(am__EXEEXT_1)
@USE_WAYLAND_TRUE@am__append_1 = putsurface_wayland
subdir = test/putsurface
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
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 =
@USE_WAYLAND_TRUE@am__EXEEXT_1 = putsurface_wayland$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_putsurface_OBJECTS = putsurface-putsurface_x11.$(OBJEXT)
putsurface_OBJECTS = $(am_putsurface_OBJECTS)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(top_builddir)/va/libva.la
putsurface_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
$(top_builddir)/va/libva-x11.la
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 =
putsurface_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(putsurface_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am__putsurface_wayland_SOURCES_DIST = putsurface_wayland.c
@USE_WAYLAND_TRUE@am_putsurface_wayland_OBJECTS = putsurface_wayland-putsurface_wayland.$(OBJEXT)
putsurface_wayland_OBJECTS = $(am_putsurface_wayland_OBJECTS)
@USE_WAYLAND_TRUE@putsurface_wayland_DEPENDENCIES = \
@USE_WAYLAND_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
@USE_WAYLAND_TRUE@ $(top_builddir)/va/libva-wayland.la
putsurface_wayland_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(putsurface_wayland_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
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 = $(putsurface_SOURCES) $(putsurface_wayland_SOURCES)
DIST_SOURCES = $(putsurface_SOURCES) \
$(am__putsurface_wayland_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
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 = \
-I$(top_srcdir) \
-I$(top_builddir) \
$(NULL)
 
TEST_CFLAGS = \
-DIN_LIBVA \
$(NULL)
 
TEST_LIBS = \
$(top_builddir)/va/libva.la \
-lpthread \
$(NULL)
 
putsurface_SOURCES = putsurface_x11.c
putsurface_CFLAGS = $(X11_CFLAGS) $(TEST_CFLAGS)
putsurface_LDADD = $(X11_LIBS) $(TEST_LIBS) \
$(top_builddir)/va/libva-x11.la \
$(NULL)
 
@USE_WAYLAND_TRUE@putsurface_wayland_SOURCES = putsurface_wayland.c
@USE_WAYLAND_TRUE@putsurface_wayland_CFLAGS = $(WAYLAND_CFLAGS) $(TEST_CFLAGS)
@USE_WAYLAND_TRUE@putsurface_wayland_LDADD = $(WAYLAND_LIBS) $(TEST_LIBS) \
@USE_WAYLAND_TRUE@ $(top_builddir)/va/libva-wayland.la \
@USE_WAYLAND_TRUE@ $(NULL)
 
EXTRA_DIST = putsurface_common.c
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 test/putsurface/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu test/putsurface/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):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p \
|| test -f $$p1 \
; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' \
-e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
 
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' \
`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
 
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
 
putsurface$(EXEEXT): $(putsurface_OBJECTS) $(putsurface_DEPENDENCIES) $(EXTRA_putsurface_DEPENDENCIES)
@rm -f putsurface$(EXEEXT)
$(AM_V_CCLD)$(putsurface_LINK) $(putsurface_OBJECTS) $(putsurface_LDADD) $(LIBS)
 
putsurface_wayland$(EXEEXT): $(putsurface_wayland_OBJECTS) $(putsurface_wayland_DEPENDENCIES) $(EXTRA_putsurface_wayland_DEPENDENCIES)
@rm -f putsurface_wayland$(EXEEXT)
$(AM_V_CCLD)$(putsurface_wayland_LINK) $(putsurface_wayland_OBJECTS) $(putsurface_wayland_LDADD) $(LIBS)
 
mostlyclean-compile:
-rm -f *.$(OBJEXT)
 
distclean-compile:
-rm -f *.tab.c
 
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/putsurface-putsurface_x11.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/putsurface_wayland-putsurface_wayland.Po@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 $@ $<
 
putsurface-putsurface_x11.o: putsurface_x11.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_CFLAGS) $(CFLAGS) -MT putsurface-putsurface_x11.o -MD -MP -MF $(DEPDIR)/putsurface-putsurface_x11.Tpo -c -o putsurface-putsurface_x11.o `test -f 'putsurface_x11.c' || echo '$(srcdir)/'`putsurface_x11.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/putsurface-putsurface_x11.Tpo $(DEPDIR)/putsurface-putsurface_x11.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='putsurface_x11.c' object='putsurface-putsurface_x11.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_CFLAGS) $(CFLAGS) -c -o putsurface-putsurface_x11.o `test -f 'putsurface_x11.c' || echo '$(srcdir)/'`putsurface_x11.c
 
putsurface-putsurface_x11.obj: putsurface_x11.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_CFLAGS) $(CFLAGS) -MT putsurface-putsurface_x11.obj -MD -MP -MF $(DEPDIR)/putsurface-putsurface_x11.Tpo -c -o putsurface-putsurface_x11.obj `if test -f 'putsurface_x11.c'; then $(CYGPATH_W) 'putsurface_x11.c'; else $(CYGPATH_W) '$(srcdir)/putsurface_x11.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/putsurface-putsurface_x11.Tpo $(DEPDIR)/putsurface-putsurface_x11.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='putsurface_x11.c' object='putsurface-putsurface_x11.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_CFLAGS) $(CFLAGS) -c -o putsurface-putsurface_x11.obj `if test -f 'putsurface_x11.c'; then $(CYGPATH_W) 'putsurface_x11.c'; else $(CYGPATH_W) '$(srcdir)/putsurface_x11.c'; fi`
 
putsurface_wayland-putsurface_wayland.o: putsurface_wayland.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_wayland_CFLAGS) $(CFLAGS) -MT putsurface_wayland-putsurface_wayland.o -MD -MP -MF $(DEPDIR)/putsurface_wayland-putsurface_wayland.Tpo -c -o putsurface_wayland-putsurface_wayland.o `test -f 'putsurface_wayland.c' || echo '$(srcdir)/'`putsurface_wayland.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/putsurface_wayland-putsurface_wayland.Tpo $(DEPDIR)/putsurface_wayland-putsurface_wayland.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='putsurface_wayland.c' object='putsurface_wayland-putsurface_wayland.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_wayland_CFLAGS) $(CFLAGS) -c -o putsurface_wayland-putsurface_wayland.o `test -f 'putsurface_wayland.c' || echo '$(srcdir)/'`putsurface_wayland.c
 
putsurface_wayland-putsurface_wayland.obj: putsurface_wayland.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_wayland_CFLAGS) $(CFLAGS) -MT putsurface_wayland-putsurface_wayland.obj -MD -MP -MF $(DEPDIR)/putsurface_wayland-putsurface_wayland.Tpo -c -o putsurface_wayland-putsurface_wayland.obj `if test -f 'putsurface_wayland.c'; then $(CYGPATH_W) 'putsurface_wayland.c'; else $(CYGPATH_W) '$(srcdir)/putsurface_wayland.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/putsurface_wayland-putsurface_wayland.Tpo $(DEPDIR)/putsurface_wayland-putsurface_wayland.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='putsurface_wayland.c' object='putsurface_wayland-putsurface_wayland.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(putsurface_wayland_CFLAGS) $(CFLAGS) -c -o putsurface_wayland-putsurface_wayland.obj `if test -f 'putsurface_wayland.c'; then $(CYGPATH_W) 'putsurface_wayland.c'; else $(CYGPATH_W) '$(srcdir)/putsurface_wayland.c'; fi`
 
mostlyclean-libtool:
-rm -f *.lo
 
clean-libtool:
-rm -rf .libs _libs
 
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 $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; 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-binPROGRAMS clean-generic clean-libtool 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-dvi: install-dvi-am
 
install-dvi-am:
 
install-exec-am: install-binPROGRAMS
 
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-binPROGRAMS
 
.MAKE: install-am install-strip
 
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool 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-binPROGRAMS \
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-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-binPROGRAMS
 
 
valgrind: $(bin_PROGRAMS)
for a in $(bin_PROGRAMS); do \
valgrind --leak-check=full --show-reachable=yes .libs/$$a; \
done
 
# 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/test/putsurface/putsurface_common.c
0,0 → 1,688
/*
* Copyright (c) 2008-2009 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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <getopt.h>
 
#include <sys/time.h>
 
#include <unistd.h>
 
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include <pthread.h>
 
/*currently, if XCheckWindowEvent was called in more than one thread, it would cause
* XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
* after 87 requests (83 known processed) with 0 events remaining.
*
* X Error of failed request: BadGC (invalid GC parameter)
* Major opcode of failed request: 60 (X_FreeGC)
* Resource id in failed request: 0x600034
* Serial number of failed request: 398
* Current serial number in output stream: 399
* The root cause is unknown. */
 
#define CHECK_VASTATUS(va_status,func) \
if (va_status != VA_STATUS_SUCCESS) { \
fprintf(stderr,"%s:%s (%d) failed,exit\n", __func__, func, __LINE__); \
exit(1); \
}
#include "../loadsurface.h"
 
#define SURFACE_NUM 16
 
static void *win_display;
static VADisplay va_dpy;
static VAImageFormat *va_image_formats;
static int va_num_image_formats = -1;
static VAConfigID vpp_config_id = VA_INVALID_ID;
static VASurfaceAttrib *va_surface_attribs;
static int va_num_surface_attribs = -1;
static VASurfaceID surface_id[SURFACE_NUM];
static pthread_mutex_t surface_mutex[SURFACE_NUM];
 
static void *drawable_thread0, *drawable_thread1;
static int surface_width = 352, surface_height = 288;
static int win_x = 0, win_y = 0;
static int win_width = 352, win_height = 288;
static int frame_rate = 0;
static unsigned long long frame_num_total = ~0;
static int check_event = 1;
static int put_pixmap = 0;
static int test_clip = 0;
static int display_field = VA_FRAME_PICTURE;
static pthread_mutex_t gmutex;
static int box_width = 32;
static int multi_thread = 0;
static int verbose = 0;
static int test_color_conversion = 0;
static int csc_src_fourcc = 0, csc_dst_fourcc = 0;
static VAImage csc_dst_fourcc_image;
static VASurfaceID csc_render_surface;
 
 
typedef struct {
char* fmt_str;
unsigned int fourcc;
} fourcc_map;
fourcc_map va_fourcc_map[] = {
{"YUYV", VA_FOURCC_YUY2},
{"YUY2", VA_FOURCC_YUY2},
{"NV12", VA_FOURCC_NV12},
{"YV12", VA_FOURCC_YV12},
{"BGRA", VA_FOURCC_BGRA},
{"RGBA", VA_FOURCC_RGBA},
{"BGRX", VA_FOURCC_BGRX},
{"RGBX", VA_FOURCC_RGBX},
};
unsigned int map_str_to_vafourcc (char * str)
{
int i;
for (i=0; i< sizeof(va_fourcc_map)/sizeof(fourcc_map); i++) {
if (!strcmp(va_fourcc_map[i].fmt_str, str)) {
return va_fourcc_map[i].fourcc;
}
}
 
return 0;
 
}
char* map_vafourcc_to_str (unsigned int format)
{
static char unknown_format[] = "unknown-format";
int i;
for (i=0; i< sizeof(va_fourcc_map)/sizeof(fourcc_map); i++) {
if (va_fourcc_map[i].fourcc == format) {
return va_fourcc_map[i].fmt_str;
}
}
 
return unknown_format;
 
}
 
static int
va_value_equals(const VAGenericValue *v1, const VAGenericValue *v2)
{
if (v1->type != v2->type)
return 0;
 
switch (v1->type) {
case VAGenericValueTypeInteger:
return v1->value.i == v2->value.i;
case VAGenericValueTypeFloat:
return v1->value.f == v2->value.f;
case VAGenericValueTypePointer:
return v1->value.p == v2->value.p;
case VAGenericValueTypeFunc:
return v1->value.fn == v2->value.fn;
}
return 0;
}
 
static int
ensure_image_formats(void)
{
VAStatus va_status;
VAImageFormat *image_formats;
int num_image_formats;
 
if (va_num_image_formats >= 0)
return va_num_image_formats;
 
num_image_formats = vaMaxNumImageFormats(va_dpy);
if (num_image_formats == 0)
return 0;
 
image_formats = malloc(num_image_formats * sizeof(*image_formats));
if (!image_formats)
return 0;
 
va_status = vaQueryImageFormats(va_dpy, image_formats, &num_image_formats);
CHECK_VASTATUS(va_status, "vaQuerySurfaceAttributes()");
 
va_image_formats = image_formats;
va_num_image_formats = num_image_formats;
return num_image_formats;
}
 
static const VAImageFormat *
lookup_image_format(uint32_t fourcc)
{
int i;
 
if (!ensure_image_formats())
return NULL;
 
for (i = 0; i < va_num_image_formats; i++) {
const VAImageFormat * const image_format = &va_image_formats[i];
if (image_format->fourcc == fourcc)
return image_format;
}
return NULL;
}
 
static int
ensure_surface_attribs(void)
{
VAStatus va_status;
VASurfaceAttrib *surface_attribs;
unsigned int num_image_formats, num_surface_attribs;
 
if (va_num_surface_attribs >= 0)
return va_num_surface_attribs;
 
num_image_formats = vaMaxNumImageFormats(va_dpy);
if (num_image_formats == 0)
return 0;
 
va_status = vaCreateConfig(va_dpy, VAProfileNone, VAEntrypointVideoProc,
NULL, 0, &vpp_config_id);
CHECK_VASTATUS(va_status, "vaCreateConfig()");
 
/* Guess the number of surface attributes, thus including any
pixel-format supported by the VA driver */
num_surface_attribs = VASurfaceAttribCount + num_image_formats;
surface_attribs = malloc(num_surface_attribs * sizeof(*surface_attribs));
if (!surface_attribs)
return 0;
 
va_status = vaQuerySurfaceAttributes(va_dpy, vpp_config_id,
surface_attribs, &num_surface_attribs);
if (va_status == VA_STATUS_SUCCESS)
va_surface_attribs = surface_attribs;
else if (va_status == VA_STATUS_ERROR_MAX_NUM_EXCEEDED) {
va_surface_attribs = realloc(surface_attribs,
num_surface_attribs * sizeof(*va_surface_attribs));
if (!va_surface_attribs) {
free(surface_attribs);
return 0;
}
va_status = vaQuerySurfaceAttributes(va_dpy, vpp_config_id,
va_surface_attribs, &num_surface_attribs);
}
CHECK_VASTATUS(va_status, "vaQuerySurfaceAttributes()");
va_num_surface_attribs = num_surface_attribs;
return num_surface_attribs;
}
 
static const VASurfaceAttrib *
lookup_surface_attrib(VASurfaceAttribType type, const VAGenericValue *value)
{
int i;
 
if (!ensure_surface_attribs())
return NULL;
 
for (i = 0; i < va_num_surface_attribs; i++) {
const VASurfaceAttrib * const surface_attrib = &va_surface_attribs[i];
if (surface_attrib->type != type)
continue;
if (!(surface_attrib->flags & VA_SURFACE_ATTRIB_SETTABLE))
continue;
if (va_value_equals(&surface_attrib->value, value))
return surface_attrib;
}
return NULL;
}
 
int csc_preparation ()
{
VAStatus va_status;
// 1. make sure dst fourcc is supported for vaImage
if (!lookup_image_format(csc_dst_fourcc)) {
test_color_conversion = 0;
printf("VA driver doesn't support %s image, skip additional color conversion\n", map_vafourcc_to_str(csc_dst_fourcc));
goto cleanup;
}
 
// 2. make sure src_fourcc is supported for vaSurface
VASurfaceAttrib surface_attribs[1], * const s_attrib = &surface_attribs[0];
s_attrib->type = VASurfaceAttribPixelFormat;
s_attrib->flags = VA_SURFACE_ATTRIB_SETTABLE;
s_attrib->value.type = VAGenericValueTypeInteger;
s_attrib->value.value.i = csc_src_fourcc;
 
if (!lookup_surface_attrib(VASurfaceAttribPixelFormat, &s_attrib->value)) {
printf("VA driver doesn't support %s surface, skip additional color conversion\n", map_vafourcc_to_str(csc_src_fourcc));
test_color_conversion = 0;
goto cleanup;
}
 
// 3 create all objs required by csc
// 3.1 vaSurface with src fourcc
va_status = vaCreateSurfaces(
va_dpy,
VA_RT_FORMAT_YUV420, surface_width, surface_height,
&surface_id[0], SURFACE_NUM,
surface_attribs, 1
);
CHECK_VASTATUS(va_status,"vaCreateSurfaces");
 
// 3.2 vaImage with dst fourcc
VAImageFormat image_format;
image_format.fourcc = csc_dst_fourcc;
image_format.byte_order = VA_LSB_FIRST;
image_format.bits_per_pixel = 16;
va_status = vaCreateImage(va_dpy, &image_format,
surface_width, surface_height,
&csc_dst_fourcc_image);
CHECK_VASTATUS(va_status,"vaCreateImage");
 
// 3.3 create a temp VASurface for final rendering(vaPutSurface)
s_attrib->value.value.i = VA_FOURCC_NV12;
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420,
surface_width, surface_height,
&csc_render_surface, 1,
surface_attribs, 1);
CHECK_VASTATUS(va_status,"vaCreateSurfaces");
 
 
cleanup:
return test_color_conversion;
}
 
static VASurfaceID get_next_free_surface(int *index)
{
VASurfaceStatus surface_status;
int i;
 
assert(index);
 
if (multi_thread == 0) {
i = *index;
i++;
if (i == SURFACE_NUM)
i = 0;
*index = i;
 
return surface_id[i];
}
for (i=0; i<SURFACE_NUM; i++) {
surface_status = (VASurfaceStatus)0;
vaQuerySurfaceStatus(va_dpy, surface_id[i], &surface_status);
if (surface_status == VASurfaceReady)
{
if (0 == pthread_mutex_trylock(&surface_mutex[i]))
{
*index = i;
break;
}
}
}
 
if (i==SURFACE_NUM)
return VA_INVALID_SURFACE;
else
return surface_id[i];
}
 
static int upload_source_YUV_once_for_all()
{
VAImage surface_image;
void *surface_p=NULL, *U_start,*V_start;
VAStatus va_status;
int box_width_loc=8;
int row_shift_loc=0;
int i;
for (i=0; i<SURFACE_NUM; i++) {
printf("\rLoading data into surface %d.....", i);
upload_surface(va_dpy, surface_id[i], box_width_loc, row_shift_loc, 0);
row_shift_loc++;
if (row_shift_loc==(2*box_width_loc)) row_shift_loc= 0;
}
printf("\n");
 
return 0;
}
 
/*
* Helper function for profiling purposes
*/
static unsigned long get_tick_count(void)
{
struct timeval tv;
if (gettimeofday(&tv, NULL))
return 0;
return tv.tv_usec/1000+tv.tv_sec*1000;
}
 
static void update_clipbox(VARectangle *cliprects, int width, int height)
{
if (test_clip == 0)
return;
srand((unsigned)time(NULL));
cliprects[0].x = (rand() % width);
cliprects[0].y = (rand() % height);
cliprects[0].width = (rand() % (width - cliprects[0].x));
cliprects[0].height = (rand() % (height - cliprects[0].y));
 
cliprects[1].x = (rand() % width);
cliprects[1].y = (rand() % height);
cliprects[1].width = (rand() % (width - cliprects[1].x));
cliprects[1].height = (rand() % (height - cliprects[1].y));
printf("\nTest clip (%d,%d, %d x %d) and (%d,%d, %d x %d) \n",
cliprects[0].x, cliprects[0].y, cliprects[0].width, cliprects[0].height,
cliprects[1].x, cliprects[1].y, cliprects[1].width, cliprects[1].height);
}
 
static void* putsurface_thread(void *data)
{
int width=win_width, height=win_height;
void *drawable = data;
int quit = 0;
VAStatus vaStatus;
int row_shift = 0;
int index = 0;
unsigned int frame_num=0, start_time, putsurface_time;
VARectangle cliprects[2]; /* client supplied clip list */
int continue_display = 0;
if (drawable == drawable_thread0)
printf("Enter into thread0\n\n");
if (drawable == drawable_thread1)
printf("Enter into thread1\n\n");
putsurface_time = 0;
while (!quit) {
VASurfaceID surface_id = VA_INVALID_SURFACE;
while (surface_id == VA_INVALID_SURFACE)
surface_id = get_next_free_surface(&index);
 
if (verbose) printf("Thread: %p Display surface 0x%x,\n", drawable, surface_id);
 
if (multi_thread)
upload_surface(va_dpy, surface_id, box_width, row_shift, display_field);
 
if (check_event)
pthread_mutex_lock(&gmutex);
start_time = get_tick_count();
if ((continue_display == 0) && getenv("FRAME_STOP")) {
char c;
printf("Press any key to display frame %d...(c/C to continue)\n", frame_num);
c = getchar();
if (c == 'c' || c == 'C')
continue_display = 1;
}
if (test_color_conversion) {
static int _put_surface_count = 0;
if (_put_surface_count++ %50 == 0) {
printf("do additional colorcoversion from %s to %s\n", map_vafourcc_to_str(csc_src_fourcc), map_vafourcc_to_str(csc_dst_fourcc));
}
// get image from surface, csc_src_fourcc to csc_dst_fourcc conversion happens
vaStatus = vaGetImage(va_dpy, surface_id, 0, 0,
surface_width, surface_height, csc_dst_fourcc_image.image_id);
CHECK_VASTATUS(vaStatus,"vaGetImage");
// render csc_dst_fourcc image to temp surface
vaStatus = vaPutImage(va_dpy, csc_render_surface, csc_dst_fourcc_image.image_id,
0, 0, surface_width, surface_height,
0, 0, surface_width, surface_height);
CHECK_VASTATUS(vaStatus,"vaPutImage");
// render the temp surface, it should be same with original surface without color conversion test
vaStatus = vaPutSurface(va_dpy, csc_render_surface, CAST_DRAWABLE(drawable),
0,0,surface_width,surface_height,
0,0,width,height,
(test_clip==0)?NULL:&cliprects[0],
(test_clip==0)?0:2,
display_field);
CHECK_VASTATUS(vaStatus,"vaPutSurface");
}
else {
vaStatus = vaPutSurface(va_dpy, surface_id, CAST_DRAWABLE(drawable),
0,0,surface_width,surface_height,
0,0,width,height,
(test_clip==0)?NULL:&cliprects[0],
(test_clip==0)?0:2,
display_field);
CHECK_VASTATUS(vaStatus,"vaPutSurface");
}
putsurface_time += (get_tick_count() - start_time);
if (check_event)
pthread_mutex_unlock(&gmutex);
pthread_mutex_unlock(&surface_mutex[index]); /* locked in get_next_free_surface */
if ((frame_num % 0xff) == 0) {
fprintf(stderr, "%.2f FPS \r", 256000.0 / (float)putsurface_time);
putsurface_time = 0;
update_clipbox(cliprects, width, height);
}
if (check_event)
check_window_event(win_display, drawable, &width, &height, &quit);
 
if (multi_thread) { /* reload surface content */
row_shift++;
if (row_shift==(2*box_width)) row_shift= 0;
}
if (frame_rate != 0) /* rough framerate control */
usleep(1000/frame_rate*1000);
 
frame_num++;
if (frame_num >= frame_num_total)
quit = 1;
}
if (drawable == drawable_thread1)
pthread_exit(NULL);
return 0;
}
int main(int argc,char **argv)
{
int major_ver, minor_ver;
VAStatus va_status;
pthread_t thread1;
int ret;
char c;
int i;
char str_src_fmt[5], str_dst_fmt[5];
 
static struct option long_options[] =
{
{"fmt1", required_argument, NULL, '1'},
{"fmt2", required_argument, NULL, '2'},
{0, 0, 0, 0}
};
 
while ((c =getopt_long(argc,argv,"w:h:g:r:d:f:tcep?n:1:2:v", long_options, NULL)) != EOF) {
switch (c) {
case '?':
printf("putsurface <options>\n");
printf(" -g <widthxheight+x_location+y_location> window geometry\n");
printf(" -w/-h resolution of surface\n");
printf(" -r <framerate>\n");
printf(" -d the dimension of black/write square box, default is 32\n");
printf(" -t multi-threads\n");
printf(" -c test clipbox\n");
printf(" -f <1/2> top field, or bottom field\n");
printf(" -1 source format (fourcc) for color conversion test\n");
printf(" -2 dest format (fourcc) for color conversion test\n");
printf(" --fmt1 same to -1\n");
printf(" --fmt2 same to -2\n");
printf(" -v verbose output\n");
exit(0);
break;
case 'g':
ret = sscanf(optarg, "%dx%d+%d+%d", &win_width, &win_height, &win_x, &win_y);
if (ret != 4) {
printf("invalid window geometry, must be widthxheight+x_location+y_location\n");
exit(0);
} else
printf("Create window at (%d, %d), width = %d, height = %d\n",
win_x, win_y, win_width, win_height);
break;
case 'r':
frame_rate = atoi(optarg);
break;
case 'w':
surface_width = atoi(optarg);
break;
case 'h':
surface_height = atoi(optarg);
break;
case 'n':
frame_num_total = atoi(optarg);
break;
case 'd':
box_width = atoi(optarg);
break;
case 't':
multi_thread = 1;
printf("Two threads to do vaPutSurface\n");
break;
case 'e':
check_event = 0;
break;
case 'p':
put_pixmap = 1;
break;
case 'c':
test_clip = 1;
break;
case 'f':
if (atoi(optarg) == 1) {
printf("Display TOP field\n");
display_field = VA_TOP_FIELD;
} else if (atoi(optarg) == 2) {
printf("Display BOTTOM field\n");
display_field = VA_BOTTOM_FIELD;
} else
printf("The validate input for -f is: 1(top field)/2(bottom field)\n");
break;
case '1':
sscanf(optarg, "%s", str_src_fmt);
csc_src_fourcc = map_str_to_vafourcc (str_src_fmt);
if (!csc_src_fourcc) {
printf("invalid fmt1: %s\n", str_src_fmt );
exit(0);
}
break;
case '2':
sscanf(optarg, "%s", str_dst_fmt);
csc_dst_fourcc = map_str_to_vafourcc (str_dst_fmt);
if (!csc_dst_fourcc) {
printf("invalid fmt1: %s\n", str_dst_fmt );
exit(0);
}
break;
case 'v':
verbose = 1;
printf("Enable verbose output\n");
break;
}
}
 
if (csc_src_fourcc && csc_dst_fourcc) {
test_color_conversion = 1;
}
win_display = (void *)open_display();
if (win_display == NULL) {
fprintf(stderr, "Can't open the connection of display!\n");
exit(-1);
}
create_window(win_display, win_x, win_y, win_width, win_height);
 
va_dpy = vaGetDisplay(win_display);
va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
CHECK_VASTATUS(va_status, "vaInitialize");
 
if (test_color_conversion) {
ret = csc_preparation();
}
if (!test_color_conversion || !ret ) {
va_status = vaCreateSurfaces(
va_dpy,
VA_RT_FORMAT_YUV420, surface_width, surface_height,
&surface_id[0], SURFACE_NUM,
NULL, 0
);
}
CHECK_VASTATUS(va_status, "vaCreateSurfaces");
if (multi_thread == 0) /* upload the content for all surfaces */
upload_source_YUV_once_for_all();
if (check_event)
pthread_mutex_init(&gmutex, NULL);
for(i = 0; i< SURFACE_NUM; i++)
pthread_mutex_init(&surface_mutex[i], NULL);
if (multi_thread == 1)
ret = pthread_create(&thread1, NULL, putsurface_thread, (void*)drawable_thread1);
 
putsurface_thread((void *)drawable_thread0);
 
if (multi_thread == 1)
pthread_join(thread1, (void **)&ret);
printf("thread1 is free\n");
 
if (test_color_conversion) {
// destroy temp surface/image
va_status = vaDestroySurfaces(va_dpy, &csc_render_surface, 1);
CHECK_VASTATUS(va_status,"vaDestroySurfaces");
va_status = vaDestroyImage(va_dpy, csc_dst_fourcc_image.image_id);
CHECK_VASTATUS(va_status,"vaDestroyImage");
}
 
if (vpp_config_id != VA_INVALID_ID) {
vaDestroyConfig (va_dpy, vpp_config_id);
vpp_config_id = VA_INVALID_ID;
}
 
vaDestroySurfaces(va_dpy,&surface_id[0],SURFACE_NUM);
vaTerminate(va_dpy);
 
free(va_image_formats);
free(va_surface_attribs);
close_display(win_display);
return 0;
}
/contrib/sdk/sources/vaapi/libva-1.4.1/test/putsurface/putsurface_wayland.c
0,0 → 1,332
/*
* Copyright (c) 2011 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 <stddef.h>
#include <errno.h>
#include <sys/select.h>
#ifdef IN_LIBVA
# include "va/wayland/va_wayland.h"
#else
# include <va/va_wayland.h>
#endif
#include <wayland-server.h>
 
static void *open_display(void);
static void close_display(void *win_display);
static int create_window(void *win_display,
int x, int y, int width, int height);
static int check_window_event(void *win_display, void *drawable,
int *width, int *height, int *quit);
 
struct display;
struct drawable;
 
static VAStatus
va_put_surface(
VADisplay dpy,
struct drawable *wl_drawable,
VASurfaceID va_surface,
const VARectangle *src_rect,
const VARectangle *dst_rect,
const VARectangle *cliprects,
unsigned int num_cliprects,
unsigned int flags
);
 
/* Glue code for the current PutSurface test design */
#define CAST_DRAWABLE(a) (struct drawable *)(a)
 
static inline VADisplay
vaGetDisplay(VANativeDisplay native_dpy)
{
return vaGetDisplayWl(native_dpy);
}
 
static VAStatus
vaPutSurface(
VADisplay dpy,
VASurfaceID surface,
struct drawable *wl_drawable,
short src_x,
short src_y,
unsigned short src_w,
unsigned short src_h,
short dst_x,
short dst_y,
unsigned short dst_w,
unsigned short dst_h,
const VARectangle *cliprects,
unsigned int num_cliprects,
unsigned int flags
)
{
VARectangle src_rect, dst_rect;
 
src_rect.x = src_x;
src_rect.y = src_y;
src_rect.width = src_w;
src_rect.height = src_h;
 
dst_rect.x = src_x;
dst_rect.y = src_y;
dst_rect.width = src_w;
dst_rect.height = src_h;
return va_put_surface(dpy, wl_drawable, surface, &src_rect, &dst_rect,
cliprects, num_cliprects, flags);
}
 
#include "putsurface_common.c"
 
struct display {
struct wl_display *display;
struct wl_compositor *compositor;
struct wl_shell *shell;
struct wl_registry *registry;
int event_fd;
};
 
struct drawable {
struct wl_display *display;
struct wl_surface *surface;
unsigned int redraw_pending : 1;
};
 
static void
frame_redraw_callback(void *data, struct wl_callback *callback, uint32_t time)
{
struct drawable * const drawable = data;
 
drawable->redraw_pending = 0;
wl_callback_destroy(callback);
}
 
static const struct wl_callback_listener frame_callback_listener = {
frame_redraw_callback
};
 
static VAStatus
va_put_surface(
VADisplay dpy,
struct drawable *wl_drawable,
VASurfaceID va_surface,
const VARectangle *src_rect,
const VARectangle *dst_rect,
const VARectangle *cliprects,
unsigned int num_cliprects,
unsigned int flags
)
{
struct display *d;
struct wl_callback *callback;
VAStatus va_status;
struct wl_buffer *buffer;
 
if (!wl_drawable)
return VA_STATUS_ERROR_INVALID_SURFACE;
 
d = wl_display_get_user_data(wl_drawable->display);
if (!d)
return VA_STATUS_ERROR_INVALID_DISPLAY;
 
/* Wait for the previous frame to complete redraw */
if (wl_drawable->redraw_pending) {
wl_display_flush(d->display);
while (wl_drawable->redraw_pending)
wl_display_dispatch(wl_drawable->display);
}
 
va_status = vaGetSurfaceBufferWl(va_dpy, va_surface, VA_FRAME_PICTURE, &buffer);
if (va_status != VA_STATUS_SUCCESS)
return va_status;
 
wl_surface_attach(wl_drawable->surface, buffer, 0, 0);
wl_surface_damage(
wl_drawable->surface,
dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height
);
 
wl_display_flush(d->display);
wl_drawable->redraw_pending = 1;
callback = wl_surface_frame(wl_drawable->surface);
wl_surface_commit(wl_drawable->surface);
wl_callback_add_listener(callback, &frame_callback_listener, wl_drawable);
return VA_STATUS_SUCCESS;
}
 
static void
registry_handle_global(
void *data,
struct wl_registry *registry,
uint32_t id,
const char *interface,
uint32_t version
)
{
struct display * const d = data;
 
if (strcmp(interface, "wl_compositor") == 0)
d->compositor =
wl_registry_bind(registry, id, &wl_compositor_interface, 1);
else if (strcmp(interface, "wl_shell") == 0)
d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
}
 
static const struct wl_registry_listener registry_listener = {
registry_handle_global,
NULL,
};
 
static void *
open_display(void)
{
struct display *d;
 
d = calloc(1, sizeof *d);
if (!d)
return NULL;
 
d->display = wl_display_connect(NULL);
if (!d->display)
return NULL;
 
wl_display_set_user_data(d->display, d);
d->registry = wl_display_get_registry(d->display);
wl_registry_add_listener(d->registry, &registry_listener, d);
d->event_fd = wl_display_get_fd(d->display);
wl_display_dispatch(d->display);
return d->display;
}
 
static void
close_display(void *win_display)
{
struct display * const d = wl_display_get_user_data(win_display);
 
if (d->shell) {
wl_shell_destroy(d->shell);
d->shell = NULL;
}
 
if (d->compositor) {
wl_compositor_destroy(d->compositor);
d->compositor = NULL;
}
 
if (d->display) {
wl_display_disconnect(d->display);
d->display = NULL;
}
free(d);
}
 
static int
create_window(void *win_display, int x, int y, int width, int height)
{
struct wl_display * const display = win_display;
struct display * const d = wl_display_get_user_data(display);
struct wl_surface *surface1, *surface2;
struct wl_shell_surface *shell_surface;
struct wl_shell_surface *shell_surface_2;
struct drawable *drawable1, *drawable2;
 
surface1 = wl_compositor_create_surface(d->compositor);
shell_surface = wl_shell_get_shell_surface(d->shell, surface1);
wl_shell_surface_set_toplevel(shell_surface);
 
drawable1 = malloc(sizeof(*drawable1));
drawable1->display = display;
drawable1->surface = surface1;
drawable1->redraw_pending = 0;
 
/* global out */
drawable_thread0 = drawable1;
 
if (multi_thread == 0)
return 0;
 
surface2 = wl_compositor_create_surface(d->compositor);
shell_surface_2 = wl_shell_get_shell_surface(d->shell, surface2);
wl_shell_surface_set_toplevel(shell_surface_2);
 
drawable2 = malloc(sizeof(*drawable2));
drawable2->display = display;
drawable1->surface = surface2;
drawable2->redraw_pending = 0;
 
/* global out */
drawable_thread1 = drawable2;
return 0;
}
 
static int
check_window_event(
void *win_display,
void *drawable,
int *width,
int *height,
int *quit
)
{
struct wl_display * const display = win_display;
struct display * const d = wl_display_get_user_data(display);
struct timeval tv;
fd_set rfds;
int retval;
 
if (check_event == 0)
return 0;
 
tv.tv_sec = 0;
tv.tv_usec = 0;
do {
FD_ZERO(&rfds);
FD_SET(d->event_fd, &rfds);
 
retval = select(d->event_fd + 1, &rfds, NULL, NULL, &tv);
if (retval < 0) {
perror("select");
break;
}
if (retval == 1)
wl_display_dispatch(d->display);
} while (retval > 0);
 
#if 0
/* bail on any focused key press */
if(event.type == KeyPress) {
*quit = 1;
return 0;
}
#endif
 
#if 0
/* rescale the video to fit the window */
if(event.type == ConfigureNotify) {
*width = event.xconfigure.width;
*height = event.xconfigure.height;
printf("Scale window to %dx%d\n", width, height);
}
#endif
return 0;
}
/contrib/sdk/sources/vaapi/libva-1.4.1/test/putsurface/putsurface_x11.c
0,0 → 1,172
/*
* Copyright (c) 2008-2009 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 <X11/Xlib.h>
#include <X11/Xutil.h>
#include <va/va_x11.h>
 
static Window window_thread0, window_thread1;
static GC context_thread0, context_thread1;
static pthread_mutex_t gmutex;
 
static void *open_display(void);
static void close_display(void *win_display);
static int create_window(void *win_display, int x, int y, int width, int height);
static int check_window_event(void *x11_display, void *drawable, int *width, int *height, int *quit);
 
#define CAST_DRAWABLE(a) (Drawable)(a)
 
#include "putsurface_common.c"
 
static void *open_display(void)
{
return XOpenDisplay(NULL);
}
 
static void close_display(void *win_display)
{
XCloseDisplay(win_display);
}
 
static Pixmap create_pixmap(void *win_display, int width, int height)
{
Display *x11_display = (Display *)win_display;
int screen = DefaultScreen(x11_display);
Window root;
Pixmap pixmap;
XWindowAttributes attr;
root = RootWindow(x11_display, screen);
 
XGetWindowAttributes (x11_display, root, &attr);
printf("Create a pixmap from ROOT window %dx%d, pixmap size %dx%d\n\n", attr.width, attr.height, width, height);
pixmap = XCreatePixmap(x11_display, root, width, height,
DefaultDepth(x11_display, DefaultScreen(x11_display)));
 
return pixmap;
}
 
static int create_window(void *win_display, int x, int y, int width, int height)
{
Display *x11_display = (Display *)win_display;
int screen = DefaultScreen(x11_display);
Window root, win;
 
root = RootWindow(x11_display, screen);
 
printf("Create window0 for thread0\n");
drawable_thread0 = (void *)XCreateSimpleWindow(x11_display, root, x, y, width, height,
0, 0, WhitePixel(x11_display, 0));
 
win = (Window)drawable_thread0;
if (drawable_thread0) {
XSizeHints sizehints;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize;
XSetNormalHints(x11_display, win, &sizehints);
XSetStandardProperties(x11_display, win, "Thread 0", "Thread 0",
None, (char **)NULL, 0, &sizehints);
 
XMapWindow(x11_display, win);
}
context_thread0 = XCreateGC(x11_display, win, 0, 0);
XSelectInput(x11_display, win, KeyPressMask | StructureNotifyMask);
XSync(x11_display, False);
 
if (put_pixmap) {
window_thread0 = (Window)drawable_thread0;
drawable_thread0 = (void *)create_pixmap(x11_display, width, height);
}
if (multi_thread == 0)
return 0;
 
printf("Create window1 for thread1\n");
drawable_thread1 = (void *)XCreateSimpleWindow(x11_display, root, width, 0, width, height,
0, 0, WhitePixel(x11_display, 0));
win = (Window)drawable_thread1;
if (drawable_thread1) {
XSizeHints sizehints;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize;
XSetNormalHints(x11_display, win, &sizehints);
XSetStandardProperties(x11_display, win, "Thread 1", "Thread 1",
None, (char **)NULL, 0, &sizehints);
 
XMapWindow(x11_display, win);
}
if (put_pixmap) {
window_thread1 = (Window)drawable_thread1;
drawable_thread1 = (void *)create_pixmap(x11_display, width, height);
}
 
context_thread1 = XCreateGC(x11_display, win, 0, 0);
XSelectInput(x11_display, win, KeyPressMask | StructureNotifyMask);
XSync(x11_display, False);
return 0;
}
 
static int check_window_event(void *win_display, void *drawable, int *width, int *height, int *quit)
{
int is_event = 0;
XEvent event;
Window win = (Window)drawable;
Display *x11_display = (Display *)win_display;
if (check_event == 0)
return 0;
 
pthread_mutex_lock(&gmutex);
is_event = XCheckWindowEvent(x11_display, win, StructureNotifyMask|KeyPressMask,&event);
pthread_mutex_unlock(&gmutex);
if (is_event == 0)
return 0;
 
/* bail on any focused key press */
if(event.type == KeyPress) {
*quit = 1;
return 0;
}
#if 0
/* rescale the video to fit the window */
if(event.type == ConfigureNotify) {
*width = event.xconfigure.width;
*height = event.xconfigure.height;
printf("Scale window to %dx%d\n", width, height);
}
#endif
 
return 0;
}