Graphics data access processing method, device, computer equipment and storage medium

By creating file descriptors of the cache area in domestic processors and performing memory mapping, directly accessing the graphic data in the cache area, solving the problem of memory bandwidth usage caused by frequent memory copies and improving the operating efficiency of the processor.

CN114756699BActive Publication Date: 2025-03-25HUNAN HANBOWEI MICROELECTRONICS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210446356.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-26
Publication Date
2025-03-25
Estimated Expiration
2042-04-26

AI Technical Summary

Technical Problem

In the real-time operating system of existing domestic processors, frequent memory copies lead to large memory bandwidth usage, seriously affecting the operating efficiency of the processor.

Method used

By creating a file descriptor for the cache area, it passes it to the application layer, writes the graphics data of the specified graphics into the cache area, and obtains permissions through memory mapping to directly access the graphics data in the cache area, avoiding frequent memory copies.

Benefits of technology

The entire access and display process does not require frequent memory copying, freeing up a large amount of memory bandwidth, effectively improving the operating efficiency of the processor.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114756699B_ABST
    Figure CN114756699B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, computer equipment, storage medium and computer program product for accessing and processing graphic data. The method comprises: when a display request for a specified graphic is obtained, a file descriptor corresponding to a cache area is created, the file descriptor is passed to an application layer, and the graphic data of the specified graphic is written into the cache area; the file descriptor is obtained from the application layer, and the cache area associated with the file descriptor is determined; a connection and a memory mapping relationship is established with the cache area, and permissions to the memory address of the cache area are obtained; the graphic data of the specified graphic cached in the cache area is directly accessed according to the permissions, and displayed. The use of this method can effectively improve the operating efficiency of the 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 method, device, computer equipment, storage medium and computer program product for accessing and processing graphic data. Background Art

[0002] With the development of information technology, the security and confidentiality of information are becoming increasingly difficult to guarantee, so the demand for domestically developed chips is also expanding.

[0003] The interaction between the display controller driver device and the graphics processing unit device in the existing domestic processors still uses the original memory copy method. In real-time operating systems, frequent memory copies will occupy a large amount of memory bandwidth, seriously affecting the operating efficiency of the processor. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for accessing and processing graphics data that can improve program running efficiency in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for accessing and processing graphic data, the method comprising:

[0006] When a display request for a specified graphic is obtained, a file descriptor corresponding to the buffer area is created, the file descriptor is passed to the application layer, and the graphic data of the specified graphic is written into the buffer area;

[0007] Obtain the file descriptor from the application layer, and determine a buffer associated with the file descriptor;

[0008] Establishing a connection and a memory mapping relationship with the cache area to obtain permission for the memory address of the cache area;

[0009] The graphic data of the designated graphic cached in the cache area is directly accessed and displayed according to the authority.

[0010] In one embodiment, when a display request for a specified graphic is obtained, creating a file descriptor corresponding to a buffer area, passing the file descriptor to an application layer, and writing the graphic data of the specified graphic into the buffer area includes:

[0011] Declare direct access to the buffer based on the processing request for the specified graphics;

[0012] Mounting the cache area function interface into the cache area;

[0013] Calling a preset creation function to create a file descriptor corresponding to the buffer area, associating the file descriptor with the buffer area, and passing the file descriptor to the application layer;

[0014] The graphic data of the specified graphic is written into the buffer area.

[0015] In one embodiment, writing the data of the specified image into the buffer area includes:

[0016] If the buffer area is not occupied, the control authority for the buffer area is obtained, and the graphic data of the specified graphic is written into the buffer area.

[0017] In one embodiment, the method further comprises:

[0018] If the buffer area is occupied, suspend the data writing step and wait;

[0019] When the waiting time reaches the preset waiting time, the data writing step is executed again to write the graphic data of the designated graphic into the buffer area.

[0020] In one embodiment, directly accessing the graphic data of the specified graphic cached in the buffer area according to the permission includes:

[0021] If the cache area is not occupied, then the control authority for the cache area is obtained, and the data cached in the cache area is directly accessed according to the authority.

[0022] In one embodiment, the method further comprises:

[0023] If the buffer area is occupied, suspend the data access step and wait;

[0024] When the waiting time reaches the preset waiting time, the data access step is executed again to access the data cached in the cache area.

[0025] In a second aspect, the present application further provides a device for accessing and processing graphic data, the device comprising:

[0026] A data writing module is used to create a file descriptor corresponding to the buffer area when a display request for a specified graphic is obtained, pass the file descriptor to the application layer, and write the graphic data of the specified graphic into the buffer area;

