Data processing method, device and electronic equipment

By monitoring interface calls in electronic devices and redirecting data to write to appropriate memory, the problem of high CPU processing load is solved and the CPU running rate is improved.

CN113703943BActive Publication Date: 2025-08-19LENOVO (BEIJING) LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111006102.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-30
Publication Date
2025-08-19
Estimated Expiration
2041-08-30

AI Technical Summary

Technical Problem

In the prior art, after reading data from disk and decompressing, the central processor (CPU) reads and renders the output from memory by the graphics processor (GPU), resulting in a low CPU running rate.

Method used

By monitoring interface calls, it is determined whether the data meets the redirection conditions, and directly writes the data to the memory corresponding to the processor of a different CPU type, and the processor performs processing to avoid processing consumption of the CPU processing the data and then transmitting it to other processors.

Benefits of technology

It improves the running rate of the CPU, reduces the processing load of the CPU, and improves the performance of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113703943B_ABST
    Figure CN113703943B_ABST
Patent Text Reader

Abstract

The present application discloses a data processing method, apparatus, and electronic device, the method comprising: obtaining a first parameter; when the first parameter indicates that first data is to be written to a first memory, determining whether the first parameter satisfies a redirection condition; the first memory is a memory corresponding to a first processor in the electronic device; when the first parameter satisfies the redirection condition, writing the first data to a second memory according to the first parameter, the second memory being a memory corresponding to a second processor in the electronic device; wherein the second processor is of a different processor type from the first processor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device and electronic device. Background Art

[0002] In application scenarios, it is often necessary to read and decompress large amounts of data from disk to facilitate the normal operation of the application. For example, in a game application, resource files need to be decompressed in the mobile phone storage area in order to render the game interface.

[0003] Taking game applications as an example, the current solution mostly uses the central processing unit (CPU) to read data from the disk into the memory, and the CPU decompresses the data. Then the graphics processing unit (GPU) reads the decompressed data from the memory into the video memory for rendering output.

[0004] However, this solution increases CPU consumption and causes the CPU operating speed to be lower. Summary of the Invention

[0005] In view of this, the present application provides a data processing method, device, and electronic device as follows:

[0006] A data processing method, comprising:

[0007] Get the first parameter;

[0008] In a case where the first parameter indicates that the first data is to be written into a first memory, determining whether the first parameter satisfies a redirection condition; the first memory is a memory corresponding to a first processor in the electronic device;

[0009] When the first parameter satisfies the redirection condition, writing the first data into a second memory according to the first parameter, where the second memory is a memory corresponding to a second processor in the electronic device;

[0010] The second processor is of a different type from the first processor.

[0011] Preferably, the above method, obtaining the first parameter, includes:

[0012] When it is detected that the first interface is called, a first parameter in the first interface is obtained; the first interface is used to write the first data into the first memory according to the instruction of the first parameter.

[0013] Preferably, the method of writing the first data into the second memory according to the first parameter includes:

[0014] Stop calling the first interface and call a target interface, where the target interface is used to write the first data into the second memory according to the first parameter.

[0015] The above method preferably further comprises:

[0016] Get the second parameter;

[0017] In a case where the second parameter indicates to read the second data from the first memory, reading the second data from the second memory according to the second parameter, and outputting an image according to the second data;

[0018] The second data is data obtained by processing the first data.

[0019] In the above method, preferably, the second parameter is obtained from the second interface when it is detected that the second interface is called; the second interface is at least used to read the second data from the first memory according to the instruction of the second parameter;

[0020] Reading the second data from the second memory according to the second parameter includes:

[0021] The second interface is triggered to read the second data in the second memory according to the second parameter, and image output is performed according to the second data.

[0022] The above method, preferably, further comprises:

[0023] Record storage parameters of the second data in the second memory, where the storage parameters are provided to the second interface so that the second interface reads the second data from the second memory according to the storage parameters.

[0024] In the above method, preferably, the second data is obtained by the second processor decompressing the first data, so that the second interface can recognize the second data and output an image according to the second data after reading the second data.

[0025] In the above method, preferably, the first parameter satisfies the redirection condition, including:

