Compare commits
16 Commits
feature/KA
...
KASM-1910-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f1f88d6b2 | ||
|
|
2f91fbd235 | ||
|
|
3500489bb8 | ||
|
|
22362e73ad | ||
|
|
0a1f705637 | ||
|
|
02dc1a4b53 | ||
|
|
33dd45b6e5 | ||
|
|
c5d61ca63e | ||
|
|
bb2dc1787d | ||
|
|
2bdfd0f70a | ||
|
|
c9a4319ca7 | ||
|
|
b367d1711d | ||
|
|
159d752795 | ||
|
|
0cb2c0ba9f | ||
|
|
dc21d5f97c | ||
|
|
91eb953f62 |
14
.ci/check_if_build_was_already_uploaded
Executable file
14
.ci/check_if_build_was_already_uploaded
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
check_directory_exists() {
|
||||||
|
local remote_dir="$1"
|
||||||
|
|
||||||
|
curl --output /dev/null --silent --head --fail "$remote_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
S3_URL="https://${S3_BUCKET}.s3.amazonaws.com/${S3_BUILD_DIRECTORY}/";
|
||||||
|
if check_directory_exists "$S3_URL"; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -1,16 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
is_kasmvnc_package() {
|
||||||
|
local package="$1";
|
||||||
|
|
||||||
|
echo "$package" | grep -E -q 'kasmvncserver_|rpm'
|
||||||
|
}
|
||||||
|
|
||||||
function prepare_upload_filename() {
|
function prepare_upload_filename() {
|
||||||
local package="$1";
|
local package="$1";
|
||||||
|
|
||||||
|
if ! is_kasmvnc_package "$package"; then
|
||||||
|
export upload_filename="$package"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
.ci/detect_os_arch_package_format "$package" > /tmp/os_arch_package_format;
|
.ci/detect_os_arch_package_format "$package" > /tmp/os_arch_package_format;
|
||||||
source /tmp/os_arch_package_format;
|
source /tmp/os_arch_package_format;
|
||||||
detect_release_branch
|
detect_release_branch
|
||||||
|
|
||||||
|
detect_revision "$package" "$OS_ARCH"
|
||||||
|
if [ -n "$REVISION" ]; then
|
||||||
|
REVISION="_${REVISION}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$RELEASE_BRANCH" ]; then
|
if [ -n "$RELEASE_BRANCH" ]; then
|
||||||
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${OS_ARCH}.${PACKAGE_FORMAT}";
|
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
|
||||||
else
|
else
|
||||||
export SANITIZED_BRANCH="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')";
|
export SANITIZED_BRANCH="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')";
|
||||||
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${SANITIZED_BRANCH}_${CI_COMMIT_SHA:0:6}_${OS_ARCH}.${PACKAGE_FORMAT}";
|
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${SANITIZED_BRANCH}_${CI_COMMIT_SHA:0:6}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
|
||||||
fi
|
fi
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -25,6 +42,7 @@ function upload_to_s3() {
|
|||||||
export BUILD_STATUS="{\"key\":\"doc\", \"state\":\"SUCCESSFUL\", \"name\":\"${upload_filename}\", \"url\":\"${S3_URL}\"}";
|
export BUILD_STATUS="{\"key\":\"doc\", \"state\":\"SUCCESSFUL\", \"name\":\"${upload_filename}\", \"url\":\"${S3_URL}\"}";
|
||||||
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=build-url&target_url=${S3_URL}";
|
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=build-url&target_url=${S3_URL}";
|
||||||
};
|
};
|
||||||
|
|
||||||
function prepare_to_run_scripts_and_s3_uploads() {
|
function prepare_to_run_scripts_and_s3_uploads() {
|
||||||
export DEBIAN_FRONTEND=noninteractive;
|
export DEBIAN_FRONTEND=noninteractive;
|
||||||
apt-get update;
|
apt-get update;
|
||||||
@@ -38,3 +56,16 @@ detect_release_branch() {
|
|||||||
export RELEASE_BRANCH=1;
|
export RELEASE_BRANCH=1;
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detect_revision() {
|
||||||
|
local package="$1"
|
||||||
|
local arch="$2"
|
||||||
|
|
||||||
|
REVISION=
|
||||||
|
|
||||||
|
if ! echo "$package" | grep -q '+'; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
REVISION=$(echo "$package" | sed "s/_${arch}.\+//" | sed 's/.\++//')
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
builder/build
|
|
||||||
@@ -6,11 +6,22 @@ variables:
|
|||||||
GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared
|
GITLAB_SHARED_DIND_DIR: /builds/$CI_PROJECT_PATH/shared
|
||||||
GIT_SUBMODULE_STRATEGY: normal
|
GIT_SUBMODULE_STRATEGY: normal
|
||||||
GIT_FETCH_EXTRA_FLAGS: --tags
|
GIT_FETCH_EXTRA_FLAGS: --tags
|
||||||
|
# S3_BUILD_DIRECTORY: kasmvnc/${CI_COMMIT_SHA}
|
||||||
|
S3_BUILD_DIRECTORY: kasmvnc/159d7527955f131e096cf1602b7f9f66cc5d66cb
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- check_if_build_was_already_uploaded_for_the_commit
|
||||||
- build
|
- build
|
||||||
- upload
|
- upload
|
||||||
|
|
||||||
|
check_if_build_was_already_uploaded_for_the_commit:
|
||||||
|
stage: check_if_build_was_already_uploaded_for_the_commit
|
||||||
|
script:
|
||||||
|
- apk add bash
|
||||||
|
- apk add curl
|
||||||
|
# - TODO: Try uploading and fail if the file .lock exists.
|
||||||
|
- .ci/check_if_build_was_already_uploaded
|
||||||
|
|
||||||
.prepare_build: &prepare_build
|
.prepare_build: &prepare_build
|
||||||
- ls -l
|
- ls -l
|
||||||
- pwd
|
- pwd
|
||||||
@@ -34,6 +45,18 @@ build_ubuntu_bionic:
|
|||||||
paths:
|
paths:
|
||||||
- output/
|
- output/
|
||||||
|
|
||||||
|
build_ubuntu_bionic_libjpeg_turbo:
|
||||||
|
stage: build
|
||||||
|
before_script:
|
||||||
|
- *prepare_build
|
||||||
|
after_script:
|
||||||
|
- *prepare_artfacts
|
||||||
|
script:
|
||||||
|
- bash builder/build-package ubuntu bionic +libjpeg-turbo_latest
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- output/
|
||||||
|
|
||||||
build_ubuntu_focal:
|
build_ubuntu_focal:
|
||||||
stage: build
|
stage: build
|
||||||
before_script:
|
before_script:
|
||||||
@@ -100,10 +123,9 @@ upload:
|
|||||||
before_script:
|
before_script:
|
||||||
- . .ci/upload.sh
|
- . .ci/upload.sh
|
||||||
script:
|
script:
|
||||||
- export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}"
|
|
||||||
- prepare_to_run_scripts_and_s3_uploads
|
- prepare_to_run_scripts_and_s3_uploads
|
||||||
- export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME")
|
- export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME")
|
||||||
- for package in `find output/ -type f -name 'kasmvncserver_*.deb' -or -name '*.rpm'`; do
|
- for package in `find output/ -type f -name '*.deb' -or -name '*.rpm'`; do
|
||||||
prepare_upload_filename "$package";
|
prepare_upload_filename "$package";
|
||||||
echo;
|
echo;
|
||||||
echo "File to upload $upload_filename";
|
echo "File to upload $upload_filename";
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ include(CheckLibraryExists)
|
|||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
include(CheckCSourceRuns)
|
include(CheckCSourceRuns)
|
||||||
|
|
||||||
include(CMakeMacroLibtoolFile)
|
include(CMakeMacroLibtoolFile)
|
||||||
@@ -208,6 +209,9 @@ if(ENABLE_PAM)
|
|||||||
endif()
|
endif()
|
||||||
set(HAVE_PAM ${ENABLE_PAM})
|
set(HAVE_PAM ${ENABLE_PAM})
|
||||||
|
|
||||||
|
# Check for SSE2
|
||||||
|
check_cxx_compiler_flag(-msse2 COMPILER_SUPPORTS_SSE2)
|
||||||
|
|
||||||
# Generate config.h and make sure the source finds it
|
# Generate config.h and make sure the source finds it
|
||||||
configure_file(config.h.in config.h)
|
configure_file(config.h.in config.h)
|
||||||
add_definitions(-DHAVE_CONFIG_H)
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|||||||
@@ -3,8 +3,17 @@ Docker CE
|
|||||||
|
|
||||||
# Build a deb/rpm package
|
# Build a deb/rpm package
|
||||||
```
|
```
|
||||||
# builder/build-package <os> <os_codename>
|
# builder/build-package <os> <os_codename> <build_tag>
|
||||||
# os_codename is what "lsb_release -c" outputs, e.g. buster, focal.
|
# os_codename is what "lsb_release -c" outputs, e.g. buster, focal.
|
||||||
|
#
|
||||||
|
# build_tag allows building multiple versions of deb package (rpm not supported)
|
||||||
|
# targeting a single distro release (e.g. Ubuntu Bionic). If build_tag is given,
|
||||||
|
# the package name will include build_tag as part of Debian revision. For
|
||||||
|
# example:
|
||||||
|
# * with build_tag: kasmvncserver_0.9.1~beta-1+libjpeg-turbo-latest_amd64.deb
|
||||||
|
# * without build_tag: kasmvncserver_0.9.1~beta-1_amd64.deb
|
||||||
|
# You need to have .build and .deb.build for the build_tag.
|
||||||
|
#
|
||||||
# Packages will be placed under builder/build/
|
# Packages will be placed under builder/build/
|
||||||
|
|
||||||
builder/build-package ubuntu bionic
|
builder/build-package ubuntu bionic
|
||||||
@@ -70,3 +79,14 @@ packages installed with XFCE.
|
|||||||
```
|
```
|
||||||
builder/test-deb-barebones ubuntu focal
|
builder/test-deb-barebones ubuntu focal
|
||||||
```
|
```
|
||||||
|
# CI development
|
||||||
|
|
||||||
|
S3 upload code is extracted to various files in `.ci`. It's possible to iterate
|
||||||
|
locally by doing stuff like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
bash -c '
|
||||||
|
. .ci/upload.sh;
|
||||||
|
prepare_upload_filename "bionic/kasmvncserver_0.9.1~beta-1+libjpeg-turbo-latest_amd64.deb";
|
||||||
|
echo $upload_filename;'
|
||||||
|
```
|
||||||
|
|||||||
@@ -5,12 +5,17 @@ set -e
|
|||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
. builder/os_ver_cli.sh
|
. builder/os_ver_cli.sh
|
||||||
|
|
||||||
docker build -t debbuilder_${os}:${os_codename} -f \
|
|
||||||
builder/dockerfile.${os}_${os_codename}.deb.build .
|
|
||||||
|
|
||||||
deb_output_dir=$(cd .. && echo $PWD)
|
|
||||||
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
|
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
|
||||||
L_GID=$(id -g)
|
L_GID=$(id -g)
|
||||||
docker run --rm -v "$deb_output_dir":/src --user $L_UID:$L_GID \
|
|
||||||
debbuilder_${os}:${os_codename} /bin/bash -c \
|
builder_image=debbuilder_${os}:${os_codename}${build_tag_for_images}
|
||||||
|
docker build --build-arg KASMVNC_PACKAGE_DIR="builder/build/${os_codename}" \
|
||||||
|
--build-arg L_UID="$L_UID" \
|
||||||
|
-t "$builder_image" -f \
|
||||||
|
builder/dockerfile.${os}_${os_codename}${build_tag}.deb.build .
|
||||||
|
|
||||||
|
deb_output_dir=$(cd .. && echo $PWD)
|
||||||
|
docker run --rm -v "$deb_output_dir":/src -e BUILD_TAG="$build_tag" \
|
||||||
|
--user "$L_UID:$L_GID" \
|
||||||
|
"$builder_image" /bin/bash -c \
|
||||||
'/src/*/builder/build-deb-inside-docker'
|
'/src/*/builder/build-deb-inside-docker'
|
||||||
|
|||||||
@@ -2,12 +2,31 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
prepare_docker_copy_of_debian_dir_and_cd_to_id() {
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
local mounted_src_dir="$PWD"
|
||||||
|
local docker_src_dir="$HOME/src"
|
||||||
|
|
||||||
|
mkdir "$docker_src_dir"
|
||||||
|
cd "$docker_src_dir"
|
||||||
|
cp -a "$mounted_src_dir/debian/" .
|
||||||
|
ln -s "$mounted_src_dir/builder" .
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_docker_copy_of_debian_dir_and_cd_to_id
|
||||||
|
|
||||||
os=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
|
os=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
|
||||||
os_codename=$(lsb_release -cs)
|
os_codename=$(lsb_release -cs)
|
||||||
os_dir="builder/build/${os_codename}"
|
os_dir="builder/build/${os_codename}"
|
||||||
|
|
||||||
|
if [ "$BUILD_TAG" = "+libjpeg-turbo_latest" ]; then
|
||||||
|
echo 'libjpeg 62 libjpeg-turbo (>= 2.1.1)' > debian/shlibs.local
|
||||||
|
|
||||||
|
debian_revision="$(echo $BUILD_TAG | tr _ -)"
|
||||||
|
sed -i -e "1 s/)/$debian_revision)/" debian/changelog
|
||||||
|
fi
|
||||||
|
|
||||||
dpkg-buildpackage -us -uc -b
|
dpkg-buildpackage -us -uc -b
|
||||||
mkdir -p "$os_dir"
|
mkdir -p "$os_dir"
|
||||||
cp ../*.deb "$os_dir"
|
cp ../*.deb "$os_dir"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ set -e
|
|||||||
|
|
||||||
os="$1"
|
os="$1"
|
||||||
codename="$2"
|
codename="$2"
|
||||||
|
build_tag="$3"
|
||||||
|
|
||||||
detect_package_format() {
|
detect_package_format() {
|
||||||
package_format=rpm
|
package_format=rpm
|
||||||
@@ -12,8 +13,17 @@ detect_package_format() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warn_build_tag_not_supported_for_rpm_and_exit() {
|
||||||
|
if [[ "$build_tag" && "$package_format" = "rpm" ]]; then
|
||||||
|
echo >&2 "<build_tag> isn't supported for rpm"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
detect_package_format
|
detect_package_format
|
||||||
builder/build-tarball "$os" "$codename"
|
warn_build_tag_not_supported_for_rpm_and_exit
|
||||||
builder/build-${package_format} "$os" "$codename"
|
|
||||||
|
builder/build-tarball "$os" "$codename" "$build_tag"
|
||||||
|
builder/build-${package_format} "$os" "$codename" "$build_tag"
|
||||||
|
|||||||
@@ -2,8 +2,18 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
warn_build_tag_not_supported_for_rpm_and_exit() {
|
||||||
|
local build_tag="$1"
|
||||||
|
|
||||||
|
if [[ -n "$build_tag" ]]; then
|
||||||
|
echo >&2 "<build_tag> isn't supported for rpm"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
. builder/os_ver_cli.sh
|
. builder/os_ver_cli.sh
|
||||||
|
warn_build_tag_not_supported_for_rpm_and_exit "$build_tag"
|
||||||
|
|
||||||
docker build -t kasmvnc_rpmbuilder_${os}:${os_codename} -f \
|
docker build -t kasmvnc_rpmbuilder_${os}:${os_codename} -f \
|
||||||
builder/dockerfile.${os}_${os_codename}.rpm.build .
|
builder/dockerfile.${os}_${os_codename}.rpm.build .
|
||||||
|
|||||||
@@ -12,6 +12,13 @@ build_www_dir() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
move_libjpeg_turbo_to_os_specific_dir() {
|
||||||
|
chown $L_UID:$L_GID $shared_with_docker_dir/${os_codename}/*
|
||||||
|
mkdir -p $PWD/builder/build/${os_codename}/
|
||||||
|
mv $shared_with_docker_dir/${os_codename}/libjpeg-turbo*.deb \
|
||||||
|
$PWD/builder/build/${os_codename}/
|
||||||
|
}
|
||||||
|
|
||||||
shared_with_docker_dir=${GITLAB_SHARED_DIND_DIR:-/tmp}
|
shared_with_docker_dir=${GITLAB_SHARED_DIND_DIR:-/tmp}
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
@@ -19,13 +26,21 @@ cd "$(dirname "$0")/.."
|
|||||||
|
|
||||||
build_www_dir
|
build_www_dir
|
||||||
|
|
||||||
docker build -t kasmvncbuilder:$os_codename \
|
builder_image=kasmvncbuilder:$os_codename${build_tag_for_images}
|
||||||
-f builder/dockerfile.${os}_${os_codename}.build .
|
docker build -t "$builder_image" \
|
||||||
|
-f builder/dockerfile.${os}_${os_codename}${build_tag}.build .
|
||||||
mkdir -p builder/build
|
mkdir -p builder/build
|
||||||
docker run -v $shared_with_docker_dir:/build --rm kasmvncbuilder:$os_codename
|
docker run -v $shared_with_docker_dir:/build -e BUILD_TAG="$build_tag" \
|
||||||
|
--rm "$builder_image"
|
||||||
|
|
||||||
L_GID=$(id -g)
|
L_GID=$(id -g)
|
||||||
L_UID=$(id -u)
|
L_UID=$(id -u)
|
||||||
tarball_name="kasmvnc.${os}_${os_codename}.tar.gz"
|
tarball_name="kasmvnc.${os}_${os_codename}.tar.gz"
|
||||||
|
tarball_name_with_build_tag="kasmvnc.${os}_${os_codename}${build_tag}.tar.gz"
|
||||||
chown $L_UID:$L_GID $shared_with_docker_dir/$tarball_name
|
chown $L_UID:$L_GID $shared_with_docker_dir/$tarball_name
|
||||||
mv $shared_with_docker_dir/$tarball_name $PWD/builder/build/
|
mv $shared_with_docker_dir/$tarball_name \
|
||||||
|
$PWD/builder/build/"$tarball_name_with_build_tag"
|
||||||
|
|
||||||
|
if [ "$build_tag" = "+libjpeg-turbo_latest" ]; then
|
||||||
|
move_libjpeg_turbo_to_os_specific_dir
|
||||||
|
fi
|
||||||
|
|||||||
@@ -84,3 +84,7 @@ fi
|
|||||||
make servertarball
|
make servertarball
|
||||||
|
|
||||||
cp kasmvnc*.tar.gz /build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz
|
cp kasmvnc*.tar.gz /build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz
|
||||||
|
if [ "$BUILD_TAG" = "+libjpeg-turbo_latest" ]; then
|
||||||
|
mkdir -p /build/${KASMVNC_BUILD_OS_CODENAME}/
|
||||||
|
cp /libjpeg-turbo/libjpeg*.deb /build/${KASMVNC_BUILD_OS_CODENAME}/
|
||||||
|
fi
|
||||||
|
|||||||
@@ -9,4 +9,11 @@ RUN apt-get update && \
|
|||||||
COPY ./debian/control /tmp
|
COPY ./debian/control /tmp
|
||||||
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
||||||
|
|
||||||
USER 1000
|
ARG L_UID
|
||||||
|
RUN if [ "$L_UID" -eq 0 ]; then \
|
||||||
|
useradd -m docker; \
|
||||||
|
else \
|
||||||
|
useradd -m docker -u $L_UID;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER docker
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
|
|||||||
### START CUSTOM STUFF ####
|
### START CUSTOM STUFF ####
|
||||||
|
|
||||||
ARG KASMVNC_PACKAGE_DIR
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
|
||||||
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
### END CUSTOM STUFF ###
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM debian:buster-slim
|
FROM debian:buster-slim
|
||||||
|
|
||||||
ARG KASMVNC_PACKAGE_DIR
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
|
||||||
RUN apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
RUN apt-get update && apt-get -y install xterm
|
RUN apt-get update && apt-get -y install xterm
|
||||||
|
|
||||||
COPY startup/deb/kasmvncserver-easy-start /usr/local/bin
|
COPY startup/deb/kasmvncserver-easy-start /usr/local/bin
|
||||||
|
|||||||
@@ -9,4 +9,11 @@ RUN apt-get update && \
|
|||||||
COPY ./debian/control /tmp
|
COPY ./debian/control /tmp
|
||||||
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
||||||
|
|
||||||
USER 1000
|
ARG L_UID
|
||||||
|
RUN if [ "$L_UID" -eq 0 ]; then \
|
||||||
|
useradd -m docker; \
|
||||||
|
else \
|
||||||
|
useradd -m docker -u $L_UID;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER docker
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
|
|||||||
### START CUSTOM STUFF ####
|
### START CUSTOM STUFF ####
|
||||||
|
|
||||||
ARG KASMVNC_PACKAGE_DIR
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
|
||||||
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
### END CUSTOM STUFF ###
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,11 @@ RUN apt-get update && \
|
|||||||
COPY ./debian/control /tmp
|
COPY ./debian/control /tmp
|
||||||
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
||||||
|
|
||||||
USER 1000
|
ARG L_UID
|
||||||
|
RUN if [ "$L_UID" -eq 0 ]; then \
|
||||||
|
useradd -m docker; \
|
||||||
|
else \
|
||||||
|
useradd -m docker -u $L_UID;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER docker
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
|
|||||||
### START CUSTOM STUFF ####
|
### START CUSTOM STUFF ####
|
||||||
|
|
||||||
ARG KASMVNC_PACKAGE_DIR
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
|
||||||
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
### END CUSTOM STUFF ###
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
|||||||
39
builder/dockerfile.ubuntu_bionic+libjpeg-turbo_latest.build
Normal file
39
builder/dockerfile.ubuntu_bionic+libjpeg-turbo_latest.build
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
|
ENV KASMVNC_BUILD_OS ubuntu
|
||||||
|
ENV KASMVNC_BUILD_OS_CODENAME bionic
|
||||||
|
ENV XORG_VER 1.20.10
|
||||||
|
|
||||||
|
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get -y install sudo
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
||||||
|
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver
|
||||||
|
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y cmake nasm gcc
|
||||||
|
RUN git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git
|
||||||
|
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -G"Unix Makefiles" && make deb
|
||||||
|
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles" && make && make install
|
||||||
|
|
||||||
|
# Additions for webp
|
||||||
|
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
|
||||||
|
RUN cd /tmp && tar -xzvf /tmp/libwebp-*
|
||||||
|
RUN cd /tmp/libwebp-1.0.2 && \
|
||||||
|
./configure --enable-static --disable-shared && \
|
||||||
|
make && make install
|
||||||
|
|
||||||
|
# Fix for older required libs
|
||||||
|
#RUN cd /tmp && wget http://launchpadlibrarian.net/347526424/libxfont1-dev_1.5.2-4ubuntu2_amd64.deb && \
|
||||||
|
# wget http://launchpadlibrarian.net/347526425/libxfont1_1.5.2-4ubuntu2_amd64.deb && \
|
||||||
|
# dpkg -i libxfont1_1.5.2-4ubuntu2_amd64.deb && \
|
||||||
|
# dpkg -i libxfont1-dev_1.5.2-4ubuntu2_amd64.deb
|
||||||
|
|
||||||
|
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
|
||||||
|
|
||||||
|
COPY --chown=docker:docker . /src
|
||||||
|
|
||||||
|
USER docker
|
||||||
|
ENTRYPOINT ["/src/builder/build.sh"]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get -y install vim build-essential devscripts equivs
|
||||||
|
|
||||||
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
|
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo*deb /tmp
|
||||||
|
RUN apt-get install /tmp/libjpeg-turbo*deb
|
||||||
|
|
||||||
|
# Install build-deps for the package.
|
||||||
|
COPY ./debian/control /tmp
|
||||||
|
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
||||||
|
|
||||||
|
ENV LD_LIBRARY_PATH="/opt/libjpeg-turbo/lib64/:$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
ARG L_UID
|
||||||
|
RUN if [ "$L_UID" -eq 0 ]; then \
|
||||||
|
useradd -m docker; \
|
||||||
|
else \
|
||||||
|
useradd -m docker -u $L_UID;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER docker
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
|
ENV DISPLAY=:1 \
|
||||||
|
VNC_PORT=8443 \
|
||||||
|
VNC_RESOLUTION=1280x720 \
|
||||||
|
MAX_FRAME_RATE=24 \
|
||||||
|
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
|
||||||
|
HOME=/home/user \
|
||||||
|
TERM=xterm \
|
||||||
|
STARTUPDIR=/dockerstartup \
|
||||||
|
INST_SCRIPTS=/dockerstartup/install \
|
||||||
|
KASM_RX_HOME=/dockerstartup/kasmrx \
|
||||||
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
|
VNC_COL_DEPTH=24 \
|
||||||
|
VNC_RESOLUTION=1280x1024 \
|
||||||
|
VNC_PW=vncpassword \
|
||||||
|
VNC_USER=user \
|
||||||
|
VNC_VIEW_ONLY_PW=vncviewonlypassword \
|
||||||
|
LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64/:/usr/local/lib/ \
|
||||||
|
OMP_WAIT_POLICY=PASSIVE \
|
||||||
|
SHELL=/bin/bash \
|
||||||
|
SINGLE_APPLICATION=0 \
|
||||||
|
KASMVNC_BUILD_OS=ubuntu \
|
||||||
|
KASMVNC_BUILD_OS_CODENAME=bionic
|
||||||
|
|
||||||
|
EXPOSE $VNC_PORT
|
||||||
|
|
||||||
|
WORKDIR $HOME
|
||||||
|
|
||||||
|
### REQUIRED STUFF ###
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
|
||||||
|
RUN apt-get purge -y pm-utils xscreensaver*
|
||||||
|
RUN apt-get update && apt-get install -y vim less
|
||||||
|
RUN apt-get update && apt-get -y install lsb-release
|
||||||
|
|
||||||
|
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
|
||||||
|
|
||||||
|
RUN mkdir -p $STARTUPDIR
|
||||||
|
COPY startup/ $STARTUPDIR
|
||||||
|
|
||||||
|
### START CUSTOM STUFF ####
|
||||||
|
|
||||||
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
|
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo_*.deb /tmp
|
||||||
|
RUN apt-get install /tmp/libjpeg-turbo*deb
|
||||||
|
|
||||||
|
ARG BUILD_DEBIAN_REVISION
|
||||||
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*$BUILD_DEBIAN_REVISION*.deb /tmp
|
||||||
|
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
RUN chown -R 1000:0 $HOME
|
||||||
|
USER 1000:ssl-cert
|
||||||
|
WORKDIR $HOME
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]
|
||||||
@@ -7,4 +7,11 @@ RUN apt-get update && \
|
|||||||
COPY ./debian/control /tmp
|
COPY ./debian/control /tmp
|
||||||
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
||||||
|
|
||||||
USER 1000
|
ARG L_UID
|
||||||
|
RUN if [ "$L_UID" -eq 0 ]; then \
|
||||||
|
useradd -m docker; \
|
||||||
|
else \
|
||||||
|
useradd -m docker -u $L_UID;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER docker
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
|
|||||||
### START CUSTOM STUFF ####
|
### START CUSTOM STUFF ####
|
||||||
|
|
||||||
ARG KASMVNC_PACKAGE_DIR
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
|
||||||
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
### END CUSTOM STUFF ###
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM ubuntu:focal
|
FROM ubuntu:focal
|
||||||
|
|
||||||
ARG KASMVNC_PACKAGE_DIR
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
|
||||||
RUN apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
RUN apt-get update && apt-get -y install xterm lsb-release
|
RUN apt-get update && apt-get -y install xterm lsb-release
|
||||||
|
|
||||||
RUN useradd -m foo && addgroup foo ssl-cert
|
RUN useradd -m foo && addgroup foo ssl-cert
|
||||||
|
|||||||
@@ -9,4 +9,11 @@ RUN apt-get update && \
|
|||||||
COPY ./debian/control /tmp
|
COPY ./debian/control /tmp
|
||||||
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
||||||
|
|
||||||
USER 1000
|
ARG L_UID
|
||||||
|
RUN if [ "$L_UID" -eq 0 ]; then \
|
||||||
|
useradd -m docker; \
|
||||||
|
else \
|
||||||
|
useradd -m docker -u $L_UID;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER docker
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ COPY startup/ $STARTUPDIR
|
|||||||
### START CUSTOM STUFF ####
|
### START CUSTOM STUFF ####
|
||||||
|
|
||||||
ARG KASMVNC_PACKAGE_DIR
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*.deb /tmp/
|
||||||
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
|
RUN mkdir ~/.vnc && echo '/usr/bin/xfce4-session &' >> ~/.vnc/xstartup && \
|
||||||
chmod +x ~/.vnc/xstartup
|
chmod +x ~/.vnc/xstartup
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ default_os_codename=bionic
|
|||||||
|
|
||||||
os=${1:-$default_os}
|
os=${1:-$default_os}
|
||||||
os_codename=${2:-$default_os_codename}
|
os_codename=${2:-$default_os_codename}
|
||||||
|
build_tag="${3:-}"
|
||||||
|
if [[ -n "$build_tag" ]]; then
|
||||||
|
build_tag_for_images="_${build_tag#+}"
|
||||||
|
build_debian_revision="$(echo $build_tag | tr _ -)"
|
||||||
|
fi
|
||||||
os_image="$os:$os_codename"
|
os_image="$os:$os_codename"
|
||||||
|
|
||||||
echo "Building for $os_image"
|
echo "Building for $os_image"
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ set -e
|
|||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
. ./os_ver_cli.sh
|
. ./os_ver_cli.sh
|
||||||
|
|
||||||
|
tester_image=kasmvnctester_${os}:$os_codename${build_tag_for_images}
|
||||||
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \
|
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \
|
||||||
-t kasmvnctester_${os}:$os_codename \
|
--build-arg BUILD_DEBIAN_REVISION="$build_debian_revision" \
|
||||||
-f dockerfile.${os}_${os_codename}.deb.test .
|
-t "$tester_image" \
|
||||||
|
-f dockerfile.${os}_${os_codename}${build_tag}.deb.test .
|
||||||
docker run -it -p 443:8443 --rm \
|
docker run -it -p 443:8443 --rm \
|
||||||
-e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \
|
-e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \
|
||||||
-e "VNC_USER=foo" -e "VNC_PW=foobar" \
|
-e "VNC_USER=foo" -e "VNC_PW=foobar" \
|
||||||
kasmvnctester_${os}:$os_codename
|
"$tester_image"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <network/GetAPI.h>
|
#include <network/GetAPI.h>
|
||||||
#include <rfb/ConnParams.h>
|
#include <rfb/ConnParams.h>
|
||||||
|
#include <rfb/EncodeManager.h>
|
||||||
#include <rfb/LogWriter.h>
|
#include <rfb/LogWriter.h>
|
||||||
#include <rfb/JpegCompressor.h>
|
#include <rfb/JpegCompressor.h>
|
||||||
#include <rfb/xxhash.h>
|
#include <rfb/xxhash.h>
|
||||||
@@ -32,10 +33,6 @@ using namespace rfb;
|
|||||||
|
|
||||||
static LogWriter vlog("GetAPIMessager");
|
static LogWriter vlog("GetAPIMessager");
|
||||||
|
|
||||||
PixelBuffer *progressiveBilinearScale(const PixelBuffer *pb,
|
|
||||||
const uint16_t tgtw, const uint16_t tgth,
|
|
||||||
const float tgtdiff);
|
|
||||||
|
|
||||||
struct TightJPEGConfiguration {
|
struct TightJPEGConfiguration {
|
||||||
int quality;
|
int quality;
|
||||||
int subsampling;
|
int subsampling;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ set(RFB_SOURCES
|
|||||||
Security.cxx
|
Security.cxx
|
||||||
SecurityServer.cxx
|
SecurityServer.cxx
|
||||||
SecurityClient.cxx
|
SecurityClient.cxx
|
||||||
|
SelfBench.cxx
|
||||||
SSecurityPlain.cxx
|
SSecurityPlain.cxx
|
||||||
SSecurityStack.cxx
|
SSecurityStack.cxx
|
||||||
SSecurityVncAuth.cxx
|
SSecurityVncAuth.cxx
|
||||||
@@ -63,6 +64,7 @@ set(RFB_SOURCES
|
|||||||
VNCServerST.cxx
|
VNCServerST.cxx
|
||||||
ZRLEEncoder.cxx
|
ZRLEEncoder.cxx
|
||||||
ZRLEDecoder.cxx
|
ZRLEDecoder.cxx
|
||||||
|
cpuid.cxx
|
||||||
encodings.cxx
|
encodings.cxx
|
||||||
util.cxx
|
util.cxx
|
||||||
xxhash.c)
|
xxhash.c)
|
||||||
@@ -96,6 +98,27 @@ if(GNUTLS_FOUND)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# SSE2
|
||||||
|
|
||||||
|
set(SSE2_SOURCES
|
||||||
|
scale_sse2.cxx)
|
||||||
|
|
||||||
|
set(SCALE_DUMMY_SOURCES
|
||||||
|
scale_dummy.cxx)
|
||||||
|
|
||||||
|
if(COMPILER_SUPPORTS_SSE2)
|
||||||
|
set_source_files_properties(${SSE2_SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} -msse2)
|
||||||
|
set(RFB_SOURCES
|
||||||
|
${RFB_SOURCES}
|
||||||
|
${SSE2_SOURCES}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(RFB_SOURCES
|
||||||
|
${RFB_SOURCES}
|
||||||
|
${SCALE_DUMMY_SOURCES}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(rfb STATIC ${RFB_SOURCES})
|
add_library(rfb STATIC ${RFB_SOURCES})
|
||||||
|
|
||||||
target_link_libraries(rfb ${RFB_LIBRARIES})
|
target_link_libraries(rfb ${RFB_LIBRARIES})
|
||||||
|
|||||||
@@ -22,10 +22,12 @@
|
|||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <rfb/cpuid.h>
|
||||||
#include <rfb/EncCache.h>
|
#include <rfb/EncCache.h>
|
||||||
#include <rfb/EncodeManager.h>
|
#include <rfb/EncodeManager.h>
|
||||||
#include <rfb/Encoder.h>
|
#include <rfb/Encoder.h>
|
||||||
#include <rfb/Palette.h>
|
#include <rfb/Palette.h>
|
||||||
|
#include <rfb/scale_sse2.h>
|
||||||
#include <rfb/SConnection.h>
|
#include <rfb/SConnection.h>
|
||||||
#include <rfb/ServerCore.h>
|
#include <rfb/ServerCore.h>
|
||||||
#include <rfb/SMsgWriter.h>
|
#include <rfb/SMsgWriter.h>
|
||||||
@@ -895,7 +897,7 @@ void EncodeManager::updateVideoStats(const std::vector<Rect> &rects, const Pixel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PixelBuffer *nearestScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
PixelBuffer *rfb::nearestScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
||||||
const float diff)
|
const float diff)
|
||||||
{
|
{
|
||||||
ManagedPixelBuffer *newpb = new ManagedPixelBuffer(pb->getPF(), w, h);
|
ManagedPixelBuffer *newpb = new ManagedPixelBuffer(pb->getPF(), w, h);
|
||||||
@@ -920,7 +922,7 @@ static PixelBuffer *nearestScale(const PixelBuffer *pb, const uint16_t w, const
|
|||||||
return newpb;
|
return newpb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PixelBuffer *bilinearScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
PixelBuffer *rfb::bilinearScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
||||||
const float diff)
|
const float diff)
|
||||||
{
|
{
|
||||||
ManagedPixelBuffer *newpb = new ManagedPixelBuffer(pb->getPF(), w, h);
|
ManagedPixelBuffer *newpb = new ManagedPixelBuffer(pb->getPF(), w, h);
|
||||||
@@ -968,10 +970,68 @@ static PixelBuffer *bilinearScale(const PixelBuffer *pb, const uint16_t w, const
|
|||||||
return newpb;
|
return newpb;
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelBuffer *progressiveBilinearScale(const PixelBuffer *pb,
|
PixelBuffer *rfb::progressiveBilinearScale(const PixelBuffer *pb,
|
||||||
const uint16_t tgtw, const uint16_t tgth,
|
const uint16_t tgtw, const uint16_t tgth,
|
||||||
const float tgtdiff)
|
const float tgtdiff)
|
||||||
{
|
{
|
||||||
|
if (supportsSSE2()) {
|
||||||
|
if (tgtdiff >= 0.5f) {
|
||||||
|
ManagedPixelBuffer *newpb = new ManagedPixelBuffer(pb->getPF(), tgtw, tgth);
|
||||||
|
|
||||||
|
int oldstride, newstride;
|
||||||
|
const rdr::U8 *oldpx = pb->getBuffer(pb->getRect(), &oldstride);
|
||||||
|
rdr::U8 *newpx = newpb->getBufferRW(newpb->getRect(), &newstride);
|
||||||
|
|
||||||
|
SSE2_scale(oldpx, tgtw, tgth, newpx, oldstride, newstride, tgtdiff);
|
||||||
|
return newpb;
|
||||||
|
}
|
||||||
|
|
||||||
|
PixelBuffer *newpb;
|
||||||
|
uint16_t neww, newh, oldw, oldh;
|
||||||
|
bool del = false;
|
||||||
|
|
||||||
|
do {
|
||||||
|
oldw = pb->getRect().width();
|
||||||
|
oldh = pb->getRect().height();
|
||||||
|
neww = oldw / 2;
|
||||||
|
newh = oldh / 2;
|
||||||
|
|
||||||
|
newpb = new ManagedPixelBuffer(pb->getPF(), neww, newh);
|
||||||
|
|
||||||
|
int oldstride, newstride;
|
||||||
|
const rdr::U8 *oldpx = pb->getBuffer(pb->getRect(), &oldstride);
|
||||||
|
rdr::U8 *newpx = ((ManagedPixelBuffer *) newpb)->getBufferRW(newpb->getRect(),
|
||||||
|
&newstride);
|
||||||
|
|
||||||
|
SSE2_halve(oldpx, neww, newh, newpx, oldstride, newstride);
|
||||||
|
|
||||||
|
if (del)
|
||||||
|
delete pb;
|
||||||
|
del = true;
|
||||||
|
|
||||||
|
pb = newpb;
|
||||||
|
} while (tgtw * 2 < neww);
|
||||||
|
|
||||||
|
// Final, non-halving step
|
||||||
|
if (tgtw != neww || tgth != newh) {
|
||||||
|
oldw = pb->getRect().width();
|
||||||
|
oldh = pb->getRect().height();
|
||||||
|
|
||||||
|
newpb = new ManagedPixelBuffer(pb->getPF(), tgtw, tgth);
|
||||||
|
|
||||||
|
int oldstride, newstride;
|
||||||
|
const rdr::U8 *oldpx = pb->getBuffer(pb->getRect(), &oldstride);
|
||||||
|
rdr::U8 *newpx = ((ManagedPixelBuffer *) newpb)->getBufferRW(newpb->getRect(),
|
||||||
|
&newstride);
|
||||||
|
|
||||||
|
SSE2_scale(oldpx, tgtw, tgth, newpx, oldstride, newstride, tgtdiff);
|
||||||
|
if (del)
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newpb;
|
||||||
|
} // SSE2
|
||||||
|
|
||||||
if (tgtdiff >= 0.5f)
|
if (tgtdiff >= 0.5f)
|
||||||
return bilinearScale(pb, tgtw, tgth, tgtdiff);
|
return bilinearScale(pb, tgtw, tgth, tgtdiff);
|
||||||
|
|
||||||
|
|||||||
@@ -215,6 +215,13 @@ namespace rfb {
|
|||||||
virtual rdr::U8* getBufferRW(const Rect& r, int* stride);
|
virtual rdr::U8* getBufferRW(const Rect& r, int* stride);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PixelBuffer *nearestScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
||||||
|
const float diff);
|
||||||
|
PixelBuffer *bilinearScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
||||||
|
const float diff);
|
||||||
|
PixelBuffer *progressiveBilinearScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
||||||
|
const float diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
197
common/rfb/SelfBench.cxx
Normal file
197
common/rfb/SelfBench.cxx
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm Web
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rfb/ComparingUpdateTracker.h>
|
||||||
|
#include <rfb/EncodeManager.h>
|
||||||
|
#include <rfb/LogWriter.h>
|
||||||
|
#include <rfb/SConnection.h>
|
||||||
|
#include <rfb/ServerCore.h>
|
||||||
|
#include <rfb/PixelBuffer.h>
|
||||||
|
#include <rfb/TightJPEGEncoder.h>
|
||||||
|
#include <rfb/TightWEBPEncoder.h>
|
||||||
|
#include <rfb/util.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
using namespace rfb;
|
||||||
|
static LogWriter vlog("SelfBench");
|
||||||
|
|
||||||
|
static const PixelFormat pfRGBX(32, 24, false, true, 255, 255, 255, 0, 8, 16);
|
||||||
|
|
||||||
|
#define RUNS 64
|
||||||
|
|
||||||
|
#define W 1600
|
||||||
|
#define H 1200
|
||||||
|
|
||||||
|
void SelfBench() {
|
||||||
|
|
||||||
|
unsigned i, runs;
|
||||||
|
struct timeval start;
|
||||||
|
|
||||||
|
ManagedPixelBuffer f1(pfRGBX, W, H);
|
||||||
|
ManagedPixelBuffer f2(pfRGBX, W, H);
|
||||||
|
ManagedPixelBuffer screen(pfRGBX, W, H);
|
||||||
|
|
||||||
|
int stride;
|
||||||
|
rdr::U8 *f1ptr = f1.getBufferRW(f1.getRect(), &stride);
|
||||||
|
rdr::U8 *f2ptr = f2.getBufferRW(f2.getRect(), &stride);
|
||||||
|
rdr::U8 * const screenptr = screen.getBufferRW(screen.getRect(), &stride);
|
||||||
|
|
||||||
|
rdr::U8 * const f1orig = f1ptr;
|
||||||
|
rdr::U8 * const f2orig = f2ptr;
|
||||||
|
|
||||||
|
for (i = 0; i < W * H * 4; i += 4) {
|
||||||
|
f1ptr[0] = rand();
|
||||||
|
f1ptr[1] = rand();
|
||||||
|
f1ptr[2] = rand();
|
||||||
|
|
||||||
|
f2ptr[0] = rand();
|
||||||
|
f2ptr[1] = rand();
|
||||||
|
f2ptr[2] = rand();
|
||||||
|
|
||||||
|
f1ptr += 4;
|
||||||
|
f2ptr += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
vlog.info("Running micro-benchmarks (single-threaded, runs depending on task)");
|
||||||
|
|
||||||
|
// Encoding
|
||||||
|
std::vector<uint8_t> vec;
|
||||||
|
|
||||||
|
TightJPEGEncoder jpeg(NULL);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
jpeg.compressOnly(&f1, 8, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Jpeg compression at quality 8 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
jpeg.compressOnly(&f1, 4, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Jpeg compression at quality 4 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
|
||||||
|
TightWEBPEncoder webp(NULL);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS / 8;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
webp.compressOnly(&f1, 8, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Webp compression at quality 8 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS / 4;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
webp.compressOnly(&f1, 4, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Webp compression at quality 4 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
// Scaling
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = nearestScale(&f1, W * 0.8, H * 0.8, 0.8);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Nearest scaling to 80%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = nearestScale(&f1, W * 0.4, H * 0.4, 0.4);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Nearest scaling to 40%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = bilinearScale(&f1, W * 0.8, H * 0.8, 0.8);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Bilinear scaling to 80%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = bilinearScale(&f1, W * 0.4, H * 0.4, 0.4);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Bilinear scaling to 40%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = progressiveBilinearScale(&f1, W * 0.8, H * 0.8, 0.8);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Progressive bilinear scaling to 80%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = progressiveBilinearScale(&f1, W * 0.4, H * 0.4, 0.4);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Progressive bilinear scaling to 40%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
// Analysis
|
||||||
|
ComparingUpdateTracker *comparer = new ComparingUpdateTracker(&screen);
|
||||||
|
Region cursorReg;
|
||||||
|
|
||||||
|
Server::detectScrolling.setParam(false);
|
||||||
|
Server::detectHorizontal.setParam(false);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4);
|
||||||
|
comparer->compare(true, cursorReg);
|
||||||
|
}
|
||||||
|
vlog.info("Analysis took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs);
|
||||||
|
|
||||||
|
Server::detectScrolling.setParam(true);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4);
|
||||||
|
comparer->compare(false, cursorReg);
|
||||||
|
}
|
||||||
|
vlog.info("Analysis w/ scroll detection took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs);
|
||||||
|
|
||||||
|
Server::detectHorizontal.setParam(true);
|
||||||
|
delete comparer;
|
||||||
|
comparer = new ComparingUpdateTracker(&screen);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS / 2;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4);
|
||||||
|
comparer->compare(false, cursorReg);
|
||||||
|
}
|
||||||
|
vlog.info("Analysis w/ horizontal scroll detection took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
@@ -113,6 +113,10 @@ rfb::BoolParameter rfb::Server::ignoreClientSettingsKasm
|
|||||||
("IgnoreClientSettingsKasm",
|
("IgnoreClientSettingsKasm",
|
||||||
"Ignore the additional client settings exposed in Kasm.",
|
"Ignore the additional client settings exposed in Kasm.",
|
||||||
false);
|
false);
|
||||||
|
rfb::BoolParameter rfb::Server::selfBench
|
||||||
|
("SelfBench",
|
||||||
|
"Run self-benchmarks and exit.",
|
||||||
|
false);
|
||||||
rfb::IntParameter rfb::Server::dynamicQualityMin
|
rfb::IntParameter rfb::Server::dynamicQualityMin
|
||||||
("DynamicQualityMin",
|
("DynamicQualityMin",
|
||||||
"The minimum dynamic JPEG quality, 0 = low, 9 = high",
|
"The minimum dynamic JPEG quality, 0 = low, 9 = high",
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ namespace rfb {
|
|||||||
static BoolParameter detectScrolling;
|
static BoolParameter detectScrolling;
|
||||||
static BoolParameter detectHorizontal;
|
static BoolParameter detectHorizontal;
|
||||||
static BoolParameter ignoreClientSettingsKasm;
|
static BoolParameter ignoreClientSettingsKasm;
|
||||||
|
static BoolParameter selfBench;
|
||||||
static PresetParameter preferBandwidth;
|
static PresetParameter preferBandwidth;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
|
|
||||||
#include <network/GetAPI.h>
|
#include <network/GetAPI.h>
|
||||||
|
|
||||||
|
#include <rfb/cpuid.h>
|
||||||
#include <rfb/ComparingUpdateTracker.h>
|
#include <rfb/ComparingUpdateTracker.h>
|
||||||
#include <rfb/KeyRemapper.h>
|
#include <rfb/KeyRemapper.h>
|
||||||
#include <rfb/ListConnInfo.h>
|
#include <rfb/ListConnInfo.h>
|
||||||
@@ -76,6 +77,8 @@ static LogWriter slog("VNCServerST");
|
|||||||
LogWriter VNCServerST::connectionsLog("Connections");
|
LogWriter VNCServerST::connectionsLog("Connections");
|
||||||
EncCache VNCServerST::encCache;
|
EncCache VNCServerST::encCache;
|
||||||
|
|
||||||
|
void SelfBench();
|
||||||
|
|
||||||
//
|
//
|
||||||
// -=- VNCServerST Implementation
|
// -=- VNCServerST Implementation
|
||||||
//
|
//
|
||||||
@@ -132,6 +135,9 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_)
|
|||||||
{
|
{
|
||||||
lastUserInputTime = lastDisconnectTime = time(0);
|
lastUserInputTime = lastDisconnectTime = time(0);
|
||||||
slog.debug("creating single-threaded server %s", name.buf);
|
slog.debug("creating single-threaded server %s", name.buf);
|
||||||
|
slog.info("CPU capability: SSE2 %s, AVX512f %s",
|
||||||
|
supportsSSE2() ? "yes" : "no",
|
||||||
|
supportsAVX512f() ? "yes" : "no");
|
||||||
|
|
||||||
DLPRegion.enabled = DLPRegion.percents = false;
|
DLPRegion.enabled = DLPRegion.percents = false;
|
||||||
|
|
||||||
@@ -212,6 +218,9 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
trackingClient[0] = 0;
|
trackingClient[0] = 0;
|
||||||
|
|
||||||
|
if (Server::selfBench)
|
||||||
|
SelfBench();
|
||||||
}
|
}
|
||||||
|
|
||||||
VNCServerST::~VNCServerST()
|
VNCServerST::~VNCServerST()
|
||||||
|
|||||||
70
common/rfb/cpuid.cxx
Normal file
70
common/rfb/cpuid.cxx
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm Web
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
static uint32_t cpuid[4] = { 0 };
|
||||||
|
static uint32_t extcpuid[4] = { 0 };
|
||||||
|
|
||||||
|
static void getcpuid() {
|
||||||
|
if (cpuid[0])
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
uint32_t eax, ecx = 0;
|
||||||
|
|
||||||
|
eax = 1; // normal feature bits
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"cpuid\n\t"
|
||||||
|
: "=a"(cpuid[0]), "=b"(cpuid[1]), "=c"(cpuid[2]), "=d"(cpuid[3])
|
||||||
|
: "0"(eax), "2"(ecx)
|
||||||
|
);
|
||||||
|
|
||||||
|
eax = 7; // ext feature bits
|
||||||
|
ecx = 0;
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"cpuid\n\t"
|
||||||
|
: "=a"(extcpuid[0]), "=b"(extcpuid[1]), "=c"(extcpuid[2]), "=d"(extcpuid[3])
|
||||||
|
: "0"(eax), "2"(ecx)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace rfb {
|
||||||
|
|
||||||
|
bool supportsSSE2() {
|
||||||
|
getcpuid();
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
#define bit_SSE2 (1 << 26)
|
||||||
|
return cpuid[3] & bit_SSE2;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool supportsAVX512f() {
|
||||||
|
getcpuid();
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
#define bit_AVX512f (1 << 16)
|
||||||
|
return extcpuid[1] & bit_AVX512f;
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // namespace rfb
|
||||||
28
common/rfb/cpuid.h
Normal file
28
common/rfb/cpuid.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm Web
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RFB_CPUID_H__
|
||||||
|
#define __RFB_CPUID_H__
|
||||||
|
|
||||||
|
namespace rfb {
|
||||||
|
|
||||||
|
bool supportsSSE2();
|
||||||
|
bool supportsAVX512f();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
37
common/rfb/scale_dummy.cxx
Normal file
37
common/rfb/scale_dummy.cxx
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm Web
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rfb/scale_sse2.h>
|
||||||
|
|
||||||
|
namespace rfb {
|
||||||
|
|
||||||
|
void SSE2_halve(const uint8_t *oldpx,
|
||||||
|
const uint16_t tgtw, const uint16_t tgth,
|
||||||
|
uint8_t *newpx,
|
||||||
|
const unsigned oldstride, const unsigned newstride) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handles factors between 0.5 and 1.0
|
||||||
|
void SSE2_scale(const uint8_t *oldpx,
|
||||||
|
const uint16_t tgtw, const uint16_t tgth,
|
||||||
|
uint8_t *newpx,
|
||||||
|
const unsigned oldstride, const unsigned newstride,
|
||||||
|
const float tgtdiff) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // namespace rfb
|
||||||
257
common/rfb/scale_sse2.cxx
Normal file
257
common/rfb/scale_sse2.cxx
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm Web
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <emmintrin.h>
|
||||||
|
|
||||||
|
#include <rfb/scale_sse2.h>
|
||||||
|
|
||||||
|
namespace rfb {
|
||||||
|
|
||||||
|
/*
|
||||||
|
static void print128(const char msg[], const __m128i v) {
|
||||||
|
union {
|
||||||
|
__m128i v;
|
||||||
|
uint8_t c[16];
|
||||||
|
} u;
|
||||||
|
|
||||||
|
u.v = v;
|
||||||
|
|
||||||
|
printf("%s %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
|
||||||
|
msg,
|
||||||
|
u.c[0],
|
||||||
|
u.c[1],
|
||||||
|
u.c[2],
|
||||||
|
u.c[3],
|
||||||
|
u.c[4],
|
||||||
|
u.c[5],
|
||||||
|
u.c[6],
|
||||||
|
u.c[7],
|
||||||
|
u.c[8],
|
||||||
|
u.c[9],
|
||||||
|
u.c[10],
|
||||||
|
u.c[11],
|
||||||
|
u.c[12],
|
||||||
|
u.c[13],
|
||||||
|
u.c[14],
|
||||||
|
u.c[15]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void SSE2_halve(const uint8_t *oldpx,
|
||||||
|
const uint16_t tgtw, const uint16_t tgth,
|
||||||
|
uint8_t *newpx,
|
||||||
|
const unsigned oldstride, const unsigned newstride) {
|
||||||
|
uint16_t x, y;
|
||||||
|
const uint16_t srcw = tgtw * 2, srch = tgth * 2;
|
||||||
|
const __m128i zero = _mm_setzero_si128();
|
||||||
|
const __m128i shift = _mm_set_epi32(0, 0, 0, 2);
|
||||||
|
const __m128i low = _mm_set_epi32(0, 0, 0xffffffff, 0xffffffff);
|
||||||
|
const __m128i high = _mm_set_epi32(0xffffffff, 0xffffffff, 0, 0);
|
||||||
|
|
||||||
|
for (y = 0; y < srch; y += 2) {
|
||||||
|
const uint8_t * const row0 = oldpx + oldstride * y * 4;
|
||||||
|
const uint8_t * const row1 = oldpx + oldstride * (y + 1) * 4;
|
||||||
|
|
||||||
|
uint8_t * const dst = newpx + newstride * (y / 2) * 4;
|
||||||
|
|
||||||
|
for (x = 0; x < srcw; x += 4) {
|
||||||
|
__m128i lo, hi, a, b, c, d;
|
||||||
|
lo = _mm_loadu_si128((__m128i *) &row0[x * 4]);
|
||||||
|
hi = _mm_loadu_si128((__m128i *) &row1[x * 4]);
|
||||||
|
|
||||||
|
a = _mm_unpacklo_epi8(lo, zero);
|
||||||
|
b = _mm_unpackhi_epi8(lo, zero);
|
||||||
|
c = _mm_unpacklo_epi8(hi, zero);
|
||||||
|
d = _mm_unpackhi_epi8(hi, zero);
|
||||||
|
|
||||||
|
a = _mm_add_epi16(a, c);
|
||||||
|
b = _mm_add_epi16(b, d);
|
||||||
|
|
||||||
|
c = _mm_srli_si128(a, 8);
|
||||||
|
a = _mm_and_si128(a, low);
|
||||||
|
a = _mm_add_epi16(a, c);
|
||||||
|
|
||||||
|
d = _mm_slli_si128(b, 8);
|
||||||
|
b = _mm_and_si128(b, high);
|
||||||
|
b = _mm_add_epi16(b, d);
|
||||||
|
|
||||||
|
a = _mm_add_epi16(a, b);
|
||||||
|
|
||||||
|
a = _mm_srl_epi16(a, shift);
|
||||||
|
a = _mm_packus_epi16(a, zero);
|
||||||
|
|
||||||
|
_mm_storel_epi64((__m128i *) &dst[(x / 2) * 4], a);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; x < srcw; x += 2) {
|
||||||
|
// Remainder in C
|
||||||
|
uint8_t i;
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
dst[(x / 2) * 4 + i] =
|
||||||
|
(row0[x * 4 + i] +
|
||||||
|
row0[(x + 1) * 4 + i] +
|
||||||
|
row1[x * 4 + i] +
|
||||||
|
row1[(x + 1) * 4 + i]) / 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handles factors between 0.5 and 1.0
|
||||||
|
void SSE2_scale(const uint8_t *oldpx,
|
||||||
|
const uint16_t tgtw, const uint16_t tgth,
|
||||||
|
uint8_t *newpx,
|
||||||
|
const unsigned oldstride, const unsigned newstride,
|
||||||
|
const float tgtdiff) {
|
||||||
|
|
||||||
|
uint16_t x, y;
|
||||||
|
const __m128i zero = _mm_setzero_si128();
|
||||||
|
const __m128i low = _mm_set_epi32(0, 0, 0xffffffff, 0xffffffff);
|
||||||
|
const __m128i high = _mm_set_epi32(0xffffffff, 0xffffffff, 0, 0);
|
||||||
|
const float invdiff = 1 / tgtdiff;
|
||||||
|
|
||||||
|
for (y = 0; y < tgth; y++) {
|
||||||
|
const float ny = y * invdiff;
|
||||||
|
const uint16_t lowy = ny;
|
||||||
|
const uint16_t highy = lowy + 1;
|
||||||
|
const uint16_t bot = (ny - lowy) * 256;
|
||||||
|
const uint16_t top = 256 - bot;
|
||||||
|
const uint32_t * const row0 = (uint32_t *) (oldpx + oldstride * lowy * 4);
|
||||||
|
const uint32_t * const row1 = (uint32_t *) (oldpx + oldstride * highy * 4);
|
||||||
|
const uint8_t * const brow0 = (uint8_t *) row0;
|
||||||
|
const uint8_t * const brow1 = (uint8_t *) row1;
|
||||||
|
|
||||||
|
uint8_t * const dst = newpx + newstride * y * 4;
|
||||||
|
|
||||||
|
const __m128i vertmul = _mm_set1_epi16(top);
|
||||||
|
const __m128i vertmul2 = _mm_set1_epi16(bot);
|
||||||
|
|
||||||
|
for (x = 0; x < tgtw; x += 2) {
|
||||||
|
const float nx[2] = {
|
||||||
|
x * invdiff,
|
||||||
|
(x + 1) * invdiff,
|
||||||
|
};
|
||||||
|
const uint16_t lowx[2] = {
|
||||||
|
(uint16_t) nx[0],
|
||||||
|
(uint16_t) nx[1],
|
||||||
|
};
|
||||||
|
const uint16_t highx[2] = {
|
||||||
|
(uint16_t) (lowx[0] + 1),
|
||||||
|
(uint16_t) (lowx[1] + 1),
|
||||||
|
};
|
||||||
|
const uint16_t right[2] = {
|
||||||
|
(uint16_t) ((nx[0] - lowx[0]) * 256),
|
||||||
|
(uint16_t) ((nx[1] - lowx[1]) * 256),
|
||||||
|
};
|
||||||
|
const uint16_t left[2] = {
|
||||||
|
(uint16_t) (256 - right[0]),
|
||||||
|
(uint16_t) (256 - right[1]),
|
||||||
|
};
|
||||||
|
|
||||||
|
const __m128i horzmul = _mm_set_epi16(
|
||||||
|
right[0],
|
||||||
|
right[0],
|
||||||
|
right[0],
|
||||||
|
right[0],
|
||||||
|
left[0],
|
||||||
|
left[0],
|
||||||
|
left[0],
|
||||||
|
left[0]
|
||||||
|
);
|
||||||
|
const __m128i horzmul2 = _mm_set_epi16(
|
||||||
|
right[1],
|
||||||
|
right[1],
|
||||||
|
right[1],
|
||||||
|
right[1],
|
||||||
|
left[1],
|
||||||
|
left[1],
|
||||||
|
left[1],
|
||||||
|
left[1]
|
||||||
|
);
|
||||||
|
|
||||||
|
__m128i lo, hi, a, b, c, d;
|
||||||
|
lo = _mm_setr_epi32(row0[lowx[0]],
|
||||||
|
row0[highx[0]],
|
||||||
|
row0[lowx[1]],
|
||||||
|
row0[highx[1]]);
|
||||||
|
hi = _mm_setr_epi32(row1[lowx[0]],
|
||||||
|
row1[highx[0]],
|
||||||
|
row1[lowx[1]],
|
||||||
|
row1[highx[1]]);
|
||||||
|
|
||||||
|
a = _mm_unpacklo_epi8(lo, zero);
|
||||||
|
b = _mm_unpackhi_epi8(lo, zero);
|
||||||
|
c = _mm_unpacklo_epi8(hi, zero);
|
||||||
|
d = _mm_unpackhi_epi8(hi, zero);
|
||||||
|
|
||||||
|
a = _mm_mullo_epi16(a, vertmul);
|
||||||
|
b = _mm_mullo_epi16(b, vertmul);
|
||||||
|
c = _mm_mullo_epi16(c, vertmul2);
|
||||||
|
d = _mm_mullo_epi16(d, vertmul2);
|
||||||
|
|
||||||
|
a = _mm_add_epi16(a, c);
|
||||||
|
a = _mm_srli_epi16(a, 8);
|
||||||
|
b = _mm_add_epi16(b, d);
|
||||||
|
b = _mm_srli_epi16(b, 8);
|
||||||
|
|
||||||
|
a = _mm_mullo_epi16(a, horzmul);
|
||||||
|
b = _mm_mullo_epi16(b, horzmul2);
|
||||||
|
|
||||||
|
lo = _mm_srli_si128(a, 8);
|
||||||
|
a = _mm_and_si128(a, low);
|
||||||
|
a = _mm_add_epi16(a, lo);
|
||||||
|
|
||||||
|
hi = _mm_slli_si128(b, 8);
|
||||||
|
b = _mm_and_si128(b, high);
|
||||||
|
b = _mm_add_epi16(b, hi);
|
||||||
|
|
||||||
|
a = _mm_add_epi16(a, b);
|
||||||
|
a = _mm_srli_epi16(a, 8);
|
||||||
|
|
||||||
|
a = _mm_packus_epi16(a, zero);
|
||||||
|
|
||||||
|
_mm_storel_epi64((__m128i *) &dst[x * 4], a);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; x < tgtw; x++) {
|
||||||
|
// Remainder in C
|
||||||
|
const float nx = x * invdiff;
|
||||||
|
const uint16_t lowx = nx;
|
||||||
|
const uint16_t highx = lowx + 1;
|
||||||
|
const uint16_t right = (nx - lowx) * 256;
|
||||||
|
const uint16_t left = 256 - right;
|
||||||
|
|
||||||
|
uint8_t i;
|
||||||
|
uint32_t val, val2;
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
val = brow0[lowx * 4 + i] * left;
|
||||||
|
val += brow0[highx * 4 + i] * right;
|
||||||
|
val >>= 8;
|
||||||
|
|
||||||
|
val2 = brow1[lowx * 4 + i] * left;
|
||||||
|
val2 += brow1[highx * 4 + i] * right;
|
||||||
|
val2 >>= 8;
|
||||||
|
|
||||||
|
dst[x * 4 + i] =
|
||||||
|
(val * top + val2 * bot) >> 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // namespace rfb
|
||||||
38
common/rfb/scale_sse2.h
Normal file
38
common/rfb/scale_sse2.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm Web
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RFB_SCALE_SSE2_H__
|
||||||
|
#define __RFB_SCALE_SSE2_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace rfb {
|
||||||
|
|
||||||
|
void SSE2_halve(const uint8_t *oldpx,
|
||||||
|
const uint16_t tgtw, const uint16_t tgth,
|
||||||
|
uint8_t *newpx,
|
||||||
|
const unsigned oldstride, const unsigned newstride);
|
||||||
|
|
||||||
|
void SSE2_scale(const uint8_t *oldpx,
|
||||||
|
const uint16_t tgtw, const uint16_t tgth,
|
||||||
|
uint8_t *newpx,
|
||||||
|
const unsigned oldstride, const unsigned newstride,
|
||||||
|
const float tgtdiff);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
2
debian/Makefile.to_fakebuild_tar_package
vendored
2
debian/Makefile.to_fakebuild_tar_package
vendored
@@ -1,7 +1,7 @@
|
|||||||
TARGET_OS := $(shell lsb_release -is | tr '[:upper:]' '[:lower:]')
|
TARGET_OS := $(shell lsb_release -is | tr '[:upper:]' '[:lower:]')
|
||||||
TARGET_OS_CODENAME := $(shell lsb_release -cs | tr '[:upper:]' '[:lower:]')
|
TARGET_OS_CODENAME := $(shell lsb_release -cs | tr '[:upper:]' '[:lower:]')
|
||||||
TARBALL_DIR := builder/build
|
TARBALL_DIR := builder/build
|
||||||
TARBALL := $(TARBALL_DIR)/kasmvnc.$(TARGET_OS)_$(TARGET_OS_CODENAME).tar.gz
|
TARBALL := $(TARBALL_DIR)/kasmvnc.$(TARGET_OS)_$(TARGET_OS_CODENAME)$(BUILD_TAG).tar.gz
|
||||||
TAR_DATA := $(shell mktemp -d)
|
TAR_DATA := $(shell mktemp -d)
|
||||||
SRC := $(TAR_DATA)/usr/local
|
SRC := $(TAR_DATA)/usr/local
|
||||||
SRC_BIN := $(SRC)/bin
|
SRC_BIN := $(SRC)/bin
|
||||||
|
|||||||
2
kasmweb
2
kasmweb
Submodule kasmweb updated: ba40cacce0...d1e4bda4b3
@@ -317,6 +317,10 @@ Log clipboard and keyboard actions. Info logs just clipboard direction and size,
|
|||||||
verbose adds the contents for both.
|
verbose adds the contents for both.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-selfBench
|
||||||
|
Run a set of self-benchmarks and exit.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
.B \-noWebsocket
|
.B \-noWebsocket
|
||||||
Disable websockets and expose a traditional VNC port (5901, etc.).
|
Disable websockets and expose a traditional VNC port (5901, etc.).
|
||||||
.
|
.
|
||||||
|
|||||||
Reference in New Issue
Block a user