Merge remote-tracking branch 'origin/master' into sse_scaling
commit
242853eb2a
@ -1 +0,0 @@
|
|||||||
builder/build
|
|
@ -0,0 +1,39 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
|
ENV KASMVNC_BUILD_OS ubuntu
|
||||||
|
ENV KASMVNC_BUILD_OS_CODENAME bionic
|
||||||
|
ENV XORG_VER 1.20.10
|
||||||
|
|
||||||
|
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get -y install sudo
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
|
||||||
|
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver
|
||||||
|
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y cmake nasm gcc
|
||||||
|
RUN git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git
|
||||||
|
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -G"Unix Makefiles" && make deb
|
||||||
|
RUN export MAKEFLAGS=-j`nproc`; cd libjpeg-turbo && cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles" && make && make install
|
||||||
|
|
||||||
|
# Additions for webp
|
||||||
|
RUN cd /tmp && wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz
|
||||||
|
RUN cd /tmp && tar -xzvf /tmp/libwebp-*
|
||||||
|
RUN cd /tmp/libwebp-1.0.2 && \
|
||||||
|
./configure --enable-static --disable-shared && \
|
||||||
|
make && make install
|
||||||
|
|
||||||
|
# Fix for older required libs
|
||||||
|
#RUN cd /tmp && wget http://launchpadlibrarian.net/347526424/libxfont1-dev_1.5.2-4ubuntu2_amd64.deb && \
|
||||||
|
# wget http://launchpadlibrarian.net/347526425/libxfont1_1.5.2-4ubuntu2_amd64.deb && \
|
||||||
|
# dpkg -i libxfont1_1.5.2-4ubuntu2_amd64.deb && \
|
||||||
|
# dpkg -i libxfont1-dev_1.5.2-4ubuntu2_amd64.deb
|
||||||
|
|
||||||
|
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
|
||||||
|
|
||||||
|
COPY --chown=docker:docker . /src
|
||||||
|
|
||||||
|
USER docker
|
||||||
|
ENTRYPOINT ["/src/builder/build.sh"]
|
@ -0,0 +1,23 @@
|
|||||||
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get -y install vim build-essential devscripts equivs
|
||||||
|
|
||||||
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
|
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo*deb /tmp
|
||||||
|
RUN apt-get install /tmp/libjpeg-turbo*deb
|
||||||
|
|
||||||
|
# Install build-deps for the package.
|
||||||
|
COPY ./debian/control /tmp
|
||||||
|
RUN apt-get update && echo YYY | mk-build-deps --install --remove /tmp/control
|
||||||
|
|
||||||
|
ENV LD_LIBRARY_PATH="/opt/libjpeg-turbo/lib64/:$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
ARG L_UID
|
||||||
|
RUN if [ "$L_UID" -eq 0 ]; then \
|
||||||
|
useradd -m docker; \
|
||||||
|
else \
|
||||||
|
useradd -m docker -u $L_UID;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER docker
|
@ -0,0 +1,58 @@
|
|||||||
|
FROM ubuntu:bionic
|
||||||
|
|
||||||
|
ENV DISPLAY=:1 \
|
||||||
|
VNC_PORT=8443 \
|
||||||
|
VNC_RESOLUTION=1280x720 \
|
||||||
|
MAX_FRAME_RATE=24 \
|
||||||
|
VNCOPTIONS="-PreferBandwidth -DynamicQualityMin=4 -DynamicQualityMax=7" \
|
||||||
|
HOME=/home/user \
|
||||||
|
TERM=xterm \
|
||||||
|
STARTUPDIR=/dockerstartup \
|
||||||
|
INST_SCRIPTS=/dockerstartup/install \
|
||||||
|
KASM_RX_HOME=/dockerstartup/kasmrx \
|
||||||
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
|
VNC_COL_DEPTH=24 \
|
||||||
|
VNC_RESOLUTION=1280x1024 \
|
||||||
|
VNC_PW=vncpassword \
|
||||||
|
VNC_USER=user \
|
||||||
|
VNC_VIEW_ONLY_PW=vncviewonlypassword \
|
||||||
|
LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64/:/usr/local/lib/ \
|
||||||
|
OMP_WAIT_POLICY=PASSIVE \
|
||||||
|
SHELL=/bin/bash \
|
||||||
|
SINGLE_APPLICATION=0 \
|
||||||
|
KASMVNC_BUILD_OS=ubuntu \
|
||||||
|
KASMVNC_BUILD_OS_CODENAME=bionic
|
||||||
|
|
||||||
|
EXPOSE $VNC_PORT
|
||||||
|
|
||||||
|
WORKDIR $HOME
|
||||||
|
|
||||||
|
### REQUIRED STUFF ###
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm libnss-wrapper gettext wget
|
||||||
|
RUN apt-get purge -y pm-utils xscreensaver*
|
||||||
|
RUN apt-get update && apt-get install -y vim less
|
||||||
|
RUN apt-get update && apt-get -y install lsb-release
|
||||||
|
|
||||||
|
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
|
||||||
|
|
||||||
|
RUN mkdir -p $STARTUPDIR
|
||||||
|
COPY startup/ $STARTUPDIR
|
||||||
|
|
||||||
|
### START CUSTOM STUFF ####
|
||||||
|
|
||||||
|
ARG KASMVNC_PACKAGE_DIR
|
||||||
|
COPY $KASMVNC_PACKAGE_DIR/libjpeg-turbo_*.deb /tmp
|
||||||
|
RUN apt-get install /tmp/libjpeg-turbo*deb
|
||||||
|
|
||||||
|
ARG BUILD_DEBIAN_REVISION
|
||||||
|
COPY $KASMVNC_PACKAGE_DIR/kasmvncserver_*$BUILD_DEBIAN_REVISION*.deb /tmp
|
||||||
|
RUN dpkg -i /tmp/*.deb; apt-get -yf install
|
||||||
|
|
||||||
|
### END CUSTOM STUFF ###
|
||||||
|
|
||||||
|
RUN chown -R 1000:0 $HOME
|
||||||
|
USER 1000:ssl-cert
|
||||||
|
WORKDIR $HOME
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]
|
@ -0,0 +1,197 @@
|
|||||||
|
/* Copyright (C) 2021 Kasm Web
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rfb/ComparingUpdateTracker.h>
|
||||||
|
#include <rfb/EncodeManager.h>
|
||||||
|
#include <rfb/LogWriter.h>
|
||||||
|
#include <rfb/SConnection.h>
|
||||||
|
#include <rfb/ServerCore.h>
|
||||||
|
#include <rfb/PixelBuffer.h>
|
||||||
|
#include <rfb/TightJPEGEncoder.h>
|
||||||
|
#include <rfb/TightWEBPEncoder.h>
|
||||||
|
#include <rfb/util.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
using namespace rfb;
|
||||||
|
static LogWriter vlog("SelfBench");
|
||||||
|
|
||||||
|
static const PixelFormat pfRGBX(32, 24, false, true, 255, 255, 255, 0, 8, 16);
|
||||||
|
|
||||||
|
#define RUNS 64
|
||||||
|
|
||||||
|
#define W 1600
|
||||||
|
#define H 1200
|
||||||
|
|
||||||
|
void SelfBench() {
|
||||||
|
|
||||||
|
unsigned i, runs;
|
||||||
|
struct timeval start;
|
||||||
|
|
||||||
|
ManagedPixelBuffer f1(pfRGBX, W, H);
|
||||||
|
ManagedPixelBuffer f2(pfRGBX, W, H);
|
||||||
|
ManagedPixelBuffer screen(pfRGBX, W, H);
|
||||||
|
|
||||||
|
int stride;
|
||||||
|
rdr::U8 *f1ptr = f1.getBufferRW(f1.getRect(), &stride);
|
||||||
|
rdr::U8 *f2ptr = f2.getBufferRW(f2.getRect(), &stride);
|
||||||
|
rdr::U8 * const screenptr = screen.getBufferRW(screen.getRect(), &stride);
|
||||||
|
|
||||||
|
rdr::U8 * const f1orig = f1ptr;
|
||||||
|
rdr::U8 * const f2orig = f2ptr;
|
||||||
|
|
||||||
|
for (i = 0; i < W * H * 4; i += 4) {
|
||||||
|
f1ptr[0] = rand();
|
||||||
|
f1ptr[1] = rand();
|
||||||
|
f1ptr[2] = rand();
|
||||||
|
|
||||||
|
f2ptr[0] = rand();
|
||||||
|
f2ptr[1] = rand();
|
||||||
|
f2ptr[2] = rand();
|
||||||
|
|
||||||
|
f1ptr += 4;
|
||||||
|
f2ptr += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
vlog.info("Running micro-benchmarks (single-threaded, runs depending on task)");
|
||||||
|
|
||||||
|
// Encoding
|
||||||
|
std::vector<uint8_t> vec;
|
||||||
|
|
||||||
|
TightJPEGEncoder jpeg(NULL);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
jpeg.compressOnly(&f1, 8, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Jpeg compression at quality 8 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
jpeg.compressOnly(&f1, 4, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Jpeg compression at quality 4 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
|
||||||
|
TightWEBPEncoder webp(NULL);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS / 8;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
webp.compressOnly(&f1, 8, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Webp compression at quality 8 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS / 4;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
webp.compressOnly(&f1, 4, vec, false);
|
||||||
|
}
|
||||||
|
vlog.info("Webp compression at quality 4 took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
// Scaling
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = nearestScale(&f1, W * 0.8, H * 0.8, 0.8);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Nearest scaling to 80%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = nearestScale(&f1, W * 0.4, H * 0.4, 0.4);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Nearest scaling to 40%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = bilinearScale(&f1, W * 0.8, H * 0.8, 0.8);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Bilinear scaling to 80%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = bilinearScale(&f1, W * 0.4, H * 0.4, 0.4);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Bilinear scaling to 40%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = progressiveBilinearScale(&f1, W * 0.8, H * 0.8, 0.8);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Progressive bilinear scaling to 80%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
PixelBuffer *pb = progressiveBilinearScale(&f1, W * 0.4, H * 0.4, 0.4);
|
||||||
|
delete pb;
|
||||||
|
}
|
||||||
|
vlog.info("Progressive bilinear scaling to 40%% took %u ms (%u runs)", msSince(&start), runs);
|
||||||
|
|
||||||
|
// Analysis
|
||||||
|
ComparingUpdateTracker *comparer = new ComparingUpdateTracker(&screen);
|
||||||
|
Region cursorReg;
|
||||||
|
|
||||||
|
Server::detectScrolling.setParam(false);
|
||||||
|
Server::detectHorizontal.setParam(false);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4);
|
||||||
|
comparer->compare(true, cursorReg);
|
||||||
|
}
|
||||||
|
vlog.info("Analysis took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs);
|
||||||
|
|
||||||
|
Server::detectScrolling.setParam(true);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4);
|
||||||
|
comparer->compare(false, cursorReg);
|
||||||
|
}
|
||||||
|
vlog.info("Analysis w/ scroll detection took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs);
|
||||||
|
|
||||||
|
Server::detectHorizontal.setParam(true);
|
||||||
|
delete comparer;
|
||||||
|
comparer = new ComparingUpdateTracker(&screen);
|
||||||
|
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
runs = RUNS / 2;
|
||||||
|
for (i = 0; i < runs; i++) {
|
||||||
|
memcpy(screenptr, i % 2 ? f1orig : f2orig, W * H * 4);
|
||||||
|
comparer->compare(false, cursorReg);
|
||||||
|
}
|
||||||
|
vlog.info("Analysis w/ horizontal scroll detection took %u ms (%u runs) (incl. memcpy overhead)", msSince(&start), runs);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
Loading…
Reference in New Issue