Compare commits
16 Commits
KASM-1910-
...
feature/KA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
152821d77b | ||
|
|
906fcc3e67 | ||
|
|
ab32cbc53e | ||
|
|
a48811b12f | ||
|
|
4c4808d2bd | ||
|
|
e282851073 | ||
|
|
40d263368d | ||
|
|
377d3e5629 | ||
|
|
5b516e84d9 | ||
|
|
43c31d759b | ||
|
|
aa7d1b5a30 | ||
|
|
8b5600e8f3 | ||
|
|
bbd971e9f1 | ||
|
|
0467e938a2 | ||
|
|
01623eaffd | ||
|
|
3383ad52e4 |
@@ -1,14 +0,0 @@
|
|||||||
#!/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,33 +1,16 @@
|
|||||||
#!/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}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
|
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${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}${REVISION}_${OS_ARCH}.${PACKAGE_FORMAT}";
|
export upload_filename="kasmvncserver_${PACKAGE_OS}_${RELEASE_VERSION}_${SANITIZED_BRANCH}_${CI_COMMIT_SHA:0:6}_${OS_ARCH}.${PACKAGE_FORMAT}";
|
||||||
fi
|
fi
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,7 +25,6 @@ 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;
|
||||||
@@ -56,16 +38,3 @@ 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
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
builder/build
|
||||||
@@ -6,22 +6,11 @@ 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
|
||||||
@@ -45,18 +34,6 @@ 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:
|
||||||
@@ -123,9 +100,10 @@ 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 '*.deb' -or -name '*.rpm'`; do
|
- for package in `find output/ -type f -name 'kasmvncserver_*.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,7 +16,6 @@ include(CheckLibraryExists)
|
|||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
include(CheckCXXCompilerFlag)
|
|
||||||
include(CheckCSourceRuns)
|
include(CheckCSourceRuns)
|
||||||
|
|
||||||
include(CMakeMacroLibtoolFile)
|
include(CMakeMacroLibtoolFile)
|
||||||
@@ -209,9 +208,6 @@ 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,17 +3,8 @@ Docker CE
|
|||||||
|
|
||||||
# Build a deb/rpm package
|
# Build a deb/rpm package
|
||||||
```
|
```
|
||||||
# builder/build-package <os> <os_codename> <build_tag>
|
# builder/build-package <os> <os_codename>
|
||||||
# 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
|
||||||
@@ -79,14 +70,3 @@ 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,17 +5,12 @@ set -e
|
|||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
. builder/os_ver_cli.sh
|
. builder/os_ver_cli.sh
|
||||||
|
|
||||||
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
|
docker build -t debbuilder_${os}:${os_codename} -f \
|
||||||
L_GID=$(id -g)
|
builder/dockerfile.${os}_${os_codename}.deb.build .
|
||||||
|
|
||||||
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)
|
deb_output_dir=$(cd .. && echo $PWD)
|
||||||
docker run --rm -v "$deb_output_dir":/src -e BUILD_TAG="$build_tag" \
|
L_UID=$(id -u) #Ubuntu already has UID env var, but this should work on all Linix systems
|
||||||
--user "$L_UID:$L_GID" \
|
L_GID=$(id -g)
|
||||||
"$builder_image" /bin/bash -c \
|
docker run --rm -v "$deb_output_dir":/src --user $L_UID:$L_GID \
|
||||||
|
debbuilder_${os}:${os_codename} /bin/bash -c \
|
||||||
'/src/*/builder/build-deb-inside-docker'
|
'/src/*/builder/build-deb-inside-docker'
|
||||||
|
|||||||
@@ -2,31 +2,12 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
prepare_docker_copy_of_debian_dir_and_cd_to_id() {
|
cd "$(dirname "$0")/.."
|
||||||
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,7 +4,6 @@ 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
|
||||||
@@ -13,17 +12,8 @@ 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
|
||||||
warn_build_tag_not_supported_for_rpm_and_exit
|
builder/build-tarball "$os" "$codename"
|
||||||
|
builder/build-${package_format} "$os" "$codename"
|
||||||
builder/build-tarball "$os" "$codename" "$build_tag"
|
|
||||||
builder/build-${package_format} "$os" "$codename" "$build_tag"
|
|
||||||
|
|||||||
@@ -2,18 +2,8 @@
|
|||||||
|
|
||||||
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 .
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
build_www_dir() {
|
build_www_dir() {
|
||||||
local webpacked_www=$PWD/builder/www
|
local webpacked_www=$PWD/builder/www
|
||||||
@@ -12,13 +13,6 @@ 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")/.."
|
||||||
@@ -26,21 +20,13 @@ cd "$(dirname "$0")/.."
|
|||||||
|
|
||||||
build_www_dir
|
build_www_dir
|
||||||
|
|
||||||
builder_image=kasmvncbuilder:$os_codename${build_tag_for_images}
|
docker build -t kasmvncbuilder:$os_codename \
|
||||||
docker build -t "$builder_image" \
|
-f builder/dockerfile.${os}_${os_codename}.build .
|
||||||
-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 -e BUILD_TAG="$build_tag" \
|
docker run -v $shared_with_docker_dir:/build --rm kasmvncbuilder:$os_codename
|
||||||
--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 \
|
mv $shared_with_docker_dir/$tarball_name $PWD/builder/build/
|
||||||
$PWD/builder/build/"$tarball_name_with_build_tag"
|
|
||||||
|
|
||||||
if [ "$build_tag" = "+libjpeg-turbo_latest" ]; then
|
|
||||||
move_libjpeg_turbo_to_os_specific_dir
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
detect_quilt() {
|
detect_quilt() {
|
||||||
if which quilt 1>/dev/null; then
|
if which quilt 1>/dev/null; then
|
||||||
QUILT_PRESENT=1
|
QUILT_PRESENT=1
|
||||||
@@ -80,11 +82,9 @@ cd /src
|
|||||||
detect_quilt
|
detect_quilt
|
||||||
if [ -n "$QUILT_PRESENT" ]; then
|
if [ -n "$QUILT_PRESENT" ]; then
|
||||||
quilt push -a
|
quilt push -a
|
||||||
|
echo 'Patches applied!'
|
||||||
fi
|
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
|
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ RUN yum install -y make
|
|||||||
RUN yum group install -y "Development Tools"
|
RUN yum group install -y "Development Tools"
|
||||||
RUN yum install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
|
RUN yum install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
|
||||||
RUN yum install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
|
RUN yum install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
|
||||||
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel
|
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel pam-devel \
|
||||||
|
gnutls-devel libX11-devel libXtst-devel libXcursor-devel
|
||||||
RUN yum install -y mesa-dri-drivers
|
RUN yum install -y mesa-dri-drivers
|
||||||
|
|
||||||
# Additions for webp
|
# Additions for webp
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ RUN apt-get update && \
|
|||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
||||||
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
||||||
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
||||||
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
|
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
|
||||||
|
|
||||||
# Additions for webp
|
# 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 && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
|
||||||
|
|||||||
@@ -9,11 +9,4 @@ 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
|
||||||
|
|
||||||
ARG L_UID
|
USER 1000
|
||||||
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 rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN 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 rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN 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
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ RUN apt-get update && \
|
|||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
||||||
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
||||||
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
||||||
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
|
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
|
||||||
|
|
||||||
# Additions for webp
|
# 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 && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
|
||||||
|
|||||||
@@ -9,11 +9,4 @@ 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
|
||||||
|
|
||||||
ARG L_UID
|
USER 1000
|
||||||
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 rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
### END CUSTOM STUFF ###
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ RUN dnf install -y make
|
|||||||
RUN dnf group install -y "Development Tools"
|
RUN dnf group install -y "Development Tools"
|
||||||
RUN dnf install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
|
RUN dnf install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel
|
||||||
RUN dnf install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
|
RUN dnf install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
|
||||||
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel
|
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel libXcursor-devel
|
||||||
RUN dnf install -y mesa-dri-drivers
|
RUN dnf install -y mesa-dri-drivers
|
||||||
RUN dnf install -y bzip2 redhat-lsb-core
|
RUN dnf install -y bzip2 redhat-lsb-core
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ RUN apt-get update && \
|
|||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
|
||||||
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
||||||
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
||||||
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
|
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
|
||||||
|
|
||||||
# Additions for webp
|
# 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 && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
|
||||||
|
|||||||
@@ -9,11 +9,4 @@ 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
|
||||||
|
|
||||||
ARG L_UID
|
USER 1000
|
||||||
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 rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
### END CUSTOM STUFF ###
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
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"]
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
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" ]
|
|
||||||
@@ -11,7 +11,7 @@ RUN apt-get update && \
|
|||||||
|
|
||||||
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
||||||
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
||||||
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
|
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
|
||||||
|
|
||||||
# Additions for webp
|
# 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 && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
|
||||||
|
|||||||
@@ -7,11 +7,4 @@ 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
|
||||||
|
|
||||||
ARG L_UID
|
USER 1000
|
||||||
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 rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN 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 rm -f /tmp/kasmvncserver_*+*.deb; apt-get update && dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN 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
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ RUN apt-get update && \
|
|||||||
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
|
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
|
||||||
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
||||||
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
RUN apt-get update && apt-get -y install cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver
|
||||||
RUN apt-get update && apt-get -y install libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
|
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
|
||||||
|
|
||||||
# Additions for webp
|
# 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 && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
|
||||||
|
|||||||
@@ -9,11 +9,4 @@ 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
|
||||||
|
|
||||||
ARG L_UID
|
USER 1000
|
||||||
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 rm -f /tmp/kasmvncserver_*+*.deb; dpkg -i /tmp/*.deb; apt-get -yf install
|
RUN 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,11 +3,6 @@ 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,12 +5,10 @@ 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}" \
|
||||||
--build-arg BUILD_DEBIAN_REVISION="$build_debian_revision" \
|
-t kasmvnctester_${os}:$os_codename \
|
||||||
-t "$tester_image" \
|
-f dockerfile.${os}_${os_codename}.deb.test .
|
||||||
-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" \
|
||||||
"$tester_image"
|
kasmvnctester_${os}:$os_codename
|
||||||
|
|||||||
@@ -62,8 +62,10 @@ cp $SRC/man/man1/Xvnc.1 $DESTDIR/usr/share/man/man1/;
|
|||||||
cp $SRC/share/man/man1/vncserver.1 $DST_MAN;
|
cp $SRC/share/man/man1/vncserver.1 $DST_MAN;
|
||||||
cp $SRC/share/man/man1/vncconfig.1 $DST_MAN;
|
cp $SRC/share/man/man1/vncconfig.1 $DST_MAN;
|
||||||
cp $SRC/share/man/man1/vncpasswd.1 $DST_MAN;
|
cp $SRC/share/man/man1/vncpasswd.1 $DST_MAN;
|
||||||
|
cp $SRC/share/man/man1/kasmxpoxy.1 $DST_MAN;
|
||||||
cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
|
cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
|
||||||
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
/usr/bin/*
|
/usr/bin/*
|
||||||
/usr/share/man/man1/*
|
/usr/share/man/man1/*
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#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>
|
||||||
@@ -33,6 +32,10 @@ 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,7 +48,6 @@ 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
|
||||||
@@ -64,7 +63,6 @@ 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)
|
||||||
@@ -98,27 +96,6 @@ 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,12 +22,10 @@
|
|||||||
#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>
|
||||||
@@ -897,7 +895,7 @@ void EncodeManager::updateVideoStats(const std::vector<Rect> &rects, const Pixel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelBuffer *rfb::nearestScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
static PixelBuffer *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);
|
||||||
@@ -922,7 +920,7 @@ PixelBuffer *rfb::nearestScale(const PixelBuffer *pb, const uint16_t w, const ui
|
|||||||
return newpb;
|
return newpb;
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelBuffer *rfb::bilinearScale(const PixelBuffer *pb, const uint16_t w, const uint16_t h,
|
static PixelBuffer *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);
|
||||||
@@ -970,68 +968,10 @@ PixelBuffer *rfb::bilinearScale(const PixelBuffer *pb, const uint16_t w, const u
|
|||||||
return newpb;
|
return newpb;
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelBuffer *rfb::progressiveBilinearScale(const PixelBuffer *pb,
|
PixelBuffer *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,13 +215,6 @@ 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
|
||||||
|
|||||||
@@ -1,197 +0,0 @@
|
|||||||
/* 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,10 +113,6 @@ 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,7 +74,6 @@ 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,7 +53,6 @@
|
|||||||
|
|
||||||
#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>
|
||||||
@@ -77,8 +76,6 @@ static LogWriter slog("VNCServerST");
|
|||||||
LogWriter VNCServerST::connectionsLog("Connections");
|
LogWriter VNCServerST::connectionsLog("Connections");
|
||||||
EncCache VNCServerST::encCache;
|
EncCache VNCServerST::encCache;
|
||||||
|
|
||||||
void SelfBench();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// -=- VNCServerST Implementation
|
// -=- VNCServerST Implementation
|
||||||
//
|
//
|
||||||
@@ -135,9 +132,6 @@ 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;
|
||||||
|
|
||||||
@@ -218,9 +212,6 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
trackingClient[0] = 0;
|
trackingClient[0] = 0;
|
||||||
|
|
||||||
if (Server::selfBench)
|
|
||||||
SelfBench();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VNCServerST::~VNCServerST()
|
VNCServerST::~VNCServerST()
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
/* 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
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/* 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
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/* 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
|
|
||||||
@@ -1,257 +0,0 @@
|
|||||||
/* 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
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/* 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
|
|
||||||
3
debian/Makefile.to_fakebuild_tar_package
vendored
3
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)$(BUILD_TAG).tar.gz
|
TARBALL := $(TARBALL_DIR)/kasmvnc.$(TARGET_OS)_$(TARGET_OS_CODENAME).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
|
||||||
@@ -16,6 +16,7 @@ install: unpack_tarball
|
|||||||
cp $(SRC_BIN)/vncserver $(DESTDIR)/usr/bin/kasmvncserver
|
cp $(SRC_BIN)/vncserver $(DESTDIR)/usr/bin/kasmvncserver
|
||||||
cp $(SRC_BIN)/vncconfig $(DESTDIR)/usr/bin/kasmvncconfig
|
cp $(SRC_BIN)/vncconfig $(DESTDIR)/usr/bin/kasmvncconfig
|
||||||
cp $(SRC_BIN)/kasmvncpasswd $(DESTDIR)/usr/bin/
|
cp $(SRC_BIN)/kasmvncpasswd $(DESTDIR)/usr/bin/
|
||||||
|
cp $(SRC_BIN)/kasmxproxy $(DESTDIR)/usr/bin/
|
||||||
cp -r $(SRC)/share/doc/kasmvnc*/* $(DESTDIR)/usr/share/doc/kasmvncserver/
|
cp -r $(SRC)/share/doc/kasmvnc*/* $(DESTDIR)/usr/share/doc/kasmvncserver/
|
||||||
rsync -r --exclude '.git*' --exclude po2js --exclude xgettext-html \
|
rsync -r --exclude '.git*' --exclude po2js --exclude xgettext-html \
|
||||||
--exclude www/utils/ --exclude .eslintrc \
|
--exclude www/utils/ --exclude .eslintrc \
|
||||||
|
|||||||
2
debian/control
vendored
2
debian/control
vendored
@@ -3,7 +3,7 @@ Section: x11
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Kasm Technologies LLC <info@kasmweb.com>
|
Maintainer: Kasm Technologies LLC <info@kasmweb.com>
|
||||||
Build-Depends: debhelper (>= 11), rsync, libjpeg-dev, libjpeg-dev, libpng-dev,
|
Build-Depends: debhelper (>= 11), rsync, libjpeg-dev, libjpeg-dev, libpng-dev,
|
||||||
libtiff-dev, libgif-dev, libavcodec-dev, libssl-dev, libgl1, libxfont2, libsm6
|
libtiff-dev, libgif-dev, libavcodec-dev, libssl-dev, libgl1, libxfont2, libsm6, libxext-dev, libxrandr-dev, libxtst-dev, libxcursor-dev
|
||||||
Standards-Version: 4.1.3
|
Standards-Version: 4.1.3
|
||||||
Homepage: https://github.com/kasmtech/KasmVNC
|
Homepage: https://github.com/kasmtech/KasmVNC
|
||||||
#Vcs-Browser: https://salsa.debian.org/debian/kasmvnc
|
#Vcs-Browser: https://salsa.debian.org/debian/kasmvnc
|
||||||
|
|||||||
2
debian/postinst
vendored
2
debian/postinst
vendored
@@ -21,7 +21,7 @@ case "$1" in
|
|||||||
configure)
|
configure)
|
||||||
bindir=/usr/bin
|
bindir=/usr/bin
|
||||||
mandir=/usr/share/man
|
mandir=/usr/share/man
|
||||||
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc"
|
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc kasmxproxy"
|
||||||
|
|
||||||
for kasm_command in $commands; do
|
for kasm_command in $commands; do
|
||||||
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
|
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
|
||||||
|
|||||||
2
debian/prerm
vendored
2
debian/prerm
vendored
@@ -21,7 +21,7 @@ case "$1" in
|
|||||||
remove)
|
remove)
|
||||||
bindir=/usr/bin
|
bindir=/usr/bin
|
||||||
mandir=/usr/share/man
|
mandir=/usr/share/man
|
||||||
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc"
|
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc kasmxproxy"
|
||||||
|
|
||||||
for kasm_command in $commands; do
|
for kasm_command in $commands; do
|
||||||
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
|
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
|
||||||
|
|||||||
2
kasmweb
2
kasmweb
Submodule kasmweb updated: d1e4bda4b3...ba40cacce0
@@ -45,6 +45,7 @@ mkdir -p $OUTDIR/man/man1
|
|||||||
|
|
||||||
make DESTDIR=$TMPDIR/inst install
|
make DESTDIR=$TMPDIR/inst install
|
||||||
if [ $SERVER = 1 ]; then
|
if [ $SERVER = 1 ]; then
|
||||||
|
install -m 755 ./unix/kasmxproxy/kasmxproxy $OUTDIR/bin/
|
||||||
install -m 755 ./xorg.build/bin/Xvnc $OUTDIR/bin/
|
install -m 755 ./xorg.build/bin/Xvnc $OUTDIR/bin/
|
||||||
install -m 644 ./xorg.build/man/man1/Xvnc.1 $OUTDIR/man/man1/Xvnc.1
|
install -m 644 ./xorg.build/man/man1/Xvnc.1 $OUTDIR/man/man1/Xvnc.1
|
||||||
install -m 644 ./xorg.build/man/man1/Xserver.1 $OUTDIR/man/man1/Xserver.1
|
install -m 644 ./xorg.build/man/man1/Xserver.1 $OUTDIR/man/man1/Xserver.1
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ add_subdirectory(common)
|
|||||||
add_subdirectory(vncconfig)
|
add_subdirectory(vncconfig)
|
||||||
add_subdirectory(vncpasswd)
|
add_subdirectory(vncpasswd)
|
||||||
add_subdirectory(kasmvncpasswd)
|
add_subdirectory(kasmvncpasswd)
|
||||||
|
add_subdirectory(kasmxproxy)
|
||||||
|
|
||||||
install(PROGRAMS vncserver DESTINATION ${BIN_DIR})
|
install(PROGRAMS vncserver DESTINATION ${BIN_DIR})
|
||||||
install(FILES vncserver.man DESTINATION ${MAN_DIR}/man1 RENAME vncserver.1)
|
install(FILES vncserver.man DESTINATION ${MAN_DIR}/man1 RENAME vncserver.1)
|
||||||
|
|||||||
1
unix/kasmxproxy/.gitignore
vendored
Normal file
1
unix/kasmxproxy/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
kasmxproxy
|
||||||
11
unix/kasmxproxy/CMakeLists.txt
Normal file
11
unix/kasmxproxy/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
include_directories(${X11_INCLUDE_DIR})
|
||||||
|
|
||||||
|
add_executable(kasmxproxy
|
||||||
|
xxhash.c
|
||||||
|
kasmxproxy.c)
|
||||||
|
|
||||||
|
target_link_libraries(kasmxproxy ${X11_LIBRARIES} ${X11_XTest_LIB} ${X11_Xrandr_LIB}
|
||||||
|
${X11_Xcursor_LIB} ${X11_Xfixes_LIB})
|
||||||
|
|
||||||
|
install(TARGETS kasmxproxy DESTINATION ${BIN_DIR})
|
||||||
|
install(FILES kasmxproxy.man DESTINATION ${MAN_DIR}/man1 RENAME kasmxproxy.1)
|
||||||
530
unix/kasmxproxy/kasmxproxy.c
Normal file
530
unix/kasmxproxy/kasmxproxy.c
Normal file
@@ -0,0 +1,530 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* 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 <getopt.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
#include <sys/shm.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xcursor/Xcursor.h>
|
||||||
|
#include <X11/extensions/Xfixes.h>
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#include <X11/extensions/XShm.h>
|
||||||
|
#include <X11/extensions/XTest.h>
|
||||||
|
|
||||||
|
#include "xxhash.h"
|
||||||
|
|
||||||
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
|
static void help(const char name[]) {
|
||||||
|
printf("Usage: %s [opts]\n\n"
|
||||||
|
"-a --app-display disp App display, default :0\n"
|
||||||
|
"-v --vnc-display disp VNC display, default :1\n"
|
||||||
|
"\n"
|
||||||
|
"-f --fps fps FPS, default 30\n"
|
||||||
|
"-r --resize Enable resize, default disabled.\n"
|
||||||
|
" Do not enable this if there's a physical screen\n"
|
||||||
|
" connected to the app display.\n",
|
||||||
|
name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CUT_MAX (16 * 1024)
|
||||||
|
static uint8_t cutbuf[CUT_MAX];
|
||||||
|
|
||||||
|
static void supplyselection(Display *disp, const XEvent * const ev, const Atom xa_targets) {
|
||||||
|
XSelectionEvent sev;
|
||||||
|
|
||||||
|
sev.type = SelectionNotify;
|
||||||
|
sev.display = disp;
|
||||||
|
sev.requestor = ev->xselectionrequest.requestor;
|
||||||
|
sev.selection = ev->xselectionrequest.selection;
|
||||||
|
sev.target = ev->xselectionrequest.target;
|
||||||
|
sev.time = ev->xselectionrequest.time;
|
||||||
|
/*printf("someone wants our clipboard, sel %lu, tgt %lu, prop %lu\n",
|
||||||
|
sev.selection, sev.target,
|
||||||
|
ev.xselectionrequest.property);*/
|
||||||
|
|
||||||
|
if (ev->xselectionrequest.property == None)
|
||||||
|
sev.property = sev.target;
|
||||||
|
else
|
||||||
|
sev.property = ev->xselectionrequest.property;
|
||||||
|
|
||||||
|
const uint32_t len = strlen((char *) cutbuf);
|
||||||
|
|
||||||
|
if (xa_targets != None &&
|
||||||
|
sev.target == xa_targets) {
|
||||||
|
// Which formats can we do
|
||||||
|
Atom tgt[2] = {
|
||||||
|
xa_targets,
|
||||||
|
XA_STRING
|
||||||
|
};
|
||||||
|
|
||||||
|
XChangeProperty(disp, sev.requestor,
|
||||||
|
ev->xselectionrequest.property,
|
||||||
|
XA_ATOM, 32,
|
||||||
|
PropModeReplace,
|
||||||
|
(unsigned char *) tgt,
|
||||||
|
2);
|
||||||
|
//puts("sent targets");
|
||||||
|
} else {
|
||||||
|
// Data
|
||||||
|
XChangeProperty(disp, sev.requestor,
|
||||||
|
ev->xselectionrequest.property,
|
||||||
|
sev.target, 8,
|
||||||
|
PropModeReplace,
|
||||||
|
cutbuf, len);
|
||||||
|
//printf("sent data, of len %u\n", len);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the notify event
|
||||||
|
XSendEvent(disp, sev.requestor, False, 0,
|
||||||
|
(XEvent *) &sev);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
const char *appstr = ":0";
|
||||||
|
const char *vncstr = ":1";
|
||||||
|
uint8_t resize = 0;
|
||||||
|
uint8_t fps = 30;
|
||||||
|
|
||||||
|
const struct option longargs[] = {
|
||||||
|
{"app-display", 1, NULL, 'a'},
|
||||||
|
{"vnc-display", 1, NULL, 'v'},
|
||||||
|
{"resize", 0, NULL, 'r'},
|
||||||
|
{"fps", 1, NULL, 'f'},
|
||||||
|
|
||||||
|
{NULL, 0, NULL, 0},
|
||||||
|
};
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
int c = getopt_long(argc, argv, "a:v:rf:", longargs, NULL);
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
switch (c) {
|
||||||
|
case 'a':
|
||||||
|
appstr = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
vncstr = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
resize = 1;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
fps = atoi(optarg);
|
||||||
|
if (fps < 1 || fps > 120) {
|
||||||
|
printf("Invalid fps\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
help(argv[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Display *appdisp = XOpenDisplay(appstr);
|
||||||
|
if (!appdisp) {
|
||||||
|
printf("Cannot open display %s\n", appstr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!XShmQueryExtension(appdisp)) {
|
||||||
|
printf("Display %s lacks SHM extension\n", appstr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Display *vncdisp = XOpenDisplay(vncstr);
|
||||||
|
if (!vncdisp) {
|
||||||
|
printf("Cannot open display %s\n", vncstr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!XShmQueryExtension(vncdisp)) {
|
||||||
|
printf("Display %s lacks SHM extension\n", vncstr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int appscreen = DefaultScreen(appdisp);
|
||||||
|
const int vncscreen = DefaultScreen(vncdisp);
|
||||||
|
Visual *appvis = DefaultVisual(appdisp, appscreen);
|
||||||
|
//Visual *vncvis = DefaultVisual(vncdisp, vncscreen);
|
||||||
|
const int appdepth = DefaultDepth(appdisp, appscreen);
|
||||||
|
const int vncdepth = DefaultDepth(vncdisp, vncscreen);
|
||||||
|
if (appdepth != vncdepth) {
|
||||||
|
printf("Depths don't match, app %u vnc %u\n", appdepth, vncdepth);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Window approot = DefaultRootWindow(appdisp);
|
||||||
|
Window vncroot = DefaultRootWindow(vncdisp);
|
||||||
|
XWindowAttributes appattr, vncattr;
|
||||||
|
|
||||||
|
XGCValues gcval;
|
||||||
|
gcval.plane_mask = AllPlanes;
|
||||||
|
gcval.function = GXcopy;
|
||||||
|
GC gc = XCreateGC(vncdisp, vncroot, GCFunction | GCPlaneMask, &gcval);
|
||||||
|
|
||||||
|
XImage *img = NULL;
|
||||||
|
XShmSegmentInfo shminfo;
|
||||||
|
unsigned imgw = 0, imgh = 0;
|
||||||
|
|
||||||
|
if (XGrabPointer(vncdisp, vncroot, False,
|
||||||
|
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||||
|
GrabModeAsync, GrabModeAsync, None, None,
|
||||||
|
CurrentTime) != Success)
|
||||||
|
return 1;
|
||||||
|
if (XGrabKeyboard(vncdisp, vncroot, False, GrabModeAsync, GrabModeAsync,
|
||||||
|
CurrentTime) != Success)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
int xfixesbase, xfixeserrbase;
|
||||||
|
XFixesQueryExtension(appdisp, &xfixesbase, &xfixeserrbase);
|
||||||
|
XFixesSelectSelectionInput(appdisp, approot, XA_PRIMARY,
|
||||||
|
XFixesSetSelectionOwnerNotifyMask);
|
||||||
|
|
||||||
|
int xfixesbasevnc, xfixeserrbasevnc;
|
||||||
|
XFixesQueryExtension(vncdisp, &xfixesbasevnc, &xfixeserrbasevnc);
|
||||||
|
XFixesSelectSelectionInput(vncdisp, vncroot, XA_PRIMARY,
|
||||||
|
XFixesSetSelectionOwnerNotifyMask);
|
||||||
|
|
||||||
|
Atom xa_targets_vnc = XInternAtom(vncdisp, "TARGETS", False);
|
||||||
|
Atom xa_targets_app = XInternAtom(appdisp, "TARGETS", False);
|
||||||
|
Window selwin = XCreateSimpleWindow(appdisp, approot, 3, 2, 1, 1, 0, 0, 0);
|
||||||
|
Window vncselwin = XCreateSimpleWindow(vncdisp, vncroot, 3, 2, 1, 1, 0, 0, 0);
|
||||||
|
|
||||||
|
XFixesCursorImage *cursor = NULL;
|
||||||
|
uint64_t cursorhash = 0;
|
||||||
|
Cursor xcursor = None;
|
||||||
|
|
||||||
|
const unsigned sleeptime = 1000 * 1000 / fps;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (!XGetWindowAttributes(appdisp, approot, &appattr))
|
||||||
|
break;
|
||||||
|
if (!XGetWindowAttributes(vncdisp, vncroot, &vncattr))
|
||||||
|
break;
|
||||||
|
if (resize && (appattr.width != vncattr.width ||
|
||||||
|
appattr.height != vncattr.height)) {
|
||||||
|
// resize app display to VNC display size
|
||||||
|
XRRScreenConfiguration *config = XRRGetScreenInfo(appdisp, approot);
|
||||||
|
|
||||||
|
int nsizes, i, match = -1;
|
||||||
|
XRRScreenSize *sizes = XRRConfigSizes(config, &nsizes);
|
||||||
|
//printf("%u sizes\n", nsizes);
|
||||||
|
for (i = 0; i < nsizes; i++) {
|
||||||
|
if (sizes[i].width == vncattr.width &&
|
||||||
|
sizes[i].height == vncattr.height) {
|
||||||
|
//printf("match %u\n", i);
|
||||||
|
match = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match >= 0) {
|
||||||
|
XRRSetScreenConfig(appdisp, config, approot, match,
|
||||||
|
RR_Rotate_0, CurrentTime);
|
||||||
|
} else {
|
||||||
|
/*XRRSetScreenSize(appdisp, approot,
|
||||||
|
vncattr.width, vncattr.height,
|
||||||
|
sizes[0].mwidth, sizes[0].mheight);*/
|
||||||
|
XRRScreenResources *res = XRRGetScreenResources(appdisp, approot);
|
||||||
|
//printf("%u outputs, %u crtcs\n", res->noutput, res->ncrtc);
|
||||||
|
// Nvidia crap uses a *different* list for 1.0 and 1.2!
|
||||||
|
unsigned oldmode = 0xffff;
|
||||||
|
//printf("1.2 modes %u\n", res->nmode);
|
||||||
|
for (i = 0; i < res->nmode; i++) {
|
||||||
|
if (res->modes[i].width == vncattr.width &&
|
||||||
|
res->modes[i].height == vncattr.height) {
|
||||||
|
oldmode = i;
|
||||||
|
//printf("old mode %u matched\n", i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned tgt = 0;
|
||||||
|
if (res->noutput > 1) {
|
||||||
|
for (i = 0; i < res->noutput; i++) {
|
||||||
|
XRROutputInfo *info = XRRGetOutputInfo(appdisp, res, res->outputs[i]);
|
||||||
|
if (info->connection == RR_Connected)
|
||||||
|
tgt = i;
|
||||||
|
//printf("%u %s %u\n", i, info->name, info->connection);
|
||||||
|
XRRFreeOutputInfo(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldmode < 0xffff) {
|
||||||
|
Status s;
|
||||||
|
// nvidia needs this weird dance
|
||||||
|
s = XRRSetCrtcConfig(appdisp, res, res->crtcs[tgt],
|
||||||
|
CurrentTime,
|
||||||
|
0, 0,
|
||||||
|
None, RR_Rotate_0,
|
||||||
|
NULL, 0);
|
||||||
|
//printf("disable %u\n", s);
|
||||||
|
XRRSetScreenSize(appdisp, approot,
|
||||||
|
vncattr.width, vncattr.height,
|
||||||
|
sizes[0].mwidth, sizes[0].mheight);
|
||||||
|
s = XRRSetCrtcConfig(appdisp, res, res->crtcs[tgt],
|
||||||
|
CurrentTime,
|
||||||
|
0, 0,
|
||||||
|
res->modes[oldmode].id, RR_Rotate_0,
|
||||||
|
&res->outputs[tgt], 1);
|
||||||
|
//printf("set %u\n", s);
|
||||||
|
} else {
|
||||||
|
char name[32];
|
||||||
|
sprintf(name, "%ux%u_60", vncattr.width, vncattr.height);
|
||||||
|
printf("Creating new Mode %s\n", name);
|
||||||
|
XRRModeInfo *mode = XRRAllocModeInfo(name, strlen(name));
|
||||||
|
|
||||||
|
mode->width = vncattr.width;
|
||||||
|
mode->height = vncattr.height;
|
||||||
|
|
||||||
|
RRMode rmode = XRRCreateMode(appdisp, approot, mode);
|
||||||
|
XRRAddOutputMode(appdisp,
|
||||||
|
res->outputs[tgt],
|
||||||
|
rmode);
|
||||||
|
XRRFreeModeInfo(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
XRRFreeScreenResources(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
XRRFreeScreenConfigInfo(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned w = min(appattr.width, vncattr.width);
|
||||||
|
const unsigned h = min(appattr.height, vncattr.height);
|
||||||
|
|
||||||
|
if (w != imgw || h != imgh) {
|
||||||
|
if (img) {
|
||||||
|
XShmDetach(appdisp, &shminfo);
|
||||||
|
XDestroyImage(img);
|
||||||
|
shmdt(shminfo.shmaddr);
|
||||||
|
shmctl(shminfo.shmid, IPC_RMID, NULL);
|
||||||
|
}
|
||||||
|
img = XShmCreateImage(appdisp, appvis, appdepth, ZPixmap,
|
||||||
|
NULL, &shminfo, w, h);
|
||||||
|
if (!img)
|
||||||
|
break;
|
||||||
|
|
||||||
|
shminfo.shmid = shmget(IPC_PRIVATE,
|
||||||
|
img->bytes_per_line * img->height,
|
||||||
|
IPC_CREAT | 0666);
|
||||||
|
if (shminfo.shmid == -1)
|
||||||
|
break;
|
||||||
|
shminfo.shmaddr = img->data = shmat(shminfo.shmid, 0, 0);
|
||||||
|
shminfo.readOnly = False;
|
||||||
|
if (!XShmAttach(appdisp, &shminfo))
|
||||||
|
break;
|
||||||
|
|
||||||
|
imgw = w;
|
||||||
|
imgh = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
XShmGetImage(appdisp, approot, img, 0, 0, 0xffffffff);
|
||||||
|
XPutImage(vncdisp, vncroot, gc, img, 0, 0, 0, 0, w, h);
|
||||||
|
|
||||||
|
// Handle events
|
||||||
|
while (XPending(vncdisp)) {
|
||||||
|
XEvent ev;
|
||||||
|
XNextEvent(vncdisp, &ev);
|
||||||
|
|
||||||
|
if (ev.type == xfixesbasevnc + XFixesSelectionNotify) {
|
||||||
|
XFixesSelectionNotifyEvent *xfe =
|
||||||
|
(XFixesSelectionNotifyEvent *) &ev;
|
||||||
|
// printf("vnc disp did a copy, owner %lu, root %lu\n",
|
||||||
|
// xfe->owner, vncroot);
|
||||||
|
if (xfe->owner == None || xfe->owner == vncroot)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
XConvertSelection(vncdisp, XA_PRIMARY, XA_STRING, XA_STRING,
|
||||||
|
vncselwin, CurrentTime);
|
||||||
|
} else switch (ev.type) {
|
||||||
|
case KeyPress:
|
||||||
|
case KeyRelease:
|
||||||
|
XTestFakeKeyEvent(appdisp, ev.xkey.keycode,
|
||||||
|
ev.type == KeyPress,
|
||||||
|
CurrentTime);
|
||||||
|
break;
|
||||||
|
case ButtonPress:
|
||||||
|
case ButtonRelease:
|
||||||
|
XTestFakeButtonEvent(appdisp, ev.xbutton.button,
|
||||||
|
ev.type == ButtonPress,
|
||||||
|
CurrentTime);
|
||||||
|
break;
|
||||||
|
case MotionNotify:
|
||||||
|
XTestFakeMotionEvent(appdisp, appscreen,
|
||||||
|
ev.xmotion.x,
|
||||||
|
ev.xmotion.y,
|
||||||
|
CurrentTime);
|
||||||
|
break;
|
||||||
|
case SelectionRequest:
|
||||||
|
supplyselection(vncdisp, &ev, xa_targets_vnc);
|
||||||
|
break;
|
||||||
|
case SelectionNotify:
|
||||||
|
{
|
||||||
|
Atom realtype;
|
||||||
|
int fmt;
|
||||||
|
unsigned long nitems, bytes_rem;
|
||||||
|
unsigned char *data;
|
||||||
|
if (XGetWindowProperty(vncdisp, vncselwin,
|
||||||
|
XA_STRING,
|
||||||
|
0, CUT_MAX / 4,
|
||||||
|
False, AnyPropertyType,
|
||||||
|
&realtype, &fmt,
|
||||||
|
&nitems, &bytes_rem,
|
||||||
|
&data) == Success) {
|
||||||
|
|
||||||
|
if (bytes_rem) {
|
||||||
|
printf("Clipboard too large, ignoring\n");
|
||||||
|
} else {
|
||||||
|
const uint32_t len = nitems * (fmt / 8);
|
||||||
|
//printf("realtype %lu, fmt %u, nitems %lu\n",
|
||||||
|
// realtype, fmt, nitems);
|
||||||
|
memcpy(cutbuf, data, len);
|
||||||
|
if (len < CUT_MAX)
|
||||||
|
cutbuf[len] = 0;
|
||||||
|
else
|
||||||
|
cutbuf[CUT_MAX - 1] = 0;
|
||||||
|
|
||||||
|
// Send it to the app screen
|
||||||
|
XSetSelectionOwner(appdisp, XA_PRIMARY,
|
||||||
|
approot,
|
||||||
|
CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(data);
|
||||||
|
} else {
|
||||||
|
printf("Failed to fetch vnc clipboard\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SelectionClear:
|
||||||
|
cutbuf[0] = '\0';
|
||||||
|
XSetSelectionOwner(appdisp, XA_PRIMARY, None,
|
||||||
|
CurrentTime);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unexpected event type %u\n", ev.type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// App-side events
|
||||||
|
while (XPending(appdisp)) {
|
||||||
|
XEvent ev;
|
||||||
|
XNextEvent(appdisp, &ev);
|
||||||
|
|
||||||
|
if (ev.type == xfixesbase + XFixesSelectionNotify) {
|
||||||
|
XFixesSelectionNotifyEvent *xfe =
|
||||||
|
(XFixesSelectionNotifyEvent *) &ev;
|
||||||
|
//printf("app disp did a copy, owner %lu\n", xfe->owner);
|
||||||
|
if (xfe->owner == None || xfe->owner == approot)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
XConvertSelection(appdisp, XA_PRIMARY, XA_STRING, XA_STRING,
|
||||||
|
selwin, CurrentTime);
|
||||||
|
} else switch (ev.type) {
|
||||||
|
case SelectionNotify:
|
||||||
|
{
|
||||||
|
Atom realtype;
|
||||||
|
int fmt;
|
||||||
|
unsigned long nitems, bytes_rem;
|
||||||
|
unsigned char *data;
|
||||||
|
if (XGetWindowProperty(appdisp, selwin,
|
||||||
|
XA_STRING,
|
||||||
|
0, CUT_MAX / 4,
|
||||||
|
False, AnyPropertyType,
|
||||||
|
&realtype, &fmt,
|
||||||
|
&nitems, &bytes_rem,
|
||||||
|
&data) == Success) {
|
||||||
|
|
||||||
|
if (bytes_rem) {
|
||||||
|
printf("Clipboard too large, ignoring\n");
|
||||||
|
} else {
|
||||||
|
const uint32_t len = nitems * (fmt / 8);
|
||||||
|
//printf("realtype %lu, fmt %u, nitems %lu\n",
|
||||||
|
// realtype, fmt, nitems);
|
||||||
|
memcpy(cutbuf, data, len);
|
||||||
|
if (len < CUT_MAX)
|
||||||
|
cutbuf[len] = 0;
|
||||||
|
else
|
||||||
|
cutbuf[CUT_MAX - 1] = 0;
|
||||||
|
|
||||||
|
// Send it to the VNC screen
|
||||||
|
XSetSelectionOwner(vncdisp, XA_PRIMARY,
|
||||||
|
vncroot,
|
||||||
|
CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(data);
|
||||||
|
} else {
|
||||||
|
printf("Failed to fetch app clipboard\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SelectionRequest:
|
||||||
|
supplyselection(appdisp, &ev, xa_targets_app);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unexpected app event type %u\n", ev.type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cursors
|
||||||
|
cursor = XFixesGetCursorImage(appdisp);
|
||||||
|
uint64_t newhash = XXH64(cursor->pixels,
|
||||||
|
cursor->width * cursor->height * sizeof(unsigned long),
|
||||||
|
0);
|
||||||
|
if (cursorhash != newhash) {
|
||||||
|
if (cursorhash)
|
||||||
|
XFreeCursor(vncdisp, xcursor);
|
||||||
|
|
||||||
|
XcursorImage *converted = XcursorImageCreate(cursor->width, cursor->height);
|
||||||
|
|
||||||
|
converted->xhot = cursor->xhot;
|
||||||
|
converted->yhot = cursor->yhot;
|
||||||
|
unsigned i;
|
||||||
|
for (i = 0; i < cursor->width * cursor->height; i++) {
|
||||||
|
converted->pixels[i] = cursor->pixels[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
xcursor = XcursorImageLoadCursor(vncdisp, converted);
|
||||||
|
XDefineCursor(vncdisp, vncroot, xcursor);
|
||||||
|
|
||||||
|
XcursorImageDestroy(converted);
|
||||||
|
|
||||||
|
cursorhash = newhash;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(sleeptime);
|
||||||
|
}
|
||||||
|
|
||||||
|
XCloseDisplay(appdisp);
|
||||||
|
XCloseDisplay(vncdisp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
unix/kasmxproxy/kasmxproxy.man
Normal file
18
unix/kasmxproxy/kasmxproxy.man
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.TH kasmxproxy 1 "" "KasmVNC" "Virtual Network Computing"
|
||||||
|
.SH NAME
|
||||||
|
kasmxproxy \- proxy an existing X11 display to a KasmVNC display
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B kasmxproxy
|
||||||
|
.RB [ \-a \-\-app\-display
|
||||||
|
.IR source display, default :0 ]
|
||||||
|
.RB [ \-v \-\-vnc\-display
|
||||||
|
.IR destination display, default :1 ]
|
||||||
|
.RB [ \-f \-\-fps
|
||||||
|
.IR FPS, default 30 ]
|
||||||
|
.RB [ \-r \-\-resize
|
||||||
|
.IR Enable resizing, default disabled. WARNING: DO NOT ENABLE IF PHYSICAL DISPLAY IS ATTACHED ]
|
||||||
|
.br
|
||||||
|
.BI "kasmxproxy -a :1 -v :10 -r"
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B kasmxproxy
|
||||||
|
is used to proxy an x display, usually attached to a physical GPU, to KasmVNC display. This is usually used in the context of providing GPU acceleration to a KasmVNC session.
|
||||||
1
unix/kasmxproxy/xxhash.c
Symbolic link
1
unix/kasmxproxy/xxhash.c
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../common/rfb/xxhash.c
|
||||||
1
unix/kasmxproxy/xxhash.h
Symbolic link
1
unix/kasmxproxy/xxhash.h
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../common/rfb/xxhash.h
|
||||||
@@ -317,10 +317,6 @@ 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