[0027] A buffer area determination module, used to obtain the file descriptor from the application layer and determine the buffer area associated with the file descriptor;

[0028] A permission acquisition module, used to establish a connection and a memory mapping relationship with the cache area, and obtain permission to the memory address of the cache area;

[0029] A data access module is used to directly access the graphic data of the specified graphic cached in the cache area according to the authority and display it.

[0030] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0032] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.

[0033] The above-mentioned method, device, computer equipment, storage medium and computer program product for accessing and processing graphic data, when a display request for a specified graphic is obtained, the graphic processing device creates a file descriptor corresponding to the cache area, passes the file descriptor to the application layer, and writes the graphic data of the specified graphic to the cache area. The display control device obtains the file descriptor from the application layer, determines the cache area associated with the file descriptor, establishes a connection and memory mapping relationship with the cache area, obtains the permission for the memory address of the cache area, and can directly access and display the graphic data of the specified graphic cached in the cache area according to the permission. The entire access and display process does not require frequent memory copying, which releases a large amount of memory bandwidth and effectively improves the operating efficiency of the processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a structural block diagram of a graphics processor in one embodiment;

[0035] Figure 2 A schematic diagram of a flow chart of a method for accessing and processing graphic data in one embodiment;

[0036] Figure 3 A flowchart of the steps of creating a file descriptor corresponding to a buffer area, passing the file descriptor to an application layer, and writing data of the specified image into the buffer area when a display request for a specified graphic is obtained in one embodiment;

[0037] Figure 4 It is a flowchart of a method for accessing and processing graphic data in another embodiment;

[0038] Figure 5is a structural block diagram of a device for accessing and processing graphics data in one embodiment;

[0039] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0041] In existing domestic processors, such as Feiteng processors, when the graphics processing device 102 interacts with the display control device 104, frequent memory copies can easily lead to reduced operating efficiency and processor performance. The graphics data access processing method provided in the embodiment of the present application can be applied to Figure 1 In the graphics processor 100S shown. Among them, the graphics processor 100 includes a graphics processing device 102 and a display control device 104, and the graphics processing device 102 and the display control device 104 exchange data through a shared buffer area 106. Specifically, when the graphics processor 100 receives a display request for a specified graphic, the graphics processing device 102 creates a file descriptor corresponding to the buffer area 106, passes the file descriptor to the application layer, writes the graphic data of the specified graphic into the buffer area 106, and the display control device 104 obtains the file descriptor from the application layer, determines the buffer area 106 associated with the file descriptor, establishes a connection and a memory mapping relationship with the buffer area 106, and obtains the permission for the memory address of the buffer area 106; directly accesses the graphic data of the specified graphic cached in the buffer area 106 according to the permission, and displays it.

[0042] In one embodiment, Figure 2 As shown, a method for accessing and processing graphic data is provided, and the method is applied in Figure 1 Taking the graphics processor in FIG. 1 as an example, the method includes the following steps:

[0043] Step 202: When a display request for a specified graphic is obtained, a file descriptor corresponding to the buffer area is created, the file descriptor is passed to the application layer, and the graphic data of the specified graphic is written into the buffer area.

[0044] The specified graphic is a graphic that needs to be displayed on the display device. When the user needs to display the specified graphic on the display device, a display request operation is triggered, and the display request is used to instruct to display the specified graphic on the display device. It can be understood that the graphic data of the specified graphic is the output data of the graphics processing unit in the graphics processor.

[0045] The buffer area is used to cache image data processed by the graphics processing device. It can be understood that the buffer area is set in the kernel space of the image processor.

[0046] Among them, the file descriptor is an index created by the kernel for efficient management of opened files. It is used to refer to the opened file. All system calls related to the I / O operations of the file need to go through the file descriptor.

[0047] The application layer provides an interface for applications used for communication and the underlying network used for message transmission. By passing the file descriptor to the application layer, it is convenient for the device that needs to access the buffer area corresponding to the file descriptor to quickly find the corresponding buffer area.

[0048] Specifically, when the graphics processor receives a display request for a specified graphic, the graphics processing device in the graphics processor responsible for producing the specified graphic will create a file descriptor corresponding to the cache area, pass the file descriptor to the application layer, and then write the image data of the produced specified graphic into the cache area.

[0049] Step 204, obtain a file descriptor from the application layer, and determine a buffer area associated with the file descriptor.

