Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[desktop][drape] Black screen with new Qt 6.7 #7838

Open
vng opened this issue Apr 6, 2024 · 20 comments
Open

[desktop][drape] Black screen with new Qt 6.7 #7838

vng opened this issue Apr 6, 2024 · 20 comments
Labels
Desktop Desktop application Drape Drape OpenGL, Vulkan and Metal graphics rendering engine

Comments

@vng
Copy link
Member

vng commented Apr 6, 2024

After updating on Qt 6.7.
Qt 6.6.3 works fine.
Part of the init log, see "GLError: 1286"

LOG TID(1) INFO      1.12232 drape_frontend/visual_params.cpp:52 Init(): Visual scale = 2 ; Tile size = 1024 ; Resources = xhdpi
LOG TID(3) INFO      1.12317 drape_frontend/backend_renderer.cpp:724 Do(): Start routine.
LOG TID(3) INFO      1.12318 drape_frontend/backend_renderer.cpp:692 OnContextCreate(): On context create.
LOG TID(4) INFO      1.12402 drape_frontend/frontend_renderer.cpp:2401 Do(): Start routine.
LOG TID(4) INFO      1.12412 drape_frontend/frontend_renderer.cpp:2318 OnContextCreate(): On context create.
LOG TID(3) INFO      1.12845 drape/support_manager.cpp:35 Init(): Renderer = Apple M1 Pro | Api = OpenGLES3 | Version = 4.1 Metal - 88
LOG TID(4) INFO      1.12847 drape/gl_functions.cpp:1150 CheckGLError(): SrcPoint  drape/gl_functions.cpp:442 glClear():  GLError: 1286
LOG TID(3) INFO      1.12847 drape/support_manager.cpp:79 Init(): Max line width = 1 | Max texture size = 16384
LOG TID(4) INFO      1.12855 shaders/program_manager.cpp:68 InitForOpenGL(): VTF enabled
LOG TID(3) INFO      1.12864 platform/platform.cpp:215 GetFontNames(): Available font files: [10: 00_NotoNaskhArabic-Regular.ttf 00_NotoSansThai-Regular.ttf 00_NotoSerifDevanagari-Regular.ttf 01_dejavusans.ttf 02_droidsans-fallback.ttf 03_jomolhari-id-a3d.ttf 04_padauk.ttf 05_khmeros.ttf 06_code2000.ttf 07_roboto_medium.ttf ]
LOG TID(4) INFO      1.13033 drape/gl_functions.cpp:1150 CheckGLError(): SrcPoint  drape/gl_functions.cpp:442 glClear():  GLError: 1286
LOG TID(4) INFO      1.13041 drape/gl_functions.cpp:1150 CheckGLError(): SrcPoint  drape/gl_functions.cpp:442 glClear():  GLError: 1286
LOG TID(3) DEBUG     1.18301 drape/texture_manager.cpp:463 Init(): Patterns texture size = 512 512
LOG TID(3) DEBUG     1.18396 drape/texture_manager.cpp:480 Init(): Colors texture size = 64 64

@Ferenc- @renderexpert Maybe you have any ideas.

@vng vng added Desktop Desktop application Drape Drape OpenGL, Vulkan and Metal graphics rendering engine labels Apr 6, 2024
@vng vng changed the title [desktop] Black screen with new Qt 6.7 [desktop][drape] Black screen with new Qt 6.7 Apr 6, 2024
@biodranik
Copy link
Member

biodranik commented Apr 27, 2024

The workaround is to downgrade to Qt 6.6, here is how to do it on a Mac using brew:

brew uninstall qt
curl -o qt.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/0576ab588998abbcd8df5e4fec605fe5f5074c78/Formula/q/qt.rb
brew install qt.rb

Upd: to avoid automatic qt update, use:

brew pin qt

When the bug will be fixed:

brew unpin qt

@rtsisyk
Copy link
Member

rtsisyk commented Apr 27, 2024

Please put instructions into ./scripts/unix/install-qt-mac.sh

@biodranik
Copy link
Member

Good idea @rtsisyk! can you please help?

@AntonM030481
Copy link
Contributor

Confirm solution for my Apple M1 Pro.

@gerion0
Copy link
Contributor