[0026] The first parameter includes a data identifier, and the data identifier indicates that the first data is target type data.

[0027] A data processing device, comprising:

[0028] A parameter obtaining unit, configured to obtain a first parameter;

[0029] a conditional judgment unit, configured to, when the first parameter indicates that the first data is to be written into the first memory, judge whether the first parameter satisfies a redirection condition; the first processor being a memory corresponding to the first processor in the electronic device; and triggering the data writing unit when the first parameter satisfies the redirection condition;

[0030] a data writing unit, configured to write the first data into a second memory according to the first parameter, where the second memory is a second processor in the electronic device;

[0031] The second processor is of a different type from the first processor.

[0032] An electronic device, comprising:

[0033] A first processor corresponding to a first memory;

[0034] a second processor corresponding to the second memory, the second processor being of a different processor type than the first processor;

[0035] The first processor is configured to obtain a first parameter, and when the first parameter indicates that first data is to be written into the first memory, determine whether the first parameter satisfies a redirection condition, and when the first parameter satisfies the redirection condition, write the first data into the second memory according to the first parameter.

[0036] It can be seen from the above technical solution that in a data processing method, device and electronic device disclosed in the present application, after obtaining the first parameter indicating that the first data is to be written into the first memory corresponding to the first processor, it is determined whether the first parameter meets the redirection condition, and then when the first parameter meets the redirection condition, the first data is written into the second memory corresponding to the second processor according to the first parameter. As a result, the second processor in the present application can directly process the first data in the second memory, thereby avoiding the processor consumption caused by the first processor first processing the first data in the first memory and then sending it to the second processor for processing, thereby improving the operating speed of the first processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0038] Figure 1 A flowchart of a data processing method provided in Example 1 of the present application;

[0039] Figure 2-Figure 4 They are respectively application example diagrams of the embodiments of the present application;

[0040] Figure 5 Another flow chart of a data processing method provided in Example 1 of the present application;

[0041] Figure 6 This is another application example diagram of an embodiment of the present application;

[0042] Figure 7 A schematic diagram of the structure of a data processing device provided in Example 2 of the present application;

[0043] Figure 8-Figure 9 They are respectively another structural schematic diagram of a data processing device provided in the second embodiment of the present application;

[0044] Figure 10 A schematic diagram of the structure of an electronic device provided in Example 3 of the present application;

[0045] Figure 11 This embodiment of the present application is a flowchart for implementing a method of reducing CPU occupancy to increase the running speed when a mobile phone is running a game application. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0047] refer to Figure 1 FIG2 is a flowchart illustrating an implementation of a data processing method provided in Example 1 of the present application. The method can be applied to electronic devices including multiple processors of different types, such as mobile phones, pads, notebooks, computers, or servers. The technical solution in this embodiment is mainly used to increase the operating speed of the first processor in the electronic device.

[0048] Specifically, the method in this embodiment may include the following steps:

[0049] Step 101: Obtain a first parameter.

[0050] The first parameter may instruct the electronic device to perform corresponding processing, such as reading data, writing data, etc., through the parameter content included therein.

[0051] Specifically, the first parameter may include at least a first content and a second content, where the first content indicates the write location of the first data, and the second content indicates the data type of the first data. For example, the first content indicates whether the first data is to be written to the first storage device or the second storage device, and the second content is represented by a data identifier, such as a file name or a file suffix, which indicates whether the first data is of the target type or another type of data.

[0052] The first memory is a memory corresponding to the first processor, and the second memory is a memory corresponding to the second processor, and the second processor is a different type of processor from the first processor. For example, the first processor is a central processing unit (CPU), and the first memory is a memory connected to the CPU. The second processor is a graphics processing unit (GPU), a video processing unit (VPU), or a neural-network processing unit (NPU), which is a different type of processor from the CPU. For example, if the second processor is a GPU, the second memory can be video memory connected to the GPU.

[0053] Step 102 : Determine whether the first parameter indicates writing the first data into the first memory; if so, execute step 103 .