[0050] Specifically, the display control device in the image processor obtains the file descriptor transmitted by the graphics processing device from the application layer, and determines the buffer area associated with the file descriptor according to the file descriptor.

[0051] Step 206, establish a connection and memory mapping relationship with the cache area, and obtain permission for the cache area memory address.

[0052] The display control device establishes a connection relationship with the buffer area by acquiring the physical starting address and length of the buffer area.

[0053] The memory mapping relationship refers to the corresponding relationship between the user space where the display control device is located and the kernel space where the cache area is located. By establishing a memory mapping relationship with the cache area, the display control device can directly map the cache area of ​​the kernel space to the user space, thereby obtaining the permission to the memory address of the cache area. At this time, the display control device can directly access the physical memory of the cache area like accessing a normal file.

[0054] Specifically, the display control device obtains the physical starting address and length of the cache area, establishes a connection relationship with the cache area, and establishes a memory mapping relationship with the cache area, maps the cache area in the kernel space to the user space, thereby obtaining permission to the cache area memory address.

[0055] Step 208: directly access the graphic data of the designated graphic cached in the cache area according to the authority, and display it.

[0056] Specifically, the display control device directly accesses the graphic data of the designated graphic cached in the cache area according to the acquired cache area memory address authority and displays it.

[0057] In the above-mentioned method for accessing and processing graphic data, when a display request for a specified graphic is obtained, the graphics processing device creates a file descriptor corresponding to the cache area, passes the file descriptor to the application layer, and writes the graphic data of the specified graphic into the cache area. The display control device obtains the file descriptor from the application layer, determines the cache area associated with the file descriptor, establishes a connection and memory mapping relationship with the cache area, obtains permission for the memory address of the cache area, and can directly access and display the graphic data of the specified graphic cached in the cache area according to the permission. The entire access and display process does not require frequent memory copying, which releases a large amount of memory bandwidth and effectively improves the operating efficiency of the processor.

[0058] In one embodiment, Figure 3 As shown, when a display request for a specified graphic is obtained, a file descriptor corresponding to the buffer area is created, the file descriptor is passed to the application layer, and the data of the specified image is written into the buffer area, including:

[0059] Step 302: Declare a directly accessed buffer area based on a processing request for a specified graphic.

[0060] The processing request for the specified graphic is used to instruct to store the graphic data corresponding to the specified graphic into the buffer area.

[0061] Specifically, when the graphics processor obtains a display request for a specified graphic, it generates a processing request for the specified graphic and sends it to the graphics processing device, instructing the graphics processing device to store the graphics data corresponding to the specified graphic into a cache. Based on the processing request for the specified graphic, the graphics processing device declares a cache that can be directly accessed by both the graphics processing device and the display control device, that is, creates a directly accessible cache in the kernel space of the graphics processor.

[0062] Step 304, mount the cache area function interface into the cache area.

[0063] The buffer area function interface is an interface that includes functions that can be implemented by the buffer area. It can be understood that the number of buffer area function interfaces can be set according to the specific needs of the application.

[0064] Specifically, the graphics processing device encapsulates at least one cache area function interface with related information of other cache areas, and mounts the cache area function interface into the cache area.

[0065] In one embodiment, the graphics processing device encapsulates the basic information of the buffer, the buffer function interface and the buffer initialization module together to obtain a buffer object.

[0066] The basic information of the buffer includes the buffer memory size, pointer (mem_ptr) and name in user space (buffer_id). Specifically, the memory size remains unchanged throughout the life cycle of the buffer object; the pointer is used to point to the first address of the buffer memory space; the user space name is the name given by the user space to the buffer object, which is assigned when a new buffer object is generated to facilitate subsequent debugging.

[0067] Step 306, calling a preset creation function, creating a file descriptor corresponding to the buffer area, associating the file descriptor with the buffer area, and passing the file descriptor to the application layer.

[0068] The creation function is a function for creating a corresponding file descriptor for the buffer area. It can be understood that the creation function is pre-stored in the graphics processor, and when it is necessary to create a file descriptor corresponding to the buffer area, the graphics processing device can directly call the creation function to create it.

[0069] Specifically, the image processing device calls a preset creation function to create a file descriptor corresponding to the buffer area, and points the item corresponding to the file descriptor in the pointer array of the file type in the file descriptor table to the buffer area, so that the file descriptor and the buffer area are correspondingly related. The file descriptor is passed to the application layer, and the file descriptor can be used as a medium to realize data interaction between the image processing device and the display control device.

[0070] In one embodiment, the creation function is an mmap function.

