How is partial draw or swap implemented?

47 views
Skip to first unread message

Rahul Patel

unread,
Jul 2, 2024, 7:24:12 PMJul 2
to Graphics-dev
Hello,
Is there any documentation on how partial draw or swap implemented in chromium? specially what is accounted to calculate the damage_rect?

My understanding is that chromium calculate damage if there are any any changes happen across the layers and it doesn't consider the age of back_buffer i.e how many frames old the current back buffer is?

For example - Based on the below code reference it looks for libAngle we do consider the age of back buffer but not for the base chromium.


Is there any plan to support it for other platform? or any documents around partial draw would be helpful. 

 

Thanks,
 Rahul

Sunny Sachanandani

unread,
Jul 8, 2024, 6:05:04 PM (14 days ago) Jul 8
to Rahul Patel, Graphics-dev
How partial swap is implemented is up to each SkiaOutputDevice implementation. The partial swap rect is specified by `sub_buffer_rect` passed in the `OutputSurfaceFrame` parameter passed to `SkiaOutputDevice::Present`.

Some platforms (Mac, ChromeOS) will use SkiaOutputDeviceBufferQueue to manage back buffers manually and track damage across frames to ensure that the correct area is redrawn. Other implementations like SkiaOutputDeviceDComp on Windows will rely on native swap chain / surface APIs that do damage tracking internally instead of manually managing back buffers (e.g. IDXGISwapChain1::Present1).

If you seek to implement partial swap support and manage buffers individually, adapting SkiaOutputDeviceBufferQueue to your use case will be your best option.

Kyle Charbonneau

unread,
Jul 9, 2024, 9:22:37 AM (13 days ago) Jul 9
to Sunny Sachanandani, Rahul Patel, Graphics-dev
Some platforms (Mac, ChromeOS) will use SkiaOutputDeviceBufferQueue to manage back buffers manually and track damage across frames to ensure that the correct area is redrawn

It's worth noting that SkiaOutputDeviceBufferQueue doesn't actually track buffers or damage anymore. The code still exists but it's unused and the functionality has moved to BufferQueue. SkiaOutputDeviceBufferQueue will have this duplicate code removed after M127 hits stable.

Kyle
Reply all
Reply to author
Forward
0 new messages