Bug 458407 - Opening or importing SVG results in unresponsive program
Summary: Opening or importing SVG results in unresponsive program
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (other bugs)
Version First Reported In: 5.1.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-28 05:57 UTC by lamashtu17
Modified: 2024-11-05 12:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
SVG file causing the issue (1022.96 KB, image/svg+xml)
2022-08-28 05:57 UTC, lamashtu17
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lamashtu17 2022-08-28 05:57:53 UTC
Created attachment 151652 [details]
SVG file causing the issue

SUMMARY

Opening or importing as a layer the attached SVG file causes the program to become unresponsive, and begin utilizing up to 10G RAM, before dropping to 3.5G and then back again.  Control is never returned and Krita must be forcibly terminated.



STEPS TO REPRODUCE
1. Open file (or create a new file and import file as a layer)
2. Press enter to confirm PPI

OBSERVED RESULT
Krita indicates there is a vector layer in the GUI, but displays only the colors indicating transparency.  RAM usage increases to 10 gigs, will drop to between 3.5 and 6 gigs, and this cycle will continue.  Control will not be returned to the user.  CPU usage is fairly low (10-13% per Windows task manager).

EXPECTED RESULT
SVG is loaded and displayed, work can begin.

SOFTWARE/OS VERSIONS
Windows: 10 21H2

ADDITIONAL INFORMATION
Krita

 Version: 5.1.0
 Installation type: installer / portable package
 Hidpi: false

Qt

  Version (compiled): 5.12.12
  Version (loaded): 5.12.12

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.19044
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

Locale

  Languages: en_US
  C locale: C
  QLocale current: en
  QLocale system: en
  QTextCodec for locale: UTF-8
  Process ACP: 65001 (UTF-8)
  System locale default ACP: 1252  (ANSI - Latin I)

OpenGL Info
 
  Vendor:  "Google Inc. (NVIDIA)" 
  Renderer:  "ANGLE (NVIDIA, NVIDIA GeForce GTX 980 Ti Direct3D11 vs_5_0 ps_5_0, D3D11-30.0.15.1123)" 
  Version:  "OpenGL ES 3.0.0 (ANGLE 2.1.0 git hash: f2280c0c5f93+krita_qt5.12.12)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0 git hash: f2280c0c5f93+krita_qt5.12.12)" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions false 
     is OpenGL ES: true 
  supportsBufferMapping: true 
  supportsBufferInvalidation: false 
  forceDisableTextureBuffers: true 
  Extensions: 
     "GL_ANGLE_texture_multisample" 
     "GL_EXT_map_buffer_range" 
     "GL_EXT_color_buffer_half_float" 
     "GL_CHROMIUM_bind_uniform_location" 
     "GL_NV_EGL_stream_consumer_external" 
     "GL_CHROMIUM_lose_context" 
     "GL_OVR_multiview" 
     "GL_ANGLE_client_arrays" 
     "GL_ANGLE_multi_draw" 
     "GL_ANGLE_get_tex_level_parameter" 
     "GL_ANGLE_copy_texture_3d" 
     "GL_EXT_texture_format_BGRA8888" 
     "GL_OES_compressed_EAC_R11_signed_texture" 
     "GL_CHROMIUM_copy_texture" 
     "GL_ANGLE_robust_client_memory" 
     "GL_OES_get_program_binary" 
     "GL_OES_texture_border_clamp" 
     "GL_EXT_texture_filter_anisotropic" 
     "GL_ANGLE_base_vertex_base_instance_shader_builtin" 
     "GL_OES_depth24" 
     "GL_ANGLE_framebuffer_multisample" 
     "GL_EXT_blend_minmax" 
     "GL_OVR_multiview2" 
     "GL_EXT_shader_texture_lod" 
     "GL_EXT_sRGB" 
     "GL_EXT_draw_buffers_indexed" 
     "GL_OES_mapbuffer" 
     "GL_CHROMIUM_sync_query" 
     "GL_EXT_debug_label" 
     "GL_EXT_draw_elements_base_vertex" 
     "GL_OES_draw_elements_base_vertex" 
     "GL_EXT_EGL_image_external_wrap_modes" 
     "GL_NV_fence" 
     "GL_OES_packed_depth_stencil" 
     "GL_EXT_draw_buffers" 
     "GL_EXT_discard_framebuffer" 
     "GL_OES_draw_buffers_indexed" 
     "GL_EXT_unpack_subimage" 
     "GL_OES_compressed_EAC_R11_unsigned_texture" 
     "GL_AMD_performance_monitor" 
     "GL_EXT_robustness" 
     "GL_NV_pixel_buffer_object" 
     "GL_WEBGL_video_texture" 
     "GL_OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture" 
     "GL_OES_texture_stencil8" 
     "GL_ANGLE_provoking_vertex" 
     "GL_CHROMIUM_copy_compressed_texture" 
     "GL_OES_compressed_ETC2_RGBA8_texture" 
     "GL_CHROMIUM_bind_generates_resource" 
     "GL_ANGLE_request_extension" 
     "GL_ANGLE_texture_usage" 
     "GL_OES_fbo_render_mipmap" 
     "GL_OES_texture_half_float_linear" 
     "GL_ANGLE_get_serialized_context_string" 
     "GL_ANGLE_framebuffer_blit" 
     "GL_OES_EGL_image_external" 
     "GL_ANGLE_instanced_arrays" 
     "GL_OES_standard_derivatives" 
     "GL_NV_framebuffer_blit" 
     "GL_ANGLE_lossy_etc_decode" 
     "GL_EXT_texture_rg" 
     "GL_ANGLE_pack_reverse_row_order" 
     "GL_ANGLE_translated_shader_source" 
     "GL_EXT_debug_marker" 
     "GL_EXT_texture_compression_rgtc" 
     "GL_OES_texture_float_linear" 
     "GL_KHR_parallel_shader_compile" 
     "GL_OES_compressed_EAC_RG11_unsigned_texture" 
     "" 
     "GL_OES_depth32" 
     "GL_EXT_multisampled_render_to_texture" 
     "GL_OES_texture_half_float" 
     "GL_OES_EGL_image" 
     "GL_EXT_frag_depth" 
     "GL_EXT_texture_compression_s3tc_srgb" 
     "GL_EXT_texture_type_2_10_10_10_REV" 
     "GL_EXT_blend_func_extended" 
     "GL_EXT_occlusion_query_boolean" 
     "GL_OES_compressed_EAC_RG11_signed_texture" 
     "GL_ANGLE_memory_size" 
     "GL_EXT_disjoint_timer_query" 
     "GL_OES_rgb8_rgba8" 
     "GL_EXT_read_format_bgra" 
     "GL_EXT_instanced_arrays" 
     "GL_OES_surfaceless_context" 
     "GL_EXT_texture_compression_dxt1" 
     "GL_OES_texture_float" 
     "GL_OES_vertex_array_object" 
     "GL_OES_compressed_ETC2_RGB8_texture" 
     "GL_OES_texture_npot" 
     "GL_EXT_multi_draw_indirect" 
     "GL_OES_compressed_ETC2_sRGB8_texture" 
     "GL_ANGLE_texture_compression_dxt3" 
     "GL_ANGLE_multiview_multisample" 
     "GL_ANGLE_program_cache_control" 
     "GL_ANGLE_texture_compression_dxt5" 
     "GL_OES_element_index_uint" 
     "GL_OES_compressed_ETC2_punchthroughA_RGBA8_texture" 
     "GL_ANGLE_base_vertex_base_instance" 
     "GL_OES_EGL_image_external_essl3" 
     "GL_EXT_texture_compression_bptc" 
     "GL_EXT_texture_storage" 
     "GL_EXT_clip_control" 
     "GL_ANGLE_depth_texture" 
     "GL_EXT_color_buffer_float" 
     "GL_NV_pack_subimage" 
     "GL_OES_compressed_ETC2_sRGB8_alpha8_texture" 
     "GL_EXT_float_blend" 
     "GL_EXT_texture_norm16" 
     "GL_KHR_debug" 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsAngleD3D11: true 
  isQtPreferAngle: true 