[0071] Step 308, writing the graphic data of the specified graphic into the buffer area.

[0072] Specifically, the graphics processing device writes the generated graphics data of the designated graphics into the declared buffer area.

[0073] In this embodiment, after receiving a processing request for a specified graphic, the graphics processing device declares a cache area for direct access, mounts a cache area function interface for the cache area, creates a file descriptor corresponding to the cache area by calling a preset creation function, and exposes the file descriptor to the application layer, and then writes the generated graphic data of the specified graphic into the declared cache area, providing a data basis for the subsequent display control device to read the graphic data from the cache area and display it. By creating a cache area, memory copy operations are avoided when two devices interact with data, thereby improving the operating efficiency of the processor.

[0074] In one embodiment, the functions that can be implemented by the buffer area functional interface mainly include:

[0075] (1) Establishing a correspondence between the device and the cache area: By obtaining the physical starting address and length of the cache area, an initial connection relationship is established between the graphics processing device or display controller device accessing the cache area and the cache area for use in subsequent memory space mapping operations.

[0076] (2) Memory mapping between device and buffer: Calling the preset creation function forces the address of the buffer to be mapped to the device's address space. This operation can only be called after the initial connection between the device and the buffer is established.

[0077] (3) Delete the memory mapping of the device and the cache area: This operation cancels the memory mapping established in operation (2);

[0078] (4) Memory mapping between kernel space and user space: To facilitate the device to read and write data in the cache area allocated in kernel space directly in user space, this method provides a callback function interface that can directly map the cache area in kernel space to user space. At this time, the device can directly access the physical memory of the cache area like accessing a normal file.

[0079] (5) Delete the memory mapping between kernel space and user space: This operation can delete the memory mapping between kernel space and user space established in operation (4);

[0080] (6) Fixed cache memory: During device operation, the memory address of the cache is fixed to ensure that the cache data is available so that all devices with access rights can access the cache;

[0081] (7) Unfix the cache memory: When this operation is called, the producer device (graphics processing device) has the authority to move the memory address of the cache. This operation is only used for dynamic import programs.

[0082] (8) Remove duplicate spatial mappings: When this operation is called, this method only creates a mapping for the first connection of each device. This operation can avoid creating duplicate connections for the same device multiple times.

[0083] (9) Release cache memory: This operation is called only when the reference count of the cache is 0 to release the cache object, including the physical memory corresponding to the cache object and the private data of the object.

[0084] In one embodiment, writing the data of the specified image into the buffer area includes: if the buffer area is not occupied, obtaining control authority over the buffer area, and writing the graphic data of the specified graphic into the buffer area.

[0085] Specifically, a synchronization control module is encapsulated in the cache area. Before the graphics data of the specified graphics are written into the cache area, the graphics processing device sends a write access request to the synchronization control module of the cache area and waits for a response to the request. After receiving the write access request, the synchronization control module accesses the mutually exclusive variable of the cache area to determine the current state of the cache area. If the cache area is not occupied, the state of the cache area is modified to occupied, and a write consent response is sent to the graphics processing device. The graphics processing device obtains control authority over the cache area and writes the graphics data of the specified graphics into the cache area. This method can effectively prevent the occurrence of data interaction confusion caused by the cache area being occupied by multiple producer devices and consumer devices at the same time.

[0086] In one of the embodiments, after writing is completed, the graphics processing device sends a write completion message to the synchronization control module of the cache area. After receiving the write completion message, the synchronization control module modifies the state of the cache area to unoccupied.

[0087] In one embodiment, the method for accessing and processing graphic data further includes:

[0088] If the buffer area is occupied, the data writing step is suspended and waiting is performed; when the waiting time reaches the preset waiting time, the data writing step is re-executed to write the graphic data of the specified graphic into the buffer area.

[0089] Specifically, after the image processing device sends a write access request to the synchronization control module of the cache area, if the synchronization control module determines that the current cache area is occupied, it means that the cache area is being accessed and data is being exchanged. If the image processing device is allowed to continue the data writing step at this time, it is easy to cause cache area access confusion. The graphics processing device suspends the data writing step and waits. When the waiting time reaches the preset waiting time, the graphics processing device resends the write access request to the synchronization control module of the cache area until it receives the write consent response returned by the synchronization control module, and then writes the graphic data of the specified graphic into the cache area. This effectively avoids the occurrence of cache area access confusion.

[0090] In one embodiment, if the synchronization control module determines that the current state of the buffer area is occupied, a buffer area occupied reply is sent to the image processing device.

