Dynamic rendering adaptation method and system, electronic equipment and storage medium
By obtaining the target operating system's environmental detection information, selecting a suitable rendering backend engine, integrating the open-source Mesa driver component, isolating closed-source driver interference, adjusting the graphics driver's rendering information, and creating a lightweight container environment to preload dependency libraries, we solved the compatibility and stability issues in the graphics rendering process, and improved the clarity of the interface display and the stability of the program.
Patent Information
- Application Number
- CN202510635105.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-09-19
AI Technical Summary
There are compatibility issues in the graphics rendering process in the existing technology, which lead to black screens, abnormal interface display, disproportionate interface elements and fuzzy font display, missing or frequent conflicts in dependent libraries, affecting user experience and program stability.
By obtaining the target operating system's environmental detection information, selecting a suitable rendering backend engine, integrating the open-source Mesa driver component, isolating closed-source driver interference, adjusting the graphics driver's rendering information, and creating a lightweight container environment to preload dependency libraries, we ensure that the resource loading path is correct.
It solves compatibility issues in the graphics rendering process, improves the clarity and consistency of the interface display, avoids operation interruptions caused by insufficient drivers or missing dependent libraries, and ensures stable operation of the program in the target operating system.
Smart Images

Figure CN120669940A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graphics processing technology, and in particular to a dynamic rendering adaptation method, a dynamic rendering adaptation system, an electronic device, and a computer-readable storage medium. Background Art
[0002] Compatibility issues with graphics rendering technology have always been a significant factor affecting program performance. Due to the diversity of graphics drivers and varying system environments, existing technologies often result in black screens and display anomalies during rendering. This is especially true in certain operating systems, where insufficient graphics driver support prevents hardware acceleration from being enabled, severely impacting the user experience.
[0003] On the other hand, issues with interface display refinement and library loading also hinder the normal operation of programs. In existing technologies, the adaptation of screen resolution and display settings often lacks flexibility, resulting in disproportionate interface elements or blurred fonts, making it difficult to meet users' demands for clear visuals. Furthermore, the frequent absence or conflict of library dependencies in the system environment prevents programs from obtaining necessary support resources during startup or operation, resulting in limited functionality or operational interruptions. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a dynamic rendering adaptation method, a dynamic rendering adaptation system, an electronic device, and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0005] In order to solve the above problems, an embodiment of the present invention discloses a dynamic rendering adaptation method, which is applied to a target operating system. The method includes:
[0006] Obtaining environmental detection information of the target operating system;
[0007] Selecting a rendering backend engine according to the environmental detection information;
[0008] Performing compatibility processing on the graphics driver according to the rendering backend engine;
[0009] Adjusting the information to be rendered according to the graphics driver after compatibility processing;
[0010] The dependent library is loaded to adapt the rendering backend engine and the display operation of the information to be rendered.
[0011] Optionally, obtaining the environment detection information of the target operating system includes:
[0012] Obtaining OpenGL version information through a detection tool, and / or reading a session type parameter of the target operating system;
[0013] determining, based on the version information, whether the OpenGL version is lower than a preset threshold or whether a driver is available, and / or determining, based on the session type parameter, whether the current session is an X11 or Wayland session;
[0014] generating compatibility status data and / or session type data according to the determination result;
[0015] The compatibility status data and / or the session type data are used as the environment detection information.
[0016] Optionally, selecting a rendering backend engine according to the environment detection information includes:
[0017] Determining whether the OpenGL is available according to the environment detection information;
[0018] If the OpenGL is available, selecting the rendering backend engine corresponding to the hardware acceleration;
[0019] If the OpenGL is not available, determining whether the current session type is a Wayland session according to the environment detection information;
[0020] If the current session type is a Wayland session, selecting the rendering backend engine corresponding to the Wayland protocol;
[0021] If the current session type is not a Wayland session, the rendering backend engine corresponding to XCB combined with software rendering is selected.
[0022] Optionally, performing compatibility processing on the graphics driver according to the rendering backend engine includes:
[0023] According to the rendering backend engine, the open source Mesa driver component is integrated, and the compatibility interference of the closed-source driver is isolated through the virtualization layer.
[0024] Optionally, adjusting the information to be rendered according to the graphics driver after compatibility processing includes:
[0025] The graphics driver reads the dots per inch value from a system configuration file according to the compatibility processing, or calculates the dots per inch value according to the physical size and resolution of the screen;
[0026] The scaling of the interface elements is adjusted according to the dots per inch value, and the font display size is adjusted.
[0027] Optionally, the adjusting the information to be rendered according to the graphics driver after compatibility processing further includes:
[0028] Loading system fonts according to the font fallback mechanism according to the graphics driver after compatibility processing;
[0029] If the system font is missing, switch to loading the open source font library to obtain font configuration data;
[0030] The display size of the font configuration data is adjusted according to the dots per inch value.
[0031] Optionally, the loading of a dependency library to adapt the rendering backend engine and the display operation of the information to be rendered includes:
[0032] Creating a lightweight container environment based on the rendering backend engine and the operational requirements of the dots per inch setting and font display in the information to be rendered;
[0033] Preloading the dependent library missing from the system in the container environment;
[0034] The loading path of the dependent library is adjusted by setting environment variables to ensure that the dependent library is loaded correctly.
[0035] An embodiment of the present invention further discloses a dynamic rendering adaptation system, which is applied to a target operating system. The dynamic rendering adaptation system includes:
[0036] An environment detection information acquisition module, used to obtain the environment detection information of the target operating system;
[0037] A rendering backend engine selection module, configured to select a rendering backend engine according to the environment detection information;
[0038] A compatibility processing module, configured to perform compatibility processing on the graphics driver according to the rendering backend engine;
[0039] A setting and display adjustment module, configured to adjust the information to be rendered according to the graphics driver after compatibility processing;
[0040] The dependency library loading module is used to load the dependency library to adapt to the rendering backend engine and the display operation of the information to be rendered.
[0041] Optionally, the environment detection information acquisition module includes:
[0042] A version parameter acquisition module, configured to obtain OpenGL version information through a detection tool, and / or read a session type parameter of the target operating system;
[0043] a version session determination module, configured to determine, based on the version information, whether the OpenGL version is lower than a preset threshold or whether a driver is available, and / or, based on the session type parameter, determine whether the current session is an X11 or Wayland session;
[0044] A data generation module, configured to generate compatibility status data and / or session type data according to the judgment result;
[0045] The environment information determination module is configured to use the compatibility status data and / or the session type data as the environment detection information.
[0046] Optionally, the rendering backend engine selection module includes:
[0047] An OpenGL determination module, configured to determine whether the OpenGL is available according to the environment detection information;
[0048] An engine selection module, configured to select the rendering backend engine corresponding to hardware acceleration if the OpenGL is available;
[0049] a session determination module, configured to determine whether the current session type is a Wayland session based on the environment detection information if the OpenGL is unavailable;
[0050] The engine selection module is further configured to select the rendering backend engine corresponding to the Wayland protocol if the current session type is a Wayland session;
[0051] The engine selection module is further configured to select the rendering backend engine corresponding to XCB combined with software rendering if the current session type is not a Wayland session.
[0052] Optionally, the compatibility processing module is used to integrate an open source Mesa driver component according to the rendering backend engine, and isolate the compatibility interference of the closed source driver through a virtualization layer.
[0053] Optionally, the setting and display adjustment module includes:
[0054] A dot per inch acquisition module, configured to read the dot per inch value from a system configuration file according to the graphics driver after compatibility processing, or to calculate the dot per inch value according to the physical size and resolution of the screen;
[0055] The scaling ratio adjustment module is used to adjust the scaling ratio of the interface elements according to the dots per inch value and adjust the font display size.
[0056] Optionally, the setting and display adjustment module further includes:
[0057] A system font loading module, configured to load system fonts according to a font fallback mechanism based on the graphics driver after compatibility processing;
[0058] An open source font loading module, configured to switch to loading an open source font library to obtain font configuration data if the system font is missing;
[0059] A display size adjustment module is configured to adjust the display size of the font configuration data according to the dots per inch value.
[0060] Optionally, the dependency library loading module includes:
[0061] A container environment creation module, configured to create a lightweight container environment based on the rendering backend engine and the operational requirements of the dots per inch setting and font display in the information to be rendered;
[0062] A dependency library preloading module, used to preload the dependency library missing from the system in the container environment;
[0063] The loading path adjustment module is used to adjust the loading path of the dependent library by setting environment variables to ensure that the dependent library is loaded correctly.
[0064] An embodiment of the present invention further discloses an electronic device, comprising: one or more processors; and one or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, enables the electronic device to perform the dynamic rendering adaptation method described above.
[0065] An embodiment of the present invention further discloses a computer-readable storage medium, which stores a computer program that enables a processor to execute the dynamic rendering adaptation method described above.
[0066] The embodiments of the present invention include the following advantages:
[0067] The dynamic rendering adaptation solution provided by an embodiment of the present invention is applied to a target operating system. The solution obtains environmental detection information from the target operating system; selects a rendering backend engine based on the environmental detection information; performs compatibility processing on the graphics driver based on the rendering backend engine; adjusts the information to be rendered based on the graphics driver after the compatibility processing; and loads dependent libraries to adapt the rendering backend engine and the display operation of the information to be rendered.
[0068] Compared with the background technology, the embodiments of the present invention have the following beneficial effects:
[0069] By acquiring environmental detection information from the target operating system and selecting a rendering backend engine based on that information, the embodiments of the present invention can flexibly determine the rendering method based on the actual system environment. This targeted selection avoids the black screen or interface display anomalies caused by the diversity of graphics drivers and differences in system environments in the prior art. This is because different rendering backend engines can adapt to different driver support capabilities and session types, thereby reducing the possibility of compatibility conflicts.
[0070] Moreover, after selecting the rendering backend engine, the graphics driver is processed for compatibility, and the information to be rendered is adjusted according to the processed graphics driver to ensure the adaptability of the information to be rendered under different resolutions and display settings. By specifically processing the compatibility issues of the graphics driver, the impact of insufficient drivers on the rendering effect is reduced. In addition, by adjusting the information to be rendered, the defects of the disproportionate proportions of interface elements and blurred fonts in the background technology are solved, making the visual effect clearer and more consistent. In addition, the dependent library is loaded to adapt the rendering backend engine and the display operation of the information to be rendered. By providing the necessary resource support, the function limitation or operation interruption caused by the lack or conflict of the dependent library in the background technology is avoided, and the stable operation of the program in the target operating system is ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 This is a flowchart of the steps of a dynamic rendering adaptation method according to an embodiment of the present invention;
[0072] Figure 2 This is a structural block diagram of a dynamic rendering adaptation system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0073] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0074] An embodiment of the present invention provides a dynamic rendering adaptation solution, one of the goals of which is to optimize graphics rendering and interface display effects in a target operating system, addressing compatibility and stability issues through a series of technical steps. This solution includes obtaining environmental detection information, selecting a rendering backend engine based on this environmental detection information, performing compatibility processing on the graphics driver, adjusting the information to be rendered to adapt to interface elements and font clarity, and loading dependent libraries to preload missing resources in a sandbox environment to adapt to related operations. This significantly improves the program's performance and user experience in the target operating system.
[0075] Reference Figure 1, shows a flowchart of the steps of a dynamic rendering adaptation method according to an embodiment of the present invention. The dynamic rendering adaptation method can be applied to a target operating system (hereinafter referred to as the system). The dynamic rendering adaptation method may specifically include the following steps:
[0076] Step 101: Obtain environment detection information of the target operating system.
[0077] Obtaining environmental detection information includes obtaining the version information of the Open Graphics Library (OpenGL) through a detection tool, and determining whether the version is lower than a preset threshold or whether the driver is available. If the OpenGL version is lower than a preset threshold (such as 3.0) or the driver is not available, compatibility status data will be generated based on the judgment result and marked as low compatibility mode for subsequent decision-making. In addition, obtaining environmental detection information also includes reading the system session type parameter to determine whether the current session type is X11 (X Window System Version 11, referred to as X11) or Wayland session, and generating session type data based on the judgment result. X11 and Wayland are two different display server protocols. The difference in session type directly affects the selection of the rendering engine, so this detection is crucial. Through the above detection, the compatibility status data and session type data are finally integrated into environmental detection information as input data for subsequent steps.
[0078] Environmental monitoring information isn't limited to the two items mentioned above. If other system environment factors affect rendering, these can also be detected and recorded in a similar manner to ensure completeness. For example, in complex environments, specific graphics hardware parameters or system configurations may also need to be tested. These can supplement environmental monitoring information and ensure that subsequent decisions are based on comprehensive data.
[0079] Step 102: Select a rendering backend engine based on the environment detection information.
[0080] Whether OpenGL is available is determined based on the compatibility status data in the environment detection information. If OpenGL is available (i.e., the version reaches the preset threshold and the driver is normal), a rendering backend engine that supports hardware acceleration is selected to fully utilize the system's graphics processing capabilities and improve rendering efficiency. Secondly, if OpenGL is not available, the session type data in the environment detection information is further used to determine whether the current session type is a Wayland session. If it is a Wayland session, the rendering backend engine corresponding to the Wayland protocol is selected, because Wayland sessions usually support more modern rendering mechanisms and can provide better compatibility when OpenGL is not available. Finally, if OpenGL is not available and the current session type is not a Wayland session (usually an X11 session), the X Protocol C-language Binding (XCB) is selected in combination with the rendering backend engine corresponding to software rendering. Software rendering is used to bypass hardware driver limitations and ensure the basic implementation of rendering functions.
[0081] For example, in a system environment, if the OpenGL version is detected to be lower than 3.0 and the session type is X11, an engine combining XCB and software rendering will be selected to avoid black screen issues caused by unavailable hardware acceleration. This selection process fully considers the diversity and complexity of the system environment, ensuring that an adapted rendering method can be found regardless of the system environment, avoiding compatibility failures caused by a single rendering mode. In addition, the logic for selecting the rendering backend engine can be expanded according to actual needs. For example, in some special environments, additional rendering engine options or priority rules may need to be considered to further optimize the adaptation effect.
[0082] Step 103: Perform compatibility processing on the graphics driver according to the rendering backend engine.
[0083] Compatibility management involves two key steps: First, integrating the open-source Mesa driver component based on the selected rendering backend engine to support rendering operations. Mesa is an open-source graphics driver library that supports a variety of rendering backend engines. By integrating the Mesa driver component, the rendering backend engine can be provided with the necessary graphics processing capabilities. This is particularly useful when the system's native driver is insufficient, as Mesa can serve as an alternative to ensure rendering functionality. For example, if an engine that uses XCB combined with software rendering is selected on a system where OpenGL is unavailable, integrating the Mesa driver component provides the underlying support required for software rendering, preventing rendering failures. Second, compatibility management involves isolating closed-source drivers from compatibility issues that may arise through a virtualization layer to enhance graphics driver stability. Because closed-source drivers lack visible code, they often experience incompatibilities with the system environment or rendering backend engine, potentially leading to conflicts or instability during rendering. By isolating potential compatibility issues caused by closed-source drivers from the rest of the system, the virtualization layer effectively prevents these issues from impacting the rendering process and ensures graphics driver stability in various environments. This process fully considers the complexity and uncertainty of graphics drivers in the target operating system. By integrating open-source driver components and isolating interference from closed-source drivers, it ensures a high degree of compatibility between the graphics driver and the rendering backend engine. Furthermore, compatibility processing can be expanded based on the actual system environment. For example, in some special environments, it may be necessary to integrate other open-source driver libraries or adopt different isolation technologies to further optimize the graphics driver's support capabilities.
[0084] Step 104: Adjust the information to be rendered according to the graphics driver after the compatibility processing.
[0085] The information to be rendered can refer to, for example, the display settings in the target operating system. For example, the information to be rendered can include, but is not limited to, dots per inch (DPI) settings and font display information. The process of adjusting the information to be rendered involves several key operations: First, the DPI value is read from the system configuration file based on the graphics driver after compatibility adjustments, or, if no configuration file is available, the DPI value is calculated based on the screen's physical size and resolution to obtain accurate DPI data. This data reflects the screen's pixel density and serves as the basis for adjusting the display scale. For example, on a system with a high-resolution screen, if the DPI value read from the configuration file is 120, subsequent adjustments will be based on this value for scale calculations. Second, the scaling of interface elements is adjusted based on the obtained DPI data to ensure that interface elements appear appropriately proportioned across different resolutions and screen sizes, avoiding display anomalies caused by disproportionate proportions. Furthermore, the font display size is adjusted based on the DPI data to ensure that the font size matches the screen's pixel density, avoiding blurry or unclear text caused by fonts that are too small or too large.
[0086] In order to further optimize the font display effect, the adjustment process also includes prioritizing the loading of system fonts according to the font fallback mechanism. If the system font is missing, it switches to the open source font library to determine the final font configuration data. This mechanism ensures that when the system font is unavailable, a suitable alternative font can still be selected to maintain the clarity and consistency of the font display. When adjusting the font display size, the pixel size of the font configuration data will be dynamically calculated and adjusted according to the dots per inch data to adapt to the display characteristics of the screen. This process fully considers the diversity of the display environment in the target operating system, and ensures the best presentation of display setting information such as interface elements and fonts by adjusting the rendering information. In addition, the adjustment process can also be expanded according to actual needs. For example, in some special display environments, it may be necessary to additionally consider factors such as screen orientation or multi-monitor configuration to further optimize display adaptability.
[0087] Step 105: Load dependent libraries to adapt the rendering backend engine and the display operation of the information to be rendered.
[0088] The process of loading dependent libraries involves several key operations: First, a lightweight container environment (also known as a sandbox environment) is created based on the requirements of the rendering backend engine and related display operations (such as dots per inch settings and font display). This container environment serves as an independent runtime space, isolating system-level dependency conflicts and ensuring that subsequently loaded dependent libraries do not interfere with other parts of the system. For example, in a system with complex dependency libraries, creating a lightweight container environment can prevent rendering backend engine failures caused by system-level library conflicts. Second, missing system dependent libraries are preloaded within this container environment to supplement the resources required for program operation. Specific preloaded dependent libraries may include graphics rendering-related libraries (such as libxcb-xinerama0) or other libraries that support dots per inch settings and font display, ensuring the normal execution of the rendering backend engine and display operations. This process prevents program interruptions due to insufficient resources during runtime by preloading missing resources. In addition, the dependency library loading path is adjusted by setting environment variables to ensure that the dependent libraries are loaded correctly. Specific adjustment methods include modifying environment variables (such as LD_LIBRARY_PATH in Linux systems), adding the dependency library path in the container environment to the loading path, and prioritizing loading the library in the container rather than the system default library to avoid dependency conflicts. This adjustment ensures that the program can stably obtain the required resources in the target operating system, supports the selection and operation of the rendering backend engine, and the adjustment of the information to be rendered. The process of loading dependent libraries fully considers the complexity and uncertainty of the resource environment in the target operating system, and ensures the stability of program operation through the three means of creating a container environment, preloading missing libraries, and adjusting the loading path. In addition, this process can also be expanded according to the actual system environment. For example, in some special environments, it may be necessary to load additional dependent libraries or adopt different path adjustment strategies to further optimize the resource adaptation effect.
[0089] By acquiring environmental detection information from the target operating system and selecting a rendering backend engine based on that information, the embodiments of the present invention can flexibly determine the rendering method based on the actual system environment. This targeted selection avoids the black screen or interface display anomalies caused by the diversity of graphics drivers and differences in system environments in the prior art. This is because different rendering backend engines can adapt to different driver support capabilities and session types, thereby reducing the possibility of compatibility conflicts.
[0090] Moreover, after selecting the rendering backend engine, the graphics driver is processed for compatibility, and the information to be rendered is adjusted according to the processed graphics driver to ensure the adaptability of the information to be rendered under different resolutions and display settings. By specifically processing the compatibility issues of the graphics driver, the impact of insufficient drivers on the rendering effect is reduced. In addition, by adjusting the information to be rendered, the defects of the disproportionate proportions of interface elements and blurred fonts in the background technology are solved, making the visual effect clearer and more consistent. In addition, the dependent library is loaded to adapt the rendering backend engine and the display operation of the information to be rendered. By providing the necessary resource support, the function limitation or operation interruption caused by the lack or conflict of the dependent library in the background technology is avoided, and the stable operation of the program in the target operating system is ensured.
[0091] In an exemplary embodiment of the present invention, an implementation method for obtaining environment detection information of a target operating system is: obtaining OpenGL version information through a detection tool, and / or reading a session type parameter of the target operating system; determining whether the OpenGL version is lower than a preset threshold or whether a driver is available based on the version information, and / or determining whether the current session is an X11 or Wayland session based on the session type parameter; generating compatibility status data and / or session type data based on the determination result; and using the compatibility status data and / or session type data as environment detection information.
[0092] OpenGL is a widely used graphics rendering interface. Its version information directly reflects the support capabilities of the system graphics driver, while the session type parameter indicates the system's display server environment. The OpenGL version and driver status determine whether hardware-accelerated rendering can be supported, while the session type (such as X11 or Wayland) affects the selection of the rendering backend engine. For example, in an old system, if the OpenGL version is detected to be lower than the preset threshold and the driver is unavailable, it will be marked as a low compatibility state; if the session type is X11, software rendering may be selected in the future. Then, based on the above judgment results, compatibility status data and / or session type data are generated. The compatibility status data reflects the capability status of the graphics driver, and the session type data records the type of display server environment. Finally, the generated compatibility status data and / or session type data are integrated into environment detection information as a basis for subsequent decision-making on the selection of the rendering backend engine. This implementation method fully takes into account the diversity and complexity of the target operating system environment. By dual detection of the OpenGL version and session type, the comprehensiveness and accuracy of the environment detection information are ensured. In addition, this method is also scalable. If the system environment involves other factors that affect rendering (such as specific hardware parameters), they can also be included in the environmental detection information through similar detection tools or parameter reading methods to further improve the completeness of the detection.
[0093] This implementation method obtains OpenGL version information and session type parameters through detection tools, which can accurately understand the system's graphics processing capabilities and display environment, and then generates compatibility status data and session type data through judgment to ensure that the environmental detection information reflects the actual situation, thereby providing a reliable basis for subsequent rendering back-end engine selection, avoiding rendering anomalies or compatibility conflicts caused by missing or incorrect environmental information, and significantly improving the adaptability and stability of the program in the target operating system.
[0094] In an exemplary embodiment of the present invention, an implementation method of selecting a rendering backend engine based on environment detection information is: judging whether OpenGL is available based on the environment detection information; if OpenGL is available, selecting a rendering backend engine corresponding to hardware acceleration; if OpenGL is not available, judging whether the current session type is a Wayland session based on the environment detection information; if the current session type is a Wayland session, selecting a rendering backend engine corresponding to the Wayland protocol; if the current session type is not a Wayland session, selecting a rendering backend engine corresponding to XCB combined with software rendering.
[0095] For example, in a system equipped with a high-performance graphics card, if the OpenGL version is detected to meet the requirements, selecting a hardware acceleration engine can make graphics rendering smoother. However, if OpenGL is unavailable (i.e., the version is below a preset threshold or the driver is unavailable), the current session type is further determined based on the environmental detection information to determine whether it is a Wayland session. Wayland is a modern display server protocol that provides better rendering support in certain scenarios compared to traditional display systems. If the current session type is a Wayland session, the rendering backend engine corresponding to the Wayland protocol is selected to adapt to the characteristics of this modern protocol and ensure the stability of the rendering effect. Conversely, if the current session type is not a Wayland session, the rendering backend engine corresponding to XCB combined with software rendering is selected. XCB is a lightweight X11 interface library that, combined with software rendering, can achieve graphics rendering through software calculation when hardware acceleration is unavailable, avoiding rendering failures caused by hardware limitations. This implementation method fully considers the diversity of graphics driver capabilities and session types in the target operating system through multi-level judgment logic, ensuring that no matter how complex the system environment is, an adapted rendering backend engine can be found.
[0096] This implementation method can accurately identify the system's rendering support capabilities by judging the availability and session type of OpenGL based on environmental detection information, and then select the rendering backend engine of hardware acceleration, Wayland protocol or XCB combined with software rendering through hierarchical decision-making, ensuring the matching of the rendering method with the system environment, thereby effectively avoiding graphics rendering anomalies or poor performance caused by environmental incompatibility, and improving the program's running stability and display effect in the target operating system.
[0097] In an exemplary embodiment of the present invention, an implementation method for compatibility processing of a graphics driver based on a rendering backend engine is: integrating an open source Mesa driver component based on the rendering backend engine, and isolating the compatibility interference of a closed-source driver through a virtualization layer.
[0098] Mesa is an open-source graphics driver library that supports the operational requirements of various rendering backend engines, covering various modes such as OpenGL hardware acceleration and software rendering. By integrating the Mesa driver component, the rendering backend engine can be provided with the necessary graphics processing capabilities. This is particularly useful when the system's native driver is insufficient or incompatible, as Mesa can serve as an alternative to ensure smooth rendering. For example, on an older system that uses XCB with software rendering, integrating the Mesa driver component can provide the underlying support required for software rendering, avoiding rendering failures caused by missing system drivers. Because closed-source drivers lack visible code, they often experience incompatibilities with the system environment or rendering backend engine, potentially causing conflicts or instability during the rendering process. By using virtualization layer technology, any compatibility issues caused by closed-source drivers can be isolated from the rest of the system, effectively preventing these issues from affecting the rendering process.
[0099] For example, in a mixed driver environment where both closed-source and open-source components coexist, the virtualization layer can isolate the instability of the closed-source driver, ensuring uninterrupted operation of the rendering backend engine. This implementation fully considers the complexity and uncertainty of the graphics driver environment in the target operating system. By integrating the open-source Mesa driver components and isolating interference from closed-source drivers, it ensures a high degree of compatibility between the graphics driver and the rendering backend engine, providing a stable graphical foundation for subsequent interface display adjustments.
[0100] This implementation integrates the open source Mesa driver component according to the rendering backend engine, which can provide the necessary graphics processing support for different rendering requirements. It then isolates the compatibility interference that may be caused by closed-source drivers through the virtualization layer, effectively avoiding the impact of driver conflicts on the rendering process, thereby ensuring the stability of the graphics driver in various system environments, significantly reducing the risk of rendering anomalies caused by driver incompatibility, and improving the reliability of the program's operation in the target operating system.
[0101] In an exemplary embodiment of the present invention, an implementation method of adjusting the information to be rendered according to the graphics driver after compatibility processing is: reading the dots per inch value from the system configuration file according to the graphics driver after compatibility processing, or calculating the dots per inch value according to the physical size and resolution of the screen; adjusting the scaling ratio of the interface elements according to the dots per inch value, and adjusting the font display size.
[0102] The process of adjusting the information to be rendered includes the following key operations: First, the dots per inch (dpi) value is read from the system configuration file based on the graphics driver after compatibility adjustments. If no relevant data is available in the system configuration file, the dot per inch (dpi) value is calculated based on the screen's physical size and resolution. This process ensures that the obtained dot per inch (dpi) data accurately reflects the screen's pixel density, providing a reliable basis for subsequent adjustments. For example, in a system with a high-resolution display device, if the dpi value read from the configuration file is 144, it indicates a high screen pixel density, and subsequent adjustments will be based on this value for proportional adaptation. If no configuration file data is available, an approximate dot per inch (dpi) value can be calculated based on the screen's physical size (e.g., 15 inches) and resolution (e.g., 3840x2160), ensuring the diversity and accuracy of data sources. Second, the scaling of interface elements is adjusted based on the obtained dot per inch (dpi) value, ensuring that interface elements appear appropriately proportioned across different screen resolutions and sizes, avoiding display anomalies or operational difficulties caused by disproportionate proportions. Furthermore, the font size is adjusted based on the dot per inch (dpi) value to align with the screen's pixel density, avoiding illegible fonts that are too small or crowded fonts that are too large. For example, on a system with a small, high-density screen, if the dots per inch value is 200, the font size will be increased accordingly to ensure that the user can clearly read the text content. This implementation fully considers the diversity and complexity of display environments in the target operating system. By reading or calculating the dots per inch data from the configuration file, it ensures the dynamic adaptability of interface elements and font display.
[0103] This implementation method can accurately grasp the screen pixel density characteristics by reading or calculating the dots per inch value from the system configuration file based on the graphics driver after compatibility processing, and then adjust the scaling ratio and font display size of the interface elements according to the value, ensuring the adaptability of the interface and fonts to different display environments, thereby effectively avoiding the problems of disproportion and blurred fonts, and improving the visual clarity and user convenience of the program in the target operating system.
[0104] In an exemplary embodiment of the present invention, an implementation method of adjusting the information to be rendered according to the graphics driver after compatibility processing also includes: loading the system font according to the font fallback mechanism according to the graphics driver after compatibility processing; if the system font is missing, switching to loading the open source font library to obtain font configuration data; adjusting the display size of the font configuration data according to the dots per inch value.
[0105] The font fallback mechanism is a priority strategy that prioritizes system-provided font resources because these fonts are generally highly compatible with the system environment and provide the best display quality and performance. For example, in a common system, if default system fonts such as Songti are available, the font fallback mechanism will prioritize loading these fonts to ensure that font display is consistent with the system style. However, if the system fonts are missing or unavailable (for example, in some streamlined systems where a complete font library is not pre-installed), the system switches to loading open-source font libraries to obtain alternative font resources, thereby obtaining font configuration data. Open-source font libraries typically contain a variety of freely available font resources that can serve as fallback options when system fonts are unavailable, ensuring uninterrupted font display functionality. This process fully guarantees the availability of font resources and avoids display anomalies caused by missing fonts. Secondly, the display size of the font configuration data is adjusted based on the obtained dots per inch value, so that the font size matches the screen pixel density and ensures font clarity and readability at different resolutions and screen sizes. For example, on a small, high-pixel-density device with a dpi value of 200, the font size will be increased to prevent the font from being too small and difficult to read. Conversely, on a large, low-pixel-density device with a smaller font size, the font size will be appropriately reduced to prevent excessive font size from causing clutter in the interface layout. This implementation fully considers the diversity of font resources and display environments in the target operating system, ensuring flexibility and adaptability of font display through a dual mechanism of font fallback and dynamic size adjustment.
[0106] This implementation ensures the availability of font resources by preferentially loading system fonts according to the font fallback mechanism based on the graphics driver after compatibility processing, and switching to the open source font library to obtain font configuration data when missing. It then adjusts the font display size according to the dots per inch value to adapt the font size to the screen characteristics, thereby effectively avoiding blurry or unreadable display problems caused by missing fonts or inappropriate size, and improving the text presentation quality and user visual experience of the program in the target operating system.
[0107] In an exemplary embodiment of the present invention, an implementation method of loading dependent libraries to adapt to the rendering backend engine and the display operation of the information to be rendered is: creating a lightweight container environment according to the rendering backend engine and the operational requirements of the dots per inch setting and font display in the information to be rendered; preloading the dependent libraries missing in the system in the container environment; adjusting the loading path of the dependent libraries by setting environment variables to ensure that the dependent libraries are loaded correctly.
[0108] A lightweight container environment (also known as a sandbox environment) acts as an independent runtime space, isolating system-level dependency conflicts and ensuring that subsequently loaded dependent libraries do not interfere with the rest of the system. The lightweight container environment is created based on the specific rendering backend engine type and the resource requirements for display operations. For example, if the rendering backend engine uses XCB combined with software rendering, and the dots-per-inch setting requires a specific graphics processing library, the container environment is customized to these requirements to provide optimal resource isolation. Secondly, dependent libraries may include those supporting graphics rendering (such as those related to XCB) or font display, ensuring the proper execution of the rendering backend engine and the dots-per-inch setting and font display operations. For example, in a streamlined system, if a specific library supporting font rendering is missing, the corresponding open-source library will be preloaded in the container environment to prevent program crashes due to insufficient resources. Finally, the load path for dependent libraries is adjusted by setting environment variables to ensure that they are correctly loaded. This adjustment involves modifying system environment variables to prioritize the container environment's dependent library paths over potentially conflicting system default libraries. For example, in a system with multiple versions of libraries, adjusting the loading path can ensure that the program loads the preset dependent library version in the container, avoiding runtime errors caused by version conflicts.
[0109] This implementation creates a lightweight container environment based on the rendering backend engine and the dots per inch settings and font display operational requirements of the information to be rendered, which can effectively isolate system-level dependency conflicts. It then ensures the correct loading and use of dependency library resources by preloading missing dependency libraries in the system and setting environment variables to adjust the loading path, thereby avoiding program interruptions caused by insufficient resources or conflicts, and improving the stability and reliability of the program in the target operating system.
[0110] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0111] Reference Figure 2 , shows a structural block diagram of a dynamic rendering adaptation system according to an embodiment of the present invention. The dynamic rendering adaptation system may specifically include the following modules.
[0112] An environment detection information acquisition module 21 is used to obtain environment detection information of the target operating system;
[0113] A rendering backend engine selection module 22 is configured to select a rendering backend engine according to the environment detection information;
[0114] A compatibility processing module 23 is used to perform compatibility processing on the graphics driver according to the rendering backend engine;
[0115] A setting and display adjustment module 24, configured to adjust the information to be rendered according to the graphics driver after compatibility processing;
[0116] The dependency library loading module 25 is used to load the dependency library to adapt to the rendering backend engine and the display operation of the information to be rendered.
[0117] In an exemplary embodiment of the present invention, the environment detection information acquisition module 21 includes:
[0118] A version parameter acquisition module, configured to obtain OpenGL version information through a detection tool, and / or read a session type parameter of the target operating system;
[0119] a version session determination module, configured to determine, based on the version information, whether the OpenGL version is lower than a preset threshold or whether a driver is available, and / or, based on the session type parameter, determine whether the current session is an X11 or Wayland session;
[0120] A data generation module, configured to generate compatibility status data and / or session type data according to the judgment result;
[0121] The environment information determination module is configured to use the compatibility status data and / or the session type data as the environment detection information.
[0122] In an exemplary embodiment of the present invention, the rendering backend engine selection module 22 includes:
[0123] An OpenGL determination module, configured to determine whether the OpenGL is available according to the environment detection information;
[0124] An engine selection module, configured to select the rendering backend engine corresponding to hardware acceleration if the OpenGL is available;
[0125] a session determination module, configured to determine whether the current session type is a Wayland session based on the environment detection information if the OpenGL is unavailable;
[0126] The engine selection module is further configured to select the rendering backend engine corresponding to the Wayland protocol if the current session type is a Wayland session;
[0127] The engine selection module is further configured to select the rendering backend engine corresponding to XCB combined with software rendering if the current session type is not a Wayland session.
[0128] In an exemplary embodiment of the present invention, the compatibility processing module 23 is used to integrate the open source Mesa driver component according to the rendering backend engine, and isolate the compatibility interference of the closed source driver through the virtualization layer.
[0129] In an exemplary embodiment of the present invention, the setting and display adjustment module 24 includes:
[0130] A dot per inch acquisition module, configured to read the dot per inch value from a system configuration file according to the graphics driver after compatibility processing, or to calculate the dot per inch value according to the physical size and resolution of the screen;
[0131] The scaling ratio adjustment module is used to adjust the scaling ratio of the interface elements according to the dots per inch value and adjust the font display size.
[0132] In an exemplary embodiment of the present invention, the setting and display adjustment module 24 further includes:
[0133] A system font loading module, configured to load system fonts according to a font fallback mechanism based on the graphics driver after compatibility processing;
[0134] An open source font loading module, configured to switch to loading an open source font library to obtain font configuration data if the system font is missing;
[0135] A display size adjustment module is configured to adjust the display size of the font configuration data according to the dots per inch value.
[0136] In an exemplary embodiment of the present invention, the dependency library loading module 25 includes:
[0137] A container environment creation module, configured to create a lightweight container environment based on the rendering backend engine and the operational requirements of the dots per inch setting and font display in the information to be rendered;
[0138] A dependency library preloading module, used to preload the dependency library missing from the system in the container environment;
[0139] The loading path adjustment module is used to adjust the loading path of the dependent library by setting environment variables to ensure that the dependent library is loaded correctly.
[0140] As for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0141] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0142] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatus, or computer program products. Thus, embodiments of the present invention may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0143] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the process in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0144] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0145] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0146] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0147] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0148] The above is a detailed introduction to a dynamic rendering adaptation method and a dynamic rendering adaptation system provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A dynamic rendering adaptation method, characterized in that: Applied to a target operating system, the method includes: Obtaining environmental detection information of the target operating system; Selecting a rendering backend engine according to the environmental detection information; Performing compatibility processing on the graphics driver according to the rendering backend engine; Adjusting the information to be rendered according to the graphics driver after compatibility processing; The dependent library is loaded to adapt the rendering backend engine and the display operation of the information to be rendered.
2. The method according to claim 1, characterized in that The acquiring of the environment detection information of the target operating system includes: Obtaining OpenGL version information through a detection tool, and / or reading a session type parameter of the target operating system; determining, based on the version information, whether the OpenGL version is lower than a preset threshold or whether a driver is available, and / or determining, based on the session type parameter, whether the current session is an X11 or Wayland session; generating compatibility status data and / or session type data according to the determination result; The compatibility status data and / or the session type data are used as the environment detection information.
3. The method according to claim 2, characterized in that The selecting a rendering backend engine according to the environment detection information includes: Determining whether the OpenGL is available according to the environment detection information; If the OpenGL is available, selecting the rendering backend engine corresponding to the hardware acceleration; If the OpenGL is not available, determining whether the current session type is a Wayland session according to the environment detection information; If the current session type is a Wayland session, selecting the rendering backend engine corresponding to the Wayland protocol; If the current session type is not a Wayland session, the rendering backend engine corresponding to XCB combined with software rendering is selected.
4. The method according to claim 1, wherein The performing compatibility processing on the graphics driver according to the rendering backend engine includes: According to the rendering backend engine, the open source Mesa driver component is integrated, and the compatibility interference of the closed-source driver is isolated through the virtualization layer.
5. The method according to claim 1, wherein The adjusting the information to be rendered according to the graphics driver after the compatibility processing includes: The graphics driver reads the dots per inch value from a system configuration file according to the compatibility processing, or calculates the dots per inch value according to the physical size and resolution of the screen; The scaling of the interface elements is adjusted according to the dots per inch value, and the font display size is adjusted.
6. The method according to claim 5, characterized in that The step of adjusting the information to be rendered according to the graphics driver after the compatibility processing further includes: Loading system fonts according to the font fallback mechanism according to the graphics driver after compatibility processing; If the system font is missing, switch to loading the open source font library to obtain font configuration data; The display size of the font configuration data is adjusted according to the dots per inch value.
7. The method according to claim 1, characterized in that The loading of the dependency library to adapt the rendering backend engine and the display operation of the information to be rendered includes: Creating a lightweight container environment based on the rendering backend engine and the operational requirements of the dots per inch setting and font display in the information to be rendered; Preloading the dependent library missing from the system in the container environment; The loading path of the dependent library is adjusted by setting environment variables to ensure that the dependent library is loaded correctly.
8. A dynamic rendering adaptation system, characterized in that: Applied to the target operating system, the dynamic rendering adaptation system includes: An environment detection information acquisition module, used to obtain the environment detection information of the target operating system; A rendering backend engine selection module, configured to select a rendering backend engine according to the environment detection information; A compatibility processing module, configured to perform compatibility processing on the graphics driver according to the rendering backend engine; A setting and display adjustment module, configured to adjust the information to be rendered according to the graphics driver after compatibility processing; The dependency library loading module is used to load the dependency library to adapt to the rendering backend engine and the display operation of the information to be rendered.
9. An electronic device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the electronic device to perform the dynamic rendering adaptation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer program stored therein enables the processor to execute the dynamic rendering adaptation method according to any one of claims 1 to 7.
Citation Information
Cited By
Wayland protocol pass-through graph processing method based on cloud application and related equipment
CN121116670A