rebase and fix conflicts

This commit is contained in:
mattmcclaskey 2023-03-07 07:23:03 -05:00
commit 252fc2f20c
No known key found for this signature in database
53 changed files with 1398 additions and 114 deletions

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -0,0 +1,27 @@
---
name: Installation Issue
about: Create a report about an installation issue
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the issue is.
**System Description**
Provide the output of
```bash
cat /etc/os-release
uname -a
```
**KasmVNC Details**
Provide the filename of the package you installed KasmVNC with. The filename includes important details like the OS, architecture, and commit sha.
**Installation Details**
Provide the commands used to install the KasmVNC package and the output of those commands.
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,46 @@
---
name: Report a bug or issue with KasmVNC
about: Create a bug/issue report on KasmVNC
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the issue is.
**System Description**
Provide the output of
```bash
cat /etc/os-release
uname -a
```
**KasmVNC Details**
Provide the filename of the package you installed KasmVNC with. The filename includes important details like the OS, architecture, and commit sha.
Provide the output of this command.
```bash
Xvnc -version
```
**To Reproduce**
Steps to reproduce the behavior (for non-installation issues):
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Browser**
If this is a problem with the KasmVNC client, provide details about the browser you are accessing KasmVNC from.
- Device: [e.g. iPhone6]
- OS: [e.g. Windows 11]
- Browser [e.g. chrome, safari, edge]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -11,6 +11,7 @@ variables:
# arm builds, because build_debian_buster_arm matches build_debian_buster. # arm builds, because build_debian_buster_arm matches build_debian_buster.
# "BUILD_JOBS: none" won't build any build jobs, nor www. # "BUILD_JOBS: none" won't build any build jobs, nor www.
BUILD_JOBS: all BUILD_JOBS: all
DOCKER_HOST: unix://
workflow: workflow:
rules: rules:
@ -35,6 +36,10 @@ stages:
- cp -r builder/build/* output/ - cp -r builder/build/* output/
- rm output/*.tar.gz - rm output/*.tar.gz
default:
tags:
- oci-fixed-amd64
build_www: build_www:
stage: www stage: www
allow_failure: false allow_failure: false
@ -47,6 +52,9 @@ build_www:
- docker run --rm -v $PWD/builder/www:/build kasmweb/www:latest - docker run --rm -v $PWD/builder/www:/build kasmweb/www:latest
- mkdir -p output/www - mkdir -p output/www
- cd builder - cd builder
- echo $PWD
- ls -l
- ls -l ../output
- tar -zcvf ../output/www/kasm_www.tar.gz www - tar -zcvf ../output/www/kasm_www.tar.gz www
only: only:
variables: variables:
@ -76,7 +84,7 @@ build_ubuntu_bionic_arm:
stage: build stage: build
allow_failure: false allow_failure: false
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -112,7 +120,7 @@ build_ubuntu_focal_arm:
stage: build stage: build
allow_failure: true allow_failure: true
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -148,7 +156,7 @@ build_ubuntu_jammy_arm:
stage: build stage: build
allow_failure: true allow_failure: true
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -175,7 +183,7 @@ build_debian_buster:
- bash builder/build-package debian buster; - bash builder/build-package debian buster;
only: only:
variables: variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts: artifacts:
paths: paths:
- output/ - output/
@ -184,7 +192,7 @@ build_debian_buster_arm:
stage: build stage: build
allow_failure: true allow_failure: true
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -194,7 +202,7 @@ build_debian_buster_arm:
- bash builder/build-package debian buster; - bash builder/build-package debian buster;
only: only:
variables: variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts: artifacts:
paths: paths:
- output/ - output/
@ -211,7 +219,7 @@ build_debian_bullseye:
- bash builder/build-package debian bullseye; - bash builder/build-package debian bullseye;
only: only:
variables: variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts: artifacts:
paths: paths:
- output/ - output/
@ -220,7 +228,7 @@ build_debian_bullseye_arm:
stage: build stage: build
allow_failure: true allow_failure: true
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -230,7 +238,7 @@ build_debian_bullseye_arm:
- bash builder/build-package debian bullseye; - bash builder/build-package debian bullseye;
only: only:
variables: variables:
- $CI_COMMIT_MESSAGE =~ /\[full [cC][Ii]\]/ || $BUILD_JOBS =~ $CI_JOB_NAME - $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts: artifacts:
paths: paths:
- output/ - output/
@ -256,7 +264,7 @@ build_kali_rolling_arm:
stage: build stage: build
allow_failure: true allow_failure: true
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -309,7 +317,7 @@ build_oracle_8_arm:
stage: build stage: build
allow_failure: true allow_failure: true
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -324,6 +332,42 @@ build_oracle_8_arm:
paths: paths:
- output/ - output/
build_oracle_9:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 9;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_oracle_9_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm64
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package oracle 9;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_opensuse_15: build_opensuse_15:
stage: build stage: build
allow_failure: true allow_failure: true
@ -345,7 +389,7 @@ build_opensuse_15_arm:
stage: build stage: build
allow_failure: true allow_failure: true
tags: tags:
- arm - oci-fixed-arm64
before_script: before_script:
- *prepare_build - *prepare_build
- *prepare_www - *prepare_www
@ -360,6 +404,78 @@ build_opensuse_15_arm:
paths: paths:
- output/ - output/
build_fedora_thirtyseven:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora thirtyseven;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_fedora_thirtyseven_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm64
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package fedora thirtyseven;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_317:
stage: build
allow_failure: true
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 317;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
build_alpine_317_arm:
stage: build
allow_failure: true
tags:
- oci-fixed-arm64
before_script:
- *prepare_build
- *prepare_www
after_script:
- *prepare_artfacts
script:
- bash builder/build-package alpine 317;
only:
variables:
- $BUILD_JOBS == 'all' || $BUILD_JOBS =~ $CI_JOB_NAME
artifacts:
paths:
- output/
test: test:
stage: test stage: test
before_script: before_script:
@ -386,12 +502,12 @@ upload:
done done
- export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}" - export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}"
- 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 '*.deb' -or -name '*.rpm' -or -name '*.tgz'`; do
prepare_upload_filename "$package"; prepare_upload_filename "$package";
upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename"; upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename";
echo; echo;
echo "File to upload $upload_filename"; echo "File to upload $upload_filename";
upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET"; upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET";
UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm)##'); UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm|tgz)##');
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&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=${UPLOAD_NAME}&target_url=${S3_URL}";
done done

View File

@ -101,6 +101,9 @@ desktop:
height: 768 height: 768
allow_resize: true allow_resize: true
pixel_depth: 24 pixel_depth: 24
gpu:
hw3d: false
drinode: /dev/dri/renderD128
network: network:
protocol: http protocol: http
@ -256,6 +259,7 @@ command_line:
- Cursor lock - Cursor lock
- IME support for languages with extended characters - IME support for languages with extended characters
- Better mobile support - Better mobile support
- DRI3 GPU acceleration with open source drivers (AMDGPU,Intel,ATI,ARM)
Future Goals: Future Goals:

17
builder/build-apk Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -e
. builder/os_ver_cli.sh
cd "$(dirname "$0")/.."
docker build -t kasmvnc_apkbuilder_${os}:${os_codename} -f \
builder/dockerfile.${os}_${os_codename}.apk.build .
source_dir=$(echo $PWD)
L_UID=$(id -u)
L_GID=$(id -g)
docker run --rm -v "$source_dir":/src --user $L_UID:$L_GID \
kasmvnc_apkbuilder_${os}:${os_codename} /bin/bash -c \
'/src/builder/build-apk-inside-docker'

11
builder/build-apk-inside-docker Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
os=alpine
os_codename=$(cat /etc/os-release | awk '/VERSION_ID/' | grep -o '[[:digit:]]' | tr -d '\n' | head -c 3)
mkdir -p /src/builder/build/${os}_${os_codename}
mv \
/src/builder/build/kasmvnc.${os}_${os_codename}.tar.gz \
/src/builder/build/${os}_${os_codename}/kasmvnc.${os}_${os_codename}_$(uname -m).tgz

View File

@ -10,6 +10,8 @@ detect_package_format() {
package_format=rpm package_format=rpm
if ls builder/dockerfile*"$os"* | grep -q .deb.build; then if ls builder/dockerfile*"$os"* | grep -q .deb.build; then
package_format=deb package_format=deb
elif ls builder/dockerfile*"$os"* | grep -q .apk.build; then
package_format=apk
fi fi
} }

View File

@ -8,7 +8,7 @@ prepare_build_env() {
} }
copy_spec_and_tar_with_binaries() { copy_spec_and_tar_with_binaries() {
cp /tmp/kasmvncserver.spec ~/rpmbuild/SPECS/ cp /tmp/*.spec ~/rpmbuild/SPECS/
cp /src/builder/build/kasmvnc.${os}_${os_codename}.tar.gz \ cp /src/builder/build/kasmvnc.${os}_${os_codename}.tar.gz \
~/rpmbuild/SOURCES/ ~/rpmbuild/SOURCES/
} }
@ -30,6 +30,6 @@ fi
os_dir="build/${os}_${os_codename}" os_dir="build/${os}_${os_codename}"
prepare_build_env prepare_build_env
rpmbuild -ba ~/rpmbuild/SPECS/kasmvncserver.spec rpmbuild -ba ~/rpmbuild/SPECS/*.spec
copy_rpm_to_build_dir copy_rpm_to_build_dir
rpmlint "$os_dir"/*.rpm || true rpmlint "$os_dir"/*.rpm || true

View File

@ -40,14 +40,14 @@ EOF
#sudo apt-get install cmake git libjpeg-dev libgnutls-dev #sudo apt-get install cmake git libjpeg-dev libgnutls-dev
# Gcc12 builds fail due to bug # Gcc12 builds fail due to bug
fail_on_gcc_12 #fail_on_gcc_12
# Ubuntu applies a million patches, but here we use upstream to simplify matters # Ubuntu applies a million patches, but here we use upstream to simplify matters
cd /tmp cd /tmp
# default to the version of x in Ubuntu 18.04, otherwise caller will need to specify # default to the version of x in Ubuntu 18.04, otherwise caller will need to specify
XORG_VER=${XORG_VER:-"1.19.6"} XORG_VER=${XORG_VER:-"1.19.6"}
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##') XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##')
wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.bz2 wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.gz
#git clone https://kasmweb@bitbucket.org/kasmtech/kasmvnc.git #git clone https://kasmweb@bitbucket.org/kasmtech/kasmvnc.git
#cd kasmvnc #cd kasmvnc
@ -64,9 +64,10 @@ cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . -DBUILD_VIEWER:BOOL=OFF \
-DENABLE_GNUTLS:BOOL=OFF -DENABLE_GNUTLS:BOOL=OFF
make -j5 make -j5
tar -C unix/xserver -xf /tmp/xorg-server-${XORG_VER}.tar.bz2 --strip-components=1 tar -C unix/xserver -xf /tmp/xorg-server-${XORG_VER}.tar.gz --strip-components=1
cd unix/xserver cd unix/xserver
# Apply patches
patch -Np1 -i ../xserver${XORG_PATCH}.patch patch -Np1 -i ../xserver${XORG_PATCH}.patch
case "$XORG_VER" in case "$XORG_VER" in
1.20.*) 1.20.*)
@ -85,22 +86,42 @@ autoreconf -i
# everything after that is based on BUILDING.txt to remove unneeded # everything after that is based on BUILDING.txt to remove unneeded
# components. # components.
ensure_crashpad_can_fetch_line_number_by_address ensure_crashpad_can_fetch_line_number_by_address
# Centos7 is too old for dri3
if [ ! "${KASMVNC_BUILD_OS}" == "centos" ]; then
CONFIG_OPTIONS="--enable-dri3"
fi
# remove gl check for opensuse # remove gl check for opensuse
if [ "${KASMVNC_BUILD_OS}" == "opensuse" ]; then if [ "${KASMVNC_BUILD_OS}" == "opensuse" ] || ([ "${KASMVNC_BUILD_OS}" == "oracle" ] && [ "${KASMVNC_BUILD_OS_CODENAME}" == 9 ]); then
sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure
fi fi
./configure --prefix=/opt/kasmweb \
--with-xkb-path=/usr/share/X11/xkb \ # build X11
--with-xkb-output=/var/lib/xkb \ ./configure \
--with-xkb-bin-directory=/usr/bin \ --disable-config-hal \
--with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \ --disable-config-udev \
--with-sha1=libcrypto \ --disable-dmx \
--without-dtrace --disable-dri \ --disable-dri \
--disable-dri2 \
--disable-kdrive \
--disable-static \ --disable-static \
--disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \ --disable-xephyr \
--disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \ --disable-xinerama \
--disable-config-hal --disable-config-udev \ --disable-xnest \
--disable-dri2 --enable-glx --disable-xwayland --disable-dri3 --disable-xorg \
--disable-xvfb \
--disable-xwayland \
--disable-xwin \
--enable-glx \
--prefix=/opt/kasmweb \
--with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \
--without-dtrace \
--with-sha1=libcrypto \
--with-xkb-bin-directory=/usr/bin \
--with-xkb-output=/var/lib/xkb \
--with-xkb-path=/usr/share/X11/xkb ${CONFIG_OPTIONS}
# remove array bounds errors for new versions of GCC
find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \;
make -j5 make -j5
# modifications for the servertarball # modifications for the servertarball
@ -118,6 +139,8 @@ if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then
ln -s /usr/lib/x86_64-linux-gnu/dri dri ln -s /usr/lib/x86_64-linux-gnu/dri dri
elif [ -d /usr/lib/aarch64-linux-gnu/dri ]; then elif [ -d /usr/lib/aarch64-linux-gnu/dri ]; then
ln -s /usr/lib/aarch64-linux-gnu/dri dri ln -s /usr/lib/aarch64-linux-gnu/dri dri
elif [ -d /usr/lib/xorg/modules/dri ]; then
ln -s /usr/lib/xorg/modules/dri dri
else else
ln -s /usr/lib64/dri dri ln -s /usr/lib64/dri dri
fi fi

View File

@ -0,0 +1,7 @@
FROM alpine:3.17
RUN apk add shadow bash
RUN useradd -m docker && echo "docker:docker" | chpasswd
USER docker

View File

@ -0,0 +1,76 @@
FROM alpine:3.17
ENV KASMVNC_BUILD_OS alpine
ENV KASMVNC_BUILD_OS_CODENAME 317
ENV XORG_VER 1.20.14
RUN \
echo "**** install build deps ****" && \
apk add \
alpine-release \
alpine-sdk \
autoconf \
automake \
bash \
ca-certificates \
cmake \
coreutils \
curl \
eudev-dev \
font-cursor-misc \
font-misc-misc \
font-util-dev \
git \
grep \
jq \
libdrm-dev \
libepoxy-dev \
libjpeg-turbo-dev \
libjpeg-turbo-static \
libpciaccess-dev \
libtool \
libwebp-dev \
libx11-dev \
libxau-dev \
libxcb-dev \
libxcursor-dev \
libxcvt-dev \
libxdmcp-dev \
libxext-dev \
libxfont2-dev \
libxkbfile-dev \
libxrandr-dev \
libxshmfence-dev \
libxtst-dev \
mesa-dev \
mesa-dri-gallium \
meson \
nettle-dev \
openssl-dev \
pixman-dev \
procps \
shadow \
tar \
tzdata \
wayland-dev \
wayland-protocols \
xcb-util-dev \
xcb-util-image-dev \
xcb-util-keysyms-dev \
xcb-util-renderutil-dev \
xcb-util-wm-dev \
xinit \
xkbcomp \
xkbcomp-dev \
xkeyboard-config \
xorgproto \
xorg-server-common \
xorg-server-dev \
xtrans
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@ -1,4 +1,4 @@
FROM fedora:33 FROM fedora:37
ENV STARTUPDIR=/dockerstartup ENV STARTUPDIR=/dockerstartup

View File

@ -0,0 +1,83 @@
FROM fedora:37
ENV KASMVNC_BUILD_OS fedora
ENV KASMVNC_BUILD_OS_CODENAME thirtyseven
ENV XORG_VER 1.20.14
RUN \
echo "**** install build deps ****" && \
dnf group install -y \
"C Development Tools and Libraries" \
"Development Tools" && \
dnf install -y \
autoconf \
automake \
bison \
byacc \
bzip2 \
cmake \
diffutils \
doxygen \
file \
flex \
fop \
gcc \
gcc-c++ \
git \
glibc-devel \
libdrm-devel \
libepoxy-devel \
libjpeg-turbo-devel \
libjpeg-turbo-static \
libmd-devel \
libpciaccess-devel \
libtool \
libwebp-devel \
libX11-devel \
libXau-devel \
libxcb-devel \
libXcursor-devel \
libxcvt-devel \
libXdmcp-devel \
libXext-devel \
libXfont2-devel \
libxkbfile-devel \
libXrandr-devel \
libxshmfence-devel \
libXtst-devel \
mesa-libEGL-devel \
mesa-libgbm-devel \
mesa-libGL-devel \
meson \
mingw64-binutils \
mt-st \
nettle-devel \
openssl-devel \
patch \
pixman-devel \
wayland-devel \
wget \
which \
xcb-util-devel \
xcb-util-image-devel \
xcb-util-keysyms-devel \
xcb-util-renderutil-devel \
xcb-util-wm-devel \
xinit \
xkbcomp \
xkbcomp-devel \
xkeyboard-config \
xmlto \
xorg-x11-font-utils \
xorg-x11-proto-devel \
xorg-x11-server-common \
xorg-x11-server-devel \
xorg-x11-xtrans-devel \
xsltproc
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@ -1,11 +1,11 @@
FROM fedora:33 FROM fedora:37
RUN dnf install -y fedora-packager fedora-review RUN dnf install -y fedora-packager fedora-review
RUN dnf install -y tree vim less RUN dnf install -y tree vim less
RUN dnf install -y redhat-lsb-core RUN dnf install -y redhat-lsb-core
RUN dnf install -y dnf-plugins-core RUN dnf install -y dnf-plugins-core
COPY centos/*.spec /tmp COPY fedora/*.spec /tmp
RUN dnf builddep -y /tmp/*.spec RUN dnf builddep -y /tmp/*.spec
RUN useradd -m docker && echo "docker:docker" | chpasswd RUN useradd -m docker && echo "docker:docker" | chpasswd

View File

@ -1,4 +1,4 @@
FROM fedora:33 FROM fedora:37
ENV DISPLAY=:1 \ ENV DISPLAY=:1 \
VNC_PORT=8443 \ VNC_PORT=8443 \
@ -47,7 +47,7 @@ COPY builder/startup/ $STARTUPDIR
### START CUSTOM STUFF #### ### START CUSTOM STUFF ####
COPY ./builder/scripts/ /tmp/scripts/ COPY ./builder/scripts/ /tmp/scripts/
COPY ./centos/kasmvncserver.spec /tmp COPY ./fedora/kasmvncserver.spec /tmp
ARG KASMVNC_PACKAGE_DIR ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp/ COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp/

View File

@ -1,36 +0,0 @@
FROM fedora:33
ENV KASMVNC_BUILD_OS fedora
ENV KASMVNC_BUILD_OS_CODENAME thirtythree
ENV XORG_VER 1.20.10
# RUN dnf install -y build-dep xorg-server libxfont-dev sudo
RUN dnf install -y gcc cmake git gnutls-devel vim wget
#tightvncserver
RUN dnf install -y libpng-devel libtiff-devel giflib-devel openssl-devel
#libavcodec-dev
RUN dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
RUN dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
RUN dnf -y install ffmpeg-devel
RUN dnf install -y make
RUN dnf group install -y "Development Tools"
RUN dnf install -y xorg-x11-server-devel zlib-devel
RUN dnf install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \
xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel libXtst-devel \
libXcursor-devel
RUN dnf install -y mesa-dri-drivers
RUN dnf install -y bzip2 redhat-lsb-core
ENV SCRIPTS_DIR=/tmp/scripts
COPY builder/scripts $SCRIPTS_DIR
RUN $SCRIPTS_DIR/build-webp
RUN $SCRIPTS_DIR/build-libjpeg-turbo
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@ -19,6 +19,7 @@ RUN zypper install -ny \
gzip \ gzip \
lbzip2 \ lbzip2 \
libbz2-devel \ libbz2-devel \
libgbm-devel \
libGLw-devel \ libGLw-devel \
libgnutls-devel \ libgnutls-devel \
libopenssl-devel \ libopenssl-devel \
@ -26,6 +27,7 @@ RUN zypper install -ny \
libtiff-devel \ libtiff-devel \
libXfont2-devel \ libXfont2-devel \
libxkbcommon-x11-devel \ libxkbcommon-x11-devel \
libxshmfence-devel \
make \ make \
Mesa-dri \ Mesa-dri \
Mesa-libglapi-devel \ Mesa-libglapi-devel \

View File

@ -5,7 +5,10 @@ ENV KASMVNC_BUILD_OS_CODENAME 8
ENV XORG_VER 1.20.10 ENV XORG_VER 1.20.10
# Install from stock repos # Install from stock repos
RUN dnf install -y \ RUN \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled ol8_codeready_builder && \
dnf install -y \
bzip2-devel \ bzip2-devel \
ca-certificates \ ca-certificates \
cmake \ cmake \
@ -14,11 +17,13 @@ RUN dnf install -y \
gcc-c++ \ gcc-c++ \
git \ git \
gnutls-devel \ gnutls-devel \
libjpeg-turbo-devel \
libpng-devel \ libpng-devel \
libtiff-devel \ libtiff-devel \
libxshmfence-devel \
make \ make \
mesa-dri-drivers \ mesa-dri-drivers \
openssl-devel \ mesa-libgbm-devel \
openssl-devel \ openssl-devel \
patch \ patch \
tigervnc-server \ tigervnc-server \

View File

@ -13,7 +13,7 @@ RUN dnf install -y \
tree \ tree \
vim vim
COPY oracle/*.spec /tmp COPY oracle/kasmvncserver.spec /tmp
RUN dnf builddep -y /tmp/*.spec RUN dnf builddep -y /tmp/*.spec
RUN useradd -m docker && echo "docker:docker" | chpasswd RUN useradd -m docker && echo "docker:docker" | chpasswd

View File

@ -0,0 +1,23 @@
FROM oraclelinux:9
ENV STARTUPDIR=/dockerstartup
RUN dnf install -y \
less \
redhat-lsb-core \
vim \
xterm
RUN dnf config-manager --set-enabled ol9_codeready_builder
RUN dnf install -y oracle-epel-release-el9
ARG KASMVNC_PACKAGE_DIR
COPY $KASMVNC_PACKAGE_DIR/*.rpm /tmp
RUN dnf localinstall -y /tmp/*.rpm
RUN mkdir -p $STARTUPDIR
COPY startup/vnc_startup_barebones.sh $STARTUPDIR
RUN useradd -m foo
USER foo:kasmvnc-cert
ENTRYPOINT "/$STARTUPDIR/vnc_startup_barebones.sh"

View File

@ -0,0 +1,64 @@
FROM oraclelinux:9
ENV KASMVNC_BUILD_OS oracle
ENV KASMVNC_BUILD_OS_CODENAME 9
ENV XORG_VER 1.20.10
# Install from stock repos
RUN \
dnf config-manager --set-enabled ol9_codeready_builder && \
dnf config-manager --set-enabled ol9_distro_builder && \
dnf install -y \
bzip2-devel \
ca-certificates \
cmake \
dnf-plugins-core \
gcc \
gcc-c++ \
git \
gnutls-devel \
libjpeg-turbo-devel \
libpng-devel \
libtiff-devel \
libxshmfence-devel \
make \
mesa-dri-drivers \
mesa-libGL-devel \
mesa-libgbm-devel \
openssl-devel \
openssl-devel \
patch \
tigervnc-server \
wget \
xorg-x11-font-utils \
zlib-devel
# Enable additional repos (epel, powertools, and fusion)
RUN dnf install -y oracle-epel-release-el9
RUN dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm
# Install from new repos
RUN dnf install -y \
giflib-devel \
lbzip2 \
libXfont2-devel \
libxkbfile-devel \
xorg-x11-server-devel \
xorg-x11-xtrans-devel \
libXrandr-devel \
libXtst-devel \
libXcursor-devel
# 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 -xzf /tmp/libwebp-*
RUN cd /tmp/libwebp-1.0.2 && \
./configure --enable-static --disable-shared && \
make && make install
RUN useradd -m docker && echo "docker:docker" | chpasswd
COPY --chown=docker:docker . /src/
USER docker
ENTRYPOINT ["/src/builder/build.sh"]

View File

@ -0,0 +1,23 @@
FROM oraclelinux:9
ENV KASMVNC_BUILD_OS oracle
ENV KASMVNC_BUILD_OS_CODENAME 9
RUN dnf config-manager --set-enabled ol9_codeready_builder
RUN dnf config-manager --set-enabled ol9_distro_builder
RUN dnf install -y \
gpg* \
less \
redhat-lsb-core \
rng-tools \
rpm* \
rpmlint \
rsync \
tree \
vim
COPY oracle/kasmvncserver9.spec /tmp
RUN useradd -m docker && echo "docker:docker" | chpasswd
USER docker

View File

@ -66,6 +66,7 @@ namespace network {
void netResetFrameStatsCall(); void netResetFrameStatsCall();
uint8_t netServerFrameStatsReady(); uint8_t netServerFrameStatsReady();
void netUdpUpgrade(void *client, uint32_t ip); void netUdpUpgrade(void *client, uint32_t ip);
void netClearClipboard();
enum USER_ACTION { enum USER_ACTION {
NONE, NONE,
@ -73,7 +74,8 @@ namespace network {
WANT_FRAME_STATS_ALL, WANT_FRAME_STATS_ALL,
WANT_FRAME_STATS_OWNER, WANT_FRAME_STATS_OWNER,
WANT_FRAME_STATS_SPECIFIC, WANT_FRAME_STATS_SPECIFIC,
UDP_UPGRADE UDP_UPGRADE,
CLEAR_CLIPBOARD,
}; };
uint8_t netRequestFrameStats(USER_ACTION what, const char *client); uint8_t netRequestFrameStats(USER_ACTION what, const char *client);

View File

@ -806,3 +806,16 @@ void GetAPIMessager::netUdpUpgrade(void *client, uint32_t ip) {
pthread_mutex_unlock(&userMutex); pthread_mutex_unlock(&userMutex);
} }
void GetAPIMessager::netClearClipboard() {
action_data act;
act.action = CLEAR_CLIPBOARD;
// Send it in
if (pthread_mutex_lock(&userMutex))
return;
actionQueue.push_back(act);
pthread_mutex_unlock(&userMutex);
}

View File

@ -545,6 +545,12 @@ static uint8_t serverFrameStatsReadyCb(void *messager)
return msgr->netServerFrameStatsReady(); return msgr->netServerFrameStatsReady();
} }
static void clearClipboardCb(void *messager)
{
GetAPIMessager *msgr = (GetAPIMessager *) messager;
msgr->netClearClipboard();
}
#if OPENSSL_VERSION_NUMBER < 0x1010000f #if OPENSSL_VERSION_NUMBER < 0x1010000f
static pthread_mutex_t *sslmutex; static pthread_mutex_t *sslmutex;
@ -693,6 +699,8 @@ WebsocketListener::WebsocketListener(const struct sockaddr *listenaddr,
settings.getClientFrameStatsNumCb = getClientFrameStatsNumCb; settings.getClientFrameStatsNumCb = getClientFrameStatsNumCb;
settings.serverFrameStatsReadyCb = serverFrameStatsReadyCb; settings.serverFrameStatsReadyCb = serverFrameStatsReadyCb;
settings.clearClipboardCb = clearClipboardCb;
openssl_threads(); openssl_threads();
pthread_t tid; pthread_t tid;

View File

@ -1596,6 +1596,22 @@ static uint8_t ownerapi(ws_ctx_t *ws_ctx, const char *in, const char * const use
ws_send(ws_ctx, buf, strlen(buf)); ws_send(ws_ctx, buf, strlen(buf));
weblog(200, wsthread_handler_id, 0, origip, ip, user, 1, origpath, strlen(buf)); weblog(200, wsthread_handler_id, 0, origip, ip, user, 1, origpath, strlen(buf));
ret = 1;
} else entry("/api/clear_clipboard") {
settings.clearClipboardCb(settings.messager);
write(wakeuppipe[1], "", 1);
sprintf(buf, "HTTP/1.1 200 OK\r\n"
"Server: KasmVNC/4.0\r\n"
"Connection: close\r\n"
"Content-type: text/plain\r\n"
"Content-length: 6\r\n"
"%s"
"\r\n"
"200 OK", extra_headers ? extra_headers : "");
ws_send(ws_ctx, buf, strlen(buf));
weblog(200, wsthread_handler_id, 0, origip, ip, user, 1, origpath, strlen(buf));
ret = 1; ret = 1;
} }

View File

@ -105,6 +105,8 @@ typedef struct {
void (*getUsersCb)(void *messager, const char **buf); void (*getUsersCb)(void *messager, const char **buf);
uint8_t (*getClientFrameStatsNumCb)(void *messager); uint8_t (*getClientFrameStatsNumCb)(void *messager);
uint8_t (*serverFrameStatsReadyCb)(void *messager); uint8_t (*serverFrameStatsReadyCb)(void *messager);
void (*clearClipboardCb)(void *messager);
} settings_t; } settings_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -86,6 +86,8 @@ namespace rfb {
virtual void handleClipboardAnnounceBinary(const unsigned __unused_attr num, virtual void handleClipboardAnnounceBinary(const unsigned __unused_attr num,
const char __unused_attr mimes[][32]) {} const char __unused_attr mimes[][32]) {}
virtual void clearLocalClipboards() {}
protected: protected:
virtual ~SDesktop() {} virtual ~SDesktop() {}
}; };

View File

@ -64,7 +64,7 @@ VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s,
needsPermCheck(false), pointerEventTime(0), needsPermCheck(false), pointerEventTime(0),
clientHasCursor(false), clientHasCursor(false),
accessRights(AccessDefault), startTime(time(0)), frameTracking(false), accessRights(AccessDefault), startTime(time(0)), frameTracking(false),
udpFramesSinceFull(0) udpFramesSinceFull(0), complainedAboutNoViewRights(false)
{ {
setStreams(&sock->inStream(), &sock->outStream()); setStreams(&sock->inStream(), &sock->outStream());
peerEndpoint.buf = sock->getPeerEndpoint(); peerEndpoint.buf = sock->getPeerEndpoint();
@ -1308,8 +1308,14 @@ void VNCSConnectionST::writeFramebufferUpdate()
} }
} }
if (!(accessRights & AccessView)) if (!(accessRights & AccessView)) {
if (!complainedAboutNoViewRights) {
complainedAboutNoViewRights = true;
vlog.error("User %s has no read permissions. If this is not intended, grant them permissions with kasmvncpasswd or via the API",
user);
}
return; return;
}
// Updates often consists of many small writes, and in continuous // Updates often consists of many small writes, and in continuous
// mode, we will also have small fence messages around the update. We // mode, we will also have small fence messages around the update. We

View File

@ -324,6 +324,7 @@ namespace rfb {
bool frameTracking; bool frameTracking;
uint32_t udpFramesSinceFull; uint32_t udpFramesSinceFull;
bool complainedAboutNoViewRights;
}; };
} }
#endif #endif

View File

@ -832,9 +832,8 @@ static void upgradeClientToUdp(const network::GetAPIMessager::action_data &act,
} }
} }
static void checkAPIMessages(network::GetAPIMessager *apimessager, void VNCServerST::checkAPIMessages(network::GetAPIMessager *apimessager,
rdr::U8 &trackingFrameStats, char trackingClient[], rdr::U8 &trackingFrameStats, char trackingClient[])
std::list<VNCSConnectionST*> &clients)
{ {
if (pthread_mutex_lock(&apimessager->userMutex)) if (pthread_mutex_lock(&apimessager->userMutex))
return; return;
@ -866,6 +865,15 @@ static void checkAPIMessages(network::GetAPIMessager *apimessager,
case network::GetAPIMessager::UDP_UPGRADE: case network::GetAPIMessager::UDP_UPGRADE:
upgradeClientToUdp(act, clients); upgradeClientToUdp(act, clients);
break; break;
case network::GetAPIMessager::CLEAR_CLIPBOARD:
clearBinaryClipboardData();
clipboardClient = NULL;
desktop->handleClipboardAnnounceBinary(0, NULL);
sendBinaryClipboardData("text/plain", NULL, 0);
desktop->clearLocalClipboards();
break;
} }
} }
@ -1031,7 +1039,7 @@ void VNCServerST::writeUpdate()
shottime = msSince(&shotstart); shottime = msSince(&shotstart);
trackingFrameStats = 0; trackingFrameStats = 0;
checkAPIMessages(apimessager, trackingFrameStats, trackingClient, clients); checkAPIMessages(apimessager, trackingFrameStats, trackingClient);
} }
const rdr::U8 origtrackingFrameStats = trackingFrameStats; const rdr::U8 origtrackingFrameStats = trackingFrameStats;

View File

@ -284,6 +284,9 @@ namespace rfb {
void translateDLPRegion(rdr::U16 &x1, rdr::U16 &y1, rdr::U16 &x2, rdr::U16 &y2) const; void translateDLPRegion(rdr::U16 &x1, rdr::U16 &y1, rdr::U16 &x2, rdr::U16 &y2) const;
rdr::U32 clipboardId; rdr::U32 clipboardId;
void checkAPIMessages(network::GetAPIMessager *apimessager,
rdr::U8 &trackingFrameStats, char trackingClient[]);
}; };
}; };

6
debian/control vendored
View File

@ -2,8 +2,8 @@ Source: kasmvnc
Section: x11 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, libpng-dev, Build-Depends: debhelper (>= 11), rsync, libjpeg-dev, libjpeg-dev, libpng-dev,
libtiff-dev, libgif-dev, libavcodec-dev, libssl-dev, libgl1, libxfont2, libsm6, libxext-dev, libxrandr-dev, libxtst-dev, libxcursor-dev, libunwind8 libtiff-dev, libgif-dev, libavcodec-dev, libssl-dev, libgl1, libxfont2, libsm6, libxext-dev, libxrandr-dev, libxtst-dev, libxcursor-dev, libunwind8, libgbm-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
@ -14,7 +14,7 @@ Architecture: amd64 arm64
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, ssl-cert, xauth, Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, ssl-cert, xauth,
x11-xkb-utils, xkb-data, procps, libswitch-perl, libyaml-tiny-perl, x11-xkb-utils, xkb-data, procps, libswitch-perl, libyaml-tiny-perl,
libhash-merge-simple-perl, libscalar-list-utils-perl, liblist-moreutils-perl, libhash-merge-simple-perl, libscalar-list-utils-perl, liblist-moreutils-perl,
libtry-tiny-perl libtry-tiny-perl, libgbm1
Provides: vnc-server Provides: vnc-server
Description: KasmVNC provides remote web-based access to a Desktop or application. Description: KasmVNC provides remote web-based access to a Desktop or application.
While VNC is in the name, KasmVNC differs from other VNC variants such While VNC is in the name, KasmVNC differs from other VNC variants such

124
fedora/kasmvncserver.spec Normal file
View File

@ -0,0 +1,124 @@
Name: kasmvncserver
Version: 1.0.0
Release: 1%{?dist}
Summary: VNC server accessible from a web browser
License: GPLv2+
URL: https://github.com/kasmtech/KasmVNC
BuildRequires: rsync
Requires: xorg-x11-xauth, xkeyboard-config, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, mesa-libgbm, libxshmfence
Conflicts: tigervnc-server, tigervnc-server-minimal
%description
KasmVNC provides remote web-based access to a Desktop or application.
While VNC is in the name, KasmVNC differs from other VNC variants such
as TigerVNC, RealVNC, and TurboVNC. KasmVNC has broken from the RFB
specification which defines VNC, in order to support modern technologies
and increase security. KasmVNC is accessed by users from any modern
browser and does not support legacy VNC viewer applications. KasmVNC
uses a modern YAML based configuration at the server and user level,
allowing for ease of management. KasmVNC is maintained by Kasm
Technologies Corp, www.kasmweb.com.
WARNING: this package requires EPEL.
%prep
%install
rm -rf $RPM_BUILD_ROOT
TARGET_OS=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
TARGET_OS_CODENAME=$(lsb_release -cs | tr '[:upper:]' '[:lower:]')
TARBALL=$RPM_SOURCE_DIR/kasmvnc.${TARGET_OS}_${TARGET_OS_CODENAME}.tar.gz
TAR_DATA=$(mktemp -d)
tar -xzf "$TARBALL" -C "$TAR_DATA"
SRC=$TAR_DATA/usr/local
SRC_BIN=$SRC/bin
DESTDIR=$RPM_BUILD_ROOT
DST_MAN=$DESTDIR/usr/share/man/man1
mkdir -p $DESTDIR/usr/bin $DESTDIR/usr/share/man/man1 \
$DESTDIR/usr/share/doc/kasmvncserver $DESTDIR/usr/lib \
$DESTDIR/usr/share/perl5 $DESTDIR/etc/kasmvnc
cp $SRC_BIN/Xvnc $DESTDIR/usr/bin;
cp $SRC_BIN/vncserver $DESTDIR/usr/bin;
cp -a $SRC_BIN/KasmVNC $DESTDIR/usr/share/perl5/
cp $SRC_BIN/vncconfig $DESTDIR/usr/bin;
cp $SRC_BIN/kasmvncpasswd $DESTDIR/usr/bin;
cp $SRC_BIN/kasmxproxy $DESTDIR/usr/bin;
cp -r $SRC/lib/kasmvnc/ $DESTDIR/usr/lib/kasmvncserver
cd $DESTDIR/usr/bin && ln -s kasmvncpasswd vncpasswd;
cp -r $SRC/share/doc/kasmvnc*/* $DESTDIR/usr/share/doc/kasmvncserver/
rsync -r --exclude '.git*' --exclude po2js --exclude xgettext-html \
--exclude www/utils/ --exclude .eslintrc --exclude configure \
$SRC/share/kasmvnc $DESTDIR/usr/share
sed -i -e 's!pem_certificate: .\+$!pem_certificate: /etc/pki/tls/private/kasmvnc.pem!' \
$DESTDIR/usr/share/kasmvnc/kasmvnc_defaults.yaml
sed -i -e 's!pem_key: .\+$!pem_key: /etc/pki/tls/private/kasmvnc.pem!' \
$DESTDIR/usr/share/kasmvnc/kasmvnc_defaults.yaml
sed -e 's/^\([^#]\)/# \1/' $DESTDIR/usr/share/kasmvnc/kasmvnc_defaults.yaml > \
$DESTDIR/etc/kasmvnc/kasmvnc.yaml
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/vncconfig.1 $DST_MAN;
cp $SRC/share/man/man1/vncpasswd.1 $DST_MAN;
cp $SRC/share/man/man1/kasmxproxy.1 $DST_MAN;
cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
%files
%config(noreplace) /etc/kasmvnc
/usr/bin/*
/usr/lib/kasmvncserver
/usr/share/man/man1/*
/usr/share/perl5/KasmVNC
/usr/share/kasmvnc
%license /usr/share/doc/kasmvncserver/LICENSE.TXT
%doc /usr/share/doc/kasmvncserver/README.md
%changelog
* Tue Nov 29 2022 KasmTech <info@kasmweb.com> - 1.0.0-1
- WebRTC UDP transit support with support of STUN servers
- Lossless compression using multi-threaded WASM QOI decoder client side
- New yaml based configuration
- Significantly improved FPS through both client-side and server-side improvements.
- Support for the admin to define arbitrary http response headers for the built in web server
- Support for additional mouse buttons
- Refinement of vncserver checks and user prompts
- Added send_full_frame to developer API, forces full frame to be sent to all connected users that have at least read permission.
* Tue Mar 22 2022 KasmTech <info@kasmweb.com> - 0.9.3~beta-1
* Fri Feb 12 2021 KasmTech <info@kasmweb.com> - 0.9.1~beta-1
- Initial release of the rpm package.
%post
kasmvnc_group="kasmvnc-cert"
create_kasmvnc_group() {
if ! getent group "$kasmvnc_group" >/dev/null; then
groupadd --system "$kasmvnc_group"
fi
}
make_self_signed_certificate() {
local cert_file=/etc/pki/tls/private/kasmvnc.pem
[ -f "$cert_file" ] && return 0
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
-keyout "$cert_file" \
-out "$cert_file" -subj \
"/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none"
chgrp "$kasmvnc_group" "$cert_file"
chmod 640 "$cert_file"
}
create_kasmvnc_group
make_self_signed_certificate
%postun
rm -f /etc/pki/tls/private/kasmvnc.pem

@ -1 +1 @@
Subproject commit f223cfcafee67c0544c7f7d887c787422299c285 Subproject commit 31b1a93335c1cb4947d4eac06dd1311bb18f5022

View File

@ -7,7 +7,7 @@ License: GPLv2+
URL: https://github.com/kasmtech/KasmVNC URL: https://github.com/kasmtech/KasmVNC
BuildRequires: rsync BuildRequires: rsync
Requires: xauth, hostname, libxkbcommon-x11-0, xkeyboard-config, x11-tools, openssl, perl, libpixman-1-0, libgomp1, libXfont2-2, libXdmcp6, libglvnd, xkbcomp, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny Requires: xauth, hostname, libxkbcommon-x11-0, xkeyboard-config, x11-tools, openssl, perl, libpixman-1-0, libjpeg8, libgomp1, libXfont2-2, libXdmcp6, libglvnd, xkbcomp, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, libgbm1, libxshmfence1
Conflicts: tigervnc, tigervnc-x11vnc Conflicts: tigervnc, tigervnc-x11vnc
%description %description

View File

@ -7,7 +7,7 @@ License: GPLv2+
URL: https://github.com/kasmtech/KasmVNC URL: https://github.com/kasmtech/KasmVNC
BuildRequires: rsync BuildRequires: rsync
Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, hostname Requires: xorg-x11-xauth, xorg-x11-xkb-utils, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, hostname, mesa-libgbm, libxshmfence
Conflicts: tigervnc-server, tigervnc-server-minimal Conflicts: tigervnc-server, tigervnc-server-minimal
%description %description

123
oracle/kasmvncserver9.spec Normal file
View File

@ -0,0 +1,123 @@
Name: kasmvncserver
Version: 1.0.0
Release: 1%{?dist}
Summary: VNC server accessible from a web browser
License: GPLv2+
URL: https://github.com/kasmtech/KasmVNC
BuildRequires: rsync
Requires: xorg-x11-xauth, xkeyboard-config, xorg-x11-server-utils, openssl, perl, perl-Switch, perl-YAML-Tiny, perl-Hash-Merge-Simple, perl-Scalar-List-Utils, perl-List-MoreUtils, perl-Try-Tiny, hostname, mesa-libgbm, libxshmfence
Conflicts: tigervnc-server, tigervnc-server-minimal
%description
KasmVNC provides remote web-based access to a Desktop or application.
While VNC is in the name, KasmVNC differs from other VNC variants such
as TigerVNC, RealVNC, and TurboVNC. KasmVNC has broken from the RFB
specification which defines VNC, in order to support modern technologies
and increase security. KasmVNC is accessed by users from any modern
browser and does not support legacy VNC viewer applications. KasmVNC
uses a modern YAML based configuration at the server and user level,
allowing for ease of management. KasmVNC is maintained by Kasm
Technologies Corp, www.kasmweb.com.
WARNING: this package requires EPEL and CodeReady builder.
%prep
%install
rm -rf $RPM_BUILD_ROOT
TARGET_OS=$KASMVNC_BUILD_OS
TARGET_OS_CODENAME=$KASMVNC_BUILD_OS_CODENAME
TARBALL=$RPM_SOURCE_DIR/kasmvnc.${TARGET_OS}_${TARGET_OS_CODENAME}.tar.gz
TAR_DATA=$(mktemp -d)
tar -xzf "$TARBALL" -C "$TAR_DATA"
SRC=$TAR_DATA/usr/local
SRC_BIN=$SRC/bin
DESTDIR=$RPM_BUILD_ROOT
DST_MAN=$DESTDIR/usr/share/man/man1
mkdir -p $DESTDIR/usr/bin $DESTDIR/usr/share/man/man1 \
$DESTDIR/usr/share/doc/kasmvncserver $DESTDIR/usr/lib \
$DESTDIR/usr/share/perl5 $DESTDIR/etc/kasmvnc
cp $SRC_BIN/Xvnc $DESTDIR/usr/bin;
cp $SRC_BIN/vncserver $DESTDIR/usr/bin;
cp -a $SRC_BIN/KasmVNC $DESTDIR/usr/share/perl5
cp $SRC_BIN/vncconfig $DESTDIR/usr/bin;
cp $SRC_BIN/kasmvncpasswd $DESTDIR/usr/bin;
cp $SRC_BIN/kasmxproxy $DESTDIR/usr/bin;
cp -r $SRC/lib/kasmvnc/ $DESTDIR/usr/lib/kasmvncserver
cd $DESTDIR/usr/bin && ln -s kasmvncpasswd vncpasswd;
cp -r $SRC/share/doc/kasmvnc*/* $DESTDIR/usr/share/doc/kasmvncserver/
rsync -r --exclude '.git*' --exclude po2js --exclude xgettext-html \
--exclude www/utils/ --exclude .eslintrc --exclude configure \
$SRC/share/kasmvnc $DESTDIR/usr/share
sed -i -e 's!pem_certificate: .\+$!pem_certificate: /etc/pki/tls/private/kasmvnc.pem!' \
$DESTDIR/usr/share/kasmvnc/kasmvnc_defaults.yaml
sed -i -e 's!pem_key: .\+$!pem_key: /etc/pki/tls/private/kasmvnc.pem!' \
$DESTDIR/usr/share/kasmvnc/kasmvnc_defaults.yaml
sed -e 's/^\([^#]\)/# \1/' $DESTDIR/usr/share/kasmvnc/kasmvnc_defaults.yaml > \
$DESTDIR/etc/kasmvnc/kasmvnc.yaml
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/vncconfig.1 $DST_MAN;
cp $SRC/share/man/man1/vncpasswd.1 $DST_MAN;
cp $SRC/share/man/man1/kasmxproxy.1 $DST_MAN;
cd $DST_MAN && ln -s vncpasswd.1 kasmvncpasswd.1;
%files
%config(noreplace) /etc/kasmvnc
/usr/bin/*
/usr/lib/kasmvncserver
/usr/share/man/man1/*
/usr/share/perl5/KasmVNC
/usr/share/kasmvnc
%license /usr/share/doc/kasmvncserver/LICENSE.TXT
%doc /usr/share/doc/kasmvncserver/README.md
%changelog
* Tue Nov 29 2022 KasmTech <info@kasmweb.com> - 1.0.0-1
- WebRTC UDP transit support with support of STUN servers
- Lossless compression using multi-threaded WASM QOI decoder client side
- New yaml based configuration
- Significantly improved FPS through both client-side and server-side improvements.
- Support for the admin to define arbitrary http response headers for the built in web server
- Support for additional mouse buttons
- Refinement of vncserver checks and user prompts
- Added send_full_frame to developer API, forces full frame to be sent to all connected users that have at least read permission.
* Tue Mar 22 2022 KasmTech <info@kasmweb.com> - 0.9.3~beta-1
* Fri Feb 12 2021 KasmTech <info@kasmweb.com> - 0.9.1~beta-1
- Initial release of the rpm package.
%post
kasmvnc_group="kasmvnc-cert"
create_kasmvnc_group() {
if ! getent group "$kasmvnc_group" >/dev/null; then
groupadd --system "$kasmvnc_group"
fi
}
make_self_signed_certificate() {
local cert_file=/etc/pki/tls/private/kasmvnc.pem
[ -f "$cert_file" ] && return 0
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
-keyout "$cert_file" \
-out "$cert_file" -subj \
"/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none"
chgrp "$kasmvnc_group" "$cert_file"
chmod 640 "$cert_file"
}
create_kasmvnc_group
make_self_signed_certificate
%postun
rm -f /etc/pki/tls/private/kasmvnc.pem

View File

@ -4,6 +4,9 @@ desktop:
height: 768 height: 768
allow_resize: true allow_resize: true
pixel_depth: 24 pixel_depth: 24
gpu:
hw3d: false
drinode: /dev/dri/renderD128
network: network:
protocol: http protocol: http

View File

@ -5,6 +5,9 @@ desktop:
height: 768 height: 768
allow_resize: true allow_resize: true
pixel_depth: 24 pixel_depth: 24
gpu:
hw3d: false
drinode: /dev/dri/renderD128
network: network:
protocol: http protocol: http

View File

@ -2243,6 +2243,39 @@ sub DefineConfigToCLIConversion {
isPresent($value) && $value ne 'auto'; isPresent($value) && $value ne 'auto';
} }
}), }),
KasmVNC::CliOption->new({
name => 'hw3d',
configKeys => [
KasmVNC::ConfigKey->new({
name => "desktop.gpu.hw3d",
type => KasmVNC::ConfigKey::BOOLEAN
})
],
toStringSub => sub {
$self = shift;
my $value = $self->configValue();
switch($value) {
case 'true' {
$valuesStr = '-hw3d ';
}
case 'false' {
$valuesStr = ' ';
}
}
return $valuesStr;
}
}),
KasmVNC::CliOption->new({
name => 'drinode',
configKeys => [
KasmVNC::ConfigKey->new({
name => "desktop.gpu.drinode",
type => KasmVNC::ConfigKey::ANY
})
]
}),
); );
%cliArgMap = map { ("-" . $_->{name}) => $_ } @xvncOptions; %cliArgMap = map { ("-" . $_->{name}) => $_ } @xvncOptions;

4
unix/xserver/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/*
!/hw
/hw/*
!/hw/vnc

View File

@ -30,10 +30,14 @@ bin_PROGRAMS = Xvnc
man1_MANS = Xvnc.man man1_MANS = Xvnc.man
Xvnc_SOURCES = xvnc.c \ Xvnc_SOURCES = xvnc.c dri3.c \
$(top_srcdir)/Xi/stubs.c $(top_srcdir)/mi/miinitext.c \ $(top_srcdir)/Xi/stubs.c $(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/fb/fbcmap_mi.c buildtime.c $(top_srcdir)/fb/fbcmap_mi.c buildtime.c
if DRI3
XVNC_SYS_LIBS += -lgbm
endif
# Xvnc contains no C++ sources so automake doesn't understand that we # Xvnc contains no C++ sources so automake doesn't understand that we
# need to use the C++ compiler to link things. This is the upstream # need to use the C++ compiler to link things. This is the upstream
# recommendation for coaxing automake. # recommendation for coaxing automake.
@ -44,7 +48,8 @@ Xvnc_CPPFLAGS = $(XVNC_CPPFLAGS) -DKASMVNC -DNO_MODULE_EXTS \
-DXVNCEXTRAVERSION="\".$(KASMVNC_COMMIT_ID)\"" \ -DXVNCEXTRAVERSION="\".$(KASMVNC_COMMIT_ID)\"" \
-DXFree86Server -DVENDOR_RELEASE="$(VENDOR_RELEASE)" \ -DXFree86Server -DVENDOR_RELEASE="$(VENDOR_RELEASE)" \
-DVENDOR_STRING="\"$(VENDOR_STRING)\"" -I$(KASMVNC_SRCDIR)/common -I$(KASMVNC_SRCDIR)/unix/common \ -DVENDOR_STRING="\"$(VENDOR_STRING)\"" -I$(KASMVNC_SRCDIR)/common -I$(KASMVNC_SRCDIR)/unix/common \
-I$(top_srcdir)/include ${XSERVERLIBS_CFLAGS} -I$(includedir) -I$(top_srcdir)/include ${XSERVERLIBS_CFLAGS} -I$(includedir) \
-I$(top_srcdir)/dri3 @LIBDRM_CFLAGS@
Xvnc_LDADD = $(XVNC_LIBS) libvnccommon.la $(COMMON_LIBS) \ Xvnc_LDADD = $(XVNC_LIBS) libvnccommon.la $(COMMON_LIBS) \
$(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XVNC_SYS_LIBS) -lX11 -lwebp -lssl -lcrypto -lcrypt $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XVNC_SYS_LIBS) -lX11 -lwebp -lssl -lcrypto -lcrypt

View File

@ -182,6 +182,11 @@ XserverDesktop::queryConnection(network::Socket* sock,
return rfb::VNCServerST::PENDING; return rfb::VNCServerST::PENDING;
} }
void XserverDesktop::clearLocalClipboards()
{
vncClearLocalClipboards();
}
void XserverDesktop::announceClipboard(bool available) void XserverDesktop::announceClipboard(bool available)
{ {
try { try {

View File

@ -61,6 +61,7 @@ public:
void setFramebuffer(int w, int h, void* fbptr, int stride); void setFramebuffer(int w, int h, void* fbptr, int stride);
void refreshScreenLayout(); void refreshScreenLayout();
void requestClipboard(); void requestClipboard();
void clearLocalClipboards();
void announceClipboard(bool available); void announceClipboard(bool available);
void clearBinaryClipboardData(); void clearBinaryClipboardData();
void sendBinaryClipboardData(const char* mime, const unsigned char *data, void sendBinaryClipboardData(const char* mime, const unsigned char *data,

View File

@ -281,6 +281,15 @@ be either \fB0\fP (off), \fB1\fP (always) or \fB2\fP (auto). Default is
\fB2\fP. \fB2\fP.
. .
.TP .TP
.B \-hw3d
Enable hardware 3d acceleration. Default is software (llvmpipe usually).
.
.TP
.B \-drinode \fIpath\fP
Use another path instead of /dev/dri/renderD128. You may need this if you have
more than one GPU.
.
.TP
.B \-ZlibLevel \fIlevel\fP .B \-ZlibLevel \fIlevel\fP
Zlib compression level for ZRLE encoding (it does not affect Tight encoding). Zlib compression level for ZRLE encoding (it does not affect Tight encoding).
Acceptable values are between 0 and 9. Default is to use the standard Acceptable values are between 0 and 9. Default is to use the standard

284
unix/xserver/hw/vnc/dri3.c Normal file
View File

@ -0,0 +1,284 @@
/* Copyright (c) 2023 Kasm
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef DRI3
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <dri3.h>
#include <drm_fourcc.h>
#include <fb.h>
#include <gcstruct.h>
#include <gbm.h>
extern const char *driNode;
static struct priv_t {
struct gbm_device *gbm;
int fd;
} priv;
struct gbm_pixmap {
struct gbm_bo *bo;
};
typedef struct gbm_pixmap gbm_pixmap;
static DevPrivateKeyRec dri3_pixmap_private_key;
static struct timeval start;
static int
xvnc_dri3_open_client(ClientPtr client,
ScreenPtr screen,
RRProviderPtr provider,
int *pfd)
{
int fd = open(driNode, O_RDWR | O_CLOEXEC);
if (fd < 0)
return BadAlloc;
*pfd = fd;
return Success;
}
static uint32_t
gbm_format_for_depth(CARD8 depth)
{
switch (depth) {
case 16:
return GBM_FORMAT_RGB565;
case 24:
return GBM_FORMAT_XRGB8888;
case 30:
return GBM_FORMAT_ARGB2101010;
default:
ErrorF("unexpected depth: %d\n", depth);
/* fallthrough */
case 32:
return GBM_FORMAT_ARGB8888;
}
}
static void dri3_pixmap_set_private(PixmapPtr pixmap, gbm_pixmap *gp)
{
dixSetPrivate(&pixmap->devPrivates, &dri3_pixmap_private_key, gp);
}
static gbm_pixmap *gbm_pixmap_get(PixmapPtr pixmap)
{
return dixLookupPrivate(&pixmap->devPrivates, &dri3_pixmap_private_key);
}
static PixmapPtr
create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, CARD8 depth)
{
PixmapPtr pixmap;
gbm_pixmap *gp = calloc(1, sizeof(gbm_pixmap));
if (!gp)
return NULL;
pixmap = screen->CreatePixmap(screen, gbm_bo_get_width(bo), gbm_bo_get_height(bo),
depth, CREATE_PIXMAP_USAGE_SCRATCH);
if (!pixmap)
return NULL;
gp->bo = bo;
dri3_pixmap_set_private(pixmap, gp);
return pixmap;
}
static PixmapPtr
xvnc_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds,
CARD16 width, CARD16 height,
const CARD32 *strides, const CARD32 *offsets,
CARD8 depth, CARD8 bpp, uint64_t modifier)
{
struct gbm_bo *bo = NULL;
PixmapPtr pixmap;
if (width == 0 || height == 0 || num_fds == 0 ||
depth < 15 || bpp != BitsPerPixel(depth) ||
strides[0] < width * bpp / 8)
return NULL;
if (num_fds == 1) {
struct gbm_import_fd_data data;
data.fd = fds[0];
data.width = width;
data.height = height;
data.stride = strides[0];
data.format = gbm_format_for_depth(depth);
bo = gbm_bo_import(priv.gbm, GBM_BO_IMPORT_FD, &data,
GBM_BO_USE_RENDERING);
if (!bo)
return NULL;
} else {
return NULL;
}
pixmap = create_pixmap_for_bo(screen, bo, depth);
if (pixmap == NULL) {
gbm_bo_destroy(bo);
return NULL;
}
return pixmap;
}
static int
xvnc_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds,
uint32_t *strides, uint32_t *offsets,
uint64_t *modifier)
{
gbm_pixmap *gp = gbm_pixmap_get(pixmap);
if (!gp)
return 0;
fds[0] = gbm_bo_get_fd(gp->bo);
strides[0] = gbm_bo_get_stride(gp->bo);
offsets[0] = 0;
*modifier = DRM_FORMAT_MOD_INVALID;
return 1;
}
static Bool
xvnc_get_formats(ScreenPtr screen,
CARD32 *num_formats, CARD32 **formats)
{
ErrorF("xvnc_get_formats\n");
return FALSE;
}
static Bool
xvnc_get_modifiers(ScreenPtr screen, uint32_t format,
uint32_t *num_modifiers, uint64_t **modifiers)
{
ErrorF("xvnc_get_modifiers\n");
return FALSE;
}
static Bool
xvnc_get_drawable_modifiers(DrawablePtr draw, uint32_t format,
uint32_t *num_modifiers, uint64_t **modifiers)
{
ErrorF("xvnc_get_drawable_modifiers\n");
return FALSE;
}
static const dri3_screen_info_rec xvnc_dri3_info = {
.version = 2,
.open = NULL,
.pixmap_from_fds = xvnc_pixmap_from_fds,
.fds_from_pixmap = xvnc_fds_from_pixmap,
.open_client = xvnc_dri3_open_client,
.get_formats = xvnc_get_formats,
.get_modifiers = xvnc_get_modifiers,
.get_drawable_modifiers = xvnc_get_drawable_modifiers,
};
void xvnc_sync_dri3_pixmap(PixmapPtr pixmap)
{
// There doesn't seem to be a good hook or sync point, so we do it manually
// here, right before Present copies from the pixmap
DrawablePtr pDraw;
GCPtr gc;
void *ptr;
uint32_t stride, w, h;
void *opaque = NULL;
gbm_pixmap *gp = gbm_pixmap_get(pixmap);
if (!gp) {
ErrorF("Present tried to copy from a non-dri3 pixmap\n");
return;
}
w = gbm_bo_get_width(gp->bo);
h = gbm_bo_get_height(gp->bo);
ptr = gbm_bo_map(gp->bo, 0, 0, w, h,
GBM_BO_TRANSFER_READ, &stride, &opaque);
if (!ptr) {
ErrorF("gbm map failed, errno %d\n", errno);
return;
}
pDraw = &pixmap->drawable;
if ((gc = GetScratchGC(pDraw->depth, pDraw->pScreen))) {
ValidateGC(pDraw, gc);
//gc->ops->PutImage(pDraw, gc, pDraw->depth, 0, 0, w, h, 0, ZPixmap, data);
fbPutZImage(pDraw, fbGetCompositeClip(gc), gc->alu, fbGetGCPrivate(gc)->pm,
0, 0, w, h, ptr, stride / sizeof(FbStip));
FreeScratchGC(gc);
}
gbm_bo_unmap(gp->bo, opaque);
}
void xvnc_init_dri3(void)
{
memset(&priv, 0, sizeof(priv));
gettimeofday(&start, NULL);
if (!dixRegisterPrivateKey(&dri3_pixmap_private_key, PRIVATE_PIXMAP, 0))
FatalError("dix\n");
if (!driNode)
driNode = "/dev/dri/renderD128";
priv.fd = open(driNode, O_RDWR | O_CLOEXEC);
if (!priv.fd)
FatalError("Failed to open %s\n", driNode);
priv.gbm = gbm_create_device(priv.fd);
if (!priv.gbm)
FatalError("Failed to create gbm\n");
if (!dri3_screen_init(screenInfo.screens[0], &xvnc_dri3_info))
FatalError("Couldn't init dri3\n");
}
#endif // DRI3

