CN116362954A - Graphic drawing method and device in real-time system, electronic equipment and storage medium - Google Patents

Graphic drawing method and device in real-time system, electronic equipment and storage medium Download PDF

Info

Publication number
CN116362954A
CN116362954A CN202310324047.2A CN202310324047A CN116362954A CN 116362954 A CN116362954 A CN 116362954A CN 202310324047 A CN202310324047 A CN 202310324047A CN 116362954 A CN116362954 A CN 116362954A
Authority
CN
China
Prior art keywords
gpu
real
time system
function
information
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.)
Pending
Application number
CN202310324047.2A
Other languages
Chinese (zh)
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 CN202310324047.2A priority Critical patent/CN116362954A/en
Publication of CN116362954A publication Critical patent/CN116362954A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application provides a graph drawing method, a device, electronic equipment and a storage medium in a real-time system, which relate to the technical field of display control and comprise the following steps: initializing a Graphic Processor (GPU), calling a character device registration installation function in a real-time system according to the identification of the GPU, and registering the GPU to form virtual devices; receiving rendering information input from the outside, and writing the rendering information into a first register of a display controller DC through virtual equipment; receiving drawing information input from outside, and sending the drawing information to the GPU through the virtual equipment; and acquiring the drawn graph, and sending the drawn graph to the DC so that the DC displays the drawn graph frame in combination with rendering information. The GPU is indirectly controlled by registering the virtual equipment, so that drawing of graphics can be realized under the condition that an independent display card is not installed in the real-time system, and further, the power consumption and maintenance cost of the real-time system can be reduced.

Description