[0091] In one embodiment, directly accessing the graphic data of the specified graphic cached in the buffer area according to the authority includes: if the buffer area is not occupied, obtaining the control authority for the buffer area, and directly accessing the graphic data of the specified graphic cached in the buffer area according to the authority.

[0092] Specifically, before directly accessing the graphic data of the specified graphic cached in the buffer area, the display control device sends a read access request to the synchronization control module of the buffer area and waits for the request response. After receiving the read access request, the synchronization control module accesses the mutex variable of the buffer area to determine the current state of the buffer area. If the buffer area is not occupied, the state of the buffer area is modified to occupied, and a read consent response is sent to the display control device. The display control device obtains the control authority for the buffer area and directly accesses the graphic data of the specified graphic cached in the buffer area according to the authority.

[0093] In one of the embodiments, after the reading is completed, the display control device sends a reading completion message to the synchronization control module of the cache area. After receiving the reading completion message, the synchronization control module modifies the state of the cache area to unoccupied.

[0094] In one embodiment, the method for processing access to graphic data further includes: if the cache area is occupied, pausing the data access step and waiting; when the waiting time reaches a preset waiting time, re-executing the data access step to access the data cached in the cache area.

[0095] Specifically, after the display control device sends a read access request to the synchronization control module of the cache area, if the synchronization control module determines that the current state of the cache area is occupied, it means that the cache area is being accessed and data is being exchanged. If the display control device is allowed to continue to perform the data reading step at this time, it is easy to cause cache area access confusion. Therefore, the display control device suspends the data writing step and waits. When the waiting time reaches the preset waiting time, the display control device resends the read access request to the synchronization control module of the cache area until it receives the read consent response returned by the synchronization control module. The display control device obtains control authority over the cache area and directly accesses the graphic data of the specified graphic cached in the cache area according to the authority. This effectively avoids the occurrence of cache area access confusion.

[0096] In one of the embodiments, if the graphics processing device or the display control device does not receive a consent response sent by the synchronization control module within a preset time threshold, the graphics processor will start a Timeout mechanism for processing.

[0097] In one embodiment, the synchronization control module is used to implement the following functions:

[0098] (1) The producer device (graphics processing device) issues a write access request to the cache area. If the cache area is not occupied, the device obtains exclusive write control permission for the cache area and updates the cache access control flag;

[0099] (2) The consumer device (display control device) issues a read access request to the cache area. If the cache area is not occupied, the device obtains the shared read control permission of the cache area and updates the cache area access control flag;

[0100] (3) When the device occupying the cache area completes the cache area access, it sends a completion signal and clears the cache area occupation mark;

[0101] 4) Only when the device applying for access to the cache area completes the corresponding permission acquisition, is it allowed to access the underlying storage of the cache area through the corresponding device.

[0102] In one embodiment, Figure 4 As shown, a method for accessing and processing graphics data is provided, which is applied to a Feiteng processor, wherein the Feiteng processor includes a graphics processing device and a display control device. Among them, the graphics processing device is a user of the cache area, responsible for writing the produced graphics data into the cache area, which is equivalent to the producer of the cache area. The graphics processing device mainly implements the following functions:

[0103] (1) The producer device declares the cache object;

[0104] (2) The producer device specifies the cache memory size and the cache mount method set according to the operating environment and function call requirements;

[0105] (3) The producer device and the cache area are memory mapped;

[0106] (4) The producer device writes the data to be shared into the cache area and waits for the consumer device to access it.

[0107] The display control device is a buffer consumer device corresponding to the graphics processing device, and is mainly responsible for reading and utilizing the data in the buffer. The display control device mainly implements the following functions:

[0108] (1) The consumer device obtains the file descriptor fd passed by the application layer;

[0109] (2) The consumer device obtains the associated buffer object buf through the file descriptor fd;

[0110] (3) The consumer device establishes a connection and memory mapping relationship with the cache object, thereby obtaining permission to access the memory address of the cache;

[0111] (4) After the memory mapping relationship is established, the consumer device can read the data cached in the cache area.

[0112] Specifically, the method comprises the following steps:

[0113] Step 402: The image processing device declares a directly accessed buffer area based on a processing request for a specified graphic, and initializes the buffer area.

[0114] Specifically, first create a buffer area of ​​N bytes, then initialize the requested buffer area to 0; and initialize the buffer area synchronization control module to an unoccupied state. The pseudo code is as follows:

[0115] B = Alloc_DA_Buffer (N); / / Create a direct access buffer of size N bytes