View File

@ -49,7 +49,7 @@ struct dlp_mimetype_t {
char mime[32]; char mime[32];
}; };
unsigned dlp_num_mimetypes(); unsigned dlp_num_mimetypes(void);
const char *dlp_get_mimetype(const unsigned i); const char *dlp_get_mimetype(const unsigned i);
extern int vncInetdSock; extern int vncInetdSock;
@ -68,7 +68,7 @@ int vncGetSendPrimary(void);
void vncUpdateDesktopName(void); void vncUpdateDesktopName(void);
void vncAnnounceClipboard(int available); void vncAnnounceClipboard(int available);
void vncClearBinaryClipboardData(); void vncClearBinaryClipboardData(void);
void vncSendBinaryClipboardData(const char* mime, const unsigned char *data, void vncSendBinaryClipboardData(const char* mime, const unsigned char *data,
const unsigned len); const unsigned len);
void vncGetBinaryClipboardData(const char *mime, const unsigned char **ptr, void vncGetBinaryClipboardData(const char *mime, const unsigned char **ptr,

View File

@ -763,3 +763,42 @@ static void vncClientStateCallback(CallbackListPtr * l,
} }
} }
} }
static void vncClearLocalClipboard(Atom selection)
{
SelectionInfoRec info;
Selection *pSel;
int rc;
rc = dixLookupSelection(&pSel, selection, serverClient, DixSetAttrAccess);
if (rc != Success)
return;
if (pSel->client && (pSel->client != serverClient)) {
xEvent event = {
.u.selectionClear.time = currentTime.milliseconds,
.u.selectionClear.window = pSel->window,
.u.selectionClear.atom = pSel->selection
};
event.u.u.type = SelectionClear;
WriteEventsToClient(pSel->client, 1, &event);
}
pSel->lastTimeChanged = currentTime;
pSel->window = None;
pSel->pWin = NULL;
pSel->client = NullClient;
LOG_DEBUG("Cleared %s selection", NameForAtom(selection));
info.selection = pSel;
info.client = serverClient;
info.kind = SelectionSetOwner;
CallCallbacks(&SelectionCallback, &info);
}
void vncClearLocalClipboards()
{
vncClearLocalClipboard(xaPRIMARY);
vncClearLocalClipboard(xaCLIPBOARD);
}