Graphic drawing method and device in real-time system, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of display control technologies, and in particular, to a method and apparatus for drawing graphics in a real-time system, an electronic device, and a storage medium.
Background
The embedded real-time operating system (hereinafter referred to as real-time system) is an operating system specially designed and developed for the embedded environment, and can provide high-efficiency functions of real-time multi-task scheduling, interrupt/exception management, real-time inter-task communication and the like for programmers.
At present, the real-time system in the display control field is based on a central processing unit (central processing unit, CPU) +an independent display card to realize the 2D/3D graphic drawing and displaying functions. However, the mode of the CPU and the independent display card has high power consumption, low cost performance, low integration degree of hardware and complicated adaptation and maintenance.
Disclosure of Invention
The embodiment of the application provides a graph drawing method, a device, electronic equipment and a storage medium in a real-time system, which can realize drawing of 2D/3D graphs under the condition that an independent display card is not installed in the real-time system, and further can reduce the power consumption and maintenance cost of the real-time system.
In a first aspect, an embodiment of the present application provides a graphics rendering method in a real-time system, including:
initializing a Graphics Processor (GPU);
calling a character device registration installation function in a real-time system according to the identification of the GPU, registering the GPU, and forming virtual devices;
receiving externally input rendering information, and writing the rendering information into a first register of a display controller DC through the virtual equipment so that the DC reads the rendering information from the first register;
receiving drawing information input from the outside, and sending the drawing information to the GPU through the virtual equipment so that the GPU can complete graphic drawing according to the drawing information;
and acquiring the drawn graph, and sending the drawn graph to the DC so that the DC displays the drawn graph frame in combination with the rendering information.
Optionally, calling a character device registration installation function in the real-time system according to the identifier of the GPU, registering the GPU to form a virtual device, including:
according to the identification of the GPU, calling a character equipment registration installation function, and registering an execution function of the real-time system as a GPU execution function; the GPU executing function is used for controlling the GPU to execute corresponding functions;
writing the GPU executing function into the preset catalog of the real-time system to obtain registered virtual equipment, and taking the identification of the GPU as the identification parameter of the virtual equipment.
Optionally, the receiving the externally input rendering information and writing the rendering information into a first register of the display controller DC through the virtual device includes:
receiving rendering information input by an application layer from the outside, and transmitting the rendering information to a kernel mode of the real-time system;
calling the GPU executing function according to the equipment control interface function containing the identification parameter in the kernel mode of the real-time system, and writing the rendering information into the first register; wherein the address of the first register is determined at initialization of the GPU.
Optionally, the receiving drawing information input from the outside and sending the drawing information to the GPU through the virtual device includes:
receiving drawing information input by the outside through a graphic drawing interface, and transmitting the drawing information to a kernel mode of the real-time system;
and calling the GPU executing function according to the equipment control interface function containing the identification parameter in the kernel mode of the operating system, and writing the drawing information into a second register of the GPU, wherein the address of the second register is determined when the GPU is initialized.
Optionally, the drawn graph is stored in a memory of the real-time system;
the obtaining the drawing-completed graph and sending the drawing-completed graph to the DC includes:
calling the GPU executing function according to the equipment control interface function containing the identification parameters and the storage address of the drawn graph to acquire the drawn graph;
writing the drawn graph into a display address of the DC; the display address is determined from the rendering information.
Optionally, the method further comprises:
sending a drawing completion instruction to the graphic drawing interface to display an entry of the drawing information of the next time; and the drawing completion instruction is used for indicating the graphic drawing interface to display an instruction input interface.
Optionally, before the drawing completed graph is obtained, the method further includes:
and receiving a notification message sent by the GPU, wherein the notification message is used for indicating the GPU to complete graphic drawing, and the notification message is sent by means of an interrupt signal.
Optionally, the method further comprises:
and calling the GPU executing function according to the open function containing the identification, and opening the virtual equipment.
Optionally, after receiving the closing instruction input by the user, the method further includes:
calling the GPU executing function according to the close function containing the identifier, and closing the virtual equipment;
and calling the GPU executing function according to the remove function containing the identification, and removing the virtual equipment.
In a second aspect, an embodiment of the present application provides a graphics rendering apparatus in a real-time system, including:
the initialization module is used for initializing the GPU of the graphic processor;
the registration module is used for calling a character device registration installation function in the real-time system according to the identification of the GPU, registering the GPU and forming virtual devices;
the writing module is used for receiving rendering information input from the outside and writing the rendering information into a first register of a display controller DC through the virtual equipment so that the DC reads the rendering information from the first register;
the receiving module is used for receiving drawing information input from the outside and sending the drawing information to the GPU through the virtual equipment so that the GPU can complete graphic drawing according to the drawing information;
and the acquisition module is used for acquiring the drawn graph and sending the drawn graph to the DC so that the DC displays the drawn graph frame in combination with the rendering information.
In a third aspect, the present application provides an electronic device, comprising: a memory and a processor;
the memory is used for storing computer instructions; the processor is configured to execute the computer instructions stored in the memory to implement the method of any one of the first aspects.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program for execution by a processor to implement the method of any one of the first aspects.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method of any one of the first aspects.
The embodiment of the application provides a method, a device, electronic equipment and a storage medium for drawing graphics in a real-time system, wherein a Graphics Processor (GPU) is initialized; calling a character device registration installation function in a real-time system according to the identification of the GPU to register the GPU to form virtual devices; receiving externally input rendering information, and writing the rendering information into a first register of a display controller DC through virtual equipment so that the DC reads the rendering information from the first register; receiving drawing information input from the outside, and sending the drawing information to the GPU through the virtual equipment so that the GPU can complete graphic drawing according to the drawing information; and acquiring the drawn graph, and sending the drawn graph to the DC so that the DC displays the drawn graph frame in combination with the rendering information. The GPU is indirectly controlled through the registered virtual equipment, so that drawing of graphics can be realized under the condition that an independent display card is not installed in a real-time system, and further, the power consumption of the real-time system can be reduced, and the working efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of a process for drawing and displaying graphics based on a CPU and an independent graphics card;
fig. 2 is a flowchart of a graphics drawing method in a real-time system according to an embodiment of the present application;
FIG. 3 is a second schematic diagram of a graphic drawing method in a real-time system according to an embodiment of the present application;
FIG. 4 is a schematic diagram for implementing graphic drawing and display according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a graphics rendering device in the real-time system according to the embodiment of the present application;
fig. 6 is a schematic structural diagram of a graphic rendering electronic device in a real-time system according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments.
In the embodiments of the present application, the words "first", "second", etc. are used to distinguish identical items or similar items having substantially the same function and action, and the order of them is not limited. It will be appreciated by those of skill in the art that the words "first," "second," and the like do not limit the amount and order of execution, and that the words "first," "second," and the like do not necessarily differ.
It should be noted that, in the embodiments of the present application, words such as "exemplary" or "such as" are used to denote examples, illustrations, or descriptions. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
At present, a real-time system in the display control field realizes the 2D/3D graphic drawing and displaying functions based on a CPU and an independent display card.
As shown in fig. 1, the CPU sends the received drawing command to the graphics card driver, and the graphics card driver translates the drawing command into drawing information that can be recognized by the GPU, and sends the drawing information to the graphics processor (Graphics Processing Unit, GPU) of the independent graphics card, and the GPU processes the drawing information to obtain processed data, and places the processed data into the video memory on the independent graphics card. The digital-to-analog converter reads the processed data from the video memory, converts the processed data into analog signals, and finally, the display controller controls the display to display the target graph based on the analog signals obtained through conversion, so that the drawing and the display of the graph are completed.
However, the cpu+independent graphics card mode has high power consumption, low cost performance, low hardware integration degree, high adaptation and maintenance costs, and requires additional hardware support: such as display card fixing, interface with the motherboard, motherboard circuit support, etc.
The integrated chip of CPU and GPU is popular because of the advantages of high integration degree, low cost, light weight, small volume, perfect functions and the like. The processor chip of the real-time system is also transited from the CPU chip to the CPU+GPU integrated chip. In a real-time system using a cpu+gpu integrated chip, an independent display is not usually mounted in order to reduce power consumption of an operating system and maintenance cost.
Therefore, how to implement the 2D/3D graphics rendering and display functions in a real-time system lacking an independent graphics card becomes a problem to be solved by those skilled in the art.
In view of this, the present application proposes a graphics rendering method, apparatus, electronic device, and storage medium in a real-time system, where a virtual device is formed by registering a GPU through a character device registration model of the real-time system, and the GPU is controlled by a virtual device control function, so that 2D/3D graphics rendering and display functions in the real-time system can be implemented.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be implemented independently or combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
Fig. 2 is a flowchart of a graphics drawing method in a real-time system according to an embodiment of the present application, as shown in fig. 2, including the following steps:
s201, initializing a graphic processor GPU;
s202, calling a character device registration installation function in the real-time system according to the identification of the GPU, and registering the GPU to form virtual devices.
In the embodiment of the application, the character device is a device for performing read-write operation according to a byte stream in a real-time system, and the read-write data are sequenced in sequence.
The character device registration installation function is a registration function provided by the real-time system, the character device driver can be registered and installed in the real-time system through the character device registration installation function, and a corresponding entity object in the real-time system is instantiated as virtual equipment, so that the real-time system and the virtual equipment perform data interaction.
In this embodiment of the present application, the initialization of the GPU is performed by executing an initialization function of the GPU, for example, the real-time system receives a GPU initialization instruction input by a user, for example, a gpu_init function input by the user, and the real-time system starts to execute a process for initializing the GPU. Initializing the GPU includes, but is not limited to, obtaining configuration register addresses of the GPU and a corresponding display controller (DisplayController, DC), reading and writing states of the GPU and DC related registers, etc., and setting related parameters of the GPU and DC to default states by initializing the GPU.
In this embodiment of the present application, registering the GPU may call a character device registration installation function for the real-time system, and generate at least one function for controlling the GPU according to the character device function provided by the real-time system.
By way of example, the character device registration installation function in the real-time system may be an open function, a close function, or the like, and at least one objective function including the GPU identifier may be generated according to the GPU identifier and the character device registration installation function through the character device registration installation function. Such as a gpu_open function, a gpu_close function, etc.
In this embodiment of the present application, when the real-time system obtains at least one objective function, a logical device name may be created for the objective function, that is, a corresponding virtual device may be formed according to the objective function. Wherein the identification of the GPU is the name of the virtual device. For example, a virtual device under the name "/gpu".
It will be appreciated that the virtual device may be a series of objects formed by a set of objective functions for controlling the GPU that are generated for the real-time system. Through the virtual device, the external device can indirectly call the target function to control the GPU to execute the corresponding instruction. Namely, a connection channel between the real-time system and the GPU is established through the virtual device. In other words, generating virtual devices is equivalent to building GPU drivers in a real-time system.
S203, receiving externally input rendering information, and writing the rendering information into a first register of the display controller DC through the virtual device so that the DC reads the rendering information from the first register.
In this embodiment of the present application, the externally input rendering information may be rendering information input by a user in a real-time system, or may be rendering information input by other devices connected to the real-time system. Rendering information refers to parameters related to displaying a drawing pattern, such as parameters of display window length and width, color depth, and multiple sampling.
In this embodiment of the present application, a user may input relevant rendering information through an application program interface provided by the real-time system and set at an application layer, and when the real-time system receives the rendering information, the rendering information may be issued to a kernel mode of the real-time system through a calling function, for example, an ioctl function, in the real-time system. Executing a register which calls a virtual device to read and write DC in the kernel mode of the real-time system, and writing the rendering information into the register of DC.
The DC may acquire the rendering information from the register and set corresponding information for displaying the drawing pattern according to the rendering information.
S204, receiving drawing information input from the outside, and sending the drawing information to the GPU through the virtual equipment so that the GPU can complete graphic drawing according to the drawing information.
In this embodiment of the present application, the drawing information may be information related to drawing a graphic, for example, information such as length, width, height, shape, and color of the drawing graphic.
The external part can input related drawing information through an application program interface arranged at an application layer and provided by the real-time system, and when the real-time system receives the drawing information, the drawing information can be issued to the kernel mode of the real-time system through a calling function in the real-time system, such as an ioctl function. Executing calling virtual equipment to read and write a register of the GPU in a kernel mode of the real-time system, and writing drawing information into the register of the GPU.
The GPU can acquire the drawing information from the register, and draw according to the drawing information to obtain a drawn graph.
Optionally, after the drawing is completed, the GPU may send a drawing completion message to the real-time system, so that the real-time system obtains the drawn graphic, where the drawn graphic is stored in a preset location of the real-time system, for example, in a memory of the real-time system.
S205, obtaining the drawn graph, and sending the drawn graph to the DC through the virtual device so that the DC displays the drawn graph frame in combination with the rendering information.
In the embodiment of the application, when receiving the message sent by the GPU, the real-time system may execute the call virtual device according to the storage address of the drawn graphic to obtain the drawn graphic, and call the word virtual device to write the drawn graphic into the graphic display address of the preset DC.
And the DC acquires the drawing graph according to the graph display address, and displays the drawing graph on a display graph window set according to the rendering information, so that the display of one frame of graph is completed.
Optionally, when writing the drawn graphic to the preset graphic display address of the DC, the real-time system may also call the virtual device to control the GPU to write the drawn graphic to the graphic display address of the DC.
The graphic drawing method in the real-time system provided by the embodiment of the application is realized by initializing a graphic processor GPU; calling a character device registration installation function in the real-time system according to the identification of the GPU to register the GPU to form virtual devices; receiving externally input rendering information, and writing the rendering information into a first register of a display controller DC through virtual equipment so that the DC reads the rendering information from the first register; receiving drawing information input from the outside, and sending the drawing information to the GPU through the virtual equipment so that the GPU can complete graphic drawing according to the drawing information; and acquiring the drawn graph, and sending the drawn graph to the DC so that the DC displays the drawn graph frame in combination with the rendering information. The GPU and the DC are indirectly controlled through the registered virtual equipment, so that drawing of graphics can be realized under the condition that an independent display card is not installed in a real-time system, and further, the power consumption and the maintenance cost of the real-time system can be reduced.
Fig. 3 is a second flow chart of a graph drawing method in a real-time system according to an embodiment of the present application, and further illustrates, based on the embodiment shown in fig. 2, the graph drawing method according to the embodiment of the present application, as shown in fig. 3, including the following steps:
s301, calling a character device registration installation function according to the identification of the GPU to register the GPU, and obtaining the virtual device.
In this embodiment of the present application, registering a GPU according to an identifier of the GPU, to obtain a virtual device may be performed according to the following manner:
exemplary: according to the identification of the GPU, a character device registration installation function is called, an execution function of the real-time system is registered as a GPU execution function, the GPU execution function is used for controlling the GPU to execute a corresponding function to write the GPU execution function into a preset catalog of the real-time system, the registered virtual device is obtained, and the identification of the GPU is used as the identification of the virtual device.
Wherein, the GPU executing function can comprise at least one of gpu_open, gpu_close, gpu_ioctl and gpu_remove;
in this embodiment of the present application, the real-time system may call the character device to register the execution function of the installation function registration GPU, and register the remove function, open function, close function, and ioctl function of the real-time system as the execution function for controlling the GPU to run, where the execution function may also be referred to as a call function.
The real-time system may call the character device adding function to name the acquired executing function, write the acquired executing function into a preset directory of the real-time system, for example, a/dev/directory of the real-time system, and use the identifier of the GPU as a logical name of the virtual device, that is, the identifier of the virtual device, to obtain the virtual device with "/GPU" as the device name.
After obtaining the registered virtual device, the external device may indirectly control the GPU through the virtual device. For example, a user may input an open ("/GPU") function, and the real-time system may open the GPU function to identify the virtual device after receiving the function, and call the virtual device to execute the gpu_open function in the virtual device to perform an operation of opening the GPU.
Optionally, when the GPU is initialized, a section of memory space may be applied for the GPU data storage area in the memory of the real-time system, and the storage address of the data storage area may be determined.
S302, establishing connection between the virtual equipment and the GPU according to an externally input instruction.
In the embodiment of the application, the real-time system may execute the operation of establishing the connection between the virtual device and the GPU according to the external input of the open instruction in the interactive interface of the real-time system, where the external input instruction is presented in a manner of calling a function.
For example, the real-time system indirectly calls the gpu_open function according to the open function containing the GPU identifier, and establishes connection between the virtual device and the GPU.
For example, an open ("/GPU") function may be input in a main function of the real-time system, and the real-time system may determine a virtual device corresponding to the identification information according to the identification information in the function input by the outside, and call the virtual device to execute the gpu_open function in the virtual device, so as to perform an operation of opening the GPU, that is, establish connection between the virtual device and the GPU.
S303, the rendering information input by the user is written into a first register of the DC through the virtual device.
In the embodiment of the application, the real-time system may be implemented by calling the related execution function in the virtual device by writing the rendering information input by the user into the first register of the DC through the virtual device.
Illustratively, receiving rendering information input by an application layer from outside, and issuing the rendering information to a kernel mode of the real-time system; in the kernel mode of the real-time system, calling the GPU executing function according to the ioctl function containing the identification parameter, and writing the rendering information into the first register, wherein the address of the first register is determined when the GPU is initialized.
In the embodiment of the application, when the rendering information is input by the application layer, the rendering information can be performed through a correlation function of a real-time system.
For example, referring to fig. 4, a user may call an interface function at an interactive interface of a real-time system, the real-time system may display a window or interface in which the user inputs rendering information of graphics to be drawn, and a corresponding virtual device control instruction, for example, ioctl ("/gpu").
The real-time system can call the ioctl function to issue the rendering information into the kernel mode of the real-time system after the rendering information is acquired. And the real-time system executes and calls a gpu_ioctl function in the virtual equipment according to the virtual equipment control instruction in a kernel mode, reads and writes the first register according to the address of the first register, and writes the rendering information into the first register. The DC may obtain the rendering information from the first register and set a corresponding display graphical window according to the rendering information.
Optionally, when receiving the rendering information input from the outside, the real-time system may apply for a section of memory in the memory of the real-time system as a display address of DC, where the display address is used to store the drawing-completed graphics to be displayed.
S304, writing the drawing information input from the outside into a second register of the GPU through the virtual equipment.
In this embodiment of the present application, the real-time system writes the drawing information input from the outside into the second register of the GPU through the virtual device by calling the related execution function in the virtual device.
Illustratively, drawing information input by the outside through a graphic drawing interface is received, and the drawing information is issued to the kernel mode of the real-time system; and calling a GPU executing function according to the ioctl function containing the identification parameter in the kernel mode of the real-time system, and writing the drawing information into a second register of the GPU, wherein the address of the second register is determined when the GPU is initialized, and a graphic drawing interface is arranged in the application layer.
For example, with continued reference to fig. 4, the external may input an graphics rendering interface of the real-time system to the interface input opengles function call real-time system to input rendering information, and a corresponding virtual device control instruction, e.g., ioctl ("/gpu").
When the real-time system receives the drawing information, the ioctl function can be called to issue the drawing information into the kernel mode of the real-time system. And the real-time system executes and calls a gpu_ioctl function in the virtual equipment according to the virtual equipment control instruction in the kernel mode, reads and writes the second register according to the address of the second register, and writes the drawing information into the second register.
The GPU can conduct graphic drawing according to drawing information in the second register, and the drawn graphic is written into a preset data storage area. When the GPU finishes graphic drawing, the GPU can send a graphic drawing completion message to the real-time system. Wherein the graphic drawing completion message may be transmitted to the real-time system in the form of an interrupt signal.
S305, writing the drawn graph into a display address of the DC through the virtual device.
In the embodiment of the application, the real-time system writes the graphics drawn by the GPU into the DC through the virtual device by calling the related execution function in the virtual device.
Illustratively, according to the ioctl function containing the identification parameter and the storage address of the drawn graph, calling the GPU executing function to obtain the drawn graph; writing the drawn graph into a display address of the DC; the display address is determined from the rendering information.
When the real-time system receives the interrupt signal sent by the GPU, the real-time system may send a message to the application layer by means of a signal quantity, and control the application layer to display the instruction input area at the graphics drawing interface.
The external may input virtual device control instructions, for example, ioctl ("/gpu"), in the instruction input area. The real-time system may call a gpu_ioctl function in the virtual device to transfer the rendered graphics from the data store of the GPU into the display address of the DC.
The DC may display the drawn graphic in the graphic display window according to the drawn graphic in the display address.
S306, determining whether to continue graphic drawing or not according to an external instruction, or closing and moving out the virtual device.
In this embodiment of the present application, after the DC finishes displaying the drawn graphic, the real-time system may continue drawing the next frame of graphic according to an external instruction, or end drawing the graphic.
Illustratively, sending a drawing completion instruction to the graphics drawing interface to show the entry of the drawing information next time; and the drawing completion instruction is used for indicating the graphic drawing interface to display an instruction input interface.
In the embodiment of the application, the real-time system can send the graphic drawing completion instruction to the graphic drawing interface in a signal quantity mode. When the graphics rendering interface receives a graphics rendering completion instruction, the instruction input interface may be displayed.
Optionally, in some embodiments, if the real-time system receives an instruction that the instruction input in the instruction input interface is an instruction to continue drawing the graphics, the real-time system may draw the next frame of graphics according to the instruction. The implementation is similar to that shown in S303 to S305.
If the real-time system receives the command input from the external command input interface as the closing command, the drawing of the graph is ended.
Illustratively, according to a close function containing the identification parameter, calling the gpu_close function, and closing the virtual device; and calling the gpu_remove function according to the remove function containing the identification parameter, and removing the virtual equipment.
For example, if an external command is input to the command input interface close ("/gpu"), the real-time system calls the gpu_close function in the virtual device, and closes the virtual device named gpu. Closing the virtual device may be understood as closing the connection of the virtual device to the GPU.
After the virtual device is closed, if a remove ("/gpu") instruction is externally input to the instruction input interface, the real-time system calls a remove_close function in the virtual device, and removes the virtual device with the gpu as a name. Namely, deleting the registered GPU executing function under the preset directory of the real-time system.
According to the graphic drawing method, the virtual equipment of the GPU and the DC is controlled through the registration of the execution function of the real-time system, drawing of the graphic can be achieved in the real-time system without an independent display card, and therefore power consumption and maintenance cost of the real-time system can be reduced.
On the basis of the embodiment of the graph drawing method in the real-time system, the embodiment of the application also provides a graph drawing device in the real-time system.
Fig. 5 is a schematic structural diagram of a graphics rendering device 50 in a real-time system according to an embodiment of the present application, as shown in fig. 5, including:
an initialization module 501 for initializing the graphics processor GPU.
The registration module 502 is configured to call a character device registration installation function in the real-time system according to the identifier of the GPU, and register the GPU to form a virtual device.
A writing module 503, configured to receive externally input rendering information, and write the rendering information into a first register of a display controller DC through the virtual device, so that the DC reads the rendering information from the first register.
And the receiving module 504 is configured to receive drawing information input from the outside, and send the drawing information to the GPU through the virtual device, so that the GPU completes graphics drawing according to the drawing information and the graphics window.
And the acquisition module 505 is configured to acquire the drawn graphic and send the drawn graphic to the DC, so that the DC performs and displays the drawn graphic frame in combination with the rendering information.
Optionally, the registration module 502 is further configured to call a virtual device registration installation function according to the identifier of the GPU, register an execution function of the real-time system as a GPU execution function, where the GPU execution function is configured to control the GPU to execute a corresponding function; writing the GPU executing function into the preset catalog of the real-time system to obtain registered virtual equipment, and taking the identification of the GPU as the identification parameter of the virtual equipment.
Optionally, the writing module 503 is further configured to receive rendering information input by an application layer from the outside, and send the rendering information to a kernel mode of the real-time system; calling the GPU executing function according to the equipment control interface function containing the identification parameter in the kernel mode of the real-time system, and writing the rendering information into the first register; wherein the address of the first register is determined at initialization of the GPU.
Optionally, the receiving module 504 is further configured to receive drawing information input from the outside through a graphics drawing interface, and send the drawing information to a kernel mode of the real-time system, where the graphics drawing interface is disposed in the application layer; and calling the GPU executing function according to the equipment control interface function containing the identifier in the kernel mode of the real-time system, and writing the drawing information into a second register of the GPU, wherein the address of the second register is determined when the GPU is initialized.
Optionally, the obtaining module 505 is further configured to call the GPU executing function according to a device control interface function including the identification parameter and a storage address of the drawn graph, to obtain the drawn graph; writing the drawn graph into a display address of the DC; the display address is determined from the rendering information.
Optionally, the obtaining module 505 is further configured to send a drawing completion instruction to the graphics drawing interface to display an entry of the drawing information next time; and the drawing completion instruction is used for indicating the graphic drawing interface to display an instruction input interface.
Optionally, the receiving module 504 is further configured to receive a notification message sent by the GPU, where the notification message is used to instruct the GPU to complete graphics drawing, and the notification message is sent by way of an interrupt signal.
The graphics drawing device in the real-time system provided by the embodiment of the present application may execute the graphics drawing method in the real-time system provided by any one of the embodiments, and the principle and technical effects thereof are similar, and are not repeated herein.
Fig. 6 is a schematic structural diagram of a graphic rendering electronic device in a real-time system according to an embodiment of the present application. As shown in fig. 6, the graphic rendering electronic device 60 in the real-time system provided in the present embodiment may include:
a processor 601.
A memory 602 for storing executable instructions of the terminal device.
The processor is configured to execute the technical solution of the graphics rendering method embodiment in the real-time system by executing the executable instructions, and its implementation principle and technical effects are similar, and are not repeated here.
The embodiment of the present application further provides a computer readable storage medium, on which a computer program is stored, where the computer program when executed by a processor implements the technical solution of the embodiment of the graphics rendering method in the real-time system, and the implementation principle and the technical effect are similar, and are not repeated herein.
In one possible implementation, the computer readable medium may include random access Memory (Random Access Memory, RAM), read-Only Memory (ROM), compact disk (compact disc Read-Only Memory, CD-ROM) or other optical disk Memory, magnetic disk Memory or other magnetic storage device, or any other medium targeted for carrying or storing the desired program code in the form of instructions or data structures, and accessible by a computer. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (Digital Subscriber Line, DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes optical disc, laser disc, optical disc, digital versatile disc (Digital Versatile Disc, DVD), floppy disk and blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The embodiment of the application further provides a computer program product, which comprises a computer program, and the computer program when executed by a processor realizes the technical scheme of the embodiment of the graphics drawing method in the real-time system, and the implementation principle and the technical effect are similar, and are not repeated here.
In the specific implementation of the terminal device or the server, it should be understood that the processor may be a central processing unit (in english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (in english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (in english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
Those skilled in the art will appreciate that all or part of the steps of any of the method embodiments described above may be accomplished by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium, which when executed, performs all or part of the steps of the method embodiments described above.
The technical solution of the present application, if implemented in the form of software and sold or used as a product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the technical solutions of the present application may be embodied in the form of a software product stored in a storage medium comprising a computer program or several instructions. The computer software product causes a computer device (which may be a personal computer, a server, a network device, or similar electronic device) to perform all or part of the steps of the methods described in embodiments of the present application.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A graphics rendering method in a real-time system, comprising:
initializing a Graphics Processor (GPU);
calling a character device registration installation function in a real-time system according to the identification of the GPU, registering the GPU, and forming virtual devices;
receiving externally input rendering information, and writing the rendering information into a first register of a display controller DC through the virtual equipment so that the DC reads the rendering information from the first register;
receiving drawing information input from the outside, and sending the drawing information to the GPU through the virtual equipment so that the GPU can complete graphic drawing according to the drawing information;
and acquiring the drawn graph, and sending the drawn graph to the DC so that the DC displays the drawn graph frame in combination with the rendering information.
2. The method according to claim 1, wherein the calling the character device registration installation function in the real-time system according to the identification of the GPU, registering the GPU to form a virtual device, includes:
according to the identification of the GPU, calling character equipment to register an installation function, and registering an execution function of the real-time system as a GPU execution function; the GPU executing function is used for controlling the GPU to execute corresponding functions;
writing the GPU executing function into a preset catalog of the real-time system to obtain registered virtual equipment, and taking the identification of the GPU as an identification parameter of the virtual equipment.
3. The method according to claim 2, wherein receiving the externally input rendering information and writing the rendering information into the first register of the display controller DC through the virtual device comprises:
receiving rendering information input by an application layer from the outside, and transmitting the rendering information to a kernel mode of the real-time system;
in a kernel mode of the real-time system, calling the GPU executing function according to the equipment control interface function containing the identification parameter, and writing the rendering information into the first register; wherein the address of the first register is determined at initialization of the GPU.
4. The method of claim 3, wherein the receiving the externally input rendering information and transmitting the rendering information to the GPU through the virtual device comprises:
receiving drawing information input by the outside through a graphic drawing interface, and transmitting the drawing information to a kernel mode of the real-time system;
in the kernel mode of the real-time system, calling the GPU executing function according to the equipment control interface function containing the identification parameter, and writing the drawing information into a second register of the GPU; wherein the address of the second register is determined at initialization of the GPU.
5. The method of claim 4, wherein the rendered graphic is stored in a memory of the real-time system;
the obtaining the drawing-completed graph and sending the drawing-completed graph to the DC includes:
calling the GPU executing function according to the equipment control interface function containing the identification parameters and the storage address of the drawn graph to acquire the drawn graph;
writing the drawn graph into a display address of the DC; the display address is determined from the rendering information.
6. The method of claim 5, wherein the method further comprises:
sending a drawing completion instruction to the graphic drawing interface to display an entry of the drawing information of the next time; and the drawing completion instruction is used for indicating the graphic drawing interface to display an instruction input interface.
7. The method of any of claims 1-6, wherein prior to the obtaining the rendered graphic, the method further comprises:
and receiving a notification message sent by the GPU, wherein the notification message is used for indicating the GPU to complete graphic drawing, and the notification message is fed back to the application layer through an interrupt signal.
8. A graphics rendering apparatus in a real-time system, comprising:
the initialization module is used for initializing the GPU of the graphic processor;
the registration module is used for calling a character device registration installation function in the real-time system according to the identification of the GPU, registering the GPU and forming virtual devices;
the writing module is used for receiving rendering information input from the outside and writing the rendering information into a first register of a display controller DC through the virtual equipment so that the DC reads the rendering information from the first register;
the receiving module is used for receiving drawing information input from the outside and sending the drawing information to the GPU through the virtual equipment so that the GPU can complete graphic drawing according to the drawing information;
and the acquisition module is used for acquiring the drawn graph and sending the drawn graph to the DC so that the DC displays the drawn graph frame in combination with the rendering information.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the method of any one of claims 1-7.
10. A computer readable storage medium, having stored thereon a computer program, the computer program being executed by a processor to implement the method of any of claims 1-7.
CN202310324047.2A 2023-03-29 2023-03-29 Graphic drawing method and device in real-time system, electronic equipment and storage medium Pending CN116362954A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310324047.2A CN116362954A (en) 2023-03-29 2023-03-29 Graphic drawing method and device in real-time system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310324047.2A CN116362954A (en) 2023-03-29 2023-03-29 Graphic drawing method and device in real-time system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116362954A true CN116362954A (en) 2023-06-30

Family

ID=86918816

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310324047.2A Pending CN116362954A (en) 2023-03-29 2023-03-29 Graphic drawing method and device in real-time system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116362954A (en)

Similar Documents

Publication Publication Date Title
CN1270278C (en) Z-buffer technology for figure heightening
JP7101780B2 (en) APP remote control method and related devices
RU2424559C1 (en) Method and computer system for reducing amount of data transmitted to remote client terminal
TWI453603B (en) Platform independent information handling system, communication method, and computer program product thereof
CN113515396B (en) Graphics rendering method, graphics rendering device, electronic equipment and storage medium
US9384583B2 (en) Network distributed physics computations
WO2008027248A1 (en) Parallel physics simulation and graphics processing
US20020052977A1 (en) Method and apparatus for adapting and hosting legacy user interface controls
CN113419845A (en) Calculation acceleration method and device, calculation system, electronic equipment and computer readable storage medium
EP3605327B1 (en) Method and apparatus for capturing screenshots of guest operating system in computer device
CN112015476B (en) Display card driving method and device, electronic equipment and storage medium
CN101326513A (en) Alternative graphics pipe
US20200027189A1 (en) Efficient dependency detection for concurrent binning gpu workloads
CN116362954A (en) Graphic drawing method and device in real-time system, electronic equipment and storage medium
TWI566205B (en) Method for approximating motion blur in rendered frame from within graphic driver
WO2024051122A1 (en) Pcie interrupt processing method and apparatus, device, and non-volatile readable storage medium
CN116721007A (en) Task control method, system and device, electronic equipment and storage medium
US20010043216A1 (en) System and method for occlusion culling graphical data
CN116107774A (en) IO request processing method and device, electronic equipment and storage medium
CN114036085B (en) DDR 4-based multitasking read-write scheduling method, computer equipment and storage medium
CN112367295A (en) Plug-in display method and device, storage medium and electronic equipment
CN111292392A (en) Unity-based image display method, apparatus, device and medium
TWI556167B (en) System and method for multiple native software applications user interface composition
CN116485628B (en) Image display method, device and system
US20220179784A1 (en) Techniques for supporting large frame buffer apertures with better system compatibility

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