同步操作将从 OpenHarmony/graphic_surface_lite 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
A surface is used to manage and transfer the shared memory of graphics and media. Specific use cases include graphics display and composition, and media playback and recording.
A surface transfers data across processes through control structures such as Inter-Process Communication (IPC) handles (with copies), and transfers graphics and media data (zero-copy) through shared memory. The following figure shows the position where a surface works in the system architecture. The elements in green blocks are surface buffers.
Figure 1 Position of a surface in the system architecture
/foundation/graphic/surface
├── frameworks # Framework code
├── interfaces # APIs
│ ├── innerkits # APIs between modules
│ └── kits # External APIs
└── test # Test code
├── fuzztest # Fuzzing
└── unittest # Unit testing
# Generate the libsurface.so file in the out directory of the product folder through GN compilation.
hb build lite_surface
Take the interaction between Window Manager Service (WMS) and UI as an example. UI works as a producer, and WMS works as a consumer.
The producer obtains a buffer from the free queue, draws the UI content into the buffer, and places the buffer in the dirty queue.
The consumer obtains the buffer from the dirty queue, synthesizes graphics data, and places the buffer in the free queue again.
Figure 2 Surface rotation process
NOTICE:
- A shared memory is used for data transfer, and the task of managing the shared memory runs in the process of creating a surface for the first time. If the process is abnormal and is not recycled, severe memory leakage occurs. Therefore, pay special attention to the process.
- Surfaces are generally used for cross-process transfers of large memory blocks (such as display data) in graphics or media. Especially, when continuous physical memory is used, the transfer rate can be greatly improved. It is not recommended that surfaces be used in small-memory transfer scenarios. Otherwise, memory fragmentation may occur, which affects the performance in typical scenarios.
For details, see WMS.
graphic_surface
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。