Skip to content

Commit a022cca

Browse files
Merge branch 'main' into perf/qt6-webchannel-latency
2 parents ccd7094 + e881bf0 commit a022cca

28 files changed

Lines changed: 336 additions & 152 deletions

.github/actions/build-linux/action.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,6 @@ runs:
5555
run: df -h /
5656
shell: bash
5757

58-
# Rocky 9.8 dropped mesa-libOSMesa{,-devel} from the CRB repo (Mesa upstream
59-
# deprecated OSMesa in favor of llvmpipe via EGL). Pin all subsequent dnf
60-
# calls in this container to the 9.7 minor release until OpenRV migrates off
61-
# OSMesa. 9.7 is now a superseded minor, so the production CDN no longer
62-
# serves it (the default 'extras' repo 404s); point the pinned repos at the
63-
# durable vault archive (dl.rockylinux.org/vault) instead. Remove this whole
64-
# step once OpenRV no longer needs OSMesa.
65-
- name: Pin Rocky 9 to 9.7 minor release (vault)
66-
if: ${{ inputs.rocky-version == '9' }}
67-
run: |
68-
echo "9.7" > /etc/dnf/vars/releasever
69-
sed -i \
70-
-e 's|^mirrorlist=|#mirrorlist=|g' \
71-
-e 's|^#\?baseurl=https\?://dl.rockylinux.org/\$contentdir/|baseurl=https://dl.rockylinux.org/vault/rocky/|g' \
72-
/etc/yum.repos.d/[Rr]ocky*.repo
73-
dnf clean all
74-
shell: bash
75-
7658
- name: Install system dependencies
7759
run: |
7860
retry_count=0
@@ -84,9 +66,14 @@ runs:
8466
if dnf install -y epel-release && \
8567
dnf config-manager --set-enabled ${{ inputs.extra_repo }} devel && \
8668
dnf groupinstall "Development Tools" -y && \
87-
dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget patchelf pcsc-lite libxkbfile perl-IPC-Cmd perl-Time-Piece && \
69+
dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget patchelf pcsc-lite libxkbfile perl-IPC-Cmd perl-Time-Piece && \
8870
dnf install -y libX11-devel libXext-devel libXrender-devel libXrandr-devel libXcursor-devel libXi-devel libXxf86vm-devel libxkbcommon-devel && \
8971
dnf install -y xz-devel mesa-libGLU mesa-libGLU-devel && \
72+
if [ "${{ inputs.rocky-version }}" = "9" ]; then \
73+
dnf install -y mesa-compat-libOSMesa mesa-compat-libOSMesa-devel; \
74+
else \
75+
dnf install -y mesa-libOSMesa mesa-libOSMesa-devel; \
76+
fi && \
9077
dnf clean all; then
9178
echo "Dependencies installed successfully"
9279
break

.github/workflows/conan.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,34 +97,27 @@ jobs:
9797
run: |
9898
df -h /
9999
100-
# Rocky 9.8 dropped mesa-libOSMesa{,-devel} from the CRB repo. Pin all
101-
# subsequent dnf calls in this container to the 9.7 minor release until
102-
# OpenRV migrates off OSMesa. Remove this step once that's done.
103-
- name: Pin Rocky 9 to 9.7 minor release (vault)
104-
if: ${{ matrix.rocky-version == '9' }}
105-
run: |
106-
echo "9.7" > /etc/dnf/vars/releasever
107-
sed -i \
108-
-e 's|^mirrorlist=|#mirrorlist=|g' \
109-
-e 's|^#\?baseurl=https\?://dl.rockylinux.org/\$contentdir/|baseurl=https://dl.rockylinux.org/vault/rocky/|g' \
110-
/etc/yum.repos.d/[Rr]ocky*.repo
111-
dnf clean all
112-
113100
- name: Install system dependencies
114101
run: |
115102
dnf install -y epel-release
116103
dnf config-manager --set-enabled ${{ matrix.extra_repo }} devel
117104
dnf install -y which findutils
118105
dnf groupinstall "Development Tools" -y
119-
dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget patchelf pcsc-lite libxkbfile perl-IPC-Cmd perl-Digest-SHA
106+
dnf install -y alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ git libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor meson openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers qt5-qtbase-devel readline-devel sqlite-devel systemd-devel tcl-devel tcsh tk-devel yasm zip zlib-devel wget patchelf pcsc-lite libxkbfile perl-IPC-Cmd perl-Digest-SHA
120107
dnf install -y libX11-devel libXext-devel libXrender-devel libXrandr-devel libXcursor-devel libXi-devel libXxf86vm-devel libxkbcommon-devel
121108
dnf install -y xz-devel mesa-libGLU mesa-libGLU-devel
109+
if [ "${{ matrix.rocky-version }}" = "9" ]; then \
110+
dnf install -y mesa-compat-libOSMesa mesa-compat-libOSMesa-devel; \
111+
else \
112+
dnf install -y mesa-libOSMesa mesa-libOSMesa-devel; \
113+
fi && \
122114
dnf clean all
123115
124116
- name: Install other system dependencies
125117
if: ${{ matrix.rocky-version == '9' }}
126118
run: |
127119
dnf install -y perl-CPAN
120+
128121
cpan FindBin
129122
130123
- name: Install GCC 11 toolchain for Rocky Linux 8

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22