[0116] Set_Zero_Unlock(B); / / Initialize the requested direct memory access buffer to 0 and initialize the synchronization control module to an unoccupied state.

[0117] The specific algorithm is described as follows:

[0118] Algorithm input: buffer size N

[0119] Algorithm output: buffer pointer B, buffer ID

[0120] Note: The buffer size N indicates the size of the buffer in bytes; the buffer pointer B indicates the first address of the allocated buffer; the buffer identifier ID is used to identify the buffer and is also used to obtain the first address of the buffer through the buffer ID.

[0121] Step 404, set a synchronization control module in the cache area. Specifically, the synchronization control module is used to ensure the consistency of data in the cache area. When receiving a read or write access request, the synchronization control module checks the occupancy of the current cache area. If the current cache area is occupied by a read request or a write request, it waits for the previous operation to be completed until a notification of the operation completion is received and sets it to unoccupied. If the current cache area is not occupied or the access operation of the device is completed, the current cache area is set to occupied.

[0122] The specific algorithm is described as follows:

[0123] Algorithm input: read request or write request;

[0124] Algorithm output: None, this method is blocking.

[0125] Step 406: The graphics processing device writes the processed graphics data into a buffer area.

[0126] Specifically, the graphics processing device initiates a write request to the synchronization control module and waits for a request response; when receiving the request response, writes data to the first address B of the buffer area and stores the data size S; when the data is written, sends a write completion notification to the synchronization control module.

[0127] The specific algorithm is described as follows:

[0128] Algorithm input: buffer area first address B, write data size S;

[0129] Note: B is the starting address of the cache area; S indicates the size of the data to be written into the cache area.

[0130] Its pseudo code is: "Write_DA_Buffer(B,S); / / Write data of size S to the direct access buffer with the first address B".

[0131] Step 408: the display control device reads the graphic data from the buffer area.

[0132] Specifically, the display control device initiates a read request to the synchronization control module and waits for a request response; when the request response is received, the data in the read buffer area is displayed after being processed, and a data reading completion notification is sent to the synchronization control module.

[0133] The specific algorithm is described as follows:

[0134] Algorithm input: buffer area first address B;

[0135] Algorithm output: the first address of the buffer area B; the size of data that can be read from the buffer area S;

[0136] Note: B is the first address of the buffer area; S indicates the size of the data that can be read in the buffer area (the same as the size of the data written by the graphics processing device).

[0137] Its pseudo code is: "Read_DA_Buffer(B); / / Read data in the direct access buffer whose first address is B".

[0138] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0139] Based on the same inventive concept, the embodiment of the present application also provides a graphics data access processing device for implementing the graphics data access processing method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the one or more graphics data access processing device embodiments provided below can refer to the limitations of the graphics data access processing method above, and will not be repeated here.

[0140] In one embodiment, Figure 5 As shown, a device 500 for processing access to graphic data is provided, comprising: a data writing module 501, a buffer area determination module 502, a permission acquisition module 503 and a data access module 504, wherein:

[0141] The data writing module 501 is used to create a file descriptor corresponding to the buffer area when a display request for a specified graphic is obtained, pass the file descriptor to the application layer, and write the graphic data of the specified graphic into the buffer area.

[0142] The buffer area determination module 502 is used to obtain a file descriptor from the application layer and determine a buffer area associated with the file descriptor.

[0143] The permission acquisition module 503 is used to establish a connection and a memory mapping relationship with the cache area and obtain the permission to the memory address of the cache area.

[0144] The data access module 504 is used to directly access the graphic data of the specified graphic cached in the cache area according to the authority and display it.

[0145] When the above-mentioned graphics data access processing device obtains a display request for a specified graphic, the graphics processing device creates a file descriptor corresponding to the cache area, passes the file descriptor to the application layer, and writes the graphics data of the specified graphic into the cache area. The display control device obtains the file descriptor from the application layer, determines the cache area associated with the file descriptor, establishes a connection and memory mapping relationship with the cache area, obtains the permission for the memory address of the cache area, and can directly access and display the graphics data of the specified graphic cached in the cache area according to the permission. The entire access and display process does not require frequent memory copying, which releases a large amount of memory bandwidth and effectively improves the operating efficiency of the processor.

[0146] In one embodiment, the data writing module is also used to: declare a cache area for direct access based on a processing request for a specified graphic; mount the cache area function interface into the cache area; call a preset creation function to create a file descriptor corresponding to the cache area, associate the file descriptor with the cache area, and pass the file descriptor to the application layer; write the graphic data of the specified graphic into the cache area.

