CN110134370B - Graph drawing method and device, electronic equipment and storage medium - Google Patents

Graph drawing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110134370B
CN110134370B CN201810129527.2A CN201810129527A CN110134370B CN 110134370 B CN110134370 B CN 110134370B CN 201810129527 A CN201810129527 A CN 201810129527A CN 110134370 B CN110134370 B CN 110134370B
Authority
CN
China
Prior art keywords
buffer area
cpu
graphics
screen
shared
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810129527.2A
Other languages
Chinese (zh)
Other versions
CN110134370A (en
Inventor
王洪虎
高翔
朱琛
曹惠雄
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN201810129527.2A priority Critical patent/CN110134370B/en
Publication of CN110134370A publication Critical patent/CN110134370A/en
Application granted granted Critical
Publication of CN110134370B publication Critical patent/CN110134370B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The embodiment of the invention provides a method and a device for drawing a graph, which are applied to electronic equipment, wherein the electronic equipment comprises a screen buffer zone for displaying the graph on a screen and a shared buffer zone which can be accessed by a display card and a CPU (central processing unit), and the method comprises the following steps: the CPU performs graph drawing in the shared buffer area; the CPU copies the drawn graph from the shared buffer area and submits the drawn graph to the screen buffer area; and the graphics in the screen buffer area are read by the display card, and are displayed on the screen of the electronic equipment. The embodiment of the invention can reduce the graphic copying process, thereby reducing the problem of extra performance overhead caused by copying and achieving the effect of improving the graphic drawing performance.

Description

Graph drawing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method for drawing a graphic, an apparatus for drawing a graphic, an electronic device, and a storage medium.
Background
Qt is a cross-platform c++ graphical user interface application development framework. It can be used to develop both GUI (Graphical User Interface ) programs and non-GUI programs, such as console tools and servers. Qt is an object-oriented framework that uses special code to generate extensions (called meta-object compilers (MOC, meta Object Compiler)) and some macros, which are easy to extend, allow component programming, etc.
The drawing process of Qt is: firstly, qt allocates a buffer area in a system memory, then a CPU draws a graph in the buffer area, then the CPU copies the graph to a video memory (a video card buffer area), finally the video card submits the graph in the video memory to a screen buffer area, and a display controller displays the graph on a screen. From the above, it is known that there are processes of copying data to a memory and extracting data from the memory in the process of drawing completion to display to a screen, which adds additional overhead.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention have been made to provide a method of graphics rendering, a corresponding apparatus of graphics rendering, an electronic device, and a storage medium that overcome or at least partially solve the foregoing problems.
In order to solve the above problems, an embodiment of the present invention discloses a method for drawing graphics, which is applied to an electronic device, where the electronic device includes a screen buffer for displaying graphics on a screen, and a shared buffer accessible by both a graphics card and a CPU, and the method includes:
the CPU performs graph drawing in the shared buffer area;
the CPU copies the drawn graph from the shared buffer area and submits the drawn graph to the screen buffer area;
and the graphics in the screen buffer area are read by the display card, and are displayed on the screen of the electronic equipment.
Optionally, the electronic device has a memory, and before the step of performing graphics drawing in the CPU shared buffer, the method further includes:
the CPU calls a shared video memory allocation function provided by the video card;
the CPU adopts the shared video memory allocation function to allocate a shared buffer area in the memory;
and the CPU acquires a buffer area address corresponding to the shared buffer area and submits the buffer area address to the display card.
Optionally, the step of performing graphics drawing by the CPU in the shared buffer area includes:
the CPU reads the buffer address;
and the CPU performs graphic drawing in the shared buffer area corresponding to the buffer area address.
Optionally, the step of copying the drawn graphic from the shared buffer by the CPU and sending to the screen buffer includes:
the CPU controls the display card to read the drawn graph in the shared buffer area;
and the CPU controls the graphics card to send the drawn graph to the screen buffer zone.
The embodiment of the invention also discloses a graph drawing device which is applied to electronic equipment, wherein the electronic equipment comprises a screen buffer zone for displaying graphs on a screen and a shared buffer zone which can be accessed by a display card and a CPU, and the device comprises:
the graphic drawing module is used for carrying out graphic drawing on the CPU in the shared buffer area;
the graphic copying module is used for copying the drawn graphic from the shared buffer area by the CPU and submitting the drawn graphic to the screen buffer area;
and the graphic display module is used for reading the graphics in the screen buffer area by the display card and displaying the graphics on the screen of the electronic equipment.
Optionally, the electronic device has a memory, and the method further includes:
the function calling module is used for calling the shared video memory allocation function provided by the video card by the CPU;
the shared buffer area allocation module is used for allocating a shared buffer area in the memory by the CPU by adopting the shared video memory allocation function;
and the buffer address submitting module is used for acquiring the buffer address corresponding to the shared buffer area by the CPU and submitting the buffer address to the display card.
Optionally, the graphics rendering module includes:
the buffer address reading submodule is used for reading the buffer address by the CPU;
and the graphic drawing submodule is used for carrying out graphic drawing on the buffer area address corresponding to the shared buffer area by the CPU.
Optionally, the graphic transmitting and displaying module includes:
the graphics reading sub-module is used for controlling the display card to read the drawn graphics in the shared buffer area by the CPU;
and the graphics transmitting sub-module is used for controlling the display card to transmit the drawn graphics to the screen buffer area by the CPU.
The embodiment of the invention also discloses electronic equipment, which comprises a screen buffer area for displaying graphics on a screen and a shared buffer area which can be accessed by the display card and the CPU; the electronic device also includes a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for:
the CPU performs graph drawing in the shared buffer area;
the CPU copies the drawn graph from the shared buffer area and sends the drawn graph to the screen buffer area;
and the graphics in the screen buffer area are read by the display card, and are displayed on a screen of the electronic equipment.
The embodiment of the invention also discloses a readable storage medium, which enables the electronic device to execute one or more of the graphic drawing methods when the instructions in the storage medium are executed by the processor of the electronic device.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the shared buffer area which can be accessed by the display card and the CPU is arranged in the electronic equipment, when graphic drawing is carried out, the CPU carries out graphic drawing in the shared buffer area, and then the CPU directly copies drawn graphics from the shared buffer area and submits the drawn graphics to the screen buffer area of the electronic equipment, so that when graphic display is required on a screen, the display card can read the graphics in the screen buffer area to display the graphics on the screen.
Drawings
FIG. 1 is a flow chart of the steps of method embodiment 1 of a graphics rendering of the present invention;
FIG. 2 is a flow chart of the steps of method embodiment 2 of a graphics rendering of the present invention;
FIG. 3 is a schematic diagram of a current Qt graph rendering process;
FIG. 4 is a schematic diagram of a Qt graph rendering process of the present invention;
FIG. 5 is a block diagram of an embodiment of a graphically depicted apparatus of the present invention;
fig. 6 is a block diagram illustrating a configuration of an electronic device for graphics rendering, according to an example embodiment.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
In practical applications, the core of the graphics card is a GPU (Graphics Processing Unit, graphics processor), which is also called a display core, a vision processor, and a display chip, and is a microprocessor that is specially used for image operation on electronic devices such as a personal computer, a workstation, a game machine, and a mobile device (such as a tablet computer and a smart phone).
A Memory (Memory) is a core component in a computer system, and is also called an internal Memory, and is used to temporarily store operation data in a CPU (Central Processing Unit ) and data exchanged with an external Memory such as a hard disk. As long as the computer is in operation, the CPU will call the data to be operated to the memory for operation, and after the operation is completed, the CPU will transmit the operation result to the memory.
There are two types of buffers used by graphics cards: one is a buffer shared with the CPU whose physical location is system memory, a computer term called GTT (graphics translation table ). The other is a storage area which is exclusively shared by the GPU, the physical location of which is an independent storage granule on the graphics card, and the computing term VRAM (Video RAM, image random access memory). The characteristics of GTT and VRAM are: the GTT is an area which can be accessed by both the CPU and the GPU, the CPU access speed is higher, and the GPU access speed is slower; the VRAM is mainly a storage area used by the GPU, the CPU access speed is slower, and the GPU access speed is faster.
The process of drawing the graph by combining the Qt recorded in the background technology can be known that after the graph is drawn, the CPU copies the graph to the buffer area of the display card, and finally the display card copies the graph to the screen buffer area from the buffer area of the display card, and finally the graph is displayed on the screen. In the above-described graphics drawing process, there is a graphics copying process, which adds additional overhead. One of the core ideas of the embodiment of the invention is that the graphic copying process is reduced by setting the shared buffer area which can be accessed by the display card and the CPU, thereby reducing the problem of extra performance expenditure caused by copying and achieving the effect of improving the graphic drawing performance.
Referring to fig. 1, a flowchart illustrating steps of an embodiment 1 of a method for drawing graphics according to the present invention may be applied to an electronic device, where the electronic device includes a screen buffer for displaying graphics on a screen, and a shared buffer that is accessible by both a graphics card and a CPU, and the method may specifically include the steps of:
step 101, the CPU performs graphics drawing in the shared buffer.
In the embodiment of the invention, a shared buffer area which can be accessed by both the display card and the CPU is arranged. In particular, in the invention, the graphics card can copy the graphics drawn in the shared buffer area, and the CPU can also process data in the shared buffer area. Specifically, when drawing a graphic, the CPU will complete drawing the graphic in the shared buffer.
In step 102, the CPU copies the drawn graphics from the shared buffer and submits the graphics to the screen buffer.
Because the shared buffer area of the embodiment of the invention is accessible to both the display card and the CPU, after the graphics are drawn by the shared buffer area, the display card can directly copy the drawn graphics from the shared buffer area and submit the drawn graphics to the screen buffer area for displaying the graphics on the screen.
And 103, the graphics card reads the graphics in the screen buffer area and displays the graphics on the screen of the electronic equipment.
When graphics need to be displayed on the screen of the electronic device, the graphics in the screen buffer may be accessed and read by the graphics card for display to the screen.
In the embodiment of the invention, the shared buffer area which can be accessed by the display card and the CPU is arranged in the electronic equipment, when graphic drawing is required, the CPU performs graphic drawing in the shared buffer area, and then the CPU directly copies drawn graphics from the shared buffer area and submits the drawn graphics to the screen buffer area of the electronic equipment, so that when graphic display is required on the screen, the display card can read the graphics in the screen buffer area to display the graphics on the screen.
Referring to fig. 2, a flowchart of steps of an embodiment 2 of a method for drawing graphics of the present invention is shown, and the method is applied to an electronic device, where the electronic device includes a screen buffer for displaying graphics on a screen, and a shared buffer that is accessible by both a graphics card and a CPU, where the CPU has a memory, and the method specifically includes the following steps:
step 201, the CPU calls a shared video memory allocation function provided by the video card.
In the embodiment of the invention, the CPU can be used for distributing the shared buffer area which is required by drawing the graph and can be accessed by the display card and the CPU through the self-defined shared video memory distribution function provided by the driver of the display card.
Step 202, the CPU allocates a shared buffer in the memory using the shared memory allocation function.
When drawing the graph, the CPU calls the shared video memory allocation function provided by the driver of the video card, and allocates the buffer area based on the function. It should be noted that, the characteristics of the buffer area allocated by the shared video memory allocation function are: the memory location is also in CPU memory so the graphics card hardware can access the buffer in addition to the performance of the graphics rendering process being unaffected. Therefore, the buffer allocated by the shared memory allocation function is also referred to as a shared buffer in the embodiment of the present invention.
In step 203, the CPU obtains a buffer address corresponding to the shared buffer, and submits the buffer address to the graphics card.
In practice, the shared buffer has a corresponding buffer address in the memory, and in order to enable the display card to access the shared buffer, the shared buffer is submitted to the display card for storage.
In step 205, the CPU performs graphics rendering in the shared buffer.
In drawing graphics, the CPU may perform conventional graphics drawing in the allocated shared buffer. Specifically, the step of performing graphics drawing in the CPU shared buffer may include: the CPU reads the buffer address; and the CPU performs graphic drawing in the shared buffer area corresponding to the buffer area address.
In a specific implementation, the graphic drawing is completed through a CPU graphic engine, and when the CPU graphic engine performs the graphic drawing, the CPU graphic engine only needs to perform the graphic drawing according to the buffer area address to the corresponding shared buffer area.
In step 206, the CPU copies the drawn graphics from the shared buffer and submits it to the screen buffer.
In a preferred embodiment of the present invention, the step of copying the drawn graphic from the shared buffer and submitting to the screen buffer may include: the CPU controls the display card to read the drawn graph in the shared buffer area; and the CPU controls the graphics card to send the drawn graph to the screen buffer zone.
After the CPU graphic engine draws the graphic in the shared buffer area, the graphic card or software can be controlled to copy the drawn graphic out of the shared buffer area and submit the graphic to the screen buffer area.
And step 207, the graphics card reads the graphics in the screen buffer area and displays the graphics on the screen of the electronic equipment.
After the CPU submits the graphics data to the screen buffer, it may be displayed by the display controller on the screen of the electronic device.
In the embodiment of the invention, the CPU calls the self-defined shared video memory allocation function to allocate the shared buffer area which can be accessed by the video card and the CPU, so that when the CPU performs graphic drawing, the graphic can be drawn in the shared buffer area, and after drawing is completed, the video card is controlled to directly extract the drawn graphic from the shared buffer area and submit the drawn graphic to the screen buffer area, so that the video card can read and display the screen graphic. By applying the embodiment of the invention, the graphic copying process can be reduced, and the processing performance can be improved.
In order to enable those skilled in the art to better understand the advantages of the embodiments of the present invention, qt is taken as an example, and the description is made in connection with the current process of implementing Qt graphic rendering and implementing Qt graphic rendering by the present invention.
Referring to a schematic diagram of a current Qt graphic drawing process shown in fig. 3, in the current graphic drawing process, firstly Qt allocates a buffer area in a system memory through a memory allocation function (malloc), then Qt performs graphic drawing in the allocated system memory, after the graphic drawing is completed, a CPU copies the graphic drawn by Qt to a video memory accessible by a video card, and finally the video card carries the graphic to a screen buffer area for screen display to display on a screen.
After the Qt finishes the graphic drawing, a graphic copying process of the CPU exists, and because the graphics card can only access the video memory area in the working process as determined by the characteristics of the graphics card described in the background technology, the data graphics card in the system memory can not be directly accessed, so that a one-step data copying process is added, the data is copied from the system memory to the video memory, and the hardware of the graphics card can only be accessed.
Referring to fig. 2, a schematic diagram of a Qt graphic drawing process of the present invention includes the following specific implementation steps:
1. the CPU allocates a buffer area (which may also be referred to as a shared memory) required for Qt through a shared memory allocation function provided by a driver of the graphic card. The buffer area is characterized in that: the storage location is still in memory, so the performance of the Qt rendering process is not affected, while the graphics card hardware is also able to access the buffer, so no additional data copying process is required.
2. Qt performs normal graphics rendering in the allocated shared memory, which is done by the CPU. All that is required for the CPU to draw is based on a buffer, only one buffer address is needed, whether the buffer is system memory or shared memory is transparent to the Qt rendering engine. That is, the graphic drawing of the present invention is unchanged, only the drawing position is different.
3. After the CPU finishes drawing, the graphics card hardware directly copies the graphics from the shared video memory into a screen buffer area to be displayed on a screen.
According to the present graphic drawing process and the optimized graphic drawing process, the present invention can omit an additional graphic data copying process, namely, the step of copying the graphic into the video memory accessible by the video card by the CPU, so that the Qt graphic drawing efficiency is improved.
As can be seen from the above examples of the present invention, the graphics rendering optimization method based on Qt provided by the present invention includes: and the Qt is distributed to a memory buffer area for graphic drawing, and is distributed to a memory shared by the CPU and the GPU of the display card through the display card driving function interface, so that the Qt drawing process is finished in the memory, and the drawing performance is not affected.
The process of updating the graphics to the screen after the graphics are drawn can be directly completed by the display card, so that the step of copying the graphics to a buffer area of the display card by a CPU (Central processing Unit) is omitted, and the overall Qt drawing performance is provided. The invention solves the problem of extra performance overhead caused by memory graph copying in the current Qt graph drawing process, and achieves the effect of improving the Qt graph drawing performance.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 5, there is shown a block diagram of an embodiment of an apparatus for graphics rendering, applied to an electronic device, where the electronic device includes a screen buffer for displaying graphics on a screen, and a shared buffer that is accessible by both a graphics card and a CPU, and the apparatus may specifically include the following modules:
a graphics drawing module 301, configured to draw graphics in the shared buffer by the CPU;
in a preferred embodiment of the present invention, the graphic rendering module 301 may include:
the buffer address reading submodule is used for reading the buffer address by the CPU;
and the graphic drawing submodule is used for carrying out graphic drawing on the buffer area address corresponding to the shared buffer area by the CPU.
A graphic copying module 302, configured to copy the drawn graphic from the shared buffer area by the CPU, and submit the drawn graphic to the screen buffer area;
in a preferred embodiment of the present invention, the graphic copy module 302 may include:
the graphics reading sub-module is used for controlling the display card to read the drawn graphics in the shared buffer area by the CPU;
and the graphics transmitting sub-module is used for controlling the display card to transmit the drawn graphics to the screen buffer area by the CPU.
And the graphics sending and displaying module 303 is configured to read the graphics in the screen buffer by using the graphics card, and display the graphics on the screen of the electronic device.
In a preferred embodiment of the present invention, the apparatus may further comprise:
the function calling module is used for calling the shared video memory allocation function provided by the video card by the CPU;
the shared buffer area allocation module is used for allocating a shared buffer area in the memory by the CPU by adopting the shared video memory allocation function;
and the buffer address submitting module is used for acquiring the buffer address corresponding to the shared buffer area by the CPU and submitting the buffer address to the display card.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Fig. 6 is a block diagram illustrating a configuration of an electronic device 500 for graphics rendering, according to an example embodiment. For example, electronic device 500 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 6, an electronic device 500 may include one or more of the following components: a processing component 502, a memory 504, a power supply component 506, a multimedia component 508, an audio component 510, an input/output (I/O) interface 512, a sensor component 514, and a communication component 516.
The processing component 502 generally controls overall operation of the electronic device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 502 can include one or more modules that facilitate interactions between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
Memory 504 is configured to store various types of data to support operations at device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power component 506 provides power to the various components of the electronic device 500. The power components 506 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 500.
The multimedia component 508 includes a screen between the electronic device 500 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front-facing camera and/or a rear-facing camera. When the electronic device 500 is in an operational mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 510 is configured to output and/or input audio signals. For example, the audio component 510 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 500 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 504 or transmitted via the communication component 516. In some embodiments, the audio component 510 further comprises a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 514 includes one or more sensors for providing status assessment of various aspects of the electronic device 500. For example, the sensor assembly 514 may detect the on/off state of the device 500, the relative positioning of components, such as a display and keypad of the electronic device 500, the sensor assembly 514 may also detect a change in position of the electronic device 500 or a component of the electronic device 500, the presence or absence of a user's contact with the electronic device 500, the orientation or acceleration/deceleration of the electronic device 500, and a change in temperature of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate communication between the electronic device 500 and other devices, either wired or wireless. The electronic device 500 may access a wireless network based on a communication standard, such as WiFi,2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication part 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 504, including instructions executable by processor 520 of electronic device 500 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of a terminal, causes the terminal to perform a method of graphics rendering, for an electronic device including a screen buffer for screen displaying graphics, and a shared buffer accessible to both a graphics card and a CPU, the method comprising:
the CPU performs graph drawing in the shared buffer area;
the CPU copies the drawn graph from the shared buffer area and submits the drawn graph to the screen buffer area;
and the graphics in the screen buffer area are read by the display card, and are displayed on the screen of the electronic equipment.
Optionally, the electronic device has a memory, and before the step of performing graphics drawing in the CPU shared buffer, the method further includes:
the CPU calls a shared video memory allocation function provided by the video card;
the CPU adopts the shared video memory allocation function to allocate a shared buffer area in the memory;
and the CPU acquires a buffer area address corresponding to the shared buffer area and submits the buffer area address to the display card.
Optionally, the step of performing graphics drawing by the CPU in the shared buffer area includes:
the CPU reads the buffer address;
and the CPU performs graphic drawing in the shared buffer area corresponding to the buffer area address.
Optionally, the step of copying the drawn graphic from the shared buffer by the CPU and sending to the screen buffer includes:
the CPU controls the display card to read the drawn graph in the shared buffer area;
and the CPU controls the graphics card to send the drawn graph to the screen buffer zone.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, electronic devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing electronic device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing electronic device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or electronic device that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or electronic device. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or electronic device that comprises the element.
The foregoing has described in detail a method of graphics rendering, a device of graphics rendering, an electronic device and a storage medium, and specific examples have been used herein to illustrate the principles and embodiments of the present invention, and the above examples are only for aiding in the understanding of the method of the present invention and its core ideas; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (8)

1. The method for drawing the graph is characterized by being applied to electronic equipment, wherein the electronic equipment is provided with a memory, the electronic equipment is used for carrying a graph drawing frame Qt, the electronic equipment comprises a screen buffer area for displaying the graph on a screen, and a shared buffer area which is accessed by a display card and a CPU, and the method comprises the following steps:
the CPU calls a shared video memory allocation function provided by the video card;
the CPU adopts the shared video memory allocation function to allocate a shared buffer area in the memory;
the CPU acquires a buffer area address corresponding to the shared buffer area and submits the buffer area address to the display card;
the Qt draws graphics in the shared buffer area through the CPU;
the CPU copies the drawn graph from the shared buffer area and submits the drawn graph to the screen buffer area;
the graphics in the screen buffer area are read by the display card, and the graphics are displayed on the screen of the electronic equipment;
the step of the CPU copying the drawn graph from the shared buffer area and submitting the drawn graph to the screen buffer area comprises the following steps:
and the CPU controls the graphics card to send the drawn graph to the screen buffer zone.
2. The method of claim 1, wherein the step of the CPU performing graphics rendering in the shared buffer comprises:
the CPU reads the buffer address;
and the CPU performs graphic drawing in the shared buffer area corresponding to the buffer area address.
3. The method of claim 2, wherein the step of the CPU copying the drawn graphic from the shared buffer and submitting it to the screen buffer comprises:
and the CPU controls the display card to read the drawn graph in the shared buffer area.
4. The utility model provides a device is drawn to figure, its characterized in that is applied to electronic equipment, electronic equipment has the memory, electronic equipment is used for carrying on figure drawing frame Qt, electronic equipment includes the screen buffer that is used for the screen to show the figure to and the sharing buffer that display card and CPU both can visit, the device includes:
the graphics drawing module is used for drawing graphics in the shared buffer area by the Qt through the CPU;
the graphic copying module is used for copying the drawn graphic from the shared buffer area by the CPU and submitting the drawn graphic to the screen buffer area;
the graphic display module is used for reading the graphics in the screen buffer area by the display card and displaying the graphics on a screen of the electronic equipment;
the function calling module is used for calling the shared video memory allocation function provided by the video card by the CPU;
the shared buffer area allocation module is used for allocating a shared buffer area in the memory by the CPU by adopting the shared video memory allocation function;
the buffer area address submitting module is used for acquiring a buffer area address corresponding to the shared buffer area by the CPU and submitting the buffer area address to the display card;
and the graphics transmitting sub-module is used for controlling the display card to transmit the drawn graphics to the screen buffer area by the CPU.
5. The apparatus of claim 4, wherein the graphics rendering module comprises:
the buffer address reading submodule is used for reading the buffer address by the CPU;
and the graphic drawing submodule is used for carrying out graphic drawing on the buffer area address corresponding to the shared buffer area by the CPU.
6. The apparatus of claim 5, wherein the graphics rendering module comprises:
and the graphics reading sub-module is used for controlling the display card to read the drawn graphics in the shared buffer area by the CPU.
7. An electronic device, characterized in that the electronic device comprises a screen buffer area for displaying graphics on a screen, and a shared buffer area which is accessed by a display card and a CPU; the electronic device has a memory, the electronic device is used for carrying a graphics rendering framework Qt, the electronic device further comprises a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for:
the CPU calls a shared video memory allocation function provided by the video card;
the CPU adopts the shared video memory allocation function to allocate a shared buffer area in the memory;
the CPU acquires a buffer area address corresponding to the shared buffer area and submits the buffer area address to the display card;
the Qt draws graphics in the shared buffer area through the CPU;
the CPU copies the drawn graph from the shared buffer area and sends the drawn graph to the screen buffer area;
the graphics in the screen buffer area are read by the display card, and the graphics are displayed on the screen of the electronic equipment;
the step of the CPU copying the drawn graph from the shared buffer area and submitting the drawn graph to the screen buffer area comprises the following steps:
and the CPU controls the graphics card to send the drawn graph to the screen buffer zone.
8. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the graphics rendering method according to one or more of the method claims 1-3.
CN201810129527.2A 2018-02-08 2018-02-08 Graph drawing method and device, electronic equipment and storage medium Active CN110134370B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810129527.2A CN110134370B (en) 2018-02-08 2018-02-08 Graph drawing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810129527.2A CN110134370B (en) 2018-02-08 2018-02-08 Graph drawing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110134370A CN110134370A (en) 2019-08-16
CN110134370B true CN110134370B (en) 2023-09-12

Family

ID=67567760

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810129527.2A Active CN110134370B (en) 2018-02-08 2018-02-08 Graph drawing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110134370B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051154A (en) * 2021-03-02 2021-06-29 长沙景嘉微电子股份有限公司 Method and corresponding device for verifying correctness of drawing function of display card

Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4823108A (en) * 1984-05-02 1989-04-18 Quarterdeck Office Systems Display system and memory architecture and method for displaying images in windows on a video display
CA2439633A1 (en) * 2002-09-04 2004-03-04 Sony Corporation Screen display processing apparatus, screen display processing method and computer program
CN1666182A (en) * 2002-05-08 2005-09-07 英特尔公司 Method and system for optimally sharing memory between a host processor and graphic processor
GB0815442D0 (en) * 2008-08-22 2008-10-01 Advanced Risc Mach Ltd Apparatus and method for communicating between a central processing unit and a graphics processing unit
CN101526934A (en) * 2009-04-21 2009-09-09 浪潮电子信息产业股份有限公司 Construction method of GPU and CPU combined processor
CN101794237A (en) * 2009-02-02 2010-08-04 联想(北京)有限公司 Computer and method for realizing universal display
CN101882077A (en) * 2010-05-19 2010-11-10 广东威创视讯科技股份有限公司 Method and device for efficiently drawing and rendering basic graphic
CN102033705A (en) * 2010-12-10 2011-04-27 福州瑞芯微电子有限公司 Special effect display and control system of roller
US7950003B1 (en) * 2006-12-07 2011-05-24 Sony Computer Entertainment Inc. Heads-up-display software development tool for analyzing and optimizing computer software
CN103439743A (en) * 2013-08-30 2013-12-11 电子科技大学 Method for drawing seismic data profile graph
WO2014166404A1 (en) * 2013-04-10 2014-10-16 华为技术有限公司 Network data packet processing method and device
CN104331297A (en) * 2014-11-28 2015-02-04 广东威创视讯科技股份有限公司 Drawing method and drawing device for render engine
US9053559B1 (en) * 2007-11-16 2015-06-09 Nvidia Corporation Method and system for presenting image data to a video output device
CN105302580A (en) * 2015-11-28 2016-02-03 武汉斗鱼网络科技有限公司 Method and system for rapidly acquiring game graphics through GPU (Graphics Processing Unit) texture sharing
CN105427236A (en) * 2015-12-18 2016-03-23 魅族科技(中国)有限公司 Method and device for image rendering
WO2016073137A1 (en) * 2014-11-07 2016-05-12 Qualcomm Incorporated Systems and methods for performing display mirroring
CN106062662A (en) * 2014-03-02 2016-10-26 高通股份有限公司 System and method for providing power-saving static image display refresh in a DRAM memory system
WO2017049583A1 (en) * 2015-09-25 2017-03-30 Intel Corporation Gpu-cpu two-path memory copy
CN106683035A (en) * 2015-11-09 2017-05-17 龙芯中科技术有限公司 GPU acceleration method and GPU acceleration device
CN107102897A (en) * 2016-02-23 2017-08-29 深圳市知穹科技有限公司 A kind of database active defense method of many GPU parallel processings
CN107133907A (en) * 2016-02-26 2017-09-05 龙芯中科技术有限公司 Pattern drawing method and device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050012751A1 (en) * 2003-07-18 2005-01-20 Karlov Donald David Systems and methods for efficiently updating complex graphics in a computer system by by-passing the graphical processing unit and rendering graphics in main memory
US20050012753A1 (en) * 2003-07-18 2005-01-20 Microsoft Corporation Systems and methods for compositing graphics overlays without altering the primary display image and presenting them to the display on-demand
US7145566B2 (en) * 2003-07-18 2006-12-05 Microsoft Corporation Systems and methods for updating a frame buffer based on arbitrary graphics calls
US20070052715A1 (en) * 2005-09-07 2007-03-08 Konstantin Levit-Gurevich Device, system and method of graphics processing
US8760452B2 (en) * 2010-07-01 2014-06-24 Advanced Micro Devices, Inc. Integrated graphics processor data copy elimination method and apparatus when using system memory
US9378572B2 (en) * 2012-08-17 2016-06-28 Intel Corporation Shared virtual memory
US9646570B2 (en) * 2014-06-04 2017-05-09 Intel Corporation Mechanism for facilitating improved copying of graphics data on computing devices
US9569811B2 (en) * 2014-06-26 2017-02-14 Qualcomm Incorporated Rendering graphics to overlapping bins

Patent Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4823108A (en) * 1984-05-02 1989-04-18 Quarterdeck Office Systems Display system and memory architecture and method for displaying images in windows on a video display
CN1666182A (en) * 2002-05-08 2005-09-07 英特尔公司 Method and system for optimally sharing memory between a host processor and graphic processor
CA2439633A1 (en) * 2002-09-04 2004-03-04 Sony Corporation Screen display processing apparatus, screen display processing method and computer program
US7950003B1 (en) * 2006-12-07 2011-05-24 Sony Computer Entertainment Inc. Heads-up-display software development tool for analyzing and optimizing computer software
US9053559B1 (en) * 2007-11-16 2015-06-09 Nvidia Corporation Method and system for presenting image data to a video output device
GB0815442D0 (en) * 2008-08-22 2008-10-01 Advanced Risc Mach Ltd Apparatus and method for communicating between a central processing unit and a graphics processing unit
CN101794237A (en) * 2009-02-02 2010-08-04 联想(北京)有限公司 Computer and method for realizing universal display
CN101526934A (en) * 2009-04-21 2009-09-09 浪潮电子信息产业股份有限公司 Construction method of GPU and CPU combined processor
CN101882077A (en) * 2010-05-19 2010-11-10 广东威创视讯科技股份有限公司 Method and device for efficiently drawing and rendering basic graphic
CN102033705A (en) * 2010-12-10 2011-04-27 福州瑞芯微电子有限公司 Special effect display and control system of roller
WO2014166404A1 (en) * 2013-04-10 2014-10-16 华为技术有限公司 Network data packet processing method and device
CN103439743A (en) * 2013-08-30 2013-12-11 电子科技大学 Method for drawing seismic data profile graph
CN106062662A (en) * 2014-03-02 2016-10-26 高通股份有限公司 System and method for providing power-saving static image display refresh in a DRAM memory system
WO2016073137A1 (en) * 2014-11-07 2016-05-12 Qualcomm Incorporated Systems and methods for performing display mirroring
CN104331297A (en) * 2014-11-28 2015-02-04 广东威创视讯科技股份有限公司 Drawing method and drawing device for render engine
WO2017049583A1 (en) * 2015-09-25 2017-03-30 Intel Corporation Gpu-cpu two-path memory copy
CN106683035A (en) * 2015-11-09 2017-05-17 龙芯中科技术有限公司 GPU acceleration method and GPU acceleration device
CN105302580A (en) * 2015-11-28 2016-02-03 武汉斗鱼网络科技有限公司 Method and system for rapidly acquiring game graphics through GPU (Graphics Processing Unit) texture sharing
CN105427236A (en) * 2015-12-18 2016-03-23 魅族科技(中国)有限公司 Method and device for image rendering
CN107102897A (en) * 2016-02-23 2017-08-29 深圳市知穹科技有限公司 A kind of database active defense method of many GPU parallel processings
CN107133907A (en) * 2016-02-26 2017-09-05 龙芯中科技术有限公司 Pattern drawing method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
支超有.从绘图仪硬拷贝屏幕图形的方法.微型机与应用.1994,(第10期),全文. *

Also Published As

Publication number Publication date
CN110134370A (en) 2019-08-16

Similar Documents

Publication Publication Date Title
EP3454192A1 (en) Method and device for displaying page
WO2021032097A1 (en) Air gesture interaction method and electronic device
CN111147660B (en) Control operation method and electronic equipment
CN111610912B (en) Application display method, application display device and storage medium
CN112905089B (en) Equipment control method and device
EP2892047A2 (en) Image data output control method and electronic device supporting the same
EP3236355A1 (en) Method and apparatus for managing task of instant messaging application
JP6412651B2 (en) Task display method, apparatus, program, and recording medium
CN110134370B (en) Graph drawing method and device, electronic equipment and storage medium
CN111046265B (en) Card data display method, device, equipment and storage medium
CN112035691A (en) Method, device, equipment and medium for displaying cell labeling data of slice image
CN110865864A (en) Interface display method, device and equipment for fast application and storage medium
CN106354657B (en) Register access method, device and system
CN107368562B (en) Page display method and device and terminal
EP3185515B1 (en) Method and device for inputting information
CN105630486B (en) Typesetting method and device for desktop of intelligent terminal equipment
CN112306702B (en) Data sharing method and device, electronic equipment and storage medium
CN115687270A (en) Data storage sorting method and device, electronic equipment and storage medium
EP3425511B1 (en) Method and apparatus for monitoring virtual document object model
CN112068761B (en) Touch screen data processing method, touch screen data processing device and storage medium
CN107423060B (en) Animation effect presenting method and device and terminal
CN114116590B (en) Data acquisition method, device, vehicle, storage medium and electronic equipment
CN117575882A (en) Method and device for updating vertex buffer area and storage medium
CN117453111B (en) Touch response method and device, electronic equipment and storage medium
CN113778431A (en) Dynamic small program rendering method, device and equipment, readable storage medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing

Applicant after: Loongson Zhongke Technology Co.,Ltd.

Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing

Applicant before: LOONGSON TECHNOLOGY Corp.,Ltd.

GR01 Patent grant
GR01 Patent grant