Window synthesizer rendering rear end switching method compatible with different domestic graphics card performances
By obtaining the graphics card model and determining whether it is on the blacklist, dynamically switching the 2D or 3D rendering backend, the performance adaptation problem of domestic graphics cards is solved, the stability of graphics operations and user experience are improved, and the rendering needs in virtual environments are adapted. .
Patent Information
- Application Number
- CN202411796184.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology is difficult to effectively adapt to the performance differences of domestic graphics cards, resulting in unstable graphics operation, especially in low-performance graphics cards and virtual environments, which cannot provide high-quality window display effects.
By obtaining graphics card model information, determine whether it is in the preset blacklist. If so, set it to the 2D rendering backend and turn off the special effects. If not, set it to the 3D rendering backend and turn on the special effects, and set it to the 2D rendering by default in the virtual environment. rear end.
It realizes the adaptation of domestic graphics cards, improves the stability and user experience of graphics operations, ensures that low-performance graphics cards use 2D rendering by default, and high-performance graphics cards support a variety of special effects, avoiding the problem of gl call stuck in graphics cards.
Smart Images

Figure CN119251371A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method for switching a window compositor rendering backend that is compatible with the performance of different domestic graphics cards. Background Art
[0002] There are performance differences between discrete graphics cards and integrated graphics cards, and there are also performance differences between different series of discrete graphics cards. How our domestic operating systems can make specialized adaptations for these different graphics card capabilities to ensure the graphics operation of end users is a problem that we often need to face in the whole machine adaptation.
[0003] Chinese patent application CN202110837309.6 discloses "a method for switching the window management rendering backend by detecting the graphics card capability", and proposes a method of detecting the graphics card capability value to switch different window managers. The frame rate FPS is calculated by drawing QGLWidget. If it is lower than a threshold, the marco window manager will be started, and if the threshold is reached, ukui-kwin will be started. In other words, the rendering backend of switching window management in this patent is achieved by starting different window managers, but due to the diversity of graphics card driver implementations, some domestic graphics cards have encountered problems with the graphics card's gl call being stuck, unable to start or exit, resulting in certain limitations in the use of this solution.
[0004] Chinese patent application CN202011160368.6 discloses a method for controlling window display effects. In an already running system desktop environment, it provides a display effect switching function, and before the user requests a switch, it first determines whether the current computing device can support the window switching display effect, including transparent effects, minimized animation effects, etc. The function of switching window display effects will be provided to the user only when the actual hardware configuration of the computing device and the current load and operating capacity can support the window switching display effect. That is, the rendering backend has always been OpenGL, and the display effect switching function proposed in the patent has not been adapted to the rendering performance of domestic graphics cards.
[0005] Therefore, there is an urgent need for a method that can effectively solve the adaptation problem of domestic graphics cards. Summary of the invention
[0006] In order to solve the adaptation problem of domestic graphics cards, the present invention provides a method for switching a window synthesizer rendering backend compatible with different domestic graphics card performances, which adopts the following technical solutions: A method for switching a window compositor rendering backend compatible with different domestic graphics card performances, characterized by comprising: Get the graphics card model information of the currently used graphics card; Determine whether the graphics card model information is in a preset graphics card blacklist file; If it is, the rendering backend is set to 2D rendering backend, the synthesizer corresponding to the 2D rendering backend is started, and all special effects are turned off; If not, set the rendering backend to the 3D rendering backend, start the synthesizer corresponding to the 3D rendering backend, and turn on special effects.
[0007] In another possible implementation, obtaining the graphics card model information of the currently used graphics card includes: Use the udev library to obtain the graphics card model information of the currently used graphics card.
[0008] In another possible implementation, the graphics card model information includes VID and DID. The graphics card model information of the currently used graphics card is obtained through the udev library, including: Initialize udev context and enumerator; Add preset udev matching rules, find all device nodes under the DRM subsystem through the preset udev matching rules, and obtain the parent PCI device of any device node; Read the vendor and device properties of the parent PCI device to get the VID and DID.
[0009] In another possible implementation manner, determining whether the graphics card model information is in a preset graphics card blacklist file includes: Read the preset graphics card blacklist file and save the reading result to the dynamic array type variable gpuInfoVector; Traverse the dynamic array gpuInfoVector and match the graphics card model information of the dynamic array members with the obtained graphics card model information.
[0010] In another possible implementation, if in , the rendering backend is set to the 2D rendering backend, and the synthesizer corresponding to the 2D rendering backend is started, and all special effects are turned off, including: If yes, it is determined that the graphics card currently in use is a low-performance graphics card, and checkAndSetCompositingBackend("XRender") is executed to generate a parameter configuration file for the window manager; The parameter configuration file is read through the reloadCompositingSettings function to determine that the current rendering backend is a 2D rendering backend, set the rendering backend to the 2D rendering backend, start the synthesizer corresponding to the 2D rendering backend, and turn off all special effects.
[0011] In another possible implementation, if it is not, the rendering backend is set to the 3D rendering backend, and the synthesizer corresponding to the 3D rendering backend is started, and special effects are turned on, including: If not, determine that the graphics card currently in use is a high-performance graphics card, and execute checkAndSetCompositingBackend("OpenGL") to generate a parameter configuration file for the window manager; The parameter configuration file is read through the reloadCompositingSettings function to determine that the current rendering backend is a 3D rendering backend, and the synthesizer corresponding to the 3D rendering backend is started, and special effects are enabled.
[0012] In another possible implementation, the method further includes: Determine whether you are currently in a virtual environment or remote desktop; If it is, directly set the rendering backend to 2D rendering backend, start the synthesizer corresponding to the 2D rendering backend, and turn off all special effects; If not, continue to obtain the graphics card model information of the currently used graphics card.
[0013] In summary, this application includes the following beneficial technical effects: (1) Add a self-check mechanism for synthesizer startup, and start the corresponding synthesizer rendering backend based on the detection situation. (2) Adapt to domestic low-performance graphics cards. When a low-performance graphics card is detected, the 2D rendering backend is started by default. (3) Adapt to the virtual environment. In environments such as remote desktop virtual machines, the 2D rendering backend is started by default. (4) For domestic graphics cards with better performance, the 3D rendering backend is enabled by default, supporting a variety of special effects rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a structural schematic diagram of a method for switching a window compositor rendering backend compatible with different domestic graphics card performances in an embodiment of the present application.
[0015] Figure 2 It is a flowchart of a method for switching a window compositor rendering backend compatible with different domestic graphics card performances in an embodiment of the present application. DETAILED DESCRIPTION
[0016] The present application is further described in detail below in conjunction with the accompanying drawings.
[0017] After reading this specification, those skilled in the art may make non-creative modifications to this embodiment as needed, but such modifications are protected by patent law as long as they are within the scope of the claims of this application.
[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0019] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.
[0020] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0021] First, a brief explanation of the rankings involved in the present invention is: Window manager: System software used to control how application windows on the operating system desktop are displayed and how they interact. This includes window order, position, shape, etc. In modern desktop operating systems, window managers are an indispensable and important role. In the domestic Kirin desktop operating system, the window manager is ukui-kwin; in UOS, it is deepin-kwin; and in Zhongke Fangde, the window manager is mutter.
[0022] Window effects: Window effects refer to transparent windows, window shadow borders, animation effects, etc. The implementation principle of this type of effect is that all application window contents are first redirected to the off-screen cache, and the synthesizer takes the contents of the upper and lower overlay windows on the desktop and synthesizes them.
[0023] 3D compositor: 3D hardware acceleration support based on OpenGL, using hardware capabilities to synthesize window content, enhancing the system's 3D display performance. Due to the strong computing power of the GPU, this compositor supports more special effects.
[0024] 2D compositor: does not use the graphics card's hardware acceleration, but uses software for synthesis, and uses the XComposite plug-in to get the off-screen buffer and then synthesize, consuming CPU resources. Since the CPU has too many things to do and it is not a dedicated graphics computing unit, this type of compositor can only support some simple special effects.
[0025] PCI function device nodes: These nodes directly correspond to specific hardware devices, such as: USB host controller, which is used to manage USB ports and USB devices connected to these ports. Network adapter, which is responsible for the computer's network connection. Graphics card device node related to this patent, which is responsible for graphics output, etc. There are also audio controllers, RAID controllers, etc.
[0026] Since the rendering backend of the 3D compositor is OpenGL, the rendering backend of the 2D compositor is XRender. Among them, OpenGL is 3D acceleration, which is clearly rendered through the GPU. The goal of XRender is to achieve 2D acceleration through hardware, but the actual implementation is not necessarily, it depends on the support of the X server and the graphics hardware driver. If it is supported, 2D rendering can be performed through hardware. If it is not supported, it has to calculate the rendering through the CPU. 2D rendering usually has low requirements for computing resources and can achieve high-quality output on weaker hardware. 3D rendering requires stronger computing power and graphics processing capabilities, especially when dealing with high resolution and complex window effects. Enabling the 3D rendering compositor on a graphics card with poor performance will cause user operations to be very laggy. Therefore, for those devices with poor graphics card performance, it is more appropriate to use 2D rendering.
[0027] Moreover, due to the diversity of graphics card driver implementations, when the OpenGL backend is started, it is stuck in the gl call of the graphics card and cannot be exited. When other desktop applications are started, they cannot exit when entering the QApplication constructor, and the taskbar and desktop cannot be completely started and the screen is black. This kind of problem has occurred in the adaptation of GP201 graphics cards, Core Motion graphics cards, etc.
[0028] In order to solve such problems, Figure 1 As shown, this application adds a startup self-check mechanism for the synthesizer when the window manager is started. Add those graphics card models that do not implement OpenGL well to the blacklist. The basis for setting this list is a large number of whole machine adaptation sample data of domestic operating systems, the file name is / etc / xdg / LowVgaPci.list.
[0029] Specifically, the embodiment of the present application provides a method for switching a window compositor rendering backend compatible with different domestic graphics card performances, such as Figure 1 as well as Figure 2 As shown, the method includes: 1. Get the graphics card model information of the currently used graphics card.
[0030] For the embodiment of the present application, the graphics card signal information includes two parts: VID (Vendor ID) and DID (Device ID), where VID refers to the vendor ID and DID refers to the device ID. Both parts are hexadecimal numbers used to uniquely identify the manufacturer and specific model of the PCI device. The format is usually "VVVV:DDDD", where "VVVV" represents the vendor ID, "DDDD" represents the device ID, and each V or D represents a hexadecimal character. For example, the PCI_ID value of the domestic graphics card Jingjiawei 7200 is 0731:7200.
[0031] Specifically, you can use GPUStatus udevGetGPUsStatus(const QVector <gpuinfo>&gpuInfoVector) function to obtain the graphics card model information. The function is to obtain the graphics card model information of the currently used graphics card through the udev library. The specific steps are: Initialize udev context and enumerator; Add a preset matching rule to find all device nodes under the DRM subsystem through the preset udev matching rule. Since the parent PCI devices of the device nodes under the same DRM subsystem are the same, you can call udev_device_get_parent_with_subsystem_devtype() on any device node in all device nodes to get the parent PCI device. Specifically, you can call udev_device_get_parent_with_subsystem_devtype() on the first device in all device nodes to get the parent PCI device. Read the vendor and device properties of the parent PCI device to query the device's PCI_ID properties, namely VID and DID.
[0032] Furthermore, in the embodiment of the present application, the acquired graphics card model information is stored in the structure GPUStatus.
[0033] Furthermore, because when in a virtual environment or remote desktop, rendering too many special effects may cause user operations to be stuck and the user experience to be poor, in the embodiment of the present application, before obtaining the graphics card model information, it can be determined whether the current environment is a virtual environment or a remote desktop. If it is, it is determined that too many special effects cannot be rendered at present, that is, the rendering backend can be directly set to XRender, that is, the 2D rendering backend is used. If it is not, it means that the rendering backend needs to be determined based on the graphics card performance, that is, the graphics card model information is obtained again at this time, and the following steps are continued.
[0034] 2. Start the synthesizer self-check mechanism to determine whether the graphics card model information is in the preset graphics card blacklist file. If so, set the rendering backend to the 2D rendering backend, start the synthesizer corresponding to the 2D rendering backend, and turn off all special effects; if not, set the rendering backend to the 3D rendering backend, start the synthesizer corresponding to the 3D rendering backend, and turn on the special effects.
[0035] For the embodiment of the present application, the preset graphics card blacklist file records the graphics card model information of multiple low-performance graphics cards. For example, for domestic graphics cards such as Xintong, Xindong Fenghua, Jingjiawei graphics cards, Feiteng X100 integrated graphics, Loongson integrated graphics, GP101, GP201, and Rockchip, GP101 and Jingjiawei 7200 graphics cards obviously cannot support overly fancy window special effects. Therefore, the graphics card model information of GP101 and Jingjiawei 7200 can be stored in the preset graphics card blacklist file. In the embodiment of the present application, the path and file name of the preset graphics card blacklist file are: / etc / xdg / LowVgaPci.list. When storing, the specific written content can be: 0709:0001:CSMicro GP101 0731:7200:JINGJIA MICRO JM7200 Graphics Card Among them, 0709:0001 is VID:DID, and CSMicro GP101 is the graphics card description information.
[0036] Specifically, the above steps of determining the rendering backend can be implemented through the bool X11StandalonePlatform::needSetXRenderBackendBasedOnGPUStatus() const function. The specific functions of this function are as follows: First, read the preset graphics card blacklist file / etc / xdg / LowVgaPci.list. Since multiple low-performance graphics cards can be defined in the preset graphics card blacklist file and the preset graphics card blacklist file is extensible, the reading result is saved to the dynamic array type variable gpuInfoVector, and then the dynamic array gpuInfoVector is traversed to match the VID:DID of the array member with the VID and DID information in the graphics card model information; If the match is complete, it is determined that the currently used graphics card is a low-performance graphics card. CheckAndSetCompositingBackend("XRender") is executed to generate the parameter configuration file of the window manager. The parameter configuration file is saved in .config / ukui-kwinrc in the user directory. Assuming that the graphics card is a JJW7200 graphics card with poor performance, the content of the parameter configuration file generated by this function is as follows: [Compositing] AutoBackend=XRender Backend=Xrender Then, the parameter information of the window manager is reloaded through the void Options::reloadCompositingSettings(bool force) function, that is, the parameter configuration file is read, the current rendering backend is determined, that is, the current rendering backend is determined to be a 2D rendering backend, the rendering backend is set to the 2D rendering backend, and the compositor corresponding to the 2D rendering backend, that is, the XRender compositor, is started, and all special effects are turned off.
[0037] If the match fails, it is determined that the graphics card currently in use is a high-performance graphics card. CheckAndSetCompositingBackend("OpenGL") is executed to generate a parameter configuration file for the window manager. The parameter configuration file is saved in .config / ukui-kwinrc in the user directory. Assuming that the graphics card is an AMD graphics card with good performance, the content of the parameter configuration file generated by this function is as follows: [Compositing] AutoBackend=OpenGL Backend=OpenGL Then reload the window manager's parameter information through the void Options::reloadCompositingSettings(bool force) function, that is, read the parameter configuration file, determine the current rendering backend, that is, determine that the current rendering backend is a 3D rendering backend, set the rendering backend to a 2D rendering backend, and start the synthesizer corresponding to the 3D rendering backend, that is, the OpenGL synthesizer, and turn on special effects.
[0038] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.< / gpuinfo>
Claims
1. A method for switching a window compositor rendering backend compatible with different domestic graphics card performances, characterized in that: include: Get the graphics card model information of the currently used graphics card; Determine whether the graphics card model information is in a preset graphics card blacklist file; If it is, the rendering backend is set to 2D rendering backend, the synthesizer corresponding to the 2D rendering backend is started, and all special effects are turned off; If not, set the rendering backend to the 3D rendering backend, start the synthesizer corresponding to the 3D rendering backend, and turn on special effects.
2. According to claim 1, a method for switching a window synthesizer rendering backend compatible with different domestic graphics card performances is characterized in that: Get the graphics card model information of the currently used graphics card, including: Use the udev library to obtain the graphics card model information of the currently used graphics card.
3. The method for switching the window synthesizer rendering backend compatible with different domestic graphics card performances according to claim 2, characterized in that: The graphics card model information includes VID and DID. The graphics card model information of the currently used graphics card is obtained through the udev library, including: Initialize udev context and enumerator; Add preset udev matching rules, find all device nodes under the DRM subsystem through the preset udev matching rules, and obtain the parent PCI device of any device node; Read the vendor and device properties of the parent PCI device to get the VID and DID.
4. The method for switching a window synthesizer rendering backend compatible with different domestic graphics card performances according to claim 1, characterized in that: Determining whether the graphics card model information is in a preset graphics card blacklist file includes: Read the preset graphics card blacklist file and save the reading result to the dynamic array type variable gpuInfoVector; Traverse the dynamic array gpuInfoVector and match the graphics card model information of the dynamic array members with the obtained graphics card model information.
5. The method for switching the window synthesizer rendering backend compatible with different domestic graphics card performances according to claim 1, characterized in that: If it is, the rendering backend is set to 2D rendering backend, and the synthesizer corresponding to the 2D rendering backend is started, and all special effects are turned off, including: If yes, it is determined that the currently used graphics card is a low-performance graphics card, and checkAndSetCompositingBackend("XRender") is executed to generate a parameter configuration file for the window manager; The parameter configuration file is read through the reloadCompositingSettings function to determine that the current rendering backend is a 2D rendering backend, set the rendering backend to a 2D rendering backend, start the synthesizer corresponding to the 2D rendering backend, and turn off all special effects.
6. The method for switching the window compositor rendering backend compatible with different domestic graphics card performances according to claim 1, characterized in that: If not, set the rendering backend to 3D rendering backend, start the synthesizer corresponding to the 3D rendering backend, and enable special effects, including: If not, determine that the graphics card currently in use is a high-performance graphics card, and execute checkAndSetCompositingBackend("OpenGL") to generate a parameter configuration file for the window manager; The parameter configuration file is read through the reloadCompositingSettings function to determine that the current rendering backend is a 3D rendering backend, and the synthesizer corresponding to the 3D rendering backend is started, and special effects are enabled.
7. The method for switching a window compositor rendering backend compatible with different domestic graphics card performances according to claim 1, characterized in that: The method further comprises: Determine whether you are currently in a virtual environment or remote desktop; If it is, directly set the rendering backend to 2D rendering backend, start the synthesizer corresponding to the 2D rendering backend, and turn off all special effects; If not, continue to obtain the graphics card model information of the currently used graphics card.
Citation Information
Patent Citations
Method and device for automatically setting parameters of video card
CN102436363A
Matching method and system for multiple touch screens and display devices
CN111104004A
Method for switching windows to manage rendering rear end by detecting capacity of display card
CN113674132A
Straight-through method for LXC container graphics card
CN116860393A
Cited By
Self-adaptive switching method and system for rendering rear end of domestic graphics card window manager
CN121858369A
