/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/Makefile.am |
---|
0,0 → 1,49 |
# Copyright © 2012 Intel 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. |
include $(top_srcdir)/src/gallium/Automake.inc |
AM_CFLAGS = \ |
-Wall -pedantic \ |
$(GALLIUM_CFLAGS) \ |
$(VISIBILITY_CFLAGS) |
AM_CPPFLAGS = \ |
-I$(top_srcdir)/src/gallium/ \ |
-I$(top_srcdir)/src/gallium/winsys \ |
-I$(top_srcdir)/src/gallium/drivers |
xa_includedir = $(includedir) |
xa_include_HEADERS = \ |
xa_composite.h \ |
xa_context.h \ |
xa_tracker.h |
noinst_LTLIBRARIES = libxatracker.la |
libxatracker_la_SOURCES = \ |
xa_tracker.c \ |
xa_context.c \ |
xa_renderer.c \ |
xa_tgsi.c \ |
xa_yuv.c \ |
xa_composite.c |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/Makefile.in |
---|
0,0 → 1,857 |
# Makefile.in generated by automake 1.14 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 © 2012 Intel 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. |
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@ |
target_triplet = @target@ |
DIST_COMMON = $(top_srcdir)/src/gallium/Automake.inc \ |
$(srcdir)/Makefile.in $(srcdir)/Makefile.am \ |
$(top_srcdir)/bin/depcomp $(xa_include_HEADERS) README |
subdir = src/gallium/state_trackers/xa |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_bison.m4 \ |
$(top_srcdir)/m4/ax_prog_cc_for_build.m4 \ |
$(top_srcdir)/m4/ax_prog_cxx_for_build.m4 \ |
$(top_srcdir)/m4/ax_prog_flex.m4 \ |
$(top_srcdir)/m4/ax_pthread.m4 \ |
$(top_srcdir)/m4/ax_python_module.m4 \ |
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ |
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ |
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
$(ACLOCAL_M4) |
mkinstalldirs = $(install_sh) -d |
CONFIG_CLEAN_FILES = |
CONFIG_CLEAN_VPATH_FILES = |
LTLIBRARIES = $(noinst_LTLIBRARIES) |
libxatracker_la_LIBADD = |
am_libxatracker_la_OBJECTS = xa_tracker.lo xa_context.lo \ |
xa_renderer.lo xa_tgsi.lo xa_yuv.lo xa_composite.lo |
libxatracker_la_OBJECTS = $(am_libxatracker_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@ |
depcomp = $(SHELL) $(top_srcdir)/bin/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 = $(libxatracker_la_SOURCES) |
DIST_SOURCES = $(libxatracker_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)$(xa_includedir)" |
HEADERS = $(xa_include_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@ |
BUILD_EXEEXT = @BUILD_EXEEXT@ |
BUILD_OBJEXT = @BUILD_OBJEXT@ |
CC = @CC@ |
CCAS = @CCAS@ |
CCASDEPMODE = @CCASDEPMODE@ |
CCASFLAGS = @CCASFLAGS@ |
CCDEPMODE = @CCDEPMODE@ |
CC_FOR_BUILD = @CC_FOR_BUILD@ |
CFLAGS = @CFLAGS@ |
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ |
CLANG_RESOURCE_DIR = @CLANG_RESOURCE_DIR@ |
CLOCK_LIB = @CLOCK_LIB@ |
CPP = @CPP@ |
CPPFLAGS = @CPPFLAGS@ |
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ |
CPP_FOR_BUILD = @CPP_FOR_BUILD@ |
CXX = @CXX@ |
CXXCPP = @CXXCPP@ |
CXXCPPFLAGS_FOR_BUILD = @CXXCPPFLAGS_FOR_BUILD@ |
CXXCPP_FOR_BUILD = @CXXCPP_FOR_BUILD@ |
CXXDEPMODE = @CXXDEPMODE@ |
CXXFLAGS = @CXXFLAGS@ |
CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ |
CXX_FOR_BUILD = @CXX_FOR_BUILD@ |
CYGPATH_W = @CYGPATH_W@ |
DEFINES = @DEFINES@ |
DEFINES_FOR_BUILD = @DEFINES_FOR_BUILD@ |
DEFS = @DEFS@ |
DEPDIR = @DEPDIR@ |
DLLTOOL = @DLLTOOL@ |
DLOPEN_LIBS = @DLOPEN_LIBS@ |
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ |
DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ |
DRIGL_CFLAGS = @DRIGL_CFLAGS@ |
DRIGL_LIBS = @DRIGL_LIBS@ |
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@ |
DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@ |
DRI_LIB_DEPS = @DRI_LIB_DEPS@ |
DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@ |
DSYMUTIL = @DSYMUTIL@ |
DUMPBIN = @DUMPBIN@ |
ECHO_C = @ECHO_C@ |
ECHO_N = @ECHO_N@ |
ECHO_T = @ECHO_T@ |
EGL_CFLAGS = @EGL_CFLAGS@ |
EGL_CLIENT_APIS = @EGL_CLIENT_APIS@ |
EGL_DRIVER_INSTALL_DIR = @EGL_DRIVER_INSTALL_DIR@ |
EGL_LIB_DEPS = @EGL_LIB_DEPS@ |
EGL_LIB_GLOB = @EGL_LIB_GLOB@ |
EGL_LIB_NAME = @EGL_LIB_NAME@ |
EGL_NATIVE_PLATFORM = @EGL_NATIVE_PLATFORM@ |
EGL_PLATFORMS = @EGL_PLATFORMS@ |
EGREP = @EGREP@ |
ELF_LIB = @ELF_LIB@ |
EXEEXT = @EXEEXT@ |
EXPAT_INCLUDES = @EXPAT_INCLUDES@ |
FGREP = @FGREP@ |
FREEDRENO_CFLAGS = @FREEDRENO_CFLAGS@ |
FREEDRENO_LIBS = @FREEDRENO_LIBS@ |
GALLIUM_DRI_LIB_DEPS = @GALLIUM_DRI_LIB_DEPS@ |
GALLIUM_PIPE_LOADER_DEFINES = @GALLIUM_PIPE_LOADER_DEFINES@ |
GALLIUM_PIPE_LOADER_LIBS = @GALLIUM_PIPE_LOADER_LIBS@ |
GALLIUM_PIPE_LOADER_XCB_CFLAGS = @GALLIUM_PIPE_LOADER_XCB_CFLAGS@ |
GALLIUM_PIPE_LOADER_XCB_LIBS = @GALLIUM_PIPE_LOADER_XCB_LIBS@ |
GBM_PC_LIB_PRIV = @GBM_PC_LIB_PRIV@ |
GBM_PC_REQ_PRIV = @GBM_PC_REQ_PRIV@ |
GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@ |
GLAPI_LIB_NAME = @GLAPI_LIB_NAME@ |
GLESv1_CM_LIB_DEPS = @GLESv1_CM_LIB_DEPS@ |
GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@ |
GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@ |
GLESv1_CM_PC_LIB_PRIV = @GLESv1_CM_PC_LIB_PRIV@ |
GLESv2_LIB_DEPS = @GLESv2_LIB_DEPS@ |
GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@ |
GLESv2_LIB_NAME = @GLESv2_LIB_NAME@ |
GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@ |
GLPROTO_CFLAGS = @GLPROTO_CFLAGS@ |
GLPROTO_LIBS = @GLPROTO_LIBS@ |
GLX_TLS = @GLX_TLS@ |
GL_LIB = @GL_LIB@ |
GL_LIB_DEPS = @GL_LIB_DEPS@ |
GL_LIB_GLOB = @GL_LIB_GLOB@ |
GL_LIB_NAME = @GL_LIB_NAME@ |
GL_PC_CFLAGS = @GL_PC_CFLAGS@ |
GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ |
GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ |
GREP = @GREP@ |
HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@ |
INDENT = @INDENT@ |
INDENT_FLAGS = @INDENT_FLAGS@ |
INSTALL = @INSTALL@ |
INSTALL_DATA = @INSTALL_DATA@ |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ |
INTEL_CFLAGS = @INTEL_CFLAGS@ |
INTEL_LIBS = @INTEL_LIBS@ |
LD = @LD@ |
LDFLAGS = @LDFLAGS@ |
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ |
LEX = @LEX@ |
LEXLIB = @LEXLIB@ |
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ |
LIBCLC_INCLUDEDIR = @LIBCLC_INCLUDEDIR@ |
LIBCLC_LIBEXECDIR = @LIBCLC_LIBEXECDIR@ |
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ |
LIBDRM_LIBS = @LIBDRM_LIBS@ |
LIBDRM_XORG_CFLAGS = @LIBDRM_XORG_CFLAGS@ |
LIBDRM_XORG_LIBS = @LIBDRM_XORG_LIBS@ |
LIBKMS_XORG_CFLAGS = @LIBKMS_XORG_CFLAGS@ |
LIBKMS_XORG_LIBS = @LIBKMS_XORG_LIBS@ |
LIBOBJS = @LIBOBJS@ |
LIBS = @LIBS@ |
LIBTOOL = @LIBTOOL@ |
LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ |
LIBUDEV_LIBS = @LIBUDEV_LIBS@ |
LIB_DIR = @LIB_DIR@ |
LIPO = @LIPO@ |
LLVM_BINDIR = @LLVM_BINDIR@ |
LLVM_CFLAGS = @LLVM_CFLAGS@ |
LLVM_CONFIG = @LLVM_CONFIG@ |
LLVM_CPPFLAGS = @LLVM_CPPFLAGS@ |
LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ |
LLVM_INCLUDEDIR = @LLVM_INCLUDEDIR@ |
LLVM_LDFLAGS = @LLVM_LDFLAGS@ |
LLVM_LIBDIR = @LLVM_LIBDIR@ |
LLVM_LIBS = @LLVM_LIBS@ |
LLVM_VERSION = @LLVM_VERSION@ |
LN_S = @LN_S@ |
LTLIBOBJS = @LTLIBOBJS@ |
MAKE = @MAKE@ |
MAKEINFO = @MAKEINFO@ |
MANIFEST_TOOL = @MANIFEST_TOOL@ |
MESA_LLVM = @MESA_LLVM@ |
MKDIR_P = @MKDIR_P@ |
NM = @NM@ |
NMEDIT = @NMEDIT@ |
NOUVEAU_CFLAGS = @NOUVEAU_CFLAGS@ |
NOUVEAU_LIBS = @NOUVEAU_LIBS@ |
OBJDUMP = @OBJDUMP@ |
OBJEXT = @OBJEXT@ |
OPENCL_LIB_INSTALL_DIR = @OPENCL_LIB_INSTALL_DIR@ |
OSMESA_LIB = @OSMESA_LIB@ |
OSMESA_LIB_DEPS = @OSMESA_LIB_DEPS@ |
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@ |
OSMESA_MESA_DEPS = @OSMESA_MESA_DEPS@ |
OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@ |
OSMESA_PC_REQ = @OSMESA_PC_REQ@ |
OSMESA_VERSION = @OSMESA_VERSION@ |
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@ |
PERL = @PERL@ |
PKG_CONFIG = @PKG_CONFIG@ |
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ |
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ |
POSIX_SHELL = @POSIX_SHELL@ |
PTHREAD_CC = @PTHREAD_CC@ |
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ |
PTHREAD_LIBS = @PTHREAD_LIBS@ |
PYTHON2 = @PYTHON2@ |
RADEON_CFLAGS = @RADEON_CFLAGS@ |
RADEON_LIBS = @RADEON_LIBS@ |
RANLIB = @RANLIB@ |
SED = @SED@ |
SELINUX_LIBS = @SELINUX_LIBS@ |
SET_MAKE = @SET_MAKE@ |
SHELL = @SHELL@ |
STRIP = @STRIP@ |
VDPAU_CFLAGS = @VDPAU_CFLAGS@ |
VDPAU_LIBS = @VDPAU_LIBS@ |
VDPAU_LIB_INSTALL_DIR = @VDPAU_LIB_INSTALL_DIR@ |
VDPAU_MAJOR = @VDPAU_MAJOR@ |
VDPAU_MINOR = @VDPAU_MINOR@ |
VERSION = @VERSION@ |
VG_LIB_DEPS = @VG_LIB_DEPS@ |
VG_LIB_GLOB = @VG_LIB_GLOB@ |
VG_LIB_NAME = @VG_LIB_NAME@ |
VG_PC_LIB_PRIV = @VG_PC_LIB_PRIV@ |
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@ |
VISIBILITY_CXXFLAGS = @VISIBILITY_CXXFLAGS@ |
WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ |
WAYLAND_LIBS = @WAYLAND_LIBS@ |
WAYLAND_SCANNER = @WAYLAND_SCANNER@ |
X11_INCLUDES = @X11_INCLUDES@ |
XA_MAJOR = @XA_MAJOR@ |
XA_MINOR = @XA_MINOR@ |
XA_TINY = @XA_TINY@ |
XA_VERSION = @XA_VERSION@ |
XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@ |
XCB_DRI2_LIBS = @XCB_DRI2_LIBS@ |
XEXT_CFLAGS = @XEXT_CFLAGS@ |
XEXT_LIBS = @XEXT_LIBS@ |
XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ |
XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ |
XLIBGL_CFLAGS = @XLIBGL_CFLAGS@ |
XLIBGL_LIBS = @XLIBGL_LIBS@ |
XORG_CFLAGS = @XORG_CFLAGS@ |
XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@ |
XORG_LIBS = @XORG_LIBS@ |
XVMC_CFLAGS = @XVMC_CFLAGS@ |
XVMC_LIBS = @XVMC_LIBS@ |
XVMC_LIB_INSTALL_DIR = @XVMC_LIB_INSTALL_DIR@ |
XVMC_MAJOR = @XVMC_MAJOR@ |
XVMC_MINOR = @XVMC_MINOR@ |
YACC = @YACC@ |
YFLAGS = @YFLAGS@ |
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_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ |
ac_ct_CXX = @ac_ct_CXX@ |
ac_ct_CXX_FOR_BUILD = @ac_ct_CXX_FOR_BUILD@ |
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@ |
ax_pthread_config = @ax_pthread_config@ |
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@ |
prefix = @prefix@ |
program_transform_name = @program_transform_name@ |
psdir = @psdir@ |
sbindir = @sbindir@ |
sharedstatedir = @sharedstatedir@ |
srcdir = @srcdir@ |
sysconfdir = @sysconfdir@ |
target = @target@ |
target_alias = @target_alias@ |
target_cpu = @target_cpu@ |
target_os = @target_os@ |
target_vendor = @target_vendor@ |
top_build_prefix = @top_build_prefix@ |
top_builddir = @top_builddir@ |
top_srcdir = @top_srcdir@ |
GALLIUM_CFLAGS = \ |
-I$(top_srcdir)/include \ |
-I$(top_srcdir)/src/gallium/include \ |
-I$(top_srcdir)/src/gallium/auxiliary \ |
$(DEFINES) |
AM_CFLAGS = \ |
-Wall -pedantic \ |
$(GALLIUM_CFLAGS) \ |
$(VISIBILITY_CFLAGS) |
AM_CPPFLAGS = \ |
-I$(top_srcdir)/src/gallium/ \ |
-I$(top_srcdir)/src/gallium/winsys \ |
-I$(top_srcdir)/src/gallium/drivers |
xa_includedir = $(includedir) |
xa_include_HEADERS = \ |
xa_composite.h \ |
xa_context.h \ |
xa_tracker.h |
noinst_LTLIBRARIES = libxatracker.la |
libxatracker_la_SOURCES = \ |
xa_tracker.c \ |
xa_context.c \ |
xa_renderer.c \ |
xa_tgsi.c \ |
xa_yuv.c \ |
xa_composite.c |
all: all-am |
.SUFFIXES: |
.SUFFIXES: .c .lo .o .obj |
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/src/gallium/Automake.inc $(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) --foreign src/gallium/state_trackers/xa/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/gallium/state_trackers/xa/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_srcdir)/src/gallium/Automake.inc: |
$(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}; \ |
} |
libxatracker.la: $(libxatracker_la_OBJECTS) $(libxatracker_la_DEPENDENCIES) $(EXTRA_libxatracker_la_DEPENDENCIES) |
$(AM_V_CCLD)$(LINK) $(libxatracker_la_OBJECTS) $(libxatracker_la_LIBADD) $(LIBS) |
mostlyclean-compile: |
-rm -f *.$(OBJEXT) |
distclean-compile: |
-rm -f *.tab.c |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xa_composite.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xa_context.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xa_renderer.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xa_tgsi.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xa_tracker.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xa_yuv.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-xa_includeHEADERS: $(xa_include_HEADERS) |
@$(NORMAL_INSTALL) |
@list='$(xa_include_HEADERS)'; test -n "$(xa_includedir)" || list=; \ |
if test -n "$$list"; then \ |
echo " $(MKDIR_P) '$(DESTDIR)$(xa_includedir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(xa_includedir)" || 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)$(xa_includedir)'"; \ |
$(INSTALL_HEADER) $$files "$(DESTDIR)$(xa_includedir)" || exit $$?; \ |
done |
uninstall-xa_includeHEADERS: |
@$(NORMAL_UNINSTALL) |
@list='$(xa_include_HEADERS)'; test -n "$(xa_includedir)" || list=; \ |
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ |
dir='$(DESTDIR)$(xa_includedir)'; $(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)$(xa_includedir)"; 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-xa_includeHEADERS |
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-xa_includeHEADERS |
.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-man install-pdf install-pdf-am \ |
install-ps install-ps-am install-strip \ |
install-xa_includeHEADERS 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-xa_includeHEADERS |
# 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/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/README |
---|
0,0 → 1,72 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
The XA state tracker is intended as a versioned interface to gallium for |
xorg driver writers. Initially it's mostly based on Zack Rusin's |
composite / video work for the Xorg state tracker. |
The motivation behind this state tracker is that the Xorg state tracker has |
a number of interfaces to work with: |
1) The Xorg sdk (versioned) |
2) Gallium3D (not versioned) |
3) KMS modesetting (versioned) |
4) Driver-private (hopefully versioned) |
Since Gallium3D is not versioned, the Xorg state tracker needs to be compiled |
with Gallium, but it's really beneficial to be able to compile xorg drivers |
standalone. |
Therefore the xa state tracker is intended to supply the following |
functionality: |
1) Versioning. |
2) Surface functionality (creation and copying for a basic dri2 implementation) |
3) YUV blits for textured Xv. |
4) Solid fills without ROP functionality. |
5) Copies with format conversion and - reinterpretation but without ROP |
6) Xrender- type compositing for general acceleration. |
The first user will be the vmwgfx xorg driver. When there are more users, |
we need to be able to load the appropriate gallium pipe driver, and we |
should investigate sharing the loadig mechanism with the EGL state tracker. |
IMPORTANT: |
Version compatibilities: |
While this library remains OUTSIDE any mesa release branch, |
and the major version number is still 0. Any minor bump should be viewed as |
an incompatibility event, and any user of this library should test for that |
and refuse to use the library if minor versions differ. |
As soon as the library enters a mesa release branch, if not earlier, major |
will be bumped to 1, and normal incompatibility rules (major bump) |
will be followed. |
It is allowed to add function interfaces while only bumping minor. Any |
user that uses these function interfaces must therefore use lazy symbol |
lookups and test minor for compatibility before using such a function. |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa-indent |
---|
0,0 → 1,3 |
# |
indent --linux-style -i4 -ip4 -bad -bap -psl $* |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_composite.c |
---|
0,0 → 1,547 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#include "xa_composite.h" |
#include "xa_context.h" |
#include "xa_priv.h" |
#include "cso_cache/cso_context.h" |
#include "util/u_sampler.h" |
#include "util/u_inlines.h" |
/*XXX also in Xrender.h but the including it here breaks compilition */ |
#define XFixedToDouble(f) (((double) (f)) / 65536.) |
struct xa_composite_blend { |
unsigned op : 8; |
unsigned alpha_dst : 4; |
unsigned alpha_src : 4; |
unsigned rgb_src : 8; /**< PIPE_BLENDFACTOR_x */ |
unsigned rgb_dst : 8; /**< PIPE_BLENDFACTOR_x */ |
}; |
#define XA_BLEND_OP_OVER 3 |
static const struct xa_composite_blend xa_blends[] = { |
{ xa_op_clear, |
0, 0, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO}, |
{ xa_op_src, |
0, 0, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ZERO}, |
{ xa_op_dst, |
0, 0, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ONE}, |
{ xa_op_over, |
0, 1, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, |
{ xa_op_over_reverse, |
1, 0, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE}, |
{ xa_op_in, |
1, 0, PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_ZERO}, |
{ xa_op_in_reverse, |
0, 1, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_SRC_ALPHA}, |
{ xa_op_out, |
1, 0, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ZERO}, |
{ xa_op_out_reverse, |
0, 1, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, |
{ xa_op_atop, |
1, 1, PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, |
{ xa_op_atop_reverse, |
1, 1, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_SRC_ALPHA}, |
{ xa_op_xor, |
1, 1, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, |
{ xa_op_add, |
0, 0, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE}, |
}; |
/* |
* The alpha value stored in a luminance texture is read by the |
* hardware as color. |
*/ |
static unsigned |
xa_convert_blend_for_luminance(unsigned factor) |
{ |
switch(factor) { |
case PIPE_BLENDFACTOR_DST_ALPHA: |
return PIPE_BLENDFACTOR_DST_COLOR; |
case PIPE_BLENDFACTOR_INV_DST_ALPHA: |
return PIPE_BLENDFACTOR_INV_DST_COLOR; |
default: |
break; |
} |
return factor; |
} |
static boolean |
blend_for_op(struct xa_composite_blend *blend, |
enum xa_composite_op op, |
struct xa_picture *src_pic, |
struct xa_picture *mask_pic, |
struct xa_picture *dst_pic) |
{ |
const int num_blends = |
sizeof(xa_blends)/sizeof(struct xa_composite_blend); |
int i; |
boolean supported = FALSE; |
/* |
* Temporarily disable component alpha since it appears buggy. |
*/ |
if (mask_pic && mask_pic->component_alpha) |
return FALSE; |
/* |
* our default in case something goes wrong |
*/ |
*blend = xa_blends[XA_BLEND_OP_OVER]; |
for (i = 0; i < num_blends; ++i) { |
if (xa_blends[i].op == op) { |
*blend = xa_blends[i]; |
supported = TRUE; |
} |
} |
if (!dst_pic->srf) |
return supported; |
if (dst_pic->srf->tex->format == PIPE_FORMAT_L8_UNORM) { |
blend->rgb_src = xa_convert_blend_for_luminance(blend->rgb_src); |
blend->rgb_dst = xa_convert_blend_for_luminance(blend->rgb_dst); |
} |
/* |
* If there's no dst alpha channel, adjust the blend op so that we'll treat |
* it as always 1. |
*/ |
if (xa_format_a(dst_pic->pict_format) == 0 && blend->alpha_dst) { |
if (blend->rgb_src == PIPE_BLENDFACTOR_DST_ALPHA) |
blend->rgb_src = PIPE_BLENDFACTOR_ONE; |
else if (blend->rgb_src == PIPE_BLENDFACTOR_INV_DST_ALPHA) |
blend->rgb_src = PIPE_BLENDFACTOR_ZERO; |
} |
/* |
* If the source alpha is being used, then we should only be in a case where |
* the source blend factor is 0, and the source blend value is the mask |
* channels multiplied by the source picture's alpha. |
*/ |
if (mask_pic && mask_pic->component_alpha && |
xa_format_rgb(mask_pic->pict_format) && |
blend->alpha_src) { |
if (blend->rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) { |
blend->rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR; |
} else if (blend->rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) { |
blend->rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR; |
} |
} |
return supported; |
} |
static INLINE int |
xa_repeat_to_gallium(int mode) |
{ |
switch(mode) { |
case xa_wrap_clamp_to_border: |
return PIPE_TEX_WRAP_CLAMP_TO_BORDER; |
case xa_wrap_repeat: |
return PIPE_TEX_WRAP_REPEAT; |
case xa_wrap_mirror_repeat: |
return PIPE_TEX_WRAP_MIRROR_REPEAT; |
case xa_wrap_clamp_to_edge: |
return PIPE_TEX_WRAP_CLAMP_TO_EDGE; |
default: |
break; |
} |
return PIPE_TEX_WRAP_REPEAT; |
} |
static INLINE boolean |
xa_filter_to_gallium(int xrender_filter, int *out_filter) |
{ |
switch (xrender_filter) { |
case xa_filter_nearest: |
*out_filter = PIPE_TEX_FILTER_NEAREST; |
break; |
case xa_filter_linear: |
*out_filter = PIPE_TEX_FILTER_LINEAR; |
break; |
default: |
*out_filter = PIPE_TEX_FILTER_NEAREST; |
return FALSE; |
} |
return TRUE; |
} |
static int |
xa_is_filter_accelerated(struct xa_picture *pic) |
{ |
int filter; |
if (pic && !xa_filter_to_gallium(pic->filter, &filter)) |
return 0; |
return 1; |
} |
XA_EXPORT int |
xa_composite_check_accelerated(const struct xa_composite *comp) |
{ |
struct xa_composite_blend blend; |
struct xa_picture *src_pic = comp->src; |
if (!xa_is_filter_accelerated(src_pic) || |
!xa_is_filter_accelerated(comp->mask)) { |
return -XA_ERR_INVAL; |
} |
if (src_pic->src_pict) { |
if (src_pic->src_pict->type != xa_src_pict_solid_fill) |
return -XA_ERR_INVAL; |
/* |
* Currently we don't support solid fill with a mask. |
* We can easily do that, but that would require shader, |
* sampler view setup and vertex setup modification. |
*/ |
if (comp->mask) |
return -XA_ERR_INVAL; |
} |
if (blend_for_op(&blend, comp->op, comp->src, comp->mask, comp->dst)) { |
struct xa_picture *mask = comp->mask; |
if (mask && mask->component_alpha && |
xa_format_rgb(mask->pict_format)) { |
if (blend.alpha_src && blend.rgb_src != PIPE_BLENDFACTOR_ZERO) { |
return -XA_ERR_INVAL; |
} |
} |
return XA_ERR_NONE; |
} |
return -XA_ERR_INVAL; |
} |
static int |
bind_composite_blend_state(struct xa_context *ctx, |
const struct xa_composite *comp) |
{ |
struct xa_composite_blend blend_opt; |
struct pipe_blend_state blend; |
if (!blend_for_op(&blend_opt, comp->op, comp->src, comp->mask, comp->dst)) |
return -XA_ERR_INVAL; |
memset(&blend, 0, sizeof(struct pipe_blend_state)); |
blend.rt[0].blend_enable = 1; |
blend.rt[0].colormask = PIPE_MASK_RGBA; |
blend.rt[0].rgb_src_factor = blend_opt.rgb_src; |
blend.rt[0].alpha_src_factor = blend_opt.rgb_src; |
blend.rt[0].rgb_dst_factor = blend_opt.rgb_dst; |
blend.rt[0].alpha_dst_factor = blend_opt.rgb_dst; |
cso_set_blend(ctx->cso, &blend); |
return XA_ERR_NONE; |
} |
static unsigned int |
picture_format_fixups(struct xa_picture *src_pic, |
int mask) |
{ |
boolean set_alpha = FALSE; |
boolean swizzle = FALSE; |
unsigned ret = 0; |
struct xa_surface *src = src_pic->srf; |
enum xa_formats src_hw_format, src_pic_format; |
enum xa_surface_type src_hw_type, src_pic_type; |
if (!src) |
return 0; |
src_hw_format = xa_surface_format(src); |
src_pic_format = src_pic->pict_format; |
set_alpha = (xa_format_type_is_color(src_pic_format) && |
xa_format_a(src_pic_format) == 0); |
if (set_alpha) |
ret |= mask ? FS_MASK_SET_ALPHA : FS_SRC_SET_ALPHA; |
if (src_hw_format == src_pic_format) { |
if (src->tex->format == PIPE_FORMAT_L8_UNORM) |
return ((mask) ? FS_MASK_LUMINANCE : FS_SRC_LUMINANCE); |
return ret; |
} |
src_hw_type = xa_format_type(src_hw_format); |
src_pic_type = xa_format_type(src_pic_format); |
swizzle = ((src_hw_type == xa_type_argb && |
src_pic_type == xa_type_abgr) || |
((src_hw_type == xa_type_abgr && |
src_pic_type == xa_type_argb))); |
if (!swizzle && (src_hw_type != src_pic_type)) |
return ret; |
if (swizzle) |
ret |= mask ? FS_MASK_SWIZZLE_RGB : FS_SRC_SWIZZLE_RGB; |
return ret; |
} |
static int |
bind_shaders(struct xa_context *ctx, const struct xa_composite *comp) |
{ |
unsigned vs_traits = 0, fs_traits = 0; |
struct xa_shader shader; |
struct xa_picture *src_pic = comp->src; |
struct xa_picture *mask_pic = comp->mask; |
ctx->has_solid_color = FALSE; |
if (src_pic) { |
if (src_pic->wrap == xa_wrap_clamp_to_border && src_pic->has_transform) |
fs_traits |= FS_SRC_REPEAT_NONE; |
if (src_pic->src_pict) { |
if (src_pic->src_pict->type == xa_src_pict_solid_fill) { |
fs_traits |= FS_SOLID_FILL | FS_FILL; |
vs_traits |= VS_SOLID_FILL; |
xa_pixel_to_float4(src_pic->src_pict->solid_fill.color, |
ctx->solid_color); |
ctx->has_solid_color = TRUE; |
} |
} else { |
fs_traits |= FS_COMPOSITE; |
vs_traits |= VS_COMPOSITE; |
} |
fs_traits |= picture_format_fixups(src_pic, 0); |
} |
if (mask_pic) { |
vs_traits |= VS_MASK; |
fs_traits |= FS_MASK; |
if (mask_pic->wrap == xa_wrap_clamp_to_border && |
mask_pic->has_transform) |
fs_traits |= FS_MASK_REPEAT_NONE; |
if (mask_pic->component_alpha) { |
struct xa_composite_blend blend; |
if (!blend_for_op(&blend, comp->op, src_pic, mask_pic, NULL)) |
return -XA_ERR_INVAL; |
if (blend.alpha_src) { |
fs_traits |= FS_CA_SRCALPHA; |
} else |
fs_traits |= FS_CA_FULL; |
} |
fs_traits |= picture_format_fixups(mask_pic, 1); |
} |
if (ctx->srf->format == PIPE_FORMAT_L8_UNORM) |
fs_traits |= FS_DST_LUMINANCE; |
shader = xa_shaders_get(ctx->shaders, vs_traits, fs_traits); |
cso_set_vertex_shader_handle(ctx->cso, shader.vs); |
cso_set_fragment_shader_handle(ctx->cso, shader.fs); |
return XA_ERR_NONE; |
} |
static void |
bind_samplers(struct xa_context *ctx, |
const struct xa_composite *comp) |
{ |
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; |
struct pipe_sampler_state src_sampler, mask_sampler; |
struct pipe_sampler_view view_templ; |
struct pipe_sampler_view *src_view; |
struct pipe_context *pipe = ctx->pipe; |
struct xa_picture *src_pic = comp->src; |
struct xa_picture *mask_pic = comp->mask; |
ctx->num_bound_samplers = 0; |
memset(&src_sampler, 0, sizeof(struct pipe_sampler_state)); |
memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state)); |
if (src_pic) { |
if (ctx->has_solid_color) { |
samplers[0] = NULL; |
pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); |
} else { |
unsigned src_wrap = xa_repeat_to_gallium(src_pic->wrap); |
int filter; |
(void) xa_filter_to_gallium(src_pic->filter, &filter); |
src_sampler.wrap_s = src_wrap; |
src_sampler.wrap_t = src_wrap; |
src_sampler.min_img_filter = filter; |
src_sampler.mag_img_filter = filter; |
src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; |
src_sampler.normalized_coords = 1; |
samplers[0] = &src_sampler; |
ctx->num_bound_samplers = 1; |
u_sampler_view_default_template(&view_templ, |
src_pic->srf->tex, |
src_pic->srf->tex->format); |
src_view = pipe->create_sampler_view(pipe, src_pic->srf->tex, |
&view_templ); |
pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); |
ctx->bound_sampler_views[0] = src_view; |
} |
} |
if (mask_pic) { |
unsigned mask_wrap = xa_repeat_to_gallium(mask_pic->wrap); |
int filter; |
(void) xa_filter_to_gallium(mask_pic->filter, &filter); |
mask_sampler.wrap_s = mask_wrap; |
mask_sampler.wrap_t = mask_wrap; |
mask_sampler.min_img_filter = filter; |
mask_sampler.mag_img_filter = filter; |
src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; |
mask_sampler.normalized_coords = 1; |
samplers[1] = &mask_sampler; |
ctx->num_bound_samplers = 2; |
u_sampler_view_default_template(&view_templ, |
mask_pic->srf->tex, |
mask_pic->srf->tex->format); |
src_view = pipe->create_sampler_view(pipe, mask_pic->srf->tex, |
&view_templ); |
pipe_sampler_view_reference(&ctx->bound_sampler_views[1], NULL); |
ctx->bound_sampler_views[1] = src_view; |
/* |
* If src is a solid color, we have no src view, so set up a |
* dummy one that will not be used anyway. |
*/ |
if (ctx->bound_sampler_views[0] == NULL) |
pipe_sampler_view_reference(&ctx->bound_sampler_views[0], |
src_view); |
} |
cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, ctx->num_bound_samplers, |
(const struct pipe_sampler_state **)samplers); |
cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, ctx->num_bound_samplers, |
ctx->bound_sampler_views); |
} |
XA_EXPORT int |
xa_composite_prepare(struct xa_context *ctx, |
const struct xa_composite *comp) |
{ |
struct xa_surface *dst_srf = comp->dst->srf; |
int ret; |
ret = xa_ctx_srf_create(ctx, dst_srf); |
if (ret != XA_ERR_NONE) |
return ret; |
ctx->dst = dst_srf; |
renderer_bind_destination(ctx, ctx->srf, ctx->srf->width, |
ctx->srf->height); |
ret = bind_composite_blend_state(ctx, comp); |
if (ret != XA_ERR_NONE) |
return ret; |
ret = bind_shaders(ctx, comp); |
if (ret != XA_ERR_NONE) |
return ret; |
bind_samplers(ctx, comp); |
if (ctx->num_bound_samplers == 0 ) { /* solid fill */ |
renderer_begin_solid(ctx); |
} else { |
renderer_begin_textures(ctx); |
ctx->comp = comp; |
} |
xa_ctx_srf_destroy(ctx); |
return XA_ERR_NONE; |
} |
XA_EXPORT void |
xa_composite_rect(struct xa_context *ctx, |
int srcX, int srcY, int maskX, int maskY, |
int dstX, int dstY, int width, int height) |
{ |
if (ctx->num_bound_samplers == 0 ) { /* solid fill */ |
renderer_solid(ctx, dstX, dstY, dstX + width, dstY + height, |
ctx->solid_color); |
} else { |
const struct xa_composite *comp = ctx->comp; |
int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY}; |
const float *src_matrix = NULL; |
const float *mask_matrix = NULL; |
if (comp->src->has_transform) |
src_matrix = comp->src->transform; |
if (comp->mask && comp->mask->has_transform) |
mask_matrix = comp->mask->transform; |
renderer_texture(ctx, pos, width, height, |
src_matrix, mask_matrix); |
} |
} |
XA_EXPORT void |
xa_composite_done(struct xa_context *ctx) |
{ |
renderer_draw_flush(ctx); |
ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); |
ctx->comp = NULL; |
ctx->has_solid_color = FALSE; |
xa_ctx_sampler_views_destroy(ctx); |
} |
static const struct xa_composite_allocation a = { |
.xa_composite_size = sizeof(struct xa_composite), |
.xa_picture_size = sizeof(struct xa_picture), |
.xa_source_pict_size = sizeof(union xa_source_pict), |
}; |
XA_EXPORT const struct xa_composite_allocation * |
xa_composite_allocation(void) |
{ |
return &a; |
} |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_composite.h |
---|
0,0 → 1,140 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#ifndef _XA_COMPOSITE_H_ |
#define _XA_COMPOSITE_H_ |
#include "xa_tracker.h" |
#include "xa_context.h" |
/* |
* Supported composite ops. |
*/ |
enum xa_composite_op { |
xa_op_clear, |
xa_op_src, |
xa_op_dst, |
xa_op_over, |
xa_op_over_reverse, |
xa_op_in, |
xa_op_in_reverse, |
xa_op_out, |
xa_op_out_reverse, |
xa_op_atop, |
xa_op_atop_reverse, |
xa_op_xor, |
xa_op_add |
}; |
/* |
* Supported filters. |
*/ |
enum xa_composite_filter { |
xa_filter_nearest, |
xa_filter_linear |
}; |
/* |
* Supported clamp methods. |
*/ |
enum xa_composite_wrap { |
xa_wrap_clamp_to_border, |
xa_wrap_repeat, |
xa_wrap_mirror_repeat, |
xa_wrap_clamp_to_edge |
}; |
/* |
* Src picture types. |
*/ |
enum xa_composite_src_pict_type { |
xa_src_pict_solid_fill |
}; |
struct xa_pict_solid_fill { |
enum xa_composite_src_pict_type type; |
unsigned int class; |
uint32_t color; |
}; |
union xa_source_pict { |
unsigned int type; |
struct xa_pict_solid_fill solid_fill; |
}; |
struct xa_picture { |
enum xa_formats pict_format; |
struct xa_surface *srf; |
struct xa_surface *alpha_map; |
float transform[9]; |
int has_transform; |
int component_alpha; |
enum xa_composite_wrap wrap; |
enum xa_composite_filter filter; |
union xa_source_pict *src_pict; |
}; |
struct xa_composite { |
struct xa_picture *src, *mask, *dst; |
int op; |
int no_solid; |
}; |
struct xa_composite_allocation { |
unsigned int xa_composite_size; |
unsigned int xa_picture_size; |
unsigned int xa_source_pict_size; |
}; |
/* |
* Get allocation sizes for minor bump compatibility. |
*/ |
extern const struct xa_composite_allocation * |
xa_composite_allocation(void); |
/* |
* This function checks most things except the format of the hardware |
* surfaces, since they are generally not available at the time this |
* function is called. Returns usual XA error codes. |
*/ |
extern int |
xa_composite_check_accelerated(const struct xa_composite *comp); |
extern int |
xa_composite_prepare(struct xa_context *ctx, const struct xa_composite *comp); |
extern void |
xa_composite_rect(struct xa_context *ctx, |
int srcX, int srcY, int maskX, int maskY, |
int dstX, int dstY, int width, int height); |
extern void |
xa_composite_done(struct xa_context *ctx); |
#endif |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_context.c |
---|
0,0 → 1,396 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#include "xa_context.h" |
#include "xa_priv.h" |
#include "cso_cache/cso_context.h" |
#include "util/u_inlines.h" |
#include "util/u_rect.h" |
#include "util/u_surface.h" |
#include "pipe/p_context.h" |
XA_EXPORT struct xa_context * |
xa_context_default(struct xa_tracker *xa) |
{ |
return xa->default_ctx; |
} |
XA_EXPORT struct xa_context * |
xa_context_create(struct xa_tracker *xa) |
{ |
struct xa_context *ctx = calloc(1, sizeof(*ctx)); |
ctx->xa = xa; |
ctx->pipe = xa->screen->context_create(xa->screen, NULL); |
ctx->cso = cso_create_context(ctx->pipe); |
ctx->shaders = xa_shaders_create(ctx); |
renderer_init_state(ctx); |
return ctx; |
} |
XA_EXPORT void |
xa_context_destroy(struct xa_context *r) |
{ |
struct pipe_resource **vsbuf = &r->vs_const_buffer; |
struct pipe_resource **fsbuf = &r->fs_const_buffer; |
if (*vsbuf) |
pipe_resource_reference(vsbuf, NULL); |
if (*fsbuf) |
pipe_resource_reference(fsbuf, NULL); |
if (r->shaders) { |
xa_shaders_destroy(r->shaders); |
r->shaders = NULL; |
} |
xa_ctx_sampler_views_destroy(r); |
if (r->cso) { |
cso_release_all(r->cso); |
cso_destroy_context(r->cso); |
r->cso = NULL; |
} |
r->pipe->destroy(r->pipe); |
} |
XA_EXPORT int |
xa_surface_dma(struct xa_context *ctx, |
struct xa_surface *srf, |
void *data, |
unsigned int pitch, |
int to_surface, struct xa_box *boxes, unsigned int num_boxes) |
{ |
struct pipe_transfer *transfer; |
void *map; |
int w, h, i; |
enum pipe_transfer_usage transfer_direction; |
struct pipe_context *pipe = ctx->pipe; |
transfer_direction = (to_surface ? PIPE_TRANSFER_WRITE : |
PIPE_TRANSFER_READ); |
for (i = 0; i < num_boxes; ++i, ++boxes) { |
w = boxes->x2 - boxes->x1; |
h = boxes->y2 - boxes->y1; |
map = pipe_transfer_map(pipe, srf->tex, 0, 0, |
transfer_direction, boxes->x1, boxes->y1, |
w, h, &transfer); |
if (!map) |
return -XA_ERR_NORES; |
if (to_surface) { |
util_copy_rect(map, srf->tex->format, transfer->stride, |
0, 0, w, h, data, pitch, boxes->x1, boxes->y1); |
} else { |
util_copy_rect(data, srf->tex->format, pitch, |
boxes->x1, boxes->y1, w, h, map, transfer->stride, 0, |
0); |
} |
pipe->transfer_unmap(pipe, transfer); |
if (to_surface) |
pipe->flush(pipe, &ctx->last_fence, 0); |
} |
return XA_ERR_NONE; |
} |
XA_EXPORT void * |
xa_surface_map(struct xa_context *ctx, |
struct xa_surface *srf, unsigned int usage) |
{ |
void *map; |
unsigned int transfer_direction = 0; |
struct pipe_context *pipe = ctx->pipe; |
/* |
* A surface may only have a single map. |
*/ |
if (srf->transfer) |
return NULL; |
if (usage & XA_MAP_READ) |
transfer_direction = PIPE_TRANSFER_READ; |
if (usage & XA_MAP_WRITE) |
transfer_direction = PIPE_TRANSFER_WRITE; |
if (!transfer_direction) |
return NULL; |
map = pipe_transfer_map(pipe, srf->tex, 0, 0, |
transfer_direction, 0, 0, |
srf->tex->width0, srf->tex->height0, |
&srf->transfer); |
if (!map) |
return NULL; |
srf->mapping_pipe = pipe; |
return map; |
} |
XA_EXPORT void |
xa_surface_unmap(struct xa_surface *srf) |
{ |
if (srf->transfer) { |
struct pipe_context *pipe = srf->mapping_pipe; |
pipe->transfer_unmap(pipe, srf->transfer); |
srf->transfer = NULL; |
} |
} |
int |
xa_ctx_srf_create(struct xa_context *ctx, struct xa_surface *dst) |
{ |
struct pipe_screen *screen = ctx->pipe->screen; |
struct pipe_surface srf_templ; |
if (ctx->srf) |
return -XA_ERR_INVAL; |
if (!screen->is_format_supported(screen, dst->tex->format, |
PIPE_TEXTURE_2D, 0, |
PIPE_BIND_RENDER_TARGET)) |
return -XA_ERR_INVAL; |
u_surface_default_template(&srf_templ, dst->tex); |
ctx->srf = ctx->pipe->create_surface(ctx->pipe, dst->tex, &srf_templ); |
if (!ctx->srf) |
return -XA_ERR_NORES; |
return XA_ERR_NONE; |
} |
void |
xa_ctx_srf_destroy(struct xa_context *ctx) |
{ |
pipe_surface_reference(&ctx->srf, NULL); |
} |
XA_EXPORT int |
xa_copy_prepare(struct xa_context *ctx, |
struct xa_surface *dst, struct xa_surface *src) |
{ |
if (src == dst || ctx->srf != NULL) |
return -XA_ERR_INVAL; |
if (src->tex->format != dst->tex->format) { |
int ret = xa_ctx_srf_create(ctx, dst); |
if (ret != XA_ERR_NONE) |
return ret; |
renderer_copy_prepare(ctx, ctx->srf, src->tex, |
src->fdesc.xa_format, |
dst->fdesc.xa_format); |
ctx->simple_copy = 0; |
} else |
ctx->simple_copy = 1; |
ctx->src = src; |
ctx->dst = dst; |
xa_ctx_srf_destroy(ctx); |
return 0; |
} |
XA_EXPORT void |
xa_copy(struct xa_context *ctx, |
int dx, int dy, int sx, int sy, int width, int height) |
{ |
struct pipe_box src_box; |
if (ctx->simple_copy) { |
u_box_2d(sx, sy, width, height, &src_box); |
ctx->pipe->resource_copy_region(ctx->pipe, |
ctx->dst->tex, 0, dx, dy, 0, |
ctx->src->tex, |
0, &src_box); |
} else |
renderer_copy(ctx, dx, dy, sx, sy, width, height, |
(float) ctx->src->tex->width0, |
(float) ctx->src->tex->height0); |
} |
XA_EXPORT void |
xa_copy_done(struct xa_context *ctx) |
{ |
if (!ctx->simple_copy) { |
renderer_draw_flush(ctx); |
ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); |
} else |
ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); |
} |
static void |
bind_solid_blend_state(struct xa_context *ctx) |
{ |
struct pipe_blend_state blend; |
memset(&blend, 0, sizeof(struct pipe_blend_state)); |
blend.rt[0].blend_enable = 0; |
blend.rt[0].colormask = PIPE_MASK_RGBA; |
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE; |
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE; |
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; |
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; |
cso_set_blend(ctx->cso, &blend); |
} |
XA_EXPORT int |
xa_solid_prepare(struct xa_context *ctx, struct xa_surface *dst, |
uint32_t fg) |
{ |
unsigned vs_traits, fs_traits; |
struct xa_shader shader; |
int width, height; |
int ret; |
ret = xa_ctx_srf_create(ctx, dst); |
if (ret != XA_ERR_NONE) |
return ret; |
if (ctx->srf->format == PIPE_FORMAT_L8_UNORM) |
xa_pixel_to_float4_a8(fg, ctx->solid_color); |
else |
xa_pixel_to_float4(fg, ctx->solid_color); |
ctx->has_solid_color = 1; |
ctx->dst = dst; |
width = ctx->srf->width; |
height = ctx->srf->height; |
#if 0 |
debug_printf("Color Pixel=(%d, %d, %d, %d), RGBA=(%f, %f, %f, %f)\n", |
(fg >> 24) & 0xff, (fg >> 16) & 0xff, |
(fg >> 8) & 0xff, (fg >> 0) & 0xff, |
exa->solid_color[0], exa->solid_color[1], |
exa->solid_color[2], exa->solid_color[3]); |
#endif |
vs_traits = VS_SOLID_FILL; |
fs_traits = FS_SOLID_FILL; |
renderer_bind_destination(ctx, ctx->srf, width, height); |
bind_solid_blend_state(ctx); |
cso_set_samplers(ctx->cso, PIPE_SHADER_FRAGMENT, 0, NULL); |
cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 0, NULL); |
shader = xa_shaders_get(ctx->shaders, vs_traits, fs_traits); |
cso_set_vertex_shader_handle(ctx->cso, shader.vs); |
cso_set_fragment_shader_handle(ctx->cso, shader.fs); |
renderer_begin_solid(ctx); |
xa_ctx_srf_destroy(ctx); |
return XA_ERR_NONE; |
} |
XA_EXPORT void |
xa_solid(struct xa_context *ctx, int x, int y, int width, int height) |
{ |
renderer_solid(ctx, x, y, x + width, y + height, ctx->solid_color); |
} |
XA_EXPORT void |
xa_solid_done(struct xa_context *ctx) |
{ |
renderer_draw_flush(ctx); |
ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); |
ctx->comp = NULL; |
ctx->has_solid_color = FALSE; |
ctx->num_bound_samplers = 0; |
} |
XA_EXPORT struct xa_fence * |
xa_fence_get(struct xa_context *ctx) |
{ |
struct xa_fence *fence = calloc(1, sizeof(*fence)); |
struct pipe_screen *screen = ctx->xa->screen; |
if (!fence) |
return NULL; |
fence->xa = ctx->xa; |
if (ctx->last_fence == NULL) |
fence->pipe_fence = NULL; |
else |
screen->fence_reference(screen, &fence->pipe_fence, ctx->last_fence); |
return fence; |
} |
XA_EXPORT int |
xa_fence_wait(struct xa_fence *fence, uint64_t timeout) |
{ |
if (!fence) |
return XA_ERR_NONE; |
if (fence->pipe_fence) { |
struct pipe_screen *screen = fence->xa->screen; |
boolean timed_out; |
timed_out = !screen->fence_finish(screen, fence->pipe_fence, timeout); |
if (timed_out) |
return -XA_ERR_BUSY; |
screen->fence_reference(screen, &fence->pipe_fence, NULL); |
} |
return XA_ERR_NONE; |
} |
XA_EXPORT void |
xa_fence_destroy(struct xa_fence *fence) |
{ |
if (!fence) |
return; |
if (fence->pipe_fence) { |
struct pipe_screen *screen = fence->xa->screen; |
screen->fence_reference(screen, &fence->pipe_fence, NULL); |
} |
free(fence); |
} |
void |
xa_ctx_sampler_views_destroy(struct xa_context *ctx) |
{ |
int i; |
for (i = 0; i < ctx->num_bound_samplers; ++i) |
pipe_sampler_view_reference(&ctx->bound_sampler_views[i], NULL); |
ctx->num_bound_samplers = 0; |
} |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_context.h |
---|
0,0 → 1,99 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#ifndef _XA_CONTEXT_H_ |
#define _XA_CONTEXT_H_ |
#include "xa_tracker.h" |
#include <stdint.h> |
struct xa_context; |
extern struct xa_context *xa_context_default(struct xa_tracker *xa); |
extern struct xa_context *xa_context_create(struct xa_tracker *xa); |
extern void xa_context_destroy(struct xa_context *r); |
/** |
* xa_yuv_planar_blit - 2D blit with color conversion and scaling. |
* |
* Performs a scaled blit with color conversion according to |
* (R,G,B,A)^T = (CM)^T (Y,U,V,1)^T, where @conversion_matrix or CM in the |
* formula is a four by four coefficient matrix. The input variable |
* @yuv is an array of three xa_yuv_component surfaces. |
*/ |
extern int xa_yuv_planar_blit(struct xa_context *r, |
int src_x, |
int src_y, |
int src_w, |
int src_h, |
int dst_x, |
int dst_y, |
int dst_w, |
int dst_h, |
struct xa_box *box, |
unsigned int num_boxes, |
const float conversion_matrix[], |
struct xa_surface *dst, struct xa_surface *yuv[]); |
extern int xa_copy_prepare(struct xa_context *ctx, |
struct xa_surface *dst, struct xa_surface *src); |
extern void xa_copy(struct xa_context *ctx, |
int dx, int dy, int sx, int sy, int width, int height); |
extern void xa_copy_done(struct xa_context *ctx); |
extern int xa_surface_dma(struct xa_context *ctx, |
struct xa_surface *srf, |
void *data, |
unsigned int byte_pitch, |
int to_surface, struct xa_box *boxes, |
unsigned int num_boxes); |
extern void *xa_surface_map(struct xa_context *ctx, |
struct xa_surface *srf, unsigned int usage); |
extern void xa_surface_unmap(struct xa_surface *srf); |
extern int |
xa_solid_prepare(struct xa_context *ctx, struct xa_surface *dst, |
uint32_t fg); |
extern void |
xa_solid(struct xa_context *ctx, int x, int y, int width, int height); |
extern void |
xa_solid_done(struct xa_context *ctx); |
extern struct xa_fence *xa_fence_get(struct xa_context *ctx); |
extern int xa_fence_wait(struct xa_fence *fence, uint64_t timeout); |
extern void xa_fence_destroy(struct xa_fence *fence); |
#endif |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_priv.h |
---|
0,0 → 1,265 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#ifndef _XA_PRIV_H_ |
#define _XA_PRIV_H_ |
#include "xa_tracker.h" |
#include "xa_context.h" |
#include "xa_composite.h" |
#include "pipe/p_screen.h" |
#include "pipe/p_context.h" |
#include "pipe/p_state.h" |
#if defined(__GNUC__) && __GNUC__ >= 4 |
#define XA_EXPORT __attribute__ ((visibility("default"))) |
#else |
#define XA_EXPORT |
#endif |
#define XA_VB_SIZE (100 * 4 * 3 * 4) |
#define XA_LAST_SURFACE_TYPE (xa_type_yuv_component + 1) |
#define XA_MAX_SAMPLERS 3 |
struct xa_fence { |
struct pipe_fence_handle *pipe_fence; |
struct xa_tracker *xa; |
}; |
struct xa_format_descriptor { |
enum pipe_format format; |
enum xa_formats xa_format; |
}; |
struct xa_surface { |
struct pipe_resource template; |
struct xa_tracker *xa; |
struct pipe_resource *tex; |
struct pipe_transfer *transfer; |
unsigned int flags; |
struct xa_format_descriptor fdesc; |
struct pipe_context *mapping_pipe; |
}; |
struct xa_tracker { |
enum xa_formats *supported_formats; |
unsigned int format_map[XA_LAST_SURFACE_TYPE][2]; |
int d_depth_bits_last; |
int ds_depth_bits_last; |
struct pipe_screen *screen; |
struct xa_context *default_ctx; |
}; |
struct xa_context { |
struct xa_tracker *xa; |
struct pipe_context *pipe; |
struct cso_context *cso; |
struct xa_shaders *shaders; |
struct pipe_resource *vs_const_buffer; |
struct pipe_resource *fs_const_buffer; |
float buffer[XA_VB_SIZE]; |
unsigned int buffer_size; |
struct pipe_vertex_element velems[3]; |
/* number of attributes per vertex for the current |
* draw operation */ |
unsigned int attrs_per_vertex; |
unsigned int fb_width; |
unsigned int fb_height; |
struct pipe_fence_handle *last_fence; |
struct xa_surface *src; |
struct xa_surface *dst; |
struct pipe_surface *srf; |
int simple_copy; |
int has_solid_color; |
float solid_color[4]; |
unsigned int num_bound_samplers; |
struct pipe_sampler_view *bound_sampler_views[XA_MAX_SAMPLERS]; |
const struct xa_composite *comp; |
}; |
enum xa_vs_traits { |
VS_COMPOSITE = 1 << 0, |
VS_MASK = 1 << 1, |
VS_SOLID_FILL = 1 << 2, |
VS_LINGRAD_FILL = 1 << 3, |
VS_RADGRAD_FILL = 1 << 4, |
VS_YUV = 1 << 5, |
VS_FILL = (VS_SOLID_FILL | VS_LINGRAD_FILL | VS_RADGRAD_FILL) |
}; |
enum xa_fs_traits { |
FS_COMPOSITE = 1 << 0, |
FS_MASK = 1 << 1, |
FS_SOLID_FILL = 1 << 2, |
FS_LINGRAD_FILL = 1 << 3, |
FS_RADGRAD_FILL = 1 << 4, |
FS_CA_FULL = 1 << 5, /* src.rgba * mask.rgba */ |
FS_CA_SRCALPHA = 1 << 6, /* src.aaaa * mask.rgba */ |
FS_YUV = 1 << 7, |
FS_SRC_REPEAT_NONE = 1 << 8, |
FS_MASK_REPEAT_NONE = 1 << 9, |
FS_SRC_SWIZZLE_RGB = 1 << 10, |
FS_MASK_SWIZZLE_RGB = 1 << 11, |
FS_SRC_SET_ALPHA = 1 << 12, |
FS_MASK_SET_ALPHA = 1 << 13, |
FS_SRC_LUMINANCE = 1 << 14, |
FS_MASK_LUMINANCE = 1 << 15, |
FS_DST_LUMINANCE = 1 << 16, |
FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | FS_RADGRAD_FILL), |
FS_COMPONENT_ALPHA = (FS_CA_FULL | FS_CA_SRCALPHA) |
}; |
struct xa_shader { |
void *fs; |
void *vs; |
}; |
struct xa_shaders; |
/* |
* Inline utilities |
*/ |
static INLINE int |
xa_min(int a, int b) |
{ |
return ((a <= b) ? a : b); |
} |
static INLINE void |
xa_pixel_to_float4(uint32_t pixel, float *color) |
{ |
uint32_t r, g, b, a; |
a = (pixel >> 24) & 0xff; |
r = (pixel >> 16) & 0xff; |
g = (pixel >> 8) & 0xff; |
b = (pixel >> 0) & 0xff; |
color[0] = ((float)r) / 255.; |
color[1] = ((float)g) / 255.; |
color[2] = ((float)b) / 255.; |
color[3] = ((float)a) / 255.; |
} |
static INLINE void |
xa_pixel_to_float4_a8(uint32_t pixel, float *color) |
{ |
uint32_t a; |
a = (pixel >> 24) & 0xff; |
color[0] = ((float)a) / 255.; |
color[1] = ((float)a) / 255.; |
color[2] = ((float)a) / 255.; |
color[3] = ((float)a) / 255.; |
} |
/* |
* xa_tgsi.c |
*/ |
extern struct xa_shaders *xa_shaders_create(struct xa_context *); |
void xa_shaders_destroy(struct xa_shaders *shaders); |
struct xa_shader xa_shaders_get(struct xa_shaders *shaders, |
unsigned vs_traits, unsigned fs_traits); |
/* |
* xa_context.c |
*/ |
extern int |
xa_ctx_srf_create(struct xa_context *ctx, struct xa_surface *dst); |
extern void |
xa_ctx_srf_destroy(struct xa_context *ctx); |
extern void |
xa_ctx_sampler_views_destroy(struct xa_context *ctx); |
/* |
* xa_renderer.c |
*/ |
void renderer_set_constants(struct xa_context *r, |
int shader_type, const float *params, |
int param_bytes); |
void renderer_draw_yuv(struct xa_context *r, |
float src_x, |
float src_y, |
float src_w, |
float src_h, |
int dst_x, |
int dst_y, int dst_w, int dst_h, |
struct xa_surface *srf[]); |
void renderer_bind_destination(struct xa_context *r, |
struct pipe_surface *surface, int width, |
int height); |
void renderer_init_state(struct xa_context *r); |
void renderer_copy_prepare(struct xa_context *r, |
struct pipe_surface *dst_surface, |
struct pipe_resource *src_texture, |
const enum xa_formats src_xa_format, |
const enum xa_formats dst_xa_format); |
void renderer_copy(struct xa_context *r, int dx, |
int dy, |
int sx, |
int sy, |
int width, int height, float src_width, float src_height); |
void renderer_draw_flush(struct xa_context *r); |
void renderer_begin_solid(struct xa_context *r); |
void renderer_solid(struct xa_context *r, |
int x0, int y0, int x1, int y1, float *color); |
void |
renderer_begin_textures(struct xa_context *r); |
void |
renderer_texture(struct xa_context *r, |
int *pos, |
int width, int height, |
const float *src_matrix, |
const float *mask_matrix); |
#endif |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_renderer.c |
---|
0,0 → 1,610 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
*/ |
#include "xa_context.h" |
#include "xa_priv.h" |
#include <math.h> |
#include "cso_cache/cso_context.h" |
#include "util/u_inlines.h" |
#include "util/u_sampler.h" |
#include "util/u_draw_quad.h" |
#define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y))) |
#define floatIsZero(x) (floatsEqual((x) + 1, 1)) |
#define NUM_COMPONENTS 4 |
void |
renderer_set_constants(struct xa_context *r, |
int shader_type, const float *params, int param_bytes); |
static INLINE boolean |
is_affine(float *matrix) |
{ |
return floatIsZero(matrix[2]) && floatIsZero(matrix[5]) |
&& floatsEqual(matrix[8], 1); |
} |
static INLINE void |
map_point(float *mat, float x, float y, float *out_x, float *out_y) |
{ |
if (!mat) { |
*out_x = x; |
*out_y = y; |
return; |
} |
*out_x = mat[0] * x + mat[3] * y + mat[6]; |
*out_y = mat[1] * x + mat[4] * y + mat[7]; |
if (!is_affine(mat)) { |
float w = 1 / (mat[2] * x + mat[5] * y + mat[8]); |
*out_x *= w; |
*out_y *= w; |
} |
} |
static INLINE void |
renderer_draw(struct xa_context *r) |
{ |
int num_verts = r->buffer_size / (r->attrs_per_vertex * NUM_COMPONENTS); |
if (!r->buffer_size) |
return; |
cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems); |
util_draw_user_vertex_buffer(r->cso, r->buffer, PIPE_PRIM_QUADS, |
num_verts, /* verts */ |
r->attrs_per_vertex); /* attribs/vert */ |
r->buffer_size = 0; |
} |
static INLINE void |
renderer_draw_conditional(struct xa_context *r, int next_batch) |
{ |
if (r->buffer_size + next_batch >= XA_VB_SIZE || |
(next_batch == 0 && r->buffer_size)) { |
renderer_draw(r); |
} |
} |
void |
renderer_init_state(struct xa_context *r) |
{ |
struct pipe_depth_stencil_alpha_state dsa; |
struct pipe_rasterizer_state raster; |
unsigned i; |
/* set common initial clip state */ |
memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state)); |
cso_set_depth_stencil_alpha(r->cso, &dsa); |
/* XXX: move to renderer_init_state? */ |
memset(&raster, 0, sizeof(struct pipe_rasterizer_state)); |
raster.half_pixel_center = 1; |
raster.bottom_edge_rule = 1; |
raster.depth_clip = 1; |
cso_set_rasterizer(r->cso, &raster); |
/* vertex elements state */ |
memset(&r->velems[0], 0, sizeof(r->velems[0]) * 3); |
for (i = 0; i < 3; i++) { |
r->velems[i].src_offset = i * 4 * sizeof(float); |
r->velems[i].instance_divisor = 0; |
r->velems[i].vertex_buffer_index = 0; |
r->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; |
} |
} |
static INLINE void |
add_vertex_color(struct xa_context *r, float x, float y, float color[4]) |
{ |
float *vertex = r->buffer + r->buffer_size; |
vertex[0] = x; |
vertex[1] = y; |
vertex[2] = 0.f; /*z */ |
vertex[3] = 1.f; /*w */ |
vertex[4] = color[0]; /*r */ |
vertex[5] = color[1]; /*g */ |
vertex[6] = color[2]; /*b */ |
vertex[7] = color[3]; /*a */ |
r->buffer_size += 8; |
} |
static INLINE void |
add_vertex_1tex(struct xa_context *r, float x, float y, float s, float t) |
{ |
float *vertex = r->buffer + r->buffer_size; |
vertex[0] = x; |
vertex[1] = y; |
vertex[2] = 0.f; /*z */ |
vertex[3] = 1.f; /*w */ |
vertex[4] = s; /*s */ |
vertex[5] = t; /*t */ |
vertex[6] = 0.f; /*r */ |
vertex[7] = 1.f; /*q */ |
r->buffer_size += 8; |
} |
static INLINE void |
add_vertex_2tex(struct xa_context *r, |
float x, float y, float s0, float t0, float s1, float t1) |
{ |
float *vertex = r->buffer + r->buffer_size; |
vertex[0] = x; |
vertex[1] = y; |
vertex[2] = 0.f; /*z */ |
vertex[3] = 1.f; /*w */ |
vertex[4] = s0; /*s */ |
vertex[5] = t0; /*t */ |
vertex[6] = 0.f; /*r */ |
vertex[7] = 1.f; /*q */ |
vertex[8] = s1; /*s */ |
vertex[9] = t1; /*t */ |
vertex[10] = 0.f; /*r */ |
vertex[11] = 1.f; /*q */ |
r->buffer_size += 12; |
} |
static void |
add_vertex_data1(struct xa_context *r, |
float srcX, float srcY, float dstX, float dstY, |
float width, float height, |
struct pipe_resource *src, const float *src_matrix) |
{ |
float s0, t0, s1, t1, s2, t2, s3, t3; |
float pt0[2], pt1[2], pt2[2], pt3[2]; |
pt0[0] = srcX; |
pt0[1] = srcY; |
pt1[0] = (srcX + width); |
pt1[1] = srcY; |
pt2[0] = (srcX + width); |
pt2[1] = (srcY + height); |
pt3[0] = srcX; |
pt3[1] = (srcY + height); |
if (src_matrix) { |
map_point((float *)src_matrix, pt0[0], pt0[1], &pt0[0], &pt0[1]); |
map_point((float *)src_matrix, pt1[0], pt1[1], &pt1[0], &pt1[1]); |
map_point((float *)src_matrix, pt2[0], pt2[1], &pt2[0], &pt2[1]); |
map_point((float *)src_matrix, pt3[0], pt3[1], &pt3[0], &pt3[1]); |
} |
s0 = pt0[0] / src->width0; |
s1 = pt1[0] / src->width0; |
s2 = pt2[0] / src->width0; |
s3 = pt3[0] / src->width0; |
t0 = pt0[1] / src->height0; |
t1 = pt1[1] / src->height0; |
t2 = pt2[1] / src->height0; |
t3 = pt3[1] / src->height0; |
/* 1st vertex */ |
add_vertex_1tex(r, dstX, dstY, s0, t0); |
/* 2nd vertex */ |
add_vertex_1tex(r, dstX + width, dstY, s1, t1); |
/* 3rd vertex */ |
add_vertex_1tex(r, dstX + width, dstY + height, s2, t2); |
/* 4th vertex */ |
add_vertex_1tex(r, dstX, dstY + height, s3, t3); |
} |
static void |
add_vertex_data2(struct xa_context *r, |
float srcX, float srcY, float maskX, float maskY, |
float dstX, float dstY, float width, float height, |
struct pipe_resource *src, |
struct pipe_resource *mask, |
const float *src_matrix, const float *mask_matrix) |
{ |
float src_s0, src_t0, src_s1, src_t1; |
float mask_s0, mask_t0, mask_s1, mask_t1; |
float spt0[2], spt1[2]; |
float mpt0[2], mpt1[2]; |
spt0[0] = srcX; |
spt0[1] = srcY; |
spt1[0] = srcX + width; |
spt1[1] = srcY + height; |
mpt0[0] = maskX; |
mpt0[1] = maskY; |
mpt1[0] = maskX + width; |
mpt1[1] = maskY + height; |
if (src_matrix) { |
map_point((float *)src_matrix, spt0[0], spt0[1], &spt0[0], &spt0[1]); |
map_point((float *)src_matrix, spt1[0], spt1[1], &spt1[0], &spt1[1]); |
} |
if (mask_matrix) { |
map_point((float *)mask_matrix, mpt0[0], mpt0[1], &mpt0[0], &mpt0[1]); |
map_point((float *)mask_matrix, mpt1[0], mpt1[1], &mpt1[0], &mpt1[1]); |
} |
src_s0 = spt0[0] / src->width0; |
src_t0 = spt0[1] / src->height0; |
src_s1 = spt1[0] / src->width0; |
src_t1 = spt1[1] / src->height0; |
mask_s0 = mpt0[0] / mask->width0; |
mask_t0 = mpt0[1] / mask->height0; |
mask_s1 = mpt1[0] / mask->width0; |
mask_t1 = mpt1[1] / mask->height0; |
/* 1st vertex */ |
add_vertex_2tex(r, dstX, dstY, |
src_s0, src_t0, mask_s0, mask_t0); |
/* 2nd vertex */ |
add_vertex_2tex(r, dstX + width, dstY, |
src_s1, src_t0, mask_s1, mask_t0); |
/* 3rd vertex */ |
add_vertex_2tex(r, dstX + width, dstY + height, |
src_s1, src_t1, mask_s1, mask_t1); |
/* 4th vertex */ |
add_vertex_2tex(r, dstX, dstY + height, |
src_s0, src_t1, mask_s0, mask_t1); |
} |
static void |
setup_vertex_data_yuv(struct xa_context *r, |
float srcX, |
float srcY, |
float srcW, |
float srcH, |
float dstX, |
float dstY, |
float dstW, float dstH, struct xa_surface *srf[]) |
{ |
float s0, t0, s1, t1; |
float spt0[2], spt1[2]; |
struct pipe_resource *tex; |
spt0[0] = srcX; |
spt0[1] = srcY; |
spt1[0] = srcX + srcW; |
spt1[1] = srcY + srcH; |
tex = srf[0]->tex; |
s0 = spt0[0] / tex->width0; |
t0 = spt0[1] / tex->height0; |
s1 = spt1[0] / tex->width0; |
t1 = spt1[1] / tex->height0; |
/* 1st vertex */ |
add_vertex_1tex(r, dstX, dstY, s0, t0); |
/* 2nd vertex */ |
add_vertex_1tex(r, dstX + dstW, dstY, s1, t0); |
/* 3rd vertex */ |
add_vertex_1tex(r, dstX + dstW, dstY + dstH, s1, t1); |
/* 4th vertex */ |
add_vertex_1tex(r, dstX, dstY + dstH, s0, t1); |
} |
/* Set up framebuffer, viewport and vertex shader constant buffer |
* state for a particular destinaton surface. In all our rendering, |
* these concepts are linked. |
*/ |
void |
renderer_bind_destination(struct xa_context *r, |
struct pipe_surface *surface, int width, int height) |
{ |
struct pipe_framebuffer_state fb; |
struct pipe_viewport_state viewport; |
/* Framebuffer uses actual surface width/height |
*/ |
memset(&fb, 0, sizeof fb); |
fb.width = surface->width; |
fb.height = surface->height; |
fb.nr_cbufs = 1; |
fb.cbufs[0] = surface; |
fb.zsbuf = 0; |
/* Viewport just touches the bit we're interested in: |
*/ |
viewport.scale[0] = width / 2.f; |
viewport.scale[1] = height / 2.f; |
viewport.scale[2] = 1.0; |
viewport.scale[3] = 1.0; |
viewport.translate[0] = width / 2.f; |
viewport.translate[1] = height / 2.f; |
viewport.translate[2] = 0.0; |
viewport.translate[3] = 0.0; |
/* Constant buffer set up to match viewport dimensions: |
*/ |
if (r->fb_width != width || r->fb_height != height) { |
float vs_consts[8] = { |
2.f / width, 2.f / height, 1, 1, |
-1, -1, 0, 0 |
}; |
r->fb_width = width; |
r->fb_height = height; |
renderer_set_constants(r, PIPE_SHADER_VERTEX, |
vs_consts, sizeof vs_consts); |
} |
cso_set_framebuffer(r->cso, &fb); |
cso_set_viewport(r->cso, &viewport); |
} |
void |
renderer_set_constants(struct xa_context *r, |
int shader_type, const float *params, int param_bytes) |
{ |
struct pipe_resource **cbuf = |
(shader_type == PIPE_SHADER_VERTEX) ? &r->vs_const_buffer : |
&r->fs_const_buffer; |
pipe_resource_reference(cbuf, NULL); |
*cbuf = pipe_buffer_create(r->pipe->screen, |
PIPE_BIND_CONSTANT_BUFFER, PIPE_USAGE_STATIC, |
param_bytes); |
if (*cbuf) { |
pipe_buffer_write(r->pipe, *cbuf, 0, param_bytes, params); |
} |
pipe_set_constant_buffer(r->pipe, shader_type, 0, *cbuf); |
} |
void |
renderer_copy_prepare(struct xa_context *r, |
struct pipe_surface *dst_surface, |
struct pipe_resource *src_texture, |
const enum xa_formats src_xa_format, |
const enum xa_formats dst_xa_format) |
{ |
struct pipe_context *pipe = r->pipe; |
struct pipe_screen *screen = pipe->screen; |
struct xa_shader shader; |
uint32_t fs_traits = FS_COMPOSITE; |
assert(screen->is_format_supported(screen, dst_surface->format, |
PIPE_TEXTURE_2D, 0, |
PIPE_BIND_RENDER_TARGET)); |
(void)screen; |
/* set misc state we care about */ |
{ |
struct pipe_blend_state blend; |
memset(&blend, 0, sizeof(blend)); |
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE; |
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE; |
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; |
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; |
blend.rt[0].colormask = PIPE_MASK_RGBA; |
cso_set_blend(r->cso, &blend); |
} |
/* sampler */ |
{ |
struct pipe_sampler_state sampler; |
memset(&sampler, 0, sizeof(sampler)); |
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; |
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; |
sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; |
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; |
sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; |
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; |
sampler.normalized_coords = 1; |
cso_single_sampler(r->cso, PIPE_SHADER_FRAGMENT, 0, &sampler); |
cso_single_sampler_done(r->cso, PIPE_SHADER_FRAGMENT); |
} |
renderer_bind_destination(r, dst_surface, |
dst_surface->width, dst_surface->height); |
/* texture/sampler view */ |
{ |
struct pipe_sampler_view templ; |
struct pipe_sampler_view *src_view; |
u_sampler_view_default_template(&templ, |
src_texture, src_texture->format); |
src_view = pipe->create_sampler_view(pipe, src_texture, &templ); |
cso_set_sampler_views(r->cso, PIPE_SHADER_FRAGMENT, 1, &src_view); |
pipe_sampler_view_reference(&src_view, NULL); |
} |
/* shaders */ |
if (src_texture->format == PIPE_FORMAT_L8_UNORM) |
fs_traits |= FS_SRC_LUMINANCE; |
if (dst_surface->format == PIPE_FORMAT_L8_UNORM) |
fs_traits |= FS_DST_LUMINANCE; |
if (xa_format_a(dst_xa_format) != 0 && |
xa_format_a(src_xa_format) == 0) |
fs_traits |= FS_SRC_SET_ALPHA; |
shader = xa_shaders_get(r->shaders, VS_COMPOSITE, fs_traits); |
cso_set_vertex_shader_handle(r->cso, shader.vs); |
cso_set_fragment_shader_handle(r->cso, shader.fs); |
r->buffer_size = 0; |
r->attrs_per_vertex = 2; |
} |
void |
renderer_copy(struct xa_context *r, |
int dx, |
int dy, |
int sx, |
int sy, |
int width, int height, float src_width, float src_height) |
{ |
float s0, t0, s1, t1; |
float x0, y0, x1, y1; |
/* XXX: could put the texcoord scaling calculation into the vertex |
* shader. |
*/ |
s0 = sx / src_width; |
s1 = (sx + width) / src_width; |
t0 = sy / src_height; |
t1 = (sy + height) / src_height; |
x0 = dx; |
x1 = dx + width; |
y0 = dy; |
y1 = dy + height; |
/* draw quad */ |
renderer_draw_conditional(r, 4 * 8); |
add_vertex_1tex(r, x0, y0, s0, t0); |
add_vertex_1tex(r, x1, y0, s1, t0); |
add_vertex_1tex(r, x1, y1, s1, t1); |
add_vertex_1tex(r, x0, y1, s0, t1); |
} |
void |
renderer_draw_yuv(struct xa_context *r, |
float src_x, |
float src_y, |
float src_w, |
float src_h, |
int dst_x, |
int dst_y, int dst_w, int dst_h, struct xa_surface *srf[]) |
{ |
const int num_attribs = 2; /*pos + tex coord */ |
setup_vertex_data_yuv(r, |
src_x, src_y, src_w, src_h, |
dst_x, dst_y, dst_w, dst_h, srf); |
cso_set_vertex_elements(r->cso, num_attribs, r->velems); |
util_draw_user_vertex_buffer(r->cso, r->buffer, PIPE_PRIM_QUADS, |
4, /* verts */ |
num_attribs); /* attribs/vert */ |
r->buffer_size = 0; |
} |
void |
renderer_begin_solid(struct xa_context *r) |
{ |
r->buffer_size = 0; |
r->attrs_per_vertex = 2; |
} |
void |
renderer_solid(struct xa_context *r, |
int x0, int y0, int x1, int y1, float *color) |
{ |
/* |
* debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", |
* x0, y0, x1, y1, color[0], color[1], color[2], color[3]); */ |
renderer_draw_conditional(r, 4 * 8); |
/* 1st vertex */ |
add_vertex_color(r, x0, y0, color); |
/* 2nd vertex */ |
add_vertex_color(r, x1, y0, color); |
/* 3rd vertex */ |
add_vertex_color(r, x1, y1, color); |
/* 4th vertex */ |
add_vertex_color(r, x0, y1, color); |
} |
void |
renderer_draw_flush(struct xa_context *r) |
{ |
renderer_draw_conditional(r, 0); |
} |
void |
renderer_begin_textures(struct xa_context *r) |
{ |
r->attrs_per_vertex = 1 + r->num_bound_samplers; |
r->buffer_size = 0; |
} |
void |
renderer_texture(struct xa_context *r, |
int *pos, |
int width, int height, |
const float *src_matrix, |
const float *mask_matrix) |
{ |
struct pipe_sampler_view **sampler_view = r->bound_sampler_views; |
#if 0 |
if (src_matrix) { |
debug_printf("src_matrix = \n"); |
debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]); |
debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]); |
debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]); |
} |
if (mask_matrix) { |
debug_printf("mask_matrix = \n"); |
debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]); |
debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]); |
debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]); |
} |
#endif |
switch(r->attrs_per_vertex) { |
case 2: |
renderer_draw_conditional(r, 4 * 8); |
add_vertex_data1(r, |
pos[0], pos[1], /* src */ |
pos[4], pos[5], /* dst */ |
width, height, |
sampler_view[0]->texture, src_matrix); |
break; |
case 3: |
renderer_draw_conditional(r, 4 * 12); |
add_vertex_data2(r, |
pos[0], pos[1], /* src */ |
pos[2], pos[3], /* mask */ |
pos[4], pos[5], /* dst */ |
width, height, |
sampler_view[0]->texture, sampler_view[1]->texture, |
src_matrix, mask_matrix); |
break; |
default: |
break; |
} |
} |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_tgsi.c |
---|
0,0 → 1,659 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
*/ |
#include "xa_priv.h" |
#include "pipe/p_format.h" |
#include "pipe/p_context.h" |
#include "pipe/p_state.h" |
#include "pipe/p_shader_tokens.h" |
#include "util/u_memory.h" |
#include "tgsi/tgsi_ureg.h" |
#include "cso_cache/cso_context.h" |
#include "cso_cache/cso_hash.h" |
/* Vertex shader: |
* IN[0] = vertex pos |
* IN[1] = src tex coord | solid fill color |
* IN[2] = mask tex coord |
* IN[3] = dst tex coord |
* CONST[0] = (2/dst_width, 2/dst_height, 1, 1) |
* CONST[1] = (-1, -1, 0, 0) |
* |
* OUT[0] = vertex pos |
* OUT[1] = src tex coord | solid fill color |
* OUT[2] = mask tex coord |
* OUT[3] = dst tex coord |
*/ |
/* Fragment shader: |
* SAMP[0] = src |
* SAMP[1] = mask |
* SAMP[2] = dst |
* IN[0] = pos src | solid fill color |
* IN[1] = pos mask |
* IN[2] = pos dst |
* CONST[0] = (0, 0, 0, 1) |
* |
* OUT[0] = color |
*/ |
static void |
print_fs_traits(int fs_traits) |
{ |
const char *strings[] = { |
"FS_COMPOSITE", /* = 1 << 0, */ |
"FS_MASK", /* = 1 << 1, */ |
"FS_SOLID_FILL", /* = 1 << 2, */ |
"FS_LINGRAD_FILL", /* = 1 << 3, */ |
"FS_RADGRAD_FILL", /* = 1 << 4, */ |
"FS_CA_FULL", /* = 1 << 5, *//* src.rgba * mask.rgba */ |
"FS_CA_SRCALPHA", /* = 1 << 6, *//* src.aaaa * mask.rgba */ |
"FS_YUV", /* = 1 << 7, */ |
"FS_SRC_REPEAT_NONE", /* = 1 << 8, */ |
"FS_MASK_REPEAT_NONE", /* = 1 << 9, */ |
"FS_SRC_SWIZZLE_RGB", /* = 1 << 10, */ |
"FS_MASK_SWIZZLE_RGB", /* = 1 << 11, */ |
"FS_SRC_SET_ALPHA", /* = 1 << 12, */ |
"FS_MASK_SET_ALPHA", /* = 1 << 13, */ |
"FS_SRC_LUMINANCE", /* = 1 << 14, */ |
"FS_MASK_LUMINANCE", /* = 1 << 15, */ |
"FS_DST_LUMINANCE", /* = 1 << 15, */ |
}; |
int i, k; |
debug_printf("%s: ", __func__); |
for (i = 0, k = 1; k < (1 << 16); i++, k <<= 1) { |
if (fs_traits & k) |
debug_printf("%s, ", strings[i]); |
} |
debug_printf("\n"); |
} |
struct xa_shaders { |
struct xa_context *r; |
struct cso_hash *vs_hash; |
struct cso_hash *fs_hash; |
}; |
static INLINE void |
src_in_mask(struct ureg_program *ureg, |
struct ureg_dst dst, |
struct ureg_src src, |
struct ureg_src mask, |
unsigned component_alpha, unsigned mask_luminance) |
{ |
if (component_alpha == FS_CA_FULL) { |
ureg_MUL(ureg, dst, src, mask); |
} else if (component_alpha == FS_CA_SRCALPHA) { |
ureg_MUL(ureg, dst, ureg_scalar(src, TGSI_SWIZZLE_W), mask); |
} else { |
if (mask_luminance) |
ureg_MUL(ureg, dst, src, ureg_scalar(mask, TGSI_SWIZZLE_X)); |
else |
ureg_MUL(ureg, dst, src, ureg_scalar(mask, TGSI_SWIZZLE_W)); |
} |
} |
static struct ureg_src |
vs_normalize_coords(struct ureg_program *ureg, |
struct ureg_src coords, |
struct ureg_src const0, struct ureg_src const1) |
{ |
struct ureg_dst tmp = ureg_DECL_temporary(ureg); |
struct ureg_src ret; |
ureg_MAD(ureg, tmp, coords, const0, const1); |
ret = ureg_src(tmp); |
ureg_release_temporary(ureg, tmp); |
return ret; |
} |
static void |
linear_gradient(struct ureg_program *ureg, |
struct ureg_dst out, |
struct ureg_src pos, |
struct ureg_src sampler, |
struct ureg_src coords, |
struct ureg_src const0124, |
struct ureg_src matrow0, |
struct ureg_src matrow1, struct ureg_src matrow2) |
{ |
struct ureg_dst temp0 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp1 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp2 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp3 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp4 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp5 = ureg_DECL_temporary(ureg); |
ureg_MOV(ureg, ureg_writemask(temp0, TGSI_WRITEMASK_XY), pos); |
ureg_MOV(ureg, |
ureg_writemask(temp0, TGSI_WRITEMASK_Z), |
ureg_scalar(const0124, TGSI_SWIZZLE_Y)); |
ureg_DP3(ureg, temp1, matrow0, ureg_src(temp0)); |
ureg_DP3(ureg, temp2, matrow1, ureg_src(temp0)); |
ureg_DP3(ureg, temp3, matrow2, ureg_src(temp0)); |
ureg_RCP(ureg, temp3, ureg_src(temp3)); |
ureg_MUL(ureg, temp1, ureg_src(temp1), ureg_src(temp3)); |
ureg_MUL(ureg, temp2, ureg_src(temp2), ureg_src(temp3)); |
ureg_MOV(ureg, ureg_writemask(temp4, TGSI_WRITEMASK_X), ureg_src(temp1)); |
ureg_MOV(ureg, ureg_writemask(temp4, TGSI_WRITEMASK_Y), ureg_src(temp2)); |
ureg_MUL(ureg, temp0, |
ureg_scalar(coords, TGSI_SWIZZLE_Y), |
ureg_scalar(ureg_src(temp4), TGSI_SWIZZLE_Y)); |
ureg_MAD(ureg, temp1, |
ureg_scalar(coords, TGSI_SWIZZLE_X), |
ureg_scalar(ureg_src(temp4), TGSI_SWIZZLE_X), ureg_src(temp0)); |
ureg_MUL(ureg, temp2, ureg_src(temp1), ureg_scalar(coords, TGSI_SWIZZLE_Z)); |
ureg_TEX(ureg, out, TGSI_TEXTURE_1D, ureg_src(temp2), sampler); |
ureg_release_temporary(ureg, temp0); |
ureg_release_temporary(ureg, temp1); |
ureg_release_temporary(ureg, temp2); |
ureg_release_temporary(ureg, temp3); |
ureg_release_temporary(ureg, temp4); |
ureg_release_temporary(ureg, temp5); |
} |
static void |
radial_gradient(struct ureg_program *ureg, |
struct ureg_dst out, |
struct ureg_src pos, |
struct ureg_src sampler, |
struct ureg_src coords, |
struct ureg_src const0124, |
struct ureg_src matrow0, |
struct ureg_src matrow1, struct ureg_src matrow2) |
{ |
struct ureg_dst temp0 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp1 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp2 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp3 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp4 = ureg_DECL_temporary(ureg); |
struct ureg_dst temp5 = ureg_DECL_temporary(ureg); |
ureg_MOV(ureg, ureg_writemask(temp0, TGSI_WRITEMASK_XY), pos); |
ureg_MOV(ureg, |
ureg_writemask(temp0, TGSI_WRITEMASK_Z), |
ureg_scalar(const0124, TGSI_SWIZZLE_Y)); |
ureg_DP3(ureg, temp1, matrow0, ureg_src(temp0)); |
ureg_DP3(ureg, temp2, matrow1, ureg_src(temp0)); |
ureg_DP3(ureg, temp3, matrow2, ureg_src(temp0)); |
ureg_RCP(ureg, temp3, ureg_src(temp3)); |
ureg_MUL(ureg, temp1, ureg_src(temp1), ureg_src(temp3)); |
ureg_MUL(ureg, temp2, ureg_src(temp2), ureg_src(temp3)); |
ureg_MOV(ureg, ureg_writemask(temp5, TGSI_WRITEMASK_X), ureg_src(temp1)); |
ureg_MOV(ureg, ureg_writemask(temp5, TGSI_WRITEMASK_Y), ureg_src(temp2)); |
ureg_MUL(ureg, temp0, ureg_scalar(coords, TGSI_SWIZZLE_Y), |
ureg_scalar(ureg_src(temp5), TGSI_SWIZZLE_Y)); |
ureg_MAD(ureg, temp1, |
ureg_scalar(coords, TGSI_SWIZZLE_X), |
ureg_scalar(ureg_src(temp5), TGSI_SWIZZLE_X), ureg_src(temp0)); |
ureg_ADD(ureg, temp1, ureg_src(temp1), ureg_src(temp1)); |
ureg_MUL(ureg, temp3, |
ureg_scalar(ureg_src(temp5), TGSI_SWIZZLE_Y), |
ureg_scalar(ureg_src(temp5), TGSI_SWIZZLE_Y)); |
ureg_MAD(ureg, temp4, |
ureg_scalar(ureg_src(temp5), TGSI_SWIZZLE_X), |
ureg_scalar(ureg_src(temp5), TGSI_SWIZZLE_X), ureg_src(temp3)); |
ureg_MOV(ureg, temp4, ureg_negate(ureg_src(temp4))); |
ureg_MUL(ureg, temp2, ureg_scalar(coords, TGSI_SWIZZLE_Z), ureg_src(temp4)); |
ureg_MUL(ureg, temp0, |
ureg_scalar(const0124, TGSI_SWIZZLE_W), ureg_src(temp2)); |
ureg_MUL(ureg, temp3, ureg_src(temp1), ureg_src(temp1)); |
ureg_SUB(ureg, temp2, ureg_src(temp3), ureg_src(temp0)); |
ureg_RSQ(ureg, temp2, ureg_abs(ureg_src(temp2))); |
ureg_RCP(ureg, temp2, ureg_src(temp2)); |
ureg_SUB(ureg, temp1, ureg_src(temp2), ureg_src(temp1)); |
ureg_ADD(ureg, temp0, |
ureg_scalar(coords, TGSI_SWIZZLE_Z), |
ureg_scalar(coords, TGSI_SWIZZLE_Z)); |
ureg_RCP(ureg, temp0, ureg_src(temp0)); |
ureg_MUL(ureg, temp2, ureg_src(temp1), ureg_src(temp0)); |
ureg_TEX(ureg, out, TGSI_TEXTURE_1D, ureg_src(temp2), sampler); |
ureg_release_temporary(ureg, temp0); |
ureg_release_temporary(ureg, temp1); |
ureg_release_temporary(ureg, temp2); |
ureg_release_temporary(ureg, temp3); |
ureg_release_temporary(ureg, temp4); |
ureg_release_temporary(ureg, temp5); |
} |
static void * |
create_vs(struct pipe_context *pipe, unsigned vs_traits) |
{ |
struct ureg_program *ureg; |
struct ureg_src src; |
struct ureg_dst dst; |
struct ureg_src const0, const1; |
boolean is_fill = (vs_traits & VS_FILL) != 0; |
boolean is_composite = (vs_traits & VS_COMPOSITE) != 0; |
boolean has_mask = (vs_traits & VS_MASK) != 0; |
boolean is_yuv = (vs_traits & VS_YUV) != 0; |
unsigned input_slot = 0; |
ureg = ureg_create(TGSI_PROCESSOR_VERTEX); |
if (ureg == NULL) |
return 0; |
const0 = ureg_DECL_constant(ureg, 0); |
const1 = ureg_DECL_constant(ureg, 1); |
/* it has to be either a fill or a composite op */ |
debug_assert((is_fill ^ is_composite) ^ is_yuv); |
src = ureg_DECL_vs_input(ureg, input_slot++); |
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0); |
src = vs_normalize_coords(ureg, src, const0, const1); |
ureg_MOV(ureg, dst, src); |
if (is_yuv) { |
src = ureg_DECL_vs_input(ureg, input_slot++); |
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 0); |
ureg_MOV(ureg, dst, src); |
} |
if (is_composite) { |
src = ureg_DECL_vs_input(ureg, input_slot++); |
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 0); |
ureg_MOV(ureg, dst, src); |
} |
if (is_fill) { |
src = ureg_DECL_vs_input(ureg, input_slot++); |
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0); |
ureg_MOV(ureg, dst, src); |
} |
if (has_mask) { |
src = ureg_DECL_vs_input(ureg, input_slot++); |
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 1); |
ureg_MOV(ureg, dst, src); |
} |
ureg_END(ureg); |
return ureg_create_shader_and_destroy(ureg, pipe); |
} |
static void * |
create_yuv_shader(struct pipe_context *pipe, struct ureg_program *ureg) |
{ |
struct ureg_src y_sampler, u_sampler, v_sampler; |
struct ureg_src pos; |
struct ureg_src matrow0, matrow1, matrow2, matrow3; |
struct ureg_dst y, u, v, rgb; |
struct ureg_dst out = ureg_DECL_output(ureg, |
TGSI_SEMANTIC_COLOR, |
0); |
pos = ureg_DECL_fs_input(ureg, |
TGSI_SEMANTIC_GENERIC, 0, |
TGSI_INTERPOLATE_PERSPECTIVE); |
rgb = ureg_DECL_temporary(ureg); |
y = ureg_DECL_temporary(ureg); |
u = ureg_DECL_temporary(ureg); |
v = ureg_DECL_temporary(ureg); |
y_sampler = ureg_DECL_sampler(ureg, 0); |
u_sampler = ureg_DECL_sampler(ureg, 1); |
v_sampler = ureg_DECL_sampler(ureg, 2); |
matrow0 = ureg_DECL_constant(ureg, 0); |
matrow1 = ureg_DECL_constant(ureg, 1); |
matrow2 = ureg_DECL_constant(ureg, 2); |
matrow3 = ureg_DECL_constant(ureg, 3); |
ureg_TEX(ureg, y, TGSI_TEXTURE_2D, pos, y_sampler); |
ureg_TEX(ureg, u, TGSI_TEXTURE_2D, pos, u_sampler); |
ureg_TEX(ureg, v, TGSI_TEXTURE_2D, pos, v_sampler); |
ureg_MOV(ureg, rgb, matrow3); |
ureg_MAD(ureg, rgb, |
ureg_scalar(ureg_src(y), TGSI_SWIZZLE_X), matrow0, ureg_src(rgb)); |
ureg_MAD(ureg, rgb, |
ureg_scalar(ureg_src(u), TGSI_SWIZZLE_X), matrow1, ureg_src(rgb)); |
ureg_MAD(ureg, rgb, |
ureg_scalar(ureg_src(v), TGSI_SWIZZLE_X), matrow2, ureg_src(rgb)); |
ureg_MOV(ureg, out, ureg_src(rgb)); |
ureg_release_temporary(ureg, rgb); |
ureg_release_temporary(ureg, y); |
ureg_release_temporary(ureg, u); |
ureg_release_temporary(ureg, v); |
ureg_END(ureg); |
return ureg_create_shader_and_destroy(ureg, pipe); |
} |
static INLINE void |
xrender_tex(struct ureg_program *ureg, |
struct ureg_dst dst, |
struct ureg_src coords, |
struct ureg_src sampler, |
struct ureg_src imm0, |
boolean repeat_none, boolean swizzle, boolean set_alpha) |
{ |
if (repeat_none) { |
struct ureg_dst tmp0 = ureg_DECL_temporary(ureg); |
struct ureg_dst tmp1 = ureg_DECL_temporary(ureg); |
ureg_SGT(ureg, tmp1, ureg_swizzle(coords, |
TGSI_SWIZZLE_X, |
TGSI_SWIZZLE_Y, |
TGSI_SWIZZLE_X, |
TGSI_SWIZZLE_Y), ureg_scalar(imm0, |
TGSI_SWIZZLE_X)); |
ureg_SLT(ureg, tmp0, |
ureg_swizzle(coords, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y, |
TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y), ureg_scalar(imm0, |
TGSI_SWIZZLE_W)); |
ureg_MIN(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1)); |
ureg_MIN(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X), |
ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y)); |
ureg_TEX(ureg, tmp1, TGSI_TEXTURE_2D, coords, sampler); |
if (swizzle) |
ureg_MOV(ureg, tmp1, ureg_swizzle(ureg_src(tmp1), |
TGSI_SWIZZLE_Z, |
TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X, |
TGSI_SWIZZLE_W)); |
if (set_alpha) |
ureg_MOV(ureg, |
ureg_writemask(tmp1, TGSI_WRITEMASK_W), |
ureg_scalar(imm0, TGSI_SWIZZLE_W)); |
ureg_MUL(ureg, dst, ureg_src(tmp1), ureg_src(tmp0)); |
ureg_release_temporary(ureg, tmp0); |
ureg_release_temporary(ureg, tmp1); |
} else { |
if (swizzle) { |
struct ureg_dst tmp = ureg_DECL_temporary(ureg); |
ureg_TEX(ureg, tmp, TGSI_TEXTURE_2D, coords, sampler); |
ureg_MOV(ureg, dst, ureg_swizzle(ureg_src(tmp), |
TGSI_SWIZZLE_Z, |
TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X, |
TGSI_SWIZZLE_W)); |
ureg_release_temporary(ureg, tmp); |
} else { |
ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler); |
} |
if (set_alpha) |
ureg_MOV(ureg, |
ureg_writemask(dst, TGSI_WRITEMASK_W), |
ureg_scalar(imm0, TGSI_SWIZZLE_W)); |
} |
} |
static void * |
create_fs(struct pipe_context *pipe, unsigned fs_traits) |
{ |
struct ureg_program *ureg; |
struct ureg_src /*dst_sampler, */ src_sampler, mask_sampler; |
struct ureg_src /*dst_pos, */ src_input, mask_pos; |
struct ureg_dst src, mask; |
struct ureg_dst out; |
struct ureg_src imm0 = { 0 }; |
unsigned has_mask = (fs_traits & FS_MASK) != 0; |
unsigned is_fill = (fs_traits & FS_FILL) != 0; |
unsigned is_composite = (fs_traits & FS_COMPOSITE) != 0; |
unsigned is_solid = (fs_traits & FS_SOLID_FILL) != 0; |
unsigned is_lingrad = (fs_traits & FS_LINGRAD_FILL) != 0; |
unsigned is_radgrad = (fs_traits & FS_RADGRAD_FILL) != 0; |
unsigned comp_alpha_mask = fs_traits & FS_COMPONENT_ALPHA; |
unsigned is_yuv = (fs_traits & FS_YUV) != 0; |
unsigned src_repeat_none = (fs_traits & FS_SRC_REPEAT_NONE) != 0; |
unsigned mask_repeat_none = (fs_traits & FS_MASK_REPEAT_NONE) != 0; |
unsigned src_swizzle = (fs_traits & FS_SRC_SWIZZLE_RGB) != 0; |
unsigned mask_swizzle = (fs_traits & FS_MASK_SWIZZLE_RGB) != 0; |
unsigned src_set_alpha = (fs_traits & FS_SRC_SET_ALPHA) != 0; |
unsigned mask_set_alpha = (fs_traits & FS_MASK_SET_ALPHA) != 0; |
unsigned src_luminance = (fs_traits & FS_SRC_LUMINANCE) != 0; |
unsigned mask_luminance = (fs_traits & FS_MASK_LUMINANCE) != 0; |
unsigned dst_luminance = (fs_traits & FS_DST_LUMINANCE) != 0; |
#if 0 |
print_fs_traits(fs_traits); |
#else |
(void)print_fs_traits; |
#endif |
ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); |
if (ureg == NULL) |
return 0; |
/* it has to be either a fill, a composite op or a yuv conversion */ |
debug_assert((is_fill ^ is_composite) ^ is_yuv); |
(void)is_yuv; |
out = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0); |
if (src_repeat_none || mask_repeat_none || |
src_set_alpha || mask_set_alpha || src_luminance) { |
imm0 = ureg_imm4f(ureg, 0, 0, 0, 1); |
} |
if (is_composite) { |
src_sampler = ureg_DECL_sampler(ureg, 0); |
src_input = ureg_DECL_fs_input(ureg, |
TGSI_SEMANTIC_GENERIC, 0, |
TGSI_INTERPOLATE_PERSPECTIVE); |
} else if (is_fill) { |
if (is_solid) |
src_input = ureg_DECL_fs_input(ureg, |
TGSI_SEMANTIC_COLOR, 0, |
TGSI_INTERPOLATE_PERSPECTIVE); |
else |
src_input = ureg_DECL_fs_input(ureg, |
TGSI_SEMANTIC_POSITION, 0, |
TGSI_INTERPOLATE_PERSPECTIVE); |
} else { |
debug_assert(is_yuv); |
return create_yuv_shader(pipe, ureg); |
} |
if (has_mask) { |
mask_sampler = ureg_DECL_sampler(ureg, 1); |
mask_pos = ureg_DECL_fs_input(ureg, |
TGSI_SEMANTIC_GENERIC, 1, |
TGSI_INTERPOLATE_PERSPECTIVE); |
} |
#if 0 /* unused right now */ |
dst_sampler = ureg_DECL_sampler(ureg, 2); |
dst_pos = ureg_DECL_fs_input(ureg, |
TGSI_SEMANTIC_POSITION, 2, |
TGSI_INTERPOLATE_PERSPECTIVE); |
#endif |
if (is_composite) { |
if (has_mask || src_luminance || dst_luminance) |
src = ureg_DECL_temporary(ureg); |
else |
src = out; |
xrender_tex(ureg, src, src_input, src_sampler, imm0, |
src_repeat_none, src_swizzle, src_set_alpha); |
} else if (is_fill) { |
if (is_solid) { |
if (has_mask || src_luminance || dst_luminance) |
src = ureg_dst(src_input); |
else |
ureg_MOV(ureg, out, src_input); |
} else if (is_lingrad || is_radgrad) { |
struct ureg_src coords, const0124, matrow0, matrow1, matrow2; |
if (has_mask || src_luminance || dst_luminance) |
src = ureg_DECL_temporary(ureg); |
else |
src = out; |
coords = ureg_DECL_constant(ureg, 0); |
const0124 = ureg_DECL_constant(ureg, 1); |
matrow0 = ureg_DECL_constant(ureg, 2); |
matrow1 = ureg_DECL_constant(ureg, 3); |
matrow2 = ureg_DECL_constant(ureg, 4); |
if (is_lingrad) { |
linear_gradient(ureg, src, |
src_input, src_sampler, |
coords, const0124, matrow0, matrow1, matrow2); |
} else if (is_radgrad) { |
radial_gradient(ureg, src, |
src_input, src_sampler, |
coords, const0124, matrow0, matrow1, matrow2); |
} |
} else |
debug_assert(!"Unknown fill type!"); |
} |
if (src_luminance) { |
ureg_MOV(ureg, src, ureg_scalar(ureg_src(src), TGSI_SWIZZLE_X)); |
ureg_MOV(ureg, ureg_writemask(src, TGSI_WRITEMASK_XYZ), |
ureg_scalar(imm0, TGSI_SWIZZLE_X)); |
if (!has_mask && !dst_luminance) |
ureg_MOV(ureg, out, ureg_src(src)); |
} |
if (has_mask) { |
mask = ureg_DECL_temporary(ureg); |
xrender_tex(ureg, mask, mask_pos, mask_sampler, imm0, |
mask_repeat_none, mask_swizzle, mask_set_alpha); |
/* src IN mask */ |
src_in_mask(ureg, (dst_luminance) ? src : out, ureg_src(src), |
ureg_src(mask), |
comp_alpha_mask, mask_luminance); |
ureg_release_temporary(ureg, mask); |
} |
if (dst_luminance) { |
/* |
* Make sure the alpha channel goes into the output L8 surface. |
*/ |
ureg_MOV(ureg, out, ureg_scalar(ureg_src(src), TGSI_SWIZZLE_W)); |
} |
ureg_END(ureg); |
return ureg_create_shader_and_destroy(ureg, pipe); |
} |
struct xa_shaders * |
xa_shaders_create(struct xa_context *r) |
{ |
struct xa_shaders *sc = CALLOC_STRUCT(xa_shaders); |
sc->r = r; |
sc->vs_hash = cso_hash_create(); |
sc->fs_hash = cso_hash_create(); |
return sc; |
} |
static void |
cache_destroy(struct cso_context *cso, |
struct cso_hash *hash, unsigned processor) |
{ |
struct cso_hash_iter iter = cso_hash_first_node(hash); |
while (!cso_hash_iter_is_null(iter)) { |
void *shader = (void *)cso_hash_iter_data(iter); |
if (processor == PIPE_SHADER_FRAGMENT) { |
cso_delete_fragment_shader(cso, shader); |
} else if (processor == PIPE_SHADER_VERTEX) { |
cso_delete_vertex_shader(cso, shader); |
} |
iter = cso_hash_erase(hash, iter); |
} |
cso_hash_delete(hash); |
} |
void |
xa_shaders_destroy(struct xa_shaders *sc) |
{ |
cache_destroy(sc->r->cso, sc->vs_hash, PIPE_SHADER_VERTEX); |
cache_destroy(sc->r->cso, sc->fs_hash, PIPE_SHADER_FRAGMENT); |
FREE(sc); |
} |
static INLINE void * |
shader_from_cache(struct pipe_context *pipe, |
unsigned type, struct cso_hash *hash, unsigned key) |
{ |
void *shader = 0; |
struct cso_hash_iter iter = cso_hash_find(hash, key); |
if (cso_hash_iter_is_null(iter)) { |
if (type == PIPE_SHADER_VERTEX) |
shader = create_vs(pipe, key); |
else |
shader = create_fs(pipe, key); |
cso_hash_insert(hash, key, shader); |
} else |
shader = (void *)cso_hash_iter_data(iter); |
return shader; |
} |
struct xa_shader |
xa_shaders_get(struct xa_shaders *sc, unsigned vs_traits, unsigned fs_traits) |
{ |
struct xa_shader shader = { NULL, NULL }; |
void *vs, *fs; |
vs = shader_from_cache(sc->r->pipe, PIPE_SHADER_VERTEX, |
sc->vs_hash, vs_traits); |
fs = shader_from_cache(sc->r->pipe, PIPE_SHADER_FRAGMENT, |
sc->fs_hash, fs_traits); |
debug_assert(vs && fs); |
if (!vs || !fs) |
return shader; |
shader.vs = vs; |
shader.fs = fs; |
return shader; |
} |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_tracker.c |
---|
0,0 → 1,461 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#include "xa_tracker.h" |
#include "xa_priv.h" |
#include "pipe/p_state.h" |
#include "pipe/p_format.h" |
#include "state_tracker/drm_driver.h" |
#include "util/u_inlines.h" |
/* |
* format_map [xa_surface_type][first..last in list]. |
* Needs to be updated when enum xa_formats is updated. |
*/ |
static const enum xa_formats preferred_a[] = { xa_format_a8 }; |
static const enum xa_formats preferred_argb[] = |
{ xa_format_a8r8g8b8, xa_format_x8r8g8b8, xa_format_r5g6b5, |
xa_format_x1r5g5b5 |
}; |
static const enum xa_formats preferred_z[] = |
{ xa_format_z32, xa_format_z24, xa_format_z16 }; |
static const enum xa_formats preferred_sz[] = |
{ xa_format_x8z24, xa_format_s8z24 }; |
static const enum xa_formats preferred_zs[] = |
{ xa_format_z24x8, xa_format_z24s8 }; |
static const enum xa_formats preferred_yuv[] = { xa_format_yuv8 }; |
static const enum xa_formats *preferred[] = |
{ NULL, preferred_a, preferred_argb, NULL, NULL, |
preferred_z, preferred_zs, preferred_sz, preferred_yuv |
}; |
static const unsigned int num_preferred[] = { 0, |
sizeof(preferred_a) / sizeof(enum xa_formats), |
sizeof(preferred_argb) / sizeof(enum xa_formats), |
0, |
0, |
sizeof(preferred_z) / sizeof(enum xa_formats), |
sizeof(preferred_zs) / sizeof(enum xa_formats), |
sizeof(preferred_sz) / sizeof(enum xa_formats), |
sizeof(preferred_yuv) / sizeof(enum xa_formats) |
}; |
static const unsigned int stype_bind[XA_LAST_SURFACE_TYPE] = { 0, |
PIPE_BIND_SAMPLER_VIEW, |
PIPE_BIND_SAMPLER_VIEW, |
PIPE_BIND_SAMPLER_VIEW, |
PIPE_BIND_SAMPLER_VIEW, |
PIPE_BIND_DEPTH_STENCIL, |
PIPE_BIND_DEPTH_STENCIL, |
PIPE_BIND_DEPTH_STENCIL, |
PIPE_BIND_SAMPLER_VIEW |
}; |
static struct xa_format_descriptor |
xa_get_pipe_format(enum xa_formats xa_format) |
{ |
struct xa_format_descriptor fdesc; |
fdesc.xa_format = xa_format; |
switch (xa_format) { |
case xa_format_a8r8g8b8: |
fdesc.format = PIPE_FORMAT_B8G8R8A8_UNORM; |
break; |
case xa_format_x8r8g8b8: |
fdesc.format = PIPE_FORMAT_B8G8R8X8_UNORM; |
break; |
case xa_format_r5g6b5: |
fdesc.format = PIPE_FORMAT_B5G6R5_UNORM; |
break; |
case xa_format_x1r5g5b5: |
fdesc.format = PIPE_FORMAT_B5G5R5A1_UNORM; |
break; |
case xa_format_a8: |
fdesc.format = PIPE_FORMAT_L8_UNORM; |
break; |
case xa_format_z24: |
fdesc.format = PIPE_FORMAT_Z24X8_UNORM; |
break; |
case xa_format_z16: |
fdesc.format = PIPE_FORMAT_Z16_UNORM; |
break; |
case xa_format_z32: |
fdesc.format = PIPE_FORMAT_Z32_UNORM; |
break; |
case xa_format_x8z24: |
fdesc.format = PIPE_FORMAT_Z24X8_UNORM; |
break; |
case xa_format_z24x8: |
fdesc.format = PIPE_FORMAT_X8Z24_UNORM; |
break; |
case xa_format_s8z24: |
fdesc.format = PIPE_FORMAT_Z24_UNORM_S8_UINT; |
break; |
case xa_format_z24s8: |
fdesc.format = PIPE_FORMAT_S8_UINT_Z24_UNORM; |
break; |
case xa_format_yuv8: |
fdesc.format = PIPE_FORMAT_L8_UNORM; |
break; |
default: |
fdesc.xa_format = xa_format_unknown; |
break; |
} |
return fdesc; |
} |
XA_EXPORT struct xa_tracker * |
xa_tracker_create(int drm_fd) |
{ |
struct xa_tracker *xa = calloc(1, sizeof(struct xa_tracker)); |
enum xa_surface_type stype; |
unsigned int num_formats; |
if (!xa) |
return NULL; |
xa->screen = driver_descriptor.create_screen(drm_fd); |
if (!xa->screen) |
goto out_no_screen; |
xa->default_ctx = xa_context_create(xa); |
if (!xa->default_ctx) |
goto out_no_pipe; |
num_formats = 0; |
for (stype = 0; stype < XA_LAST_SURFACE_TYPE; ++stype) |
num_formats += num_preferred[stype]; |
num_formats += 1; |
xa->supported_formats = calloc(num_formats, sizeof(*xa->supported_formats)); |
if (!xa->supported_formats) |
goto out_sf_alloc_fail; |
xa->supported_formats[0] = xa_format_unknown; |
num_formats = 1; |
memset(xa->format_map, 0, sizeof(xa->format_map)); |
for (stype = 0; stype < XA_LAST_SURFACE_TYPE; ++stype) { |
unsigned int bind = stype_bind[stype]; |
enum xa_formats xa_format; |
int i; |
for (i = 0; i < num_preferred[stype]; ++i) { |
xa_format = preferred[stype][i]; |
struct xa_format_descriptor fdesc = xa_get_pipe_format(xa_format); |
if (xa->screen->is_format_supported(xa->screen, fdesc.format, |
PIPE_TEXTURE_2D, 0, bind)) { |
if (xa->format_map[stype][0] == 0) |
xa->format_map[stype][0] = num_formats; |
xa->format_map[stype][1] = num_formats; |
xa->supported_formats[num_formats++] = xa_format; |
} |
} |
} |
return xa; |
out_sf_alloc_fail: |
xa_context_destroy(xa->default_ctx); |
out_no_pipe: |
xa->screen->destroy(xa->screen); |
out_no_screen: |
free(xa); |
return NULL; |
} |
XA_EXPORT void |
xa_tracker_destroy(struct xa_tracker *xa) |
{ |
free(xa->supported_formats); |
xa_context_destroy(xa->default_ctx); |
xa->screen->destroy(xa->screen); |
free(xa); |
} |
static int |
xa_flags_compat(unsigned int old_flags, unsigned int new_flags) |
{ |
unsigned int flag_diff = (old_flags ^ new_flags); |
if (flag_diff == 0) |
return 1; |
if (flag_diff & XA_FLAG_SHARED) |
return 0; |
/* |
* Don't recreate if we're dropping the render target flag. |
*/ |
if (flag_diff & XA_FLAG_RENDER_TARGET) |
return ((new_flags & XA_FLAG_RENDER_TARGET) == 0); |
/* |
* Don't recreate if we're dropping the scanout flag. |
*/ |
if (flag_diff & XA_FLAG_SCANOUT) |
return ((new_flags & XA_FLAG_SCANOUT) == 0); |
/* |
* Always recreate for unknown / unimplemented flags. |
*/ |
return 0; |
} |
static struct xa_format_descriptor |
xa_get_format_stype_depth(struct xa_tracker *xa, |
enum xa_surface_type stype, unsigned int depth) |
{ |
unsigned int i; |
struct xa_format_descriptor fdesc; |
int found = 0; |
for (i = xa->format_map[stype][0]; i <= xa->format_map[stype][1]; ++i) { |
fdesc = xa_get_pipe_format(xa->supported_formats[i]); |
if (fdesc.xa_format != xa_format_unknown && |
xa_format_depth(fdesc.xa_format) == depth) { |
found = 1; |
break; |
} |
} |
if (!found) |
fdesc.xa_format = xa_format_unknown; |
return fdesc; |
} |
XA_EXPORT int |
xa_format_check_supported(struct xa_tracker *xa, |
enum xa_formats xa_format, unsigned int flags) |
{ |
struct xa_format_descriptor fdesc = xa_get_pipe_format(xa_format); |
unsigned int bind; |
if (fdesc.xa_format == xa_format_unknown) |
return -XA_ERR_INVAL; |
bind = stype_bind[xa_format_type(fdesc.xa_format)]; |
if (flags & XA_FLAG_SHARED) |
bind |= PIPE_BIND_SHARED; |
if (flags & XA_FLAG_RENDER_TARGET) |
bind |= PIPE_BIND_RENDER_TARGET; |
if (flags & XA_FLAG_SCANOUT) |
bind |= PIPE_BIND_SCANOUT; |
if (!xa->screen->is_format_supported(xa->screen, fdesc.format, |
PIPE_TEXTURE_2D, 0, bind)) |
return -XA_ERR_INVAL; |
return XA_ERR_NONE; |
} |
XA_EXPORT struct xa_surface * |
xa_surface_create(struct xa_tracker *xa, |
int width, |
int height, |
int depth, |
enum xa_surface_type stype, |
enum xa_formats xa_format, unsigned int flags) |
{ |
struct pipe_resource *template; |
struct xa_surface *srf; |
struct xa_format_descriptor fdesc; |
if (xa_format == xa_format_unknown) |
fdesc = xa_get_format_stype_depth(xa, stype, depth); |
else |
fdesc = xa_get_pipe_format(xa_format); |
if (fdesc.xa_format == xa_format_unknown) |
return NULL; |
srf = calloc(1, sizeof(*srf)); |
if (!srf) |
return NULL; |
template = &srf->template; |
template->format = fdesc.format; |
template->target = PIPE_TEXTURE_2D; |
template->width0 = width; |
template->height0 = height; |
template->depth0 = 1; |
template->array_size = 1; |
template->last_level = 0; |
template->bind = stype_bind[xa_format_type(fdesc.xa_format)]; |
if (flags & XA_FLAG_SHARED) |
template->bind |= PIPE_BIND_SHARED; |
if (flags & XA_FLAG_RENDER_TARGET) |
template->bind |= PIPE_BIND_RENDER_TARGET; |
if (flags & XA_FLAG_SCANOUT) |
template->bind |= PIPE_BIND_SCANOUT; |
srf->tex = xa->screen->resource_create(xa->screen, template); |
if (!srf->tex) |
goto out_no_tex; |
srf->xa = xa; |
srf->flags = flags; |
srf->fdesc = fdesc; |
return srf; |
out_no_tex: |
free(srf); |
return NULL; |
} |
XA_EXPORT int |
xa_surface_redefine(struct xa_surface *srf, |
int width, |
int height, |
int depth, |
enum xa_surface_type stype, |
enum xa_formats xa_format, |
unsigned int new_flags, |
int copy_contents) |
{ |
struct pipe_resource *template = &srf->template; |
struct pipe_resource *texture; |
struct pipe_box src_box; |
struct xa_tracker *xa = srf->xa; |
int save_width; |
int save_height; |
unsigned int save_format; |
struct xa_format_descriptor fdesc; |
if (xa_format == xa_format_unknown) |
fdesc = xa_get_format_stype_depth(xa, stype, depth); |
else |
fdesc = xa_get_pipe_format(xa_format); |
if (width == template->width0 && height == template->height0 && |
template->format == fdesc.format && |
xa_flags_compat(srf->flags, new_flags)) |
return XA_ERR_NONE; |
template->bind = stype_bind[xa_format_type(fdesc.xa_format)]; |
if (new_flags & XA_FLAG_SHARED) |
template->bind |= PIPE_BIND_SHARED; |
if (new_flags & XA_FLAG_RENDER_TARGET) |
template->bind |= PIPE_BIND_RENDER_TARGET; |
if (new_flags & XA_FLAG_SCANOUT) |
template->bind |= PIPE_BIND_SCANOUT; |
if (copy_contents) { |
if (!xa_format_type_is_color(fdesc.xa_format) || |
xa_format_type(fdesc.xa_format) == xa_type_a) |
return -XA_ERR_INVAL; |
if (!xa->screen->is_format_supported(xa->screen, fdesc.format, |
PIPE_TEXTURE_2D, 0, |
template->bind | |
PIPE_BIND_RENDER_TARGET)) |
return -XA_ERR_INVAL; |
} |
save_width = template->width0; |
save_height = template->height0; |
save_format = template->format; |
template->width0 = width; |
template->height0 = height; |
template->format = fdesc.format; |
texture = xa->screen->resource_create(xa->screen, template); |
if (!texture) { |
template->width0 = save_width; |
template->height0 = save_height; |
template->format = save_format; |
return -XA_ERR_NORES; |
} |
if (copy_contents) { |
struct pipe_context *pipe = xa->default_ctx->pipe; |
u_box_origin_2d(xa_min(save_width, template->width0), |
xa_min(save_height, template->height0), &src_box); |
pipe->resource_copy_region(pipe, texture, |
0, 0, 0, 0, srf->tex, 0, &src_box); |
pipe->flush(pipe, &xa->default_ctx->last_fence, 0); |
} |
pipe_resource_reference(&srf->tex, texture); |
pipe_resource_reference(&texture, NULL); |
srf->fdesc = fdesc; |
srf->flags = new_flags; |
return XA_ERR_NONE; |
} |
XA_EXPORT void |
xa_surface_destroy(struct xa_surface *srf) |
{ |
pipe_resource_reference(&srf->tex, NULL); |
free(srf); |
} |
XA_EXPORT void |
xa_tracker_version(int *major, int *minor, int *patch) |
{ |
*major = XA_TRACKER_VERSION_MAJOR; |
*minor = XA_TRACKER_VERSION_MINOR; |
*patch = XA_TRACKER_VERSION_PATCH; |
} |
XA_EXPORT int |
xa_surface_handle(struct xa_surface *srf, |
uint32_t * handle, unsigned int *stride) |
{ |
struct winsys_handle whandle; |
struct pipe_screen *screen = srf->xa->screen; |
boolean res; |
memset(&whandle, 0, sizeof(whandle)); |
whandle.type = DRM_API_HANDLE_TYPE_SHARED; |
res = screen->resource_get_handle(screen, srf->tex, &whandle); |
if (!res) |
return -XA_ERR_INVAL; |
*handle = whandle.handle; |
*stride = whandle.stride; |
return XA_ERR_NONE; |
} |
XA_EXPORT enum xa_formats |
xa_surface_format(const struct xa_surface *srf) |
{ |
return srf->fdesc.xa_format; |
} |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_tracker.h |
---|
0,0 → 1,179 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
* The format encoding idea is partially borrowed from libpixman, but it is not |
* considered a "substantial part of the software", so the pixman copyright |
* is left out for simplicity, and acknowledgment is instead given in this way. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#ifndef _XA_TRACKER_H_ |
#define _XA_TRACKER_H_ |
#include <stdint.h> |
#define XA_TRACKER_VERSION_MAJOR 1 |
#define XA_TRACKER_VERSION_MINOR 0 |
#define XA_TRACKER_VERSION_PATCH 0 |
#define XA_FLAG_SHARED (1 << 0) |
#define XA_FLAG_RENDER_TARGET (1 << 1) |
#define XA_FLAG_SCANOUT (1 << 2) |
#define XA_MAP_READ (1 << 0) |
#define XA_MAP_WRITE (1 << 1) |
#define XA_ERR_NONE 0 |
#define XA_ERR_NORES 1 |
#define XA_ERR_INVAL 2 |
#define XA_ERR_BUSY 3 |
enum xa_surface_type { |
xa_type_other, |
xa_type_a, |
xa_type_argb, |
xa_type_abgr, |
xa_type_bgra, |
xa_type_z, |
xa_type_zs, |
xa_type_sz, |
xa_type_yuv_component |
}; |
/* |
* Note that these formats should not be assumed to be binary compatible with |
* pixman formats, but with the below macros and a format type map, |
* conversion should be simple. Macros for now. We might replace with |
* inline functions. |
*/ |
#define xa_format(bpp,type,a,r,g,b) (((bpp) << 24) | \ |
((type) << 16) | \ |
((a) << 12) | \ |
((r) << 8) | \ |
((g) << 4) | \ |
((b))) |
/* |
* Non-RGBA one- and two component formats. |
*/ |
#define xa_format_c(bpp,type,c1,c2) (((bpp) << 24) | \ |
((type) << 16) | \ |
((c1) << 8) | \ |
((c2))) |
#define xa_format_bpp(f) (((f) >> 24) ) |
#define xa_format_type(f) (((f) >> 16) & 0xff) |
#define xa_format_a(f) (((f) >> 12) & 0x0f) |
#define xa_format_r(f) (((f) >> 8) & 0x0f) |
#define xa_format_g(f) (((f) >> 4) & 0x0f) |
#define xa_format_b(f) (((f) ) & 0x0f) |
#define xa_format_rgb(f) (((f) ) & 0xfff) |
#define xa_format_c1(f) (((f) >> 8 ) & 0xff) |
#define xa_format_c2(f) (((f) ) & 0xff) |
#define xa_format_argb_depth(f) (xa_format_a(f) + \ |
xa_format_r(f) + \ |
xa_format_g(f) + \ |
xa_format_b(f)) |
#define xa_format_c_depth(f) (xa_format_c1(f) + \ |
xa_format_c2(f)) |
static inline int |
xa_format_type_is_color(uint32_t xa_format) |
{ |
return (xa_format_type(xa_format) < xa_type_z); |
} |
static inline unsigned int |
xa_format_depth(uint32_t xa_format) |
{ |
return ((xa_format_type_is_color(xa_format)) ? |
xa_format_argb_depth(xa_format) : xa_format_c_depth(xa_format)); |
} |
enum xa_formats { |
xa_format_unknown = 0, |
xa_format_a8 = xa_format(8, xa_type_a, 8, 0, 0, 0), |
xa_format_a8r8g8b8 = xa_format(32, xa_type_argb, 8, 8, 8, 8), |
xa_format_x8r8g8b8 = xa_format(32, xa_type_argb, 0, 8, 8, 8), |
xa_format_r5g6b5 = xa_format(16, xa_type_argb, 0, 5, 6, 5), |
xa_format_x1r5g5b5 = xa_format(16, xa_type_argb, 0, 5, 5, 5), |
xa_format_z16 = xa_format_c(16, xa_type_z, 16, 0), |
xa_format_z32 = xa_format_c(32, xa_type_z, 32, 0), |
xa_format_z24 = xa_format_c(32, xa_type_z, 24, 0), |
xa_format_x8z24 = xa_format_c(32, xa_type_sz, 24, 0), |
xa_format_s8z24 = xa_format_c(32, xa_type_sz, 24, 8), |
xa_format_z24x8 = xa_format_c(32, xa_type_zs, 24, 0), |
xa_format_z24s8 = xa_format_c(32, xa_type_zs, 24, 8), |
xa_format_yuv8 = xa_format_c(8, xa_type_yuv_component, 8, 0) |
}; |
struct xa_tracker; |
struct xa_surface; |
struct xa_box { |
uint16_t x1, y1, x2, y2; |
}; |
extern void xa_tracker_version(int *major, int *minor, int *patch); |
extern struct xa_tracker *xa_tracker_create(int drm_fd); |
extern void xa_tracker_destroy(struct xa_tracker *xa); |
extern int xa_format_check_supported(struct xa_tracker *xa, |
enum xa_formats xa_format, |
unsigned int flags); |
extern struct xa_surface *xa_surface_create(struct xa_tracker *xa, |
int width, |
int height, |
int depth, |
enum xa_surface_type stype, |
enum xa_formats pform, |
unsigned int flags); |
enum xa_formats xa_surface_format(const struct xa_surface *srf); |
extern void xa_surface_destroy(struct xa_surface *srf); |
extern int xa_surface_redefine(struct xa_surface *srf, |
int width, |
int height, |
int depth, |
enum xa_surface_type stype, |
enum xa_formats rgb_format, |
unsigned int new_flags, |
int copy_contents); |
extern int xa_surface_handle(struct xa_surface *srf, |
uint32_t * handle, unsigned int *byte_stride); |
#endif |
/contrib/sdk/sources/Mesa/mesa-9.2.5/src/gallium/state_trackers/xa/xa_yuv.c |
---|
0,0 → 1,162 |
/********************************************************** |
* Copyright 2009-2011 VMware, Inc. 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, 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 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. |
* |
********************************************************* |
* Authors: |
* Zack Rusin <zackr-at-vmware-dot-com> |
* Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
*/ |
#include "xa_context.h" |
#include "xa_priv.h" |
#include "util/u_inlines.h" |
#include "util/u_sampler.h" |
#include "util/u_surface.h" |
#include "cso_cache/cso_context.h" |
static void |
xa_yuv_bind_blend_state(struct xa_context *r) |
{ |
struct pipe_blend_state blend; |
memset(&blend, 0, sizeof(struct pipe_blend_state)); |
blend.rt[0].blend_enable = 0; |
blend.rt[0].colormask = PIPE_MASK_RGBA; |
/* porter&duff src */ |
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE; |
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE; |
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; |
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; |
cso_set_blend(r->cso, &blend); |
} |
static void |
xa_yuv_bind_shaders(struct xa_context *r) |
{ |
unsigned vs_traits = 0, fs_traits = 0; |
struct xa_shader shader; |
vs_traits |= VS_YUV; |
fs_traits |= FS_YUV; |
shader = xa_shaders_get(r->shaders, vs_traits, fs_traits); |
cso_set_vertex_shader_handle(r->cso, shader.vs); |
cso_set_fragment_shader_handle(r->cso, shader.fs); |
} |
static void |
xa_yuv_bind_samplers(struct xa_context *r, struct xa_surface *yuv[]) |
{ |
struct pipe_sampler_state *samplers[3]; |
struct pipe_sampler_state sampler; |
struct pipe_sampler_view view_templ; |
unsigned int i; |
memset(&sampler, 0, sizeof(struct pipe_sampler_state)); |
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP; |
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP; |
sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR; |
sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR; |
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; |
sampler.normalized_coords = 1; |
for (i = 0; i < 3; ++i) { |
samplers[i] = &sampler; |
u_sampler_view_default_template(&view_templ, yuv[i]->tex, |
yuv[i]->tex->format); |
r->bound_sampler_views[i] = |
r->pipe->create_sampler_view(r->pipe, yuv[i]->tex, &view_templ); |
} |
r->num_bound_samplers = 3; |
cso_set_samplers(r->cso, PIPE_SHADER_FRAGMENT, 3, (const struct pipe_sampler_state **)samplers); |
cso_set_sampler_views(r->cso, PIPE_SHADER_FRAGMENT, 3, r->bound_sampler_views); |
} |
static void |
xa_yuv_fs_constants(struct xa_context *r, const float conversion_matrix[]) |
{ |
const int param_bytes = 16 * sizeof(float); |
renderer_set_constants(r, PIPE_SHADER_FRAGMENT, |
conversion_matrix, param_bytes); |
} |
XA_EXPORT int |
xa_yuv_planar_blit(struct xa_context *r, |
int src_x, |
int src_y, |
int src_w, |
int src_h, |
int dst_x, |
int dst_y, |
int dst_w, |
int dst_h, |
struct xa_box *box, |
unsigned int num_boxes, |
const float conversion_matrix[], |
struct xa_surface *dst, struct xa_surface *yuv[]) |
{ |
float scale_x; |
float scale_y; |
int ret; |
if (dst_w == 0 || dst_h == 0) |
return XA_ERR_NONE; |
ret = xa_ctx_srf_create(r, dst); |
if (ret != XA_ERR_NONE) |
return -XA_ERR_NORES; |
renderer_bind_destination(r, r->srf, r->srf->width, r->srf->height); |
xa_yuv_bind_blend_state(r); |
xa_yuv_bind_shaders(r); |
xa_yuv_bind_samplers(r, yuv); |
xa_yuv_fs_constants(r, conversion_matrix); |
scale_x = (float)src_w / (float)dst_w; |
scale_y = (float)src_h / (float)dst_h; |
while (num_boxes--) { |
int x = box->x1; |
int y = box->y1; |
int w = box->x2 - box->x1; |
int h = box->y2 - box->y1; |
renderer_draw_yuv(r, |
(float)src_x + scale_x * (x - dst_x), |
(float)src_y + scale_y * (y - dst_y), |
scale_x * w, scale_y * h, x, y, w, h, yuv); |
box++; |
} |
r->pipe->flush(r->pipe, &r->last_fence, 0); |
xa_ctx_sampler_views_destroy(r); |
xa_ctx_srf_destroy(r); |
return XA_ERR_NONE; |
} |