[0147] In one embodiment, the data writing module is further used to: if the buffer area is not occupied, obtain control authority over the buffer area and write the graphic data of the specified graphic into the buffer area.

[0148] In one embodiment, the graphic data access processing device also includes: a write pause module, which is used to pause the data writing step and wait if the cache area is occupied; when the waiting time reaches the preset waiting time, the data writing step is re-executed to write the graphic data of the specified graphic into the cache area.

[0149] In one embodiment, the data access module is further used to: if the cache area is not occupied, obtain control authority over the cache area, and directly access the data cached in the cache area according to the authority.

[0150] In one embodiment, the graphics data access processing device also includes: a pause access module, if the cache area is occupied, the data access step is paused and waiting is performed; when the waiting time reaches the preset waiting time, the data access step is re-executed to access the data cached in the cache area.

[0151] Each module in the above-mentioned graphic data access processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0152] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store graphic data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for accessing and processing graphic data is implemented.

[0153] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0154] In one embodiment, a computer device is provided, which may be a graphics processor in the method. The computer device includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program:

[0155] When a display request for a specified graphic is obtained, a file descriptor corresponding to the buffer area is created, the file descriptor is passed to the application layer, and the graphic data of the specified graphic is written into the buffer area;

[0156] Get the file descriptor from the application layer and determine the buffer associated with the file descriptor;

[0157] Establish a connection and memory mapping relationship with the cache area to obtain permission to the cache area memory address;

[0158] Directly access the graphic data of the specified graphic cached in the buffer area according to the permissions and display it.

[0159] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0160] Declare direct access to the buffer based on the processing request for the specified graphics;

[0161] Mount the cache area function interface to the cache area;

[0162] Call the preset creation function, create a file descriptor corresponding to the buffer area, associate the file descriptor with the buffer area, and pass the file descriptor to the application layer;

[0163] Write the graphics data of the specified graphic to the buffer.

[0164] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0165] If the buffer area is not occupied, the control authority for the buffer area is obtained, and the graphic data of the specified graphic is written into the buffer area.

[0166] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0167] If the buffer is occupied, the data writing step is paused and waiting is performed;

[0168] When the waiting time reaches the preset waiting time, the data writing step is executed again to write the graphic data of the specified graphic into the buffer area.

[0169] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0170] If the cache area is not occupied, the control permission for the cache area is obtained, and the cached data in the cache area is directly accessed according to the permission.

[0171] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0172] If the cache is occupied, the data access step is paused and waited;

[0173] When the waiting time reaches the preset waiting time, the data access step is re-executed to access the data cached in the cache area.

[0174] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0175] When a display request for a specified graphic is obtained, a file descriptor corresponding to the buffer area is created, the file descriptor is passed to the application layer, and the graphic data of the specified graphic is written into the buffer area;

[0176] Get the file descriptor from the application layer and determine the buffer associated with the file descriptor;

[0177] Establish a connection and memory mapping relationship with the cache area to obtain permission to the cache area memory address;

[0178] Directly access the graphic data of the specified graphic cached in the buffer area according to the permissions and display it.

[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0180] Declare direct access to the buffer based on the processing request for the specified graphics;

[0181] Mount the cache area function interface to the cache area;

[0182] Call the preset creation function, create a file descriptor corresponding to the buffer area, associate the file descriptor with the buffer area, and pass the file descriptor to the application layer;

[0183] Write the graphics data of the specified graphic to the buffer.

[0184] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0185] If the buffer area is not occupied, the control authority for the buffer area is obtained, and the graphic data of the specified graphic is written into the buffer area.

[0186] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0187] If the buffer is occupied, the data writing step is paused and waiting is performed;

[0188] When the waiting time reaches the preset waiting time, the data writing step is executed again to write the graphic data of the specified graphic into the buffer area.

[0189] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0190] If the cache area is not occupied, the control permission for the cache area is obtained, and the cached data in the cache area is directly accessed according to the permission.

[0191] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0192] If the cache is occupied, the data access step is paused and waited;

[0193] When the waiting time reaches the preset waiting time, the data access step is re-executed to access the data cached in the cache area.

[0194] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0195] When a display request for a specified graphic is obtained, a file descriptor corresponding to the buffer area is created, the file descriptor is passed to the application layer, and the graphic data of the specified graphic is written into the buffer area;

[0196] Get the file descriptor from the application layer and determine the buffer associated with the file descriptor;

