commit
526187a054
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "${FEATURES}" == *ccache* && "${EBUILD_PHASE_FUNC}" == src_* ]]
|
||||
then
|
||||
if [[ "${CCACHE_DIR}" == "${EPREFIX}"/usr/ccache ]]
|
||||
then
|
||||
# Set the ccache dir to whatever CCACHE_DIR is + category + name of the package
|
||||
export CCACHE_DIR="${EPREFIX}"/usr/ccache/${CATEGORY}/${PN}
|
||||
mkdir -p "${CCACHE_DIR}" || die "Failed to create ccache directory"
|
||||
# Copy ccache.conf if it is found in "old" CCACHE_DIR
|
||||
if [ -f "${EPREFIX}"/usr/ccache/ccache.conf ]
|
||||
then
|
||||
cp "${EPREFIX}"/usr/ccache/ccache.conf /usr/ccache/"${CATEGORY}"/"${PN}"/ccache.conf || die "Failed to copy ccache config"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Verbose ebuild phase
|
||||
|
||||
if [ -n "${EBUILD_PHASE}" ] && [ ! "${EBUILD_PHASE}" = "depend" ]
|
||||
then
|
||||
echo "[ $(date +%H:%M:%S) ] ${EBUILD_PHASE^^} for version ${PV} of ${PN} from ${CATEGORY}"
|
||||
fi
|
|
@ -0,0 +1,768 @@
|
|||
#!/bin/bash
|
||||
# (C) Martin V\"ath <martin at mvath.de>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
FLAG_FILTER_C_CXX=(
|
||||
'-fall-intrinsics'
|
||||
'-fbackslash'
|
||||
'-fcray-pointer'
|
||||
'-fd-lines-as-*'
|
||||
'-fdec*'
|
||||
'-fdefault-*'
|
||||
'-fdollar-ok'
|
||||
'-ffixed-*'
|
||||
'-ffree-*'
|
||||
'-fimplicit-none'
|
||||
'-finteger-4-integer-8'
|
||||
'-fmax-identifier-length*'
|
||||
'-fmodule-private'
|
||||
'-fno-range-check'
|
||||
'-freal-*'
|
||||
'-ftest-forall-temp'
|
||||
'-std=f*'
|
||||
'-std=gnu'
|
||||
'-std=legacy'
|
||||
)
|
||||
|
||||
FLAG_FILTER_CXX_FORTRAN=(
|
||||
'-std=c1*'
|
||||
'-std=c8*'
|
||||
'-std=c9*'
|
||||
'-std=gnu1*'
|
||||
'-std=gnu8*'
|
||||
'-std=gnu9*'
|
||||
'-std=iso*'
|
||||
'-Wimplicit-function-declaration'
|
||||
)
|
||||
|
||||
FLAG_FILTER_C_FORTRAN=(
|
||||
'-fabi-*'
|
||||
'-faligned-new'
|
||||
'-fcheck-new'
|
||||
'-fconcepts'
|
||||
'-fconstexpr-*'
|
||||
'-fdeduce-init-list'
|
||||
'-fext*'
|
||||
'-ffor-scope'
|
||||
'-ffriend-injection'
|
||||
'-fms-extensions'
|
||||
'-fnew-inheriting-ctors'
|
||||
'-fnew-ttp-matching'
|
||||
'-fno-access-control'
|
||||
'-fno-elide-constructors'
|
||||
'-fno-enforce-eh-specs'
|
||||
'-fno-extern-tls-init'
|
||||
'-fno-for-scope'
|
||||
'-fno-gnu-keywords'
|
||||
'-fno-implement-inlines'
|
||||
'-fno-implicit-*'
|
||||
'-fno-nonansi-builtins'
|
||||
'-fno-operator-names'
|
||||
'-fno-optional-diags'
|
||||
'-fno-pretty-templates'
|
||||
'-fno-rtti'
|
||||
'-fno-threadsafe-statics'
|
||||
'-fno-use-cxa-get-exception-ptr'
|
||||
'-fno-weak'
|
||||
'-fnothrow-opt'
|
||||
'-fpermissive'
|
||||
'-frepo'
|
||||
'-fsized-deallocation'
|
||||
'-fstrict-enums'
|
||||
'-fstrong-eval-order'
|
||||
'-ftemplate-*'
|
||||
'-fuse-cxa-atexit'
|
||||
'-fvisibility-*'
|
||||
'-nostdinc++'
|
||||
'-std=c++*'
|
||||
'-std=gnu++*'
|
||||
'-Wabi*'
|
||||
'-Wctor-dtor-privacy'
|
||||
'-Wdelete-non-virtual-dtor'
|
||||
'-Weffc++'
|
||||
'-Wliteral-suffix'
|
||||
'-Wlto-type-mismatch'
|
||||
'-Wmultiple-inheritance'
|
||||
'-Wnamespaces'
|
||||
'-Wno-narrowing'
|
||||
'-Wno-non-template-friend'
|
||||
'-Wno-pmf-conversions'
|
||||
'-Wno-terminate'
|
||||
'-Wnoexcept'
|
||||
'-Wnon-virtual-dtor'
|
||||
'-Wold-style-cast'
|
||||
'-Woverloaded-virtual'
|
||||
'-Wregister'
|
||||
'-Wreorder'
|
||||
'-Wsign-promo'
|
||||
'-Wstrict-null-sentinel'
|
||||
'-Wtemplates'
|
||||
'-Wvirtual-inheritance'
|
||||
)
|
||||
|
||||
FLAG_FILTER_CFLAGS=(
|
||||
)
|
||||
|
||||
FLAG_FILTER_CXXFLAGS=(
|
||||
)
|
||||
|
||||
FLAG_FILTER_FORTRAN=(
|
||||
'-ansi'
|
||||
'-fallow-parameterless-variadic-functions'
|
||||
'-fcilkplus'
|
||||
'-fcond-mismatch'
|
||||
'-fdirectives-only'
|
||||
'-ffreestanding'
|
||||
'-fgimple'
|
||||
'-fgnu-tm'
|
||||
'-fgnu89-inline'
|
||||
'-fhosted'
|
||||
'-flax-vector-conversions'
|
||||
'-fms-extensions'
|
||||
'-fno-asm'
|
||||
'-fno-builtin*'
|
||||
'-fno-signed-bitfields'
|
||||
'-fno-unsigned-bitfields'
|
||||
'-fpermitted-flt-eval-methods*'
|
||||
'-fplan9-extensions'
|
||||
'-fsigned-*'
|
||||
'-fsso-struct*'
|
||||
'-funsigned-*'
|
||||
'-Wchkp'
|
||||
'-Wclobbered'
|
||||
'-Wformat*'
|
||||
'-Wvolatile-register-var'
|
||||
)
|
||||
|
||||
FLAG_FILTER_FFLAGS=(
|
||||
)
|
||||
|
||||
FLAG_FILTER_FCFLAGS=(
|
||||
)
|
||||
|
||||
FLAG_FILTER_F77FLAGS=(
|
||||
)
|
||||
|
||||
FLAG_FILTER_NONGNU=(
|
||||
'-fcf-protection*'
|
||||
'-fdevirtualize-at-ltrans'
|
||||
'-fdevirtualize-speculatively'
|
||||
'-fdirectives-only'
|
||||
'-ffat-lto-objects'
|
||||
'-fgcse*'
|
||||
'-fgraphite*'
|
||||
'-finline-functions'
|
||||
'-fipa-pta'
|
||||
'-fira-loop-pressure'
|
||||
'-fisolate-erroneous-paths-attribute'
|
||||
'-fivopts'
|
||||
'-flimit-function-alignment'
|
||||
'-floop*'
|
||||
'-flto=[0-9]*'
|
||||
'-flto=auto'
|
||||
'-flto=jobserver'
|
||||
'-flto-partition=*'
|
||||
'-flto-compression-level=*'
|
||||
'-fmodulo*'
|
||||
'-fno-enforce-eh-specs'
|
||||
'-fno-ident'
|
||||
'-fno-ipa-cp-clone'
|
||||
'-fno-plt' # causes various runtime segfaults for clang:6 compiled code
|
||||
'-fno-semantic-interposition'
|
||||
'-fnothrow-opt'
|
||||
'-fpredictive-commoning'
|
||||
'-frename-registers'
|
||||
'-freorder-functions'
|
||||
'-frerun-cse-after-loop'
|
||||
'-fsched*'
|
||||
'-fsection-anchors'
|
||||
'-fstack-clash-protection'
|
||||
'-ftree*'
|
||||
'-funsafe-loop*'
|
||||
'-fuse-linker-plugin'
|
||||
'-fvect-cost-model'
|
||||
'-fweb'
|
||||
'-fwhole-program'
|
||||
'-malign-data*'
|
||||
'-mfunction-return*'
|
||||
'-mindirect-branch*'
|
||||
'-mvectorize*'
|
||||
'-Wl,-z,retpolineplt' # does not work, currently
|
||||
)
|
||||
|
||||
FLAG_FILTER_GNU=(
|
||||
'-emit-llvm'
|
||||
'-flto=full'
|
||||
'-flto=thin'
|
||||
'-flto-jobs=*'
|
||||
'-fopenmp=*'
|
||||
'-frewrite-includes'
|
||||
'-fsanitize=cfi'
|
||||
'-fsanitize=safe-stack'
|
||||
'-mllvm'
|
||||
'-mretpoline*'
|
||||
'-polly*'
|
||||
'-Wl,-z,retpolineplt'
|
||||
)
|
||||
|
||||
FlagEval() {
|
||||
case $- in
|
||||
*f*) eval "$*";;
|
||||
*) set -f
|
||||
eval "$*"
|
||||
set +f;;
|
||||
esac
|
||||
}
|
||||
|
||||
FlagNodupAdd() {
|
||||
local addres addf addvar dups
|
||||
dups=$1
|
||||
shift
|
||||
addvar=$1
|
||||
shift
|
||||
eval addres=\$$addvar
|
||||
for addf
|
||||
do case " $addres $dups " in
|
||||
*[[:space:]]"$addf"[[:space:]]*)
|
||||
continue;;
|
||||
esac
|
||||
addres=$addres${addres:+\ }$addf
|
||||
done
|
||||
eval $addvar=\$addres
|
||||
}
|
||||
|
||||
FlagAdd() {
|
||||
FlagNodupAdd '' "$@"
|
||||
}
|
||||
|
||||
FlagSub() {
|
||||
local subres subpat subf subvar sublist
|
||||
subvar=$1
|
||||
shift
|
||||
subres=
|
||||
eval sublist=\$$subvar
|
||||
for subf in $sublist
|
||||
do for subpat
|
||||
do [ -n "${subpat:++}" ] || continue
|
||||
case $subf in
|
||||
$subpat)
|
||||
subf=
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
[ -z "${subf:++}" ] || subres=$subres${subres:+\ }$subf
|
||||
done
|
||||
eval $subvar=\$subres
|
||||
}
|
||||
|
||||
FlagReplace() {
|
||||
local repres repf repcurr repvar reppat
|
||||
repvar=$1
|
||||
shift
|
||||
eval repf=\$$repvar
|
||||
reppat=$1
|
||||
shift
|
||||
repres=
|
||||
for repcurr in $repf
|
||||
do case $repcurr in
|
||||
$reppat)
|
||||
$repfound && FlagAdd repres "$@"
|
||||
continue;;
|
||||
esac
|
||||
repres=$repres${repres:+\ }$repcurr
|
||||
done
|
||||
eval $repvar=\$repres
|
||||
}
|
||||
|
||||
FlagSet() {
|
||||
local setvar
|
||||
setvar=$1
|
||||
shift
|
||||
eval $setvar=\$*
|
||||
}
|
||||
|
||||
FlagAddCFlags() {
|
||||
FlagAdd CFLAGS "$@"
|
||||
FlagAdd CXXFLAGS "$@"
|
||||
}
|
||||
|
||||
FlagSubCFlags() {
|
||||
FlagSub CFLAGS "$@"
|
||||
FlagSub CXXFLAGS "$@"
|
||||
FlagSub CPPFLAGS "$@"
|
||||
FlagSub OPTCFLAGS "$@"
|
||||
FlagSub OPTCXXFLAGS "$@"
|
||||
FlagSub OPTCPPFLAGS "$@"
|
||||
}
|
||||
|
||||
FlagReplaceCFlags() {
|
||||
FlagReplace CFLAGS "$@"
|
||||
FlagReplace CXXFLAGS "$@"
|
||||
FlagReplace CPPFLAGS "$@"
|
||||
FlagSub OPTCFLAGS "$1"
|
||||
FlagSub OPTCXXFLAGS "$1"
|
||||
FlagSub OPTCPPFLAGS "$1"
|
||||
}
|
||||
|
||||
FlagSetCFlags() {
|
||||
FlagSet CFLAGS "$@"
|
||||
CXXFLAGS=$CFLAGS
|
||||
CPPFLAGS=
|
||||
OPTCFLAGS=
|
||||
OPTCXXFLAGS=
|
||||
OPTCPPFLAGS=
|
||||
}
|
||||
|
||||
FlagAddFFlags() {
|
||||
FlagAdd FFLAGS "$@"
|
||||
FlagAdd FCFLAGS "$@"
|
||||
FlagAdd F77FLAGS "$@"
|
||||
}
|
||||
|
||||
FlagSubFFlags() {
|
||||
FlagSub FFLAGS "$@"
|
||||
FlagSub FCFLAGS "$@"
|
||||
FlagSub F77FLAGS "$@"
|
||||
}
|
||||
|
||||
FlagReplaceFFlags() {
|
||||
FlagReplace FFLAGS "$@"
|
||||
FlagReplace FCFLAGS "$@"
|
||||
FlagReplace F77FLAGS "$@"
|
||||
}
|
||||
|
||||
FlagSetFFlags() {
|
||||
FlagSet FFLAGS "$@"
|
||||
FlagSet FCFLAGS "$@"
|
||||
FlagSet F77FLAGS "$@"
|
||||
}
|
||||
|
||||
FlagAddAllFlags() {
|
||||
FlagAddCFlags "$@"
|
||||
FlagAddFFlags "$@"
|
||||
}
|
||||
|
||||
FlagSubAllFlags() {
|
||||
FlagSubCFlags "$@"
|
||||
FlagSubFFlags "$@"
|
||||
FlagSub LDFLAGS "$@"
|
||||
FlagSub OPTLDFLAGS "$@"
|
||||
}
|
||||
|
||||
FlagReplaceAllFlags() {
|
||||
FlagReplaceCFlags "$@"
|
||||
FlagReplaceFFlags "$@"
|
||||
FlagSub LDFLAGS "$1"
|
||||
FlagSub OPTLDFLAGS "$1"
|
||||
}
|
||||
|
||||
FlagSetAllFlags() {
|
||||
FlagSetCFlags "$@"
|
||||
FlagSetFFlags "$@"
|
||||
LDFLAGS=
|
||||
OPTLDFLAGS=
|
||||
}
|
||||
|
||||
FlagAthlon() {
|
||||
FlagSubCFlags '-march=*'
|
||||
FlagAddCFlags '-march=athlon-4'
|
||||
command -v x86_64-pc-linux-gnu-gcc32 >/dev/null 2>&1 && \
|
||||
export CC=x86_64-pc-linux-gnu-gcc32
|
||||
command -v x86_64-pc-linux-gnu-g++32 >/dev/null 2>&1 && \
|
||||
export CXX=x86_64-pc-linux-gnu-g++32
|
||||
}
|
||||
|
||||
FlagExecute() {
|
||||
local ex exy excurr
|
||||
for excurr
|
||||
do case $excurr in
|
||||
'#'*)
|
||||
return;;
|
||||
'!'*)
|
||||
[ "$HOSTTYPE" = 'i686' ] || continue
|
||||
ex=${excurr#?};;
|
||||
'~'*)
|
||||
[ "$HOSTTYPE" = 'x86_64' ] || continue
|
||||
ex=${excurr#?};;
|
||||
*)
|
||||
ex=$excurr;;
|
||||
esac
|
||||
case $ex in
|
||||
/*/*)
|
||||
ex=${ex%/}
|
||||
ex=${ex#/}
|
||||
FlagEval FlagReplaceAllFlags "${ex%%/*}" "${ex#*/}";;
|
||||
'-'*)
|
||||
FlagAddCFlags "$ex";;
|
||||
'+flto*')
|
||||
FlagSubAllFlags '-flto*' '-fuse-linker-plugin' '-emit-llvm';;
|
||||
'+'*)
|
||||
FlagSubAllFlags "-${ex#+}";;
|
||||
'C*FLAGS-='*)
|
||||
FlagEval FlagSubCFlags ${ex#*-=};;
|
||||
'C*FLAGS+='*)
|
||||
FlagEval FlagAddCFlags ${ex#*+=};;
|
||||
'C*FLAGS='*)
|
||||
FlagEval FlagSetCFlags "${ex#*=}";;
|
||||
'C*FLAGS/=/'*/*)
|
||||
ex=${ex%/}
|
||||
ex=${ex#*/=/}
|
||||
FlagEval FlagReplaceCFlags "${ex%%/*}" "${ex#*/}";;
|
||||
'F*FLAGS-='*)
|
||||
FlagEval FlagSubFFlags ${ex#*-=};;
|
||||
'F*FLAGS+='*)
|
||||
FlagEval FlagAddFFlags ${ex#*+=};;
|
||||
'F*FLAGS='*)
|
||||
FlagEval FlagSetFFlags "${ex#*=}";;
|
||||
'F*FLAGS/=/'*/*)
|
||||
ex=${ex%/}
|
||||
ex=${ex#*/=/}
|
||||
FlagEval FlagReplaceFFlags "${ex%%/*}" "${ex#*/}";;
|
||||
'*FLAGS-='*)
|
||||
FlagEval FlagSubAllFlags ${ex#*-=};;
|
||||
'*FLAGS+='*)
|
||||
FlagEval FlagAddAllFlags ${ex#*+=};;
|
||||
'*FLAGS='*)
|
||||
FlagEval FlagSetAllFlags "${ex#*=}";;
|
||||
'*FLAGS/=/'*/*)
|
||||
ex=${ex%/}
|
||||
ex=${ex#*/=/}
|
||||
FlagEval FlagReplaceAllFlags "${ex%%/*}" "${ex#*/}";;
|
||||
'ATHLON32')
|
||||
FlagAthlon;;
|
||||
'NOC*OPT='*|'NOC*='*)
|
||||
FlagEval FlagSet NOCOPT "${ex#*=}"
|
||||
NOCXXOPT=$NOCOPT
|
||||
NOCPPOPT=$NOCOPT;;
|
||||
'NO*OPT='*)
|
||||
FlagEval FlagSet NOCOPT "${ex#*=}"
|
||||
NOCXXOPT=$NOCOPT
|
||||
NOCPPOPT=$NOCOPT
|
||||
NOLDOPT=$NOCOPT;;
|
||||
'NOLD*='*)
|
||||
FlagEval FlagSet NOLDOPT "${ex#*=}"
|
||||
NOLDADD=$NOLDOPT;;
|
||||
'NO*'*)
|
||||
FlagEval FlagSet NOCOPT "${ex#*=}"
|
||||
NOCXXOPT=$NOCOPT
|
||||
NOCPPOPT=$NOCOPT
|
||||
NOLDOPT=$NOCOPT
|
||||
NOLDADD=$NOCOPT
|
||||
NOFFLAGS=$NOCOPT
|
||||
NOFCFLAGS=$NOCOPT
|
||||
NOF77FLAGS=$NOCOPT;;
|
||||
'SAFE')
|
||||
NOCOPT=1
|
||||
NOCXXOPT=1
|
||||
NOCPPOPT=1
|
||||
NOLDOPT=1
|
||||
MESONDEDUP=1
|
||||
LDFLAGS=
|
||||
CONFIG_SITE=
|
||||
NOLAFILEREMOVE=1
|
||||
unset CMAKE_MAKEFILE_GENERATOR;;
|
||||
*' '*'='*)
|
||||
FlagEval "$ex";;
|
||||
*'/=/'*'/'*)
|
||||
ex=${ex%/}
|
||||
exy=${ex#*/=/}
|
||||
FlagEval FlagReplace "${ex%%/=/*}" "${exy%%/*}" "${exy#*/}";;
|
||||
*'-='*)
|
||||
FlagEval FlagSub "${ex%%-=*}" ${ex#*-=};;
|
||||
*'+='*)
|
||||
FlagEval FlagAdd "${ex%%+=*}" ${ex#*+=};;
|
||||
*'='*)
|
||||
FlagEval FlagSet "${ex%%=*}" "${ex#*=}";;
|
||||
*)
|
||||
FlagEval "$ex";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
FlagMask() {
|
||||
if command -v masked-packages >/dev/null 2>&1
|
||||
then
|
||||
FlagMask() {
|
||||
masked-packages -qm "$1" -- "$CATEGORY/$PF:${SLOT:-0}${PORTAGE_REPO_NAME:+::}${PORTAGE_REPO_NAME-}"
|
||||
}
|
||||
else
|
||||
FlagMask() {
|
||||
local add=
|
||||
case ${1%::*} in
|
||||
*':'*)
|
||||
add=:${SLOT:-0};;
|
||||
esac
|
||||
case $1 in
|
||||
*'::'*)
|
||||
add=$add::$PORTAGE_REPO_NAME;;
|
||||
esac
|
||||
case $1 in
|
||||
'~'*)
|
||||
case "~$CATEGORY/$PN-$PV$add" in
|
||||
$1)
|
||||
return;;
|
||||
esac;;
|
||||
'='*)
|
||||
case "=$CATEGORY/$PF$add" in
|
||||
$1)
|
||||
return;;
|
||||
esac;;
|
||||
*)
|
||||
case "$CATEGORY/$PN$add" in
|
||||
$1)
|
||||
return;;
|
||||
esac;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
FlagMask "$@"
|
||||
}
|
||||
|
||||
FlagParseLine() {
|
||||
local scanp scanl scansaveifs
|
||||
scanl=$2
|
||||
while :
|
||||
do case $scanl in
|
||||
[[:space:]]*)
|
||||
scanl=${scanl#?}
|
||||
continue;;
|
||||
'#'*)
|
||||
return;;
|
||||
*[[:space:]]*)
|
||||
break;;
|
||||
esac
|
||||
return
|
||||
done
|
||||
scanp=${scanl%%[[:space:]]*}
|
||||
scanl=${scanl#*[[:space:]]}
|
||||
[ -n "${scanl:++}" ] || return 0
|
||||
FlagMask "$scanp" || return 0
|
||||
scansaveifs=$IFS
|
||||
IFS=$1
|
||||
BashrcdEcho "$scanfile -> $scanp: $scanl"
|
||||
FlagEval FlagExecute $scanl
|
||||
IFS=$scansaveifs
|
||||
}
|
||||
|
||||
FlagScanFiles() {
|
||||
local scanfile scanl oldifs scanifs
|
||||
scanifs=$IFS
|
||||
IFS=
|
||||
for scanfile
|
||||
do [ -z "${scanfile:++}" ] && continue
|
||||
test -r "$scanfile" || continue
|
||||
while read -r scanl
|
||||
do FlagParseLine "$scanifs" "$scanl"
|
||||
done <"$scanfile"
|
||||
done
|
||||
IFS=$scanifs
|
||||
}
|
||||
|
||||
FlagScanDir() {
|
||||
local scantmp scanifs scanfile
|
||||
scanifs=$IFS
|
||||
if test -d "$1"
|
||||
then IFS='
|
||||
'
|
||||
for scantmp in `find -L "$1" \
|
||||
'(' '(' -name '.*' -o -name '*~' ')' -prune ')' -o \
|
||||
-type f -print`
|
||||
do IFS=$scanifs
|
||||
FlagScanFiles "$scantmp"
|
||||
done
|
||||
else FlagScanFiles "$1"
|
||||
fi
|
||||
scanfile='FLAG_ADDLINES'
|
||||
IFS='
|
||||
'
|
||||
for scantmp in $FLAG_ADDLINES
|
||||
do FlagParseLine "$scanifs" "$scantmp"
|
||||
done
|
||||
IFS=$scanifs
|
||||
}
|
||||
|
||||
FlagSetUseNonGNU() {
|
||||
case $CC$CXX in
|
||||
*clang*)
|
||||
return 0;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
FlagSetNonGNU() {
|
||||
: ${NOLDADD:=1}
|
||||
FlagSubAllFlags "${FLAG_FILTER_NONGNU[@]}"
|
||||
FlagReplaceAllFlags '-fstack-check*' '-fstack-check'
|
||||
# FlagAddCFlags '-flto' '-emit-llvm'
|
||||
}
|
||||
|
||||
FlagSetGNU() {
|
||||
FlagSubAllFlags "${FLAG_FILTER_GNU[@]}"
|
||||
}
|
||||
|
||||
FlagMesonDedup() {
|
||||
local newld=
|
||||
FlagNodupAdd "$CFLAGS $CXXFLAGS $CPPFLAGS $FFLAGS $FCFLAGS $F77FLAGS" \
|
||||
newld $LDFLAGS
|
||||
LDFLAGS=$newld
|
||||
}
|
||||
|
||||
FlagSetFlags() {
|
||||
local ld i
|
||||
ld=
|
||||
: ${PGO_PARENT:=/var/cache/pgo}
|
||||
: ${PGO_DIR:=$PGO_PARENT/$CATEGORY:$P}
|
||||
FlagScanDir "${PORTAGE_CONFIGROOT%/}/etc/portage/package.cflags"
|
||||
[ -z "${USE_NONGNU++}" ] && FlagSetUseNonGNU && USE_NONGNU=1
|
||||
if BashrcdTrue "${USE_NONGNU-}"
|
||||
then FlagSetNonGNU
|
||||
else FlagSetGNU
|
||||
fi
|
||||
if [ -n "$FLAG_ADD" ]
|
||||
then BashrcdEcho "FLAG_ADD: $FLAG_ADD"
|
||||
FlagEval FlagExecute "$FLAG_ADD"
|
||||
fi
|
||||
PGO_DIR=${PGO_DIR%/}
|
||||
case ${PGO_DIR:-/} in
|
||||
/)
|
||||
error 'PGO_DIR must not be empty'
|
||||
false;;
|
||||
/*)
|
||||
:;;
|
||||
*)
|
||||
error 'PGO_DIR must be an absolute path'
|
||||
false;;
|
||||
esac || {
|
||||
die 'Bad PGO_DIR'
|
||||
exit 2
|
||||
}
|
||||
use_pgo=false
|
||||
if test -r "$PGO_DIR"
|
||||
then unset PGO
|
||||
BashrcdTrue $NOPGO || use_pgo=:
|
||||
fi
|
||||
if BashrcdTrue $PGO
|
||||
then FlagAddCFlags "-fprofile-generate=$PGO_DIR" \
|
||||
-fvpt -fprofile-arcs
|
||||
FlagAdd LDFLAGS -fprofile-arcs
|
||||
addpredict "$PGO_PARENT"
|
||||
elif $use_pgo
|
||||
then FlagAddCFlags "-fprofile-use=$PGO_DIR" \
|
||||
-fvpt -fbranch-probabilities -fprofile-correction
|
||||
else : ${KEEPPGO:=:}
|
||||
fi
|
||||
BashrcdTrue $NOLDOPT || FlagAdd LDFLAGS $OPTLDFLAGS
|
||||
BashrcdTrue $NOCADD || BashrcdTrue $MESONDEDUP || \
|
||||
case " $LDFLAGS $CFLAGS $CXXFLAGS" in
|
||||
*[[:space:]]'-flto'*)
|
||||
ld="$CFLAGS $CXXFLAGS";;
|
||||
esac
|
||||
BashrcdTrue $NOLDADD || BashrcdTrue $MESONDEDUP || FlagAddCFlags $LDFLAGS
|
||||
FlagAdd LDFLAGS $ld
|
||||
BashrcdTrue $NOCOPT || FlagAdd CFLAGS $OPTCFLAGS
|
||||
BashrcdTrue $NOCXXOPT || FlagAdd CXXFLAGS $OPTCXXFLAGS
|
||||
BashrcdTrue $NOCPPOPT || FlagAdd CPPFLAGS $OPTCPPFLAGS
|
||||
BashrcdTrue $NOFFLAGS || FFLAGS=$CFLAGS
|
||||
BashrcdTrue $NOFCFLAGS || FCFLAGS=$FFLAGS
|
||||
BashrcdTrue $NOF77FLAGS || F77FLAGS=$FFLAGS
|
||||
BashrcdTrue $NOFILTER_CXXFLAGS || FlagSub CXXFLAGS \
|
||||
"${FLAG_FILTER_C_CXX[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" \
|
||||
"${FLAG_FILTER_CXXFLAGS[@]}"
|
||||
BashrcdTrue $NOFILTER_CFLAGS || FlagSub CFLAGS \
|
||||
"${FLAG_FILTER_C_CXX[@]}" "${FLAG_FILTER_C_FORTRAN[@]}" \
|
||||
"${FLAG_FILTER_CFLAGS[@]}"
|
||||
BashrcdTrue $NOFILTER_FFLAGS || FlagSub FFLAGS \
|
||||
"${FLAG_FILTER_C_FORTRAN[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" \
|
||||
"${FLAG_FILTER_FORTRAN[@]}" "${FLAG_FILTER_FFLAGS[@]}"
|
||||
BashrcdTrue $NOFILTER_FCFLAGS || FlagSub FCFLAGS \
|
||||
"${FLAG_FILTER_C_FORTRAN[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" \
|
||||
"${FLAG_FILTER_FORTRAN[@]}" "${FLAG_FILTER_FCFLAGS[@]}"
|
||||
BashrcdTrue $NOFILTER_F77FLAGS || FlagSub FCFLAGS \
|
||||
"${FLAG_FILTER_C_FORTRAN[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" \
|
||||
"${FLAG_FILTER_FORTRAN[@]}" "${FLAG_FILTER_F77LAGS[@]}"
|
||||
! BashrcdTrue $MESONDEDUP || FlagMesonDedup
|
||||
unset OPTCFLAGS OPTCXXFLAGS OPTCPPFLAGS OPTLDFLAGS
|
||||
unset NOLDOPT NOLDADD NOCOPT NOCXXOPT NOFFLAGS NOFCFLAGS NOF77FLAGS
|
||||
unset NOFILTER_CXXFLAGS NOFILTER_CFLAGS
|
||||
unset NOFILTER_FFLAGS NOFILTER_FCFLAGS NOFILTER_F77FLAGS
|
||||
}
|
||||
|
||||
FlagInfoExport() {
|
||||
local out
|
||||
for out in FEATURES CFLAGS CXXFLAGS CPPFLAGS FFLAGS FCFLAGS F77FLAGS \
|
||||
LDFLAGS MAKEOPTS EXTRA_ECONF EXTRA_EMAKE USE_NONGNU
|
||||
do eval "if [ -n \"\${$out:++}\" ]
|
||||
then export $out
|
||||
BashrcdEcho \"$out='\$$out'\"
|
||||
else unset $out
|
||||
fi"
|
||||
done
|
||||
if BashrcdTrue $PGO
|
||||
then BashrcdEcho "Create PGO into $PGO_DIR"
|
||||
elif $use_pgo
|
||||
then BashrcdEcho "Using PGO from $PGO_DIR"
|
||||
fi
|
||||
out=`${CC:-gcc} --version | head -n 1` || out=
|
||||
BashrcdEcho "${out:-cannot determine gcc version}"
|
||||
out=`${CXX:-g++} --version | head -n 1` || out=
|
||||
BashrcdEcho "${out:-cannot determine g++ version}"
|
||||
out=`${LD:-ld} --version | head -n 1` || out=
|
||||
BashrcdEcho "${out:-cannot determine ld version}"
|
||||
BashrcdEcho "`uname -a`"
|
||||
}
|
||||
|
||||
FlagCompile() {
|
||||
eerror \
|
||||
"${PORTAGE_CONFIGROOT%/}/etc/portage/bashrc.d/*flag.sh strange order of EBUILD_PHASE:"
|
||||
die "compile or preinst before setup"
|
||||
exit 2
|
||||
}
|
||||
|
||||
FlagPreinst() {
|
||||
FlagCompile
|
||||
}
|
||||
|
||||
FlagSetup() {
|
||||
FlagCompile() {
|
||||
:
|
||||
}
|
||||
local use_pgo
|
||||
FlagSetFlags
|
||||
if BashrcdTrue $PGO
|
||||
then
|
||||
FlagPreinst() {
|
||||
test -d "$PGO_DIR" || mkdir -p -m +1777 -- "$PGO_DIR" || {
|
||||
eerror "cannot create pgo directory $PGO_DIR"
|
||||
die 'cannot create PGO_DIR'
|
||||
exit 2
|
||||
}
|
||||
ewarn "$CATEGORY/$PN will write profile info to world-writable"
|
||||
ewarn "$PGO_DIR"
|
||||
ewarn 'Reemerge it soon for an optimized version and removal of that directory'
|
||||
}
|
||||
elif BashrcdTrue $KEEPPGO
|
||||
then
|
||||
FlagPreinst() {
|
||||
:
|
||||
}
|
||||
else
|
||||
FlagPreinst() {
|
||||
test -d "$PGO_DIR" || return 0
|
||||
BashrcdLog "removing pgo directory $PGO_DIR"
|
||||
rm -r -f -- "$PGO_DIR" || {
|
||||
eerror "cannot remove pgo directory $PGO_DIR"
|
||||
die 'cannot remove PGO_DIR'
|
||||
exit 2
|
||||
}
|
||||
local g
|
||||
g=${PGO_DIR%/*}
|
||||
[ -z "$g" ] || rmdir -p -- "$g" >/dev/null 2>&1
|
||||
}
|
||||
fi
|
||||
FlagInfoExport
|
||||
}
|
||||
|
||||
BashrcdPhase compile FlagCompile
|
||||
BashrcdPhase preinst FlagPreinst
|
||||
BashrcdPhase setup FlagSetup
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
# (C) Martin V\"ath <martin at mvath.de>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
QlopSetup() {
|
||||
local num sec hour min date
|
||||
! BashrcdTrue "${NOQLOP-}" && command -v qlop >/dev/null 2>&1 || return 0
|
||||
qlop -amH -- "$CATEGORY/$PN"
|
||||
qlop -tmH -- "$CATEGORY/$PN"
|
||||
command -v title >/dev/null 2>&1 || return 0
|
||||
num=$(tail -n1 /var/log/emerge.log | \
|
||||
sed -e 's/^.*(\([0-9]*\) of \([0-9]*\)).*$/\1|\2/') \
|
||||
&& [ -n "$num" ] || {
|
||||
date=$(date +%T)
|
||||
title "emerge $date $PN"
|
||||
return
|
||||
}
|
||||
case ${QLOPCOUNT:-1} in
|
||||
*[!0123456789]*)
|
||||
sec=$(qlop -ACMm -- "$CATEGORY/$PN" | awk \
|
||||
'/[[:space:]][0123456789]+$/{a=$NF}
|
||||
END{if(a!=""){print a}}');;
|
||||
[123456789]*)
|
||||
sec=$(qlop -tCMm -- "$CATEGORY/$PN" | \
|
||||
awk -v 'i=0' -v 'm=0' -v "n=${QLOPCOUNT:-3}" \
|
||||
'/[[:space:]][0123456789]+$/{a[i++]=$NF;if(i>m){m=i};if(i>=n){i=0}}
|
||||
END{s=0;for(i=m;i>0;){s+=a[--i]};if(m>0){print int(s/m+1/2)}}');;
|
||||
*)
|
||||
false;;
|
||||
esac && [ -n "$sec" ] || {
|
||||
date=$(date +%T)
|
||||
title "emerge $date $num $PN"
|
||||
return
|
||||
}
|
||||
hour=$(( $sec / 3600 ))
|
||||
[ "$hour" -gt 0 ] || hour=
|
||||
hour=$hour${hour:+:}
|
||||
sec=$(( $sec % 3600 ))
|
||||
min=$(( $sec / 60 ))
|
||||
sec=$(( $sec % 60 ))
|
||||
[ "$min" -gt 9 ] || min=0$min
|
||||
[ "$sec" -gt 9 ] || sec=0$sec
|
||||
date=$(date +%T)
|
||||
title "emerge $date $num $PN $hour$min:$sec"
|
||||
}
|
||||
|
||||
BashrcdPhase setup QlopSetup
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/bashrc.d/41-lto-patch.sh
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/bashrc.d/43-lto-no-common.sh
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
# (C) Martin V\"ath <martin at mvath.de>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
# Portage explicitly unsets all CCACHE_* variables in each phase.
|
||||
# Therefore, we save them to BASHRCD_CCACHE_* in the setup phase;
|
||||
# in all later phases, we restore CCACHE_* from these variables
|
||||
CcacheSetup() {
|
||||
local i
|
||||
: ${CCACHE_BASEDIR=${PORTAGE_TMPDIR:-/var/tmp}/portage}
|
||||
: ${CCACHE_SLOPPINESS='file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches,pch_defines'}
|
||||
: ${CCACHE_COMPRESS=true}
|
||||
if BashrcdTrue $USE_NONGNU && BashrcdTrue $CCACHE_CPP2_OPTIONAL
|
||||
then : ${CCACHE_CPP2=true}
|
||||
fi
|
||||
# Default to NOHASHDIR unless contrary is specified
|
||||
BashrcdTrue "${CCACHE_HASHDIR-}" || CCACHE_NOHASHDIR=true
|
||||
for i in ${!CCACHE_*}
|
||||
do if eval "BashrcdTrue \$$i"
|
||||
then eval BASHRCD_$i=\$$i
|
||||
export $i
|
||||
else unset $i
|
||||
fi
|
||||
done
|
||||
CcacheRestore() {
|
||||
local i j
|
||||
unset ${!CCACHE_*}
|
||||
for i in ${!BASHRCD_CCACHE_*}
|
||||
do j=${i##BASHRCD_}
|
||||
eval $j=\$$i
|
||||
export $j
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
CcacheRestore() {
|
||||
:
|
||||
}
|
||||
|
||||
# Register CcacheRestore before CcacheSetup to save time in setup phase
|
||||
BashrcdPhase all CcacheRestore
|
||||
BashrcdPhase setup CcacheSetup
|
|
@ -0,0 +1,412 @@
|
|||
#!/bin/bash
|
||||
# (C) Martin V\"ath <martin at mvath.de>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
ALL_LOCALES="
|
||||
aa
|
||||
af
|
||||
af_ZA
|
||||
am
|
||||
am_ET
|
||||
ang
|
||||
ar
|
||||
ar_AE
|
||||
ar_BH
|
||||
ar_DZ
|
||||
ar_EG
|
||||
ar_IN
|
||||
ar_IQ
|
||||
ar_JO
|
||||
ar_KW
|
||||
ar_LB
|
||||
ar_LY
|
||||
ar_MA
|
||||
ar_OM
|
||||
ar_QA
|
||||
ar_SA
|
||||
ar_SD
|
||||
ar_SY
|
||||
ar_TN
|
||||
ar_YE
|
||||
as
|
||||
ast
|
||||
az
|
||||
az_AZ
|
||||
az_IR
|
||||
be
|
||||
be@latin
|
||||
be_BY
|
||||
bg
|
||||
bg_BG
|
||||
bn
|
||||
bn_IN
|
||||
br
|
||||
br_FR
|
||||
bs
|
||||
bs_BA
|
||||
byn
|
||||
ca
|
||||
ca@valencia
|
||||
ca_ES
|
||||
ca_ES@euro
|
||||
ca_ES@valencia
|
||||
chs
|
||||
cht
|
||||
crh
|
||||
cs
|
||||
cs_CZ
|
||||
cy
|
||||
cy_GB
|
||||
cz
|
||||
da
|
||||
da_DK
|
||||
de
|
||||
de_AT
|
||||
de_AT@euro
|
||||
de_BE
|
||||
de_BE@euro
|
||||
de_CH
|
||||
de_DE
|
||||
de_DE.UTF-8
|
||||
de_DE@euro
|
||||
de_LU
|
||||
de_LU@euro
|
||||
dk
|
||||
dv
|
||||
dz
|
||||
el
|
||||
el_GR
|
||||
el_GR.UTF-8
|
||||
el_GR@euro
|
||||
en
|
||||
en@IPA
|
||||
en@boldquot
|
||||
en@quot
|
||||
en@shaw
|
||||
en_AU
|
||||
en_BW
|
||||
en_CA
|
||||
en_DK
|
||||
en_GB
|
||||
en_GB.UTF-8
|
||||
en_HK
|
||||
en_IE
|
||||
en_IE@euro
|
||||
en_IN
|
||||
en_NZ
|
||||
en_PH
|
||||
en_RN
|
||||
en_SG
|
||||
en_UK
|
||||
en_US
|
||||
en_US.UTF-8
|
||||
en_ZA
|
||||
en_ZW
|
||||
eo
|
||||
eo_EO
|
||||
es
|
||||
es_AR
|
||||
es_BO
|
||||
es_CL
|
||||
es_CO
|
||||
es_CR
|
||||
es_DO
|
||||
es_EC
|
||||
es_ES
|
||||
es_ES.UTF-8
|
||||
es_ES@euro
|
||||
es_GT
|
||||
es_HN
|
||||
es_MX
|
||||
es_NI
|
||||
es_PA
|
||||
es_PE
|
||||
es_PR
|
||||
es_PY
|
||||
es_SV
|
||||
es_US
|
||||
es_UY
|
||||
es_VE
|
||||
et
|
||||
et_EE
|
||||
eu
|
||||
eu_ES
|
||||
eu_ES@euro
|
||||
fa
|
||||
fa_IR
|
||||
fa_IR.UTF-8
|
||||
fi
|
||||
fi_FI
|
||||
fi_FI@euro
|
||||
fo
|
||||
fo_FO
|
||||
fr
|
||||
fr_BE
|
||||
fr_BE@euro
|
||||
fr_CA
|
||||
fr_CH
|
||||
fr_FR
|
||||
fr_FR.UTF-8
|
||||
fr_FR@euro
|
||||
fr_LU
|
||||
fr_LU@euro
|
||||
fur
|
||||
fy
|
||||
ga
|
||||
ga_IE
|
||||
ga_IE@euro
|
||||
gd
|
||||
gd_GB
|
||||
gez
|
||||
gl
|
||||
gl_ES
|
||||
gl_ES@euro
|
||||
gr
|
||||
gu
|
||||
gv
|
||||
gv_GB
|
||||
haw
|
||||
he
|
||||
he_IL
|
||||
hi
|
||||
hi_IN
|
||||
hi_IN.UTF-8
|
||||
hr
|
||||
hr_HR
|
||||
hu
|
||||
hu_HU
|
||||
hy
|
||||
hy_AM
|
||||
ia
|
||||
id
|
||||
id_ID
|
||||
is
|
||||
is_IS
|
||||
it
|
||||
it_CH
|
||||
it_IT
|
||||
it_IT@euro
|
||||
iu
|
||||
iw
|
||||
iw_IL
|
||||
ja
|
||||
ja_JP
|
||||
ja_JP.EUC
|
||||
ja_JP.EUC-JP
|
||||
ja_JP.UTF-8
|
||||
ja_JP.eucJP
|
||||
ka
|
||||
ka_GE
|
||||
kk
|
||||
kl
|
||||
kl_GL
|
||||
km
|
||||
km_KH
|
||||
kn
|
||||
ko
|
||||
ko_KR
|
||||
ko_KR.EUC-KR
|
||||
ko_KR.UTF-8
|
||||
kok
|
||||
ku
|
||||
kw
|
||||
kw_GB
|
||||
ky
|
||||
la
|
||||
lg
|
||||
li
|
||||
lo
|
||||
lt
|
||||
lt_LT
|
||||
lv
|
||||
lv_LV
|
||||
mai
|
||||
mg
|
||||
mhr
|
||||
mi
|
||||
mi_NZ
|
||||
mk
|
||||
mk_MK
|
||||
ml
|
||||
mn
|
||||
mr
|
||||
mr_IN
|
||||
mr_IN.UTF-8
|
||||
ms
|
||||
ms_MY
|
||||
mt
|
||||
mt_MT
|
||||
my
|
||||
my_MM
|
||||
nb
|
||||
nb_NO
|
||||
nds
|
||||
ne
|
||||
nl
|
||||
nl_BE
|
||||
nl_BE@euro
|
||||
nl_NL
|
||||
nl_NL@euro
|
||||
nn
|
||||
nn_NO
|
||||
no
|
||||
no_NO
|
||||
nso
|
||||
nyc
|
||||
oc
|
||||
oc_FR
|
||||
om
|
||||
or
|
||||
pa
|
||||
pl
|
||||
pl_PL
|
||||
ps
|
||||
pt
|
||||
pt_BR
|
||||
pt_PT
|
||||
pt_PT@euro
|
||||
rm
|
||||
ro
|
||||
ro_RO
|
||||
ru
|
||||
ru_RU
|
||||
ru_RU.KOI8-R
|
||||
ru_RU.UTF-8
|
||||
ru_UA
|
||||
rw
|
||||
sa
|
||||
si
|
||||
sid
|
||||
sk
|
||||
sk_SK
|
||||
sl
|
||||
sl_SI
|
||||
so
|
||||
sp
|
||||
sq
|
||||
sq_AL
|
||||
sr
|
||||
sr@Latn
|
||||
sr@ije
|
||||
sr@latin
|
||||
sr_RS
|
||||
sr_YU
|
||||
sr_YU@cyrillic
|
||||
sv
|
||||
sv_FI
|
||||
sv_FI@euro
|
||||
sv_SE
|
||||
sw
|
||||
syr
|
||||
ta
|
||||
ta_IN
|
||||
te
|
||||
te_IN
|
||||
tg
|
||||
tg_TJ
|
||||
th
|
||||
th_TH
|
||||
ti
|
||||
ti_ER
|
||||
ti_ET
|
||||
tig
|
||||
tk
|
||||
tl
|
||||
tl_PH
|
||||
tr
|
||||
tr_TR
|
||||
tt
|
||||
tt_RU
|
||||
ug
|
||||
uk
|
||||
uk_UA
|
||||
ur
|
||||
ur_PK
|
||||
uz
|
||||
uz@Latn
|
||||
uz_UZ
|
||||
ve
|
||||
vi
|
||||
vi_VN
|
||||
vi_VN.UTF-8
|
||||
wa
|
||||
wal
|
||||
wo
|
||||
xh
|
||||
yi
|
||||
yi_US
|
||||
zh
|
||||
zh_CN
|
||||
zh_CN.GB18030
|
||||
zh_CN.GB2312
|
||||
zh_CN.GBK
|
||||
zh_CN.UTF-8
|
||||
zh_HK
|
||||
zh_HK.UTF-8
|
||||
zh_SG
|
||||
zh_TW
|
||||
zh_TW.Big5
|
||||
zh_TW.EUC-TW
|
||||
zh_TW.UTF-8
|
||||
zu
|
||||
"
|
||||
|
||||
LocalePurgeNokeep() {
|
||||
local locale_keep
|
||||
for locale_keep in $KEEP_LOCALES
|
||||
do case $1 in
|
||||
$locale_keep)
|
||||
return 1;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
LocalePurgeMain() {
|
||||
local locale_list locale_item locale_cmd
|
||||
locale_list=
|
||||
for locale_item in $ALL_LOCALES ${ALL_LOCALES_ADD-}
|
||||
do [ -n "$locale_item" ] && LocalePurgeNokeep "$locale_item" && \
|
||||
locale_list=$locale_list' '$locale_item
|
||||
done
|
||||
locale_cmd='for d
|
||||
do for l in $locale_list
|
||||
do if test -d "$d/$l$k"
|
||||
then rm -rvf -- "$d/$l"
|
||||
fi
|
||||
done
|
||||
done'
|
||||
export locale_list
|
||||
shell=`command -v sh` || shell=
|
||||
: ${shell:=/bin/sh}
|
||||
if BashrcdTrue $LOCALEPURGE
|
||||
then einfo 'removing undesired locales'
|
||||
find "$ED" -name locale -type d \
|
||||
-exec "$shell" -c "k='/LC_MESSAGES'
|
||||
$locale_cmd" sh '{}' '+'
|
||||
fi
|
||||
if BashrcdTrue $MANPURGE
|
||||
then einfo 'removing undesired manpages'
|
||||
find "$ED" -name man -type d \
|
||||
-exec "$shell" -c "k=
|
||||
$locale_cmd" sh '{}' '+'
|
||||
fi
|
||||
unset locale_list
|
||||
}
|
||||
|
||||
LocalePurge() {
|
||||
if BashrcdTrue $NOLOCALEPURGE || {
|
||||
! BashrcdTrue $LOCALEPURGE && ! BashrcdTrue $MANPURGE
|
||||
} || [ -z "${KEEP_LOCALES++}" ]
|
||||
then return 0
|
||||
fi
|
||||
case $- in
|
||||
*f*)
|
||||
LocalePurgeMain;;
|
||||
*)
|
||||
set -f
|
||||
LocalePurgeMain
|
||||
set +f;;
|
||||
esac
|
||||
}
|
||||
|
||||
BashrcdPhase preinst LocalePurge
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
# (C) Martin V\"ath <martin at mvath.de>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
Remove_la() {
|
||||
BashrcdTrue $NOLAFILEREMOVE && return
|
||||
# Some packages are known to rely on .la files (e.g. for building of plugins):
|
||||
case "$CATEGORY/$PN" in
|
||||
'media-libs/gst-plugins-base'|'media-libs/libsidplay')
|
||||
return 0;;
|
||||
esac
|
||||
einfo 'removing unneeded *.la files'
|
||||
local shell
|
||||
shell=`command -v sh` || shell=
|
||||
: ${shell:=/bin/sh}
|
||||
Dexport=$ED find "$ED" -name '*.la' '!' -name 'libltdl.la' \
|
||||
-exec "$shell" -c "for i
|
||||
do if grep -q -- '^shouldnotlink=no\$' \"\$i\"
|
||||
then printf '\\t%s\\n' \"\${i#\$Dexport}\"
|
||||
rm -- \"\$i\" || echo 'removing failed!'
|
||||
fi
|
||||
done" sh '{}' '+'
|
||||
}
|
||||
|
||||
BashrcdPhase preinst Remove_la
|
Binary file not shown.
|
@ -0,0 +1,86 @@
|
|||
#!/bin/bash
|
||||
# (C) Martin V\"ath <martin at mvath.de>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
BashrcdTrue() {
|
||||
case ${1:-n} in
|
||||
[nNfF]*|[oO][fF]*|0|-)
|
||||
return 1;;
|
||||
esac
|
||||
:
|
||||
}
|
||||
|
||||
BashrcdLog() {
|
||||
local i m=elog
|
||||
BashrcdTrue $BASHRCDNOLOG && m=einfo
|
||||
for i
|
||||
do $m "$i"
|
||||
done
|
||||
}
|
||||
|
||||
BashrcdEcho() {
|
||||
local i m=einfo
|
||||
BashrcdTrue $BASHRCDLOG && m=elog
|
||||
for i
|
||||
do $m "$i"
|
||||
done
|
||||
}
|
||||
|
||||
BashrcdPhase() {
|
||||
local c
|
||||
eval c=\${bashrcd_phases_c_$1}
|
||||
if [ -n "${c:++}" ]
|
||||
then c=$(( $c + 1 ))
|
||||
else c=0
|
||||
fi
|
||||
eval "bashrcd_phases_c_$1=\$c
|
||||
bashrcd_phases_${c}_$1=\$2"
|
||||
}
|
||||
|
||||
BashrcdMain() {
|
||||
local bashrcd
|
||||
for bashrcd in "${PORTAGE_CONFIGROOT%/}/etc/portage/bashrc.d/"*.sh
|
||||
do case $bashrcd in
|
||||
*'/bashrcd.sh')
|
||||
continue;;
|
||||
esac
|
||||
test -r "$bashrcd" || continue
|
||||
. "$bashrcd"
|
||||
BashrcdTrue $BASHRCD_DEBUG && BashrcdEcho "$bashrcd sourced"
|
||||
done
|
||||
unset -f BashrcdPhase
|
||||
BashrcdMain() {
|
||||
local bashrcd_ebuild_phase bashrcd_phase bashrcd_num bashrcd_max
|
||||
bashrcd_ebuild_phase=$EBUILD_PHASE
|
||||
[ -n "${bashrcd_ebuild_phase:++}" ] || [ $# -eq 0 ] || bashrcd_ebuild_phase=$1
|
||||
: ${ED:=${D%/}${EPREFIX%/}/}
|
||||
BashrcdTrue $BASHRCD_DEBUG && BashrcdEcho \
|
||||
"$0: $* ($# args)" \
|
||||
"EBUILD_PHASE=$EBUILD_PHASE" \
|
||||
"PORTDIR=$PORTDIR" \
|
||||
"CATEGORY=$CATEGORY" \
|
||||
"P=$P" \
|
||||
"USER=$USER" \
|
||||
"UID=$UID" \
|
||||
"HOME=$HOME" \
|
||||
"PATH=$PATH" \
|
||||
"ROOT=$ROOT" \
|
||||
"PORTAGE_CONFIGROOT=$PORTAGE_CONFIGROOT" \
|
||||
"LD_PRELOAD=$LD_PRELOAD" \
|
||||
"EPREFIX=$EPREFIX" \
|
||||
"D=$D" \
|
||||
"ED=$ED"
|
||||
for bashrcd_phase in all "$bashrcd_ebuild_phase"
|
||||
do eval bashrcd_max=\${bashrcd_phases_c_$bashrcd_phase}
|
||||
[ -z "${bashrcd_max:++}" ] && continue
|
||||
bashrcd_num=0
|
||||
while {
|
||||
eval eval \"\\\${bashrcd_phases_${bashrcd_num}_$bashrcd_phase}\"
|
||||
[ $bashrcd_num -ne $bashrcd_max ]
|
||||
}
|
||||
do bashrcd_num=$(( $bashrcd_num + 1 ))
|
||||
done
|
||||
done
|
||||
}
|
||||
BashrcdMain "$@"
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
COMMON_FLAGS="-flto -O3 -march=haswell -pipe"
|
||||
CFLAGS="${COMMON_FLAGS}"
|
||||
CXXFLAGS="${COMMON_FLAGS}"
|
||||
FCFLAGS="${COMMON_FLAGS}"
|
||||
FFLAGS="${COMMON_FLAGS}"
|
||||
LDFLAGS="-Wl,-O1 -Wl,--no-as-needed"
|
|
@ -0,0 +1,5 @@
|
|||
COMMON_FLAGS="-march=native -O2 -pipe"
|
||||
CFLAGS="${COMMON_FLAGS}"
|
||||
CXXFLAGS="${COMMON_FLAGS}"
|
||||
FCFLAGS="${COMMON_FLAGS}"
|
||||
FFLAGS="${COMMON_FLAGS}"
|
|
@ -0,0 +1 @@
|
|||
CFLAGS="${CFLAGS} -fno-lto"
|
|
@ -0,0 +1,5 @@
|
|||
COMMON_FLAGS="-march=native -O3 -pipe -fno-strict-aliasing"
|
||||
CFLAGS="${COMMON_FLAGS}"
|
||||
CXXFLAGS="${COMMON_FLAGS}"
|
||||
FCFLAGS="${COMMON_FLAGS}"
|
||||
FFLAGS="${COMMON_FLAGS}"
|
|
@ -0,0 +1 @@
|
|||
PORTAGE_TMPDIR="/var/tmpnotmpfs"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,48 @@
|
|||
#NTHREADS="8"
|
||||
#source /etc/portage/make.conf.lto.defines
|
||||
#
|
||||
#COMMON_FLAGS="-march=native -O3 ${GRAPHITE} ${DEVIRTLTO} ${IPAPTA} \
|
||||
# ${SEMINTERPOS} ${FLTO} -fuse-linker-plugin -falign-functions=32"
|
||||
|
||||
COMMON_FLAGS="-march=native -O2 -pipe"
|
||||
CFLAGS="${COMMON_FLAGS}"
|
||||
CXXFLAGS="${CFLAGS}"
|
||||
FCFLAGS="${CFLAGS}"
|
||||
FFLAGS="${CFLAGS}"
|
||||
|
||||
PORTAGE_BINHOST="http://packages.gentooexperimental.org/packages/"
|
||||
GENTOO_MIRRORS="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/ \
|
||||
https://gentoo.osuosl.org/ \
|
||||
http://ftp.vectranet.pl/gentoo/ \
|
||||
http://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/"
|
||||
|
||||
#MAKEOPTS="-j8 --load-average=6.4"
|
||||
#EMERGE_DEFAULT_OPTS="--jobs=8 --load-average=6.4 --with-bdeps=y --keep-going=y --quiet-build"
|
||||
|
||||
MAKEOPTS="-j3 --load-average=3.3"
|
||||
EMERGE_DEFAULT_OPTS="--jobs=3 --load-average=3.3 --with-bdeps=y --keep-going=y --quiet-build"
|
||||
|
||||
ACCEPT_LICENSE="*"
|
||||
ACCEPT_KEYWORDS="~amd64"
|
||||
|
||||
CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
|
||||
|
||||
FEATURES="${FEATURES} sign ccache buildpkg userfetch multilib-strict sandbox userpriv usersandbox collision-protect"
|
||||
|
||||
USE="-bluetooth"
|
||||
|
||||
PORTAGE_GPG_KEY="D34FB8A44F324B8A"
|
||||
SIGNED_OFF_BY="Marcin Woźniak <y0rune@aol.com>"
|
||||
|
||||
RUBY_TARGETS="ruby30 ruby26 ruby27"
|
||||
|
||||
PORTDIR="/var/db/repos/gentoo"
|
||||
DISTDIR="/var/cache/distfiles"
|
||||
PKGDIR="/var/cache/binpkgs"
|
||||
CCACHE_DIR="/var/cache/ccache"
|
||||
|
||||
LC_MESSAGES=C
|
||||
|
||||
INPUT_DEVICES="mouse keyboard synaptics libinput"
|
||||
VIDEO_CARDS="nvidia"
|
||||
GRUB_PLATFORMS="efi-64"
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/make.conf.lto
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/make.conf.lto.defines
|
|
@ -0,0 +1 @@
|
|||
../../var/db/repos/gentoo/profiles/default/linux/amd64/17.1
|
|
@ -0,0 +1,11 @@
|
|||
sys-apps/openrc -~amd64
|
||||
net-misc/tigervnc -~amd64
|
||||
mail-client/neomutt -~amd64
|
||||
net-libs/nodejs -~amd64
|
||||
app-emulation/docker -~amd64
|
||||
app-emulation/docker-proxy -~amd64
|
||||
app-emulation/containerd -~amd64
|
||||
app-emulation/runc -~amd64
|
||||
dev-util/cppcheck -~amd64
|
||||
net-misc/streamlink **
|
||||
net-misc/youtube-dl **
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/clang.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/cmake-makefile.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/devirtualize-at-ltrans.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/graphite.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/ipa-pta.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/lto.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/no-common-libtool.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/no-plt.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/no-semantic-interposition.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/optimizations.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/portage-bashrc-mv.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/tls-dialect.conf
|
|
@ -0,0 +1 @@
|
|||
/var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/use-ld.conf
|
|
@ -0,0 +1,18 @@
|
|||
app-office/libreoffice notmpfs.conf
|
||||
dev-lang/spidermonkey notmpfs.conf
|
||||
dev-lang/rust notmpfs.conf
|
||||
dev-libs/libaio no-fno-lto.conf
|
||||
dev-libs/libbsd no-fno-lto.conf
|
||||
sys-apps/sandbox no-fno-lto.conf
|
||||
media-libs/x264 no-fno-lto.conf
|
||||
media-libs/alsa-lib no-fno-lto.conf
|
||||
sys-libs/efivar no-fno-lto.conf
|
||||
sys-libs/libomp no-fno-lto.conf
|
||||
dev-python/twisted no-fno-lto.conf
|
||||
app-text/texlive-core no-fno-lto.conf
|
||||
app-text/lcdf-typetools no-lto.conf
|
||||
sys-devel/llvm no-lto.conf
|
||||
dev-lang/ruby no-lto.conf
|
||||
net-analyzer/wireshark no-lto.conf
|
||||
dev-qt/* no-lto.conf
|
||||
net-libs/webkit-gtk no-lto.conf
|
|
@ -0,0 +1,4 @@
|
|||
dev-haskell/*::gentoo
|
||||
x11-drivers/nvidia-drivers::hossie
|
||||
net-misc/megasync::guru
|
||||
sys-apps/flatpak::guru
|
|
@ -0,0 +1 @@
|
|||
app-i18n/mozc
|
|
@ -0,0 +1,422 @@
|
|||
#vim
|
||||
app-editors/vim python
|
||||
|
||||
# Emacs
|
||||
app-editors/emacs jpeg lcms png svg X gui gtk xft tiff libxml2
|
||||
app-emacs/emacs-common-gentoo X gui
|
||||
app-emacs/emacs-common gui
|
||||
|
||||
app-emulation/docker cli
|
||||
|
||||
media-gfx/gnome-screenshot X
|
||||
sys-kernel/gentoo-sources experimental
|
||||
>=dev-libs/libpcre2-10.34 pcre16
|
||||
>=sys-boot/grub-2.04-r1 device-mapper mount
|
||||
>=x11-libs/libxcb-1.13.1 xkb
|
||||
net-wireless/wpa_supplicant dbus
|
||||
>=x11-libs/gdk-pixbuf-2.40.0 X
|
||||
>=x11-libs/pango-1.42.4-r2 X
|
||||
>=x11-libs/libX11-1.6.9 abi_x86_32
|
||||
>=x11-libs/libXext-1.3.4 abi_x86_32
|
||||
>=x11-libs/libvdpau-1.3 abi_x86_32
|
||||
>=x11-libs/cairo-1.16.0-r3 X
|
||||
>=x11-libs/libxcb-1.13.1 abi_x86_32
|
||||
>=virtual/pkgconfig-1 abi_x86_32
|
||||
>=dev-util/pkgconf-1.6.3 abi_x86_32
|
||||
>=dev-libs/libpthread-stubs-0.4-r1 abi_x86_32
|
||||
>=x11-libs/libXau-1.0.9 abi_x86_32
|
||||
>=x11-libs/libXdmcp-1.1.3 abi_x86_32
|
||||
>=x11-base/xcb-proto-1.13 abi_x86_32
|
||||
>=media-plugins/alsa-plugins-1.2.1 pulseaudio
|
||||
>=media-libs/speexdsp-1.2.0 abi_x86_32
|
||||
>=dev-dotnet/libgdiplus-6.0.2 cairo
|
||||
>=app-text/ghostscript-gpl-9.50 cups
|
||||
>=app-text/xmlto-0.0.28-r1 text
|
||||
>=dev-libs/glib-2.60.7 dbus
|
||||
>=sys-auth/polkit-0.96-r1 elogind
|
||||
>=app-crypt/gcr-3.34.0 gtk
|
||||
>=dev-lang/python-2.7.17:2.7 sqlite
|
||||
>=app-crypt/pinentry-1.1.0-r3 gnome-keyring
|
||||
>=dev-cpp/gtkmm-3.24.2 X
|
||||
>=x11-libs/cairo-1.16.0-r3 X
|
||||
>=net-misc/meganz-sdk-3.6.5 qt libuv mediainfo
|
||||
net-misc/megasync threads python
|
||||
>=x11-libs/libxkbcommon-0.9.1 X
|
||||
media-sound/teamspeak-client alsa pulseaudio
|
||||
>=dev-qt/qtgui-5.13.2 dbus accessibility
|
||||
>=dev-qt/qtwebengine-5.13.2 widgets alsa pulseaudio geolocation
|
||||
>=dev-qt/qtwebchannel-5.13.2 qml
|
||||
>=dev-libs/libxml2-2.9.9-r2 icu
|
||||
>=media-libs/libvpx-1.8.1 svc
|
||||
>=sys-libs/zlib-1.2.11-r2 minizip abi_x86_32 static-libs
|
||||
>=virtual/libcrypt-1 abi_x86_32
|
||||
>=app-arch/zstd-1.4.4-r2 abi_x86_32
|
||||
media-sound/cmus alsa ffmpeg pulseaudio
|
||||
sys-devel/gcc graphite lto pgo
|
||||
|
||||
# NM APPLET
|
||||
>=gnome-extra/nm-applet-1.8.24 gtk
|
||||
>=virtual/rust-1.45.1 abi_x86_32
|
||||
>=dev-lang/rust-1.45.1 abi_x86_32
|
||||
|
||||
# QEMU
|
||||
app-emulation/qemu gtk nfs spice ssh vnc QEMU_SOFTMMU_TARGETS: x86_64 QEMU_USER_TARGETS: x86_64
|
||||
app-emulation/virt-manager gtk
|
||||
>=net-misc/spice-gtk-0.39 usbredir
|
||||
>=net-dns/dnsmasq-2.84-r101 script
|
||||
|
||||
#KODI
|
||||
>=dev-libs/boost-1.72.0 abi_x86_32
|
||||
>=net-libs/nghttp2-1.40.0 abi_x86_32
|
||||
>=net-misc/curl-7.67.0-r1 http2
|
||||
>=media-video/ffmpeg-4.2.1 mp3 openssl X x264 dav1d vaapi
|
||||
media-tv/kodi webserver pulseaudio alsa
|
||||
|
||||
#steam
|
||||
games-util/game-device-udev-rules acl elogind
|
||||
app-arch/bzip2 abi_x86_32
|
||||
dev-db/sqlite abi_x86_32
|
||||
dev-libs/atk abi_x86_32
|
||||
dev-libs/expat abi_x86_32
|
||||
dev-libs/fribidi abi_x86_32
|
||||
dev-libs/glib abi_x86_32
|
||||
dev-libs/gmp abi_x86_32
|
||||
dev-libs/icu abi_x86_32
|
||||
dev-libs/libcroco abi_x86_32
|
||||
dev-libs/libffi abi_x86_32
|
||||
dev-libs/libpcre abi_x86_32
|
||||
dev-libs/libpthread-stubs abi_x86_32
|
||||
dev-libs/libtasn1 abi_x86_32
|
||||
dev-libs/libunistring abi_x86_32
|
||||
dev-libs/libxml2 abi_x86_32
|
||||
dev-libs/lzo static-libs abi_x86_32
|
||||
dev-libs/nettle abi_x86_32
|
||||
dev-libs/nspr abi_x86_32
|
||||
dev-libs/nss abi_x86_32
|
||||
dev-libs/openssl abi_x86_32
|
||||
dev-libs/wayland abi_x86_32
|
||||
dev-util/pkgconfig abi_x86_32
|
||||
gnome-base/librsvg abi_x86_32
|
||||
media-gfx/graphite2 abi_x86_32
|
||||
media-libs/fontconfig abi_x86_32
|
||||
media-libs/freetype abi_x86_32
|
||||
media-libs/harfbuzz abi_x86_32
|
||||
media-libs/libpng abi_x86_32
|
||||
edia-libs/openal abi_x86_32
|
||||
media-libs/tiff abi_x86_32
|
||||
net-dns/libidn2 abi_x86_32
|
||||
net-libs/gnutls abi_x86_32
|
||||
net-misc/curl abi_x86_32
|
||||
net-nds/openldap abi_x86_32
|
||||
net-print/cups abi_x86_32
|
||||
sys-apps/attr abi_x86_32
|
||||
sys-apps/dbus abi_x86_32
|
||||
sys-apps/util-linux abi_x86_32
|
||||
sys-devel/gettext abi_x86_32
|
||||
sys-devel/llvm abi_x86_32
|
||||
sys-libs/binutils-libs abi_x86_32
|
||||
sys-fs/eudev abi_x86_32
|
||||
>=virtual/libintl-0-r2 abi_x86_32
|
||||
sys-libs/gpm abi_x86_32
|
||||
sys-libs/ncurses abi_x86_32
|
||||
sys-libs/readline abi_x86_32
|
||||
sys-libs/zlib abi_x86_32
|
||||
virtual/libffi abi_x86_32
|
||||
virtual/libiconv abi_x86_32
|
||||
virtual/libudev abi_x86_32
|
||||
virtual/pkgconfig abi_x86_32
|
||||
x11-libs/cairo abi_x86_32
|
||||
x11-libs/gdk-pixbuf abi_x86_32
|
||||
x11-libs/gtk+:2 abi_x86_32
|
||||
x11-libs/libX11 abi_x86_32
|
||||
x11-libs/libXScrnSaver abi_x86_32
|
||||
x11-libs/libXau abi_x86_32
|
||||
x11-libs/libXcomposite abi_x86_32
|
||||
x11-libs/libXcursor abi_x86_32
|
||||
x11-libs/libXdamage abi_x86_32
|
||||
x11-libs/libXdmcp abi_x86_32
|
||||
x11-libs/libXext abi_x86_32
|
||||
x11-libs/libXfixes abi_x86_32
|
||||
x11-libs/libXft abi_x86_32
|
||||
x11-libs/libXi abi_x86_32
|
||||
x11-libs/libXinerama abi_x86_32
|
||||
x11-libs/libXrandr abi_x86_32
|
||||
x11-libs/libXrender abi_x86_32
|
||||
x11-libs/libXxf86vm abi_x86_32
|
||||
x11-libs/libdrm abi_x86_32
|
||||
x11-libs/libpciaccess abi_x86_32
|
||||
>=dev-libs/libxml2-2.9.9-r2 python
|
||||
x11-libs/libxcb abi_x86_32
|
||||
x11-libs/libxshmfence abi_x86_32
|
||||
x11-libs/pango abi_x86_32
|
||||
x11-libs/pixman abi_x86_32
|
||||
x11-proto/damageproto abi_x86_32
|
||||
x11-proto/dri2proto abi_x86_32
|
||||
x11-proto/dri3proto abi_x86_32
|
||||
x11-proto/fixesproto abi_x86_32
|
||||
x11-proto/glproto abi_x86_32
|
||||
x11-proto/inputproto abi_x86_32
|
||||
x11-proto/kbproto abi_x86_32
|
||||
x11-proto/presentproto abi_x86_32
|
||||
x11-base/xcb-proto abi_x86_32
|
||||
x11-proto/xextproto abi_x86_32
|
||||
x11-proto/xf86bigfontproto abi_x86_32
|
||||
x11-proto/xf86driproto abi_x86_32
|
||||
x11-proto/xf86vidmodeproto abi_x86_32
|
||||
x11-proto/xproto abi_x86_32
|
||||
|
||||
#XOrg
|
||||
>=media-libs/libglvnd-1.3.2 abi_x86_32 X
|
||||
x11-drivers/nvidia-drivers tools libglvnd static-libs libglvnd
|
||||
x11-base/xorg-server libglvnd
|
||||
|
||||
#Wine
|
||||
>=sys-auth/pambase-20200618 elogind
|
||||
media-libs/mesa libglvnd abi_x86_32 vulcan vulcan-overlay
|
||||
app-emulation/winetricks rar
|
||||
media-libs/vulkan-loader X layers
|
||||
media-libs/vulkan-layers X
|
||||
media-libs/gstreamer abi_x86_32
|
||||
media-plugins/gst-plugins-meta abi_x86_32
|
||||
media-libs/lcms abi_x86_32
|
||||
media-sound/mpg123 abi_x86_32
|
||||
dev-libs/libxslt abi_x86_32
|
||||
app-emulation/wine-gecko abi_x86_32
|
||||
dev-libs/libgcrypt static-libs abi_x86_32
|
||||
dev-libs/libgpg-error static-libs abi_x86_32
|
||||
media-libs/gst-plugins-base abi_x86_32
|
||||
media-libs/gst-plugins-good abi_x86_32
|
||||
media-plugins/gst-plugins-a52dec abi_x86_32
|
||||
media-plugins/gst-plugins-faad abi_x86_32
|
||||
media-plugins/gst-plugins-dts abi_x86_32
|
||||
media-libs/gst-plugins-ugly abi_x86_32
|
||||
media-plugins/gst-plugins-dvdread abi_x86_32
|
||||
media-plugins/gst-plugins-mpeg2dec abi_x86_32
|
||||
media-plugins/gst-plugins-resindvd abi_x86_32
|
||||
media-plugins/gst-plugins-flac abi_x86_32
|
||||
media-plugins/gst-plugins-mpg123 abi_x86_32
|
||||
media-plugins/gst-plugins-pulse abi_x86_32
|
||||
media-plugins/gst-plugins-x264 abi_x86_32
|
||||
media-libs/x264 abi_x86_32
|
||||
media-libs/libdvdnav abi_x86_32
|
||||
media-libs/libdvdread abi_x86_32
|
||||
media-libs/gst-plugins-bad abi_x86_32
|
||||
media-plugins/gst-plugins-gtk abi_x86_32
|
||||
dev-lang/orc abi_x86_32
|
||||
x11-libs/gtk+ cups abi_x86_32
|
||||
media-libs/libepoxy abi_x86_32
|
||||
x11-misc/colord abi_x86_32
|
||||
app-accessibility/at-spi2-atk abi_x86_32
|
||||
app-accessibility/at-spi2-core abi_x86_32
|
||||
dev-libs/libgusb abi_x86_32
|
||||
media-libs/libdvdcss abi_x86_32
|
||||
media-libs/libmpeg2 abi_x86_32
|
||||
media-libs/libdca abi_x86_32
|
||||
media-libs/faad2 abi_x86_32
|
||||
media-libs/a52dec abi_x86_32
|
||||
media-libs/libtheora abi_x86_32
|
||||
x11-libs/libXv abi_x86_32
|
||||
media-plugins/gst-plugins-cdparanoia abi_x86_32
|
||||
media-sound/cdparanoia abi_x86_32
|
||||
virtual/libusb udev abi_x86_32
|
||||
dev-libs/libusb udev abi_x86_32
|
||||
virtual/libgudev abi_x86_32
|
||||
dev-libs/libgudev abi_x86_32
|
||||
dev-libs/libusb-compat abi_x86_32
|
||||
virtual/glu abi_x86_32
|
||||
media-libs/glu abi_x86_32
|
||||
app-emulation/wine-staging vulkan abi_x86_32 pulseaudio alsa
|
||||
media-libs/alsa-lib abi_x86_32
|
||||
>=media-libs/libsdl2-2.0.10 abi_x86_32
|
||||
>=media-libs/vulkan-loader-1.1.125 abi_x86_32
|
||||
>=media-libs/vulkan-layers-1.1.125-r2 abi_x86_32
|
||||
>=dev-util/glslang-7.12.3353_pre20191027-r2 abi_x86_32
|
||||
>=dev-util/spirv-tools-2019.10_pre20191027-r1 abi_x86_32
|
||||
|
||||
#LUTRIS
|
||||
>=media-libs/libjpeg-turbo-2.0.3 abi_x86_32
|
||||
>=virtual/opengl-7.0-r2 abi_x86_32
|
||||
>=virtual/jpeg-0-r3 abi_x86_32
|
||||
>=sys-libs/cracklib-2.9.7 abi_x86_32
|
||||
>=sys-libs/db-6.0.35-r2 abi_x86_32
|
||||
>=sys-libs/pam-1.3.1-r1 abi_x86_32
|
||||
>=sys-libs/libcap-2.28-r1 abi_x86_32
|
||||
>=media-libs/graphene-1.8.6 abi_x86_32
|
||||
>=media-libs/libvorbis-1.3.6-r1 abi_x86_32
|
||||
>=media-libs/libogg-1.3.4 abi_x86_32
|
||||
>=media-libs/harfbuzz-2.6.4 icu
|
||||
>=dev-lang/python-3.7.7-r2:3.7 sqlite
|
||||
dev-lang/python sqlite
|
||||
|
||||
#LATEX
|
||||
>=media-libs/gd-2.2.5-r2 png
|
||||
|
||||
#Ruby
|
||||
>=dev-ruby/did_you_mean-1.3.1 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/minitest-5.13.0 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/net-telnet-0.2.0 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/power_assert-1.1.5 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/rake-13.0.1 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/test-unit-3.3.4 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/xmlrpc-0.3.0 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/bundler-2.1.2 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/json-2.3.0 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/rdoc-6.2.0 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/kpeg-1.1.0-r1 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/racc-1.4.14 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=virtual/rubygems-15-r99 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/rubygems-3.0.6 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=virtual/ruby-ssl-11 ruby_targets_ruby27 ruby_targets_ruby30
|
||||
>=dev-ruby/rbs-1.2.0 ruby_targets_ruby30
|
||||
>=dev-cpp/abseil-cpp-20200923.2 cxx17
|
||||
|
||||
app-admin/keepassxc yubikey autotype
|
||||
app-text/mupdf X
|
||||
|
||||
#ADB
|
||||
>=dev-java/swt-3.7.2-r2:3.7 cairo
|
||||
>=sys-libs/ncurses-compat-6.1_p20190609 abi_x86_32
|
||||
|
||||
#Japanese
|
||||
app-text/texlive cjk xetex
|
||||
app-text/texlive-core cjk xetex
|
||||
app-i18n/mozc emacs ibus
|
||||
media-fonts/kochi-substitute X
|
||||
>=sys-apps/dbus-1.12.16 X
|
||||
|
||||
#Audacity
|
||||
media-sound/audacity alsa ffmpeg
|
||||
>=media-libs/portaudio-19.06.00-r2 alsa
|
||||
|
||||
#Wine
|
||||
>=media-sound/pulseaudio-13.0 abi_x86_32
|
||||
>=media-libs/libsndfile-1.0.29_pre2_p20191024 abi_x86_32
|
||||
>=x11-libs/libSM-1.2.3 abi_x86_32
|
||||
>=x11-libs/libICE-1.0.10 abi_x86_32
|
||||
>=x11-libs/libXtst-1.2.3-r1 abi_x86_32
|
||||
>=sys-apps/tcp-wrappers-7.6.28 abi_x86_32
|
||||
>=net-libs/libasyncns-0.8-r4 abi_x86_32
|
||||
>=media-plugins/alsa-plugins-1.2.1 abi_x86_32
|
||||
>=media-libs/flac-1.3.3 abi_x86_32
|
||||
>=media-libs/opus-1.3.1-r1 abi_x86_32
|
||||
|
||||
#VPN
|
||||
net-vpn/openvpn passwordsave example
|
||||
net-vpn/networkmanager-openvpn gtk
|
||||
|
||||
#Gimp
|
||||
>=app-text/poppler-0.84.0 cairo
|
||||
>=media-libs/gegl-0.4.20 cairo
|
||||
|
||||
#Firefox
|
||||
www-client/firefox hwaccel openh264 pulseaudio startup-notification -system-libvpx
|
||||
>=media-libs/speex-1.2.0-r2 abi_x86_32
|
||||
>=media-libs/libpng-1.6.37 apng
|
||||
>=dev-db/sqlite-3.30.1 secure-delete
|
||||
|
||||
#FZF
|
||||
app-shells/fzf tmux
|
||||
|
||||
media-libs/gst-plugins-base alsa
|
||||
>=sys-libs/libunwind-1.3.1 abi_x86_32
|
||||
media-video/ffmpeg alsa pulseaudio x265
|
||||
|
||||
# Fonts
|
||||
|
||||
media-fonts/terminus-font X
|
||||
media-fonts/joypixels X
|
||||
media-libs/freetype X png
|
||||
media-fonts/fontawesome X ttf otf
|
||||
media-fonts/roboto X
|
||||
media-fonts/nerd-fonts X firacode
|
||||
|
||||
#Discord-purple
|
||||
>=media-gfx/imagemagick-7.0.10.9 png svg xml jpeg
|
||||
|
||||
#DNS
|
||||
net-dns/getdns stubby
|
||||
|
||||
#OpenRC
|
||||
>=x11-libs/libdrm-2.4.102 libkms
|
||||
|
||||
#libva
|
||||
>=x11-libs/libva-2.8.0 X
|
||||
|
||||
# Freerdp
|
||||
net-misc/freerdp X alsa pulseaudio
|
||||
|
||||
# MPV
|
||||
media-video/mpv cuda vaapi
|
||||
|
||||
# NEOVIM
|
||||
>=dev-lua/lpeg-1.0.2 luajit
|
||||
>=dev-lua/luv-1.32.0.0 luajit
|
||||
>=dev-lua/mpack-1.0.4 luajit
|
||||
|
||||
# gkrellm
|
||||
app-admin/gkrellm X
|
||||
|
||||
# LibreOffice
|
||||
>=dev-libs/xmlsec-1.2.30 nss
|
||||
|
||||
#OpenJDK
|
||||
dev-java/openjdk-bin gentoo-vm
|
||||
|
||||
# StreamLink
|
||||
net-misc/streamlink python_single_target_python3_9
|
||||
|
||||
# Haskell
|
||||
dev-lang/ghc binary
|
||||
|
||||
>=dev-python/PyQt5-5.15.2 gui widgets
|
||||
|
||||
# Japanese
|
||||
app-i18n/mozc emacs gui ibus
|
||||
dev-libs/libdbusmenu gtk3
|
||||
|
||||
# Keyboard
|
||||
dev-libs/libratbag elogind
|
||||
|
||||
# Aria2
|
||||
net-misc/aria2 bittorrent
|
||||
|
||||
# Firefox
|
||||
dev-lang/spidermonkey clang
|
||||
|
||||
# Opera
|
||||
www-client/opera widevine
|
||||
|
||||
# VirtualBox
|
||||
media-libs/libsdl X
|
||||
|
||||
#VMWare
|
||||
media-plugins/alsa-plugins speex
|
||||
app-emulation/vmware-workstation doc macos-guests vmware-tools-darwin vmware-tools-darwinPre15 vmware-tools-linux vmware-tools-netware vmware-tools-windows
|
||||
|
||||
# Notebook
|
||||
>=net-libs/zeromq-4.3.4-r1 drafts
|
||||
|
||||
# Anki
|
||||
>=dev-python/PyQt5-5.15.2 svg webchannel printsupport network
|
||||
|
||||
# Chrome
|
||||
>=dev-util/wayland-scanner-1.19.0 abi_x86_32
|
||||
|
||||
# TigerVnc
|
||||
net-misc/tigervnc xinerama
|
||||
|
||||
# GentooLTO
|
||||
sys-config/ltoize clang
|
||||
|
||||
# Quassel
|
||||
net-irc/quassel X -server monolithic
|
||||
>=dev-db/sqlite-3.35.4 -secure-delete
|
||||
|
||||
# Neomutt
|
||||
mail-client/neomutt notmuch ssl
|
||||
|
||||
# HP
|
||||
net-dns/avahi python
|
||||
|
||||
#BB
|
||||
>=sys-libs/db-4.8.30-r6:4.8 cxx
|
|
@ -0,0 +1,120 @@
|
|||
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
|
||||
index fd761246c5..29a5ad7db8 100644
|
||||
--- a/dlls/ntdll/signal_i386.c
|
||||
+++ b/dlls/ntdll/signal_i386.c
|
||||
@@ -442,6 +442,8 @@ static size_t signal_stack_size;
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
+static int wine_cs;
|
||||
+
|
||||
enum i386_trap_code
|
||||
{
|
||||
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
|
||||
@@ -846,7 +848,7 @@ static inline void *init_handler( const ucontext_t *sigcontext, WORD *fs, WORD *
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (!wine_ldt_is_system(CS_sig(sigcontext)) ||
|
||||
+ if ((CS_sig(sigcontext) != wine_cs && !wine_ldt_is_system(CS_sig(sigcontext))) ||
|
||||
!wine_ldt_is_system(SS_sig(sigcontext))) /* 16-bit mode */
|
||||
{
|
||||
/*
|
||||
@@ -1533,7 +1535,7 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
|
||||
BYTE instr[16];
|
||||
unsigned int i, len, prefix_count = 0;
|
||||
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return 0;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
len = virtual_uninterrupted_read_memory( (BYTE *)context->Eip, instr, sizeof(instr) );
|
||||
|
||||
for (i = 0; i < len; i++) switch (instr[i])
|
||||
@@ -1600,7 +1602,7 @@ static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context )
|
||||
WORD system_gs = x86_thread_data()->gs;
|
||||
|
||||
if (context->SegGs == system_gs) return FALSE;
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return FALSE;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
/* only handle faults in system libraries */
|
||||
if (virtual_is_valid_code_address( instr, 1 )) return FALSE;
|
||||
|
||||
@@ -1883,7 +1885,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout *
|
||||
EIP_sig(sigcontext) = (DWORD)raise_generic_exception;
|
||||
/* clear single-step, direction, and align check flag */
|
||||
EFL_sig(sigcontext) &= ~(0x100|0x400|0x40000);
|
||||
- CS_sig(sigcontext) = wine_get_cs();
|
||||
+ CS_sig(sigcontext) = wine_cs;
|
||||
DS_sig(sigcontext) = wine_get_ds();
|
||||
ES_sig(sigcontext) = wine_get_es();
|
||||
FS_sig(sigcontext) = wine_get_fs();
|
||||
@@ -2275,6 +2277,21 @@ static void ldt_unlock(void)
|
||||
}
|
||||
|
||||
|
||||
+void signal_init_cs(void)
|
||||
+{
|
||||
+ LDT_ENTRY entry;
|
||||
+
|
||||
+ if (!wine_cs)
|
||||
+ wine_cs = wine_ldt_alloc_entries( 1 );
|
||||
+
|
||||
+ wine_ldt_set_base( &entry, 0 );
|
||||
+ wine_ldt_set_limit( &entry, (UINT_PTR)-1 );
|
||||
+ wine_ldt_set_flags( &entry, WINE_LDT_FLAGS_CODE|WINE_LDT_FLAGS_32BIT );
|
||||
+ wine_ldt_set_entry( wine_cs, &entry );
|
||||
+
|
||||
+ wine_set_cs( wine_cs );
|
||||
+}
|
||||
+
|
||||
/**********************************************************************
|
||||
* signal_alloc_thread
|
||||
*/
|
||||
@@ -2311,6 +2328,9 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
||||
status = STATUS_TOO_MANY_THREADS;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ signal_init_cs();
|
||||
+
|
||||
return status;
|
||||
}
|
||||
|
||||
diff --git a/include/wine/library.h b/include/wine/library.h
|
||||
index af9deaf93f..cac3e3bc64 100644
|
||||
--- a/include/wine/library.h
|
||||
+++ b/include/wine/library.h
|
||||
@@ -193,6 +193,7 @@ __DEFINE_SET_SEG(fs)
|
||||
__DEFINE_SET_SEG(gs)
|
||||
#undef __DEFINE_GET_SEG
|
||||
#undef __DEFINE_SET_SEG
|
||||
+extern void wine_set_cs(unsigned int);
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c
|
||||
index baf12a2e3a..edf7247dc0 100644
|
||||
--- a/libs/wine/ldt.c
|
||||
+++ b/libs/wine/ldt.c
|
||||
@@ -463,6 +463,10 @@ __ASM_GLOBAL_FUNC( wine_get_es, "movw %es,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_fs, "movw %fs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_gs, "movw %gs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_ss, "movw %ss,%ax\n\tret" )
|
||||
+__ASM_GLOBAL_FUNC( wine_set_cs, "movl 4(%esp),%eax\n\t"
|
||||
+ "xchg 0(%esp),%eax\n\t"
|
||||
+ "push %eax\n\t"
|
||||
+ "retf" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" )
|
||||
|
||||
diff --git a/libs/wine/wine.map b/libs/wine/wine.map
|
||||
index 2159fac852..43c735cc59 100644
|
||||
--- a/libs/wine/wine.map
|
||||
+++ b/libs/wine/wine.map
|
||||
@@ -63,6 +63,7 @@ WINE_1.0
|
||||
wine_mmap_enum_free_areas;
|
||||
wine_mmap_is_in_free_area;
|
||||
wine_mmap_remove_free_area;
|
||||
+ wine_set_cs;
|
||||
wine_set_fs;
|
||||
wine_set_gs;
|
||||
wine_utf8_mbstowcs;
|
|
@ -0,0 +1,10 @@
|
|||
--- wine.map 2020-02-09 00:13:26.145060709 +0100
|
||||
+++ wine.mapNEW 2020-02-09 00:17:59.837068528 +0100
|
||||
@@ -63,6 +63,7 @@
|
||||
wine_mmap_enum_free_areas;
|
||||
wine_mmap_is_in_free_area;
|
||||
wine_mmap_remove_free_area;
|
||||
+ wine_set_cs;
|
||||
wine_set_fs;
|
||||
wine_set_gs;
|
||||
wine_utf8_mbstowcs;
|
|
@ -0,0 +1,120 @@
|
|||
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
|
||||
index fd761246c5..29a5ad7db8 100644
|
||||
--- a/dlls/ntdll/signal_i386.c
|
||||
+++ b/dlls/ntdll/signal_i386.c
|
||||
@@ -442,6 +442,8 @@ static size_t signal_stack_size;
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
+static int wine_cs;
|
||||
+
|
||||
enum i386_trap_code
|
||||
{
|
||||
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
|
||||
@@ -846,7 +848,7 @@ static inline void *init_handler( const ucontext_t *sigcontext, WORD *fs, WORD *
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (!wine_ldt_is_system(CS_sig(sigcontext)) ||
|
||||
+ if ((CS_sig(sigcontext) != wine_cs && !wine_ldt_is_system(CS_sig(sigcontext))) ||
|
||||
!wine_ldt_is_system(SS_sig(sigcontext))) /* 16-bit mode */
|
||||
{
|
||||
/*
|
||||
@@ -1533,7 +1535,7 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
|
||||
BYTE instr[16];
|
||||
unsigned int i, len, prefix_count = 0;
|
||||
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return 0;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
len = virtual_uninterrupted_read_memory( (BYTE *)context->Eip, instr, sizeof(instr) );
|
||||
|
||||
for (i = 0; i < len; i++) switch (instr[i])
|
||||
@@ -1600,7 +1602,7 @@ static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context )
|
||||
WORD system_gs = x86_thread_data()->gs;
|
||||
|
||||
if (context->SegGs == system_gs) return FALSE;
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return FALSE;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
/* only handle faults in system libraries */
|
||||
if (virtual_is_valid_code_address( instr, 1 )) return FALSE;
|
||||
|
||||
@@ -1883,7 +1885,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout *
|
||||
EIP_sig(sigcontext) = (DWORD)raise_generic_exception;
|
||||
/* clear single-step, direction, and align check flag */
|
||||
EFL_sig(sigcontext) &= ~(0x100|0x400|0x40000);
|
||||
- CS_sig(sigcontext) = wine_get_cs();
|
||||
+ CS_sig(sigcontext) = wine_cs;
|
||||
DS_sig(sigcontext) = wine_get_ds();
|
||||
ES_sig(sigcontext) = wine_get_es();
|
||||
FS_sig(sigcontext) = wine_get_fs();
|
||||
@@ -2275,6 +2277,21 @@ static void ldt_unlock(void)
|
||||
}
|
||||
|
||||
|
||||
+void signal_init_cs(void)
|
||||
+{
|
||||
+ LDT_ENTRY entry;
|
||||
+
|
||||
+ if (!wine_cs)
|
||||
+ wine_cs = wine_ldt_alloc_entries( 1 );
|
||||
+
|
||||
+ wine_ldt_set_base( &entry, 0 );
|
||||
+ wine_ldt_set_limit( &entry, (UINT_PTR)-1 );
|
||||
+ wine_ldt_set_flags( &entry, WINE_LDT_FLAGS_CODE|WINE_LDT_FLAGS_32BIT );
|
||||
+ wine_ldt_set_entry( wine_cs, &entry );
|
||||
+
|
||||
+ wine_set_cs( wine_cs );
|
||||
+}
|
||||
+
|
||||
/**********************************************************************
|
||||
* signal_alloc_thread
|
||||
*/
|
||||
@@ -2311,6 +2328,9 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
||||
status = STATUS_TOO_MANY_THREADS;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ signal_init_cs();
|
||||
+
|
||||
return status;
|
||||
}
|
||||
|
||||
diff --git a/include/wine/library.h b/include/wine/library.h
|
||||
index af9deaf93f..cac3e3bc64 100644
|
||||
--- a/include/wine/library.h
|
||||
+++ b/include/wine/library.h
|
||||
@@ -193,6 +193,7 @@ __DEFINE_SET_SEG(fs)
|
||||
__DEFINE_SET_SEG(gs)
|
||||
#undef __DEFINE_GET_SEG
|
||||
#undef __DEFINE_SET_SEG
|
||||
+extern void wine_set_cs(unsigned int);
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c
|
||||
index baf12a2e3a..edf7247dc0 100644
|
||||
--- a/libs/wine/ldt.c
|
||||
+++ b/libs/wine/ldt.c
|
||||
@@ -463,6 +463,10 @@ __ASM_GLOBAL_FUNC( wine_get_es, "movw %es,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_fs, "movw %fs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_gs, "movw %gs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_ss, "movw %ss,%ax\n\tret" )
|
||||
+__ASM_GLOBAL_FUNC( wine_set_cs, "movl 4(%esp),%eax\n\t"
|
||||
+ "xchg 0(%esp),%eax\n\t"
|
||||
+ "push %eax\n\t"
|
||||
+ "retf" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" )
|
||||
|
||||
diff --git a/libs/wine/wine.map b/libs/wine/wine.map
|
||||
index 2159fac852..43c735cc59 100644
|
||||
--- a/libs/wine/wine.map
|
||||
+++ b/libs/wine/wine.map
|
||||
@@ -63,6 +63,7 @@ WINE_1.0
|
||||
wine_mmap_enum_free_areas;
|
||||
wine_mmap_is_in_free_area;
|
||||
wine_mmap_remove_free_area;
|
||||
+ wine_set_cs;
|
||||
wine_set_fs;
|
||||
wine_set_gs;
|
||||
wine_utf8_mbstowcs;
|
|
@ -0,0 +1,10 @@
|
|||
--- wine.map 2020-02-09 00:13:26.145060709 +0100
|
||||
+++ wine.mapNEW 2020-02-09 00:17:59.837068528 +0100
|
||||
@@ -63,6 +63,7 @@
|
||||
wine_mmap_enum_free_areas;
|
||||
wine_mmap_is_in_free_area;
|
||||
wine_mmap_remove_free_area;
|
||||
+ wine_set_cs;
|
||||
wine_set_fs;
|
||||
wine_set_gs;
|
||||
wine_utf8_mbstowcs;
|
|
@ -0,0 +1,120 @@
|
|||
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
|
||||
index fd761246c5..29a5ad7db8 100644
|
||||
--- a/dlls/ntdll/signal_i386.c
|
||||
+++ b/dlls/ntdll/signal_i386.c
|
||||
@@ -442,6 +442,8 @@ static size_t signal_stack_size;
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
+static int wine_cs;
|
||||
+
|
||||
enum i386_trap_code
|
||||
{
|
||||
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
|
||||
@@ -846,7 +848,7 @@ static inline void *init_handler( const ucontext_t *sigcontext, WORD *fs, WORD *
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (!wine_ldt_is_system(CS_sig(sigcontext)) ||
|
||||
+ if ((CS_sig(sigcontext) != wine_cs && !wine_ldt_is_system(CS_sig(sigcontext))) ||
|
||||
!wine_ldt_is_system(SS_sig(sigcontext))) /* 16-bit mode */
|
||||
{
|
||||
/*
|
||||
@@ -1533,7 +1535,7 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
|
||||
BYTE instr[16];
|
||||
unsigned int i, len, prefix_count = 0;
|
||||
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return 0;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
len = virtual_uninterrupted_read_memory( (BYTE *)context->Eip, instr, sizeof(instr) );
|
||||
|
||||
for (i = 0; i < len; i++) switch (instr[i])
|
||||
@@ -1600,7 +1602,7 @@ static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context )
|
||||
WORD system_gs = x86_thread_data()->gs;
|
||||
|
||||
if (context->SegGs == system_gs) return FALSE;
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return FALSE;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
/* only handle faults in system libraries */
|
||||
if (virtual_is_valid_code_address( instr, 1 )) return FALSE;
|
||||
|
||||
@@ -1883,7 +1885,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout *
|
||||
EIP_sig(sigcontext) = (DWORD)raise_generic_exception;
|
||||
/* clear single-step, direction, and align check flag */
|
||||
EFL_sig(sigcontext) &= ~(0x100|0x400|0x40000);
|
||||
- CS_sig(sigcontext) = wine_get_cs();
|
||||
+ CS_sig(sigcontext) = wine_cs;
|
||||
DS_sig(sigcontext) = wine_get_ds();
|
||||
ES_sig(sigcontext) = wine_get_es();
|
||||
FS_sig(sigcontext) = wine_get_fs();
|
||||
@@ -2275,6 +2277,21 @@ static void ldt_unlock(void)
|
||||
}
|
||||
|
||||
|
||||
+void signal_init_cs(void)
|
||||
+{
|
||||
+ LDT_ENTRY entry;
|
||||
+
|
||||
+ if (!wine_cs)
|
||||
+ wine_cs = wine_ldt_alloc_entries( 1 );
|
||||
+
|
||||
+ wine_ldt_set_base( &entry, 0 );
|
||||
+ wine_ldt_set_limit( &entry, (UINT_PTR)-1 );
|
||||
+ wine_ldt_set_flags( &entry, WINE_LDT_FLAGS_CODE|WINE_LDT_FLAGS_32BIT );
|
||||
+ wine_ldt_set_entry( wine_cs, &entry );
|
||||
+
|
||||
+ wine_set_cs( wine_cs );
|
||||
+}
|
||||
+
|
||||
/**********************************************************************
|
||||
* signal_alloc_thread
|
||||
*/
|
||||
@@ -2311,6 +2328,9 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
||||
status = STATUS_TOO_MANY_THREADS;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ signal_init_cs();
|
||||
+
|
||||
return status;
|
||||
}
|
||||
|
||||
diff --git a/include/wine/library.h b/include/wine/library.h
|
||||
index af9deaf93f..cac3e3bc64 100644
|
||||
--- a/include/wine/library.h
|
||||
+++ b/include/wine/library.h
|
||||
@@ -193,6 +193,7 @@ __DEFINE_SET_SEG(fs)
|
||||
__DEFINE_SET_SEG(gs)
|
||||
#undef __DEFINE_GET_SEG
|
||||
#undef __DEFINE_SET_SEG
|
||||
+extern void wine_set_cs(unsigned int);
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c
|
||||
index baf12a2e3a..edf7247dc0 100644
|
||||
--- a/libs/wine/ldt.c
|
||||
+++ b/libs/wine/ldt.c
|
||||
@@ -463,6 +463,10 @@ __ASM_GLOBAL_FUNC( wine_get_es, "movw %es,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_fs, "movw %fs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_gs, "movw %gs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_ss, "movw %ss,%ax\n\tret" )
|
||||
+__ASM_GLOBAL_FUNC( wine_set_cs, "movl 4(%esp),%eax\n\t"
|
||||
+ "xchg 0(%esp),%eax\n\t"
|
||||
+ "push %eax\n\t"
|
||||
+ "retf" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" )
|
||||
|
||||
diff --git a/libs/wine/wine.map b/libs/wine/wine.map
|
||||
index 2159fac852..43c735cc59 100644
|
||||
--- a/libs/wine/wine.map
|
||||
+++ b/libs/wine/wine.map
|
||||
@@ -111,6 +111,7 @@ WINE_1.0
|
||||
wine_mmap_remove_reserved_area;
|
||||
wine_pthread_get_functions;
|
||||
wine_pthread_set_functions;
|
||||
+ wine_set_cs;
|
||||
wine_set_fs;
|
||||
wine_set_gs;
|
||||
wine_switch_to_stack;
|
|
@ -0,0 +1,120 @@
|
|||
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
|
||||
index fd761246c5..29a5ad7db8 100644
|
||||
--- a/dlls/ntdll/signal_i386.c
|
||||
+++ b/dlls/ntdll/signal_i386.c
|
||||
@@ -442,6 +442,8 @@ static size_t signal_stack_size;
|
||||
|
||||
static wine_signal_handler handlers[256];
|
||||
|
||||
+static int wine_cs;
|
||||
+
|
||||
enum i386_trap_code
|
||||
{
|
||||
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
|
||||
@@ -846,7 +848,7 @@ static inline void *init_handler( const ucontext_t *sigcontext, WORD *fs, WORD *
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (!wine_ldt_is_system(CS_sig(sigcontext)) ||
|
||||
+ if ((CS_sig(sigcontext) != wine_cs && !wine_ldt_is_system(CS_sig(sigcontext))) ||
|
||||
!wine_ldt_is_system(SS_sig(sigcontext))) /* 16-bit mode */
|
||||
{
|
||||
/*
|
||||
@@ -1533,7 +1535,7 @@ static inline DWORD is_privileged_instr( CONTEXT *context )
|
||||
BYTE instr[16];
|
||||
unsigned int i, len, prefix_count = 0;
|
||||
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return 0;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
len = virtual_uninterrupted_read_memory( (BYTE *)context->Eip, instr, sizeof(instr) );
|
||||
|
||||
for (i = 0; i < len; i++) switch (instr[i])
|
||||
@@ -1600,7 +1602,7 @@ static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context )
|
||||
WORD system_gs = x86_thread_data()->gs;
|
||||
|
||||
if (context->SegGs == system_gs) return FALSE;
|
||||
- if (!wine_ldt_is_system( context->SegCs )) return FALSE;
|
||||
+ if (context->SegCs != wine_cs && !wine_ldt_is_system( context->SegCs )) return 0;
|
||||
/* only handle faults in system libraries */
|
||||
if (virtual_is_valid_code_address( instr, 1 )) return FALSE;
|
||||
|
||||
@@ -1883,7 +1885,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout *
|
||||
EIP_sig(sigcontext) = (DWORD)raise_generic_exception;
|
||||
/* clear single-step, direction, and align check flag */
|
||||
EFL_sig(sigcontext) &= ~(0x100|0x400|0x40000);
|
||||
- CS_sig(sigcontext) = wine_get_cs();
|
||||
+ CS_sig(sigcontext) = wine_cs;
|
||||
DS_sig(sigcontext) = wine_get_ds();
|
||||
ES_sig(sigcontext) = wine_get_es();
|
||||
FS_sig(sigcontext) = wine_get_fs();
|
||||
@@ -2275,6 +2277,21 @@ static void ldt_unlock(void)
|
||||
}
|
||||
|
||||
|
||||
+void signal_init_cs(void)
|
||||
+{
|
||||
+ LDT_ENTRY entry;
|
||||
+
|
||||
+ if (!wine_cs)
|
||||
+ wine_cs = wine_ldt_alloc_entries( 1 );
|
||||
+
|
||||
+ wine_ldt_set_base( &entry, 0 );
|
||||
+ wine_ldt_set_limit( &entry, (UINT_PTR)-1 );
|
||||
+ wine_ldt_set_flags( &entry, WINE_LDT_FLAGS_CODE|WINE_LDT_FLAGS_32BIT );
|
||||
+ wine_ldt_set_entry( wine_cs, &entry );
|
||||
+
|
||||
+ wine_set_cs( wine_cs );
|
||||
+}
|
||||
+
|
||||
/**********************************************************************
|
||||
* signal_alloc_thread
|
||||
*/
|
||||
@@ -2311,6 +2328,9 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
||||
status = STATUS_TOO_MANY_THREADS;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ signal_init_cs();
|
||||
+
|
||||
return status;
|
||||
}
|
||||
|
||||
diff --git a/include/wine/library.h b/include/wine/library.h
|
||||
index af9deaf93f..cac3e3bc64 100644
|
||||
--- a/include/wine/library.h
|
||||
+++ b/include/wine/library.h
|
||||
@@ -193,6 +193,7 @@ __DEFINE_SET_SEG(fs)
|
||||
__DEFINE_SET_SEG(gs)
|
||||
#undef __DEFINE_GET_SEG
|
||||
#undef __DEFINE_SET_SEG
|
||||
+extern void wine_set_cs(unsigned int);
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c
|
||||
index baf12a2e3a..edf7247dc0 100644
|
||||
--- a/libs/wine/ldt.c
|
||||
+++ b/libs/wine/ldt.c
|
||||
@@ -463,6 +463,10 @@ __ASM_GLOBAL_FUNC( wine_get_es, "movw %es,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_fs, "movw %fs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_gs, "movw %gs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_get_ss, "movw %ss,%ax\n\tret" )
|
||||
+__ASM_GLOBAL_FUNC( wine_set_cs, "movl 4(%esp),%eax\n\t"
|
||||
+ "xchg 0(%esp),%eax\n\t"
|
||||
+ "push %eax\n\t"
|
||||
+ "retf" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( wine_set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" )
|
||||
|
||||
diff --git a/libs/wine/wine.map b/libs/wine/wine.map
|
||||
index 2159fac852..43c735cc59 100644
|
||||
--- a/libs/wine/wine.map
|
||||
+++ b/libs/wine/wine.map
|
||||
@@ -111,6 +111,7 @@ WINE_1.0
|
||||
wine_mmap_remove_reserved_area;
|
||||
wine_pthread_get_functions;
|
||||
wine_pthread_set_functions;
|
||||
+ wine_set_cs;
|
||||
wine_set_fs;
|
||||
wine_set_gs;
|
||||
wine_switch_to_stack;
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/common/glib-gen.mak b/common/glib-gen.mak
|
||||
index ef93a5f..e43e126 100644
|
||||
--- a/common/glib-gen.mak
|
||||
+++ b/common/glib-gen.mak
|
||||
@@ -5,7 +5,7 @@
|
||||
#glib_enum_define=GST_COLOR_BALANCE
|
||||
#glib_enum_prefix=gst_color_balance
|
||||
|
||||
-enum_headers=$(foreach h,$(glib_enum_headers),\n\#include \"$(h)\")
|
||||
+enum_headers=$(foreach h,$(glib_enum_headers),\n#include \"$(h)\")
|
||||
|
||||
# these are all the rules generating the relevant files
|
||||
%-marshal.h: %-marshal.list
|
||||
diff --git a/sys/v4l2/Makefile.in b/sys/v4l2/Makefile.in
|
||||
index 048ee8e..eb62bbc 100644
|
||||
--- a/sys/v4l2/Makefile.in
|
||||
+++ b/sys/v4l2/Makefile.in
|
||||
@@ -669,7 +669,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
plugin_LTLIBRARIES = libgstvideo4linux2.la
|
||||
-enum_headers = $(foreach h,$(glib_enum_headers),\n\#include \"$(h)\")
|
||||
+enum_headers = $(foreach h,$(glib_enum_headers),\n#include \"$(h)\")
|
||||
libgstvideo4linux2_la_SOURCES = gstv4l2.c \
|
||||
gstv4l2allocator.c \
|
||||
gstv4l2colorbalance.c \
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/sys/v4l2/Makefile.in b/sys/v4l2/Makefile.in
|
||||
index 048ee8e..eb62bbc 100644
|
||||
--- a/sys/v4l2/Makefile.in
|
||||
+++ b/sys/v4l2/Makefile.in
|
||||
@@ -669,7 +669,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
plugin_LTLIBRARIES = libgstvideo4linux2.la
|
||||
-enum_headers = $(foreach h,$(glib_enum_headers),\n\#include \"$(h)\")
|
||||
+enum_headers = $(foreach h,$(glib_enum_headers),\n#include \"$(h)\")
|
||||
libgstvideo4linux2_la_SOURCES = gstv4l2.c \
|
||||
gstv4l2allocator.c \
|
||||
gstv4l2colorbalance.c \
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,395 @@
|
|||
diff --git a/.manifest b/.manifest
|
||||
index a53265d..bc46234 100644
|
||||
--- a/.manifest
|
||||
+++ b/.manifest
|
||||
@@ -36,6 +36,7 @@ kernel/nvidia/nv-rsync.c 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resm
|
||||
kernel/nvidia/nv-msi.c 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
|
||||
kernel/conftest.sh 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
|
||||
kernel/common/inc/nv.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
|
||||
+kernel/common/inc/nv-drm.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
|
||||
kernel/common/inc/nv-pci.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
|
||||
kernel/common/inc/nv-pgprot.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
|
||||
kernel/common/inc/nv-mm.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman
|
||||
diff --git a/kernel/common/inc/nv-drm.h b/kernel/common/inc/nv-drm.h
|
||||
new file mode 100644
|
||||
index 0000000..07e9f3c
|
||||
--- /dev/null
|
||||
+++ b/kernel/common/inc/nv-drm.h
|
||||
@@ -0,0 +1,36 @@
|
||||
+#ifndef _NV_DRM_H_
|
||||
+#define _NV_DRM_H_
|
||||
+
|
||||
+#include "conftest.h"
|
||||
+
|
||||
+#if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
+#include <drm/drmP.h>
|
||||
+#else
|
||||
+#include <linux/agp_backend.h>
|
||||
+#include <linux/file.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/jiffies.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mutex.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <asm/pgalloc.h>
|
||||
+#include <linux/uaccess.h>
|
||||
+
|
||||
+#include <uapi/drm/drm.h>
|
||||
+#include <uapi/drm/drm_mode.h>
|
||||
+
|
||||
+#include <drm/drm_agpsupport.h>
|
||||
+#include <drm/drm_crtc.h>
|
||||
+#include <drm/drm_drv.h>
|
||||
+#include <drm/drm_prime.h>
|
||||
+#include <drm/drm_pci.h>
|
||||
+#include <drm/drm_ioctl.h>
|
||||
+#include <drm/drm_sysfs.h>
|
||||
+#include <drm/drm_vblank.h>
|
||||
+#include <drm/drm_device.h>
|
||||
+
|
||||
+#include <drm/drm_gem.h>
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
|
||||
index c9c2db3..dd22bb0 100755
|
||||
--- a/kernel/conftest.sh
|
||||
+++ b/kernel/conftest.sh
|
||||
@@ -1150,6 +1150,9 @@ compile_test() {
|
||||
CODE="
|
||||
#if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #else
|
||||
+ #include <drm/drm_drv.h>
|
||||
+ #include <drm/drm_prime.h>
|
||||
#endif
|
||||
#if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
|
||||
#error DRM not enabled
|
||||
@@ -1781,6 +1784,8 @@ compile_test() {
|
||||
echo "$CONFTEST_PREAMBLE
|
||||
#if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #else
|
||||
+ #include <drm/drm_drv.h>
|
||||
#endif
|
||||
#include <drm/drm_atomic.h>
|
||||
#if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
|
||||
@@ -1909,7 +1914,11 @@ compile_test() {
|
||||
# attached drivers") in v3.14 (2013-12-11)
|
||||
#
|
||||
CODE="
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #else
|
||||
+ #include <drm/drm_drv.h>
|
||||
+ #endif
|
||||
int conftest_drm_driver_has_legacy_dev_list(void) {
|
||||
return offsetof(struct drm_driver, legacy_dev_list);
|
||||
}"
|
||||
@@ -1933,7 +1942,11 @@ compile_test() {
|
||||
# 2017-07-23 e6fc3b68558e4c6d8d160b5daf2511b99afa8814
|
||||
#
|
||||
CODE="
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #else
|
||||
+ #include <drm/drm_crtc.h>
|
||||
+ #endif
|
||||
|
||||
int conftest_drm_crtc_init_with_planes_has_name_arg(void) {
|
||||
return
|
||||
@@ -1949,7 +1962,11 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_DRM_CRTC_INIT_WITH_PLANES_HAS_NAME_ARG" "" "types"
|
||||
|
||||
CODE="
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #else
|
||||
+ #include <drm/drm_encoder.h>
|
||||
+ #endif
|
||||
|
||||
int conftest_drm_encoder_init_has_name_arg(void) {
|
||||
return
|
||||
@@ -1964,7 +1981,11 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_DRM_ENCODER_INIT_HAS_NAME_ARG" "" "types"
|
||||
|
||||
echo "$CONFTEST_PREAMBLE
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #else
|
||||
+ #include <drm/drm_plane.h>
|
||||
+ #endif
|
||||
|
||||
int conftest_drm_universal_plane_init_has_format_modifiers_arg(void) {
|
||||
return
|
||||
@@ -1991,7 +2012,11 @@ compile_test() {
|
||||
echo "#undef NV_DRM_UNIVERSAL_PLANE_INIT_HAS_FORMAT_MODIFIERS_ARG" | append_conftest "types"
|
||||
|
||||
echo "$CONFTEST_PREAMBLE
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #else
|
||||
+ #include <drm/drm_plane.h>
|
||||
+ #endif
|
||||
|
||||
int conftest_drm_universal_plane_init_has_name_arg(void) {
|
||||
return
|
||||
@@ -3084,7 +3109,9 @@ compile_test() {
|
||||
# drm_framebuffer_{get,put}()") in v4.12 (2017-02-28).
|
||||
#
|
||||
CODE="
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #endif
|
||||
#if defined(NV_DRM_DRM_FRAMEBUFFER_H_PRESENT)
|
||||
#include <drm/drm_framebuffer.h>
|
||||
#endif
|
||||
@@ -3103,7 +3130,9 @@ compile_test() {
|
||||
# drm_gem_object_{get,put}()") in v4.12 (2017-02-28).
|
||||
#
|
||||
CODE="
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #endif
|
||||
#if defined(NV_DRM_DRM_GEM_H_PRESENT)
|
||||
#include <drm/drm_gem.h>
|
||||
#endif
|
||||
@@ -3122,7 +3151,9 @@ compile_test() {
|
||||
# functions") in v4.15 (2017-09-26).
|
||||
#
|
||||
CODE="
|
||||
+ #if defined(NV_DRM_DRMP_H_PRESENT)
|
||||
#include <drm/drmP.h>
|
||||
+ #endif
|
||||
#if defined(NV_DRM_DRM_DRV_H_PRESENT)
|
||||
#include <drm/drm_drv.h>
|
||||
#endif
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-connector.c b/kernel/nvidia-drm/nvidia-drm-connector.c
|
||||
index 1553ebc..f851561 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-connector.c
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-connector.c
|
||||
@@ -20,6 +20,8 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
+#include <linux/version.h>
|
||||
+
|
||||
#include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
||||
|
||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||
@@ -71,7 +73,11 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
|
||||
struct nv_drm_encoder *nv_detected_encoder = NULL;
|
||||
|
||||
struct NvKmsKapiDynamicDisplayParams *pDetectParams = NULL;
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
|
||||
unsigned int i;
|
||||
+#else
|
||||
+ struct drm_encoder *encoder = NULL;
|
||||
+#endif
|
||||
|
||||
BUG_ON(!mutex_is_locked(&dev->mode_config.mutex));
|
||||
|
||||
@@ -87,11 +93,16 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
|
||||
goto done;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
|
||||
for (i = 0;
|
||||
i < DRM_CONNECTOR_MAX_ENCODER && detected_encoder == NULL; i++) {
|
||||
struct drm_encoder *encoder;
|
||||
+#else
|
||||
+ drm_connector_for_each_possible_encoder(connector, encoder) {
|
||||
+#endif
|
||||
struct nv_drm_encoder *nv_encoder;
|
||||
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
|
||||
if (connector->encoder_ids[i] == 0) {
|
||||
break;
|
||||
}
|
||||
@@ -102,6 +113,7 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
|
||||
BUG_ON(encoder != NULL);
|
||||
continue;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* DVI-I connectors can drive both digital and analog
|
||||
@@ -169,6 +181,8 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
|
||||
}
|
||||
|
||||
detected_encoder = encoder;
|
||||
+
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-connector.h b/kernel/nvidia-drm/nvidia-drm-connector.h
|
||||
index f74e22c..099390d 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-connector.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-connector.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
|
||||
#include "nvtypes.h"
|
||||
#include "nvkms-api-types.h"
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-crtc.h b/kernel/nvidia-drm/nvidia-drm-crtc.h
|
||||
index 31ef3b5..5de3a51 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-crtc.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-crtc.h
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "nvidia-drm-helper.h"
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
#include "nvtypes.h"
|
||||
#include "nvkms-kapi.h"
|
||||
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
|
||||
index a66d3cc..06bf859 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-drv.c
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include "nvidia-drm-ioctl.h"
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
|
||||
/*
|
||||
* Commit fcd70cd36b9b ("drm: Split out drm_probe_helper.h")
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-encoder.h b/kernel/nvidia-drm/nvidia-drm-encoder.h
|
||||
index bbaf986..af341a8 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-encoder.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-encoder.h
|
||||
@@ -32,7 +32,7 @@
|
||||
#if defined(NV_DRM_DRM_ENCODER_H_PRESENT)
|
||||
#include <drm/drm_encoder.h>
|
||||
#else
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
#endif
|
||||
|
||||
#include "nvkms-kapi.h"
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-fb.h b/kernel/nvidia-drm/nvidia-drm-fb.h
|
||||
index 7f292ce..d13bc4c 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-fb.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-fb.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
#include "nvidia-drm-gem-nvkms-memory.h"
|
||||
#include "nvkms-kapi.h"
|
||||
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h
|
||||
index b621969..326f810 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-gem.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-gem.h
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "nvidia-drm-priv.h"
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
#include "nvkms-kapi.h"
|
||||
|
||||
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-helper.c b/kernel/nvidia-drm/nvidia-drm-helper.c
|
||||
index da602ac..e5d6daa 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-helper.c
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-helper.c
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
#if defined(NV_DRM_DRM_ATOMIC_UAPI_H_PRESENT)
|
||||
#include <drm/drm_atomic_uapi.h>
|
||||
#endif
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-helper.h b/kernel/nvidia-drm/nvidia-drm-helper.h
|
||||
index 8f050d8..71c4b90 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-helper.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-helper.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NV_DRM_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
|
||||
/*
|
||||
* drm_dev_put() is added by commit 9a96f55034e41b4e002b767e9218d55f03bdff7d
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-modeset.h b/kernel/nvidia-drm/nvidia-drm-modeset.h
|
||||
index 06659c5..e9d7b70 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-modeset.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-modeset.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
|
||||
struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev);
|
||||
void nv_drm_atomic_state_clear(struct drm_atomic_state *state);
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-os-interface.h b/kernel/nvidia-drm/nvidia-drm-os-interface.h
|
||||
index f43f851..7f4ff8b 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-os-interface.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-os-interface.h
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#if defined(NV_DRM_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
|
||||
/* Set to true when the atomic modeset feature is enabled. */
|
||||
extern bool nv_drm_modeset_module_param;
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-prime-fence.h b/kernel/nvidia-drm/nvidia-drm-prime-fence.h
|
||||
index 20da923..f3cc2b4 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-prime-fence.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-prime-fence.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NV_DRM_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
|
||||
#if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
|
||||
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-priv.h b/kernel/nvidia-drm/nvidia-drm-priv.h
|
||||
index 9076835..77a95f3 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-priv.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-priv.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NV_DRM_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
|
||||
#if defined(NV_DRM_DRM_GEM_H_PRESENT)
|
||||
#include <drm/drm_gem.h>
|
||||
diff --git a/kernel/nvidia-drm/nvidia-drm-utils.h b/kernel/nvidia-drm/nvidia-drm-utils.h
|
||||
index 6d24120..95190c4 100644
|
||||
--- a/kernel/nvidia-drm/nvidia-drm-utils.h
|
||||
+++ b/kernel/nvidia-drm/nvidia-drm-utils.h
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||
|
||||
-#include <drm/drmP.h>
|
||||
+#include "nv-drm.h"
|
||||
#include "nvkms-kapi.h"
|
||||
|
||||
struct NvKmsKapiConnectorInfo*
|
|
@ -0,0 +1,503 @@
|
|||
diff --git a/kernel/common/inc/nv-procfs.h b/kernel/common/inc/nv-procfs.h
|
||||
index 8b53f86..4c5aceb 100644
|
||||
--- a/kernel/common/inc/nv-procfs.h
|
||||
+++ b/kernel/common/inc/nv-procfs.h
|
||||
@@ -28,6 +28,18 @@
|
||||
|
||||
#define IS_EXERCISE_ERROR_FORWARDING_ENABLED() (EXERCISE_ERROR_FORWARDING)
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
|
||||
+ ({ \
|
||||
+ struct proc_dir_entry *__entry; \
|
||||
+ int mode = (S_IFREG | S_IRUGO); \
|
||||
+ const struct proc_ops *fops = &nv_procfs_##__name##_fops; \
|
||||
+ if (fops->proc_write != 0) \
|
||||
+ mode |= S_IWUSR; \
|
||||
+ __entry = proc_create_data(filename, mode, parent, fops, __data);\
|
||||
+ __entry; \
|
||||
+ })
|
||||
+#else
|
||||
#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
|
||||
({ \
|
||||
struct proc_dir_entry *__entry; \
|
||||
@@ -38,6 +50,7 @@
|
||||
__entry = proc_create_data(filename, mode, parent, fops, __data);\
|
||||
__entry; \
|
||||
})
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
|
||||
@@ -77,6 +90,44 @@
|
||||
remove_proc_entry(entry->name, entry->parent);
|
||||
#endif
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+#define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
|
||||
+ static int nv_procfs_open_##name( \
|
||||
+ struct inode *inode, \
|
||||
+ struct file *filep \
|
||||
+ ) \
|
||||
+ { \
|
||||
+ int ret; \
|
||||
+ ret = single_open(filep, nv_procfs_read_##name, \
|
||||
+ NV_PDE_DATA(inode)); \
|
||||
+ if (ret < 0) \
|
||||
+ { \
|
||||
+ return ret; \
|
||||
+ } \
|
||||
+ ret = open_callback(); \
|
||||
+ if (ret < 0) \
|
||||
+ { \
|
||||
+ single_release(inode, filep); \
|
||||
+ } \
|
||||
+ return ret; \
|
||||
+ } \
|
||||
+ \
|
||||
+ static int nv_procfs_release_##name( \
|
||||
+ struct inode *inode, \
|
||||
+ struct file *filep \
|
||||
+ ) \
|
||||
+ { \
|
||||
+ close_callback(); \
|
||||
+ return single_release(inode, filep); \
|
||||
+ } \
|
||||
+ \
|
||||
+ static const struct proc_ops nv_procfs_##name##_fops = { \
|
||||
+ .proc_open = nv_procfs_open_##name, \
|
||||
+ .proc_read = seq_read, \
|
||||
+ .proc_lseek = seq_lseek, \
|
||||
+ .proc_release = nv_procfs_release_##name, \
|
||||
+ };
|
||||
+#else
|
||||
#define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
|
||||
static int nv_procfs_open_##name( \
|
||||
struct inode *inode, \
|
||||
@@ -114,6 +165,7 @@
|
||||
.llseek = seq_lseek, \
|
||||
.release = nv_procfs_release_##name, \
|
||||
};
|
||||
+#endif
|
||||
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
diff --git a/kernel/common/inc/nv-time.h b/kernel/common/inc/nv-time.h
|
||||
index 968b873..f03c7b0 100644
|
||||
--- a/kernel/common/inc/nv-time.h
|
||||
+++ b/kernel/common/inc/nv-time.h
|
||||
@@ -27,7 +27,12 @@
|
||||
|
||||
#include <linux/ktime.h>
|
||||
|
||||
-static inline void nv_gettimeofday(struct timeval *tv)
|
||||
+struct nv_timeval {
|
||||
+ __kernel_long_t tv_sec;
|
||||
+ __kernel_suseconds_t tv_usec;
|
||||
+};
|
||||
+
|
||||
+static inline void nv_gettimeofday(struct nv_timeval *tv)
|
||||
{
|
||||
#ifdef NV_DO_GETTIMEOFDAY_PRESENT
|
||||
do_gettimeofday(tv);
|
||||
@@ -36,7 +41,7 @@ static inline void nv_gettimeofday(struct timeval *tv)
|
||||
|
||||
ktime_get_real_ts64(&now);
|
||||
|
||||
- *tv = (struct timeval) {
|
||||
+ *tv = (struct nv_timeval) {
|
||||
.tv_sec = now.tv_sec,
|
||||
.tv_usec = now.tv_nsec/1000,
|
||||
};
|
||||
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
|
||||
index 57d85a4..4eb703f 100755
|
||||
--- a/kernel/conftest.sh
|
||||
+++ b/kernel/conftest.sh
|
||||
@@ -806,6 +806,46 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_FILE_OPERATIONS_HAS_IOCTL" "" "types"
|
||||
;;
|
||||
|
||||
+ proc_ops)
|
||||
+ CODE="
|
||||
+ #include <linux/proc_fs.h>
|
||||
+ int conftest_proc_ops(void) {
|
||||
+ return offsetof(struct proc_ops, proc_open);
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_HAVE_PROC_OPS" "" "types"
|
||||
+ ;;
|
||||
+
|
||||
+ ktime_get_raw_ts64)
|
||||
+ #
|
||||
+ # Determine if the ktime_get_raw_ts64() function is present.
|
||||
+ #
|
||||
+ CODE="
|
||||
+ #include <linux/ktime.h>
|
||||
+ int conftest_ktime_get_raw_ts64(void) {
|
||||
+ struct timespec64 ts = {0};
|
||||
+
|
||||
+ ktime_get_raw_ts64(&ts64);
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_KTIME_GET_RAW_TS64_PRESENT" "" "functions"
|
||||
+ ;;
|
||||
+
|
||||
+ ktime_get_real_ts64)
|
||||
+ #
|
||||
+ # Determine if the ktime_get_real_ts64() function is present.
|
||||
+ #
|
||||
+ CODE="
|
||||
+ #include <linux/ktime.h>
|
||||
+ int conftest_ktime_get_raw_ts64(void) {
|
||||
+ struct timespec64 ts = {0};
|
||||
+
|
||||
+ ktime_get_real_ts64(&ts64);
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_KTIME_GET_REAL_TS64_PRESENT" "" "functions"
|
||||
+ ;;
|
||||
+
|
||||
sg_alloc_table)
|
||||
#
|
||||
# sg_alloc_table_from_pages added by commit efc42bc98058
|
||||
diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c
|
||||
index 0ca2c7d..8902143 100644
|
||||
--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
|
||||
+++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
|
||||
@@ -266,7 +266,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 usec)
|
||||
|
||||
NvU64 NVKMS_API_CALL nvkms_get_usec(void)
|
||||
{
|
||||
- struct timeval tv;
|
||||
+ struct nv_timeval tv;
|
||||
|
||||
nv_gettimeofday(&tv);
|
||||
|
||||
diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
|
||||
index 30a9dea..1a20eff 100644
|
||||
--- a/kernel/nvidia-uvm/uvm_linux.h
|
||||
+++ b/kernel/nvidia-uvm/uvm_linux.h
|
||||
@@ -301,7 +301,16 @@ static inline uint64_t NV_DIV64(uint64_t dividend, uint64_t divisor, uint64_t *r
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if defined(CLOCK_MONOTONIC_RAW)
|
||||
+#if defined(NV_KTIME_GET_RAW_TS64_PRESENT)
|
||||
+static inline NvU64 NV_GETTIME(void)
|
||||
+{
|
||||
+ struct timespec64 ts;
|
||||
+
|
||||
+ ktime_get_raw_ts64(&ts);
|
||||
+
|
||||
+ return (ts.tv_sec * 1000000000ULL + ts.tv_nsec);
|
||||
+}
|
||||
+#elif defined(CLOCK_MONOTONIC_RAW)
|
||||
/* Return a nanosecond-precise value */
|
||||
static inline NvU64 NV_GETTIME(void)
|
||||
{
|
||||
@@ -317,7 +326,7 @@ static inline NvU64 NV_GETTIME(void)
|
||||
* available non-GPL symbols. */
|
||||
static inline NvU64 NV_GETTIME(void)
|
||||
{
|
||||
- struct timeval tv = {0};
|
||||
+ struct nv_timeval tv = {0};
|
||||
|
||||
nv_gettimeofday(&tv);
|
||||
|
||||
diff --git a/kernel/nvidia/linux_nvswitch.c b/kernel/nvidia/linux_nvswitch.c
|
||||
index 1d2c1bc..0a0b4e8 100644
|
||||
--- a/kernel/nvidia/linux_nvswitch.c
|
||||
+++ b/kernel/nvidia/linux_nvswitch.c
|
||||
@@ -1578,10 +1578,17 @@ nvswitch_os_get_platform_time
|
||||
void
|
||||
)
|
||||
{
|
||||
+#if defined(NV_KTIME_GET_REAL_TS64_PRESENT)
|
||||
+ struct timespec64 ts64;
|
||||
+
|
||||
+ ktime_get_real_ts64(&ts64);
|
||||
+ return ((NvU64)(ts64.tv_sec * NSEC_PER_SEC) + ts64.tv_nsec);
|
||||
+#else
|
||||
struct timespec ts;
|
||||
|
||||
getnstimeofday(&ts);
|
||||
return ((NvU64) timespec_to_ns(&ts));
|
||||
+#endif
|
||||
}
|
||||
|
||||
void
|
||||
diff --git a/kernel/nvidia/nv-procfs.c b/kernel/nvidia/nv-procfs.c
|
||||
index 064d727..a7308d3 100644
|
||||
--- a/kernel/nvidia/nv-procfs.c
|
||||
+++ b/kernel/nvidia/nv-procfs.c
|
||||
@@ -452,6 +452,15 @@ done:
|
||||
return ((status < 0) ? status : (int)count);
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_registry_fops = {
|
||||
+ .proc_open = nv_procfs_open_registry,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_registry,
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_registry_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_registry,
|
||||
@@ -460,6 +469,7 @@ static struct file_operations nv_procfs_registry_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = nv_procfs_close_registry,
|
||||
};
|
||||
+#endif
|
||||
|
||||
#if defined(CONFIG_PM)
|
||||
static int
|
||||
@@ -531,6 +541,15 @@ nv_procfs_open_suspend_depth(
|
||||
return single_open(file, nv_procfs_show_suspend_depth, NULL);
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_suspend_depth_fops = {
|
||||
+ .proc_open = nv_procfs_open_suspend_depth,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_suspend_depth,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = single_release
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_suspend_depth_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_suspend_depth,
|
||||
@@ -539,6 +558,7 @@ static struct file_operations nv_procfs_suspend_depth_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int
|
||||
nv_procfs_show_suspend(
|
||||
@@ -613,6 +633,15 @@ nv_procfs_open_suspend(
|
||||
return single_open(file, nv_procfs_show_suspend, NULL);
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_suspend_fops = {
|
||||
+ .proc_open = nv_procfs_open_suspend,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_suspend,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = single_release
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_suspend_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_suspend,
|
||||
@@ -622,6 +651,7 @@ static struct file_operations nv_procfs_suspend_fops = {
|
||||
.release = single_release
|
||||
};
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Forwards error to nv_log_error which exposes data to vendor callback
|
||||
@@ -724,12 +754,20 @@ done:
|
||||
return status;
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_exercise_error_forwarding_fops = {
|
||||
+ .proc_open = nv_procfs_open_exercise_error_forwarding,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_release = nv_procfs_close_exercise_error_forwarding,
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_exercise_error_forwarding_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_exercise_error_forwarding,
|
||||
.write = nv_procfs_write_file,
|
||||
.release = nv_procfs_close_exercise_error_forwarding,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int
|
||||
nv_procfs_read_unbind_lock(
|
||||
@@ -851,6 +889,15 @@ done:
|
||||
return rc;
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_unbind_lock_fops = {
|
||||
+ .proc_open = nv_procfs_open_unbind_lock,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_unbind_lock,
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_unbind_lock_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_unbind_lock,
|
||||
@@ -859,6 +906,7 @@ static struct file_operations nv_procfs_unbind_lock_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = nv_procfs_close_unbind_lock,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static const char*
|
||||
numa_status_describe(nv_numa_status_t state)
|
||||
@@ -1187,6 +1235,22 @@ done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static const struct proc_ops nv_procfs_numa_status_fops = {
|
||||
+ .proc_open = nv_procfs_open_numa_status,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_numa_status,
|
||||
+};
|
||||
+
|
||||
+static const struct proc_ops nv_procfs_offline_pages_fops = {
|
||||
+ .proc_open = nv_procfs_open_offline_pages,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_offline_pages,
|
||||
+};
|
||||
+#else
|
||||
static const struct file_operations nv_procfs_numa_status_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_numa_status,
|
||||
@@ -1203,6 +1267,7 @@ static const struct file_operations nv_procfs_offline_pages_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = nv_procfs_close_offline_pages,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int
|
||||
nv_procfs_read_text_file(
|
||||
diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
|
||||
index 5ec3e65..339a757 100644
|
||||
--- a/kernel/nvidia/nvidia.Kbuild
|
||||
+++ b/kernel/nvidia/nvidia.Kbuild
|
||||
@@ -150,6 +150,9 @@ NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_dma_ops
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += acpi_op_remove
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations
|
||||
+NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops
|
||||
+NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_raw_ts64
|
||||
+NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_real_ts64
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += file_inode
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += kuid_t
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += dma_ops
|
||||
diff --git a/kernel/nvidia/nvlink_linux.c b/kernel/nvidia/nvlink_linux.c
|
||||
index c84b36a..54fe244 100644
|
||||
--- a/kernel/nvidia/nvlink_linux.c
|
||||
+++ b/kernel/nvidia/nvlink_linux.c
|
||||
@@ -513,8 +513,8 @@ int NVLINK_API_CALL nvlink_memcmp(const void *s1, const void *s2, NvLength size)
|
||||
|
||||
static NvBool nv_timer_less_than
|
||||
(
|
||||
- const struct timeval *a,
|
||||
- const struct timeval *b
|
||||
+ const struct nv_timeval *a,
|
||||
+ const struct nv_timeval *b
|
||||
)
|
||||
{
|
||||
return (a->tv_sec == b->tv_sec) ? (a->tv_usec < b->tv_usec)
|
||||
@@ -523,9 +523,9 @@ static NvBool nv_timer_less_than
|
||||
|
||||
static void nv_timeradd
|
||||
(
|
||||
- const struct timeval *a,
|
||||
- const struct timeval *b,
|
||||
- struct timeval *result
|
||||
+ const struct nv_timeval *a,
|
||||
+ const struct nv_timeval *b,
|
||||
+ struct nv_timeval *result
|
||||
)
|
||||
{
|
||||
result->tv_sec = a->tv_sec + b->tv_sec;
|
||||
@@ -539,9 +539,9 @@ static void nv_timeradd
|
||||
|
||||
static void nv_timersub
|
||||
(
|
||||
- const struct timeval *a,
|
||||
- const struct timeval *b,
|
||||
- struct timeval *result
|
||||
+ const struct nv_timeval *a,
|
||||
+ const struct nv_timeval *b,
|
||||
+ struct nv_timeval *result
|
||||
)
|
||||
{
|
||||
result->tv_sec = a->tv_sec - b->tv_sec;
|
||||
@@ -561,7 +561,7 @@ void NVLINK_API_CALL nvlink_sleep(unsigned int ms)
|
||||
unsigned long us;
|
||||
unsigned long jiffies;
|
||||
unsigned long mdelay_safe_msec;
|
||||
- struct timeval tm_end, tm_aux;
|
||||
+ struct nv_timeval tm_end, tm_aux;
|
||||
|
||||
nv_gettimeofday(&tm_aux);
|
||||
|
||||
diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c
|
||||
index 07f1b77..239be58 100644
|
||||
--- a/kernel/nvidia/os-interface.c
|
||||
+++ b/kernel/nvidia/os-interface.c
|
||||
@@ -463,7 +463,7 @@ NV_STATUS NV_API_CALL os_get_current_time(
|
||||
NvU32 *useconds
|
||||
)
|
||||
{
|
||||
- struct timeval tm;
|
||||
+ struct nv_timeval tm;
|
||||
|
||||
nv_gettimeofday(&tm);
|
||||
|
||||
@@ -477,9 +477,15 @@ NV_STATUS NV_API_CALL os_get_current_time(
|
||||
|
||||
void NV_API_CALL os_get_current_tick(NvU64 *nseconds)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
+ struct timespec64 ts;
|
||||
+
|
||||
+ jiffies_to_timespec64(jiffies, &ts);
|
||||
+#else
|
||||
struct timespec ts;
|
||||
|
||||
jiffies_to_timespec(jiffies, &ts);
|
||||
+#endif
|
||||
|
||||
*nseconds = ((NvU64)ts.tv_sec * NSEC_PER_SEC + (NvU64)ts.tv_nsec);
|
||||
}
|
||||
@@ -549,7 +555,7 @@ NV_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds)
|
||||
unsigned long usec;
|
||||
|
||||
#ifdef NV_CHECK_DELAY_ACCURACY
|
||||
- struct timeval tm1, tm2;
|
||||
+ struct nv_timeval tm1, tm2;
|
||||
|
||||
nv_gettimeofday(&tm1);
|
||||
#endif
|
||||
@@ -589,9 +595,9 @@ NV_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
|
||||
unsigned long MicroSeconds;
|
||||
unsigned long jiffies;
|
||||
unsigned long mdelay_safe_msec;
|
||||
- struct timeval tm_end, tm_aux;
|
||||
+ struct nv_timeval tm_end, tm_aux;
|
||||
#ifdef NV_CHECK_DELAY_ACCURACY
|
||||
- struct timeval tm_start;
|
||||
+ struct nv_timeval tm_start;
|
||||
#endif
|
||||
|
||||
nv_gettimeofday(&tm_aux);
|
||||
@@ -1954,7 +1960,7 @@ static NV_STATUS NV_API_CALL _os_ipmi_receive_resp
|
||||
{
|
||||
struct ipmi_recv_msg *rx_msg;
|
||||
int err_no;
|
||||
- struct timeval tv;
|
||||
+ struct nv_timeval tv;
|
||||
NvU64 start_time;
|
||||
|
||||
nv_gettimeofday(&tv);
|
|
@ -0,0 +1,503 @@
|
|||
diff --git a/kernel/common/inc/nv-procfs.h b/kernel/common/inc/nv-procfs.h
|
||||
index 8b53f86..4c5aceb 100644
|
||||
--- a/kernel/common/inc/nv-procfs.h
|
||||
+++ b/kernel/common/inc/nv-procfs.h
|
||||
@@ -28,6 +28,18 @@
|
||||
|
||||
#define IS_EXERCISE_ERROR_FORWARDING_ENABLED() (EXERCISE_ERROR_FORWARDING)
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
|
||||
+ ({ \
|
||||
+ struct proc_dir_entry *__entry; \
|
||||
+ int mode = (S_IFREG | S_IRUGO); \
|
||||
+ const struct proc_ops *fops = &nv_procfs_##__name##_fops; \
|
||||
+ if (fops->proc_write != 0) \
|
||||
+ mode |= S_IWUSR; \
|
||||
+ __entry = proc_create_data(filename, mode, parent, fops, __data);\
|
||||
+ __entry; \
|
||||
+ })
|
||||
+#else
|
||||
#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \
|
||||
({ \
|
||||
struct proc_dir_entry *__entry; \
|
||||
@@ -38,6 +50,7 @@
|
||||
__entry = proc_create_data(filename, mode, parent, fops, __data);\
|
||||
__entry; \
|
||||
})
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0.
|
||||
@@ -77,6 +90,44 @@
|
||||
remove_proc_entry(entry->name, entry->parent);
|
||||
#endif
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+#define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
|
||||
+ static int nv_procfs_open_##name( \
|
||||
+ struct inode *inode, \
|
||||
+ struct file *filep \
|
||||
+ ) \
|
||||
+ { \
|
||||
+ int ret; \
|
||||
+ ret = single_open(filep, nv_procfs_read_##name, \
|
||||
+ NV_PDE_DATA(inode)); \
|
||||
+ if (ret < 0) \
|
||||
+ { \
|
||||
+ return ret; \
|
||||
+ } \
|
||||
+ ret = open_callback(); \
|
||||
+ if (ret < 0) \
|
||||
+ { \
|
||||
+ single_release(inode, filep); \
|
||||
+ } \
|
||||
+ return ret; \
|
||||
+ } \
|
||||
+ \
|
||||
+ static int nv_procfs_release_##name( \
|
||||
+ struct inode *inode, \
|
||||
+ struct file *filep \
|
||||
+ ) \
|
||||
+ { \
|
||||
+ close_callback(); \
|
||||
+ return single_release(inode, filep); \
|
||||
+ } \
|
||||
+ \
|
||||
+ static const struct proc_ops nv_procfs_##name##_fops = { \
|
||||
+ .proc_open = nv_procfs_open_##name, \
|
||||
+ .proc_read = seq_read, \
|
||||
+ .proc_lseek = seq_lseek, \
|
||||
+ .proc_release = nv_procfs_release_##name, \
|
||||
+ };
|
||||
+#else
|
||||
#define NV_DEFINE_SINGLE_PROCFS_FILE(name, open_callback, close_callback) \
|
||||
static int nv_procfs_open_##name( \
|
||||
struct inode *inode, \
|
||||
@@ -114,6 +165,7 @@
|
||||
.llseek = seq_lseek, \
|
||||
.release = nv_procfs_release_##name, \
|
||||
};
|
||||
+#endif
|
||||
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
diff --git a/kernel/common/inc/nv-time.h b/kernel/common/inc/nv-time.h
|
||||
index 968b873..f03c7b0 100644
|
||||
--- a/kernel/common/inc/nv-time.h
|
||||
+++ b/kernel/common/inc/nv-time.h
|
||||
@@ -27,7 +27,12 @@
|
||||
|
||||
#include <linux/ktime.h>
|
||||
|
||||
-static inline void nv_gettimeofday(struct timeval *tv)
|
||||
+struct nv_timeval {
|
||||
+ __kernel_long_t tv_sec;
|
||||
+ __kernel_suseconds_t tv_usec;
|
||||
+};
|
||||
+
|
||||
+static inline void nv_gettimeofday(struct nv_timeval *tv)
|
||||
{
|
||||
#ifdef NV_DO_GETTIMEOFDAY_PRESENT
|
||||
do_gettimeofday(tv);
|
||||
@@ -36,7 +41,7 @@ static inline void nv_gettimeofday(struct timeval *tv)
|
||||
|
||||
ktime_get_real_ts64(&now);
|
||||
|
||||
- *tv = (struct timeval) {
|
||||
+ *tv = (struct nv_timeval) {
|
||||
.tv_sec = now.tv_sec,
|
||||
.tv_usec = now.tv_nsec/1000,
|
||||
};
|
||||
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
|
||||
index 57d85a4..4eb703f 100755
|
||||
--- a/kernel/conftest.sh
|
||||
+++ b/kernel/conftest.sh
|
||||
@@ -806,6 +806,46 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_FILE_OPERATIONS_HAS_IOCTL" "" "types"
|
||||
;;
|
||||
|
||||
+ proc_ops)
|
||||
+ CODE="
|
||||
+ #include <linux/proc_fs.h>
|
||||
+ int conftest_proc_ops(void) {
|
||||
+ return offsetof(struct proc_ops, proc_open);
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_HAVE_PROC_OPS" "" "types"
|
||||
+ ;;
|
||||
+
|
||||
+ ktime_get_raw_ts64)
|
||||
+ #
|
||||
+ # Determine if the ktime_get_raw_ts64() function is present.
|
||||
+ #
|
||||
+ CODE="
|
||||
+ #include <linux/ktime.h>
|
||||
+ int conftest_ktime_get_raw_ts64(void) {
|
||||
+ struct timespec64 ts = {0};
|
||||
+
|
||||
+ ktime_get_raw_ts64(&ts64);
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_KTIME_GET_RAW_TS64_PRESENT" "" "functions"
|
||||
+ ;;
|
||||
+
|
||||
+ ktime_get_real_ts64)
|
||||
+ #
|
||||
+ # Determine if the ktime_get_real_ts64() function is present.
|
||||
+ #
|
||||
+ CODE="
|
||||
+ #include <linux/ktime.h>
|
||||
+ int conftest_ktime_get_raw_ts64(void) {
|
||||
+ struct timespec64 ts = {0};
|
||||
+
|
||||
+ ktime_get_real_ts64(&ts64);
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_KTIME_GET_REAL_TS64_PRESENT" "" "functions"
|
||||
+ ;;
|
||||
+
|
||||
sg_alloc_table)
|
||||
#
|
||||
# sg_alloc_table_from_pages added by commit efc42bc98058
|
||||
diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c
|
||||
index 0ca2c7d..8902143 100644
|
||||
--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c
|
||||
+++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c
|
||||
@@ -266,7 +266,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 usec)
|
||||
|
||||
NvU64 NVKMS_API_CALL nvkms_get_usec(void)
|
||||
{
|
||||
- struct timeval tv;
|
||||
+ struct nv_timeval tv;
|
||||
|
||||
nv_gettimeofday(&tv);
|
||||
|
||||
diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
|
||||
index 30a9dea..1a20eff 100644
|
||||
--- a/kernel/nvidia-uvm/uvm_linux.h
|
||||
+++ b/kernel/nvidia-uvm/uvm_linux.h
|
||||
@@ -301,7 +301,16 @@ static inline uint64_t NV_DIV64(uint64_t dividend, uint64_t divisor, uint64_t *r
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if defined(CLOCK_MONOTONIC_RAW)
|
||||
+#if defined(NV_KTIME_GET_RAW_TS64_PRESENT)
|
||||
+static inline NvU64 NV_GETTIME(void)
|
||||
+{
|
||||
+ struct timespec64 ts;
|
||||
+
|
||||
+ ktime_get_raw_ts64(&ts);
|
||||
+
|
||||
+ return (ts.tv_sec * 1000000000ULL + ts.tv_nsec);
|
||||
+}
|
||||
+#elif defined(CLOCK_MONOTONIC_RAW)
|
||||
/* Return a nanosecond-precise value */
|
||||
static inline NvU64 NV_GETTIME(void)
|
||||
{
|
||||
@@ -317,7 +326,7 @@ static inline NvU64 NV_GETTIME(void)
|
||||
* available non-GPL symbols. */
|
||||
static inline NvU64 NV_GETTIME(void)
|
||||
{
|
||||
- struct timeval tv = {0};
|
||||
+ struct nv_timeval tv = {0};
|
||||
|
||||
nv_gettimeofday(&tv);
|
||||
|
||||
diff --git a/kernel/nvidia/linux_nvswitch.c b/kernel/nvidia/linux_nvswitch.c
|
||||
index 1d2c1bc..0a0b4e8 100644
|
||||
--- a/kernel/nvidia/linux_nvswitch.c
|
||||
+++ b/kernel/nvidia/linux_nvswitch.c
|
||||
@@ -1578,10 +1578,17 @@ nvswitch_os_get_platform_time
|
||||
void
|
||||
)
|
||||
{
|
||||
+#if defined(NV_KTIME_GET_REAL_TS64_PRESENT)
|
||||
+ struct timespec64 ts64;
|
||||
+
|
||||
+ ktime_get_real_ts64(&ts64);
|
||||
+ return ((NvU64)(ts64.tv_sec * NSEC_PER_SEC) + ts64.tv_nsec);
|
||||
+#else
|
||||
struct timespec ts;
|
||||
|
||||
getnstimeofday(&ts);
|
||||
return ((NvU64) timespec_to_ns(&ts));
|
||||
+#endif
|
||||
}
|
||||
|
||||
void
|
||||
diff --git a/kernel/nvidia/nv-procfs.c b/kernel/nvidia/nv-procfs.c
|
||||
index 064d727..a7308d3 100644
|
||||
--- a/kernel/nvidia/nv-procfs.c
|
||||
+++ b/kernel/nvidia/nv-procfs.c
|
||||
@@ -452,6 +452,15 @@ done:
|
||||
return ((status < 0) ? status : (int)count);
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_registry_fops = {
|
||||
+ .proc_open = nv_procfs_open_registry,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_registry,
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_registry_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_registry,
|
||||
@@ -460,6 +469,7 @@ static struct file_operations nv_procfs_registry_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = nv_procfs_close_registry,
|
||||
};
|
||||
+#endif
|
||||
|
||||
#if defined(CONFIG_PM)
|
||||
static int
|
||||
@@ -531,6 +541,15 @@ nv_procfs_open_suspend_depth(
|
||||
return single_open(file, nv_procfs_show_suspend_depth, NULL);
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_suspend_depth_fops = {
|
||||
+ .proc_open = nv_procfs_open_suspend_depth,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_suspend_depth,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = single_release
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_suspend_depth_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_suspend_depth,
|
||||
@@ -539,6 +558,7 @@ static struct file_operations nv_procfs_suspend_depth_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int
|
||||
nv_procfs_show_suspend(
|
||||
@@ -613,6 +633,15 @@ nv_procfs_open_suspend(
|
||||
return single_open(file, nv_procfs_show_suspend, NULL);
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_suspend_fops = {
|
||||
+ .proc_open = nv_procfs_open_suspend,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_suspend,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = single_release
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_suspend_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_suspend,
|
||||
@@ -622,6 +651,7 @@ static struct file_operations nv_procfs_suspend_fops = {
|
||||
.release = single_release
|
||||
};
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Forwards error to nv_log_error which exposes data to vendor callback
|
||||
@@ -724,12 +754,20 @@ done:
|
||||
return status;
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_exercise_error_forwarding_fops = {
|
||||
+ .proc_open = nv_procfs_open_exercise_error_forwarding,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_release = nv_procfs_close_exercise_error_forwarding,
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_exercise_error_forwarding_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_exercise_error_forwarding,
|
||||
.write = nv_procfs_write_file,
|
||||
.release = nv_procfs_close_exercise_error_forwarding,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int
|
||||
nv_procfs_read_unbind_lock(
|
||||
@@ -851,6 +889,15 @@ done:
|
||||
return rc;
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static struct proc_ops nv_procfs_unbind_lock_fops = {
|
||||
+ .proc_open = nv_procfs_open_unbind_lock,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_unbind_lock,
|
||||
+};
|
||||
+#else
|
||||
static struct file_operations nv_procfs_unbind_lock_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_unbind_lock,
|
||||
@@ -859,6 +906,7 @@ static struct file_operations nv_procfs_unbind_lock_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = nv_procfs_close_unbind_lock,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static const char*
|
||||
numa_status_describe(nv_numa_status_t state)
|
||||
@@ -1187,6 +1235,22 @@ done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
+#if defined(NV_HAVE_PROC_OPS)
|
||||
+static const struct proc_ops nv_procfs_numa_status_fops = {
|
||||
+ .proc_open = nv_procfs_open_numa_status,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_write = nv_procfs_write_file,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_numa_status,
|
||||
+};
|
||||
+
|
||||
+static const struct proc_ops nv_procfs_offline_pages_fops = {
|
||||
+ .proc_open = nv_procfs_open_offline_pages,
|
||||
+ .proc_read = seq_read,
|
||||
+ .proc_lseek = seq_lseek,
|
||||
+ .proc_release = nv_procfs_close_offline_pages,
|
||||
+};
|
||||
+#else
|
||||
static const struct file_operations nv_procfs_numa_status_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nv_procfs_open_numa_status,
|
||||
@@ -1203,6 +1267,7 @@ static const struct file_operations nv_procfs_offline_pages_fops = {
|
||||
.llseek = seq_lseek,
|
||||
.release = nv_procfs_close_offline_pages,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int
|
||||
nv_procfs_read_text_file(
|
||||
diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
|
||||
index 5ec3e65..339a757 100644
|
||||
--- a/kernel/nvidia/nvidia.Kbuild
|
||||
+++ b/kernel/nvidia/nvidia.Kbuild
|
||||
@@ -150,6 +150,9 @@ NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_dma_ops
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += acpi_op_remove
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations
|
||||
+NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops
|
||||
+NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_raw_ts64
|
||||
+NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_real_ts64
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += file_inode
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += kuid_t
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += dma_ops
|
||||
diff --git a/kernel/nvidia/nvlink_linux.c b/kernel/nvidia/nvlink_linux.c
|
||||
index c84b36a..54fe244 100644
|
||||
--- a/kernel/nvidia/nvlink_linux.c
|
||||
+++ b/kernel/nvidia/nvlink_linux.c
|
||||
@@ -513,8 +513,8 @@ int NVLINK_API_CALL nvlink_memcmp(const void *s1, const void *s2, NvLength size)
|
||||
|
||||
static NvBool nv_timer_less_than
|
||||
(
|
||||
- const struct timeval *a,
|
||||
- const struct timeval *b
|
||||
+ const struct nv_timeval *a,
|
||||
+ const struct nv_timeval *b
|
||||
)
|
||||
{
|
||||
return (a->tv_sec == b->tv_sec) ? (a->tv_usec < b->tv_usec)
|
||||
@@ -523,9 +523,9 @@ static NvBool nv_timer_less_than
|
||||
|
||||
static void nv_timeradd
|
||||
(
|
||||
- const struct timeval *a,
|
||||
- const struct timeval *b,
|
||||
- struct timeval *result
|
||||
+ const struct nv_timeval *a,
|
||||
+ const struct nv_timeval *b,
|
||||
+ struct nv_timeval *result
|
||||
)
|
||||
{
|
||||
result->tv_sec = a->tv_sec + b->tv_sec;
|
||||
@@ -539,9 +539,9 @@ static void nv_timeradd
|
||||
|
||||
static void nv_timersub
|
||||
(
|
||||
- const struct timeval *a,
|
||||
- const struct timeval *b,
|
||||
- struct timeval *result
|
||||
+ const struct nv_timeval *a,
|
||||
+ const struct nv_timeval *b,
|
||||
+ struct nv_timeval *result
|
||||
)
|
||||
{
|
||||
result->tv_sec = a->tv_sec - b->tv_sec;
|
||||
@@ -561,7 +561,7 @@ void NVLINK_API_CALL nvlink_sleep(unsigned int ms)
|
||||
unsigned long us;
|
||||
unsigned long jiffies;
|
||||
unsigned long mdelay_safe_msec;
|
||||
- struct timeval tm_end, tm_aux;
|
||||
+ struct nv_timeval tm_end, tm_aux;
|
||||
|
||||
nv_gettimeofday(&tm_aux);
|
||||
|
||||
diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c
|
||||
index 07f1b77..239be58 100644
|
||||
--- a/kernel/nvidia/os-interface.c
|
||||
+++ b/kernel/nvidia/os-interface.c
|
||||
@@ -463,7 +463,7 @@ NV_STATUS NV_API_CALL os_get_current_time(
|
||||
NvU32 *useconds
|
||||
)
|
||||
{
|
||||
- struct timeval tm;
|
||||
+ struct nv_timeval tm;
|
||||
|
||||
nv_gettimeofday(&tm);
|
||||
|
||||
@@ -477,9 +477,15 @@ NV_STATUS NV_API_CALL os_get_current_time(
|
||||
|
||||
void NV_API_CALL os_get_current_tick(NvU64 *nseconds)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)
|
||||
+ struct timespec64 ts;
|
||||
+
|
||||
+ jiffies_to_timespec64(jiffies, &ts);
|
||||
+#else
|
||||
struct timespec ts;
|
||||
|
||||
jiffies_to_timespec(jiffies, &ts);
|
||||
+#endif
|
||||
|
||||
*nseconds = ((NvU64)ts.tv_sec * NSEC_PER_SEC + (NvU64)ts.tv_nsec);
|
||||
}
|
||||
@@ -549,7 +555,7 @@ NV_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds)
|
||||
unsigned long usec;
|
||||
|
||||
#ifdef NV_CHECK_DELAY_ACCURACY
|
||||
- struct timeval tm1, tm2;
|
||||
+ struct nv_timeval tm1, tm2;
|
||||
|
||||
nv_gettimeofday(&tm1);
|
||||
#endif
|
||||
@@ -589,9 +595,9 @@ NV_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds)
|
||||
unsigned long MicroSeconds;
|
||||
unsigned long jiffies;
|
||||
unsigned long mdelay_safe_msec;
|
||||
- struct timeval tm_end, tm_aux;
|
||||
+ struct nv_timeval tm_end, tm_aux;
|
||||
#ifdef NV_CHECK_DELAY_ACCURACY
|
||||
- struct timeval tm_start;
|
||||
+ struct nv_timeval tm_start;
|
||||
#endif
|
||||
|
||||
nv_gettimeofday(&tm_aux);
|
||||
@@ -1954,7 +1960,7 @@ static NV_STATUS NV_API_CALL _os_ipmi_receive_resp
|
||||
{
|
||||
struct ipmi_recv_msg *rx_msg;
|
||||
int err_no;
|
||||
- struct timeval tv;
|
||||
+ struct nv_timeval tv;
|
||||
NvU64 start_time;
|
||||
|
||||
nv_gettimeofday(&tv);
|
|
@ -0,0 +1,23 @@
|
|||
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
|
||||
index 8f807a1..af29636 100755
|
||||
--- a/kernel/conftest.sh
|
||||
+++ b/kernel/conftest.sh
|
||||
@@ -143,6 +143,7 @@ test_headers() {
|
||||
FILES="$FILES video/nv_internal.h"
|
||||
FILES="$FILES asm/book3s/64/hash-64k.h"
|
||||
FILES="$FILES asm/set_memory.h"
|
||||
+ FILES="$FILES asm/pgtable.h"
|
||||
FILES="$FILES asm/prom.h"
|
||||
FILES="$FILES asm/powernv.h"
|
||||
FILES="$FILES asm/tlbflush.h"
|
||||
@@ -466,6 +467,9 @@ compile_test() {
|
||||
# It does not exist on all architectures.
|
||||
#
|
||||
CODE="
|
||||
+ #if defined(NV_ASM_PGTABLE_H_PRESENT)
|
||||
+ #include <asm/pgtable.h>
|
||||
+ #endif
|
||||
#if defined(NV_ASM_SET_MEMORY_H_PRESENT)
|
||||
#include <asm/set_memory.h>
|
||||
#else
|
||||
|
|
@ -0,0 +1,738 @@
|
|||
From 7808631e7a9a605d5fe7a1077129c658d9ec47fc Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Coste <mawww@kakoune.org>
|
||||
Date: Tue, 22 Oct 2019 22:46:49 +1100
|
||||
Subject: [PATCH] Add support for BGRA glyphs display and scaling
|
||||
|
||||
Display is done using an XRender Picture, as XRender
|
||||
glyphs are incompatible with BGRA rendering due to
|
||||
their use of the glyph bitmap as a mask.
|
||||
|
||||
Scaling is done by averaging all relevant pixel, which gives
|
||||
much better result than nearest pixel sampling while staying
|
||||
simple enough and not too computationally expensive.
|
||||
|
||||
This enables color emoji rendering support.
|
||||
|
||||
Fixes: #6
|
||||
|
||||
Signed-off-by: Maxime Coste <mawww@kakoune.org>
|
||||
---
|
||||
src/xftfreetype.c | 18 ++++-
|
||||
src/xftglyphs.c | 200 ++++++++++++++++++++++++++++++++++++++++++----
|
||||
src/xftint.h | 2 +
|
||||
src/xftrender.c | 168 ++++++++++++++++++++++++--------------
|
||||
4 files changed, 307 insertions(+), 81 deletions(-)
|
||||
|
||||
diff --git a/src/xftfreetype.c b/src/xftfreetype.c
|
||||
index a3b8332..a639a03 100644
|
||||
--- a/src/xftfreetype.c
|
||||
+++ b/src/xftfreetype.c
|
||||
@@ -514,7 +514,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
|
||||
/*
|
||||
* Compute glyph load flags
|
||||
*/
|
||||
- fi->load_flags = FT_LOAD_DEFAULT;
|
||||
+ fi->load_flags = FT_LOAD_DEFAULT | FT_LOAD_COLOR;
|
||||
|
||||
#ifndef XFT_EMBEDDED_BITMAP
|
||||
#define XFT_EMBEDDED_BITMAP "embeddedbitmap"
|
||||
@@ -766,6 +766,7 @@ XftFontOpenInfo (Display *dpy,
|
||||
FcChar32 hash_value;
|
||||
FcChar32 rehash_value;
|
||||
FcBool antialias;
|
||||
+ FcBool color;
|
||||
int max_glyph_memory;
|
||||
int alloc_size;
|
||||
int ascent, descent, height;
|
||||
@@ -822,12 +823,16 @@ XftFontOpenInfo (Display *dpy,
|
||||
if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
|
||||
antialias = FcFalse;
|
||||
|
||||
+ color = FT_HAS_COLOR(face) ? FcTrue : FcFalse;
|
||||
+
|
||||
/*
|
||||
* Find the appropriate picture format
|
||||
*/
|
||||
if (fi->render)
|
||||
{
|
||||
- if (antialias)
|
||||
+ if (color)
|
||||
+ format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
|
||||
+ else if (antialias)
|
||||
{
|
||||
switch (fi->rgba) {
|
||||
case FC_RGBA_RGB:
|
||||
@@ -842,9 +847,7 @@ XftFontOpenInfo (Display *dpy,
|
||||
}
|
||||
}
|
||||
else
|
||||
- {
|
||||
format = XRenderFindStandardFormat (dpy, PictStandardA1);
|
||||
- }
|
||||
|
||||
if (!format)
|
||||
goto bail2;
|
||||
@@ -959,6 +962,13 @@ XftFontOpenInfo (Display *dpy,
|
||||
* which doesn't happen in XftFontInfoFill
|
||||
*/
|
||||
font->info.antialias = antialias;
|
||||
+
|
||||
+ /*
|
||||
+ * Set color value, which is only known once the
|
||||
+ * font was loaded
|
||||
+ */
|
||||
+ font->info.color = color;
|
||||
+
|
||||
/*
|
||||
* bump XftFile reference count
|
||||
*/
|
||||
diff --git a/src/xftglyphs.c b/src/xftglyphs.c
|
||||
index 4b5fb82..af2e3c1 100644
|
||||
--- a/src/xftglyphs.c
|
||||
+++ b/src/xftglyphs.c
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include FT_SYNTHESIS_H
|
||||
|
||||
+#include FT_GLYPH_H
|
||||
+
|
||||
/*
|
||||
* Validate the memory info for a font
|
||||
*/
|
||||
@@ -78,9 +80,11 @@ _XftFontValidateMemory (Display *dpy, XftFont *public)
|
||||
static int
|
||||
_compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
FT_GlyphSlot slot,
|
||||
- FT_Render_Mode mode )
|
||||
+ FT_Render_Mode mode,
|
||||
+ FT_Matrix* matrix )
|
||||
{
|
||||
FT_Bitmap* ftbit;
|
||||
+ FT_Vector vector;
|
||||
int width, height, pitch;
|
||||
|
||||
if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
|
||||
@@ -88,9 +92,18 @@ _compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
|
||||
// compute the size of the final bitmap
|
||||
ftbit = &slot->bitmap;
|
||||
-
|
||||
width = ftbit->width;
|
||||
height = ftbit->rows;
|
||||
+
|
||||
+ if ( matrix && mode == FT_RENDER_MODE_NORMAL )
|
||||
+ {
|
||||
+ vector.x = ftbit->width;
|
||||
+ vector.y = ftbit->rows;
|
||||
+ FT_Vector_Transform(&vector, matrix);
|
||||
+
|
||||
+ width = vector.x;
|
||||
+ height = vector.y;
|
||||
+ }
|
||||
pitch = (width+3) & ~3;
|
||||
|
||||
switch ( ftbit->pixel_mode )
|
||||
@@ -112,6 +125,10 @@ _compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case FT_PIXEL_MODE_BGRA:
|
||||
+ pitch = width * 4;
|
||||
+ break;
|
||||
+
|
||||
case FT_PIXEL_MODE_LCD:
|
||||
if ( mode != FT_RENDER_MODE_LCD )
|
||||
return -1;
|
||||
@@ -142,6 +159,105 @@ _compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
return pitch * height;
|
||||
}
|
||||
|
||||
+/* this functions converts the glyph bitmap found in a FT_GlyphSlot
|
||||
+ * into a different format while scaling by applying the given matrix
|
||||
+ * (see _compute_xrender_bitmap_size)
|
||||
+ *
|
||||
+ * you should call this function after _compute_xrender_bitmap_size
|
||||
+ *
|
||||
+ * target :: target bitmap descriptor. Note that its 'buffer' pointer
|
||||
+ * must point to memory allocated by the caller
|
||||
+ *
|
||||
+ * source :: the source bitmap descriptor
|
||||
+ *
|
||||
+ * matrix :: the scaling matrix to apply
|
||||
+ */
|
||||
+static void
|
||||
+_scaled_fill_xrender_bitmap( FT_Bitmap* target,
|
||||
+ FT_Bitmap* source,
|
||||
+ const FT_Matrix* matrix )
|
||||
+{
|
||||
+ unsigned char* src_buf = source->buffer;
|
||||
+ unsigned char* dst_line = target->buffer;
|
||||
+ int src_pitch = source->pitch;
|
||||
+ int width = target->width;
|
||||
+ int height = target->rows;
|
||||
+ int pitch = target->pitch;
|
||||
+ int h;
|
||||
+ FT_Vector vector;
|
||||
+ FT_Matrix inverse = *matrix;
|
||||
+ int sampling_width;
|
||||
+ int sampling_height;
|
||||
+ int sample_count;
|
||||
+
|
||||
+ if ( src_pitch < 0 )
|
||||
+ src_buf -= src_pitch*(source->rows-1);
|
||||
+
|
||||
+ FT_Matrix_Invert(&inverse);
|
||||
+
|
||||
+ /* compute how many source pixels a target pixel spans */
|
||||
+ vector.x = 1;
|
||||
+ vector.y = 1;
|
||||
+ FT_Vector_Transform(&vector, &inverse);
|
||||
+ sampling_width = vector.x / 2;
|
||||
+ sampling_height = vector.y / 2;
|
||||
+ sample_count = (2 * sampling_width + 1) * (2 * sampling_height + 1);
|
||||
+
|
||||
+ for ( h = height; h > 0; h--, dst_line += pitch )
|
||||
+ {
|
||||
+ int x;
|
||||
+
|
||||
+ for ( x = 0; x < width; x++ )
|
||||
+ {
|
||||
+ unsigned char* src;
|
||||
+
|
||||
+#define CLAMP(x, min, max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x)))
|
||||
+
|
||||
+ /* compute target pixel location in source space */
|
||||
+ vector.x = (x * 0x10000) + 0x10000 / 2;
|
||||
+ vector.y = ((height - h) * 0x10000) + 0x10000 / 2;
|
||||
+ FT_Vector_Transform(&vector, &inverse);
|
||||
+ vector.x = CLAMP(FT_RoundFix(vector.x) / 0x10000, 0, source->width - 1);
|
||||
+ vector.y = CLAMP(FT_RoundFix(vector.y) / 0x10000, 0, source->rows - 1);
|
||||
+
|
||||
+ switch ( source->pixel_mode )
|
||||
+ {
|
||||
+ case FT_PIXEL_MODE_MONO: /* convert mono to 8-bit gray, scale using nearest pixel */
|
||||
+ src = src_buf + (vector.y * src_pitch);
|
||||
+ if ( src[(vector.x >> 3)] & (0x80 >> (vector.x & 7)) )
|
||||
+ dst_line[x] = 0xff;
|
||||
+ break;
|
||||
+
|
||||
+ case FT_PIXEL_MODE_GRAY: /* scale using nearest pixel */
|
||||
+ src = src_buf + (vector.y * src_pitch);
|
||||
+ dst_line[x] = src[vector.x];
|
||||
+ break;
|
||||
+
|
||||
+ case FT_PIXEL_MODE_BGRA: /* scale by averaging all relevant source pixels, keep BGRA format */
|
||||
+ {
|
||||
+ int sample_x, sample_y;
|
||||
+ int bgra[4] = {};
|
||||
+ for (sample_y = - sampling_height; sample_y < sampling_height + 1; ++sample_y)
|
||||
+ {
|
||||
+ int src_y = CLAMP(vector.y + sample_y, 0, source->rows - 1);
|
||||
+ src = src_buf + (src_y * src_pitch);
|
||||
+ for (sample_x = - sampling_width; sample_x < sampling_width + 1; ++sample_x)
|
||||
+ {
|
||||
+ int src_x = CLAMP(vector.x + sample_x, 0, source->width - 1);
|
||||
+ for (int i = 0; i < 4; ++i)
|
||||
+ bgra[i] += src[src_x * 4 + i];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < 4; ++i)
|
||||
+ dst_line[4 * x + i] = bgra[i] / sample_count;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* this functions converts the glyph bitmap found in a FT_GlyphSlot
|
||||
* into a different format (see _compute_xrender_bitmap_size)
|
||||
*
|
||||
@@ -244,6 +360,11 @@ _fill_xrender_bitmap( FT_Bitmap* target,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case FT_PIXEL_MODE_BGRA: /* Preserve BGRA format */
|
||||
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
|
||||
+ memcpy( dstLine, srcLine, width * 4 );
|
||||
+ break;
|
||||
+
|
||||
case FT_PIXEL_MODE_LCD:
|
||||
if ( !bgr )
|
||||
{
|
||||
@@ -365,6 +486,8 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
FT_Vector vector;
|
||||
FT_Face face;
|
||||
FT_Render_Mode mode = FT_RENDER_MODE_MONO;
|
||||
+ FcBool transform;
|
||||
+ FcBool glyph_transform;
|
||||
|
||||
if (!info)
|
||||
return;
|
||||
@@ -374,6 +497,8 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
if (!face)
|
||||
return;
|
||||
|
||||
+ if (font->info.color)
|
||||
+ mode = FT_RENDER_MODE_NORMAL;
|
||||
if (font->info.antialias)
|
||||
{
|
||||
switch (font->info.rgba) {
|
||||
@@ -390,6 +515,8 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
|
||||
+ transform = font->info.transform && mode != FT_RENDER_MODE_MONO;
|
||||
+
|
||||
while (nglyph--)
|
||||
{
|
||||
glyphindex = *glyphs++;
|
||||
@@ -440,7 +567,7 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
/*
|
||||
* Compute glyph metrics from FreeType information
|
||||
*/
|
||||
- if(font->info.transform && glyphslot->format != FT_GLYPH_FORMAT_BITMAP)
|
||||
+ if (transform)
|
||||
{
|
||||
/*
|
||||
* calculate the true width by transforming all four corners.
|
||||
@@ -487,7 +614,7 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
* Clip charcell glyphs to the bounding box
|
||||
* XXX transformed?
|
||||
*/
|
||||
- if (font->info.spacing >= FC_CHARCELL && !font->info.transform)
|
||||
+ if (font->info.spacing >= FC_CHARCELL && !transform)
|
||||
{
|
||||
if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT)
|
||||
{
|
||||
@@ -519,18 +646,20 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
|
||||
+ glyph_transform = transform;
|
||||
if ( glyphslot->format != FT_GLYPH_FORMAT_BITMAP )
|
||||
{
|
||||
error = FT_Render_Glyph( face->glyph, mode );
|
||||
if (error)
|
||||
continue;
|
||||
+ glyph_transform = False;
|
||||
}
|
||||
|
||||
FT_Library_SetLcdFilter( _XftFTlibrary, FT_LCD_FILTER_NONE );
|
||||
|
||||
if (font->info.spacing >= FC_MONO)
|
||||
{
|
||||
- if (font->info.transform)
|
||||
+ if (transform)
|
||||
{
|
||||
if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT)
|
||||
{
|
||||
@@ -613,14 +742,27 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
|
||||
- size = _compute_xrender_bitmap_size( &local, glyphslot, mode );
|
||||
+ size = _compute_xrender_bitmap_size( &local, glyphslot, mode, glyph_transform ? &font->info.matrix : NULL );
|
||||
if ( size < 0 )
|
||||
continue;
|
||||
|
||||
xftg->metrics.width = local.width;
|
||||
xftg->metrics.height = local.rows;
|
||||
- xftg->metrics.x = - glyphslot->bitmap_left;
|
||||
- xftg->metrics.y = glyphslot->bitmap_top;
|
||||
+ if (transform)
|
||||
+ {
|
||||
+ vector.x = - glyphslot->bitmap_left;
|
||||
+ vector.y = glyphslot->bitmap_top;
|
||||
+
|
||||
+ FT_Vector_Transform(&vector, &font->info.matrix);
|
||||
+
|
||||
+ xftg->metrics.x = vector.x;
|
||||
+ xftg->metrics.y = vector.y;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ xftg->metrics.x = - glyphslot->bitmap_left;
|
||||
+ xftg->metrics.y = glyphslot->bitmap_top;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* If the glyph is relatively large (> 1% of server memory),
|
||||
@@ -645,9 +787,12 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
|
||||
local.buffer = bufBitmap;
|
||||
|
||||
- _fill_xrender_bitmap( &local, glyphslot, mode,
|
||||
- (font->info.rgba == FC_RGBA_BGR ||
|
||||
- font->info.rgba == FC_RGBA_VBGR ) );
|
||||
+ if (mode == FT_RENDER_MODE_NORMAL && glyph_transform)
|
||||
+ _scaled_fill_xrender_bitmap(&local, &glyphslot->bitmap, &font->info.matrix);
|
||||
+ else
|
||||
+ _fill_xrender_bitmap( &local, glyphslot, mode,
|
||||
+ (font->info.rgba == FC_RGBA_BGR ||
|
||||
+ font->info.rgba == FC_RGBA_VBGR ) );
|
||||
|
||||
/*
|
||||
* Copy or convert into local buffer.
|
||||
@@ -662,6 +807,7 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
*/
|
||||
glyph = (Glyph) glyphindex;
|
||||
|
||||
+ xftg->picture = 0;
|
||||
xftg->glyph_memory = size + sizeof (XftGlyph);
|
||||
if (font->format)
|
||||
{
|
||||
@@ -685,15 +831,35 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
}
|
||||
- else if ( mode != FT_RENDER_MODE_NORMAL )
|
||||
+ else if (glyphslot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA || mode != FT_RENDER_MODE_NORMAL)
|
||||
{
|
||||
/* invert ARGB <=> BGRA */
|
||||
if (ImageByteOrder (dpy) != XftNativeByteOrder ())
|
||||
XftSwapCARD32 ((CARD32 *) bufBitmap, size >> 2);
|
||||
}
|
||||
- XRenderAddGlyphs (dpy, font->glyphset, &glyph,
|
||||
- &xftg->metrics, 1,
|
||||
- (char *) bufBitmap, size);
|
||||
+
|
||||
+ if (glyphslot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA)
|
||||
+ {
|
||||
+ Pixmap pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), local.width, local.rows, 32);
|
||||
+ GC gc = XCreateGC(dpy, pixmap, 0, NULL);
|
||||
+ XImage image = {
|
||||
+ local.width, local.rows, 0, ZPixmap, (char *)bufBitmap,
|
||||
+ dpy->byte_order, dpy->bitmap_unit, dpy->bitmap_bit_order, 32,
|
||||
+ 32, local.width * 4 - local.pitch, 32,
|
||||
+ 0, 0, 0
|
||||
+ };
|
||||
+
|
||||
+ XInitImage(&image);
|
||||
+ XPutImage(dpy, pixmap, gc, &image, 0, 0, 0, 0, local.width, local.rows);
|
||||
+ xftg->picture = XRenderCreatePicture(dpy, pixmap, font->format, 0, NULL);
|
||||
+
|
||||
+ XFreeGC(dpy, gc);
|
||||
+ XFreePixmap(dpy, pixmap);
|
||||
+ }
|
||||
+ else
|
||||
+ XRenderAddGlyphs (dpy, font->glyphset, &glyph,
|
||||
+ &xftg->metrics, 1,
|
||||
+ (char *) bufBitmap, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -744,7 +910,9 @@ XftFontUnloadGlyphs (Display *dpy,
|
||||
{
|
||||
if (font->format)
|
||||
{
|
||||
- if (font->glyphset)
|
||||
+ if (xftg->picture)
|
||||
+ XRenderFreePicture(dpy, xftg->picture);
|
||||
+ else if (font->glyphset)
|
||||
{
|
||||
glyphBuf[nused++] = (Glyph) glyphindex;
|
||||
if (nused == sizeof (glyphBuf) / sizeof (glyphBuf[0]))
|
||||
diff --git a/src/xftint.h b/src/xftint.h
|
||||
index c06ac3c..b263520 100644
|
||||
--- a/src/xftint.h
|
||||
+++ b/src/xftint.h
|
||||
@@ -85,6 +85,7 @@ typedef struct _XftGlyph {
|
||||
XGlyphInfo metrics;
|
||||
void *bitmap;
|
||||
unsigned long glyph_memory;
|
||||
+ Picture picture;
|
||||
} XftGlyph;
|
||||
|
||||
/*
|
||||
@@ -134,6 +135,7 @@ struct _XftFontInfo {
|
||||
FT_F26Dot6 xsize, ysize; /* pixel size */
|
||||
FcBool antialias; /* doing antialiasing */
|
||||
FcBool embolden; /* force emboldening */
|
||||
+ FcBool color; /* contains color glyphs */
|
||||
int rgba; /* subpixel order */
|
||||
int lcd_filter; /* lcd filter */
|
||||
FT_Matrix matrix; /* glyph transformation matrix */
|
||||
diff --git a/src/xftrender.c b/src/xftrender.c
|
||||
index b280c03..9a789cb 100644
|
||||
--- a/src/xftrender.c
|
||||
+++ b/src/xftrender.c
|
||||
@@ -25,6 +25,35 @@
|
||||
#define NUM_LOCAL 1024
|
||||
#define NUM_ELT_LOCAL 128
|
||||
|
||||
+/*
|
||||
+ * Dispatch glyph drawing to the correct XRenderCompositeString function
|
||||
+ */
|
||||
+static void
|
||||
+_XftCompositeString (Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat* format, GlyphSet glyphset, int srcx, int srcy, int dstx, int dsty, int charwidth, unsigned int* chars, int nchars)
|
||||
+{
|
||||
+ if (nchars == 0)
|
||||
+ return;
|
||||
+
|
||||
+ switch (charwidth) {
|
||||
+ case 1:
|
||||
+ default:
|
||||
+ XRenderCompositeString8 (dpy, op,
|
||||
+ src, dst, format, glyphset,
|
||||
+ srcx, srcy, dstx, dsty, (char*)chars, nchars);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ XRenderCompositeString16(dpy, op,
|
||||
+ src, dst, format, glyphset,
|
||||
+ srcx, srcy, dstx, dsty, (unsigned short*)chars, nchars);
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ XRenderCompositeString32(dpy, op,
|
||||
+ src, dst, format, glyphset,
|
||||
+ srcx, srcy, dstx, dsty, (unsigned int*)chars, nchars);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Use the Render extension to draw the glyphs
|
||||
*/
|
||||
@@ -43,12 +72,14 @@ XftGlyphRender (Display *dpy,
|
||||
int nglyphs)
|
||||
{
|
||||
XftFontInt *font = (XftFontInt *) pub;
|
||||
- int i;
|
||||
+ int i, j;
|
||||
FT_UInt missing[XFT_NMISSING];
|
||||
int nmissing;
|
||||
FT_UInt g, max;
|
||||
int size, width;
|
||||
+ int dstx, dsty;
|
||||
Glyph wire;
|
||||
+ XftGlyph* glyph;
|
||||
char *char8;
|
||||
unsigned short *char16;
|
||||
unsigned int *char32;
|
||||
@@ -100,43 +131,75 @@ XftGlyphRender (Display *dpy,
|
||||
if (!chars)
|
||||
goto bail1;
|
||||
}
|
||||
+ dstx = x;
|
||||
+ dsty = y;
|
||||
char8 = (char *) chars;
|
||||
char16 = (unsigned short *) chars;
|
||||
char32 = (unsigned int *) chars;
|
||||
- for (i = 0; i < nglyphs; i++)
|
||||
+ for (i = 0, j = 0; i < nglyphs; i++)
|
||||
{
|
||||
wire = (Glyph) glyphs[i];
|
||||
if (wire >= font->num_glyphs || !font->glyphs[wire])
|
||||
wire = 0;
|
||||
- switch (width) {
|
||||
- case 1: char8[i] = (char) wire; break;
|
||||
- case 2: char16[i] = (unsigned short) wire; break;
|
||||
- case 4: char32[i] = (unsigned long) wire; break;
|
||||
+ glyph = font->glyphs[wire];
|
||||
+ if (glyph->picture)
|
||||
+ {
|
||||
+ _XftCompositeString(dpy, op, src, dst, font->format, font->glyphset, srcx, srcy, x, y, width, chars, j);
|
||||
+ XRenderComposite(dpy, PictOpOver, glyph->picture, None, dst, 0, 0, 0, 0, dstx, dsty - glyph->metrics.y, glyph->metrics.width, glyph->metrics.height);
|
||||
+ x = dstx = dstx + glyph->metrics.xOff;
|
||||
+ x = dsty = dsty + glyph->metrics.yOff;
|
||||
+ j = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ switch (width) {
|
||||
+ case 1: char8[j] = (char) wire; break;
|
||||
+ case 2: char16[j] = (unsigned short) wire; break;
|
||||
+ case 4: char32[j] = (unsigned long) wire; break;
|
||||
+ }
|
||||
+ dstx += glyph->metrics.xOff;
|
||||
+ dsty += glyph->metrics.yOff;
|
||||
+ ++j;
|
||||
}
|
||||
}
|
||||
- switch (width) {
|
||||
+ _XftCompositeString(dpy, op, src, dst, font->format, font->glyphset, srcx, srcy, x, y, width, chars, j);
|
||||
+ if (chars != char_local)
|
||||
+ free (chars);
|
||||
+bail1:
|
||||
+ if (glyphs_loaded)
|
||||
+ _XftFontManageMemory (dpy, pub);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Dispatch glyph drawing to the correct XRenderCompositeText function
|
||||
+ */
|
||||
+static void
|
||||
+_XftCompositeText (Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat* format, int srcx, int srcy, int dstx, int dsty, int eltwidth, XGlyphElt8* elts, int nelt)
|
||||
+{
|
||||
+ if (nelt == 0)
|
||||
+ return;
|
||||
+
|
||||
+ switch (eltwidth) {
|
||||
case 1:
|
||||
default:
|
||||
- XRenderCompositeString8 (dpy, op,
|
||||
- src, dst, font->format, font->glyphset,
|
||||
- srcx, srcy, x, y, char8, nglyphs);
|
||||
+ XRenderCompositeText8 (dpy, op,
|
||||
+ src, dst, format,
|
||||
+ srcx, srcy, dstx, dsty,
|
||||
+ (XGlyphElt8*)elts, nelt);
|
||||
break;
|
||||
case 2:
|
||||
- XRenderCompositeString16(dpy, op,
|
||||
- src, dst, font->format, font->glyphset,
|
||||
- srcx, srcy, x, y, char16, nglyphs);
|
||||
+ XRenderCompositeText16(dpy, op,
|
||||
+ src, dst, format,
|
||||
+ srcx, srcy, dstx, dsty,
|
||||
+ (XGlyphElt16*)elts, nelt);
|
||||
break;
|
||||
case 4:
|
||||
- XRenderCompositeString32(dpy, op,
|
||||
- src, dst, font->format, font->glyphset,
|
||||
- srcx, srcy, x, y, char32, nglyphs);
|
||||
+ XRenderCompositeText32(dpy, op,
|
||||
+ src, dst, format,
|
||||
+ srcx, srcy, dstx, dsty,
|
||||
+ (XGlyphElt32*)elts, nelt);
|
||||
break;
|
||||
}
|
||||
- if (chars != char_local)
|
||||
- free (chars);
|
||||
-bail1:
|
||||
- if (glyphs_loaded)
|
||||
- _XftFontManageMemory (dpy, pub);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
@@ -251,9 +314,10 @@ XftGlyphSpecRender (Display *dpy,
|
||||
g = 0;
|
||||
/*
|
||||
* check to see if the glyph is placed where it would
|
||||
- * fall using the normal spacing
|
||||
+ * fall using the normal spacing and if it would render
|
||||
+ * as a XRender glyph
|
||||
*/
|
||||
- if ((glyph = font->glyphs[g]))
|
||||
+ if ((glyph = font->glyphs[g]) && !glyph->picture)
|
||||
{
|
||||
if (x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
@@ -267,7 +331,7 @@ XftGlyphSpecRender (Display *dpy,
|
||||
}
|
||||
|
||||
elts = elts_local;
|
||||
- if (nelt > NUM_ELT_LOCAL)
|
||||
+ if (!font->info.color && nelt > NUM_ELT_LOCAL)
|
||||
{
|
||||
elts = malloc (nelt * sizeof (XGlyphElt8));
|
||||
if (!elts)
|
||||
@@ -275,7 +339,7 @@ XftGlyphSpecRender (Display *dpy,
|
||||
}
|
||||
|
||||
/*
|
||||
- * Generate the list of glyph elts
|
||||
+ * Generate the list of glyph elts or render color glyphs
|
||||
*/
|
||||
nelt = 0;
|
||||
x = y = 0;
|
||||
@@ -289,6 +353,11 @@ XftGlyphSpecRender (Display *dpy,
|
||||
g = 0;
|
||||
if ((glyph = font->glyphs[g]))
|
||||
{
|
||||
+ if (glyph->picture)
|
||||
+ {
|
||||
+ XRenderComposite(dpy, PictOpOver, glyph->picture, None, dst, 0, 0, 0, 0, glyphs[i].x, glyphs[i].y - glyph->metrics.y, glyph->metrics.width, glyph->metrics.height);
|
||||
+ continue;
|
||||
+ }
|
||||
if (!i || x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
if (n)
|
||||
@@ -320,23 +389,9 @@ XftGlyphSpecRender (Display *dpy,
|
||||
elts[nelt].nchars = n;
|
||||
nelt++;
|
||||
}
|
||||
- switch (width) {
|
||||
- case 1:
|
||||
- XRenderCompositeText8 (dpy, op, src, dst, font->format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- elts, nelt);
|
||||
- break;
|
||||
- case 2:
|
||||
- XRenderCompositeText16 (dpy, op, src, dst, font->format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt16 *) elts, nelt);
|
||||
- break;
|
||||
- case 4:
|
||||
- XRenderCompositeText32 (dpy, op, src, dst, font->format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt32 *) elts, nelt);
|
||||
- break;
|
||||
- }
|
||||
+ _XftCompositeText(dpy, op, src, dst, font->format,
|
||||
+ srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
+ width, elts, nelt);
|
||||
|
||||
if (elts != elts_local)
|
||||
free (elts);
|
||||
@@ -535,7 +590,7 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
* check to see if the glyph is placed where it would
|
||||
* fall using the normal spacing
|
||||
*/
|
||||
- if ((glyph = font->glyphs[g]))
|
||||
+ if ((glyph = font->glyphs[g]) && !glyph->picture)
|
||||
{
|
||||
if (pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
@@ -560,7 +615,7 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
}
|
||||
|
||||
/*
|
||||
- * Generate the list of glyph elts
|
||||
+ * Generate the list of glyph elts and render color glyphs
|
||||
*/
|
||||
nelt = 0;
|
||||
x = y = 0;
|
||||
@@ -578,6 +633,11 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
g = 0;
|
||||
if ((glyph = font->glyphs[g]))
|
||||
{
|
||||
+ if (glyph->picture)
|
||||
+ {
|
||||
+ XRenderComposite(dpy, PictOpOver, glyph->picture, None, dst, 0, 0, 0, 0, glyphs[i].x, glyphs[i].y - glyph->metrics.y, glyph->metrics.width, glyph->metrics.height);
|
||||
+ continue;
|
||||
+ }
|
||||
if (!i || pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
if (n)
|
||||
@@ -610,23 +670,9 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
elts[nelt].nchars = n;
|
||||
nelt++;
|
||||
}
|
||||
- switch (width) {
|
||||
- case 1:
|
||||
- XRenderCompositeText8 (dpy, op, src, dst, format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- elts, nelt);
|
||||
- break;
|
||||
- case 2:
|
||||
- XRenderCompositeText16 (dpy, op, src, dst, format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt16 *) elts, nelt);
|
||||
- break;
|
||||
- case 4:
|
||||
- XRenderCompositeText32 (dpy, op, src, dst, format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt32 *) elts, nelt);
|
||||
- break;
|
||||
- }
|
||||
+ _XftCompositeText(dpy, op, src, dst, format,
|
||||
+ srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
+ width, elts, nelt);
|
||||
|
||||
if (elts != elts_local)
|
||||
free (elts);
|
||||
--
|
||||
2.26.2
|
||||
|
|
@ -0,0 +1,738 @@
|
|||
From 7808631e7a9a605d5fe7a1077129c658d9ec47fc Mon Sep 17 00:00:00 2001
|
||||
From: Maxime Coste <mawww@kakoune.org>
|
||||
Date: Tue, 22 Oct 2019 22:46:49 +1100
|
||||
Subject: [PATCH] Add support for BGRA glyphs display and scaling
|
||||
|
||||
Display is done using an XRender Picture, as XRender
|
||||
glyphs are incompatible with BGRA rendering due to
|
||||
their use of the glyph bitmap as a mask.
|
||||
|
||||
Scaling is done by averaging all relevant pixel, which gives
|
||||
much better result than nearest pixel sampling while staying
|
||||
simple enough and not too computationally expensive.
|
||||
|
||||
This enables color emoji rendering support.
|
||||
|
||||
Fixes: #6
|
||||
|
||||
Signed-off-by: Maxime Coste <mawww@kakoune.org>
|
||||
---
|
||||
src/xftfreetype.c | 18 ++++-
|
||||
src/xftglyphs.c | 200 ++++++++++++++++++++++++++++++++++++++++++----
|
||||
src/xftint.h | 2 +
|
||||
src/xftrender.c | 168 ++++++++++++++++++++++++--------------
|
||||
4 files changed, 307 insertions(+), 81 deletions(-)
|
||||
|
||||
diff --git a/src/xftfreetype.c b/src/xftfreetype.c
|
||||
index a3b8332..a639a03 100644
|
||||
--- a/src/xftfreetype.c
|
||||
+++ b/src/xftfreetype.c
|
||||
@@ -514,7 +514,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi)
|
||||
/*
|
||||
* Compute glyph load flags
|
||||
*/
|
||||
- fi->load_flags = FT_LOAD_DEFAULT;
|
||||
+ fi->load_flags = FT_LOAD_DEFAULT | FT_LOAD_COLOR;
|
||||
|
||||
#ifndef XFT_EMBEDDED_BITMAP
|
||||
#define XFT_EMBEDDED_BITMAP "embeddedbitmap"
|
||||
@@ -766,6 +766,7 @@ XftFontOpenInfo (Display *dpy,
|
||||
FcChar32 hash_value;
|
||||
FcChar32 rehash_value;
|
||||
FcBool antialias;
|
||||
+ FcBool color;
|
||||
int max_glyph_memory;
|
||||
int alloc_size;
|
||||
int ascent, descent, height;
|
||||
@@ -822,12 +823,16 @@ XftFontOpenInfo (Display *dpy,
|
||||
if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
|
||||
antialias = FcFalse;
|
||||
|
||||
+ color = FT_HAS_COLOR(face) ? FcTrue : FcFalse;
|
||||
+
|
||||
/*
|
||||
* Find the appropriate picture format
|
||||
*/
|
||||
if (fi->render)
|
||||
{
|
||||
- if (antialias)
|
||||
+ if (color)
|
||||
+ format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
|
||||
+ else if (antialias)
|
||||
{
|
||||
switch (fi->rgba) {
|
||||
case FC_RGBA_RGB:
|
||||
@@ -842,9 +847,7 @@ XftFontOpenInfo (Display *dpy,
|
||||
}
|
||||
}
|
||||
else
|
||||
- {
|
||||
format = XRenderFindStandardFormat (dpy, PictStandardA1);
|
||||
- }
|
||||
|
||||
if (!format)
|
||||
goto bail2;
|
||||
@@ -959,6 +962,13 @@ XftFontOpenInfo (Display *dpy,
|
||||
* which doesn't happen in XftFontInfoFill
|
||||
*/
|
||||
font->info.antialias = antialias;
|
||||
+
|
||||
+ /*
|
||||
+ * Set color value, which is only known once the
|
||||
+ * font was loaded
|
||||
+ */
|
||||
+ font->info.color = color;
|
||||
+
|
||||
/*
|
||||
* bump XftFile reference count
|
||||
*/
|
||||
diff --git a/src/xftglyphs.c b/src/xftglyphs.c
|
||||
index 4b5fb82..af2e3c1 100644
|
||||
--- a/src/xftglyphs.c
|
||||
+++ b/src/xftglyphs.c
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include FT_SYNTHESIS_H
|
||||
|
||||
+#include FT_GLYPH_H
|
||||
+
|
||||
/*
|
||||
* Validate the memory info for a font
|
||||
*/
|
||||
@@ -78,9 +80,11 @@ _XftFontValidateMemory (Display *dpy, XftFont *public)
|
||||
static int
|
||||
_compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
FT_GlyphSlot slot,
|
||||
- FT_Render_Mode mode )
|
||||
+ FT_Render_Mode mode,
|
||||
+ FT_Matrix* matrix )
|
||||
{
|
||||
FT_Bitmap* ftbit;
|
||||
+ FT_Vector vector;
|
||||
int width, height, pitch;
|
||||
|
||||
if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
|
||||
@@ -88,9 +92,18 @@ _compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
|
||||
// compute the size of the final bitmap
|
||||
ftbit = &slot->bitmap;
|
||||
-
|
||||
width = ftbit->width;
|
||||
height = ftbit->rows;
|
||||
+
|
||||
+ if ( matrix && mode == FT_RENDER_MODE_NORMAL )
|
||||
+ {
|
||||
+ vector.x = ftbit->width;
|
||||
+ vector.y = ftbit->rows;
|
||||
+ FT_Vector_Transform(&vector, matrix);
|
||||
+
|
||||
+ width = vector.x;
|
||||
+ height = vector.y;
|
||||
+ }
|
||||
pitch = (width+3) & ~3;
|
||||
|
||||
switch ( ftbit->pixel_mode )
|
||||
@@ -112,6 +125,10 @@ _compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case FT_PIXEL_MODE_BGRA:
|
||||
+ pitch = width * 4;
|
||||
+ break;
|
||||
+
|
||||
case FT_PIXEL_MODE_LCD:
|
||||
if ( mode != FT_RENDER_MODE_LCD )
|
||||
return -1;
|
||||
@@ -142,6 +159,105 @@ _compute_xrender_bitmap_size( FT_Bitmap* target,
|
||||
return pitch * height;
|
||||
}
|
||||
|
||||
+/* this functions converts the glyph bitmap found in a FT_GlyphSlot
|
||||
+ * into a different format while scaling by applying the given matrix
|
||||
+ * (see _compute_xrender_bitmap_size)
|
||||
+ *
|
||||
+ * you should call this function after _compute_xrender_bitmap_size
|
||||
+ *
|
||||
+ * target :: target bitmap descriptor. Note that its 'buffer' pointer
|
||||
+ * must point to memory allocated by the caller
|
||||
+ *
|
||||
+ * source :: the source bitmap descriptor
|
||||
+ *
|
||||
+ * matrix :: the scaling matrix to apply
|
||||
+ */
|
||||
+static void
|
||||
+_scaled_fill_xrender_bitmap( FT_Bitmap* target,
|
||||
+ FT_Bitmap* source,
|
||||
+ const FT_Matrix* matrix )
|
||||
+{
|
||||
+ unsigned char* src_buf = source->buffer;
|
||||
+ unsigned char* dst_line = target->buffer;
|
||||
+ int src_pitch = source->pitch;
|
||||
+ int width = target->width;
|
||||
+ int height = target->rows;
|
||||
+ int pitch = target->pitch;
|
||||
+ int h;
|
||||
+ FT_Vector vector;
|
||||
+ FT_Matrix inverse = *matrix;
|
||||
+ int sampling_width;
|
||||
+ int sampling_height;
|
||||
+ int sample_count;
|
||||
+
|
||||
+ if ( src_pitch < 0 )
|
||||
+ src_buf -= src_pitch*(source->rows-1);
|
||||
+
|
||||
+ FT_Matrix_Invert(&inverse);
|
||||
+
|
||||
+ /* compute how many source pixels a target pixel spans */
|
||||
+ vector.x = 1;
|
||||
+ vector.y = 1;
|
||||
+ FT_Vector_Transform(&vector, &inverse);
|
||||
+ sampling_width = vector.x / 2;
|
||||
+ sampling_height = vector.y / 2;
|
||||
+ sample_count = (2 * sampling_width + 1) * (2 * sampling_height + 1);
|
||||
+
|
||||
+ for ( h = height; h > 0; h--, dst_line += pitch )
|
||||
+ {
|
||||
+ int x;
|
||||
+
|
||||
+ for ( x = 0; x < width; x++ )
|
||||
+ {
|
||||
+ unsigned char* src;
|
||||
+
|
||||
+#define CLAMP(x, min, max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x)))
|
||||
+
|
||||
+ /* compute target pixel location in source space */
|
||||
+ vector.x = (x * 0x10000) + 0x10000 / 2;
|
||||
+ vector.y = ((height - h) * 0x10000) + 0x10000 / 2;
|
||||
+ FT_Vector_Transform(&vector, &inverse);
|
||||
+ vector.x = CLAMP(FT_RoundFix(vector.x) / 0x10000, 0, source->width - 1);
|
||||
+ vector.y = CLAMP(FT_RoundFix(vector.y) / 0x10000, 0, source->rows - 1);
|
||||
+
|
||||
+ switch ( source->pixel_mode )
|
||||
+ {
|
||||
+ case FT_PIXEL_MODE_MONO: /* convert mono to 8-bit gray, scale using nearest pixel */
|
||||
+ src = src_buf + (vector.y * src_pitch);
|
||||
+ if ( src[(vector.x >> 3)] & (0x80 >> (vector.x & 7)) )
|
||||
+ dst_line[x] = 0xff;
|
||||
+ break;
|
||||
+
|
||||
+ case FT_PIXEL_MODE_GRAY: /* scale using nearest pixel */
|
||||
+ src = src_buf + (vector.y * src_pitch);
|
||||
+ dst_line[x] = src[vector.x];
|
||||
+ break;
|
||||
+
|
||||
+ case FT_PIXEL_MODE_BGRA: /* scale by averaging all relevant source pixels, keep BGRA format */
|
||||
+ {
|
||||
+ int sample_x, sample_y;
|
||||
+ int bgra[4] = {};
|
||||
+ for (sample_y = - sampling_height; sample_y < sampling_height + 1; ++sample_y)
|
||||
+ {
|
||||
+ int src_y = CLAMP(vector.y + sample_y, 0, source->rows - 1);
|
||||
+ src = src_buf + (src_y * src_pitch);
|
||||
+ for (sample_x = - sampling_width; sample_x < sampling_width + 1; ++sample_x)
|
||||
+ {
|
||||
+ int src_x = CLAMP(vector.x + sample_x, 0, source->width - 1);
|
||||
+ for (int i = 0; i < 4; ++i)
|
||||
+ bgra[i] += src[src_x * 4 + i];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < 4; ++i)
|
||||
+ dst_line[4 * x + i] = bgra[i] / sample_count;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* this functions converts the glyph bitmap found in a FT_GlyphSlot
|
||||
* into a different format (see _compute_xrender_bitmap_size)
|
||||
*
|
||||
@@ -244,6 +360,11 @@ _fill_xrender_bitmap( FT_Bitmap* target,
|
||||
}
|
||||
break;
|
||||
|
||||
+ case FT_PIXEL_MODE_BGRA: /* Preserve BGRA format */
|
||||
+ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch )
|
||||
+ memcpy( dstLine, srcLine, width * 4 );
|
||||
+ break;
|
||||
+
|
||||
case FT_PIXEL_MODE_LCD:
|
||||
if ( !bgr )
|
||||
{
|
||||
@@ -365,6 +486,8 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
FT_Vector vector;
|
||||
FT_Face face;
|
||||
FT_Render_Mode mode = FT_RENDER_MODE_MONO;
|
||||
+ FcBool transform;
|
||||
+ FcBool glyph_transform;
|
||||
|
||||
if (!info)
|
||||
return;
|
||||
@@ -374,6 +497,8 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
if (!face)
|
||||
return;
|
||||
|
||||
+ if (font->info.color)
|
||||
+ mode = FT_RENDER_MODE_NORMAL;
|
||||
if (font->info.antialias)
|
||||
{
|
||||
switch (font->info.rgba) {
|
||||
@@ -390,6 +515,8 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
|
||||
+ transform = font->info.transform && mode != FT_RENDER_MODE_MONO;
|
||||
+
|
||||
while (nglyph--)
|
||||
{
|
||||
glyphindex = *glyphs++;
|
||||
@@ -440,7 +567,7 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
/*
|
||||
* Compute glyph metrics from FreeType information
|
||||
*/
|
||||
- if(font->info.transform && glyphslot->format != FT_GLYPH_FORMAT_BITMAP)
|
||||
+ if (transform)
|
||||
{
|
||||
/*
|
||||
* calculate the true width by transforming all four corners.
|
||||
@@ -487,7 +614,7 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
* Clip charcell glyphs to the bounding box
|
||||
* XXX transformed?
|
||||
*/
|
||||
- if (font->info.spacing >= FC_CHARCELL && !font->info.transform)
|
||||
+ if (font->info.spacing >= FC_CHARCELL && !transform)
|
||||
{
|
||||
if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT)
|
||||
{
|
||||
@@ -519,18 +646,20 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
|
||||
+ glyph_transform = transform;
|
||||
if ( glyphslot->format != FT_GLYPH_FORMAT_BITMAP )
|
||||
{
|
||||
error = FT_Render_Glyph( face->glyph, mode );
|
||||
if (error)
|
||||
continue;
|
||||
+ glyph_transform = False;
|
||||
}
|
||||
|
||||
FT_Library_SetLcdFilter( _XftFTlibrary, FT_LCD_FILTER_NONE );
|
||||
|
||||
if (font->info.spacing >= FC_MONO)
|
||||
{
|
||||
- if (font->info.transform)
|
||||
+ if (transform)
|
||||
{
|
||||
if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT)
|
||||
{
|
||||
@@ -613,14 +742,27 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
|
||||
- size = _compute_xrender_bitmap_size( &local, glyphslot, mode );
|
||||
+ size = _compute_xrender_bitmap_size( &local, glyphslot, mode, glyph_transform ? &font->info.matrix : NULL );
|
||||
if ( size < 0 )
|
||||
continue;
|
||||
|
||||
xftg->metrics.width = local.width;
|
||||
xftg->metrics.height = local.rows;
|
||||
- xftg->metrics.x = - glyphslot->bitmap_left;
|
||||
- xftg->metrics.y = glyphslot->bitmap_top;
|
||||
+ if (transform)
|
||||
+ {
|
||||
+ vector.x = - glyphslot->bitmap_left;
|
||||
+ vector.y = glyphslot->bitmap_top;
|
||||
+
|
||||
+ FT_Vector_Transform(&vector, &font->info.matrix);
|
||||
+
|
||||
+ xftg->metrics.x = vector.x;
|
||||
+ xftg->metrics.y = vector.y;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ xftg->metrics.x = - glyphslot->bitmap_left;
|
||||
+ xftg->metrics.y = glyphslot->bitmap_top;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* If the glyph is relatively large (> 1% of server memory),
|
||||
@@ -645,9 +787,12 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
|
||||
local.buffer = bufBitmap;
|
||||
|
||||
- _fill_xrender_bitmap( &local, glyphslot, mode,
|
||||
- (font->info.rgba == FC_RGBA_BGR ||
|
||||
- font->info.rgba == FC_RGBA_VBGR ) );
|
||||
+ if (mode == FT_RENDER_MODE_NORMAL && glyph_transform)
|
||||
+ _scaled_fill_xrender_bitmap(&local, &glyphslot->bitmap, &font->info.matrix);
|
||||
+ else
|
||||
+ _fill_xrender_bitmap( &local, glyphslot, mode,
|
||||
+ (font->info.rgba == FC_RGBA_BGR ||
|
||||
+ font->info.rgba == FC_RGBA_VBGR ) );
|
||||
|
||||
/*
|
||||
* Copy or convert into local buffer.
|
||||
@@ -662,6 +807,7 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
*/
|
||||
glyph = (Glyph) glyphindex;
|
||||
|
||||
+ xftg->picture = 0;
|
||||
xftg->glyph_memory = size + sizeof (XftGlyph);
|
||||
if (font->format)
|
||||
{
|
||||
@@ -685,15 +831,35 @@ XftFontLoadGlyphs (Display *dpy,
|
||||
}
|
||||
}
|
||||
}
|
||||
- else if ( mode != FT_RENDER_MODE_NORMAL )
|
||||
+ else if (glyphslot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA || mode != FT_RENDER_MODE_NORMAL)
|
||||
{
|
||||
/* invert ARGB <=> BGRA */
|
||||
if (ImageByteOrder (dpy) != XftNativeByteOrder ())
|
||||
XftSwapCARD32 ((CARD32 *) bufBitmap, size >> 2);
|
||||
}
|
||||
- XRenderAddGlyphs (dpy, font->glyphset, &glyph,
|
||||
- &xftg->metrics, 1,
|
||||
- (char *) bufBitmap, size);
|
||||
+
|
||||
+ if (glyphslot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA)
|
||||
+ {
|
||||
+ Pixmap pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), local.width, local.rows, 32);
|
||||
+ GC gc = XCreateGC(dpy, pixmap, 0, NULL);
|
||||
+ XImage image = {
|
||||
+ local.width, local.rows, 0, ZPixmap, (char *)bufBitmap,
|
||||
+ dpy->byte_order, dpy->bitmap_unit, dpy->bitmap_bit_order, 32,
|
||||
+ 32, local.width * 4 - local.pitch, 32,
|
||||
+ 0, 0, 0
|
||||
+ };
|
||||
+
|
||||
+ XInitImage(&image);
|
||||
+ XPutImage(dpy, pixmap, gc, &image, 0, 0, 0, 0, local.width, local.rows);
|
||||
+ xftg->picture = XRenderCreatePicture(dpy, pixmap, font->format, 0, NULL);
|
||||
+
|
||||
+ XFreeGC(dpy, gc);
|
||||
+ XFreePixmap(dpy, pixmap);
|
||||
+ }
|
||||
+ else
|
||||
+ XRenderAddGlyphs (dpy, font->glyphset, &glyph,
|
||||
+ &xftg->metrics, 1,
|
||||
+ (char *) bufBitmap, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -744,7 +910,9 @@ XftFontUnloadGlyphs (Display *dpy,
|
||||
{
|
||||
if (font->format)
|
||||
{
|
||||
- if (font->glyphset)
|
||||
+ if (xftg->picture)
|
||||
+ XRenderFreePicture(dpy, xftg->picture);
|
||||
+ else if (font->glyphset)
|
||||
{
|
||||
glyphBuf[nused++] = (Glyph) glyphindex;
|
||||
if (nused == sizeof (glyphBuf) / sizeof (glyphBuf[0]))
|
||||
diff --git a/src/xftint.h b/src/xftint.h
|
||||
index c06ac3c..b263520 100644
|
||||
--- a/src/xftint.h
|
||||
+++ b/src/xftint.h
|
||||
@@ -85,6 +85,7 @@ typedef struct _XftGlyph {
|
||||
XGlyphInfo metrics;
|
||||
void *bitmap;
|
||||
unsigned long glyph_memory;
|
||||
+ Picture picture;
|
||||
} XftGlyph;
|
||||
|
||||
/*
|
||||
@@ -134,6 +135,7 @@ struct _XftFontInfo {
|
||||
FT_F26Dot6 xsize, ysize; /* pixel size */
|
||||
FcBool antialias; /* doing antialiasing */
|
||||
FcBool embolden; /* force emboldening */
|
||||
+ FcBool color; /* contains color glyphs */
|
||||
int rgba; /* subpixel order */
|
||||
int lcd_filter; /* lcd filter */
|
||||
FT_Matrix matrix; /* glyph transformation matrix */
|
||||
diff --git a/src/xftrender.c b/src/xftrender.c
|
||||
index b280c03..9a789cb 100644
|
||||
--- a/src/xftrender.c
|
||||
+++ b/src/xftrender.c
|
||||
@@ -25,6 +25,35 @@
|
||||
#define NUM_LOCAL 1024
|
||||
#define NUM_ELT_LOCAL 128
|
||||
|
||||
+/*
|
||||
+ * Dispatch glyph drawing to the correct XRenderCompositeString function
|
||||
+ */
|
||||
+static void
|
||||
+_XftCompositeString (Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat* format, GlyphSet glyphset, int srcx, int srcy, int dstx, int dsty, int charwidth, unsigned int* chars, int nchars)
|
||||
+{
|
||||
+ if (nchars == 0)
|
||||
+ return;
|
||||
+
|
||||
+ switch (charwidth) {
|
||||
+ case 1:
|
||||
+ default:
|
||||
+ XRenderCompositeString8 (dpy, op,
|
||||
+ src, dst, format, glyphset,
|
||||
+ srcx, srcy, dstx, dsty, (char*)chars, nchars);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ XRenderCompositeString16(dpy, op,
|
||||
+ src, dst, format, glyphset,
|
||||
+ srcx, srcy, dstx, dsty, (unsigned short*)chars, nchars);
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ XRenderCompositeString32(dpy, op,
|
||||
+ src, dst, format, glyphset,
|
||||
+ srcx, srcy, dstx, dsty, (unsigned int*)chars, nchars);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Use the Render extension to draw the glyphs
|
||||
*/
|
||||
@@ -43,12 +72,14 @@ XftGlyphRender (Display *dpy,
|
||||
int nglyphs)
|
||||
{
|
||||
XftFontInt *font = (XftFontInt *) pub;
|
||||
- int i;
|
||||
+ int i, j;
|
||||
FT_UInt missing[XFT_NMISSING];
|
||||
int nmissing;
|
||||
FT_UInt g, max;
|
||||
int size, width;
|
||||
+ int dstx, dsty;
|
||||
Glyph wire;
|
||||
+ XftGlyph* glyph;
|
||||
char *char8;
|
||||
unsigned short *char16;
|
||||
unsigned int *char32;
|
||||
@@ -100,43 +131,75 @@ XftGlyphRender (Display *dpy,
|
||||
if (!chars)
|
||||
goto bail1;
|
||||
}
|
||||
+ dstx = x;
|
||||
+ dsty = y;
|
||||
char8 = (char *) chars;
|
||||
char16 = (unsigned short *) chars;
|
||||
char32 = (unsigned int *) chars;
|
||||
- for (i = 0; i < nglyphs; i++)
|
||||
+ for (i = 0, j = 0; i < nglyphs; i++)
|
||||
{
|
||||
wire = (Glyph) glyphs[i];
|
||||
if (wire >= font->num_glyphs || !font->glyphs[wire])
|
||||
wire = 0;
|
||||
- switch (width) {
|
||||
- case 1: char8[i] = (char) wire; break;
|
||||
- case 2: char16[i] = (unsigned short) wire; break;
|
||||
- case 4: char32[i] = (unsigned long) wire; break;
|
||||
+ glyph = font->glyphs[wire];
|
||||
+ if (glyph->picture)
|
||||
+ {
|
||||
+ _XftCompositeString(dpy, op, src, dst, font->format, font->glyphset, srcx, srcy, x, y, width, chars, j);
|
||||
+ XRenderComposite(dpy, PictOpOver, glyph->picture, None, dst, 0, 0, 0, 0, dstx, dsty - glyph->metrics.y, glyph->metrics.width, glyph->metrics.height);
|
||||
+ x = dstx = dstx + glyph->metrics.xOff;
|
||||
+ x = dsty = dsty + glyph->metrics.yOff;
|
||||
+ j = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ switch (width) {
|
||||
+ case 1: char8[j] = (char) wire; break;
|
||||
+ case 2: char16[j] = (unsigned short) wire; break;
|
||||
+ case 4: char32[j] = (unsigned long) wire; break;
|
||||
+ }
|
||||
+ dstx += glyph->metrics.xOff;
|
||||
+ dsty += glyph->metrics.yOff;
|
||||
+ ++j;
|
||||
}
|
||||
}
|
||||
- switch (width) {
|
||||
+ _XftCompositeString(dpy, op, src, dst, font->format, font->glyphset, srcx, srcy, x, y, width, chars, j);
|
||||
+ if (chars != char_local)
|
||||
+ free (chars);
|
||||
+bail1:
|
||||
+ if (glyphs_loaded)
|
||||
+ _XftFontManageMemory (dpy, pub);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Dispatch glyph drawing to the correct XRenderCompositeText function
|
||||
+ */
|
||||
+static void
|
||||
+_XftCompositeText (Display *dpy, int op, Picture src, Picture dst, XRenderPictFormat* format, int srcx, int srcy, int dstx, int dsty, int eltwidth, XGlyphElt8* elts, int nelt)
|
||||
+{
|
||||
+ if (nelt == 0)
|
||||
+ return;
|
||||
+
|
||||
+ switch (eltwidth) {
|
||||
case 1:
|
||||
default:
|
||||
- XRenderCompositeString8 (dpy, op,
|
||||
- src, dst, font->format, font->glyphset,
|
||||
- srcx, srcy, x, y, char8, nglyphs);
|
||||
+ XRenderCompositeText8 (dpy, op,
|
||||
+ src, dst, format,
|
||||
+ srcx, srcy, dstx, dsty,
|
||||
+ (XGlyphElt8*)elts, nelt);
|
||||
break;
|
||||
case 2:
|
||||
- XRenderCompositeString16(dpy, op,
|
||||
- src, dst, font->format, font->glyphset,
|
||||
- srcx, srcy, x, y, char16, nglyphs);
|
||||
+ XRenderCompositeText16(dpy, op,
|
||||
+ src, dst, format,
|
||||
+ srcx, srcy, dstx, dsty,
|
||||
+ (XGlyphElt16*)elts, nelt);
|
||||
break;
|
||||
case 4:
|
||||
- XRenderCompositeString32(dpy, op,
|
||||
- src, dst, font->format, font->glyphset,
|
||||
- srcx, srcy, x, y, char32, nglyphs);
|
||||
+ XRenderCompositeText32(dpy, op,
|
||||
+ src, dst, format,
|
||||
+ srcx, srcy, dstx, dsty,
|
||||
+ (XGlyphElt32*)elts, nelt);
|
||||
break;
|
||||
}
|
||||
- if (chars != char_local)
|
||||
- free (chars);
|
||||
-bail1:
|
||||
- if (glyphs_loaded)
|
||||
- _XftFontManageMemory (dpy, pub);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
@@ -251,9 +314,10 @@ XftGlyphSpecRender (Display *dpy,
|
||||
g = 0;
|
||||
/*
|
||||
* check to see if the glyph is placed where it would
|
||||
- * fall using the normal spacing
|
||||
+ * fall using the normal spacing and if it would render
|
||||
+ * as a XRender glyph
|
||||
*/
|
||||
- if ((glyph = font->glyphs[g]))
|
||||
+ if ((glyph = font->glyphs[g]) && !glyph->picture)
|
||||
{
|
||||
if (x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
@@ -267,7 +331,7 @@ XftGlyphSpecRender (Display *dpy,
|
||||
}
|
||||
|
||||
elts = elts_local;
|
||||
- if (nelt > NUM_ELT_LOCAL)
|
||||
+ if (!font->info.color && nelt > NUM_ELT_LOCAL)
|
||||
{
|
||||
elts = malloc (nelt * sizeof (XGlyphElt8));
|
||||
if (!elts)
|
||||
@@ -275,7 +339,7 @@ XftGlyphSpecRender (Display *dpy,
|
||||
}
|
||||
|
||||
/*
|
||||
- * Generate the list of glyph elts
|
||||
+ * Generate the list of glyph elts or render color glyphs
|
||||
*/
|
||||
nelt = 0;
|
||||
x = y = 0;
|
||||
@@ -289,6 +353,11 @@ XftGlyphSpecRender (Display *dpy,
|
||||
g = 0;
|
||||
if ((glyph = font->glyphs[g]))
|
||||
{
|
||||
+ if (glyph->picture)
|
||||
+ {
|
||||
+ XRenderComposite(dpy, PictOpOver, glyph->picture, None, dst, 0, 0, 0, 0, glyphs[i].x, glyphs[i].y - glyph->metrics.y, glyph->metrics.width, glyph->metrics.height);
|
||||
+ continue;
|
||||
+ }
|
||||
if (!i || x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
if (n)
|
||||
@@ -320,23 +389,9 @@ XftGlyphSpecRender (Display *dpy,
|
||||
elts[nelt].nchars = n;
|
||||
nelt++;
|
||||
}
|
||||
- switch (width) {
|
||||
- case 1:
|
||||
- XRenderCompositeText8 (dpy, op, src, dst, font->format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- elts, nelt);
|
||||
- break;
|
||||
- case 2:
|
||||
- XRenderCompositeText16 (dpy, op, src, dst, font->format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt16 *) elts, nelt);
|
||||
- break;
|
||||
- case 4:
|
||||
- XRenderCompositeText32 (dpy, op, src, dst, font->format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt32 *) elts, nelt);
|
||||
- break;
|
||||
- }
|
||||
+ _XftCompositeText(dpy, op, src, dst, font->format,
|
||||
+ srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
+ width, elts, nelt);
|
||||
|
||||
if (elts != elts_local)
|
||||
free (elts);
|
||||
@@ -535,7 +590,7 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
* check to see if the glyph is placed where it would
|
||||
* fall using the normal spacing
|
||||
*/
|
||||
- if ((glyph = font->glyphs[g]))
|
||||
+ if ((glyph = font->glyphs[g]) && !glyph->picture)
|
||||
{
|
||||
if (pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
@@ -560,7 +615,7 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
}
|
||||
|
||||
/*
|
||||
- * Generate the list of glyph elts
|
||||
+ * Generate the list of glyph elts and render color glyphs
|
||||
*/
|
||||
nelt = 0;
|
||||
x = y = 0;
|
||||
@@ -578,6 +633,11 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
g = 0;
|
||||
if ((glyph = font->glyphs[g]))
|
||||
{
|
||||
+ if (glyph->picture)
|
||||
+ {
|
||||
+ XRenderComposite(dpy, PictOpOver, glyph->picture, None, dst, 0, 0, 0, 0, glyphs[i].x, glyphs[i].y - glyph->metrics.y, glyph->metrics.width, glyph->metrics.height);
|
||||
+ continue;
|
||||
+ }
|
||||
if (!i || pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y)
|
||||
{
|
||||
if (n)
|
||||
@@ -610,23 +670,9 @@ XftGlyphFontSpecRender (Display *dpy,
|
||||
elts[nelt].nchars = n;
|
||||
nelt++;
|
||||
}
|
||||
- switch (width) {
|
||||
- case 1:
|
||||
- XRenderCompositeText8 (dpy, op, src, dst, format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- elts, nelt);
|
||||
- break;
|
||||
- case 2:
|
||||
- XRenderCompositeText16 (dpy, op, src, dst, format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt16 *) elts, nelt);
|
||||
- break;
|
||||
- case 4:
|
||||
- XRenderCompositeText32 (dpy, op, src, dst, format,
|
||||
- srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
- (XGlyphElt32 *) elts, nelt);
|
||||
- break;
|
||||
- }
|
||||
+ _XftCompositeText(dpy, op, src, dst, format,
|
||||
+ srcx, srcy, glyphs[0].x, glyphs[0].y,
|
||||
+ width, elts, nelt);
|
||||
|
||||
if (elts != elts_local)
|
||||
free (elts);
|
||||
--
|
||||
2.26.2
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
# Example /etc/portage/repo.postsync.d script. Make it executable (chmod +x) for
|
||||
# Portage to process it.
|
||||
#
|
||||
# With portage-2.2.16 and newer, all repo.postsync.d hooks will be called multiple
|
||||
# times after syncing each repository.
|
||||
#
|
||||
# Older versions of Portage support syncing only one repository.
|
||||
# In those versions, the postsync.d hooks will be called only once,
|
||||
# and they will not be passed any parameters.
|
||||
|
||||
# On a repo.postsync.d hook call, positional parameters contain
|
||||
# information about the just-synced repository.
|
||||
|
||||
# Your hook can control it's actions depending on any of the three
|
||||
# parameters passed in to it.
|
||||
#
|
||||
# They are as follows:
|
||||
#
|
||||
# The repository name.
|
||||
repository_name=${1}
|
||||
# The URI to which the repository was synced.
|
||||
sync_uri=${2}
|
||||
# The path to the repository.
|
||||
repository_path=${3}
|
||||
|
||||
# Portage assumes that a hook succeeded if it exits with 0 code. If no
|
||||
# explicit exit is done, the exit code is the exit code of last spawned
|
||||
# command. Since our script is a bit more complex, we want to control
|
||||
# the exit code explicitly.
|
||||
ret=0
|
||||
|
||||
if [ -n "${repository_name}" ]; then
|
||||
# Repository name was provided, so we're in a post-repository hook.
|
||||
echo "* In post-repository hook for ${repository_name}"
|
||||
echo "** synced from remote repository ${sync_uri}"
|
||||
echo "** synced into ${repository_path}"
|
||||
|
||||
# Gentoo comes with pregenerated cache but the other repositories
|
||||
# usually don't. Generate them to improve performance.
|
||||
if [ "${repository_name}" != "gentoo" ]; then
|
||||
if ! egencache --update --repo="${repository_name}" --jobs=4
|
||||
then
|
||||
echo "!!! egencache failed!"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -n "${repository_name}" ] && ! [ -e "${repository_path}/metadata/pkg_desc_index" ]; then
|
||||
# Regenerate the metadata/pkg_desc_index file. This is not
|
||||
# needed for https://gitweb.gentoo.org/repo/sync/gentoo.git which
|
||||
# provides a freshly generated copy. The --external-cache-only
|
||||
# option causes the metadata/pkg_desc_index file to be written under
|
||||
# /var/cache/edb/dep instead of the repository itself, so that it
|
||||
# does not interfere with repository verification.
|
||||
if ! egencache --update-pkg-desc-index --external-cache-only --repo="${repository_name}" ${PORTAGE_VERBOSE+--verbose}
|
||||
then
|
||||
echo "!!! egencache failed!"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Return explicit status.
|
||||
exit "${ret}"
|
|
@ -0,0 +1,79 @@
|
|||
[DEFAULT]
|
||||
main-repo = gentoo
|
||||
uync-user = yorune
|
||||
|
||||
[gentoo]
|
||||
location = /var/db/repos/gentoo
|
||||
sync-type = git
|
||||
sync-uri = https://github.com/gentoo-mirror/gentoo.git
|
||||
auto-sync = yes
|
||||
|
||||
[hossie]
|
||||
priority = 50
|
||||
location = /var/db/repos/hossie
|
||||
sync-uri = https://github.com/gentoo-mirror/hossie.git
|
||||
sync-type = git
|
||||
auto-sync = Yes
|
||||
|
||||
[src_prepare-overlay]
|
||||
priority = 50
|
||||
location = /var/db/repos/src_prepare-overlay
|
||||
sync-uri = https://gitlab.com/src_prepare/src_prepare-overlay.git
|
||||
sync-type = git
|
||||
auto-sync = Yes
|
||||
|
||||
[ricerlay]
|
||||
priority = 50
|
||||
location = /var/db/repos/ricerlay
|
||||
sync-uri = https://github.com/azahi/ricerlay.git
|
||||
sync-type = git
|
||||
auto-sync = Yes
|
||||
|
||||
[steam-overlay]
|
||||
location = /var/db/repos/steam-overlay
|
||||
sync-type = git
|
||||
sync-uri = https://github.com/anyc/steam-overlay.git
|
||||
priority = 50
|
||||
auto-sync = Yes
|
||||
|
||||
[gentoo-yorune]
|
||||
location = /var/db/dev/gentoo-yorune
|
||||
sync-type = git
|
||||
sync-uri = gitea@git.yorune.pl:y0rune/gentoo-yorune.git
|
||||
priority = 50
|
||||
auto-sync = Yes
|
||||
|
||||
[guru]
|
||||
priority = 50
|
||||
location = /var/db/repos/guru
|
||||
sync-type = git
|
||||
sync-uri = https://anongit.gentoo.org/git/repo/proj/guru.git
|
||||
auto-sync = Yes
|
||||
|
||||
[2xsaiko]
|
||||
priority = 50
|
||||
location = /var/db/repos/2xsaiko
|
||||
sync-type = git
|
||||
sync-uri = https://git.sr.ht/~dblsaiko/ebuilds
|
||||
auto-sync = Yes
|
||||
|
||||
[bombo82]
|
||||
priority = 50
|
||||
location = /var/db/repos/bombo82
|
||||
sync-type = git
|
||||
sync-uri = https://github.com/bombo82/bombo82-overlay.git
|
||||
auto-sync = Yes
|
||||
|
||||
[mv]
|
||||
priority = 50
|
||||
location = /var/db/repos/mv
|
||||
sync-type = git
|
||||
sync-uri = https://github.com/vaeth/mv-overlay.git
|
||||
auto-sync = Yes
|
||||
|
||||
[lto-overlay]
|
||||
priority = 50
|
||||
location = /var/db/repos/lto-overlay
|
||||
sync-type = git
|
||||
sync-uri = https://github.com/InBetweenNames/gentooLTO.git
|
||||
auto-sync = Yes
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
#undef BANNER_TIMEOUT
|
||||
#define BANNER_TIMEOUT 0
|
||||
#define NET_PROTO_IPV6
|
||||
#define VMWARE_SETTINGS
|
||||
#define CONSOLE_VMWARE
|
|
@ -0,0 +1,5 @@
|
|||
#undef BANNER_TIMEOUT
|
||||
#define BANNER_TIMEOUT 0
|
||||
#define NET_PROTO_IPV6
|
||||
#define VMWARE_SETTINGS
|
||||
#define CONSOLE_VMWARE
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,115 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
static Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
|
Loading…
Reference in New Issue