tree: fe3632ede2612ed30100c55e799f08e5671b73db [path history] [tgz]
  1. ahardwarebuffer_image_backing_factory.cc
  2. ahardwarebuffer_image_backing_factory.h
  3. ahardwarebuffer_image_backing_factory_unittest.cc
  4. android_image_backing.cc
  5. android_image_backing.h
  6. android_video_image_backing.cc
  7. android_video_image_backing.h
  8. angle_vulkan_image_backing.cc
  9. angle_vulkan_image_backing.h
  10. angle_vulkan_image_backing_factory.cc
  11. angle_vulkan_image_backing_factory.h
  12. angle_vulkan_image_backing_factory_unittest.cc
  13. compound_image_backing.cc
  14. compound_image_backing.h
  15. compound_image_backing_unittest.cc
  16. copy_image_plane.cc
  17. copy_image_plane.h
  18. cpu_readback_upload_copy_strategy.cc
  19. cpu_readback_upload_copy_strategy.h
  20. d3d_image_backing.cc
  21. d3d_image_backing.h
  22. d3d_image_backing_factory.cc
  23. d3d_image_backing_factory.h
  24. d3d_image_backing_factory_unittest.cc
  25. d3d_image_representation.cc
  26. d3d_image_representation.h
  27. d3d_image_utils.cc
  28. d3d_image_utils.h
  29. dawn_ahardwarebuffer_image_representation.cc
  30. dawn_ahardwarebuffer_image_representation.h
  31. dawn_egl_image_representation.cc
  32. dawn_egl_image_representation.h
  33. dawn_fallback_image_representation.cc
  34. dawn_fallback_image_representation.h
  35. dawn_gl_texture_representation.cc
  36. dawn_gl_texture_representation.h
  37. dawn_image_representation_unittest_common.cc
  38. dawn_image_representation_unittest_common.h
  39. dawn_ozone_image_representation.cc
  40. dawn_ozone_image_representation.h
  41. dawn_shared_texture_cache.cc
  42. dawn_shared_texture_cache.h
  43. dcomp_image_backing_factory.cc
  44. dcomp_image_backing_factory.h
  45. dcomp_image_backing_factory_unittest.cc
  46. dcomp_surface_image_backing.cc
  47. dcomp_surface_image_backing.h
  48. dcomp_surface_image_representation.cc
  49. dcomp_surface_image_representation.h
  50. DEPS
  51. dxgi_swap_chain_image_backing.cc
  52. dxgi_swap_chain_image_backing.h
  53. dxgi_swap_chain_image_representation.cc
  54. dxgi_swap_chain_image_representation.h
  55. egl_image_backing.cc
  56. egl_image_backing.h
  57. egl_image_backing_factory.cc
  58. egl_image_backing_factory.h
  59. egl_image_backing_factory_unittest.cc
  60. external_vk_image_backing.cc
  61. external_vk_image_backing.h
  62. external_vk_image_backing_factory.cc
  63. external_vk_image_backing_factory.h
  64. external_vk_image_backing_factory_unittest.cc
  65. external_vk_image_dawn_representation.cc
  66. external_vk_image_dawn_representation.h
  67. external_vk_image_gl_representation.cc
  68. external_vk_image_gl_representation.h
  69. external_vk_image_overlay_representation.cc
  70. external_vk_image_overlay_representation.h
  71. external_vk_image_skia_representation.cc
  72. external_vk_image_skia_representation.h
  73. gl_common_image_backing_factory.cc
  74. gl_common_image_backing_factory.h
  75. gl_ozone_image_representation.cc
  76. gl_ozone_image_representation.h
  77. gl_repack_utils.cc
  78. gl_repack_utils.h
  79. gl_repack_utils_unittest.cc
  80. gl_texture_android_image_representation.cc
  81. gl_texture_android_image_representation.h
  82. gl_texture_holder.cc
  83. gl_texture_holder.h
  84. gl_texture_image_backing.cc
  85. gl_texture_image_backing.h
  86. gl_texture_image_backing_factory.cc
  87. gl_texture_image_backing_factory.h
  88. gl_texture_image_backing_factory_unittest.cc
  89. gl_texture_passthrough_android_image_representation.cc
  90. gl_texture_passthrough_android_image_representation.h
  91. gl_texture_passthrough_fallback_image_representation.cc
  92. gl_texture_passthrough_fallback_image_representation.h
  93. iosurface_image_backing.h
  94. iosurface_image_backing.mm
  95. iosurface_image_backing_factory.h
  96. iosurface_image_backing_factory.mm
  97. iosurface_image_backing_factory_unittest.cc
  98. ozone_image_backing.cc
  99. ozone_image_backing.h
  100. ozone_image_backing_factory.cc
  101. ozone_image_backing_factory.h
  102. ozone_image_backing_factory_unittest.cc
  103. ozone_image_gl_textures_holder.cc
  104. ozone_image_gl_textures_holder.h
  105. raw_draw_image_backing.cc
  106. raw_draw_image_backing.h
  107. raw_draw_image_backing_factory.cc
  108. raw_draw_image_backing_factory.h
  109. README.md
  110. shared_image_backing.cc
  111. shared_image_backing.h
  112. shared_image_backing_factory.cc
  113. shared_image_backing_factory.h
  114. shared_image_copy_manager.cc
  115. shared_image_copy_manager.h
  116. shared_image_copy_manager_unittest.cc
  117. shared_image_copy_strategy.h
  118. shared_image_factory.cc
  119. shared_image_factory.h
  120. shared_image_factory_unittest.cc
  121. shared_image_format_service_utils.cc
  122. shared_image_format_service_utils.h
  123. shared_image_format_service_utils_mac.mm
  124. shared_image_gl_utils.cc
  125. shared_image_gl_utils.h
  126. shared_image_manager.cc
  127. shared_image_manager.h
  128. shared_image_manager_unittest.cc
  129. shared_image_pool_service.cc
  130. shared_image_pool_service.h
  131. shared_image_representation.cc
  132. shared_image_representation.h
  133. shared_image_representation_unittest.cc
  134. shared_image_test_base.cc
  135. shared_image_test_base.h
  136. shared_memory_image_backing.cc
  137. shared_memory_image_backing.h
  138. shared_memory_image_backing_factory.cc
  139. shared_memory_image_backing_factory.h
  140. skia_gl_image_representation.cc
  141. skia_gl_image_representation.h
  142. skia_graphite_dawn_image_representation.cc
  143. skia_graphite_dawn_image_representation.h
  144. skia_vk_android_image_representation.cc
  145. skia_vk_android_image_representation.h
  146. skia_vk_ozone_image_representation.cc
  147. skia_vk_ozone_image_representation.h
  148. test_image_backing.cc
  149. test_image_backing.h
  150. test_utils.cc
  151. test_utils.h
  152. texture_holder_vk.cc
  153. texture_holder_vk.h
  154. video_image_reader_image_backing.cc
  155. video_image_reader_image_backing.h
  156. vulkan_ozone_image_representation.cc
  157. vulkan_ozone_image_representation.h
  158. wrapped_graphite_texture_backing.cc
  159. wrapped_graphite_texture_backing.h
  160. wrapped_graphite_texture_holder.cc
  161. wrapped_graphite_texture_holder.h
  162. wrapped_sk_image_backing.cc
  163. wrapped_sk_image_backing.h
  164. wrapped_sk_image_backing_factory.cc
  165. wrapped_sk_image_backing_factory.h
  166. wrapped_sk_image_backing_factory_unittest.cc