[0197] Establish a connection and memory mapping relationship with the cache area to obtain permission to the cache area memory address;

[0198] Directly access the graphic data of the specified graphic cached in the buffer area according to the permissions and display it.

[0199] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0200] Declare direct access to the buffer based on the processing request for the specified graphics;

[0201] Mount the cache area function interface to the cache area;

[0202] Call the preset creation function, create a file descriptor corresponding to the buffer area, associate the file descriptor with the buffer area, and pass the file descriptor to the application layer;

[0203] Write the graphics data of the specified graphic to the buffer.

[0204] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0205] If the buffer area is not occupied, the control authority for the buffer area is obtained, and the graphic data of the specified graphic is written into the buffer area.

[0206] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0207] If the buffer is occupied, the data writing step is paused and waiting is performed;

[0208] When the waiting time reaches the preset waiting time, the data writing step is executed again to write the graphic data of the specified graphic into the buffer area.

[0209] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0210] If the cache area is not occupied, the control permission for the cache area is obtained, and the cached data in the cache area is directly accessed according to the permission.

[0211] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0212] If the cache is occupied, the data access step is paused and waited;

[0213] When the waiting time reaches the preset waiting time, the data access step is re-executed to access the data cached in the cache area.

[0214] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0215] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0216] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0217] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for accessing and processing graphic data, characterized in that: The method comprises: When a display request for a specified graphic is obtained, a cache area for direct access is declared based on a processing request for the specified graphic; Mounting the cache area function interface into the cache area; Calling a preset creation function to create a file descriptor corresponding to the buffer area, associating the file descriptor with the buffer area, and passing the file descriptor to the application layer; Writing the graphic data of the specified graphic into the buffer area; Obtain the file descriptor from the application layer, and determine a buffer associated with the file descriptor; Obtaining the physical starting address and length of the cache area, establishing a connection relationship with the cache area, and establishing a memory mapping relationship with the cache area, mapping the cache area in the kernel space to the user space, and obtaining the authority to the memory address of the cache area; the memory mapping relationship refers to the corresponding relationship between the user space where the display control device is located and the kernel space where the cache area is located; The graphic data of the designated graphic cached in the cache area is directly accessed and displayed according to the authority.

2. The method according to claim 1, characterized in that The step of writing the graphic data of the specified graphic into the buffer area comprises: If the buffer area is not occupied, the control authority for the buffer area is obtained, and the graphic data of the specified graphic is written into the buffer area.

3. The method according to claim 2, characterized in that The method further comprises: If the buffer area is occupied, suspend the data writing step and wait; When the waiting time reaches the preset waiting time, the data writing step is executed again to write the graphic data of the designated graphic into the buffer area.

4. The method according to claim 1, characterized in that: The directly accessing the graphic data of the designated graphic cached in the buffer area according to the permission includes: If the cache area is not occupied, then the control authority for the cache area is obtained, and the data cached in the cache area is directly accessed according to the authority.

5. The method according to claim 4, characterized in that The method further comprises: If the buffer area is occupied, suspend the data access step and wait; When the waiting time reaches the preset waiting time, the data access step is executed again to access the data cached in the cache area.

6. A graphics data access processing device, characterized in that: The device comprises: A data writing module is used to, when a display request for a specified graphic is obtained, declare a directly accessed buffer area based on a processing request for the specified graphic; mount a buffer area function interface into the buffer area; call a preset creation function to create a file descriptor corresponding to the buffer area, associate the file descriptor with the buffer area, and pass the file descriptor to the application layer; write the graphic data of the specified graphic into the buffer area; A buffer area determination module, used to obtain the file descriptor from the application layer and determine the buffer area associated with the file descriptor; a permission acquisition module, used to acquire the physical starting address and length of the cache area, establish a connection relationship with the cache area, and establish a memory mapping relationship with the cache area, map the cache area in the kernel space to the user space, and acquire the permission for the memory address of the cache area; the memory mapping relationship refers to the corresponding relationship between the user space where the display control device is located and the kernel space where the cache area is located; A data access module is used to directly access the graphic data of the specified graphic cached in the cache area according to the authority and display it.

7. The device according to claim 6, characterized in that The data writing module is also used for: If the buffer area is not occupied, the control authority for the buffer area is obtained, and the graphic data of the specified graphic is written into the buffer area.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Method and device for reducing memory copy in reading and writing process

    CN106775462A

  • Method and device for reading and writing serial data, computer device, and storage medium

    CN108470008A