<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>267291</bug_id>
          
          <creation_ts>2024-01-09 11:46:33 -0800</creation_ts>
          <short_desc>Umbrella: Using Canvas image sources between different canvases and canvas types is slow</short_desc>
          <delta_ts>2026-02-26 10:23:04 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Canvas</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>234920</dependson>
    
    <dependson>267290</dependson>
    
    <dependson>286707</dependson>
    
    <dependson>294602</dependson>
    
    <dependson>301925</dependson>
    
    <dependson>266215</dependson>
    
    <dependson>275100</dependson>
    
    <dependson>297852</dependson>
    
    <dependson>300088</dependson>
    
    <dependson>301914</dependson>
    
    <dependson>302527</dependson>
    
    <dependson>305048</dependson>
    
    <dependson>308705</dependson>
    
    <dependson>308706</dependson>
    
    <dependson>308725</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kimmo Kinnunen">kkinnunen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ciprian.grigor</cc>
    
    <cc>dino</cc>
    
    <cc>karlcow</cc>
    
    <cc>kevmoo</cc>
    
    <cc>kyle.finlinson+bugzilla</cc>
    
    <cc>mwyrzykowski</cc>
    
    <cc>paul.neave</cc>
    
    <cc>rafi.apollo</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>simontaylor1</cc>
    
    <cc>stillonline</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>yegor.jbanov</cc>
    
    <cc>yura.yaroshevich</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2003892</commentid>
    <comment_count>0</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2024-01-09 11:46:33 -0800</bug_when>
    <thetext>Umbrella: Using Canvas image sources between different canvases and canvas types is slow

- Video
- Offscreen canvas
- WebGL 
- 2DContext
- Bitmaprenderer</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2004751</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-01-12 12:16:34 -0800</bug_when>
    <thetext>&lt;rdar://problem/120916864&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2032497</commentid>
    <comment_count>2</comment_count>
    <who name="Yegor">yegor.jbanov</who>
    <bug_when>2024-05-01 09:39:06 -0700</bug_when>
    <thetext>Here&apos;s a couple of repro cases:

Plain JS repro: https://jsfiddle.net/yjbanov/0vurdt42/8/

Flutter Web repro: https://image-bitmap-stress-test.web.app/

Fixing this will help us make Flutter web apps run much smoother in Safari and consume less memory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2081546</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2024-12-13 10:26:45 -0800</bug_when>
    <thetext>https://jsfiddle.net/yjbanov/0vurdt42/8/ seems fast but https://image-bitmap-stress-test.web.app/ is still slower in Safari than Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2081595</commentid>
    <comment_count>4</comment_count>
    <who name="Yegor">yegor.jbanov</who>
    <bug_when>2024-12-13 12:38:29 -0800</bug_when>
    <thetext>This is exciting! We&apos;ll kick the tires in the newest Safari. This variant is still drastically slower compared to Chromium-based browsers:

https://jsfiddle.net/6e4dz57v/4/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2081596</commentid>
    <comment_count>5</comment_count>
    <who name="Yegor">yegor.jbanov</who>
    <bug_when>2024-12-13 12:38:59 -0800</bug_when>
    <thetext>The difference may be in transferToImageBitmap vs createImageBitmap</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2121780</commentid>
    <comment_count>6</comment_count>
    <who name="Yury Yarashevich">yura.yaroshevich</who>
    <bug_when>2025-06-04 14:10:48 -0700</bug_when>
    <thetext>I&apos;d like to contribute two additional demos that cover scenarios not currently represented in this ticket:
1. The efficiency of `HTMLCanvasElement.captureStream` implementation: https://github.com/mstyura/webkit-issues/blob/main/video-transform-pipeline/README.md#mirror-4k-canvas-to-video-element-via-htmlcanvaselementcapturestream
2. The efficiency of `VideoTrackGenerator` when produce frames via `new VideoFrame(offscreenCanvas)`: https://github.com/mstyura/webkit-issues/blob/main/video-transform-pipeline/README.md#produce-a-mediastreamtrack-via-videotrackgenerator-from-an-offscreencanvas-rendered-in-a-worker</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2138774</commentid>
    <comment_count>7</comment_count>
    <who name="Simon Taylor">simontaylor1</who>
    <bug_when>2025-08-26 02:22:36 -0700</bug_when>
    <thetext>One thing I&apos;ve noticed in the WebKit source is that I believe any use of IOSurfaces looks to set kIOSurfaceCacheMode to write combined:
https://github.com/WebKit/WebKit/blob/46f0a4c36be821652d1582cbfabe5e51cfee5176/Source/WebCore/platform/graphics/cocoa/IOSurface.mm#L200

This is the default in AVAssetWriter too and in a separate project I discovered reading those buffers on the CPU had a large performance penalty (10x or more).

There&apos;s a comment in iOS SDK the IOSurfaceTypes.h header that says this:

/*
** Note: Write-combined memory is optimized for resources that the CPU writes into, but never reads. 
** On some implementations, writes may bypass caches, which avoids cache pollution. Read actions may perform very poorly.
** Applications should investigate changing the cache mode only if writing to normally cached buffers is known to cause
** performance issues due to cache pollution, as write-combined memory can have surprising performance pitfalls.
*/

Perhaps worth someone at Apple reviewing the reasoning for setting write combined here and if the benefit is worth the penalty for CPU access.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>