gpu/command_buffer/service/shared_image/README.md

Shared Image Infrastructure

This document provides a high-level overview of the Shared Image system, a core component of Chromium's GPU architecture designed for sharing graphical resources across different parts of the browser and between various graphics APIs.

Core Components

The Shared Image system is built around four primary components that work together to manage the lifecycle and accessibility of shared graphical memory.

  • SharedImageManager: The central authority for all shared images. It is the sole owner of the underlying SharedImageBacking objects and manages their creation and destruction. All access to shared images is brokered through the manager.

  • SharedImageFactory: The entry point for creating shared images. Clients request shared images through interface which goes into this factory, specifying desired format, size, and usage flags. The factory's main role is to dispatch the creation request to the most appropriate backing-specific factory based on the platform, hardware capabilities, and intended use.

  • SharedImageBacking: Represents the actual allocated graphics memory (the “backing store”). This can be a native platform resource like a D3D11 texture or an AHardwareBuffer, or a more generic resource like a GL texture or a block of shared memory. The backing is an internal implementation detail, never directly accessed by client code.

  • SharedImageRepresentation: A lightweight, API-specific “view” into a SharedImageBacking. Representations are the means by which clients interact with a shared image's data. For example, a DawnImageRepresentation allows a backing to be used as a wgpu::Texture, while a SkiaImageRepresentation allows it to be drawn to or from using Skia.

Key Architectural Concepts

Separation of Storage and Access

The fundamental design principle of the Shared Image system is the strict separation of the underlying memory storage (SharedImageBacking) from the API-specific access mechanisms (SharedImageRepresentation). This allows a single graphical resource to be accessed by different parts of the code (e.g., the compositor, the Skia renderer, the WebGPU implementation) without needing to know the details of its underlying storage.

Interoperability Across Graphics APIs

This separation is what enables seamless interoperability. For instance, an image can be created using the Vulkan backend (ExternalVkImageBackingFactory) and then be used for rendering in both Skia and Dawn. To achieve this, a client would request a SkiaImageRepresentation to draw with Skia, and later a DawnImageRepresentation to use the same image as a texture in a WebGPU application. The backing must ensure that access is properly synchronized.

Platform-Specific Implementations

To leverage native capabilities, the Shared Image system uses specialized backing factories on different operating systems.

  • Windows: The D3DImageBackingFactory is used to create backings from D3D11 textures. This provides the most efficient path for interoperability with D3D11, D3D12, and DXGI swap chains, which are fundamental to Windows graphics.

  • Android: The AHardwareBufferImageBackingFactory creates backings that wrap AHardwareBuffer objects. AHardwareBuffer is Android's native mechanism for sharing buffers between system components, making it ideal for zero-copy sharing with the media decoder, camera, and other hardware.

  • macOS/iOS: The IOSurfaceImageBackingFactory utilizes IOSurface objects, which are the native, optimized buffer-sharing mechanism on Apple platforms.

  • Linux/ChromeOS (Ozone): The OzoneImageBackingFactory creates backings from NativePixmap objects, integrating with the Ozone platform abstraction layer for windowing and graphics.

Generic and Fallback Backings

For cross-platform use cases or when a native backing is not suitable, several generic factories are available.

  • SharedMemoryImageBackingFactory: Creates backings from CPU-accessible shared memory. This is highly versatile but may require an extra upload step to be used on the GPU.

  • WrappedSkImageBackingFactory: Creates a backing that wraps a Skia-owned resource (SkImage). This is useful when no other specialized native factory is needed to satisfy the requested usage flags.

  • WrappedGraphiteTextureBacking: Creates a backing that holds a BackendTexture allocated and managed by Skia's Graphite rendering backend.