gerion0 commented May 30, 2024

I have the same issue (with Qt 6.7.0, Wayland with Kwin 6.0.4.1).

Here is my log, when starting OMaps (it does not contain the above error):

I(1) 0.00000 qt/main.cpp:112 main(): Organic Maps 2024.05.30-20-d26f9231-dirty-Linux started, detected CPU cores: 16
I(1) 0.11748 platform/string_storage_base.cpp:24 StringStorageBase(): Settings path: /home/gerion/.config/OMaps/settings.ini
I(1) 0.14880 storage/storage.cpp:620 LoadCountriesFile(): Loaded countries list for version: 240429
I(1) 0.26223 search/processor.cpp:210 SetPreferredLocale(): New preferred locale: de
W(2) 0.26448 search/geocoder.cpp:735 CacheWorldLocalities(): Can't find World map file.
W(2) 0.26451 search/cities_boundaries_table.cpp:49 Load(): Can't find World map file.
W(2) 0.26452 search/processor.cpp:334 LoadCitiesBoundaries(): Can't load cities boundaries
I(1) 0.29540 map/framework.cpp:352 Framework(): System languages: de
W(1) 0.29553 power_management/power_manager.cpp:71 Load(): Cannot read power manager config file. Exception: /home/gerion/.config/OMaps/power_manager_config; READ; Datei oder Verzeichnis nicht gefunden
...
I(1) 0.30010 storage/storage.cpp:957 RegisterLocalFile(): Found file: World in directory:  with size: 47582931
I(1) 0.30010 storage/storage.cpp:957 RegisterLocalFile(): Found file: WorldCoasts in directory:  with size: 8581544
...
I(1) 0.32394 map/framework.cpp:138 RegisterMap(): Loaded World map, of version 240429
I(1) 0.32397 map/framework.cpp:138 RegisterMap(): Loaded WorldCoasts map, of version 240429
W(1) 0.32476 platform/qt_location_service.cpp:69 QtLocationService(): Failed to acquire QGeoPositionInfoSource from  geoclue2
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
I(1) 0.38787 qt_common/map_widget.cpp:320 initializeGL(): Vendor: AMD 
Renderer: AMD Radeon Graphics (radeonsi, rembrandt, LLVM 17.0.6, DRM 3.57, 6.8.9-gentoo-dist) 
Version: OpenGL ES 3.2 Mesa 24.0.6 
Shading language version:
 OpenGL ES GLSL ES 3.20 
Extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_filter_anisotropic GL_EXT_texture_compression_s3tc GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_EXT_draw_instanced GL_EXT_texture_sRGB_decode GL_OES_EGL_image GL_OES_depth_texture GL_AMD_performance_monitor GL_OES_packed_depth_stencil GL_EXT_texture_type_2_10_10_10_REV GL_NV_conditional_render GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_NV_pack_subimage GL_NV_texture_barrier GL_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_OES_viewport_array GL_ANGLE_pack_reverse_row_order GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_EXT_occlusion_query_boolean GL_EXT_robustness GL_EXT_texture_rg GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_APPLE_sync GL_EXT_draw_buffers GL_EXT_instanced_arrays GL_EXT_map_buffer_range GL_KHR_debug GL_KHR_robustness GL_KHR_texture_compression_astc_ldr GL_NV_generate_mipmap_sRGB GL_NV_pixel_buffer_object GL_OES_depth_texture_cube_map GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_color_buffer_float GL_EXT_debug_label GL_EXT_sRGB_write_control GL_EXT_separate_shader_objects GL_EXT_shader_group_vote GL_EXT_shader_implicit_conversions GL_EXT_shader_integer_mix GL_EXT_tessellation_point_size GL_EXT_tessellation_shader GL_ANDROID_extension_pack_es31a GL_EXT_base_instance GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_copy_image GL_EXT_draw_buffers_indexed GL_EXT_draw_elements_base_vertex GL_EXT_gpu_shader5 GL_EXT_polygon_offset_clamp GL_EXT_primitive_bounding_box GL_EXT_render_snorm GL_EXT_shader_io_blocks GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_EXT_texture_cube_map_array GL_EXT_texture_norm16 GL_EXT_texture_view GL_KHR_blend_equation_advanced GL_KHR_context_flush_control GL_KHR_robust_buffer_access_behavior GL_NV_image_formats GL_NV_shader_noperspective_interpolation GL_OES_copy_image GL_OES_draw_buffers_indexed GL_OES_draw_elements_base_vertex GL_OES_gpu_shader5 GL_OES_primitive_bounding_box GL_OES_sample_shading GL_OES_sample_variables GL_OES_shader_io_blocks GL_OES_shader_multisample_interpolation GL_OES_tessellation_point_size GL_OES_tessellation_shader GL_OES_texture_border_clamp GL_OES_texture_buffer GL_OES_texture_cube_map_array GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_OES_texture_view GL_EXT_blend_func_extended GL_EXT_buffer_storage GL_EXT_float_blend GL_EXT_geometry_point_size GL_EXT_geometry_shader GL_EXT_shader_samples_identical GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_RG8 GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_OES_EGL_image_external_essl3 GL_OES_geometry_point_size GL_OES_geometry_shader GL_OES_shader_image_atomic GL_EXT_clear_texture GL_EXT_clip_cull_distance GL_EXT_disjoint_timer_query GL_EXT_texture_compression_s3tc_srgb GL_EXT_window_rectangles GL_MESA_shader_integer_functions GL_EXT_clip_control GL_EXT_color_buffer_half_float GL_EXT_memory_object GL_EXT_memory_object_fd GL_EXT_semaphore GL_EXT_semaphore_fd GL_EXT_texture_compression_bptc GL_EXT_texture_mirror_clamp_to_edge GL_KHR_parallel_shader_compile GL_NV_alpha_to_coverage_dither_control GL_AMD_framebuffer_multisample_advanced GL_EXT_EGL_image_storage GL_EXT_texture_shadow_lod GL_INTEL_blackhole_render GL_MESA_framebuffer_flip_y GL_NV_compute_shader_derivatives GL_EXT_demote_to_helper_invocation GL_EXT_depth_clamp GL_EXT_texture_query_lod GL_MESA_sampler_objects GL_MESA_bgra GL_MESA_texture_const_bandwidth 
I(1) 0.38791 qt_common/map_widget.cpp:351 initializeGL(): OpenGL version is at least 3.0, enabling GLSL '#version 300 es'
I(1) 0.38834 drape_frontend/visual_params.cpp:52 Init(): Visual scale = 1 ; Tile size = 1024 ; Resources = mdpi
I(3) 0.38852 drape_frontend/backend_renderer.cpp:724 Do(): Start routine.
I(3) 0.38854 drape_frontend/backend_renderer.cpp:692 OnContextCreate(): On context create.
I(4) 0.38911 drape_frontend/frontend_renderer.cpp:2401 Do(): Start routine.
I(4) 0.38918 drape_frontend/frontend_renderer.cpp:2318 OnContextCreate(): On context create.
I(3) 0.39228 drape/support_manager.cpp:33 Init(): Renderer = AMD Radeon Graphics (radeonsi, rembrandt, LLVM 17.0.6, DRM 3.57, 6.8.9-gentoo-dist) | Api = OpenGLES3 | Version = OpenGL ES 3.2 Mesa 24.0.6
I(3) 0.39230 drape/support_manager.cpp:77 Init(): Max line width = 2048 | Max texture size = 16384
I(3) 0.39292 platform/platform.cpp:215 GetFontNames(): Available font files: [10: 00_NotoNaskhArabic-Regular.ttf 00_NotoSansThai-Regular.ttf 00_NotoSerifDevanagari-Regular.ttf 01_dejavusans.ttf 02_droidsans-fallback.ttf 03_jomolhari-id-a3d.ttf 04_padauk.ttf 05_khmeros.ttf 06_code2000.ttf 07_roboto_medium.ttf ]
I(4) 0.40111 shaders/program_manager.cpp:68 InitForOpenGL(): VTF enabled
I(2) 0.41292 search/processor.cpp:332 LoadCitiesBoundaries(): Loaded cities boundaries
W(3) 0.45664 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_tram-s
W(3) 0.45668 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_tram-m
W(3) 0.45669 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_bus-s
W(3) 0.45669 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_bus-m
W(3) 0.45670 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_ferry-s
W(3) 0.45670 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_ferry-m
W(3) 0.45671 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_cable_tram-s
W(3) 0.45671 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_cable_tram-m
W(3) 0.45672 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_aerial_lift-s
W(3) 0.45672 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_aerial_lift-m
W(3) 0.45673 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_funicular-s
W(3) 0.45673 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_funicular-m
W(3) 0.45674 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_trolleybus-s
W(3) 0.45674 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_trolleybus-m
W(3) 0.45674 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_air_service-s
W(3) 0.45675 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_air_service-m
W(3) 0.45675 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_water_service-s
W(3) 0.45675 drape/texture_manager.cpp:549 GetSymbolRegion(): Detected using of unknown symbol  transit_water_service-m
I(4) 5.88036 drape_frontend/frontend_renderer.cpp:2270 OnContextDestroy(): On context destroy.
I(3) 5.88446 drape_frontend/backend_renderer.cpp:705 OnContextDestroy(): On context destroy.
I(1) 5.91988 Organic Maps finished with code 0