useBufferInvalidation (config option): false


Hardware Information

  GPU Acceleration: auto
  Memory: 65402 Mb
  Number of Cores: 8
  Swap Location: C:/Users/<user>/AppData/Local/Temp
  Built for: sse2
  Base instruction set: sse2
  Supported instruction sets: fma3+avx2 avx2 fma3+avx avx fma4 fma3+sse4.2 sse4.2 sse4.1 ssse3 sse3 sse2 

Current Settings

  Current Swap Location: C:/Users/<user>/AppData/Local/Temp
  Current Swap Location writable: true
  Undo Enabled: true
  Undo Stack Limit: 90
  Use OpenGL: true
  Use OpenGL Texture Buffer: true
  Disable Vector Optimizations: false
  Disable AVX Optimizations: false
  Canvas State: OPENGL_SUCCESS
  Autosave Interval: 300
  Use Backup Files: true
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Backup Location writable: false
  Use Win8 Pointer Input: false
  Use RightMiddleTabletButton Workaround: false
  Levels of Detail Enabled: false
  Use Zip64: false


Display Information
Number of screens: 2
	Screen: 0
		Name: \\.\DISPLAY2
		Depth: 32
		Scale: 1
		Physical DPI108.796
		Logical DPI96
		Physical Size: 598, 336
		Position: 0, 0
		Resolution in pixels: 2560x1440
		Manufacturer: 
		Model: 
		Refresh Rate: 165
	Screen: 1
		Name: \\.\DISPLAY1
		Depth: 32
		Scale: 1
		Physical DPI108.888
		Logical DPI96
		Physical Size: 597, 336
		Position: -2560, 0
		Resolution in pixels: 2560x1440
		Manufacturer: 
		Model: 
		Refresh Rate: 165
Comment 1 amyspark 2022-08-29 13:21:41 UTC
Confirming on commit 785619b3ca. ETW tracing confirms a full repaint job is queued and keeps being repeatedly executed in a separate single thread.
Comment 2 amyspark 2022-08-29 13:45:22 UTC
UPD: a full canvas re-render is scheduled for every object in the SVG, it seems. A random global pause under the debugger shows KisShapeLayerCanvas::repaint() has up to 24 full re-renders scheduled.
Comment 3 sh_zam 2022-08-31 08:18:58 UTC
Seems related to some of the other bugs related to SVGs. Let's see -- assigning this to myself.
Comment 4 sh_zam 2022-08-31 11:36:56 UTC
This seems to happen due to the existence of masks in SVG -- they force Krita to re-render the entire hierarchy over and over.
Comment 5 Bug Janitor Service 2024-11-05 11:38:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2265
Comment 6 Dmitry Kazakov 2024-11-05 12:23:47 UTC
Git commit d01ed5efaab62215901e933d6dabd1638e01aea0 by Dmitry Kazakov.
Committed on 05/11/2024 at 12:23.
Pushed by dkazakov into branch 'master'.

Fix too slow rendering of SVG with clip masks

When rendering clipping masks we need to allocate actual storage
for the shape pixels. Hence we should clip the rendering area by
the size of the toplevel painter.

M  +6    -2    libs/flake/KoShapeManager.cpp

https://invent.kde.org/graphics/krita/-/commit/d01ed5efaab62215901e933d6dabd1638e01aea0