Image rendering method and device, equipment and storage medium
By dynamically determining the transmission method of rendered data based on the size relationship between the attribute information of the test image frame and the multiple reference values, the problem of long-term transmission of rendered data in the prior art is solved, and a better transmission method and a shorter rendering time are achieved.
Patent Information
- Application Number
- CN202411839655.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-12
AI Technical Summary
The prior art takes a long time to transfer rendering data from a solid-state drive to memory, affecting the total time spent on rendering a frame of images by GPU.
By dynamically determining the transmission method of rendered data based on the size relationship between the attribute information of the test image frame and the multiple reference values, the transmission time is optimized.
By recording the rendering time corresponding to different reference values, determining the optimal reference value, and selecting the optimal transmission method, thereby reducing the rendering time and improving GPU rendering efficiency.
Smart Images

Figure CN119762650A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to an image rendering method, apparatus, device and storage medium. Background Art
[0002] In a computer, before rendering is performed to generate an image, the corresponding rendering data needs to be loaded into the computer's memory so that it can be read by the GPU (Graphics Processing Unit).
[0003] Rendering data is usually stored in another storage device (such as a solid state drive) different from the main memory. Therefore, the time taken to transfer the rendering data from the other storage device to the main memory directly affects the total time taken by the GPU to render one frame of an image.
[0004] Currently, a fixed transmission method is mostly used to transfer rendering data to memory, resulting in a long time for the GPU to render a frame of image in some cases. Summary of the invention
[0005] The embodiments of the present application provide an image rendering method, apparatus, device and storage medium. The technical solutions provided by the embodiments of the present application are as follows:
[0006] According to one aspect of an embodiment of the present application, there is provided an image rendering method, the method comprising:
[0007] For each of the T test image frames, determine a transmission mode for transmitting the rendering data of the test image frame from the first memory to the second memory according to a size relationship between the attribute information of the test image frame and the i-th reference value of the N reference values, wherein the attribute information of the test image frame is used to reflect the data amount of the rendering data of the test image frame, the reference value is used to determine the transmission mode adopted by the rendering data of the test image frame from at least two candidate transmission modes, T is a positive integer, N is an integer greater than 1, i is a positive integer less than or equal to N, and the N reference values are different from each other;
[0008] According to the determined transmission mode, the rendering data of the test image frame is transmitted from the first memory to the second memory, wherein the graphics processor GPU is used to read the rendering data of the test image frame from the second memory, and render and generate the test image frame based on the rendering data of the test image frame;
[0009] Recording the rendering time of the test image frame corresponding to the i-th reference value;
[0010] Determining an optimal reference value corresponding to the test image frame from the N reference values according to the rendering durations of the test image frames respectively corresponding to the N reference values;
[0011] A selected reference value is determined according to the optimal reference values respectively corresponding to the T test image frames, and the selected reference value is used to determine a transmission method for transmitting rendering data of the image frame to be rendered from the first memory to the second memory.
[0012] According to one aspect of an embodiment of the present application, there is provided an image rendering method, the method comprising:
[0013] Determining a selected reference value corresponding to a current application scenario from selected reference values corresponding to at least two application scenarios, wherein the selected reference value corresponding to the current application scenario is used to determine a transmission mode adopted by transmitting rendering data of a to-be-rendered image frame in the current application scenario from a first memory to a second memory from at least two candidate transmission modes;
[0014] Determining a transmission mode adopted by rendering data of the image frame to be rendered according to a size relationship between the attribute information of the image frame to be rendered and the selected reference value corresponding to the current application scene, wherein the attribute information of the image frame to be rendered is used to reflect the data volume of the rendering data of the image frame to be rendered;
[0015] According to the determined transmission mode, the rendering data of the image frame to be rendered is transmitted from the first memory to the second memory;
[0016] The rendering data of the image frame to be rendered is read from the second memory by a graphics processor GPU, and the image frame to be rendered is generated based on the rendering data of the image frame to be rendered.
[0017] According to one aspect of an embodiment of the present application, there is provided an image rendering device, the device comprising:
[0018] A first determination module is used to determine, for each of the T test image frames, a transmission mode for transmitting the rendering data of the test image frame from the first memory to the second memory according to a size relationship between the attribute information of the test image frame and an i-th reference value among N reference values, wherein the attribute information of the test image frame is used to reflect the data volume of the rendering data of the test image frame, the reference value is used to determine the transmission mode adopted by the rendering data of the test image frame from at least two candidate transmission modes, T is a positive integer, N is an integer greater than 1, i is a positive integer less than or equal to N, and the N reference values are different from each other;
[0019] a transmission module, configured to transmit the rendering data of the test image frame from the first memory to the second memory according to the determined transmission mode, wherein the graphics processor GPU is configured to read the rendering data of the test image frame from the second memory, and render and generate the test image frame based on the rendering data of the test image frame;
[0020] A recording module, used for recording the rendering time of the test image frame corresponding to the i-th reference value;
[0021] A second determination module, configured to determine an optimal reference value corresponding to the test image frame from the N reference values according to the rendering durations of the test image frames respectively corresponding to the N reference values;
[0022] The third determination module is used to determine a selected reference value according to the optimal reference values respectively corresponding to the T test image frames, and the selected reference value is used to determine a transmission method for transmitting rendering data of the image frame to be rendered from the first memory to the second memory.
[0023] According to one aspect of an embodiment of the present application, there is provided an image rendering device, the device comprising:
[0024] a value selection module, used to determine a selected reference value corresponding to a current application scenario from selected reference values corresponding to at least two application scenarios, wherein the selected reference value corresponding to the current application scenario is used to determine a transmission mode adopted by transmitting rendering data of a to-be-rendered image frame in the current application scenario from a first memory to a second memory from at least two candidate transmission modes;
[0025] a determination module, configured to determine a transmission mode adopted by the rendering data of the image frame to be rendered according to a size relationship between the attribute information of the image frame to be rendered and a selected reference value corresponding to the current application scene, wherein the attribute information of the image frame to be rendered is used to reflect the data volume of the rendering data of the image frame to be rendered;
[0026] A transmission module, used for transmitting the rendering data of the image frame to be rendered from the first memory to the second memory according to the determined transmission mode;
[0027] The rendering module is used to read the rendering data of the image frame to be rendered from the second memory through a graphics processor GPU, and generate the image frame to be rendered based on the rendering data of the image frame to be rendered.
[0028] According to one aspect of an embodiment of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-mentioned image rendering method.
[0029] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned image rendering method.
[0030] According to one aspect of an embodiment of the present application, a chip is provided, wherein the chip includes a programmable logic circuit and / or program instructions, and when the chip is running, it is used to implement the above-mentioned image rendering method.
[0031] According to one aspect of an embodiment of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium, and a processor reading and executing the computer program from the computer-readable storage medium to implement the above-mentioned image rendering method.
[0032] The technical solution provided by the embodiments of the present application includes at least the following beneficial effects:
[0033] For each of the T test image frames, the transmission method of the rendering data from the first memory to the second memory is determined based on the attributes of the rendering data and the reference value, and the rendering duration when the transmission method is used is recorded. Since there are N reference values, the above method can obtain N rendering durations corresponding to the N reference values. Based on these rendering durations, the optimal reference value for the test image frame among the N reference values can be determined. Since the optimal reference value is selected from a plurality of different reference values based on the above rendering duration, when the selected reference value obtained according to the optimal reference value is used to determine the transmission method of the rendering data of the image frame, a better transmission method can be obtained to control the rendering duration. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is a schematic diagram of an electronic system provided by an embodiment of the present application;
[0035] Figure 2 is a schematic diagram of a method for transmitting rendering data provided by an embodiment of the present application;
[0036] Figure 3 is a schematic diagram of a method for determining an optimal reference value provided by an embodiment of the present application;
[0037] Figure 4 is a schematic diagram of a computer system provided by an embodiment of the present application;
[0038] Figure 5 is a flowchart of an image rendering method provided by an embodiment of the present application;
[0039] Figure 6 is a schematic diagram of a process for determining an optimal reference value provided by an embodiment of the present application;
[0040] Figure 7 is a schematic diagram of a process for determining a selected reference value provided by an embodiment of the present application;
[0041] Figure 8 is a schematic diagram of a method for optimizing a GPU driver layer provided by an embodiment of the present application;
[0042] Fig. 9 is a flowchart of an image rendering method provided by another embodiment of the present application;
[0043] Fig.10 is a flowchart of an image rendering method provided by another embodiment of the present application;
[0044] Fig.11 is a block diagram of an image rendering device provided by an embodiment of the present application;
[0045] Fig.12 is a block diagram of an image rendering device provided by another embodiment of the present application;
[0046] Fig.13 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0048] Please refer to Figure 1 , which shows a schematic diagram of an electronic system provided by an embodiment of the present application, the electronic system includes a first memory 10, a CPU (Central Processing Unit) 20, a second memory 30, a GPU 40 and display hardware 50.
[0049] The first memory 10 is a memory capable of saving data in the event of power failure, that is, a non-volatile memory, such as a solid state drive (SSD). In some embodiments, the first memory 10 stores rendering data of an image frame, and the rendering data of the image frame is used to generate an image frame.
[0050] The second memory 30 is a volatile memory. In some embodiments, the second memory 30 is a memory, such as a DDR (Double Data Rate Synchronous Dynamic Random Access Memory).
[0051] The GPU 40 reads the rendering data from the second memory 30 to perform rendering to generate image frames. In some embodiments, the GPU 40 is included in the CPU 20 .
[0052] The display hardware 50 is used to receive and display image frames rendered by the GPU 40 . For example, the display hardware 50 includes a controller of a display.
[0053] In some embodiments, the rendering data of the image frame is transmitted to the second memory 30 based on the CPU 20. In one transmission mode, the rendering data of the image frame is transmitted from the first memory 10 to the second memory 30 through the hardware transmission unit in the CPU 20. The hardware transmission unit refers to a transmission unit with a physical hardware structure, such as a DMA (Direct Memory Access) unit in the CPU or other hardware units with data transmission functions. In another transmission mode, the CPU 20 transfers the rendering data of the image frame from the first memory 10 to the second memory 30 by executing a transmission function. The transmission function refers to a function with a data transmission function, such as a memcpy function.
[0054] The above two transmission methods have their own advantages and disadvantages. Among them, the transmission method using the transfer function will occupy the CPU's computing resources. When the amount of rendering data to be transmitted is large, the CPU burden is heavy, which will affect the transmission rate. In addition, in the process of using the transfer function to transmit data, part of the CPU's computing resources are occupied (this part of the computing resources will be released after the transmission is completed) and cannot be used to process other operations, which will affect the parallelism of the CPU. The transmission method using the hardware transmission unit is not limited by the CPU's computing performance (using the hardware transmission unit will not occupy the CPU's computing resources) and has a fast transmission rate. However, the hardware transmission unit needs to perform a series of initialization work before transmission, which results in a longer transmission time than the transmission method using the transfer function when the amount of data to be transmitted is small.
[0055] Please refer to Figure 2 , which shows a schematic diagram of a method for transmitting rendering data provided by an embodiment of the present application, in which the CPU 20 combines the above two transmission methods to load the rendering data into the second memory 30. However, for an image frame, the composition and size of its rendering data are not fixed. For example, Figure 2The rendering data of each of the T image frames is different from each other. Therefore, how to reasonably allocate the ratio of the above two transmission methods for the rendering data of the image frames, so as to determine the optimal transmission method, requires further research.
[0056] Based on this, the present application introduces the concept of a reference value, which is used to determine the transmission method. More specifically, the reference value is used to determine the ratio of the above two transmission methods for rendering data of an image frame.
[0057] Please refer to Figure 3 , which shows a schematic diagram of a method for determining an optimal reference value provided by an embodiment of the present application.
[0058] In this method, for the rendering data of the image frame, the transmission method of the rendering data of the image frame will be determined by determining the ratio of the above two transmission methods according to the set reference value. Then, the rendering data is transmitted according to the determined transmission method, and the rendering time of the image frame under the above transmission method is recorded. By adjusting the above set reference value and repeating the above process, a list recording multiple sets of corresponding reference values and rendering times can be obtained. Based on the correspondence between the reference value and the rendering time in the list, the optimal reference value can be selected. For example, the optimal reference value is the reference value with the smallest corresponding rendering time in the list.
[0059] In the following embodiments, how to determine the optimal reference value and then determine the selected reference value to be finally selected will be described in more detail.
[0060] Please refer to Figure 4 , which shows a schematic diagram of a computer system provided by an embodiment of the present application. The computer system includes a debugging device 60 and a terminal device 70.
[0061] The debugging device 60 may be any electronic device having the first memory 10, the CPU 20, and the second memory 30. The debugging device 60 is used to determine a selected reference value, which is used to determine a transmission method for transmitting rendering data of an image frame from the first memory to the second memory. In some embodiments, the debugging device 60 is also used to configure a configuration file of a driver layer of a GPU, and the configuration file includes the selected reference value.
[0062] The terminal device 70 may be any electronic device having the above-mentioned electronic system, for example, the terminal device 70 may be an electronic device such as a mobile phone, a tablet computer, a multimedia player, a PC (Personal Computer), a wearable device, a vehicle-mounted terminal device, etc. A client for running a target application may be installed in the terminal device 70, and the target application is an application for displaying rendered image frames, such as a game application, a video application, a video conferencing application, a social application, an instant messaging application, a live broadcast application, etc. When the target application is running, the terminal device 70 will determine the transmission method of the rendering data according to the configuration file of the GPU driver layer (the selected reference value), thereby accelerating the rendering and realizing the real-time display of the image frame.
[0063] In some embodiments, the configuration file of the driver layer of the GPU is sent directly from the debugging device 60 to the terminal device 70 .
[0064] In some embodiments, Figure 4 As shown, the computer system also includes a driver publishing platform 80, and the terminal device 70 obtains or updates the configuration file of the driver layer of the GPU through the driver publishing platform 80. The driver publishing platform 80 is used to receive and save the configuration file configured by the debugging device 60, and publish the corresponding configuration file to the user. In some embodiments, the configuration file of the driver layer of the GPU is encapsulated in the driver program of the GPU, that is, the driver publishing platform 80 is used to publish the driver program of the GPU. The driver publishing platform 80 can be a server, or a server cluster composed of multiple servers, or a cloud computing service center.
[0065] The debugging device 60, the terminal device 70 and the driver publishing platform 80 can communicate with each other via a network, such as a wireless or wired network.
[0066] Please refer to Figure 5 , which shows a flow chart of an image rendering method provided by an embodiment of the present application, wherein the execution subject of each step of the method is a computer device, such as the computer device is the above-mentioned debugging device 60. The method includes at least one of the following steps 510-550.
[0067] Step 510, for each of the T test image frames, determine a transmission method for transmitting the rendering data of the test image frame from the first memory to the second memory according to the size relationship between the attribute information of the test image frame and the i-th reference value among the N reference values.
[0068] The attribute information of the test image frame is used to reflect the data amount of the rendering data of the test image frame. The reference value is used to determine the transmission mode adopted by the rendering data of the test image frame from at least two candidate transmission modes. T is a positive integer, N is an integer greater than 1, i is a positive integer less than or equal to N, and the N reference values are different from each other.
[0069] The test image frame is an image frame configured by a technician to perform a test to obtain a selected reference value.
[0070] In some embodiments, the first memory is a non-volatile memory, such as a solid state drive, and the second memory is a volatile memory, such as a memory (DDR).
[0071] The following embodiments will introduce the specific composition of the rendering data of the test image frame and the attribute information of the test image frame.
[0072] In some embodiments, the rendering data of the test image frame includes rendering data of each of the M objects in the test image frame. For each object, the rendering data of the object is used to render the object. The attribute information of the test image frame includes the data volume of the rendering data of each of the M objects, where M is a positive integer.
[0073] An object in a (test) image frame refers to an element occupying a portion of an area in the (test) image frame.
[0074] The present application does not limit the form of objects in the image frame. For example, when the test image frame is an image frame in a game, the objects in the test image frame may include game characters, game backgrounds, game props, different costumes for game characters, and many other objects.
[0075] In some embodiments, the rendering data of the object includes a texture image and a rendering control instruction. That is, each of the M objects has its own texture image and rendering control instruction.
[0076] The texture image is used to provide the texture of the object, and the rendering control instruction is used to control the process of rendering the object. For example, if the object is represented in the form of a three-dimensional model in three-dimensional space, then the rendering of the object is the process of mapping the texture image to the surface of the three-dimensional model, and the rendering control instruction is used to control the process.
[0077] In some embodiments, step 510 includes step 512 ( Figure 5 not shown).
[0078] Step 512: Determine the transmission mode used by the rendering data of the M objects to be transmitted from the first memory to the second memory according to the size relationship between the data volume of the rendering data of the M objects and the i-th reference value.
[0079] That is, the transmission mode of transmitting the rendering data of the test image frame from the first memory to the second memory includes the transmission mode of transmitting the rendering data of each of the M objects from the first memory to the second memory respectively.
[0080] In some embodiments, for the kth object among the M objects, when the data volume of the rendering data of the kth object is greater than the i-th reference value, the first transmission mode is determined as the transmission mode adopted by the rendering data of the kth object to be transmitted from the first memory to the second memory. When the data volume of the rendering data of the kth object is less than or equal to the i-th reference value, the second transmission mode is determined as the transmission mode adopted by the rendering data of the kth object to be transmitted from the first memory to the second memory. The first transmission mode and the second transmission mode are different, and k is a positive integer less than or equal to M.
[0081] In the above method, the transmission mode of the object is determined by comparing the data volume of the rendering data with a reference value. The determination process is relatively simple and does not require the introduction of too many calculation links. It is particularly suitable for scenarios where there are two transmission modes.
[0082] In some embodiments, the first transmission mode is a transmission mode of transmitting data through a hardware transmission unit in the CPU, and the second transmission mode is a transmission mode of transmitting data by executing a transmission function through the CPU.
[0083] For example, the first transmission mode is a transmission mode of transmitting data through a DMA unit in a CPU, and the second transmission mode is a transmission mode of transmitting data through the CPU executing a memcpy function.
[0084] Exemplarily, for the kth object among M objects, the amount of its rendering data is 500KB and the i-th reference value is 400KB. Since 500KB is greater than 400KB, the transmission method of transmitting data through the hardware transmission unit in the CPU is determined as the transmission method used for the rendering data of the kth object.
[0085] Exemplarily, for the kth object among M objects, the amount of its rendering data is 500KB and the i-th reference value is 600KB. Since 500KB is less than 600KB, the transmission method of transmitting data by executing a transmission function through the CPU is determined as the transmission method adopted for the rendering data of the kth object.
[0086] It can be seen from the above embodiments that, in the above two transmission modes, the transmission mode of transmitting data through the hardware transmission unit is a better transmission mode when the amount of data to be transmitted is large, and the transmission mode of executing the transmission function through the CPU is a better transmission mode when the amount of data to be transmitted is small. The purpose of setting the reference value is to determine whether the amount of data to be transmitted is large or small. In the above method, when the amount of data of the rendering data of the kth object is less than the i-th reference value, the transmission function will be used. Therefore, if the actual amount of data of the rendering data of the kth object is large, if the i-th reference value is set too large, the transmission function will still be used, thereby affecting the final rendering time. In addition, in the above method, when the amount of data of the rendering data of the kth object is greater than or equal to the i-th reference value, the hardware transmission unit will be used. Therefore, if the actual amount of data of the rendering data of the kth object is small, if the i-th reference value is set too small, the hardware transmission unit will still be used, thereby affecting the final rendering time. That is to say, using the above method, no matter whether the reference value is set too large or too small, it will eventually be reflected in the increase of rendering time. Therefore, using the optimal reference value obtained by this solution, for rendering data of different sizes, the optimal transmission method can be selected from the above two transmission methods.
[0087] In the above step 512, the rendering data of a single object in the test image frame is used as the granularity of the rendering data for transmitting the test image frame. That is to say, in the process of rendering the test image frame, the GPU can perform rendering on the M objects in batches according to the order in which the rendering data of the M objects are transmitted to the second memory. That is, after the rendering data of a certain object is transmitted to the second memory, the GPU can render it separately. In addition, in actual applications, since the rendering data of different objects have different data volumes, different reference values will change the transmission method of the rendering data of the test image frame, so that when the total data volume of the rendering data of the test image frame remains unchanged, the rendering times corresponding to the N reference values are different. Therefore, this solution can select the optimal reference value based on the correspondence between the rendering time and the reference value.
[0088] Exemplarily, if it is assumed that the actual optimal reference value is 160KB (i.e., when the rendering data of the object is greater than 160KB, the first transmission method is the best, and when it is less than or equal to 160KB, the second transmission method is the best, and it is expected to determine a reference value closest to 160KB as the optimal reference value), the rendering data of the test image frame includes the rendering data of three objects respectively (hereinafter referred to as the first data, the second data and the third data for convenience of description), the data volume of the first data is 120KB, the data volume of the second data is 140KB, and the data volume of the third data is 190KB (i.e., the total data volume of the rendering data of the test image frame is 450KB), and the N reference values are 100, 150 and 200 respectively. Then, when the reference value is 100, the first data, the second data and the third data will all adopt the first transmission method, wherein the first data and the second data are both less than 160KB but adopt the first transmission method, resulting in the failure to obtain the minimum rendering time when the reference value is 100. When the reference value is 150, the first data and the second data all use the second transmission mode, and the third data uses the first transmission mode. All three use the best transmission mode, so the minimum rendering time is obtained when the reference value is 150. When the reference value is 200, the first data, the second data, and the third data all use the second transmission mode. Among them, the third data is larger than 160KB but uses the second transmission mode, resulting in the reference value of 200 not obtaining the minimum rendering time. It can be seen that in the above example, the reference value 150, which is closest to 160KB, obtains the minimum rendering time.
[0089] In addition, it should be noted that the examples of the above three objects and three reference values are only for illustrative purposes. Those skilled in the art should understand that to form an image frame, a large number of objects need to be rendered, and the rendering data of each of these objects often has different data volumes. Therefore, it is also necessary to configure a sufficient number of reference values to perform the above process, so as to select a more accurate optimal reference value. This application does not limit the specific values of the number of objects M and the number of reference values N.
[0090] In some embodiments, the N reference values are determined by the following steps:
[0091] 1. Get the initial reference value.
[0092] In some embodiments, the initial reference value is preconfigured.
[0093] In some embodiments, the initial reference value is determined based on the data volume of the rendering data of each of the T image frames. For example, the initial reference value is the average of the maximum data volume and the minimum data volume among the data volumes corresponding to the rendering data of all objects contained in the T image frames. For example, if the maximum volume is 800KB and the minimum volume is 200KB, the initial reference value is 500KB.
[0094] 2. Adjust the initial reference value according to the adjustment step to obtain N reference values.
[0095] The initial reference value can also be regarded as the first reference value among N reference values. That is, the process of adjusting the initial reference value according to the adjustment step to obtain N reference values can also be regarded as the process of obtaining the remaining N-1 reference values according to the first reference value.
[0096] The adjustment step size is configured by the technician as needed, such as 100 Byte, 200 Byte, etc., and this application does not limit this.
[0097] In some embodiments, the initial reference value is increased or decreased according to the adjustment step size to obtain N reference values.
[0098] In some embodiments, under the restriction of the adjustment threshold, the initial reference value is adjusted according to the adjustment step to obtain N reference values. The adjustment threshold is used to limit the maximum value of the difference between the reference values other than the first reference value among the N reference values and the first reference value. That is to say, on the basis of the initial reference value, it will increase and decrease based on the adjustment step to obtain a new reference value, and when the difference between the new reference value and the initial reference value reaches the adjustment threshold, the increase and decrease will stop. Therefore, when the adjustment step is A (Byte) and the adjustment threshold is B (KB), ((B×1024×2) / A) reference values can be obtained, and finally ((B×1024×2) / A) reference value-rendering time pairs are obtained.
[0099] It should be noted that the above adjustment threshold can also be determined based on the data volume of the rendering data of each of the T image frames. Exemplarily, the initial reference value is the average of the maximum data volume and the minimum data volume among the data volumes corresponding to the rendering data of all objects contained in the T image frames. The above adjustment threshold is the difference between the maximum data volume (or the minimum data volume) and the initial reference value. For example, if the maximum volume is 800KB and the minimum data volume is 200KB, the initial reference value is 500KB and the adjustment threshold is 300KB.
[0100] In the above embodiment, N reference values are obtained by adjusting the initial reference value according to the adjustment step, that is, the device only needs to store the initial reference value and the adjustment step to determine the multiple reference values for executing the test, and by controlling the size of the adjustment step, the accuracy of the determined reference value can be conveniently controlled (the smaller the adjustment step, the smaller the difference between two adjacent reference values among the N reference values).
[0101] In some embodiments, the GPU obtains rendering data of the test image frame through an API (Application Programming Interface, application programming decoupling). In some embodiments, the API includes an OpenGL / OpenGLES interface.
[0102] Exemplarily, the API includes at least one of the following:
[0103] glTexImage1D: used to upload a one-dimensional texture image (to memory).
[0104] glTexImage2D: used to upload a two-dimensional texture image (to memory).
[0105] glTexImage3D: used to upload a three-dimensional texture image (to memory).
[0106] glTexSubImage1D: Used to update a small portion of a one-dimensional texture image.
[0107] glTexSubImage2D: Used to update a small portion of a 2D texture image.
[0108] glTexSubImage3D: Used to update a small portion of a three-dimensional texture image.
[0109] glCompressedTexImage1D: Used to allocate (memory) space for a one-dimensional texture image and upload compressed data (a one-dimensional compressed texture image).
[0110] glCompressedTexImage2D: Used to allocate (memory) space for a two-dimensional texture image and upload compressed data (two-dimensional compressed texture image).
[0111] glCompressedTexImage3D: used to allocate (memory) space for a three-dimensional texture image and upload compressed data (three-dimensional compressed texture image).
[0112] glCompressedTexSubImage1D: Used to update a small portion of a one-dimensional compressed texture image.
[0113] glCompressedTexSubImage2D: Used to update a small portion of a 2D compressed texture image.
[0114] glCompressedTexSubImage3D: Used to update a small portion of a three-dimensional compressed texture image.
[0115] Write GPU command buffer: used to provide rendering control instructions.
[0116] The above APIs can be divided into multiple categories, for example, into the following six categories: glTexImage(1D,2D,3D), glTexSubImage(1D,2D,3D), glCompressedTexImage(1D,2D,3D), glCompressedTexSubImage(1D,2D,3D), glMapBufferRange, write gpu command buffer. Among them, the first 5 types of APIs are used to obtain texture images, and the sixth type of API is used to obtain rendering control instructions. For each of the above multiple types of APIs, corresponding configurations must be made in the configuration file of the GPU driver layer, so that when obtaining the rendering data of the (first) image frame through each type of API, the corresponding transmission method can be selected according to the set reference value (the i-th reference value).
[0117] Step 520: Transmit the rendering data of the test image frame from the first memory to the second memory according to the determined transmission mode.
[0118] The GPU is used to read the rendering data of the test image frame from the second memory, and render and generate the test image frame based on the rendering data of the test image frame.
[0119] In some embodiments, the rendering data of each of the M objects are transmitted from the first memory to the second memory respectively according to the transmission methods respectively adopted by the M objects.
[0120] In some embodiments, for a k-th object among the M objects, the rendering data of the k-th object is transmitted from the first memory to the second memory according to the determined transmission mode used by (the rendering data of) the k-th object.
[0121] Step 530 , recording the rendering time of the test image frame corresponding to the i-th reference value.
[0122] The rendering duration of the test image frame includes the duration consumed for transferring the rendering data of the test image frame from the first memory to the second memory.
[0123] In some embodiments, the rendering duration of the test image frame corresponding to the i-th reference value and the corresponding relationship between the rendering duration and the i-th reference value are recorded.
[0124] In some embodiments, the above step 530 includes at least one of the following sub-steps 532 to 534: Figure 5 not shown).
[0125] Sub-step 532, recording the first moment and the second moment.
[0126] The first moment is the moment when the rendering data of the test image frame starts to be transmitted from the first memory, and the second moment is the moment when the GPU renders and generates the test image frame.
[0127] Sub-step 534: determining the interval between the first moment and the second moment as the rendering duration of the test image frame corresponding to the i-th reference value.
[0128] It should be noted that, during the rendering process of the GPU, the time taken to transfer the rendering data of the test image frame from the first memory to the second memory is usually much longer than the time taken by the GPU to read the rendering data from the second memory to perform rendering. Therefore, although the rendering duration recorded in the above manner includes the time taken to transfer the rendering data of the test image frame from the first memory to the second memory, and the time taken by the GPU to read the rendering data of the test image frame from the second memory to perform rendering, since the former is much longer than the latter, the rendering duration can also be used to reflect the transmission duration (from the first memory to the second memory). Moreover, the above method records the rendering duration with the generation of the test image frame as a sign, which is more convenient to implement and measure.
[0129] Step 540 , determining an optimal reference value corresponding to the test image frame from the N reference values according to the rendering durations of the test image frames corresponding to the N reference values.
[0130] For each of the N reference values, the above steps 510 to 530 are repeatedly performed to obtain the rendering durations of the test image frames corresponding to the N reference values.
[0131] In some embodiments, Figure 6 As shown, for each of the N reference values, corresponding configurations must be made in the configuration file of the GPU driver layer for the above-mentioned multiple types of APIs, that is, when the reference value is adjusted, the reference value should be reconfigured for each type of API.
[0132] In some embodiments, Figure 6 As shown, the reference value corresponding to the minimum rendering duration among the rendering durations of the test image frames corresponding to the N reference values is determined as the optimal reference value corresponding to the test image frame.
[0133] For example, the N reference values are 100KB, 150KB and 200KB, the rendering time corresponding to 100KB is 10ms, the rendering time corresponding to 150KB is 8ms, and the rendering time corresponding to 200KB is 11ms. Since 8ms is the minimum, 150KB is determined as the optimal reference value corresponding to the test image frame.
[0134] In the above method, the reference value of the minimum rendering time is directly used as the optimal reference value corresponding to the test image frame. Therefore, by using the selected reference value determined based on the optimal reference value, the transmission method of the rendering data of the image frame can be determined from the perspective of shortening the rendering time of the image frame.
[0135] Step 550: Determine a selected reference value according to the optimal reference values corresponding to the T image frames.
[0136] The selected reference value is used to determine a transfer method for transferring rendering data of an image frame from a first memory to a second memory.
[0137] In some embodiments, T is equal to 1, and the optimal reference value corresponding to the test image frame is directly determined as the selected reference value.
[0138] In some embodiments, T is greater than 1, but the differences among the T test image frames are small (such as differences in data volume and differences in the objects included), and the optimal reference value corresponding to any one of the T test image frames can be determined as the selected reference value.
[0139] In some embodiments, please refer to Figure 7 , T is greater than 1, and the selected reference value is determined according to the optimal reference values corresponding to the T test image frames.
[0140] In some embodiments, when T is greater than 1, the average of the optimal reference values corresponding to the T test image frames is determined as the selected reference value. For example, when T is 3, the optimal reference values corresponding to the T test image frames are 450, 490, and 560, respectively, so the average of the three, 500, is determined as the selected reference value.
[0141] In some embodiments, when T is greater than 1, the optimal reference value corresponding to the T test image frames, the optimal reference value with the shortest corresponding rendering time, is determined as the selected reference value. For example, T is 3, and the optimal reference values corresponding to the T test image frames are A, B, and C, among which C has the shortest corresponding rendering time, so C is determined as the selected reference value.
[0142] When there are multiple test image frames, since the amount of rendering data of different test image frames is different, combining the optimal reference values corresponding to multiple test image frames can improve the accuracy of the final selected reference value, so that the selected reference value can determine the optimal transmission method for the rendering data with high precision.
[0143] In some embodiments, after the selected reference value is determined, the selected reference value is set in a configuration file of a driver layer of the GPU.
[0144] In some embodiments, the configuration file is a configuration file for an API, through which the GPU obtains rendering data of an image frame. In some embodiments, the API has multiple types, and the configuration file includes configuration files corresponding to the multiple types of APIs. Figure 7 As shown, after obtaining the selected reference value, the present application will configure the above-mentioned selected reference value for various types of APIs in the driver layer of the GPU. In this way, when the GPU obtains rendering data through a certain type of API, the selected reference value will be used to determine the transmission method of the rendering data, thereby accelerating the GPU to execute rendering.
[0145] The technical solution provided by the embodiment of the present application determines, for each of the T test image frames, the transmission method of its rendering data from the first memory to the second memory according to the attributes and reference values of its rendering data, and records the rendering duration when the transmission method is used. Since there are N reference values, the above method can obtain N rendering durations corresponding to the N reference values one by one, and based on these rendering durations, the optimal reference value for the test image frame among the N reference values can be determined. Since the optimal reference value is selected from a plurality of different reference values based on the above rendering duration, when the selected reference value obtained according to the optimal reference value is used to determine the transmission method of the rendering data of the image frame, a better transmission method can be obtained to control the rendering duration.
[0146] The selected reference value obtained in the above embodiment is set at the driver layer of the GPU. Therefore, the image rendering method provided by the above technical solution can also be regarded as an optimization method (of the configuration file) for the driver layer of the GPU.
[0147] Please refer to Figure 8 , which shows a schematic diagram of a method for optimizing a GPU driver layer provided by an embodiment of the present application. The method comprises the following steps:
[0148] 1. Select the test image frame used to determine the selected reference value.
[0149] 2. In the GPU driver layer, a reference value is set for the API configuration used to obtain rendering data of the test image frame.
[0150] 3. The GPU obtains the rendering data of the test image frame through the above API. At this time, the rendering data of the test image frame will be written into the second storage (memory) according to the transmission method determined according to the above reference value.
[0151] 4. Record rendering time.
[0152] 5. Determine whether the reference value needs to be reset. If it needs to be reset (such as the current reference value still falls within the numerical range of the reference value adjustment), start from step 2 above. If it does not need to reset the reference value, obtain the reference value with the shortest rendering time and use this reference value as the optimal reference value.
[0153] 6. Using the above optimal reference value as the selected reference value, in the driver layer of the GPU, configure the selected reference value for (multiple types of) APIs used to obtain rendering data of the image frame.
[0154] As can be seen from the above embodiments, after the reference value is selected, the present application only involves the optimization of the driver layer of the GPU, without changing the application layer (such as the code of the target application). This reduces the development cycle and development difficulty of technicians, and reduces the learning cost and technical requirements for achieving optimization.
[0155] Please refer to Fig. 9 , which shows a flow chart of an image rendering method provided by another embodiment of the present application, wherein the execution subject of each step of the method is a computer device, such as the computer device is the above-mentioned debugging device 60. The method includes at least one of the following steps 910-920.
[0156] Step 910: Determine selected reference values corresponding to at least two application scenarios.
[0157] In some embodiments, different application scenarios correspond to different applications. That is, for image frames in different applications, different selected reference values will be used to perform rendering.
[0158] In some embodiments, different application scenarios correspond to different scenarios when the application is running. That is, when the application is running, different selected reference values will be used to perform rendering for image frames in different scenarios.
[0159] In some embodiments, step 910 includes at least one of the following sub-steps 912 to 914: Fig. 9 not shown).
[0160] Sub-step 912: for each of the at least two application scenarios, determine T test image frames in the application scenario.
[0161] For example, if at least two application scenarios correspond to a first application and a second application, then T test image frames of the first application and T test image frames of the second application are determined respectively. It should be noted that for different application scenarios, the number of test image frames (T) may be the same or different, and this application does not limit this.
[0162] Sub-step 914, determining a selected reference value corresponding to the application scenario according to the T test image frames.
[0163] Regarding how to determine the selected reference value corresponding to the application scenario based on the T test image frames, please refer to steps 510 to 550 in the above embodiment, which will not be described in detail here.
[0164] Step 920: Write the selected reference values corresponding to at least two application scenarios into a configuration file of the driver layer of the GPU.
[0165] The technical solution provided in the embodiment of the present application configures multiple selected reference values in the GPU driver layer for different application scenarios, so that the solution can achieve GPU accelerated rendering in various scenarios, thereby enhancing the versatility of the solution in different scenarios.
[0166] In the following embodiment, the application process of the selected reference value will be further introduced. For details not described in detail in this embodiment, please refer to the above embodiment.
[0167] Please refer to Fig.10 , which shows a flow chart of an image rendering method provided by another embodiment of the present application, wherein the execution subject of each step of the method is a computer device, such as the computer device is the above-mentioned terminal device 70. The method includes at least one of the following steps 1010-1040.
[0168] Step 1010: Determine a selected reference value corresponding to a current application scenario from selected reference values corresponding to at least two application scenarios.
[0169] The selected reference value corresponding to the current application scenario is used to determine, from at least two candidate transmission modes, a transmission mode adopted for transmitting rendering data of the image frame to be rendered in the current application scenario from the first memory to the second memory.
[0170] In some embodiments, the selected reference values corresponding to the at least two application scenarios are included in a configuration file of a driver layer of the GPU. In some embodiments, the driver layer of the GPU is used to drive the GPU, which can be implemented as a driver program of the GPU.
[0171] In some embodiments, the configuration file is a configuration file for an API, and the GPU obtains rendering data of an image frame through the API. In some embodiments, the API has multiple types, and the configuration file includes configuration files corresponding to the multiple types of APIs.
[0172] The above method configures the selected reference value in the configuration file of the GPU driver layer, that is, the technical solution provided by the embodiment of the present application only involves the optimization of the GPU driver layer, and there is no need to change the application layer (such as the code of the target application). This reduces the development cycle and development difficulty of technicians, and reduces the learning cost and technical requirements for achieving optimization.
[0173] In some embodiments, different application scenarios correspond to different application programs. Step 1010 includes: determining a selected reference value corresponding to a currently running (executing and displaying) application program from selected reference values corresponding to at least two application programs respectively.
[0174] For example, at least two application scenarios correspond to game application A and game application B. When game application A is running, the selected reference value corresponding to game application A is determined from the configuration file of the driver layer of the GPU, thereby accelerating the rendering of the image frame of game application A. It can be seen that this solution can optimize the rendering rate of the application in a targeted manner by configuring the corresponding selected reference value in the GPU.
[0175] In some embodiments, different application scenarios correspond to different scenarios when the application is running. For example, at least two application scenarios correspond to game mode A and game mode B in a game application. During the running of game mode A, the selected reference value corresponding to game mode A is determined from the configuration file of the driver layer of the GPU, thereby accelerating the rendering of image frames in game mode A.
[0176] Step 1020 , determining a transmission method used for rendering data of the image frame to be rendered according to a magnitude relationship between the attribute information of the image frame to be rendered and a selected reference value corresponding to the current application scenario.
[0177] The attribute information of the image frame to be rendered is used to reflect the data volume of the rendering data of the image frame to be rendered.
[0178] The image frames to be rendered refer to the image frames waiting to be displayed in the current application scenario.
[0179] In some embodiments, the rendering data of the image frame to be rendered includes rendering data of each of Q objects in the image frame to be rendered, and the attribute information of the image frame to be rendered includes the data volume of the rendering data of each of the Q objects, where Q is a positive integer.
[0180] Step 1020 includes: determining, according to a size relationship between the data volume of the rendering data of each of the Q objects and the selected reference value, a transmission mode adopted by the rendering data of each of the Q objects to be transmitted from the first memory to the second memory.
[0181] In some embodiments, for the pth object among the Q objects, when the data volume of the rendering data of the pth object is greater than the selected reference value, the first transmission mode is determined as the transmission mode adopted by the rendering data of the pth object from the first memory to the second memory; when the data volume of the rendering data of the pth object is less than or equal to the selected reference value, the second transmission mode is determined as the transmission mode adopted by the rendering data of the pth object from the first memory to the second memory. Wherein, p is a positive integer less than or equal to Q.
[0182] Step 1030: Transmit the rendering data of the image frame to be rendered from the first memory to the second memory according to the determined transmission mode.
[0183] Step 1040: read rendering data of the image frame to be rendered from the second memory through the GPU, and generate the image frame to be rendered based on the rendering data of the image frame to be rendered.
[0184] In some embodiments, the GPU outputs the generated image frame to be rendered to the display hardware, and the GPU displays the image frame to be rendered.
[0185] The technical solution provided by the embodiment of the present application determines, for each of the T test image frames, the transmission method of its rendering data from the first memory to the second memory according to the attributes and reference values of its rendering data, and records the rendering duration when the transmission method is used. Since there are N reference values, the above method can obtain N rendering durations corresponding to the N reference values one by one, and based on these rendering durations, the optimal reference value for the test image frame among the N reference values can be determined. Since the optimal reference value is selected from a plurality of different reference values based on the above rendering duration, when the selected reference value obtained according to the optimal reference value is used to determine the transmission method of the rendering data of the image frame, a better transmission method can be obtained to control the rendering duration.
[0186] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0187] Please refer to Fig.11 , which shows a block diagram of an image rendering device provided by an embodiment of the present application. The device has the function of implementing the above-mentioned image rendering method, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be a computer device, or can be set in a computer device. The device 1100 may include: a first determination module 1110, a transmission module 1120, a recording module 1130, a second determination module 1140 and a third determination module 1150.
[0188] The first determination module 1110 is used to determine, for each of the T test image frames, a transmission method for transmitting the rendering data of the test image frame from a first memory to a second memory according to a size relationship between the attribute information of the test image frame and an i-th reference value among N reference values, wherein the attribute information of the test image frame is used to reflect the data volume of the rendering data of the test image frame, the reference value is used to determine the transmission method adopted for the rendering data of the test image frame from at least two candidate transmission methods, T is a positive integer, N is an integer greater than 1, i is a positive integer less than or equal to N, and the N reference values are different from each other.
[0189] The transmission module 1120 is used to transmit the rendering data of the test image frame from the first memory to the second memory according to the determined transmission method, wherein the graphics processor GPU is used to read the rendering data of the test image frame from the second memory, and render and generate the test image frame based on the rendering data of the test image frame.
[0190] The recording module 1130 is used to record the rendering time of the test image frame corresponding to the i-th reference value.
[0191] The second determination module 1140 is configured to determine an optimal reference value corresponding to the test image frame from the N reference values according to the rendering durations of the test image frames respectively corresponding to the N reference values.
[0192] The third determination module 1150 is used to determine a selected reference value according to the optimal reference values respectively corresponding to the T test image frames, and the selected reference value is used to determine a transmission method for transmitting rendering data of the image frame to be rendered from the first memory to the second memory.
[0193] In some embodiments, the rendering data of the test image frame includes rendering data of each of M objects in the test image frame, the rendering data of the object is used to render the object, and the attribute information of the test image frame includes the data amount of the rendering data of each of the M objects, where M is a positive integer.
[0194] The first determination module 1110 is used to determine the transmission mode used for transmitting the rendering data of each of the M objects from the first memory to the second memory according to the size relationship between the data volume of the rendering data of each of the M objects and the i-th reference value.
[0195] In some embodiments, the first determination module 1110 is used to determine, for the kth object among the M objects, a first transmission mode as a transmission mode for transmitting the rendering data of the kth object from the first memory to the second memory when the data volume of the rendering data of the kth object is greater than the i-th reference value; and to determine a second transmission mode as a transmission mode for transmitting the rendering data of the kth object from the first memory to the second memory when the data volume of the rendering data of the kth object is less than or equal to the i-th reference value; wherein the first transmission mode and the second transmission mode are different, and k is a positive integer less than or equal to M.
[0196] In some embodiments, the first transmission mode is a transmission mode of transmitting data through a hardware transmission unit in a central processing unit (CPU), and the second transmission mode is a transmission mode of transmitting data by executing a transmission function by the CPU.
[0197] In some embodiments, the second determination module 1140 is used to determine the reference value corresponding to the minimum value of the rendering duration of the test image frame corresponding to the N reference values as the optimal reference value corresponding to the test image frame.
[0198] In some embodiments, when T is greater than 1, the third determination module 1150 is used to determine the average of the optimal reference values corresponding to the T test image frames as the selected reference value; or, determine the optimal reference value with the shortest rendering time among the optimal reference values corresponding to the T test image frames as the selected reference value.
[0199] In some embodiments, the device 1100 further includes a fourth determining module ( Fig.11 not shown).
[0200] The fourth determination module is used to obtain an initial reference value; adjust the initial reference value according to an adjustment step to obtain the N reference values.
[0201] In some embodiments, the recording module 1130 is used to record a first moment and a second moment, wherein the first moment is the moment when the rendering data of the test image frame starts to be transmitted from the first memory, and the second moment is the moment when the GPU renders and generates the test image frame; the interval between the first moment and the second moment is determined as the rendering duration of the test image frame corresponding to the i-th reference value.
[0202] In some embodiments, the device 1100 further includes a configuration module ( Fig.11 not shown).
[0203] The configuration module is used to determine selected reference values corresponding to at least two application scenarios respectively; and write the selected reference values corresponding to the at least two application scenarios respectively into a configuration file of the driver layer of the GPU.
[0204] Please refer to Fig.12 , which shows a block diagram of an image rendering device provided by another embodiment of the present application. The device has the function of implementing the above-mentioned image rendering method, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be a computer device, or it can be set in a computer device. The device 1200 may include: a value selection module 1210, a determination module 1220, a transmission module 1230 and a rendering module 1240.
[0205] The value selection module 1210 is used to determine a selected reference value corresponding to the current application scenario from selected reference values corresponding to at least two application scenarios, wherein the selected reference value corresponding to the current application scenario is used to determine the transmission method used for transmitting rendering data of the image frame to be rendered in the current application scenario from a first memory to a second memory from at least two candidate transmission methods.
[0206] Determination module 1220 is used to determine the transmission method adopted by the rendering data of the image frame to be rendered based on the size relationship between the attribute information of the image frame to be rendered and the selected reference value corresponding to the current application scene, wherein the attribute information of the image frame to be rendered is used to reflect the data volume of the rendering data of the image frame to be rendered.
[0207] The transmission module 1230 is used to transmit the rendering data of the image frame to be rendered from the first memory to the second memory according to the determined transmission mode.
[0208] The rendering module 1240 is used to read the rendering data of the image frame to be rendered from the second memory through a graphics processor GPU, and generate the image frame to be rendered based on the rendering data of the image frame to be rendered.
[0209] In some embodiments, the selected reference values corresponding to the at least two application scenarios are included in a configuration file of a driver layer of the GPU.
[0210] In some embodiments, different application scenarios correspond to different application programs.
[0211] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0212] Please refer to Fig.13 , which exemplarily shows a structural block diagram of a computer device provided by an embodiment of the present application.
[0213] Typically, the computer device 1300 includes a processor 1301 and a memory 1302 .
[0214] The processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU; the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1301 may be integrated with a GPU, which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1301 may also include an AI processor, which is used to process computing operations related to machine learning.
[0215] The memory 1302 may include one or more computer-readable storage media, which may be tangible and non-transitory. The memory 1302 may also include a high-speed random access memory, and a first memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1302 stores a computer program, which is loaded and executed by the processor 1301 to implement the above-mentioned image rendering method.
[0216] Those skilled in the art will understand that Fig.13 The structure shown in the figure does not constitute a limitation on the computer device 1300, and the computer device 1300 may include more or less components than shown in the figure, or combine some components, or adopt a different component arrangement.
[0217] In some embodiments, a computer-readable storage medium is further provided, wherein a computer program is stored in the storage medium, and the computer program is loaded and executed by a processor to implement the above-mentioned image rendering method.
[0218] Optionally, the computer readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD or optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0219] In some embodiments, a chip is also provided, which includes a programmable logic circuit and / or program instructions, and when the chip is running, it is used to implement the above-mentioned image rendering method.
[0220] In some embodiments, a computer program product is also provided, the computer program product comprising a computer program, the computer program is stored in a computer-readable storage medium, and a processor reads and executes the computer program from the computer-readable storage medium to implement the above-mentioned image rendering method.
[0221] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0222] The above are merely exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. An image rendering method, characterized in that: The method comprises: For each of the T test image frames, determine a transmission mode for transmitting the rendering data of the test image frame from the first memory to the second memory according to a size relationship between the attribute information of the test image frame and the i-th reference value of the N reference values, wherein the attribute information of the test image frame is used to reflect the data amount of the rendering data of the test image frame, the reference value is used to determine the transmission mode adopted by the rendering data of the test image frame from at least two candidate transmission modes, T is a positive integer, N is an integer greater than 1, i is a positive integer less than or equal to N, and the N reference values are different from each other; According to the determined transmission mode, the rendering data of the test image frame is transmitted from the first memory to the second memory, wherein the graphics processor GPU is used to read the rendering data of the test image frame from the second memory, and render and generate the test image frame based on the rendering data of the test image frame; Recording the rendering time of the test image frame corresponding to the i-th reference value; Determining an optimal reference value corresponding to the test image frame from the N reference values according to the rendering durations of the test image frames respectively corresponding to the N reference values; A selected reference value is determined according to the optimal reference values respectively corresponding to the T test image frames, and the selected reference value is used to determine a transmission method for transmitting rendering data of the image frame to be rendered from the first memory to the second memory.
2. The method according to claim 1, characterized in that The rendering data of the test image frame includes rendering data of each of M objects in the test image frame, the rendering data of the object is used to render the object, and the attribute information of the test image frame includes the data volume of the rendering data of each of the M objects, where M is a positive integer; The step of determining, according to a magnitude relationship between the attribute information of the test image frame and an i-th reference value among the N reference values, a transmission mode for transmitting the rendering data of the test image frame from the first memory to the second memory includes: According to the size relationship between the data volume of the rendering data of each of the M objects and the i-th reference value, a transmission mode adopted by the rendering data of each of the M objects to be transmitted from the first memory to the second memory is determined.
3. The method according to claim 2, characterized in that The determining, according to the size relationship between the data amount of the respective rendering data of the M objects and the i-th reference value, the transmission mode adopted by the respective rendering data of the M objects to be transmitted from the first memory to the second memory, comprises: For a k-th object among the M objects, when the amount of data of the rendering data of the k-th object is greater than the i-th reference value, determining the first transmission mode as the transmission mode adopted by the rendering data of the k-th object to be transmitted from the first memory to the second memory; When the amount of the rendering data of the k-th object is less than or equal to the i-th reference value, determining the second transmission mode as a transmission mode adopted by the rendering data of the k-th object to be transmitted from the first memory to the second memory; The first transmission mode and the second transmission mode are different, and k is a positive integer less than or equal to M.
4. The method according to claim 3, characterized in that The first transmission mode is a transmission mode in which data is transmitted through a hardware transmission unit in a central processing unit (CPU), and the second transmission mode is a transmission mode in which data is transmitted by executing a transmission function by the CPU.
5. The method according to claim 1, characterized in that The determining, according to the rendering durations of the test image frames respectively corresponding to the N reference values, an optimal reference value corresponding to the test image frame from the N reference values, comprises: Among the rendering times of the test image frames corresponding to the N reference values, the reference value corresponding to the minimum value of the rendering time is determined as the optimal reference value corresponding to the test image frame.
6. The method according to claim 1, characterized in that When T is greater than 1, determining the selected reference value according to the optimal reference values respectively corresponding to the T test image frames includes: Determine the average of the optimal reference values respectively corresponding to the T test image frames as the selected reference value; or, The optimal reference value with the shortest corresponding rendering time among the optimal reference values respectively corresponding to the T test image frames is determined as the selected reference value.
7. The method according to claim 1, characterized in that The method further comprises: Get the initial reference value; The initial reference value is adjusted according to the adjustment step to obtain the N reference values.
8. The method according to claim 1, characterized in that The recording of the rendering duration of the test image frame corresponding to the i-th reference value includes: Recording a first moment and a second moment, wherein the first moment is the moment when the rendering data of the test image frame starts to be transmitted from the first memory, and the second moment is the moment when the GPU renders and generates the test image frame; The interval duration between the first moment and the second moment is determined as the rendering duration of the test image frame corresponding to the i-th reference value.
9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: Determine selected reference values corresponding to at least two application scenarios respectively; The selected reference values corresponding to the at least two application scenarios are written into a configuration file of a driver layer of the GPU.
10. An image rendering method, characterized in that: The method comprises: Determining a selected reference value corresponding to a current application scenario from selected reference values corresponding to at least two application scenarios, wherein the selected reference value corresponding to the current application scenario is used to determine a transmission mode adopted by transmitting rendering data of a to-be-rendered image frame in the current application scenario from a first memory to a second memory from at least two candidate transmission modes; Determining a transmission mode adopted by rendering data of the image frame to be rendered according to a size relationship between the attribute information of the image frame to be rendered and the selected reference value corresponding to the current application scene, wherein the attribute information of the image frame to be rendered is used to reflect the data volume of the rendering data of the image frame to be rendered; According to the determined transmission mode, the rendering data of the image frame to be rendered is transmitted from the first memory to the second memory; The rendering data of the image frame to be rendered is read from the second memory by a graphics processor GPU, and the image frame to be rendered is generated based on the rendering data of the image frame to be rendered.
11. The method according to claim 10, characterized in that The selected reference values corresponding to the at least two application scenarios are included in a configuration file of a driver layer of the GPU.
12. The method according to claim 10 or 11, characterized in that: Different application scenarios correspond to different applications.
13. An image rendering device, characterized in that: The device comprises: A first determination module is used to determine, for each of the T test image frames, a transmission mode for transmitting the rendering data of the test image frame from the first memory to the second memory according to a size relationship between the attribute information of the test image frame and an i-th reference value among N reference values, wherein the attribute information of the test image frame is used to reflect the data volume of the rendering data of the test image frame, the reference value is used to determine the transmission mode adopted by the rendering data of the test image frame from at least two candidate transmission modes, T is a positive integer, N is an integer greater than 1, i is a positive integer less than or equal to N, and the N reference values are different from each other; a transmission module, configured to transmit the rendering data of the test image frame from the first memory to the second memory according to the determined transmission mode, wherein the graphics processor GPU is configured to read the rendering data of the test image frame from the second memory, and render and generate the test image frame based on the rendering data of the test image frame; A recording module, used for recording the rendering time of the test image frame corresponding to the i-th reference value; A second determination module, configured to determine an optimal reference value corresponding to the test image frame from the N reference values according to the rendering durations of the test image frames respectively corresponding to the N reference values; The third determination module is used to determine a selected reference value according to the optimal reference values respectively corresponding to the T test image frames, and the selected reference value is used to determine a transmission method for transmitting rendering data of the image frame to be rendered from the first memory to the second memory.
14. An image rendering device, characterized in that: The device comprises: a value selection module, used to determine a selected reference value corresponding to a current application scenario from selected reference values corresponding to at least two application scenarios, wherein the selected reference value corresponding to the current application scenario is used to determine a transmission mode adopted by transmitting rendering data of a to-be-rendered image frame in the current application scenario from a first memory to a second memory from at least two candidate transmission modes; a determination module, configured to determine a transmission mode adopted by the rendering data of the image frame to be rendered according to a size relationship between the attribute information of the image frame to be rendered and a selected reference value corresponding to the current application scene, wherein the attribute information of the image frame to be rendered is used to reflect the data volume of the rendering data of the image frame to be rendered; A transmission module, used for transmitting the rendering data of the image frame to be rendered from the first memory to the second memory according to the determined transmission mode; The rendering module is used to read the rendering data of the image frame to be rendered from the second memory through a graphics processor GPU, and generate the image frame to be rendered based on the rendering data of the image frame to be rendered.
15. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method according to any one of claims 1 to 9, or to implement the method according to any one of claims 10 to 12.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the method according to any one of claims 1 to 9, or to implement the method according to any one of claims 10 to 12.
17. A chip, characterized in that: The chip includes a programmable logic circuit and / or program instructions, and when the chip is running, it is used to implement the method according to any one of claims 1 to 9, or to implement the method according to any one of claims 10 to 12.
18. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium. A processor reads and executes the computer program from the computer-readable storage medium to implement the method according to any one of claims 1 to 9, or implements the method according to any one of claims 10 to 12.
Citation Information
Patent Citations
GPU dynamic frequency modulation method, device and system
CN111429333A
Image rendering method and device, equipment and storage medium
CN115423919A
Image display method and device, electronic equipment and readable storage medium
CN117974418A
Rendering method and device based on WEB security isolation system and medium
CN118733918A
Imaging apparatus
JP2018195891A