Additionally, drape_tests segfaults. Here is the backtrace with GDB:

% gdb -- ./drape_tests
GNU gdb (Gentoo 14.2 vanilla) 14.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./drape_tests...
(gdb) run
Starting program: /home/gerion/src/organicmaps/build/drape_tests 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Running attribute_provides_tests.cpp::InitStreamsTest
OK
Test took 0 ms

Running attribute_provides_tests.cpp::InterleavedStreamTest
OK
Test took 0 ms

Running attribute_provides_tests.cpp::MixedStreamsTest
OK
Test took 0 ms

Running batcher_tests.cpp::BatchLists_Test

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ??? ()
#1  0x00005555557514cc in GLFunctions::glGenBuffer () at /home/gerion/src/organicmaps/drape/gl_functions.cpp:640
#2  0x00005555557603eb in dp::GPUBuffer::GPUBuffer
    (this=this@entry=0x555555891fe0, t=t@entry=dp::GPUBuffer::ElementBuffer, data=data@entry=0x7ffff284d010, elementSize=elementSize@entry=12 '\f', capacity=capacity@entry=12, batcherHash=batcherHash@entry=0) at /home/gerion/src/organicmaps/drape/gpu_buffer.cpp:43
#3  0x000055555574524a in make_unique_dp<dp::GPUBuffer, dp::GPUBuffer::Target&, void const*, unsigned char, unsigned int const&, unsigned long&> ()
    at /home/gerion/src/organicmaps/drape/pointers.hpp:66
#4  dp::DataBufferImpl<dp::GPUBuffer>::DataBufferImpl<dp::GPUBuffer::Target&, void const*, unsigned char, unsigned int const&, unsigned long&>
    (this=0x5555558922b0) at /home/gerion/src/organicmaps/drape/data_buffer_impl.hpp:21
#5  dp::GpuBufferImpl::GpuBufferImpl<dp::GPUBuffer::Target&, void const*, unsigned char, unsigned int const&, unsigned long&> (this=0x5555558922b0)
    at /home/gerion/src/organicmaps/drape/data_buffer_impl.hpp:89
#6  make_unique_dp<dp::GpuBufferImpl, dp::GPUBuffer::Target&, void const*, unsigned char, unsigned int const&, unsigned long&> ()
    at /home/gerion/src/organicmaps/drape/pointers.hpp:68
#7  dp::DataBuffer::MoveToGPU (this=0x555555892010, context=..., target=target@entry=dp::GPUBuffer::ElementBuffer, batcherHash=0)
    at /home/gerion/src/organicmaps/drape/data_buffer.cpp:28
#8  0x000055555578e755 in dp::VertexArrayBuffer::PreflushImpl (this=0x555555891a20, context=...)
    at /home/gerion/src/organicmaps/drape/vertex_array_buffer.cpp:155
#9  0x000055555578e877 in dp::VertexArrayBuffer::Preflush (this=<optimized out>, context=...)
    at /home/gerion/src/organicmaps/drape/vertex_array_buffer.cpp:146
