Setting the cfct_config File (Configuration Scheme 1)
You can use the cfct_config file to flexibly configure the resources used by the video stream cloud phone to achieve optimal performance. Before starting a cloud phone, ensure that the cfct_config file is stored in the startup path and the configurations in the file are correct. The cloud phone container uses the configurations in this file.
The configuration items in the cfct_config file and the configuration method are as follows:
- Extract the cfct_config file and grant permissions on the file. Ensure that the file owner has read and write permissions while users in the owner group and other users have only the read permission.
1 2 3
cd /home/kbox_video/ tar -xvf DemoVideoEngine.tar.gz cfct_config chmod 644 cfct_config
- Change map configurations such as GPU, CPU, ENC, and USERDATA of the corresponding channel to select the GPU, CPU, NETINT encoding card, and path to the data volume used by the container of this channel.
To ensure the stable running and optimal performance of the video stream cloud phone, ensure that the physical CPU cores and GPU rendering nodes bound to a container belong to the same CPU socket.
- The nodes of the NETINT encoding card vary according to the server. You need to change the value of NETINT in the cfct_config file based on 4 and your environment to prevent performance loss caused by cross-socket encoding.
- If only one GPU is used in your environment, change the value of VIDEO_CPU_MAP_{total_CPU_core_number}CORE_MODE{CPU_BIND_MODE} in the cfct_config file. You can query the NUMA to which a NETINT card chip belongs based on Querying the NUMA Node to Which a NETINT Card Chip Belongs.
Take VIDEO_CPU_MAP_128CORE_MODE0 as an example. Retain the configuration of the CPU bound to the GPU and delete other configurations. If the GPU is inserted into CPU 0, delete all references related to MODE0_CPUS2 and MODE0_CPUS3. If the GPU is inserted into CPU 1, delete all references related to MODE0_CPUS0 and MODE0_CPUS1. For details about how to query the NUMA node to which a GPU belongs, see Querying the NUMA Node to Which an AMD GPU Rendering Node Belongs.
- If only one encoding card is used in your environment, change the value of VIDEO_ENC_MAP_CORE in the cfct_config file.
- If the encoding card is inserted into CPU 0, delete "${NETINT1}". If the encoding card is inserted into CPU 1, delete "${NETINT0}".
- If the CPU is used for software encoding of video frames, set CPU_BIND_MODE to 1 in cfct_config to prevent frame freezing.
- Enable the graphics acceleration layer as required. For details, see Basic Functions and Usage of the Graphics Acceleration Layer.
- To enable the C2 decoder if needed, set ENABLE_AMD_C2_DECODE in the cfct_config file to 1.
Querying the NUMA Node to Which a NETINT Card Chip Belongs
- Run the nvme list command to view the nodes of the codec card chips.
1nvme listThe following command output is an example of the NVMe nodes of the NETINT card chips.
1 2 3 4
Node SN Model Namespace Usage Format FW Rev ------------- -------------------- ---------------- --------- ------------------------ ---------------- -------- /dev/nvme0n1 Q2A325A11DC082-0454A QuadraT2A 1 8.59 TB / 8.59 TB 4 KiB + 0 B 48F6rKr1 /dev/nvme1n1 Q2A325A11DC082-0454B QuadraT2A 1 8.59 TB / 8.59 TB 4 KiB + 0 B 48F6rKr1
- Check the mapping between NVMe nodes and PCIe bus numbers.{index} indicates the NVMe node number returned in 1. For example, in /dev/nvme1n1, the value of {index} is 1.
1find /sys/devices/ -name nvme{index}
In the following command output, 0000:05:00.0 indicates the bus number of the device.
1 2
/sys/devices/pci0000:00/0000:00:0e.0/0000:05:00.0/nvme/nvme1 /sys/devices/virtual/nvme-subsystem/nvme-subsys1/nvme1
- Check the mapping between the node and NUMA based on the bus number.{busID} indicates the bus number obtained in the previous step. For example, in the command output for nvme1, {busID} is 0000:05:00.0.
1lspci -vvvs {busID} | grep NUMA
Command output:
1NUMA node: 0
- Change the value of NETINT in cfct_config based on the NUMA information corresponding to the NVMe node of the encoding card.
For servers powered by Kunpeng 920 7265F or 7260 processors: Write NVMe nodes belonging to NUMA 0 and NUMA 1 in the NETINT0 field, and NVMe nodes belonging to NUMA 2 and NUMA 3 in the NETINT1 field.
Two nodes need to be added for each device in a field. For example, for NVMe device 2, you need to add nodes /dev/nvme2 and /dev/nvme2n1.
# Nodes of NETINT encoding card devices NETINT0="/dev/nvme0,/dev/nvme0n1,/dev/nvme1,/dev/nvme1n1" NETINT1="/dev/nvme2,/dev/nvme2n1,/dev/nvme3,/dev/nvme3n1"
Querying the NUMA Node to Which an AMD GPU Rendering Node Belongs
Each AMD GPU corresponds to one GPU rendering node.
- Query GPU rendering nodes.
1ll /dev/dri/by-path/ | grep renderD
Example command output:
1 2
lrwxrwxrwx 1 root root 13 Oct 25 10:58 pci-0000:03:00.0-render -> ../renderD128 lrwxrwxrwx 1 root root 13 Oct 25 10:58 pci-0000:83:00.0-render -> ../renderD129
This indicates that two AMD GPUs are inserted into the server, and the rendering nodes are renderD128 and renderD129.
- Query the NUMA node to which a GPU rendering node belongs.
1cat /sys/bus/pci/devices/0000\:XX\:00.0/numa_node
Replace XX in the command with the IP address of a node queried in step 1. Take renderD128 as an example. The query command is as follows:
1cat /sys/bus/pci/devices/0000\:03\:00.0/numa_node
Command output:
10This indicates that renderD128 belongs to NUMA node 0.
Basic Functions and Usage of the Graphics Acceleration Layer
The graphics acceleration layer supports the following functions:
- GPU mock: emulates the GPU vendor, GPU model, OpenGL ES version, GL_MAX capability value, and OpenGL ES extension.
- Shader cache: pre-builds shader binaries and shares cache across multiple cloud phones to cut shader compilation and linking time, thereby reducing stuttering of large OpenGL ES applications.
The preceding functions can be configured in the kbox_render_accelerating_configuration.xml file. To enable the graphics acceleration layer, perform the following steps:
- Set ENABLE_RENDER_LAYER in the cloud phone startup configuration file cfct_config to 1.
- Copy the kbox_render_accelerating_configuration.xml configuration file from the Kbox-AOSP15.zip software package to the /home/kbox_video/ startup path.
cp /home/kbox_video/Kbox-AOSP15/deploy_scripts/kbox_render_accelerating_configuration.xml /home/kbox_video/
- Open the configuration file and configure the graphics acceleration layer functions for an application. For details about the configuration items, see Configuration Items of the Graphics Acceleration Layer.
- If you need to modify the configuration of the graphics acceleration layer after starting the cloud phone for the first time, modify the application-specific settings in the configuration file, manually copy the file to the /data/local/tmp directory of the cloud phone container, and restart the application for the modification to take effect.
- Multiple containers on the host share the same shader cache path. You can start a cloud phone to pre-collect as many shaders as possible. For other cloud phones, you can enable the shader cache function by setting the corresponding applications in the configuration file to read-only mode. In this case, the performance is optimal.
- The shader cache function has no cache eviction mechanism. If the cache file system storage is full or the game application needs to be updated, clear the entire file system's cache to avoid a mismatch between the shaders and binary files.