[0054] In this embodiment, the write location of the first data indicated by the first content in the first parameter can be parsed to determine whether the first parameter indicates that the first data is to be written into the first memory. Based on this, if it is determined that the first parameter indicates that the first data is to be written into the first memory, step 103 is executed.

[0055] Specifically, the first data is data corresponding to an application configured in the electronic device. Taking a game application as an example, the first data may be data such as a game progress file, a game resource file, etc. The first data may be pre-stored in a target memory in the electronic device. The target memory may be a device such as a disk memory in the electronic device. For example, Figure 2 As shown in , after the game application is started in the mobile phone and runs in the CPU, the game application needs to read the game data from the disk storage to facilitate the normal operation of the game application. Based on this, the parameters of the data reading are parsed in this embodiment to determine whether to indicate that the game data is to be written to the memory.

[0056] Step 103: Determine whether the first parameter meets the redirection condition. If yes, execute step 104.

[0057] In this embodiment, the data type of the first data indicated by the second content in the first parameter may be parsed to determine whether the first parameter meets the redirection condition.

[0058] Specifically, the redirection condition is a condition related to the target type of data, which is data that needs to be processed by the second processor. For example, resource file type data needs to be rendered by the GPU to obtain a rendered image of the game frame, and then the rendered image is output to meet the user's gaming experience. In this embodiment, the first parameter meeting the redirection condition can be: the first parameter includes a data identifier, i.e., the second content, and the data identifier indicates that the first data is data of the target type.

[0059] Based on this, when the second content indicates that the first data is data of the target type, it indicates that the first parameter indicates that the first data of the target type is written to the first memory. At this time, it can be determined that the first parameter meets the redirection condition, that is, write redirection is required, and step 104 is executed at this time.

[0060] Step 104: Write the first data into the second memory according to the first parameter.

[0061] Specifically, in this embodiment, the first data of the target type indicated by the first parameter is written to the second memory, so that the second processor corresponding to the second memory can directly process the first data in the second memory to obtain the second data, so that the second processor can perform corresponding subsequent processing on the second data.

[0062] Specifically, the second processor may decompress the first data in the second memory so that the obtained second data can be used for other processing, such as image rendering.

[0063] Compared with the solution of writing the first data into the first memory according to the first parameter and then having the first processor process the first data in the first memory and then transfer the second data to the second memory, in this embodiment, the first data of the target type indicated by the first parameter is written to the second memory through redirection, and the second processor directly processes the data to obtain the second data without occupying the first processor, thereby reducing the occupancy of the first processor and improving the operating speed of the first processor.

[0064] For example, Figure 2As shown in , in this embodiment, when it is determined that the game data is to be written to the memory, it is determined whether the game data is a resource file type. If the game data is a game resource file, then data writing needs to be redirected. That is, if the game data to be written to the memory is determined to be a resource file type, in this embodiment, the game data is directly written to the video memory through the GPU, so that the GPU can directly decompress the game data in the video memory. This avoids excessive CPU usage caused by the CPU decompressing the game data in the memory, thereby improving the CPU's operating speed.

[0065] It can be seen from the above scheme that in a data processing method provided in Example 1 of the present application, after obtaining the first parameter indicating that the first data is to be written into the first memory corresponding to the first processor, it is determined whether the first parameter meets the redirection condition, and then when the first parameter meets the redirection condition, the first data is written into the second memory corresponding to the second processor according to the first parameter. As a result, the second processor in the present application can directly process the first data in the second memory, thereby avoiding the processor consumption caused by the first processor first processing the first data in the first memory and then sending it to the second processor for processing, thereby improving the operating speed of the first processor.

[0066] In one implementation, obtaining the first parameter in step 101 can be specifically implemented in the following manner:

[0067] When it is detected that the first interface is called, a first parameter in the first interface is obtained, and the first interface is used to write the first data into the first memory according to the instruction of the first parameter.

[0068] That is to say, in this embodiment, whether the first interface in the electronic device for writing the first data into the first memory is called is monitored. If the first interface is called, a first parameter indicating the write location of the first data and the data type of the first data can be obtained from the first interface.