#10 0x0000555555732a19 in operator() (bucket={...}, __closure=<optimized out>) at /home/gerion/src/organicmaps/drape/batcher.cpp:275
#11 std::for_each<std::_Rb_tree_iterator<std::pair<const dp::RenderState, std::unique_ptr<dp::RenderBucket, std::default_delete<dp::RenderBucket> > > >, dp::Batcher::Flush(ref_ptr<dp::GraphicsContext>)::<lambda(std::map<dp::RenderState, std::unique_ptr<dp::RenderBucket, std::default_delete<dp::RenderBucket> > >::value_type&)> > (__f=..., __last=Python Exception <class 'gdb.error'>: value has been optimized out
, __first={...}) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_algo.h:3833
#12 dp::Batcher::Flush (this=this@entry=0x7fffffffbdc0, context=...) at /home/gerion/src/organicmaps/drape/batcher.cpp:272
#13 0x0000555555732ac8 in dp::Batcher::EndSession (this=this@entry=0x7fffffffbdc0, context=...) at /home/gerion/src/organicmaps/drape/batcher.cpp:209
#14 0x00005555555face1 in (anonymous namespace)::BatcherExpectations::RunTest<UnitTest_BatchLists_Test()::<lambda(dp::Batcher*, const dp::RenderState&, ref_ptr<dp::AttributeProvider>)> >
    (vertexCount=12, vertexComponentCount=3 '\003', indexCount=12, fn=<synthetic pointer>..., indexes=<optimized out>, vertexes=0x7fffffffbe30, this=0x7fffffffbc68) at /home/gerion/src/organicmaps/drape/drape_tests/batcher_tests.cpp:86
#15 UnitTest_BatchLists_Test () at /home/gerion/src/organicmaps/drape/drape_tests/batcher_tests.cpp:152
#16 0x00005555556b1d98 in std::function<void ()>::operator()() const (this=0x5555558571f0 <g_testRegister_BatchLists_Test+16>)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#17 testing::main (argc=<optimized out>, argv=<optimized out>) at /home/gerion/src/organicmaps/testing/testingmain.cpp:246
#18 0x00007ffff5664f2a in ??? () at /usr/lib64/libc.so.6
#19 0x00007ffff5664fe5 in __libc_start_main () at /usr/lib64/libc.so.6
#20 0x00005555555ec431 in _start ()
(gdb)

The app reacts normally (when I zoom in, it offers to download the map, it displays all the buttons). It's just the map that is completely black.

@gerion0
Copy link
Contributor

gerion0 commented May 30, 2024

BTW:

I(1) 0.38791 qt_common/map_widget.cpp:351 initializeGL(): OpenGL version is at least 3.0, enabling GLSL '#version 300 es'

Here, the renderer can take a different path:

    if (context()->format().version() < qMakePair(3, 0))
    {
      LOG(LINFO, ("OpenGL ES version is below 3.0, taking the OpenGL ES 2.0 path"));
      m_apiOpenGLES3 = false;

      constexpr const char* requiredExtensions[3] =
        { "GL_EXT_map_buffer_range", "GL_OES_mapbuffer", "GL_OES_vertex_array_object" };
      for (auto & requiredExtension : requiredExtensions)
      {
        if (context()->hasExtension(QByteArray::fromStdString(requiredExtension)))
          LOG(LDEBUG, ("Found OpenGL ES 2.0 extension: ", requiredExtension));
        else
          LOG(LCRITICAL, ("A required OpenGL ES 2.0 extension is missing:", requiredExtension));
      }
      fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
      fmt.setVersion(2, 0);
    }
    else
    {
      LOG(LINFO, ("OpenGL version is at least 3.0, enabling GLSL '#version 300 es'"));
      m_apiOpenGLES3 = true;
      fmt.setVersion(3, 0);
    }

I changed the condition in the if to be always true, so the renderer took the OpenGL ES 2.0 path, but it didn't helped.

@renderexpert
Copy link
Contributor

Qt 6 has new (more native) graphics API support. OM still uses Qt 5 style rendering. I think it's a question of time when it stops working completely in Qt 6.

@biodranik
Copy link
Member

@renderexpert this regression started specifically from Qt 6.7, lower versions were working fine.

