During application development, you can flexibly combine ArkUI components, videos, images, web pages, and third-party rendering frameworks to generate content that meets UI requirements. In addition to the CPU and GPU computing units, the HarmonyOS-based chip platform provides Hardware Composer (HWC) to assist the system in graphics rendering and display. HWC provides higher processing efficiency and lower power consumption in overlay layers. To fully utilize its hardware capabilities, HWC, as a dedicated hardware unit, must meet certain conditions. This helps in decreasing the load on the system's CPU and GPU, thereby reducing overheating and stutters.
Therefore, when developing multi-layer overlay scenarios such as web pages and video playback, if self-rendering layers are present, you can use either of the following methods to adjust the visual effect design and expand the effective scope of HWC:
You can adjust the visual effect design based on your service requirements so that the system can fully utilize the energy efficiency advantages of HWC, reduce the power consumption in specific scenarios, and improve the operation smoothness.
High-order visual effect components provide complex visual effects such as blurring and color inversion. These effects require operations like background sampling and color calculation.
UI elements of applications received by the system consist of two types. One is UI components that directly use existing APIs provided by ArkUI, for example, buttons, progress bars, or navigation bars. The other is the rendered content transferred by the application (referred to as application-rendered content), including videos, images, web pages, and content that has been rendered by invoking an in-house or a third-party rendering framework.
@Entry
@Component
struct ArkUISample {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
} The content is drawn by the system based on the component definition and layout. The application is unaware of the specific drawing process.
This type of content is decoded in the application process or rendered by invoking the GPU, and then transferred to the system rendering service process as a whole.
When processing these two types of UI elements, the system will comprehensively invoke the GPU or HWC based on the visual effect requirements of the UI to achieve optimal power consumption performance.
The following figure demonstrates the workflow from application UI content development to final display.

The rendering and display policy of the current system is described as follows:
The RS process draws ArkUI components to the UI layer in a unified manner. UI content comprises application-defined ArkUI components and system-provided content from the home screen process, such as the status bar and system navigation. Based on the Z-order relationship between the UI layer and the application-rendered content, the layer overlaying feature of HWC is preferentially used for display processing.
In this process, the visual effects of the UI components and the Z-order relationship of the self-rendering layers affect the use of HWC. For example, if a UI component above the self-rendering layer uses an advanced visual effect such as blurring, the blurring algorithm must read the content of the self-rendering background layer in real time, and additional processing is also required during layer composition. In this case, HWC is disabled, and the RS employs the GPU for layer composition.
Taking into account the features of HWC and the existing system rendering and display approach, we propose two recommendations. These aim to enhance the scope of HWC's effectiveness and minimize the chances of overheating and lag that might occur during application interactions.
If a UI component with effects like blurring overlaps a self-rendering layer, the RS must read the layer's content for rendering. This requires additional memory reads and forces GPU-based composition, bypassing HWC acceleration.
Such operations incur significant CPU, GPU, and DDR overhead, leading to increased power consumption and deteriorated performance. Therefore, it is recommended that you properly evaluate the necessity of UI visual effects, and avoid the overlap between non-essential high-order visual effect components and self-rendering layers by removing high-order visual effects such as blurring or adjusting the component positions.
The preceding suggestions are based on power consumption optimization. You can adjust the UI visual effect design as required.
Note: List of typical advanced visual effects
Visual Effect | ArkUI API |
Background blurring | .blur(); .backdropBlur() |
Component brightening (background brightness remained) | .backgroundBrightness() |
Gray scale | .grayscale() |
Shadow color picking | .shadow() |
Component brightening (background darkened) | .lightUpEffect() |
Foreground blurring | .foregroundEffect() |
The following cases exist:
You are advised to evaluate the necessity of setting the transparency for self-rendering layers. If the layer is fully transparent, remove the layer from the view tree in a timely manner. If a UI component must lie below a self-rendering layer, you are advised to implement the component via self-rendering as well.
You are advised to evaluate whether multiple self-rendering layers need to be overlapped and whether the rounded corners of the bottom layer can be removed.
Here are some typical use cases:
Final effect

