From 53e71f44ceec181e40c4cbd3f14a403798bca7bb Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Wed, 23 Sep 2020 23:16:55 +0200 Subject: [PATCH] tici: fix ui rotation (#2222) * fix rotation using wayland * put back intrinsic matrix fix --- SConstruct | 1 + selfdrive/ui/SConscript | 2 +- selfdrive/ui/paint.cc | 9 +++++++++ selfdrive/ui/qt/ui.cc | 16 +++++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 95388976d3..1eb8f803bc 100644 --- a/SConstruct +++ b/SConstruct @@ -201,6 +201,7 @@ if arch in ["x86_64", "Darwin", "larch64"]: f"/usr/include/{real_arch}-linux-gnu/qt5/QtCore", f"/usr/include/{real_arch}-linux-gnu/qt5/QtDBus", f"/usr/include/{real_arch}-linux-gnu/qt5/QtMultimedia", + f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.5.1/QtGui", ] qt_env.Tool('qt') diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index ed8275ee6b..2207123a97 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -22,7 +22,7 @@ else: qt_libs += ["Qt5Widgets", "Qt5Gui", "Qt5Core", "Qt5DBus", "Qt5Multimedia"] if arch == "larch64": - qt_libs += ["GLESv2"] + qt_libs += ["GLESv2", "wayland-client"] else: qt_libs += ["GL"] diff --git a/selfdrive/ui/paint.cc b/selfdrive/ui/paint.cc index 7f41b14989..881074d8f3 100644 --- a/selfdrive/ui/paint.cc +++ b/selfdrive/ui/paint.cc @@ -17,11 +17,20 @@ extern "C"{ #include "sidebar.hpp" // TODO: this is also hardcoded in common/transformations/camera.py +// TODO: choose based on frame input size +#ifdef QCOM2 +const mat3 intrinsic_matrix = (mat3){{ + 2648.0, 0.0, 1928.0/2, + 0.0, 2648.0, 1208.0/2, + 0.0, 0.0, 1.0 +}}; +#else const mat3 intrinsic_matrix = (mat3){{ 910., 0., 582., 0., 910., 437., 0., 0., 1. }}; +#endif const uint8_t alert_colors[][4] = { [STATUS_OFFROAD] = {0x07, 0x23, 0x39, 0xf1}, diff --git a/selfdrive/ui/qt/ui.cc b/selfdrive/ui/qt/ui.cc index 4a01b9ac50..aece1742ab 100644 --- a/selfdrive/ui/qt/ui.cc +++ b/selfdrive/ui/qt/ui.cc @@ -1,5 +1,11 @@ #include +#ifdef QCOM2 +#include +#include +#include +#endif + #include "window.hpp" int main(int argc, char *argv[]) { @@ -16,11 +22,15 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; -#ifdef QCOM2 - w.showFullScreen(); -#else w.setFixedSize(vwp_w, vwp_h); w.show(); + +#ifdef QCOM2 + QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); + wl_surface *s = reinterpret_cast(native->nativeResourceForWindow("surface", w.windowHandle())); + wl_surface_set_buffer_transform(s, WL_OUTPUT_TRANSFORM_270); + wl_surface_commit(s); + w.showFullScreen(); #endif return a.exec();