Disclosure of Invention
Aiming at the technical problems in the prior art, the invention provides a multi-screen display method and a multi-screen display system, which overcome the problem of black screen caused by the limitation of the number of independent display channels of a GPU (graphics processing Unit) when the comprehensive display requirements of multi-screen expansion and multi-screen copying exist at the same time.
According to a first aspect of the present invention, there is provided a multi-screen display method, comprising:
correspondingly connecting the multi-path GPU display interfaces with a plurality of displays;
Determining the type and the channel of a GPU display interface to be copied, and starting up to automatically acquire the type and the channel of the copied GPU display interface in an initial state by detecting the connection state of the GPU display interface;
The register of the GPU display interface to be copied is configured, so that the GPU display interface to be copied and the copied GPU display interface point to the same CRTC, the display time sequence of the GPU display interface to be copied and the display time sequence of the copied GPU display interface are the same as the DPMS state, and an expansion screen and a copying screen are normally displayed in an initial state;
the type and channel of the copied GPU display interface are modified in the application program so as to realize the ordered display of the extension screen and the copy screen.
On the basis of the technical scheme, the invention can also make the following improvements.
Optionally, the determining the type and the channel of the GPU display interface to be replicated includes:
Adding a member, namely a body boundary_status, into the GPU equipment structure body, and assigning an initial value of true to the boundary_status when the GPU equipment is initialized;
In the initial situation, sequentially detecting the connection states of other non-duplicated GPU display interfaces according to a certain sequence, and if the display interfaces are connected and the value of the minor_status is true or the value of the minor_num is 1, indicating that the display interfaces are duplicated display interfaces;
and starting up to automatically acquire the type and the channel of the copied GPU display interface in the initial state by detecting the connection state of the GPU display interface.
Optionally, the configuring the register of the GPU display interface to be replicated, so that the GPU display interface to be replicated and the replicated GPU display interface point to the same CRTC, and the display timing sequence of the GPU display interface to be replicated and the replicated GPU display interface are the same as the DPMS state, and letting the extension screen and the replication screen display normally in the initial state includes:
Adding struct drm_display_mode and int DPMS _status members into a type structure body of each GPU display interface, wherein the modes and DPMS _status record the display time sequence and DPMS state of the GPU display interface respectively;
configuring CRTC related registers of the GPU display interface to be copied so that the GPU display interface to be copied and the copied GPU display interface point to the same CRTC;
according to the display time sequence of the copied GPU display interface, the display time sequence of the to-be-copied GPU display interface is the same as the display time sequence of the copied GPU display interface by configuring a display time sequence related register of the to-be-copied GPU display interface;
according to the DPMS state of the copied GPU display interface, the DPMS state related registers of the to-be-copied GPU display interface are configured, so that the DPMS states of the to-be-copied GPU display interface and the copied GPU display interface are the same, and normal display of the extension screen and the copy screen in the initial state is realized.
Optionally, the method further comprises:
When the copied GPU display interface needs to be changed, configuring the type and the channel of the copied GPU display interface in an application program;
The application program sends a display interface copying request and data to the GPU kernel driver by calling the IOCTL, wherein the data comprises types and channels of the GPU display interface to be copied and the copied GPU display interface;
and the GPU kernel driver acquires a display interface copying request and data sent by the application program, configures CRTC, display time sequence and DPMS state related registers of the GPU display interface to be copied according to the CRTC, display time sequence and DPMS state of the copied GPU display interface, leads the GPU display interface to be copied and the copied GPU display interface to point to the same CRTC, and leads the display time sequence and DPMS state of the GPU display interface to be copied and the copied GPU display interface to be the same.
Optionally, the configuring the type and the channel of the replicated GPU display interface in the application program includes:
Obtaining an instruction input into an orientation application program, analyzing the instruction, obtaining the type and the channel of a GPU display interface to be copied, and storing the type and the channel;
Judging whether the display interface copy instruction is displayed or not by a character string comparison method;
If yes, confirming the type and the channel of the copied GPU display interface by character comparison and storing.
Optionally, the sending, by the application program, the display interface copy request and the data to the GPU kernel driver by calling the IOCTL includes:
Based on the GPU equipment file interface, the application program sends a display interface copy request and data to the GPU kernel driver by calling the IOCTL;
The GPU kernel driver acquires a display interface copying request and data sent by an application program, and realizes multi-screen expansion and ordered display of multi-screen copying by setting CRTC, display time sequence and DPMS related registers of a to-be-copied and copied display interface.
According to a second aspect of the present invention, there is provided a multi-screen display system comprising:
the determining module is used for determining the types and channels of the GPU display interface to be copied and the copied GPU display interface, and automatically acquiring the types and channels of the copied GPU display interface in an initial state by detecting the connection state of the GPU display interface when the computer is started;
The configuration module is used for enabling the GPU display interface to be replicated and the replicated GPU display interface to point to the same CRTC through configuring a register of the GPU display interface to be replicated, enabling display time sequences of the GPU display interface to be replicated and the replicated GPU display interface to be the same as DPMS states, and enabling an expansion screen and a replication screen to be displayed normally in an initial state;
and the modification module is used for modifying the type and the channel of the copied GPU display interface in the application program so as to realize ordered display of the extension screen and the copy screen.
According to the multi-screen display method and the multi-screen display system, provided by the invention, under the condition that the comprehensive display requirements of multi-screen expansion and multi-screen copying exist, the display flow of each display interface is driven by optimizing the GPU, so that a plurality of display interfaces point to the same CRTC and the time sequence and the DPMS state of the display interfaces are kept consistent, and the problem of black screen caused by the insufficient number of independent display channels of the GPU due to the multi-screen expansion display requirements of mixed copying is solved.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention. In addition, the technical features of each embodiment or the single embodiment provided by the invention can be combined with each other at will to form a feasible technical scheme, and the combination is not limited by the sequence of steps and/or the structural composition mode, but is necessarily based on the fact that a person of ordinary skill in the art can realize the combination, and when the technical scheme is contradictory or can not realize, the combination of the technical scheme is not considered to exist and is not within the protection scope of the invention claimed.
Based on the defects of the existing multi-screen display, the invention discloses a multi-screen display method, which comprises the steps of firstly, correspondingly connecting a plurality of GPU display interfaces with a plurality of displays, then, reasonably designing the display flow of each display interface of the GPU, enabling an extended screen and a copied screen to be displayed normally in an initial state, and finally, configuring the types and channels of the display interfaces to be copied and copied in an application program to realize multi-screen extension and multi-screen copying ordered display. According to the multi-screen display method, the display flow of each display interface is driven by the optimized GPU, and the design application program is communicated with the GPU drive, so that multi-screen expansion and multi-screen copying ordered display are realized, the actual application requirements of multi-screen display are met, no additional conversion equipment is externally connected, the integration level of the system is high, the miniaturization and light-weight design of products are facilitated, the cost can be reduced, and the multi-screen display method has wide application in daily office fields such as classroom teaching and work reporting.
Fig. 1 is a flowchart of a multi-screen display method provided by the present invention, where, as shown in fig. 1, the method includes:
and step1, correspondingly connecting the multi-path GPU display interfaces with a plurality of displays.
It can be understood that in the multi-screen display requirement, the GPU chip has multiple display interfaces, and one GPU display interface is connected with one display, so as to realize multi-screen display.
And 2, determining the type and the channel of the GPU display interface to be copied, and automatically acquiring the type and the channel of the copied GPU display interface in an initial state by detecting the connection state of the GPU display interface when the GPU display interface is started.
It will be appreciated that when there is a multi-screen copy display scenario, the type and channel of the GPU display interface to be copied is first determined.
Adding a member, namely a member, in a GPU (graphics processing unit) equipment structure body, wherein the member, namely a member, is added in the GPU equipment structure body, and the member is given a value of true when the GPU equipment is initialized;
The GPU display interface to be replicated among the plurality of GPU display interfaces is determined, and in an initial case, the replicated GPU display interface needs to be determined. In one embodiment of the invention, the copied GPU display interfaces are determined according to the number sequence of the accessed GPU display interfaces according to the access condition of other GPU display interfaces. Specifically, for example, there are five display interfaces of HDMI 0, HDMI 1, HDMI 2, HDMI 3 and DP 0 in total, it is determined that the HDMI 3 interface is a display interface to be duplicated, and the duplicated display interface may be determined by detecting the display interface that is accessed at this time. If the HDMI 0 interface is accessed and the mirror_status is true or the mirror_num is 1 at this time, HDMI 0 is used as the copied GPU display interface. If HDMI 0 is not accessed at this time, HDMI 1 is accessed and either the minor_status is true or the minor_num is 1, HDMI 1 is the replicated GPU display interface. When the HDMI 0 interface and the HDMI 1 interface are both accessed and the MIRR_status is true or the MIRR_num is 1, HDMI 1 is a copied GPU display interface, and so on;
and determining the types and channels of the GPU display interface to be copied and the GPU display interface to be copied in the initial condition, storing the types and channels of the GPU display interface to be copied and the GPU display interface to be copied, and setting the value of the mirror_status to false and the value of the mirror_num to be 1. If HDMI 0 is the copied GPU display interface, the value of the border_status is set to false, and the value of the border_num of HDMI 0 is set to 1;
And 3, configuring a register of the GPU display interface to be copied, so that the GPU display interface to be copied and the copied GPU display interface point to the same CRTC, and the display time sequence of the GPU display interface to be copied and the display time sequence of the copied GPU display interface are the same as the DPMS state, thereby realizing normal display of an expansion screen and a copying screen in an initial state.
It can be appreciated that, referring to fig. 2, after determining the GPU display interface to be copied and the GPU display interface to be copied in the initial situation, struct drm_display_mode and int dpms _status members are added to each GPU display interface type structure. The display timing and DPMS status of the copied GPU display interface are recorded with mode and DPMS _status, respectively.
And configuring related registers of the GPU display interface to be copied according to the CRTC, the display time sequence and the DPMS state of the copied GPU display interface.
Specifically, a CRTC related register of a GPU display interface to be copied is configured so that the GPU display interface to be copied and the copied GPU display interface point to the same CRTC;
according to the display time sequence of the copied GPU display interface, the display time sequence of the to-be-copied GPU display interface is the same as the display time sequence of the copied GPU display interface by configuring a display time sequence related register of the to-be-copied GPU display interface;
According to the DPMS state of the copied GPU display interface, the DPMS state related registers of the to-be-copied GPU display interface are configured, so that the DPMS states of the to-be-copied GPU display interface and the to-be-copied GPU display interface are the same, and normal display of the extension screen and the copy screen in the initial state is realized.
In the process of subsequent display, if the copied GPU display interface needs to be modified (wherein, the type and channel of the GPU display interface to be copied are determined at the time of starting up), the application program configures the type and channel of the copied GPU display interface, and the application program sends a display interface copy request and data to the GPU kernel driver by calling the IOCTL, wherein the data comprises the type and channel of the GPU display interface to be copied and the type and channel of the copied GPU display interface.
When the GPU kernel driver acquires a display interface copying request and data sent by an application program, configuring CRTC, display time sequence and DPMS state related registers of a to-be-copied GPU display interface according to CRTC, display time sequence and DPMS state of the to-be-copied GPU display interface, so that the to-be-copied GPU display interface and the to-be-copied GPU display interface point to the same CRTC, and the display time sequence and DPMS state of the to-be-copied GPU display interface and the to-be-copied GPU display interface are the same.
When the application program sends a display interface copying request to the GPU kernel driver, the type and the channel of the GPU display interface to be copied and the type and the channel of the copied GPU display interface are input into the application program and stored, and based on the GPU equipment file interface, the application program sends a copying request and data to the GPU kernel driver through the IOCTL.
The method for configuring the types and the channels of the GPU display interface to be copied and the copied GPU display interface in the application program comprises the following steps:
Obtaining an instruction input into an orientation application program, analyzing the instruction, obtaining the type and the channel of a GPU display interface to be copied, and storing the type and the channel;
Judging whether the display interface copy instruction is displayed or not by a character string comparison method;
If yes, confirming the type and the channel of the copied GPU display interface by character comparison and storing.
And reconfiguring relevant registers of the GPU display interface to be copied according to the CRTC, the display time sequence and the DPMS state of the copied GPU display interface configured in the application program. Specifically, the reconfiguration includes the following aspects:
resetting a CRTC related register of the GPU display interface to be copied to enable the CRTC related register and the copied GPU display interface to point to the same CRTC;
resetting a display time sequence related register of the GPU display interface to be copied to enable the display time sequence related register to be the same as the display time sequence of the copied GPU display interface;
resetting a DPMS related register of the GPU display interface to be copied to enable the DPMS related register to be the same as the DPMS of the copied GPU display interface;
The sequential display of the GPU multi-screen expansion and multi-screen copying is realized through reconfiguration of the display interfaces and channels to be copied and copied in the application program.
A multi-screen display method provided by the present invention will be described below with a specific example.
S1, the design of a GPU chip supports 4 CRTC controllers and supports independent display of 4 paths of display interfaces. Connecting 4 paths of HDMI (HDMI 0, HDMI 1, HDMI 2 and HDMI 3) and 1 path of DP (DP 0) interfaces of the GPU board card with a display at the same time, and designating HDMI 3 as a display interface to be duplicated;
S2, adding a member, namely a body mirror_status, into the GPU equipment structure, wherein the initial value of the mirror_status is true when the GPU equipment is initialized, adding a member, namely a int mirror_num, into the HDMI and DP interface structure, and the initial value of the mirror_num is 0 when the display interface is initialized. Loading GPU drivers, and sequentially detecting connection states of HDMI0, HDMI 1, HDMI 2 and DP 0. Since HDMI0 is connected and the value of the MIRR_status is true or the value of the MIRR_num is 1, HDMI0 is the copied display interface, and the value of the MIRR_status is set to 0 and the value of the MIRR_num of HDMI0 is set to 1;
S3, adding struct dram_display_mode and int dpms _status members in the HDMI and DP interface structures. Optimizing the display flow of HDMI 3 in GPU drive, making CRTC corresponding to HDMI 3 identical to HDMI0, after setting display time sequence of HDMI0, respectively recording display time sequence and DPMS state by using mode and DPMS _status, and setting same display time sequence and DPMS state of HDMI 3 based on mode and dmps _status of HDMI 0. Starting up and loading GPU drive, and lighting the desktop, wherein the HDMI0, HDMI 1, HDMI 2 and DP 0 realize 4-screen expansion mode display, and HDMI 3 and HDMI0 keep copy mode display;
S4, inputting HDMI clone HDMI 1 into the application program, sending the copy request and data to the GPU kernel driver through the IOCTL, analyzing the data after the GPU kernel driver acquires the copy request and the data, resetting CRTC, display time sequence and DPMS state related registers of the HDMI 3, and enabling the HDMI 3 to keep copy mode display with the HDMI 1.
Wherein, referring to fig. 4, in one embodiment, S2 specifically includes:
s2.1, starting up and loading a GPU driver, and initializing GPU hardware;
S2.2, after the hot plug interrupt is detected, EDID (Extended Display Identification Data ) of a display screen connected with a GPU display interface is obtained, analyzed and then transmitted to an operating system;
S2.3, sequentially detecting connection states of HDMI 0, HDMI 1, HDMI 2 and DP 0, judging values of a minor_status and a minor_num, and obtaining the type and the channel of the GPU display interface which are copied initially;
and S2.3, when the HDMI 0 connection is detected and the value of the MIRROR_status is true, confirming that the HDMI 0 is a copied display interface.
Wherein, referring to fig. 5, in one embodiment, S3 specifically includes:
S3.1, the GPU sets Guan Jicun devices such as CRTC, display time sequence, DPMS state and the like for each display interface of HDMI 0, HDMI 1, HDMI 2, HDMI 3 and DP 0 in sequence, and records the display time sequence and DPMS state of HDMI 0 by using mode and DPMS _status;
S3.2, when the current display interface is detected to be HDMI 3, configuring a CRTC related register of the HDMI 3 to enable the HDMI 3 and the HDMI 0 to point to the same CRTC, configuring a display time sequence of the HDMI 3 and a DPMS state related register based on a mode and DPMS _status value of the HDMI 0 stored in the front, and enabling the HDMI 3 and the HDMI 0 to keep copy mode display in an initial state.
Referring to fig. 6, in one embodiment, S4 specifically includes:
S4.1, inputting hdmi clone hdmi 1 into an application program, and analyzing the clone hdmi 1;
S4.2, acquiring the type and the channel of the display interface to be copied and storing the type and the channel;
s4.3, judging whether the command is a clone command or not by a character string comparison method;
S4.4, confirming the copied display interface type and channel by character comparison and storing the copied display interface type and channel;
S4.5, opening a GPU equipment file, and sending a copy request and data to a GPU kernel driver through the IOCTL;
S4.6, after the GPU kernel driver receives the request of the application program and the data, analyzing the data, and judging the type and the channel of the display interface to be copied and copied;
S4.7, resetting the CRTC, the display time sequence and the DPMS related register of the HDMI 3 to be copied, leading the HDMI 3 and the HDMI 1 to point to the same CRTC, leading the display time sequence and the DPMS state of the HDMI 3 and the HDMI 1 to be the same, and leading the HDMI 3 and the HDMI 1 to keep the copy mode display.
Referring to fig. 7, a multi-screen display system according to an embodiment of the present invention is provided, the system including:
The determining module 701 is configured to determine types and channels of the GPU display interface to be copied and the copied GPU display interface, and automatically obtain the type and channel of the copied GPU display interface in an initial state by detecting a connection state of the GPU display interface when the GPU display interface is started;
The configuration module 702 is configured to enable the to-be-copied GPU display interface and the copied GPU display interface to point to the same CRTC by configuring a register of the to-be-copied GPU display interface, enable display timing sequences of the to-be-copied GPU display interface and the copied GPU display interface to be the same as a DPMS state, and enable the extension screen and the copy screen to be normally displayed in an initial state;
A modifying module 703, configured to modify the type and channel of the replicated GPU display interface in the application program, so as to implement ordered display of the extension screen and the replicated screen.
It can be understood that the multi-screen display system provided by the present invention corresponds to the multi-screen display method provided in the foregoing embodiments, and relevant technical features of the multi-screen display system may refer to relevant technical features of the multi-screen display method, which are not described herein.
The multi-screen display method and the multi-screen display system provided by the embodiment of the invention have the following beneficial effects:
(1) When the comprehensive display requirements of multi-screen expansion and multi-screen copying exist at the same time, the problem of the black screen of a display connected with a GPU display interface can occur during multi-screen display due to the limited number of independent display channels of the GPU, and if the one-in-multi-out function of the GPU display interface is realized through external connection with other conversion equipment, the integration level of the system is low and the cost is high.
(2) According to the multi-screen display method, on the premise that conversion equipment is not externally connected, the display flow of each display interface is driven by the GPU and the design application program is communicated with the GPU drive, so that multi-screen expansion and multi-screen copying ordered display are realized, the actual application requirement of multi-screen display is met, additional conversion equipment is not externally connected, the integration level of the system is high, the miniaturization and light-weight design of products are facilitated, and the cost can be reduced.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and for those portions of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, 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, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (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 computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, 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 embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.