As shown in the preceding figure, the back button component in the upper left corner of the video has the blur effect. Consequently, sampling of the video layer needs to be performed and the HWC's overlaying capability cannot be used. You can enable HWC by removing the blur effect from the component or relocating it to a non-video area.
In this example, HWC is enabled by removing the blur effect from the component to optimize the power consumption. Two pieces of code snippets are provided below for comparison.
Image component with the blur effect placed above the video
@Entry
@Component
struct VideoWithBlur {
// ...
build() {
NavDestination() {
Stack() {
// Video Layer
Video({
src: $r('app.media.test_video')
})
.height('100%')
.width('100%')
.loop(true)
.autoPlay(true)
.controls(false)
RelativeContainer() {
Row() {
// The return button has a blurry effect
Image($r('app.media.chevron_left'))
.padding(12)
.width(40)
.height(40)
.borderRadius('50%')
.fillColor('rgba(255, 255, 255, 0.9)')
.backgroundColor('rgba(0, 0, 0, 0.1)')
.backdropBlur(40) // Set this component background blur
.backgroundBlurStyle(BlurStyle.BACKGROUND_REGULAR)
// ...
}
// ...
}
.width('100%')
.height('100%')
.padding({
left: 16,
right: 16,
top: 36,
bottom: 44
})
}
.width('100%')
.height('100%')
}
// ...
} Image component without the blur effect placed above the video
@Component
struct NormalVideo {
// ...
build() {
NavDestination() {
Stack() {
// Video Layer
Video({
src: $r('app.media.test_video')
})
.height('100%')
.width('100%')
.loop(true)
.autoPlay(true)
.controls(false)
RelativeContainer() {
Row() {
// The return button does not have a blur effect
Image($r('app.media.chevron_left'))
.padding(12)
.width(40)
.height(40)
.borderRadius('50%')
.fillColor('rgba(255, 255, 255, 0.9)')
.backgroundColor('rgba(0, 0, 0, 0.1)')
// ...
}
// ...
}
.width('100%')
.height('100%')
.padding({
left: 16,
right: 16,
top: 36,
bottom: 44
})
}
.width('100%')
.height('100%')
}
// ...
} Final effect without blurring

Power Consumption Comparison
Before and after the blur effect is removed from the back button component, test the power consumption of the CPU and GPU, and the total power consumption of the device. This test plays a video for 30s, with a node set every 3s to obtain the average power consumption of five nodes from 6s to 21s. The data measured by Profiler of DevEco Studio is as follows.

The test data shows that:
The test data shows that in video playback scenarios, enabling HWC by removing the blur effect from components above the video area significantly reduces the GPU and CPU power consumption, while also effectively lowering the overall device power consumption.

In this scenario, the tab bar on the bottom uses the blur effect, and the background uses the Web component or native XComponent to import self-rendering content. As a result, the UI layer and self-rendering content cannot be overlaid using HWC. To reduce power consumption, you can remove the blur effect from the tab bar or clip the component area to prevent the content on the web page from intersecting with the blur component.
In this example, HWC is enabled by removing the blur effect from the component to optimize the power consumption. Two pieces of code snippets are provided below for comparison.
TabBar component with the blur effect placed above the Web component
import { webview } from '@kit.ArkWeb';
// ...
@Entry
@Component
struct WebWithBlur {
@State currentIndex: number = 0; // The index of the currently selected tab page
private controller: TabsController = new TabsController();
private webController: webview.WebviewController = new webview.WebviewController();
// ...
@Builder
tabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) {
// ...
}
build() {
// ...
Tabs({ barPosition: BarPosition.End, index: 0, controller: this.controller }) {
TabContent() {
Web({ src: $rawfile('test.html'), controller: this.webController })
}
.tabBar(this.tabBuilder('Tab', 0, $r('app.media.tab_icon_activated'), $r('app.media.tab_icon')))
// ...
}
.height('100%')
.width('100%')
.barOverlap(true) // Set TabBar to be blurred and overlay on top of TabContent
.barBackgroundColor('rgba(241, 243, 245, 0.3)')
// ...
}
} TabBar component without the blur effect placed above the Web component
import { webview } from '@kit.ArkWeb';
// ...
@Entry
@Component
struct NormalWeb {
@State currentIndex: number = 0; // The index of the currently selected tab page
private controller: TabsController = new TabsController();
private webController: webview.WebviewController = new webview.WebviewController();
// ...
@Builder
tabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) {
// ...
}
build() {
// ...
Tabs({ barPosition: BarPosition.End, index: 0, controller: this.controller }) {
TabContent() {
Web({ src: $rawfile('test.html'), controller: this.webController })
}
.tabBar(this.tabBuilder('Tab', 0, $r('app.media.tab_icon_activated'), $r('app.media.tab_icon')))
// ...
}
.height('100%')
.width('100%')
.barOverlap(true) // Set TabBar to overlay on top of TabContent
.barBackgroundBlurStyle(BlurStyle.NONE) // Set TabBar to be not blurry
.barBackgroundColor('rgba(241, 243, 245, 1)')
// ...
}
} Final effect without blurring