What is a "Qt6" graphics approach? Are there any Qt5 migration examples or documentation?

@renderexpert
Copy link
Contributor

@biodranik I got it that it was for Qt 6.7 only. What I meant that in time such bugs will appear more and more until eventually older approach is deprecated.
What you look for is Qt RHI, please refer to the official Qt Docs about it.

Some example from the blog:
https://www.qt.io/blog/graphics-in-qt-6.0-qrhi-qt-quick-qt-quick-3d

"In general everything that worked in Qt 5 can be expected to work in Qt 6, with the exception of deprecated and now-removed functionality, such as all the Qt 4 era classes with the QGL prefix (most notably, QGLWidget). If a Qt 5 application renders its own OpenGL content into a QWindow, or uses QOpenGLWidget, it will all function as before. (in the worst case with some very minor migration steps, e.g. having to update the application project file due to QOpenGLWidget moving to its own module openglwidgets)."

@gerion0
Copy link
Contributor

gerion0 commented Jun 17, 2024

Is there another workaround than downgrading? So - if there are multiple rendering backends - maybe it is possible to switch to another one (pure software rendering for example), even if it's really slow.

@biodranik
Copy link
Member

It would be great to investigate Qt6 OpenGL examples and try to rewrite our current implementation. Or find a source of this nasty bug and fix it...

CC @Ferenc-

@Ferenc-
Copy link
Contributor

Ferenc- commented Jun 19, 2024

It would be great to investigate Qt6 OpenGL examples and try to rewrite our current implementation. Or find a source of this nasty bug and fix it...

CC @Ferenc-

