[libcamera-devel] [PATCH v2 0/3] apps: qcam: Port to Qt 6

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Sep 9 18:21:42 CEST 2024


On Mon, Sep 09, 2024 at 05:13:20PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2024-09-09 14:07:50)
> > Hi Neal,
> > 
> > I realized today that the gles rendered in qcam is broken :-( Reverting
> > back to qt5 works for me, so it's related to this patch series. Could
> > you please test ('qcam -r gles') and investigate ?
> 
> I just tested this and have the following backtrace on Fedora Rawhide...
> 
> (gdb) bt
> #0  0x0000ffffce368b3c in void st_update_array_templ<(util_popcnt)2, (st_fill_tc_set_vb)0, (st_use_vao_fast_path)1, (st_allow_zero_stride_attribs)0, (st_identity_attrib_mapping)0, (st_allow_user_buffers)0, (st_update_velems)1>(st_context*, unsigned int, unsigned int, unsigned int) () at /lib64/libgallium-24.2.1.so
> #1  0x0000ffffce0f9484 in st_prepare_draw () at /lib64/libgallium-24.2.1.so
> #2  0x0000ffffce294384 in _mesa_draw_arrays.part.0 () at /lib64/libgallium-24.2.1.so
> #3  0x0000000000454934 in QOpenGLFunctions::glDrawArrays (this=0x722d60, mode=6, first=0, count=4) at /usr/include/qt6/QtGui/qopenglfunctions.h:709
> #4  0x000000000045438c in ViewFinderGL::paintGL (this=0x722d30) at ../../src/apps/qcam/viewfinder_gl.cpp:823
> #5  0x0000fffff74e2f00 in QOpenGLWidgetPrivate::render() () at /lib64/libQt6OpenGLWidgets.so.6
> #6  0x0000fffff5dceecc in QWidget::event(QEvent*) () at /lib64/libQt6Widgets.so.6
> #7  0x0000fffff5d6ea18 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6
> #8  0x0000fffff6f71d58 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6
> #9  0x0000fffff5dc598c in QWidgetPrivate::sendPaintEvent(QRegion const&) () at /lib64/libQt6Widgets.so.6
> #10 0x0000fffff5ddba1c in QWidgetRepaintManager::paintAndFlush() () at /lib64/libQt6Widgets.so.6
> #11 0x0000fffff5dcf64c in QWidget::event(QEvent*) () at /lib64/libQt6Widgets.so.6
> #12 0x000000000043af30 in MainWindow::event (this=0x7c0440, e=0xffffd40042c0) at ../../src/apps/qcam/main_window.cpp:177
> #13 0x0000fffff5d6ea18 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6
> #14 0x0000fffff6f71d58 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6
> #15 0x0000fffff6f76068 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /lib64/libQt6Core.so.6
> #16 0x0000fffff7272fd4 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt6Core.so.6
> #17 0x0000fffff48d0b94 in g_main_context_dispatch_unlocked.lto_priv () at /lib64/libglib-2.0.so.0
> #18 0x0000fffff49341d0 in g_main_context_iterate_unlocked.isra () at /lib64/libglib-2.0.so.0
> #19 0x0000fffff48d2264 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
> #20 0x0000fffff7272658 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6
> #21 0x0000fffff6f7f694 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6
> #22 0x0000fffff6f7ac3c in QCoreApplication::exec() () at /lib64/libQt6Core.so.6
> #23 0x0000000000439a24 in main (argc=3, argv=0xffffffffeeb8) at ../../src/apps/qcam/main.cpp:87
> (gdb) quit
> A debugging session is active.

This patch fixes the crash:

diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp
index 9d2a69600db1..789a45f3e314 100644
--- a/src/apps/qcam/viewfinder_gl.cpp
+++ b/src/apps/qcam/viewfinder_gl.cpp
@@ -809,6 +809,8 @@ void ViewFinderGL::doRender()

 void ViewFinderGL::paintGL()
 {
+	vertexBuffer_.bind();
+
 	if (!fragmentShader_)
 		if (!createFragmentShader()) {
 			qWarning() << "[ViewFinderGL]:"

The display is still wrong though, but "less wrong". It appears that the
texture coordinates are not taken into account correctly.

Any OpenGL expert who could have a quick look at qcam and check where we
get binding of objects wrong ?

> > On Sun, Jan 21, 2024 at 05:39:52PM -0500, 📷-dev wrote:
> > > Open source Qt 5 has been effectively end of life since the release
> > > of Qt 6, and Qt 6 has current LTS releases now.
> > > 
> > > This change ports qcam to Qt 6.2 and drops some of the baggage related
> > > to Qt 5 that is no longer applicable.
> > > 
> > > Additionally, a couple of patches are included to update documentation
> > > references from Qt 5 to Qt 6.
> > > 
> > > === Changelog ===
> > > 
> > > v2: Bump Meson to v0.63 for Qt6 module
> > > 
> > > v1: Initial patch set
> > > 
> > > Neal Gompa (3):
> > >   apps: qcam: Port to Qt 6
> > >   libcamera: base: signal: Update Qt documentation link to Qt 6
> > >   Documentation: Update Qt documentation links to Qt 6
> > > 
> > >  .../guides/application-developer.rst          |  2 +-
> > >  Documentation/guides/pipeline-handler.rst     |  2 +-
> > >  README.rst                                    |  2 +-
> > >  meson.build                                   |  2 +-
> > >  src/apps/qcam/meson.build                     | 45 ++++++-------------
> > >  src/libcamera/base/signal.cpp                 |  2 +-
> > >  6 files changed, 18 insertions(+), 37 deletions(-)

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list