Power Consumption Comparison
Before and after the blur effect is removed from the TabBar component, test the power consumption of the CPU and GPU, and the total power consumption of the device. This test swipes the screen for 30s in an even speed, with a node set every 3s to obtain the average power consumption of five nodes from 6s to 21s. The data measured by Profiler of DevEco Studio is as follows.

The test data shows that:
The test data shows that in web page scenarios, enabling HWC by removing the blur effect from components above the web content area significantly reduces the GPU power consumption, while also effectively lowering the CPU power consumption and overall device power consumption.
Final effect

When the transparency is set for a video layer, it allows the underlying UI components to be visible, but this requires additional GPU processing and disables HWC composition. You are advised to evaluate the necessity of setting the transparency and adjust the video layer to be opaque. If the transparency is required, place UI components above the video layer or implement them via self-rendering to enable HWC support.
You can enable HWC by adjusting the opacity of the video layer to optimize power consumption. Two pieces of code snippets are provided below for comparison.
Video layer with the opacity set
@Entry
@Component
struct TransparentVideo {
// ...
build() {
// ...
RelativeContainer() {
// Bottom UI component
Image($r('app.media.watermark'))
.width(200)
.height(80)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
// Video Layer
Video({
src: $r('app.media.test_video')
})
.height('100%')
.width('100%')
.loop(true)
.autoPlay(true)
.controls(false)
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.opacity(0.7) // Set the transparency of the video layer
}
.height('100%')
.width('100%')
}
// ...
} Video layer without setting the opacity
@Entry
@Component
struct OpaqueVideo {
// ...
build() {
// ...
RelativeContainer() {
// Bottom UI component
Image($r('app.media.watermark'))
.width(200)
.height(80)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
// Video Layer
Video({
src: $r('app.media.test_video')
})
.height('100%')
.width('100%')
.loop(true)
.autoPlay(true)
.controls(false)
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.opacity(1) // Set the video layer to be fully opaque
}
.height('100%')
.width('100%')
}
// ...
} Final effect with 100% opacity

Power Consumption Comparison
Before and after the opacity is set for the video layer, test the power consumption of the CPU and GPU, and the total power consumption of the device. This test plays a video for 30s, with a node set every 3s to obtain the average power consumption of five nodes from 6s to 21s. The data measured by Profiler of DevEco Studio is as follows.

The test data shows that:
The test data shows that when video playback overlays UI component, setting the video layer to opaque (opacity set to 1) and enabling HWC significantly reduces the GPU and CPU power consumption, thereby lowering the overall device power consumption.
This document, based on the HarmonyOS system, introduces solutions for leveraging HWC to reduce application overheating and lag. Through examples in common scenarios like web pages and video playback, it demonstrates specific implementation methods and effects. You can refer to these recommendations to balance visual effects, power consumption, and performance, thereby enhancing your application's overall user experience.