我要评分
获取效率
正确性
完整性
易理解

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:

  1. Extract the cfct_config file and grant permissions on the file. Ensure that the file owner has the 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
    
  2. 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 chip.

  3. 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 your environment to ensure that the performance is not affected due to cross-chip encoding.
  4. To enable hardware decoding of the Quadra/T432 encoding card, set T432_QUADRA_DECODE_ENABLE to 1 in the cfct_config file.
  5. 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.

  6. If only one encoding card is used in your environment, change the value of VIDEO_ENC_MAP_CORE in the cfct_config file.
  7. If the encoding card is inserted into CPU 0, delete "${NETINT1}". If the encoding card is inserted into CPU 1, delete "${NETINT0}".
  8. To enable the WebRTC feature, set ENABLE_WEBRTC_CONNECTION to 1 in cfct_config. If the CPU is used for software encoding of video frames, set CPU_BIND_MODE to 1 in cfct_config to prevent frame freezing.
  9. To enable the graphics acceleration layer, set ENABLE_RENDER_LAYER in the cfct_config file to 1. For details, see Basic Functions and Usage of the Graphics Acceleration Layer.

Querying the NUMA Node to Which a NETINT Card Chip Belongs

  1. Run the nvme list command to view the nodes of the codec card chips.
    1
    nvme list
    

    The 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
    
  2. 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.
    1
    find /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
    
  3. 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.
    1
    lspci -vvvs {busID} | grep NUMA
    

    Command output:

    1
    NUMA node: 0
    
  4. 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.

  1. Query GPU rendering nodes.
    1
    ll /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.

  2. Query the NUMA node to which a GPU rendering node belongs.
    1
    cat /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:

    1
    cat /sys/bus/pci/devices/0000\:03\:00.0/numa_node
    

    Command output:

    1
    0
    

    This 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:
  • Shader cache: prebuilds binaries and shares cache across multiple cloud phones to cut shader compilation and linking time.
  • GPU mock: simulates the GPU vendor, model, GLMax, GLES version, and extension.

The preceding functions can be configured in the kbox_render_accelerating_configuration.xml file as follows:

  1. Copy the XML configuration file.
    cp Kbox-AOSP11/deploy_scripts/kbox_render_accelerating_configuration.xml /home/kbox_video/
  2. Open the file and configure the graphics acceleration layer function for an application. Configuration rules:
    • Read the general system configuration first, and then read the configuration of a specific application. If no configuration is made for the application, the system configuration is used. If the application is configured, the system configuration is overwritten.
    • The shader cache function is disabled in the general system configuration.
    • Configure the application. You can enable the graphics acceleration layer functions (disabled by default) and set the parameters of each function as required. For details, see the application configuration example in the comments of the configuration file.
    • If the shader cache function is enabled for the application, the GPU mock function is automatically enabled as well.
  3. Enable a function by setting the isEnable fields corresponding to the application and this function to true.
  • After the cloud phone is started for the first time, if you need to modify the graphics acceleration layer configuration, modify the application configuration 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 complete 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.