[0069] Take gaming applications as an example, Figure 3As shown in , after the game application is started, the mobile phone monitors whether the read-write API (Application Programming Interface) corresponding to the game application is called. If the read-write API is called, the corresponding first parameter can be obtained in the read-write API, that is, the parameter that can indicate the write position and data type of the first data to be read from the disk storage. Based on this, this embodiment determines whether the first parameter indicates that the first data is to be written to the memory and whether it indicates that the first data is a game resource file. Furthermore, when the first parameter indicates that the first data of the resource file type is to be written to the memory, this embodiment writes the first data to the video memory through write redirection instead of writing it to the memory, so that the GPU can directly decompress the game resource file in the video memory, avoiding the situation where the CPU decompresses the game resource file in the memory and causes excessive CPU occupation, thereby improving the CPU's operating speed.

[0070] Based on the above implementation, in step 104, when the first data is written into the second memory according to the first parameter, it can be specifically implemented in the following manner:

[0071] The calling of the first interface is stopped and a target interface is called, where the target interface is used to write the first data into the second memory according to the first parameter.

[0072] That is to say, in this embodiment, when it is determined that the first parameter indicates that the first data of the target type is to be written into the first memory, write redirection is achieved through interface redirection, that is, after stopping calling the first interface, the target interface is called, and the target interface writes the first data into the second memory according to the first parameter, thereby achieving write redirection.

[0073] Take gaming applications as an example, Figure 4As shown in , after the game application is started, the mobile phone monitors whether the read-write API corresponding to the game application is called. If the read-write API is called, the corresponding first parameter can be obtained in the read-write API, that is, the parameter that can indicate the write location and data type of the first data to be read from the disk storage. Based on this, this embodiment judges whether the first parameter indicates that the first data is to be written to the memory and whether it indicates that the first data is a game resource file. Then, when the first parameter indicates that the first data of the resource file type is to be written to the memory, this embodiment redirects the interface to stop calling the read-write API and call a new interface that can write the first data to the video memory. For example, the first parameter of the read-write API is passed to the DirectStorage API. After the DirectStorage API writes the game resource file to the video memory according to the passed parameter, the GPU can directly decompress the game resource file in the video memory to avoid excessive CPU occupation caused by the CPU decompressing the game resource file in the memory, thereby improving the CPU's operating speed.

[0074] Based on the above implementation, after step 104, this embodiment may further include the following steps: Figure 5 As shown in:

[0075] Step 105: Obtain the second parameter.

[0076] The second parameter indicates data reading. For example, the second parameter includes a third content and a fourth content, wherein the third content is used to indicate a location for data reading and the fourth content is used to indicate the data read.

[0077] Taking a game application as an example, after the game application is started, it needs to use the decompressed game resource file for rendering, thereby obtaining a rendered image of the game frame and outputting it. Based on this, in this embodiment, the second parameter for reading the game resource file is obtained.

[0078] Step 106: When the second parameter indicates to read the second data from the first memory, read the second data from the second memory according to the second parameter and output an image according to the second data.

[0079] The second parameter can be obtained from the second interface when it is detected that the second interface has been called, and the second interface is at least used to read the second data from the first memory according to the indication of the second parameter. In other words, in this embodiment, whether the second interface for reading the second data from the first memory in the electronic device is called is monitored. If the second interface is called, a second parameter indicating the second data and the reading location of the second data can be obtained from the second interface.

[0080] Based on this, in step 106, the second interface can be triggered to read the second data in the second memory according to the second parameter. In this embodiment, there is no need to read the second data from the first memory. The second data read at this time is the data obtained by the second processor processing the first data in the second memory. Based on this, in this embodiment, the second data can be processed by the second processor to obtain the corresponding image and output the image.

[0081] Specifically, the second data is obtained by the second processor decompressing the first data, so that the second interface can recognize the second data and output an image according to the second data after reading the second data.