View File

@ -26,6 +26,7 @@ void vncSelectionInit(void);
void vncHandleClipboardAnnounce(int available); void vncHandleClipboardAnnounce(int available);
void vncHandleClipboardAnnounceBinary(const unsigned num, const char mimes[][32]); void vncHandleClipboardAnnounceBinary(const unsigned num, const char mimes[][32]);
void vncClearLocalClipboards();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -72,6 +72,12 @@ from the X Consortium.
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#endif /* HAS_SHM */ #endif /* HAS_SHM */
#ifdef MITSHM
#include "shmint.h"
#endif
#ifdef HAVE_XSHMFENCE
#include <misyncshm.h>
#endif
#include "dix.h" #include "dix.h"
#include "os.h" #include "os.h"
#include "miline.h" #include "miline.h"
@ -149,6 +155,8 @@ typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB } fbMemType;
static fbMemType fbmemtype = NORMAL_MEMORY_FB; static fbMemType fbmemtype = NORMAL_MEMORY_FB;
static int lastScreen = -1; static int lastScreen = -1;
static Bool Render = TRUE; static Bool Render = TRUE;
static Bool hw3d = FALSE;
const char *driNode = NULL;
static Bool displaySpecified = FALSE; static Bool displaySpecified = FALSE;
static char displayNumStr[16]; static char displayNumStr[16];
@ -350,6 +358,8 @@ void ddxUseMsg(void)
ErrorF("+/-render turn on/off RENDER extension support" ErrorF("+/-render turn on/off RENDER extension support"
"(default on)\n"); "(default on)\n");
#endif #endif
ErrorF("-hw3d enable hardware 3d acceleration\n");
ErrorF("-drinode path use another card than /dev/dri/renderD128\n");
ErrorF("-linebias n adjust thin line pixelization\n"); ErrorF("-linebias n adjust thin line pixelization\n");
ErrorF("-blackpixel n pixel value for black\n"); ErrorF("-blackpixel n pixel value for black\n");
ErrorF("-whitepixel n pixel value for white\n"); ErrorF("-whitepixel n pixel value for white\n");
@ -482,6 +492,20 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 1; return 1;
} }
if (strcmp (argv[i], "-hw3d") == 0)
{
hw3d = TRUE;
return 1;
}
if (strcmp (argv[i], "-drinode") == 0)
{
fail_unless_args(argc, i, 1);
++i;
driNode = argv[i];
return 2;
}
if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */ if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */
{ {
Pixel pix; Pixel pix;
@ -1475,7 +1499,7 @@ int vncRandRCreateScreenOutputs(int scrIdx, int extraOutputs)
/* Creating and modifying modes, used by XserverDesktop and init here */ /* Creating and modifying modes, used by XserverDesktop and init here */
int vncRandRCanCreateModes() int vncRandRCanCreateModes(void)
{ {
return 1; return 1;
} }
@ -1684,6 +1708,15 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
ret = fbPictureInit (pScreen, 0, 0); ret = fbPictureInit (pScreen, 0, 0);
#endif #endif
#ifdef MITSHM
ShmRegisterFbFuncs(pScreen);
#endif
#ifdef HAVE_XSHMFENCE
if (!miSyncShmScreenInit(pScreen))
return FALSE;
#endif
if (!ret) return FALSE; if (!ret) return FALSE;
#if XORG < 110 #if XORG < 110
@ -1784,7 +1817,7 @@ static void vfbClientStateChange(CallbackListPtr *a, void *b, void *c) {
} }
} }
#if XORG >= 113 #if XORG >= 113 && XORG < 120
#ifdef GLXEXT #ifdef GLXEXT
extern void GlxExtensionInit(void); extern void GlxExtensionInit(void);
@ -1796,6 +1829,10 @@ static ExtensionModule glxExt = {
#endif #endif
#endif #endif
#ifdef DRI3
extern void xvnc_init_dri3(void);
#endif
void void
InitOutput(ScreenInfo *scrInfo, int argc, char **argv) InitOutput(ScreenInfo *scrInfo, int argc, char **argv)
{ {
@ -1872,6 +1909,14 @@ InitOutput(ScreenInfo *scrInfo, int argc, char **argv)
if (!AddCallback(&ClientStateCallback, vfbClientStateChange, 0)) { if (!AddCallback(&ClientStateCallback, vfbClientStateChange, 0)) {
FatalError("AddCallback failed\n"); FatalError("AddCallback failed\n");
} }
if (hw3d) {
#ifdef DRI3
xvnc_init_dri3();
#else
FatalError("DRI3 disabled at compile time\n");
#endif
}
} /* end InitOutput */ } /* end InitOutput */
/* this is just to get the server to link on AIX */ /* this is just to get the server to link on AIX */

View File

@ -80,3 +80,34 @@ Index: xserver/mi/miinitext.c
{GEExtensionInit, "Generic Event Extension", &noGEExtension}, {GEExtensionInit, "Generic Event Extension", &noGEExtension},
{ShapeExtensionInit, "SHAPE", NULL}, {ShapeExtensionInit, "SHAPE", NULL},
#ifdef MITSHM #ifdef MITSHM
--- xserver.orig/dri3/Makefile.am 2019-02-26 21:28:50.000000000 +0200
+++ xserver/dri3/Makefile.am 2023-01-18 11:55:45.315851638 +0200
@@ -1,7 +1,7 @@
noinst_LTLIBRARIES = libdri3.la
AM_CFLAGS = \
-DHAVE_XORG_CONFIG_H \
- @DIX_CFLAGS@ @XORG_CFLAGS@
+ @DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@
libdri3_la_SOURCES = \
dri3.h \
--- xserver.orig/present/present.c 2019-02-26 21:28:50.000000000 +0200
+++ xserver/present/present.c 2023-01-20 11:32:27.175493594 +0200
@@ -27,6 +27,8 @@
#include "present_priv.h"
#include <gcstruct.h>
+void xvnc_sync_dri3_pixmap(PixmapPtr pixmap);
+
/*
* Returns:
* TRUE if the first MSC value is equal to or after the second one
@@ -79,6 +81,8 @@
ScreenPtr screen = drawable->pScreen;
GCPtr gc;
+ xvnc_sync_dri3_pixmap(pixmap);
+
gc = GetScratchGC(drawable->depth, screen);
if (update) {
ChangeGCVal changes[2];