33
build:
4-
os: "ubuntu-20.04"
4+
os: "ubuntu-lts-latest"
55
tools:
66
python: "3.8"
77

dockerfiles/Dockerfile.Linux-Rocky9-CY2023

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ RUN dnf groupinstall "Development Tools" -y \
6363
libxkbfile \
6464
mesa-libGLU \
6565
mesa-libGLU-devel \
66-
mesa-libOSMesa \
67-
mesa-libOSMesa-devel \
66+
mesa-compat-libOSMesa \
67+
mesa-compat-libOSMesa-devel \
6868
meson \
6969
nasm \
7070
ncurses-devel \
@@ -135,4 +135,4 @@ RUN python -m aqt install-qt linux desktop ${QT_VERSION} gcc_64 -O ~/Qt \
135135
-m ${QT_MODULES} \
136136
--archives ${QT_ARCHIVES}
137137

138-
CMD ["/bin/bash"]
138+
CMD ["/bin/bash"]

dockerfiles/Dockerfile.Linux-Rocky9-CY2024

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ RUN dnf groupinstall "Development Tools" -y \
6363
libxkbfile \
6464
mesa-libGLU \
6565
mesa-libGLU-devel \
66-
mesa-libOSMesa \
67-
mesa-libOSMesa-devel \
66+
mesa-compat-libOSMesa \
67+
mesa-compat-libOSMesa-devel \
6868
meson \
6969
nasm \
7070
ncurses-devel \
@@ -92,6 +92,8 @@ RUN dnf groupinstall "Development Tools" -y \
9292
yasm \
9393
zip \
9494
zlib-devel \
95+
rust \
96+
cargo \
9597
&& dnf clean all
9698

9799
# Disable the devel repo afterwards since dnf will warn about it
@@ -135,4 +137,4 @@ RUN python -m aqt install-qt linux desktop ${QT_VERSION} gcc_64 -O ~/Qt \
135137
-m ${QT_MODULES} \
136138
--archives ${QT_ARCHIVES}
137139

138-
CMD ["/bin/bash"]
140+
CMD ["/bin/bash"]