[0082] Take gaming applications as an example, Figure 6 As shown in , after the game application is started, the mobile phone monitors whether the read / write API corresponding to the game application is called. If the read / write API is called, the corresponding first parameter can be obtained in the read / write API, that is, a parameter that can indicate the write location and data type of the first data to be read from the disk storage. Based on this, in this embodiment, it is judged whether the first parameter indicates that the first data is to be written to the memory and whether it indicates that the first data is a game resource file. Then, when the first parameter indicates that the first data of the resource file type is to be written to the memory, in this embodiment, the first data is written to the video memory by write redirection instead of writing to the memory. Based on this, the GPU directly decompresses the game resource file in the video memory, and the CPU does not need to perform decompression processing; afterwards, when it is detected that the rendering API corresponding to the game application is called, the second parameter can be obtained in the rendering API, and the rendering API is triggered to read the game resource file decompressed by the GPU from the video memory according to the second parameter, and the GPU performs image rendering based on the game resource file, thereby obtaining a rendered image of the corresponding game frame and performing image output. In this way, it is possible to effectively avoid the situation where the CPU decompresses the game resource file in the memory and causes excessive CPU occupation, thereby improving the CPU's operating speed.

[0083] In addition, in order to achieve accurate reading of the second data, in this embodiment, after the second processor processes the first data in the second memory, the storage parameters of the second data in the second memory can also be recorded. The storage parameters can be parameters such as address pointers, which are used to be given to the second interface so that the second interface can read the second data in the second memory according to the storage parameters.

[0084] Take gaming applications as an example, Figure 6As shown in , after the game application is started, the mobile phone monitors whether the read / write API corresponding to the game application is called. If the read / write API is called, the corresponding first parameter can be obtained in the read / write API, that is, the parameter that can indicate the write location and data type of the first data read from the disk storage. Based on this, in this embodiment, it is judged whether the first parameter indicates that the first data is written to the memory and whether it indicates that the first data is a game resource file. Then, when the first parameter indicates that the first data of the resource file type is written to the memory, in this embodiment, the first data is written to the video memory by write redirection instead of writing to the memory. Based on this, the GPU directly decompresses the game resource file in the video memory and passes the address pointer of the decompressed game resource file in the video memory to the rendering API, and the CPU does not need to perform decompression at this time; afterwards, when it is detected that the rendering API corresponding to the game application is called, the second parameter can be obtained in the rendering API, and the rendering API is triggered to read the game resource file decompressed by the GPU from the video memory according to the second parameter and the address pointer passed, and the GPU performs image rendering according to the game resource file, thereby obtaining a rendered image of the corresponding game frame and outputting the image. This can effectively avoid the situation where the CPU decompresses the game resource files in the memory and causes excessive CPU usage, thereby improving the CPU's operating speed.

[0085] refer to Figure 7 , is a schematic diagram of the structure of a data processing device provided in Example 2 of this application. This device can be applied to electronic devices containing multiple processors of different processor types, such as mobile phones, pads, notebooks, computers, or servers. The technical solution in this embodiment is mainly used to increase the operating speed of the first processor in the electronic device.

[0086] Specifically, the device in this embodiment may include the following units:

[0087] A parameter obtaining unit 701 is configured to obtain a first parameter;

[0088] a conditional judgment unit 702 configured to, when the first parameter indicates that the first data is to be written into the first memory, determine whether the first parameter satisfies a redirection condition; the first processor being a memory corresponding to the first processor in the electronic device; and triggering the data writing unit 703 when the first parameter satisfies the redirection condition;

[0089] a data writing unit 703, configured to write the first data into a second memory according to the first parameter, where the second memory is a second processor in the electronic device;

[0090] The second processor is of a different type from the first processor.

[0091] It can be seen from the above scheme that in a data processing device provided in Example 2 of the present application, after obtaining the first parameter indicating that the first data is to be written into the first memory corresponding to the first processor, it is determined whether the first parameter meets the redirection condition, and then when the first parameter meets the redirection condition, the first data is written into the second memory corresponding to the second processor according to the first parameter. As a result, the second processor in the present application can directly process the first data in the second memory, thereby avoiding the processor consumption caused by the first processor first processing the first data in the first memory and then sending it to the second processor for processing, thereby improving the operating speed of the first processor.

[0092] In one implementation, the parameter obtaining unit 701 is specifically used to: obtain a first parameter in the first interface when it is detected that the first interface is called; the first interface is used to write the first data into the first memory according to the instruction of the first parameter.

