Screen rendering method
By setting priority and use timeout mechanisms in the terminal core driver, the problem of screen display lag in traditional GPU isolation solutions is solved, the smooth display of the first screen and the cost-effectiveness improvement of driving is achieved, and driving safety is ensured.
Patent Information
- Application Number
- CN202410977484.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-12-06
AI Technical Summary
The traditional GPU isolation solution has insufficient isolation in the dual-screen display of new energy vehicles, resulting in lag in the screen display, which may cause driving safety issues, and is cost-effective or cost-effective.
By setting the priority of the rendering command of the first screen in the terminal kernel driver higher than the second screen, the timeout mechanism is used to ensure the isolation of the GPU resource of the first screen, preventing the high load task of the second screen from affecting the display of the first screen, and limiting the first screen The access permissions of the second screen to GPU resources.
It realizes the smooth display of the first screen, avoids screen display lag, reduces costs, improves cost performance, and ensures driving safety.
Smart Images

Figure CN119088537A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer resource management, and in particular to a screen rendering method. Background Art
[0002] In recent years, new energy vehicles have been developing rapidly. In order to provide customers with a better driving experience, the intelligent cockpit platform has become the focus of major car manufacturers. Dual-screen display is part of the common solution for intelligent cockpits. Based on the best cost-effectiveness, car manufacturers usually introduce virtualization solutions to drive two screens. GPU resource isolation is an important part of the virtualization solution, which ensures that both screens can display normally. The traditional GPU isolation solution will start two docker or VM virtual machines, one to drive the instrument screen and the other to drive the entertainment screen. The VM virtual machine solution has strong isolation. The GPU is used by the VM in a pass-through manner. The VM has full control over the GPU. Compared with the VM solution, the docker solution is more lightweight, and its shared kernel and GPU hardware can provide a certain degree of isolation.
[0003] The VM virtual machine solution has strong isolation and full control over the GPU, but the SOC must integrate multiple GPU chips for use by multiple VMs, so the cost is high and there is no cost-effectiveness advantage. In terms of cost, docker is a good cost-effective solution, but the resource restriction capabilities provided by docker are limited. Under the premise of sharing the kernel and GPU hardware, the isolation of GPU resources is not high, especially when the performance of the GPU itself is not high. The two dockers will be affected by each other due to running high-load GPU tasks, resulting in screen display jams. If the instrument display is affected by the entertainment display, this may introduce driving safety issues with serious consequences. Summary of the invention
[0004] The purpose of the present invention is to provide a screen rendering method to deeply isolate the GPU resources of a first screen, thereby ensuring smooth display of the first screen without actively interfering with displays of other screens.
[0005] A first aspect of an embodiment of the present invention provides a screen rendering method, which is applied to a terminal, and the terminal is used to render multiple screens. The method includes:
[0006] Setting a rendering command priority of a first screen and a rendering command priority of a second screen, wherein the rendering command priority of the first screen is set by a kernel driver of the terminal so that the rendering command priority of the first screen is higher than the rendering command priority of the second screen;
[0007] The first screen and the second screen are rendered according to a rendering command priority of the first screen and a rendering command priority of the second screen.
[0008] Furthermore, before setting the rendering command priority of the first screen and the rendering command priority of the second screen, the method further includes:
[0009] In response to the terminal starting up, the / dev / prio_ctrl device file of the terminal is exported to the user state, and the access rights of the / dev / prio_ctrl device file are set so that the rendering program of the first screen can access the / dev / prio_ctrl device file, and the rendering program of the second screen cannot access the / dev / prio_ctrl device file.
[0010] Furthermore, the rendering command priority of the first screen is set, including:
[0011] Accessing the / dev / prio_ctrl device file through the rendering program of the first screen to send the ID of the rendering process of the first screen to the kernel driver of the terminal; and executing a timeout mechanism to enable the first screen to be displayed normally;
[0012] The rendering command priority of the first screen is set through the kernel driver.
[0013] Furthermore, the timeout mechanism is specifically as follows:
[0014] Determine the rendering command of the first screen and the rendering command of the second screen, and if it is the rendering command of the first screen, deliver the rendering command to the GPU hardware; if it is the rendering command of the second screen, set a timeout after delivering the rendering command to the GPU hardware;
[0015] When executing a timed rendering command, the kernel driver of the terminal injects a timed out error instruction into the GPU hardware.
[0016] Furthermore, the terminal is a Cgroup-based terminal, and the kernel driver is a GPU kernel driver.
[0017] The present invention has at least the following beneficial effects:
[0018] This solution marks the display program corresponding to the first screen in the underlying operating system of the smart terminal, increases the execution priority of the command issued by the program, and thereby makes the display of the first screen unaffected by the display of the second screen, while also not interfering with the display of the second screen; and allows car manufacturers to achieve higher cost-effective output with lower cost investment, thereby bringing economic benefits.
[0019] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 The present invention provides a flowchart of a screen rendering method. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0022] In the description of the present invention, it is necessary to understand that the terms "upper", "lower", "front", "back", "left", "right", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0023] Example 1: Combination Figure 1 This embodiment is described.
[0024] This embodiment is a screen rendering method, which is applied to a terminal, and the terminal is used to render multiple screens. The method includes:
[0025] Setting a rendering command priority of the first screen and a rendering command priority of the second screen, wherein the rendering command priority of the first screen is set by a kernel driver of the terminal so that the rendering command priority of the first screen is higher than the rendering command priority of the second screen;
[0026] The first screen and the second screen are rendered according to a rendering command priority of the first screen and a rendering command priority of the second screen.
[0027] In this solution, the terminal is a Cgroup-based terminal, and the kernel driver is a GPU kernel driver.
[0028] Furthermore, before setting the rendering command priority of the first screen and the rendering command priority of the second screen, the method includes:
[0029] In response to the terminal startup, the terminal's / dev / prio_ctrl device file is exported to user mode, and the access rights of the / dev / prio_ctrl device file are set so that the rendering program of the first screen can access the / dev / prio_ctrl device file, while the rendering program of the second screen cannot access the / dev / prio_ctrl device file.
[0030] Power on the Cgroup-based terminal device, load a specific driver module, export the terminal's / dev / prio_ctrl device file to the user state, and use Cgroup to set the access rights of the / dev / prio_ctrl device so that the rendering program of the first screen can access the / dev / prio_ctrl device file, while the rendering program of the second screen cannot access the / dev / prio_ctrl device file.
[0031] Furthermore, the rendering command priority of the first screen is set, including:
[0032] The rendering program of the first screen accesses the / dev / prio_ctrl device file to send the ID of the rendering process of the first screen to the kernel driver of the terminal; and executes a timeout mechanism to allow the first screen to display normally, and sets the rendering command priority of the first screen through the kernel driver.
[0033] Start the rendering program of the first screen, open the / dev / prio_ctrl device file through the rendering program, mark its own process ID to interact with the kernel GPU driver, and enable the execution timeout mechanism of the kernel GPU driver to allow the first screen to display normally;
[0034] Then, a command to create a context is initiated through the rendering program of the first screen. After receiving the command, the kernel GPU driver raises the priority of the context to the highest level according to the marked process ID.
[0035] Start the rendering program of the second screen. Since the second screen rendering program has no access to / dev / prio_ctrl, it is impossible to increase the context priority, so that the first screen can display normally when the second screen does not run heavy-load rendering commands.
[0036] Furthermore, the timeout mechanism is as follows:
[0037] Determine the rendering command of the first screen and the rendering command of the second screen. If it is the rendering command of the first screen, deliver the rendering command to the GPU hardware; if it is the rendering command of the second screen, set a timeout after delivering the rendering command to the GPU hardware;
[0038] When executing a timed rendering command, the terminal's kernel driver injects a timeout error instruction into the GPU hardware.
[0039] First, it is necessary to distinguish whether it is a rendering command for the first screen or a rendering command for the second screen. If it is a rendering command for the first screen, the rendering command will be delivered directly to the GPU hardware. If it is a rendering command for the second screen, after the rendering command is delivered to the GPU hardware, the execution timeout will be set.
[0040] For rendering commands that have timed out, the kernel GPU driver will inject a timeout error into the GPU hardware, causing the GPU to soft restart, thereby releasing GPU resources and protecting the first screen display from being affected.
[0041] The key to executing the timeout mechanism is to set a reasonable timeout period. Since the image jitter that can be perceived by the naked eye is greater than or equal to 2 frame rates, one frame is 16 milliseconds, and two frames are 32 milliseconds. In addition, 32 milliseconds are sufficient to complete the rendering command of the first screen. Therefore, the timeout period set in this solution is 32 milliseconds. This mechanism ensures that the GPU resources of the first screen will not be occupied by the second screen for a long time, thereby ensuring that the first screen can display normally.
[0042] It should also be noted that the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "includes one..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements. The words "first", "second" and the like are used to indicate names, but do not indicate any specific order. The above schematically describes the invention and its implementation methods, which is not restrictive. The invention can be implemented in other specific forms without departing from the spirit or basic features of the invention. What is shown in the accompanying drawings is only one of the implementation methods of the invention, and the actual structure is not limited thereto. Any figure mark in the claims should not limit the claims involved. Therefore, if a person of ordinary skill in the art is inspired by it, and does not deviate from the purpose of the invention, and designs a structural mode and an embodiment similar to the technical solution without creativity, they should all belong to the scope of protection of this patent.
Claims
1. A screen rendering method, characterized in that: Applied to a terminal, the terminal is used to render multiple screens, the method comprising: Setting a rendering command priority of a first screen and a rendering command priority of a second screen, wherein the rendering command priority of the first screen is set by a kernel driver of the terminal so that the rendering command priority of the first screen is higher than the rendering command priority of the second screen; The first screen and the second screen are rendered according to a rendering command priority of the first screen and a rendering command priority of the second screen.
2. A screen rendering method according to claim 1, characterized in that: Before setting the rendering command priority of the first screen and the rendering command priority of the second screen, the method includes: In response to the terminal starting up, the / dev / prio_ctrl device file of the terminal is exported to the user state, and the access rights of the / dev / prio_ctrl device file are set so that the rendering program of the first screen can access the / dev / prio_ctrl device file, and the rendering program of the second screen cannot access the / dev / prio_ctrl device file.
3. A screen rendering method according to claim 2, characterized in that: Set the rendering command priority of the first screen, including: Accessing the / dev / prio_ctrl device file through the rendering program of the first screen to send the ID of the rendering process of the first screen to the kernel driver of the terminal; and executing a timeout mechanism to enable the first screen to be displayed normally; The rendering command priority of the first screen is set through the kernel driver.
4. A screen rendering method according to claim 3, characterized in that: The timeout mechanism is specifically as follows: Determine the rendering command of the first screen and the rendering command of the second screen, and if it is the rendering command of the first screen, deliver the rendering command to the GPU hardware; if it is the rendering command of the second screen, set a timeout after delivering the rendering command to the GPU hardware; When executing a timed rendering command, the kernel driver of the terminal injects a timed out error instruction into the GPU hardware.
5. A screen rendering method according to claim 1, characterized in that: The terminal is a Cgroup-based terminal, and the kernel driver is a GPU kernel driver.