docs/build_system/config_linux_rocky89.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ sudo dnf install -y libX11-devel libXext-devel libXrender-devel libXrandr-devel
116116
sudo dnf install -y xz-devel mesa-libGLU mesa-libGLU-devel
117117
```
118118

119+
````{tabs}
120+
```{code-tab} bash Rocky 8
121+
sudo dnf install -y mesa-libOSMesa mesa-libOSMesa-devel
122+
```
123+
```{code-tab} bash Rocky 9
124+
sudo dnf install -y mesa-compat-libOSMesa mesa-compat-libOSMesa-devel
125+
```
126+
````
127+
119128
```bash
120129
sudo dnf clean all
121130
```

src/bin/imgtools/rvio/main.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
#include <gl/glew.h>
8989
#include <QtGui/QtGui>
9090
#include <QtWidgets/QApplication>
91+
#else
92+
#include <QtGui/QGuiApplication>
9193
#endif
9294

9395
#include <QtCore/QtCore>
@@ -998,13 +1000,27 @@ int utf8Main(int argc, char* argv[])
9981000
pthread_win32_process_attach_np();
9991001
#endif
10001002

1003+
#ifndef PLATFORM_WINDOWS
1004+
//
1005+
// Paint/text annotation rendering (PaintCommand.cpp) uses Qt's font
1006+
// stack (QFont, QFontDatabase, QPainter), which requires a
1007+
// QGuiApplication rather than a QCoreApplication. rvio has no UI, so
1008+
// force the offscreen QPA platform plugin unless the caller already
1009+
// requested a specific one, avoiding any dependency on a real display.
1010+
//
1011+
if (!qEnvironmentVariableIsSet("QT_QPA_PLATFORM"))
1012+
{
1013+
qputenv("QT_QPA_PLATFORM", "offscreen");
1014+
}
1015+
#endif
1016+
10011017
#ifdef PLATFORM_DARWIN
1002-
QCoreApplication qapp(argc, argv);
1018+
QGuiApplication qapp(argc, argv);
10031019
TwkApp::DarwinBundle bundle("RV", MAJOR_VERSION, MINOR_VERSION, REVISION_NUMBER);
10041020
#endif
10051021

10061022
#ifdef PLATFORM_LINUX
1007-
QCoreApplication qapp(argc, argv);
1023+
QGuiApplication qapp(argc, argv);
10081024
TwkApp::QTBundle bundle("rv", MAJOR_VERSION, MINOR_VERSION, REVISION_NUMBER);
10091025
#endif
10101026

src/lib/app/PyTwkApp/PyInterface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ namespace TwkApp
514514
PyModule_AddObject(pModule, "Event", reinterpret_cast<PyObject*>(pyEventType()));
515515
}
516516

517+
initPyMuSymbolType();
517518
if (PyType_Ready(pyMuSymbolType()) >= 0)
518519
{
519520
Py_XINCREF(pyMuSymbolType());

src/lib/app/PyTwkApp/PyMuSymbolType.cpp

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#include <MuTwkApp/EventType.h>
4747
#include <MuTwkApp/MuInterface.h>
4848
#include <boost/algorithm/string.hpp>
49-
#include <boost/thread.hpp>
5049
#include <half.h>
50+
#include <thread>
5151
#include <sstream>
5252
#include <stdexcept>
5353
#include <iostream>
@@ -58,24 +58,7 @@ namespace TwkApp
5858

5959
// Thread safety tracking
6060
// Default constructor creates "not-a-thread" ID
61-
static boost::thread::id s_mainThreadId;
62-
63-
// Helper function for direct cout printing
64-
static PyObject* unsafe_mu_print(PyObject* args)
65-
{
66-
size_t nargs = PyTuple_Size(args);
67-
if (nargs >= 1)
68-
{
69-
PyObject* arg = PyTuple_GetItem(args, 0);
70-
if (PyUnicode_Check(arg))
71-
{
72-
const char* str = PyUnicode_AsUTF8(arg);
73-
if (str)
74-
cout << str;
75-
}
76-
}
77-
Py_RETURN_NONE;
78-
}
61+
static std::thread::id s_mainThreadId;
7962

8063
Mu::FunctionObject* createFunctionObjectFromPyObject(const Mu::FunctionType* t, PyObject* pyobj)
8164
{
@@ -303,30 +286,12 @@ namespace TwkApp
303286
return NULL;
304287
}
305288

306-
// Thread safety check - initialize main thread ID on first call
307-
boost::thread::id currentThreadId = boost::this_thread::get_id();
308-
if (s_mainThreadId == boost::thread::id()) // Check if uninitialized
309-
// (default constructed)
289+
// Thread safety check
290+
if (std::this_thread::get_id() != s_mainThreadId)
310291
{
311-
s_mainThreadId = currentThreadId;
312-
}
313-
314-
if (currentThreadId != s_mainThreadId)
315-
{
316-
// fix mu print commands from python to at least not crash from
317-
// non-main thread
318-
// (because python print is often used to debug python code, so
319-
// we'll tolerate this because print is likely redirected to the RV
320-
// console)
321-
if (self->function->fullyQualifiedName() == "extra_commands._print")
322-
{
323-
return unsafe_mu_print(args);
324-
}
292+
PyErr_SetString(PyExc_RuntimeError, "Mu is not thread-safe. Mu functions must be called from the main thread");
325293

326-
// this cout will probably get redirected to the RV console, or go
327-
// to the terminal window.
328-
cout << "WARNING: Mu " << self->function->fullyQualifiedName() << "() called from non-main thread, will eventually crash "
329-
<< "(Mu isn't thread-safe)." << endl;
294+
return nullptr;
330295
}
331296

332297
size_t nargs = PyTuple_Size(args);
@@ -530,9 +495,6 @@ namespace TwkApp
530495

531496
PyTypeObject* pyMuSymbolType() { return &type; }
532497

533-
void initPyMuSymbolType()
534-
{
535-
//
536-
}
498+
void initPyMuSymbolType() { s_mainThreadId = std::this_thread::get_id(); }
537499

538500
} // namespace TwkApp

src/lib/app/RvCommon/PyUICommands.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,41 @@ namespace Rv
418418

419419
#endif
420420

421+
static PyObject* consoleWrite(PyObject*, PyObject* args)
422+
{
423+
PyLockObject locker;
424+
const char* message = nullptr;
425+
bool foundConsole = false;
426+
427+
if (!PyArg_ParseTuple(args, "s", &message))
428+
return nullptr;
429+
430+
Py_BEGIN_ALLOW_THREADS;
431+
432+
if (RvApplication* app = RvApp())
433+
{
434+
if (RvConsoleWindow* console = app->console())
435+
{
436+
foundConsole = true;
437+
size_t size = strlen(message);
438+
console->append(message, size);
439+
440+
// Invoke processTextBuffer using AutoConnection to automatically
441+
// use queued connection if we're not on the main thread
442+
QMetaObject::invokeMethod(console, "processTextBuffer", Qt::AutoConnection);
443+
}
444+
}
445+
446+
if (!foundConsole)
447+
{
448+
cout << message;
449+
}
450+
451+
Py_END_ALLOW_THREADS;
452+
453+
Py_RETURN_NONE;
454+
}
455+
421456
static PyMethodDef localmethods[] = {
422457

423458
{"readSettings", readSettings, METH_VARARGS, ""},
@@ -438,6 +473,8 @@ namespace Rv
438473

439474
{"javascriptExport", javascriptExport, METH_VARARGS, ""},
440475

476+
{"consoleWrite", consoleWrite, METH_VARARGS, "Write a message to the RV console window."},
477+
441478
{NULL}};
442479

443480
void* pyUICommands() { return (void*)localmethods; }

0 commit comments

Comments
 (0)