[0093] Based on the above implementation, the data writing unit 703 is specifically configured to: stop calling the first interface and call a target interface, where the target interface is configured to write the first data into the second memory according to the first parameter.

[0094] In one implementation, the parameter obtaining unit 701 is further configured to: obtain a second parameter;

[0095] Based on this, the device further includes the following unit 704, such as Figure 8 As shown in:

[0096] The data reading unit 704 is used to read the second data from the second memory according to the second parameter when the second parameter indicates that the second data is to be read from the first memory, and to output an image based on the second data; wherein the second data is data obtained by processing the first data.

[0097] Based on the above implementation, the second parameter is obtained from the second interface when it is detected that the second interface is called; the second interface is at least used to read the second data from the first memory according to the instruction of the second parameter;

[0098] The data reading unit 704 is specifically configured to trigger the second interface to read the second data from the second memory according to the second parameter, and output an image according to the second data.

[0099] Optionally, the device further includes the following units: Figure 9As shown in:

[0100] The parameter recording unit 705 is used to record storage parameters of the second data in the second memory, and the storage parameters are used to be given to the second interface so that the second interface reads the second data in the second memory according to the storage parameters.

[0101] Optionally, the second data is obtained by the second processor decompressing the first data, so that the second interface can recognize the second data and output an image according to the second data after reading the second data.

[0102] In one implementation, the first parameter satisfies a redirection condition, including:

[0103] The first parameter includes a data identifier, and the data identifier indicates that the first data is target type data.

[0104] It should be noted that the specific implementation of the above units can refer to the corresponding content in the previous text and will not be described in detail here.

[0105] refer to Figure 10 , is a schematic diagram of the structure of an electronic device provided in Example 3 of the present application. The electronic device may be an electronic device including multiple processors of different processor types, such as a mobile phone, pad, notebook, computer, or server. The technical solution in this embodiment is primarily used to increase the operating speed of the first processor in the electronic device.

[0106] Specifically, the electronic device in this embodiment may include the following structure:

[0107] A first processor 1001, such as a CPU, corresponds to a first memory 1002, such as a memory;

[0108] A second processor 1003, such as a GPU, corresponds to a second memory 1004, such as a video memory, and the second processor 1003 is of a different processor type than the first processor 1001;

[0109] The first processor 1001 is used to obtain a first parameter, and when the first parameter indicates that the first data is to be written into the first memory 1002, determine whether the first parameter satisfies a redirection condition, and when the first parameter satisfies the redirection condition, write the first data into the second memory 1004 according to the first parameter.

[0110] It can be seen from the above scheme that in a data processing method provided in Example 1 of the present application, after obtaining the first parameter indicating that the first data is to be written into the first memory corresponding to the first processor, it is determined whether the first parameter meets the redirection condition, and then when the first parameter meets the redirection condition, the first data is written into the second memory corresponding to the second processor according to the first parameter. As a result, the second processor in the present application can directly process the first data in the second memory, thereby avoiding the processor consumption caused by the first processor first processing the first data in the first memory and then sending it to the second processor for processing, thereby improving the operating speed of the first processor.

[0111] Taking the electronic device as a mobile phone equipped with a game application as an example, the technical solution in this application is adopted. During the operation of the game application, the read and write API and rendering API are redirected by hooking. Specifically, the read and write API is replaced with the DirectStorage API, and the rendering API is triggered to read data from the video memory. Figure 11 The process shown in the following details the implementation of reducing the CPU usage of mobile phones during the operation of game applications:

[0112] First, while the game application is running, the behavior of reading and writing game resource files is captured. This means monitoring whether the read and write APIs are called, and then analyzing whether the data to be read or written is a game resource file. For example, this can be determined by checking whether the file suffix or file name corresponds to the resource file type. Reading and writing here refers to first reading data from the phone's disk and then writing it to the memory.

