Image rendering method, device, apparatus and storage medium
By selecting the transmission method based on the attribute information and reference values of the image frame, the transmission of image rendering data from the solid-state drive to memory is optimized, solving the problem of long rendering time in the existing technology and improving GPU rendering efficiency.
Patent Information
- Application Number
- CN202411839655.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-12-12
AI Technical Summary
In existing technologies, the transmission method of rendering data from solid-state drives to memory during image rendering is fixed, resulting in a long time for the GPU to render a single frame of an image.
Based on the relationship between the image frame's attribute information and multiple reference values, the transmission method is dynamically selected, the rendering time is recorded, and the optimal reference value is determined to optimize the transmission method.
By dynamically selecting the transmission method, the total time spent on image rendering is reduced, and the efficiency of GPU rendering is improved.
Smart Images

Figure CN119762650B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, in particular to an image rendering method and device, equipment and storage medium. BACKGROUND
[0002] In a computer, before performing rendering to generate an image, corresponding rendering data needs to be loaded into the memory of the computer, so as to facilitate the GPU (Graphics Processing Unit) to read.
[0003] The rendering data is usually saved in another storage (such as a solid state disk) different from the memory, so that the time consumption of transferring the rendering data from the above-mentioned another storage to the memory will directly affect the total time consumption of the GPU to render a frame of image.
[0004] At present, a fixed transmission mode is usually adopted to transfer the rendering data to the memory, which results in that in some cases, the time consumption of the GPU to render a frame of image is relatively long. SUMMARY
[0005] Embodiments of the present application provide an image rendering method, device, equipment and storage medium. The technical scheme provided by the embodiments of the present application is as follows:
[0006] According to an aspect of the embodiments of the present application, an image rendering method is provided, the method comprising:
[0007] For each of the T test image frames, according to the size relationship between the attribute information of the test image frame and the i-th reference value in the N reference values, a transmission mode of transferring the rendering data of the test image frame from a first storage to a second storage is determined, 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 transferred from the first storage to the second storage, wherein a GPU (Graphics Processing Unit) is used to read the rendering data of the test image frame from the second storage, and based on the rendering data of the test image frame, the test image frame is rendered and generated;
[0009] The rendering duration of the test image frame corresponding to the i-th reference value is recorded.
[0010] Based on the rendering time of the test image frame corresponding to the N reference values, the optimal reference value corresponding to the test image frame is determined from the N reference values;
[0011] Based on the optimal reference values corresponding to the T test image frames, a selected reference value is determined. The selected reference value is used to determine the transmission method for transferring the rendering data of the image frame to be rendered from the first memory to the second memory.
[0012] According to one aspect of the embodiments of this application, an image rendering method is provided, the method comprising:
[0013] From the selected reference values corresponding to at least two application scenarios respectively, determine the selected reference value corresponding to the current application scenario, wherein the selected reference value corresponding to the current application scenario is used to determine the transmission method used to transmit the rendering data of the image frame to be rendered in the current application scenario from the first memory to the second memory from at least two candidate transmission methods.
[0014] Based on the relationship between the attribute information of the image frame to be rendered and the selected reference value corresponding to the current application scenario, the transmission method used for the rendering data of the image frame to be rendered is determined, 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 method, the rendering data of the image frame to be rendered is transferred 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 the graphics processing unit (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 the embodiments of this application, an image rendering apparatus is provided, the apparatus comprising:
[0018] The first determining module is used, for each of the T test image frames, to determine the transmission method for transferring the rendering data of the test image frame from the first memory to the second memory based on the size relationship between the attribute information of the test image frame and the i-th reference value among N reference values. The attribute information of the test image frame reflects the amount of rendering data of the test image frame, and 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 all different.
[0019] A transmission module 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.
[0020] A recording module is used to record the rendering time of the test image frame corresponding to the i-th reference value;
[0021] The second determining module is used to determine the optimal reference value corresponding to the test image frame from the N reference values based on the rendering time of the test image frame corresponding to the N reference values respectively.
[0022] The third determining module is used to determine a selected reference value based on the optimal reference values corresponding to the T test image frames respectively. The selected reference value is used to determine the transmission method for transmitting the rendering data of the image frame to be rendered from the first memory to the second memory.
[0023] According to one aspect of the embodiments of this application, an image rendering apparatus is provided, the apparatus comprising:
[0024] The value selection module is used to determine the selected reference value corresponding to the current application scenario from selected reference values corresponding to at least two application scenarios respectively. The selected reference value corresponding to the current application scenario is used to determine the transmission method used to transmit the rendering data of the image frame to be rendered in the current application scenario from the first memory to the second memory from at least two candidate transmission methods.
[0025] The determination module is used to determine the transmission method of 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 scenario, 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 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 method.
[0027] The rendering module is used to read the rendering data of the image frame to be rendered from the second memory through the 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 the embodiments of this application, a computer device is provided, the computer device including 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-described image rendering method.
[0029] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, the computer program being loaded and executed by a processor to implement the above-described image rendering method.
[0030] According to one aspect of the embodiments of this application, a chip is provided, the chip including programmable logic circuits and / or program instructions, which, when the chip is running, are used to implement the above-described image rendering method.
[0031] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program stored in a computer-readable storage medium, and a processor reading from the computer-readable storage medium and executing the computer program to implement the above-described image rendering method.
[0032] The technical solutions provided in this application have at least the following beneficial effects:
[0033] For each of the T test image frames, the transmission method of its rendering data from the first memory to the second memory is determined based on the attributes and reference values of its rendering data, and the rendering time when using this transmission method is recorded. Since there are N reference values, the above method can obtain N rendering times corresponding one-to-one with the N reference values. Based on these rendering times, the optimal reference value for the test image frame can be determined from among the N reference values. Because the optimal reference value is selected from multiple distinct reference values based on the above rendering times, when the selected reference value obtained based on the optimal reference value is used to determine the transmission method of the image frame's rendering data, a better transmission method can be obtained to control the rendering time. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of an electronic system provided in one embodiment of this application;
[0035] Figure 2 This is a schematic diagram of a rendering data transmission method provided in one embodiment of this application;
[0036] Figure 3 This is a schematic diagram of a method for determining the optimal reference value provided in one embodiment of this application;
[0037] Figure 4 This is a schematic diagram of a computer system provided in one embodiment of this application;
[0038] Figure 5 This is a flowchart of an image rendering method provided in one embodiment of this application;
[0039] Figure 6 This is a schematic diagram illustrating the process of determining the optimal reference value provided in one embodiment of this application;
[0040] Figure 7 This is a schematic diagram illustrating the process of determining a selected reference value according to an embodiment of this application;
[0041] Figure 8 This is a schematic diagram of an optimization method for the GPU driver layer provided in one embodiment of this application;
[0042] Figure 9 This is a flowchart of an image rendering method provided in another embodiment of this application;
[0043] Figure 10 This is a flowchart of an image rendering method provided in another embodiment of this application;
[0044] Figure 11 This is a block diagram of an image rendering apparatus provided in one embodiment of this application;
[0045] Figure 12 This is a block diagram of an image rendering apparatus provided in another embodiment of this application;
[0046] Figure 13 This is a structural block diagram of a computer device provided in one embodiment of this application. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0048] Please refer to Figure 1 The illustration shows a schematic diagram of an electronic system provided in one embodiment of the present application, which 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 retaining data even when power is lost, i.e., a non-volatile memory, such as a solid-state drive (SSD). In some embodiments, the first memory 10 stores rendering data of image frames, which is used to generate image frames.
[0050] The second memory 30 is a volatile memory. In some embodiments, the second memory 30 is memory, such as DDR (Double Data Rate Synchronous Dynamic Random Access Memory).
[0051] GPU 40 reads the rendering data from the second memory 30 to perform rendering and generate image frames. In some embodiments, GPU 40 is included in CPU 20.
[0052] Display hardware 50 is used to receive and display image frames rendered by GPU 40. For example, display hardware 50 includes a controller for a display.
[0053] In some embodiments, the rendering data of an image frame is transferred from the CPU 20 to the second memory 30. In one transmission method, the rendering data of the image frame is transferred from the first memory 10 to the second memory 30 via a 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 transfer capabilities. In another transmission method, 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 data transfer capabilities, such as the memcpy function.
[0054] Both of the above transmission methods have their advantages and disadvantages. The transmission method using transfer functions consumes CPU computing resources. When the amount of rendering data to be transmitted is large, the increased CPU load will affect the transmission rate. Furthermore, during the data transmission process using transfer functions, a portion of the CPU's computing resources are occupied (and only released after the transmission is complete), preventing them from being used for other operations, which affects CPU parallelism. On the other hand, the transmission method using hardware transfer units is not limited by CPU computing performance (hardware transfer units do not consume CPU computing resources) and has a fast transmission rate. However, hardware transfer units need to perform a series of initialization tasks before transmission, which results in a longer transmission time compared to the transfer function method when the amount of data to be transmitted is small.
[0055] Please refer to Figure 2 This illustration shows a schematic diagram of a rendering data transmission method provided in one embodiment of this application. In this transmission method, the CPU 20 combines the two transmission methods described above 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 for each of the T image frames is different. Therefore, further research is needed to determine the optimal transmission method by rationally allocating the ratio of the two transmission methods for the rendering data of each image frame.
[0056] Based on this, this 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 two transmission methods mentioned above for the rendering data of the image frame.
[0057] Please refer to Figure 3 The diagram illustrates a method for determining the optimal reference value provided in one embodiment of this application.
[0058] In this method, for the rendering data of an image frame, the transmission method of the rendering data of that image frame is determined by setting a reference value and determining the ratio of the two transmission methods mentioned above. 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 containing multiple sets of corresponding reference values and rendering times can be obtained. Based on the correspondence between reference values and rendering times in this 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, a more detailed description will be given of how to determine the optimal reference value, and then determine the final selected reference value.
[0060] Please refer to Figure 4 This illustration shows a schematic diagram of a computer system provided in one embodiment of this application. The computer system includes a debugging device 60 and a terminal device 70.
[0061] The debugging device 60 can be any electronic device having the first memory 10, CPU 20, and second memory 30 described above. The debugging device 60 is used to determine selected reference values, which are used to determine the transmission method for transferring rendering data of image frames from the first memory to the second memory. In some embodiments, the debugging device 60 is also used to configure a configuration file of the GPU's driver layer, which contains the selected reference values described above.
[0062] Terminal device 70 can be any electronic device with the aforementioned electronic systems. For example, terminal device 70 can be an electronic device such as a mobile phone, tablet computer, multimedia playback device, PC (Personal Computer), wearable device, or in-vehicle terminal device. A client application for the target application can be installed and run on terminal device 70. This target application is used to display rendered image frames, such as a game application, video application, video conferencing application, social application, instant messaging application, or live streaming application. When the target application is running, terminal device 70 will determine the transmission method of the rendering data according to the configuration file (selected reference values) of the GPU driver layer, thereby accelerating rendering and achieving real-time display of image frames.
[0063] In some embodiments, the configuration file of the GPU driver layer is sent directly from the debugging device 60 to the terminal device 70.
[0064] In some embodiments, such as Figure 4 As shown, the computer system also includes a driver distribution platform 80, through which the terminal device 70 obtains or updates the GPU driver layer configuration file. The driver distribution platform 80 receives and saves the configuration file configured by the debugging device 60 and distributes the corresponding configuration file to the user. In some embodiments, the GPU driver layer configuration file is encapsulated in the GPU driver program, i.e., the driver distribution platform 80 is used to distribute the GPU driver program. The driver distribution platform 80 can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center.
[0065] The aforementioned debugging equipment 60, terminal equipment 70, and driver release platform 80 can communicate via a network, such as a wireless or wired network.
[0066] Please refer to Figure 5 The diagram illustrates a flowchart of an image rendering method according to an embodiment of this application. The execution entity for each step of the method is a computer device, such as the aforementioned debugging device 60. The method includes at least one of the following steps 510 to 550.
[0067] Step 510: For each of the T test image frames, determine the transmission method for transferring the rendering data of the test image frame from the first memory to the second memory based on 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 amount of data of the rendering data of the test image frame. The reference value is used to determine the transmission method used 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 all different.
[0069] The test image frame is configured by the technician to perform the test to obtain a selected reference value.
[0070] In some embodiments, the first memory is non-volatile memory, such as a solid-state drive (SSD). The second memory is volatile memory, such as RAM (DDR).
[0071] The following examples will describe the specific composition of the rendering data and attribute information of the test image frame.
[0072] In some embodiments, the rendering data of the test image frame includes rendering data for each of the M objects in the test image frame. For each object, the rendering data is used to render that object. The attribute information of the test image frame includes the amount of data for 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 that occupies a portion of the (test) image frame.
[0074] This application does not limit the form of objects in the image frame. For example, if the test image frame is an image frame in a game, the objects in the test image frame may include many objects such as game characters, game backgrounds, game props, and different outfits of game characters.
[0075] In some embodiments, the rendering data of an object includes a texture image and rendering control instructions. That is, each of the M objects has its own texture image and rendering control instructions.
[0076] Texture images are used to provide the texture of an object, while rendering control instructions are used to control the rendering process performed on the object. For example, if an object is represented as a 3D model in 3D space, then rendering the object is the process of mapping the texture image onto the surface of the 3D model, and rendering control instructions are used to control this process.
[0077] In some embodiments, step 510 includes step 512. Figure 5 (Not shown in the image).
[0078] Step 512: Based on the relationship between the data volume of each of the M objects' rendering data and the size of the i-th reference value, determine the transmission method from the first memory to the second memory for each of the M objects' rendering data.
[0079] In other words, the transmission method for transferring the rendering data of the test image frame from the first memory to the second memory includes the transmission method used by each of the M objects for transferring their respective rendering data from the first memory to the second memory.
[0080] In some embodiments, for the k-th object out of M objects, if the amount of rendering data for the k-th object is greater than the i-th reference value, the first transmission method is determined as the transmission method used to transfer the rendering data of the k-th object from the first memory to the second memory. If the amount of rendering data for the k-th object is less than or equal to the i-th reference value, the second transmission method is determined as the transmission method used to transfer the rendering data of the k-th object from the first memory to the second memory. Here, the first transmission method and the second transmission method are different, and k is a positive integer less than or equal to M.
[0081] In the above method, the transmission method of the object is determined by comparing the amount of rendered data with the reference value. The determination process is relatively simple and does not require too many calculation steps, making it particularly suitable for scenarios with two transmission methods.
[0082] In some embodiments, the first transmission method is a data transmission method that transmits data through a hardware transmission unit in the CPU, and the second transmission method is a data transmission method that transmits data by executing a transmission function in the CPU.
[0083] For example, the first transmission method is to transfer data through the DMA unit in the CPU, and the second transmission method is to transfer data by executing the memcpy function in the CPU.
[0084] For example, for the kth object among M objects, the data size 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] For example, for the kth object among M objects, the data size of its rendering data is 500KB and the i-th reference value is 600KB. Since 500KB is less than 600KB, the data transmission method determined by the CPU executing the transmission function is the transmission method used for the rendering data of the kth object.
[0086] As can be seen from the above embodiments, among the two transmission methods, the transmission method using a hardware transmission unit is superior when the amount of data to be transmitted is large, while the transmission method using the CPU to execute a transmission function is superior 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 rendering data for the k-th object is less than the i-th reference value, the transmission function is used. Therefore, if the actual amount of rendering data for the k-th object is large, and the i-th reference value is set too large, the transmission function will still be used, thus affecting the final rendering time. Furthermore, in the above method, when the amount of rendering data for the k-th object is greater than or equal to the i-th reference value, the hardware transmission unit is used. Therefore, if the actual amount of rendering data for the k-th object is small, and the i-th reference value is set too small, the hardware transmission unit will still be used, thus affecting the final rendering time. In other words, using the above method, whether the reference value is set too large or too small, it will ultimately be reflected in the increase in rendering time. Therefore, by using the optimal reference value obtained by this scheme, the optimal transmission method can be selected from the above two transmission methods for rendering data of different sizes.
[0087] In step 512 above, the rendering data of a single object in the test image frame is used as the granularity for transmitting the rendering data of the test image frame. This means that during the rendering of the test image frame, the GPU can render the M objects in batches according to the order in which their rendering data is transmitted to the second memory. Specifically, after the rendering data of a certain object is transmitted to the second memory, the GPU can render it individually. Furthermore, in practical applications, since the rendering data of different objects has different data volumes, different reference values will change the transmission method of the rendering data of the test image frame. This results in differences in the rendering time corresponding to the N reference values, even when the total amount of rendering data in the test image frame remains constant. Therefore, this scheme can select the optimal reference value based on the correspondence between rendering time and reference values.
[0088] For example, assuming the actual optimal reference value is 160KB (i.e., the first transmission method is optimal when the object's rendering data is greater than 160KB, and the second transmission method is optimal when it is less than or equal to 160KB, with the aim of determining 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 (hereinafter referred to as first data, second data, and third data for ease of description). The data size of the first data is 120KB, the data size of the second data is 140KB, and the data size of the third data is 190KB (i.e., the total data size of the rendering data of the test image frame is 450KB), and the N reference values are 100, 150, and 200. Then, when the reference value is 100, the first data, second data, and third data will all use the first transmission method. However, since both the first and second data are less than 160KB, using the first transmission method results in the minimum rendering time not being achieved when the reference value is 100. When the reference value is 150, the first and second data both use the second transmission method, while the third data uses the first transmission method. All three data use the optimal transmission method, thus achieving the minimum rendering time with a reference value of 150. When the reference value is 200, the first, second, and third data all use the second transmission method. However, the third data is larger than 160KB but uses the second transmission method, causing the minimum rendering time not to be achieved with a reference value of 200. Therefore, in the above example, the reference value of 150, which is closest to 160KB, achieves the minimum rendering time.
[0089] Furthermore, it should be noted that the examples of the three objects and three reference values mentioned above are merely illustrative. Those skilled in the art should understand that to form an image frame, rendering of a large number of objects is required. The rendering data for each of these objects often has different amounts of data. Therefore, a sufficient number of reference values also need to be configured to perform the above process, thereby selecting 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 through the following steps:
[0091] 1. Obtain the initial reference value.
[0092] In some embodiments, the initial reference value is pre-configured.
[0093] In some embodiments, the initial reference value is determined based on the data size of the rendering data for each of the T image frames. For example, the initial reference value is the average of the maximum and minimum data sizes among the rendering data sizes of all objects contained in the T image frames. For example, if the maximum data size is 800KB and the minimum data size is 200KB, then the initial reference value is 500KB.
[0094] 2. Adjust the initial reference value according to the adjustment step size to obtain N reference values.
[0095] The initial reference value can also be regarded as the first reference value among N reference values. In other words, the process of adjusting the initial reference value according to the adjustment step size to obtain N reference values can also be regarded as the process of obtaining the remaining N-1 reference values based on the first reference value.
[0096] The step size can be adjusted by technicians as needed, such as 100 bytes, 200 bytes, etc., and this application does not limit it.
[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 constraint of an adjustment threshold, the initial reference value is adjusted according to the adjustment step size to obtain N reference values. The adjustment threshold is used to limit the maximum difference between the first reference value and all other reference values among the N reference values except the first reference value. That is, based on the initial reference value, the value is increased or decreased according to the adjustment step size to obtain a new reference value. The increase or decrease stops when the difference between the new reference value and the initial reference value reaches the adjustment threshold. Therefore, with an adjustment step size of A (Byte) and an adjustment threshold of B (KB), ((B×1024×2) / A) reference values can be obtained, ultimately resulting in ((B×1024×2) / A) reference value-rendering time pairs.
[0099] It should be noted that the above adjustment threshold can also be determined based on the data volume of the rendering data for each of the T image frames. For example, the initial reference value is the average of the maximum and minimum data volumes among the rendering data volumes of all objects contained in the T image frames. The above adjustment threshold is the difference between the maximum (or minimum) data volume and the initial reference value. For example, if the maximum data volume is 800KB and the minimum data volume is 200KB, then the initial reference value is 500KB, and the adjustment threshold is 300KB.
[0100] In the above embodiment, the N reference values are obtained by adjusting the initial reference values according to the adjustment step size. That is to say, the device only needs to store the initial reference values and the adjustment step size to determine the multiple reference values to be tested. Furthermore, by controlling the size of the adjustment step size, the accuracy of the determined reference values can be conveniently controlled (the smaller the adjustment step size, 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). In some embodiments, the API includes an OpenGL / OpenGLES interface.
[0102] For example, 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 3D texture images (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 3D texture image.
[0109] glCompressedTexImage1D: Used to allocate (memory) space for a one-dimensional texture image and upload compressed data (one-dimensional compressed texture image).
[0110] glCompressedTexImage2D: Used to allocate (memory) space for a 2D texture image and upload compressed data (2D compressed texture image).
[0111] glCompressedTexImage3D: Used to allocate (memory) space for 3D texture images and upload compressed data (3D compressed texture images).
[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 two-dimensional compressed texture image.
[0114] glCompressedTexSubImage3D: Used to update a small portion of a 3D compressed texture image.
[0115] Write GPU command buffer: Used to provide rendering control commands.
[0116] The aforementioned APIs can be categorized into several types, for example, the following six: glTexImage(1D,2D,3D), glTexSubImage(1D,2D,3D), glCompressedTexImage(1D,2D,3D), glCompressedTexSubImage(1D,2D,3D), glMapBufferRange, and write GPU command buffer. The first five API types are used to acquire texture images, and the sixth API type is used to acquire rendering control commands. For each of these API types, corresponding configurations must be made in the GPU driver layer configuration file so that when acquiring rendering data for the (first) image frame through each type of API, the appropriate transmission method can be selected based on the set reference value (the i-th reference value).
[0117] Step 520: According to the determined transmission method, the rendering data of the test image frame is transferred from the first memory to the second memory.
[0118] The GPU is used to read the rendering data of the test image frame from the second memory, and to 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 is transferred from the first memory to the second memory according to the transmission method adopted by each of the M objects.
[0120] In some embodiments, for the kth object among M objects, the rendering data of the kth object is transferred from the first memory to the second memory according to the transmission method used for the determined rendering data of the kth object.
[0121] Step 530: Record the rendering time of the test image frame corresponding to the i-th reference value.
[0122] The rendering time of the test image frame includes the time spent transferring the rendering data of the test image frame from the first memory to the second memory.
[0123] In some embodiments, the rendering time of the test image frame corresponding to the i-th reference value and the correspondence between the rendering time and the i-th reference value are recorded.
[0124] In some embodiments, step 530 includes at least one of the following sub-steps 532 to 534 ( Figure 5 (Not shown in the image).
[0125] Sub-step 532: Record the first and second time points.
[0126] The first moment is the moment when the rendering data of the test image frame begins 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: Determine the interval between the first time point and the second time point as the rendering duration of the test image frame corresponding to the i-th reference value.
[0128] It should be noted that during GPU rendering, 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 for the GPU to read the rendering data from the second memory and execute the rendering. Therefore, although the rendering time recorded in the above method includes both 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 for the GPU to read the rendering data of the test image frame from the second memory and execute the rendering, since the former is much longer than the latter, this rendering time can also be used to reflect the transfer time (from the first memory to the second memory). Furthermore, the above method records the rendering time with the generation of the test image frame as a marker, which is more convenient for implementation and measurement.
[0129] Step 540: Based on the rendering time of the test image frames corresponding to the N reference values, determine the optimal reference value corresponding to the test image frame from the N reference values.
[0130] For each of the N reference values, repeat steps 510 to 530 above to obtain the rendering time of the test image frames corresponding to the N reference values.
[0131] In some embodiments, such as Figure 6 As shown, for each of the N reference values, corresponding configurations must be made in the GPU driver layer configuration file for the above-mentioned multiple API types. That is, when the reference value is adjusted, the reference value should be reconfigured for each type of API.
[0132] In some embodiments, such as Figure 6 As shown, the reference value corresponding to the minimum rendering time among the rendering times of the test image frames corresponding to the N reference values is determined as the optimal reference value for the test image frame.
[0133] For example, N reference values are 100KB, 150KB, and 200KB. The rendering time corresponding to 100KB is 10ms, 150KB is 8ms, and 200KB is 11ms. Since 8ms is the smallest, 150KB is determined as the optimal reference value for the test image frame.
[0134] In the above method, the reference value with 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 this optimal reference value, the transmission method of the image frame's rendering data can be determined from the perspective of shortening the rendering time of the image frame.
[0135] Step 550: Determine the selected reference value based on the optimal reference values corresponding to the T image frames respectively.
[0136] The selected reference value is used to determine the transfer method for transferring the rendering data of the image frame from the first memory to the second memory.
[0137] In some embodiments, T equals 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 or differences in the objects contained therein), 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 If T is greater than 1, the selected reference value is determined based on the optimal reference value corresponding to each of 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 with the smallest rendering time among the optimal reference values corresponding to the T test image frames is determined as the selected reference value. For example, if T is 3, and the optimal reference values corresponding to the T test image frames are A, B, and C, then C has the smallest 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 in 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 the configuration file of the GPU's driver layer.
[0144] In some embodiments, the above configuration file is a configuration file for an API through which the GPU obtains rendering data for image frames. In some embodiments, the API has multiple types, and the above configuration file includes configuration files corresponding to each type of API. Figure 7 As shown, after obtaining the selected reference value, this application will configure the selected reference value in the GPU driver layer for various types of APIs. In this way, when the GPU obtains rendering data through a certain type of API, it will use the selected reference value to determine the transmission method of the rendering data, thereby accelerating the GPU to perform rendering.
[0145] The technical solution provided in this application, for each of T test image frames, determines the transmission method of its rendering data from the first memory to the second memory based on the attributes and reference values of its rendering data, and records the rendering time when using this transmission method. Since there are N reference values, the above method can obtain N rendering times corresponding one-to-one with the N reference values. Based on these rendering times, the optimal reference value for the test image frame can be determined among the N reference values. Since the optimal reference value is selected from multiple distinct reference values based on the above rendering time, when the selected reference value obtained based on the optimal reference value is used to determine the transmission method of the image frame's rendering data, a better transmission method can be obtained to control the rendering time.
[0146] The selected reference value obtained in the above embodiments is set in the GPU driver layer. Therefore, the image rendering method provided by the above technical solution can also be regarded as an optimization method for the GPU driver layer (configuration file).
[0147] Please refer to Figure 8 This illustration shows a schematic diagram of an optimization method for the GPU driver layer provided in one embodiment of this application. The method includes the following steps:
[0148] 1. Select the test image frame used to determine the selected reference value.
[0149] 2. Reference values set in the GPU driver layer for the API configuration used to obtain rendering data for test image frames.
[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 to the second memory (RAM) according to the transmission method determined by the above reference value.
[0151] 4. Record rendering time.
[0152] 5. Determine whether the reference value needs to be reset. If the reference value needs to be reset (e.g., the current reference value is still within the range of reference value adjustment), start from step 2 above. If the reference value does not need to be reset, obtain the reference value with the shortest rendering time and use it as the optimal reference value.
[0153] 6. Using the above optimal reference value as the selected reference value, configure the selected reference value in the GPU driver layer for the API (of various types) used to obtain rendering data of image frames.
[0154] As can be seen from the above embodiments, after the selected reference value is determined, this application only involves optimizing the GPU driver layer, without modifying the application layer (such as the code of the target application). This reduces the development cycle and difficulty for technical personnel, and lowers the learning cost and technical requirements for achieving optimization.
[0155] Please refer to Figure 9 The diagram illustrates a flowchart of an image rendering method according to another embodiment of this application, wherein the execution entity of each step of the method is a computer device, such as the aforementioned debugging device 60. The method includes at least one of the following steps 910 to 920.
[0156] Step 910: Determine the 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 for rendering.
[0158] In some embodiments, different application scenarios correspond to different scenarios during application runtime. That is, during application runtime, 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 ( Figure 9 (Not shown in the image).
[0160] Sub-step 912: For each of the at least two application scenarios, determine T test image frames for that 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 are determined for the first application and T test image frames for the second application, respectively. It should be noted that the number of test image frames (T) can be the same or different for different application scenarios; this application does not impose any limitation on this.
[0162] Sub-step 914: Based on the above T test image frames, determine the selected reference value corresponding to the application scenario.
[0163] For details on how to determine the selected reference value corresponding to the application scenario based on T test image frames, please refer to steps 510 to 550 in the above embodiment, which will not be repeated here.
[0164] Step 920: Write the selected reference values corresponding to at least two application scenarios into the configuration file of the GPU driver layer.
[0165] The technical solution provided in this application embodiment enables GPU-accelerated rendering in various scenarios by configuring multiple selected reference values in the GPU driver layer for different application scenarios, thereby enhancing the versatility of this solution in different scenarios.
[0166] The application process of the selected reference value will be further described in the following embodiments. For details not described in detail in this embodiment, please refer to the embodiments above.
[0167] Please refer to Figure 10 The diagram illustrates a flowchart of an image rendering method according to another embodiment of this application, wherein the execution subject of each step of the method is a computer device, such as the aforementioned terminal device 70. The method includes at least one of the following steps 1010 to 1040.
[0168] Step 1010: Determine the selected reference value corresponding to the current application scenario from the 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 the transmission method used to transfer the rendering data of the image frame to be rendered in the current application scenario from the first memory to the second memory from at least two candidate transmission methods.
[0170] In some embodiments, the selected reference values corresponding to at least two application scenarios are included in the configuration file of the GPU driver layer. In some embodiments, the GPU driver layer is used to drive the GPU, and it can be implemented as a GPU driver program.
[0171] In some embodiments, the above configuration file is a configuration file for an API through which the GPU obtains rendering data for image frames. In some embodiments, the API has multiple types, and the above configuration file includes configuration files corresponding to each type of API.
[0172] The above method configures selected reference values in the GPU driver layer configuration file. In other words, the technical solution provided in this application only involves optimization of the GPU driver layer, without requiring modifications to the application layer (such as the target application code). This reduces the development cycle and difficulty for technical personnel, and lowers 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 the selected reference value corresponding to the currently running (execution display) application from selected reference values corresponding to at least two applications respectively.
[0174] For example, if at least two application scenarios correspond to game application A and game application B, then when game application A is running, the selected reference value corresponding to game application A is determined from the GPU driver layer configuration file, thereby accelerating the rendering of image frames of game application A. It is evident that this solution can specifically optimize the rendering rate of applications by configuring corresponding selected reference values in the GPU.
[0175] In some embodiments, different application scenarios correspond to different scenarios in which the application runs. For example, if at least two application scenarios correspond to game mode A and game mode B in a game application, then during the execution of game mode A, the selected reference value corresponding to game mode A is determined from the configuration file of the GPU driver layer, thereby accelerating the rendering of image frames under game mode A.
[0176] Step 1020: Determine the transmission method used for 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 scenario.
[0177] The attribute information of the image frame to be rendered is used to reflect the amount of data in the rendering data of the image frame to be rendered.
[0178] The image frame to be rendered refers to the image frame that is waiting to be displayed in the current application scenario.
[0179] In some embodiments, the rendering data of the image frame to be rendered includes the rendering data of each of the 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 the transmission method from the first memory to the second memory for the rendering data of each of the Q objects, based on the relationship between the data volume of the rendering data of each of the Q objects and the selected reference value.
[0181] In some embodiments, for the p-th object out of Q objects, if the amount of rendering data for the p-th object is greater than a selected reference value, the first transmission method is determined as the transmission method used to transfer the rendering data of the p-th object from the first memory to the second memory; if the amount of rendering data for the p-th object is less than or equal to the selected reference value, the second transmission method is determined as the transmission method used to transfer the rendering data of the p-th object from the first memory to the second memory. Here, p is a positive integer less than or equal to Q.
[0182] Step 1030: According to the determined transmission method, the rendering data of the image frame to be rendered is transferred from the first memory to the second memory.
[0183] Step 1040: Read the 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 a generated image frame to be rendered to the display hardware. The GPU then displays the image frame to be rendered.
[0185] The technical solution provided in this application, for each of T test image frames, determines the transmission method of its rendering data from the first memory to the second memory based on the attributes and reference values of its rendering data, and records the rendering time when using this transmission method. Since there are N reference values, the above method can obtain N rendering times corresponding one-to-one with the N reference values. Based on these rendering times, the optimal reference value for the test image frame can be determined among the N reference values. Since the optimal reference value is selected from multiple distinct reference values based on the above rendering time, when the selected reference value obtained based on the optimal reference value is used to determine the transmission method of the image frame's rendering data, a better transmission method can be obtained to control the rendering time.
[0186] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0187] Please refer to Figure 11 This diagram illustrates a block diagram of an image rendering apparatus according to an embodiment of this application. The apparatus has the function of implementing the image rendering method described above; this function can be implemented in hardware or by hardware executing corresponding software. The apparatus can be a computer device or can be installed within a computer device. The apparatus 1100 may include: a first determining module 1110, a transmission module 1120, a recording module 1130, a second determining module 1140, and a third determining module 1150.
[0188] The first determining module 1110 is used to determine, for each of the T test image frames, the transmission method for transferring the rendering data of the test image frame from the first memory to the second memory based on the size relationship between the attribute information of the test image frame and the i-th reference value among N reference values. The attribute information of the test image frame is used to reflect the data volume of the rendering data of the test image frame, and the reference value is used to determine the transmission method adopted by 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 all different.
[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 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 determining module 1140 is used to determine the optimal reference value corresponding to the test image frame from the N reference values based on the rendering time of the test image frame corresponding to the N reference values respectively.
[0192] The third determining module 1150 is used to determine a selected reference value based on the optimal reference values corresponding to the T test image frames respectively. The selected reference value is used to determine the transmission method for transmitting the 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 M objects in the test image frame, the rendering data of the objects being used to render the objects, and the attribute information of the test image frame including the data volume of the rendering data of the M objects, where M is a positive integer.
[0194] The first determining module 1110 is used to determine the transmission method used by the rendering data of the M objects from the first memory to the second memory based on the data volume of the rendering data of each of the M objects and the size relationship between the i-th reference value.
[0195] In some embodiments, the first determining module 1110 is configured to, for the kth object among the M objects, if the amount of rendering data of the kth object is greater than the i-th reference value, determine a first transmission method as the transmission method used by the rendering data of the kth object to be transferred from the first memory to the second memory; if the amount of rendering data of the kth object is less than or equal to the i-th reference value, determine a second transmission method as the transmission method used by the rendering data of the kth object to be transferred from the first memory to the second memory; wherein the first transmission method and the second transmission method are different, and k is a positive integer less than or equal to M.
[0196] In some embodiments, the first transmission method is a data transmission method that transmits data through a hardware transmission unit in a central processing unit (CPU), and the second transmission method is a data transmission method that transmits data by executing a transmission function through the CPU.
[0197] In some embodiments, the second determining module 1140 is used to determine the reference value corresponding to the minimum value of the rendering time of the test image frame among the rendering times of 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 determining 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 smallest 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 ( Figure 11 (Not shown in the image).
[0200] The fourth determining module is used to obtain an initial reference value; and to adjust the initial reference value according to the adjustment step size 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 begins 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 ( Figure 11 (Not shown in the image).
[0203] A configuration module is used to determine the selected reference values corresponding to at least two application scenarios respectively; and to write the selected reference values corresponding to the at least two application scenarios respectively into the configuration file of the GPU driver layer.
[0204] Please refer to Figure 12 This diagram illustrates a block diagram of an image rendering apparatus according to another embodiment of this application. The apparatus has the function of implementing the image rendering method described above; this function can be implemented in hardware or by hardware executing corresponding software. The apparatus can be a computer device or can be installed within a computer device. The apparatus 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 the selected reference value corresponding to the current application scenario from selected reference values corresponding to at least two application scenarios respectively. The selected reference value corresponding to the current application scenario is used to determine the transmission method used to transmit the rendering data of the image frame to be rendered in the current application scenario from the first memory to the second memory from at least two candidate transmission methods.
[0206] The determining module 1220 is used to determine the transmission method of 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 scenario, 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 method.
[0208] The rendering module 1240 is used to read the rendering data of the image frame to be rendered from the second memory through the 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 the configuration file of the GPU's driver layer.
[0210] In some embodiments, different application scenarios correspond to different applications.
[0211] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0212] Please refer to Figure 13 The diagram illustrates a structural block diagram of a computer device provided in one embodiment of this application.
[0213] Typically, computer device 1300 includes a processor 1301 and a memory 1302.
[0214] Processor 1301 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1301 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1301 may also include a main processor and a coprocessor. The main processor, also known as the CPU, is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1301 may integrate a GPU, which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, processor 1301 may also include an AI processor, which is used to handle computational 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 high-speed random access memory and a first memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1302 stores a computer program that is loaded and executed by the processor 1301 to implement the image rendering method described above.
[0216] Those skilled in the art will understand that Figure 13 The structure shown does not constitute a limitation on the computer device 1300, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0217] In some embodiments, a computer-readable storage medium is also provided, wherein a computer program is stored therein, the computer program being loaded and executed by a processor to implement the above-described image rendering method.
[0218] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD, or optical disc, etc. 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, the chip including programmable logic circuits and / or program instructions, which, when the chip is running, are used to implement the above-described image rendering method.
[0220] In some embodiments, a computer program product is also provided, the computer program product including a computer program stored in a computer-readable storage medium, the processor reading from the computer-readable storage medium and executing the computer program to implement the above-described image rendering method.
[0221] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0222] The above are merely exemplary embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application shall be included within the protection scope of this application.
Claims
1. An image rendering method, characterized in that, The method includes: For each of the T test image frames, based on the relationship between the attribute information of the test image frame and the i-th reference value among N reference values, the transmission method for transferring the rendering data of the test image frame from the first memory to the second memory is determined. The attribute information of the test image frame is used to reflect the amount of rendering data of the test image frame, and 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 all different. According to the determined transmission method, 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. Record the rendering time of the test image frame corresponding to the i-th reference value; Based on the rendering time of the test image frame corresponding to the N reference values, the optimal reference value corresponding to the test image frame is determined from the N reference values; Based on the optimal reference values corresponding to the T test image frames, a selected reference value is determined. The selected reference value is used to determine the transmission method for transferring the 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 the rendering data of each of the M objects in the test image frame. The rendering data of the objects is used to render the objects. 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 the transmission method for transferring the rendering data of the test image frame from the first memory to the second memory based on the relationship between the attribute information of the test image frame and the i-th reference value among N reference values includes: Based on the relationship between the data volume of the rendering data of each of the M objects and the size of the i-th reference value, the transmission method used by the rendering data of each of the M objects from the first memory to the second memory is determined.
3. The method according to claim 2, characterized in that, The step of determining the transmission method for transferring the rendering data of each of the M objects from the first memory to the second memory based on the relationship between the data volume of the rendering data of each of the M objects and the i-th reference value includes: For the kth object among the M objects, if the amount of rendering data of the kth object is greater than the i-th reference value, the first transmission method is determined to be the transmission method used by the kth object to transfer rendering data from the first memory to the second memory. If the amount of rendering data for the k-th object is less than or equal to the i-th reference value, the second transmission method is determined to be the transmission method used by the rendering data of the k-th object to transfer data from the first memory to the second memory. Wherein, the first transmission method and the second transmission method 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 method is a data transmission method that transmits data through the hardware transmission unit in the central processing unit (CPU), and the second transmission method is a data transmission method that transmits data by executing a transmission function through the CPU.
5. The method according to claim 1, characterized in that, The step of determining the optimal reference value corresponding to the test image frame from the N reference values based on the rendering time of the test image frame corresponding to the N reference values includes: The reference value corresponding to the minimum rendering time of the test image frame among the N reference values 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 based on the optimal reference values corresponding to the T test image frames includes: The average of the optimal reference values corresponding to the T test image frames is determined as the selected reference value; or... The optimal reference value with the shortest rendering time among the optimal reference values 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 includes: Obtain the initial reference value; The initial reference values are adjusted according to the adjustment step size to obtain the N reference values.
8. The method according to claim 1, characterized in that, The process of recording the rendering time of the test image frame corresponding to the i-th reference value includes: Record the first moment and the second moment, wherein the first moment is the moment when the rendering data of the test image frame begins 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 time interval between the first time point and the second time point is determined as the rendering time 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 includes: Determine the selected reference values corresponding to at least two application scenarios; The selected reference values corresponding to the at least two application scenarios are written into the configuration file of the GPU driver layer.
10. An image rendering method, characterized in that, The method includes: From the selected reference values corresponding to at least two application scenarios respectively, determine the selected reference value corresponding to the current application scenario, wherein the selected reference value corresponding to the current application scenario is used to determine the transmission method used to transmit the rendering data of the image frame to be rendered in the current application scenario from the first memory to the second memory from at least two candidate transmission methods. Based on the relationship between the attribute information of the image frame to be rendered and the selected reference value corresponding to the current application scenario, the transmission method used for the rendering data of the image frame to be rendered is determined, 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 method, the rendering data of the image frame to be rendered is transferred 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 the graphics processing unit (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 the configuration file of the GPU's driver layer.
12. The method according to claim 10 or 11, characterized in that, Different application scenarios correspond to different applications.
13. An image rendering apparatus, characterized in that, The device includes: The first determining module is used, for each of the T test image frames, to determine the transmission method for transferring the rendering data of the test image frame from the first memory to the second memory based on the size relationship between the attribute information of the test image frame and the i-th reference value among N reference values. The attribute information of the test image frame reflects the amount of rendering data of the test image frame, and 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 all different. A transmission module 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. A recording module is used to record the rendering time of the test image frame corresponding to the i-th reference value; The second determining module is used to determine the optimal reference value corresponding to the test image frame from the N reference values based on the rendering time of the test image frame corresponding to the N reference values respectively. The third determining module is used to determine a selected reference value based on the optimal reference values corresponding to the T test image frames respectively. The selected reference value is used to determine the transmission method for transmitting the rendering data of the image frame to be rendered from the first memory to the second memory.
14. An image rendering apparatus, characterized in that, The device includes: The value selection module is used to determine the selected reference value corresponding to the current application scenario from selected reference values corresponding to at least two application scenarios respectively. The selected reference value corresponding to the current application scenario is used to determine the transmission method used to transmit the rendering data of the image frame to be rendered in the current application scenario from the first memory to the second memory from at least two candidate transmission methods. The determination module is used to determine the transmission method of 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 scenario, 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 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 method. The rendering module is used to read the rendering data of the image frame to be rendered from the second memory through the 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, the memory storing a computer program that is loaded and executed by the processor to implement the method as claimed in any one of claims 1 to 9, or to implement the method as claimed in 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 that is loaded and executed by a processor to implement the method as claimed in any one of claims 1 to 9, or to implement the method as claimed in any one of claims 10 to 12.
17. A chip, characterized in that, The chip includes programmable logic circuitry and / or program instructions, which, when the chip is running, are used to implement the method as described in any one of claims 1 to 9, or to implement the method as described in any one of claims 10 to 12.
18. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, which a processor reads from and executes to implement the method as claimed in any one of claims 1 to 9, or to implement the method as claimed in 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