The source of this nasty bug appears to be, that while the usual first colour pass made by by drape via QOpenGLContext renders the map textures and everything flawlessly, out of nowhere comes two more passes, which ruin our day.

  1. The first extra pass ( #2) is aware of our QOpenGLContext, but ends up not really doing much, in correlation of a high severity Incorrect API Use No vertex buffer bound to attribute 0: a_position (buffer slot 0) at draw! This can be caused by deleting a buffer early, before all draws using it have been made.
    The backtrace is this:
qt::common::MapWidget::paintGL() line 400
QOpenGLWidget::currentTargetBuffer() const
QWidget::event(QEvent*)
QApplicationPrivate::notify_helper(QObject*, QEvent*)
QCoreApplication::notifyInternal2(QObject*, QEvent*)
QWidgetPrivate::sendPaintEvent(QRegion const&)
QWidgetRepaintManager::paintAndFlush()
QWidget::event(QEvent*)
QApplicationPrivate::notify_helper(QObject*, QEvent*)
QCoreApplication::notifyInternal2(QObject*, QEvent*)
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority()
g_main_context_prepare
g_hmac_get_string
g_main_context_iteration
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
QCoreApplication::exec()
main line 243
__libc_start_call_main
__libc_start_main_alias_2
_start

A least this does not ruin the original textures. After this pass, drape still renders the map perfectly:

std::__uniq_ptr_impl<dp::VertexArrayBufferImpl, std::default_delete<dp::VertexArrayBufferImpl> >::_M_ptr() const line 193
dp::RenderBucket::Render(ref_ptr<dp::GraphicsContext>, bool) line 127
df::RenderGroup::Render(ref_ptr<dp::GraphicsContext>, ref_ptr<gpu::ProgramManager>, ScreenBase const&, df::FrameValues const&, ref_ptr<df::DebugRectRenderer>) line 117
df::FrontendRenderer::Render2dLayer(ScreenBase const&) line 1541
df::FrontendRenderer::RenderScene(ScreenBase const&, bool) line 1432
ref_ptr<dp::GraphicsContext>::operator->() const line 127
std::__atomic_base<bool>::load(std::memory_order) const line 501
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() line 1068
std::_V2::error_category::_M_message[abi:cxx11](int) const
start_thread
__GI___clone
  1. But then comes the second extra pass ( #3) which is completely oblivious of our QOpenGLContext , renders by using QRhi instead, comes out of nowhere, and clears the texture pure black with a glClearColor(0.00, 0.00, 0.00, 1.00) ; glCelar(GL_COLOR_BUFFER_BIT); the backtrace leading to this is:
QRhiGles2InitParams::QRhiGles2InitParams()
QRhiGles2InitParams::QRhiGles2InitParams()
QRhi::endFrame(QRhiSwapChain*, QFlags<QRhi::EndFrameFlag>)
QBackingStore::beginPaint(QRegion const&)
QPlatformBackingStore::rhiFlush(QWindow*, double, QRegion const&, QPoint const&, QPlatformTextureList*, bool)
QXcbNativeInterfaceHandler::QXcbNativeInterfaceHandler(QXcbNativeInterface*)
QWidgetRepaintManager::flush(QWidget*, QRegion const&, QPlatformTextureList*)
QWidgetRepaintManager::flush()
QWidgetRepaintManager::paintAndFlush()
QWidget::event(QEvent*)
QApplicationPrivate::notify_helper(QObject*, QEvent*)
QCoreApplication::notifyInternal2(QObject*, QEvent*)
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority()
g_main_context_prepare
g_hmac_get_string
g_main_context_iteration
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
QCoreApplication::exec()
main line 243
__libc_start_call_main
__libc_start_main_alias_2
_start

@biodranik
Copy link
Member

Thanks for the investigation! It looks related to some QWindow/QRhi modifications in Qt 6.7:

Could it be that the #2 extra pass (or its consequences) caused the #3 extra pass? Is it possible to compare the behavior with Qt 6.6?

Maybe it would be feasible to find what causes the error below by enabling OpenGL debugging?

Incorrect API Use No vertex buffer bound to attribute 0: a_position (buffer slot 0) at draw! This can be caused by deleting a buffer early, before all draws using it have been made.

@Osyotr
Copy link
Contributor

Osyotr commented Jun 21, 2024

@Ferenc- probably not related to the issue, but I've noticed that MapWidget does not call QOpenGLWidget::event which does quite a few things to keep internal QRhi updated (https://github.com/qt/qtbase/blob/6.7.2/src/openglwidgets/qopenglwidget.cpp#L1696-L1739):

return QWidget::event(event);

@biodranik
Copy link
Member

@Osyotr good catch! Although it doesn't fix the black screen on the Mac. Do you have the same issue on Windows with Qt 6.7?

@Osyotr
Copy link
Contributor

Osyotr commented Jun 22, 2024

Yeah though I have other graphical issues as well (not related to Qt 6.7; probably some synchronization issues).

@Ferenc-
Copy link
Contributor

Ferenc- commented Jun 30, 2024

Surprisingly, gutting out map_widget and replacing the usage of the QtOGLContextFactory with a trivial OpenGL graphics pipeline, works. Which to me hints at an issue around the dp::GraphicsContextFactory interface.

@biodranik
Copy link
Member

@Ferenc- do you have a branch with your experiments?

@tazz4843
Copy link

tazz4843 commented Oct 4, 2024

I have multiple problems related to this issue. Running on Arch Linux with Plasma 6.1.5, Mesa 24.2.3.

My desktop runs an Arc A770 + 13700K so is fully Intel GPUs. Running off the Arc I get a mostly blank image, with a tiny slice of a solid color, but no actual detail. The map functions normally, as other users have stated.
image

Running through a software renderer I get a fully black screen as with other users above.

drape_tests passes regardless of software or hardware rendering being chosen.

@biodranik
Copy link
Member

Looks like the workaround for Mac brew above doesn't work due to the wrong icu version (it was updated in brew and should also be downgraded to work with older Qt version), CMake configure fails without working uic binary:

➜  omim git:(master) ✗ /opt/homebrew/share/qt/libexec/uic -h
dyld[1274]: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib
  Referenced from: <67164ED2-8AA5-33B4-9D38-4D285156DC98> /opt/homebrew/Cellar/qt/6.6.2_2/lib/QtCore.framework/Versions/A/QtCore
  Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib' (no such file), '/opt/homebrew/opt/icu4c/lib/libicui18n.74.dylib' (no such file)
[1]    1274 abort      /opt/homebrew/share/qt/libexec/uic -h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Desktop Desktop application Drape Drape OpenGL, Vulkan and Metal graphics rendering engine
Projects
None yet
Development

No branches or pull requests

9 participants