[0113] Afterwards, if the data to be read and written is a game resource file, the read and write API used for reading and writing resource files is replaced with the DirectStorage API. The DirectStorage API writes the read game resource file to the video memory, that is, it is first sent to the GPU, which writes it to the video memory and decompresses the game resource file in the video memory. At the same time, the storage location of the decompressed game resource file in the video memory is recorded.

[0114] Finally, when the API used for subsequent rendering is called, the game resource file storage location in the video memory is used to directly render the resource file in the GPU video memory, and the image is output after the rendered image is obtained.

[0115] It can be seen that in this application, there is no need to increase the hardware cost of the mobile phone. The game application can also support the new DirectStorage API technology through software. The resource files can be directly written to the GPU video memory for decompression, thereby greatly improving the speed of decompressing resources in any game, thereby bringing a better gaming experience to users.

[0116] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.

[0117] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0118] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0119] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data processing method, comprising: Get the first parameter; In a case where the first parameter indicates that the first data is to be written into the first memory, determining whether the first parameter satisfies a redirection condition; The first memory is a memory corresponding to the first processor in the electronic device; When the first parameter satisfies the redirection condition, writing the first data into a second memory according to the first parameter, so that the second processor directly processes the first data, the second memory being a memory corresponding to the second processor in the electronic device; wherein the second processor is of a different processor type than the first processor; The first parameter satisfies the redirection condition, including: The first parameter includes a data identifier, and the data identifier indicates that the first data is target type data, and the target type data is data that needs to be processed by the second processor.

2. The method according to claim 1, obtaining the first parameter, comprising: When it is detected that a first interface is called, obtaining a first parameter in the first interface; The first interface is used to write the first data into the first memory according to the instruction of the first parameter.

3. The method according to claim 2, writing the first data into the second memory according to the first parameter, comprising: Stop calling the first interface and call a target interface, where the target interface is used to write the first data into the second memory according to the first parameter.

4. The method according to any one of claims 1 to 3, further comprising: Get the second parameter; In a case where the second parameter indicates to read the second data from the first memory, reading the second data from the second memory according to the second parameter, and outputting an image according to the second data; The second data is data obtained by processing the first data.

5. The method according to claim 4, wherein the second parameter is obtained from the second interface when it is detected that the second interface is called; the second interface is at least used to read the second data from the first memory according to the instruction of the second parameter; in, Reading the second data from the second memory according to the second parameter includes: The second interface is triggered to read the second data in the second memory according to the second parameter, and image output is performed according to the second data.

6. The method according to claim 5, further comprising: Record storage parameters of the second data in the second memory, where the storage parameters are provided to the second interface so that the second interface reads the second data from the second memory according to the storage parameters.

7. The method according to claim 5, wherein the second data is obtained by the second processor decompressing the first data, so that the second interface can recognize the second data and output an image according to the second data after reading the second data.

8. A data processing device comprising: A parameter obtaining unit, configured to obtain a first parameter; a condition judgment unit, configured to judge whether the first parameter satisfies a redirection condition when the first parameter indicates that the first data is to be written into the first memory; The first memory is a memory corresponding to the first processor in the electronic device; When the first parameter satisfies the redirection condition, triggering the data writing unit; a data writing unit, configured to write the first data into a second memory according to the first parameter, so that the second processor directly processes the first data, the second memory being a memory corresponding to the second processor in the electronic device; wherein the second processor is of a different processor type than the first processor; The first parameter satisfies the redirection condition, including: The first parameter includes a data identifier, and the data identifier indicates that the first data is target type data, and the target type data is data that needs to be processed by the second processor.

9. An electronic device comprising: A first processor corresponding to a first memory; a second processor corresponding to the second memory, the second processor being of a different processor type than the first processor; a first processor, configured to obtain a first parameter, and if the first parameter indicates that first data is to be written into the first memory, determine whether the first parameter satisfies a redirection condition; and if the first parameter satisfies the redirection condition, write the first data into the second memory according to the first parameter, so that the second processor directly processes the first data; The first parameter satisfies the redirection condition, including: The first parameter includes a data identifier, and the data identifier indicates that the first data is target type data, and the target type data is data that needs to be processed by the second processor.

Citation Information

Patent Citations

  • Data processing method and device and storage device

    CN104881259A