Screen projection method and related device
Data transmission is performed directly in the user mode through RDMA network card technology, which solves the problem of screen casting delay and lag, realizes efficient screen casting data transmission, and improves user experience and system performance.
Patent Information
- Application Number
- CN202310491797.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-28
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-04-28
AI Technical Summary
Existing screen projection technology has large delays and freezes in wireless environments, which affects user experience, especially when network conditions are poor.
Using Remote Direct Memory Access (RDMA) network card technology, data transmission is performed directly in user mode, avoiding context switching between data copying to the network software stack and kernel mode. The first electronic device can directly write screen projection information to the second electronic device. The device's memory space provides microsecond access latency and high throughput.
It effectively reduces the screen projection delay, improves fluency and user experience, reduces CPU load, and avoids image quality degradation caused by codec and data compression.
Smart Images

Figure CN118870080A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a screen projection method and related devices. Background Art
[0002] Screen projection technology can be used to project the display content or media files (gallery, music and video) of a smart terminal to one or more other devices. Screen projection technology covers scenarios such as mobile office, smart cars, and home smart screens. Multiple smart terminals form multi-screen linkage and synergy and complementarity, which is an important part of the establishment of a full-scenario ecosystem.
[0003] At present, since the devices on both sides of the wireless screen projection need to perform a series of processing such as encoding and decoding on the projection content, the projection delay is relatively large; when the network is poor or the network fluctuates greatly, the screen projection is prone to lag, and the user experience is poor. Summary of the invention
[0004] The present application provides a screen projection method and related devices, which can effectively reduce the screen projection delay, improve the screen projection smoothness, and enhance the user experience.
[0005] In a first aspect, the present application provides a screen projection method, which is applied to a screen projection system, wherein the screen projection system includes a first electronic device and a second electronic device, and the method includes: the first electronic device receives a first input operation, and the first input operation is used to trigger the first electronic device to project the screen to the second electronic device; based on the first input operation, the remote direct memory access (RDMA) network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, and the first request includes first screen projection information and the address of the second memory space of the second electronic device, and the first request is used to indicate that the first screen projection information is written to the second memory space; based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space; the second electronic device outputs the first screen projection information based on the data stored in the second memory space.
[0006] By implementing the embodiments of the present application, using the RDMA network card, data transmission can be performed directly in the user state; there is no need to copy the data to the network software stack, nor is there any need to perform context switching between the kernel state and the user state multiple times. The first electronic device can directly write the screen projection information stored in this device directly into the second memory space of the second electronic device; the RDMA network card can provide microsecond access latency and high throughput. In this way, after the first electronic device generates the screen projection information, the second electronic device can obtain and output the screen projection information in a very short time, effectively reducing the screen projection delay and improving the smoothness of the screen projection. In addition, using the RDMA network card, the second electronic device accesses the screen projection information in the specific memory of the first electronic device without the intervention of the central processing unit (CPU) of the first electronic device, effectively reducing the CPU load of the screen projection.
[0007] In one implementation, the first projection information includes image data of the first projection screen; the second electronic device outputs the first projection information based on the data stored in the second memory space, including: the display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space. When implementing the embodiment of the present application, after the first electronic device generates the projection screen, the second electronic device can obtain and display the projection screen in a very short time, which effectively reduces the projection delay and improves the projection fluency.
[0008] In one implementation, the first screen projection information includes audio data of the first screen projection audio; the second electronic device outputs the first screen projection information based on the data stored in the second memory space, including: the audio output device of the second electronic device outputs the first screen projection audio based on the data stored in the second memory space. When implementing the embodiment of the present application, after the first electronic device generates the screen projection audio, the second electronic device can obtain and display the screen projection audio in a very short time, which effectively reduces the screen projection delay and improves the smoothness of the screen projection.
[0009] In one implementation, before the RDMA network card of the first electronic device sends the first request to the RDMA network card of the second electronic device, it also includes: after the first electronic device detects that the first electronic device synthesizes the first projection information and stores it in the first memory space, the RDMA network card of the first electronic device generates a first request based on the first projection information in the first memory space. The implementation of the embodiment of the present application is combined with the existing caching mechanism of projection information, for example, the synthesized projection screen will be cached in the display buffer; when it is detected that the projection information is cached in the display buffer, it triggers the second electronic device to write the projection information to the first electronic device in a timely manner, effectively reducing the projection delay.
[0010] In one implementation, the first projection information includes image data of the first projection screen; the first electronic device and the second electronic device are synchronized in clock, and the above method further includes: in the first refresh cycle, writing the first projection screen into the first memory space of the first electronic device; in the next refresh cycle of the first refresh cycle, the display screen of the first electronic device displays the first projection screen based on the data stored in the first memory space; the RDMA network card of the second electronic device writes the first projection information into the second memory space, including: in the first refresh cycle, the RDMA network card of the second electronic device writes the first projection information into the second memory space; the second electronic device outputs the first projection information based on the data stored in the second memory space, including: in the next refresh cycle of the first refresh cycle, the display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space. In the implementation of the embodiment of the present application, when the clocks of the first electronic device and the second electronic device are synchronized, after the first electronic device generates the projection information, the second electronic device can obtain the projection screen in a very short time before the next refresh cycle arrives, and cache it in the display buffer; thereby, it can be ensured that the two electronic devices can simultaneously display the projection screen according to the data in the display buffer in the next refresh cycle, effectively improving the user experience.
[0011] In one implementation, after the first electronic device receives the first input operation, before the RDMA network card of the first electronic device sends the first request to the RDMA network card of the second electronic device, the method further includes: the second electronic device sends a first RDMA message to the first electronic device, the first RDMA message includes the address of the second memory space of the second electronic device, and the second memory space is used to store the projection information from the first electronic device. In implementing the embodiment of the present application, the second electronic device informs the first electronic device of the address of the second memory space for storing the projection information in advance, so that the first electronic device can use the RDMA network card to write the projection information to the second memory space of the second electronic device in a timely manner.
[0012] In one implementation, before the second electronic device sends the first RDMA message to the first electronic device, it also includes: the second electronic device registers the second memory space to the RDMA network card of the second electronic device, and obtains the first key corresponding to the address of the second memory space; the first RDMA message also includes the first key, and the first request also includes the first key; based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space, including: after the RDMA network card of the second electronic device determines that the first key included in the first request is the key corresponding to the address of the second memory space, the first screen projection information is written into the second memory space. In implementing the embodiment of the present application, the second electronic device registers the second memory space for storing screen projection information with the RDMA network card in advance to obtain the key corresponding to the second memory space; the key can ensure the security of subsequent data transmission between the first electronic device and the second electronic device.
[0013] In one implementation, before the RDMA network card of the second electronic device sends the first RDMA message to the RDMA network card of the first electronic device, it also includes: based on the first input operation, the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, and the first RDMA message and the first request are sent through the RDMA connection.
[0014] In one implementation, before the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, it also includes: in response to a first input operation, the first electronic device sends a screen projection request to the second electronic device through the first communication module; the first electronic device receives a screen projection response sent by the second electronic device through the first communication module; the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, including: when determining screen projection based on the screen projection response, the RDMA network card of the second electronic device and the RDMA network card of the first electronic device establish an RDMA connection.
[0015] In one implementation, after the second electronic device outputs the first screen projection information based on the data stored in the second memory space, the method includes: the second electronic device receives the second input operation; the second electronic device stores the first screen projection reverse control event corresponding to the second input operation in the third memory space; the RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, the second request includes the data of the first screen projection reverse control event and the address of the fourth memory space of the first electronic device, and the second request is used to indicate that the data of the first screen projection reverse control event is written into the fourth memory space; based on the second request, the RDMA network card of the first electronic device writes the data of the first screen projection reverse control event into the fourth memory space; based on the first screen projection reverse control event stored in the fourth memory space, the first electronic device executes a first response event. In implementing the embodiment of the present application, using the RDMA network card, data transmission can be performed directly in the user state; without copying the data to the network software stack, and without multiple context switches between the kernel state and the user state, the second electronic device can directly write the screen projection reverse control event stored by the second electronic device into the fourth memory space of the first electronic device. In this way, after the second electronic device generates a screen projection reverse control event, the first electronic device can obtain the screen projection reverse control event in a very short time, and then determine and execute the response event corresponding to the event in the fourth memory space according to the existing mechanism, effectively reducing the screen projection reverse control delay and improving the smoothness of screen projection. In addition, using the RDMA network card, the first electronic device accesses the screen projection reverse control event of the specific memory of the second electronic device, and the central processing unit (CPU) of the second electronic device does not need to intervene, which effectively reduces the CPU load of the screen projection reverse control.
[0016] In one implementation, before the RDMA network card of the second electronic device sends the second request to the RDMA network card of the first electronic device, it also includes: after the second electronic device detects that the first screen projection reverse control event is stored in the third memory space, the RDMA network card of the second electronic device generates a second request based on the data of the first screen projection reverse control event in the third memory space. The implementation of the embodiment of the present application is combined with the existing caching mechanism of input events, for example, the screen projection reverse control event will be cached in the event buffer; when it is detected that the above event is cached in the event buffer, it triggers the first electronic device to write the screen projection reverse control event to the second electronic device in a timely manner, effectively reducing the screen projection reverse control delay.
[0017] In one implementation, before the RDMA network card of the second electronic device sends the second request to the RDMA network card of the first electronic device, the method further includes: the first electronic device sends a second RDMA message to the second electronic device, the second RDMA message includes the address of the fourth memory space of the first electronic device, and the fourth memory space is used to store input events of the first electronic device. In implementing the embodiment of the present application, the first electronic device informs the second electronic device of the address of the fourth memory space for storing input events in advance, so that the second electronic device can use the RDMA network card to write the projection reverse control event into the fourth memory space of the first electronic device in a timely manner.
[0018] In a second aspect, the present application provides a screen projection method, applied to a first electronic device, including: the first electronic device receives a first input operation, the first input operation is used to trigger the first electronic device to project the screen to a second electronic device; based on the first input operation, the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the first request includes first screen projection information and the address of the second memory space of the second electronic device, and the first request is used to indicate that the first screen projection information is written to the second memory space.
[0019] By implementing the embodiments of the present application, using the RDMA network card, data transmission can be performed directly in the user state; there is no need to copy the data to the network software stack, nor is there any need to perform context switching between the kernel state and the user state multiple times. The first electronic device can directly write the screen projection information stored in this device directly into the second memory space of the second electronic device; the RDMA network card can provide microsecond access latency and high throughput. In this way, after the first electronic device generates the screen projection information, the second electronic device can obtain and output the screen projection information in a very short time, effectively reducing the screen projection delay and improving the smoothness of the screen projection. In addition, using the RDMA network card, the second electronic device accesses the screen projection information in the specific memory of the first electronic device without the intervention of the central processing unit (CPU) of the first electronic device, effectively reducing the CPU load of the screen projection.
[0020] In one implementation, the first screen projection information includes image data of the first projection screen; the first screen projection information stored in the second memory space is used to display the first projection screen on the display screen of the second electronic device.
[0021] In one implementation, the first screen projection information includes audio data of the first screen projection audio; the first screen projection information stored in the second memory space is used for the audio output device of the second electronic device to output the first screen projection audio.
[0022] In one implementation, before the RDMA network card of the first electronic device sends the first request to the RDMA network card of the second electronic device, it also includes: after the first electronic device detects that the first electronic device synthesizes the first screen projection information and stores it in the first memory space, the RDMA network card of the first electronic device generates a first request based on the first screen projection information in the first memory space.
[0023] In one implementation, after the first electronic device receives the first input operation and before the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the method further includes: the first electronic device receives a first RDMA message sent by the second electronic device, the first RDMA message includes an address of a second memory space of the second electronic device, and the second memory space is used to store screen projection information from the first electronic device.
[0024] In one implementation, before the RDMA network card of the second electronic device sends the first RDMA message to the RDMA network card of the first electronic device, it also includes: based on the first input operation, the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, and the first RDMA message and the first request are sent through the RDMA connection.
[0025] In one implementation, before the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, it also includes: in response to a first input operation, the first electronic device sends a screen projection request to the second electronic device through the first communication module; the first electronic device receives a screen projection response sent by the second electronic device through the first communication module; the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, including: when determining screen projection based on the screen projection response, the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection.
[0026] In one implementation, after the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the method includes: the RDMA network card of the first electronic device receives a second request sent by the RDMA network card of the second electronic device, the second request includes data of the first screen projection reverse control event and an address of a fourth memory space of the first electronic device, and the second request is used to indicate that the data of the first screen projection reverse control event is written into the fourth memory space; based on the second request, the RDMA network card of the first electronic device writes the data of the first screen projection reverse control event into the fourth memory space; based on the first screen projection reverse control event stored in the fourth memory space, the first electronic device executes a first response event.
[0027] In one implementation, before the RDMA network card of the first electronic device receives the second request sent by the RDMA network card of the second electronic device, the method further includes: the first electronic device sends a second RDMA message to the second electronic device, the second RDMA message includes the address of the fourth memory space of the first electronic device, and the fourth memory space is used to store input events.
[0028] In the third aspect, the present application provides a screen projection method, which is characterized in that it is applied to a second electronic device, including: the RDMA network card of the second electronic device receives a first request sent by the RDMA network card of the first electronic device, the first request includes first screen projection information and the address of the second memory space of the second electronic device, and the first request is used to indicate that the first screen projection information is written to the second memory space; based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space; the second electronic device outputs the first screen projection information based on the data stored in the second memory space.
[0029] By implementing the embodiments of the present application, using the RDMA network card, data transmission can be performed directly in the user state; there is no need to copy the data to the network software stack, nor is there any need to perform context switching between the kernel state and the user state multiple times. The first electronic device can directly write the screen projection information stored in this device directly into the second memory space of the second electronic device; the RDMA network card can provide microsecond access latency and high throughput. In this way, after the first electronic device generates the screen projection information, the second electronic device can obtain and output the screen projection information in a very short time, effectively reducing the screen projection delay and improving the smoothness of the screen projection. In addition, using the RDMA network card, the second electronic device accesses the screen projection information in the specific memory of the first electronic device without the intervention of the central processing unit (CPU) of the first electronic device, effectively reducing the CPU load of the screen projection.
[0030] In one implementation, the first projection information includes image data of the first projection screen; the second electronic device outputs the first projection information based on the data stored in the second memory space, including: the display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space.
[0031] In one implementation, the first screen projection information includes audio data of the first screen projection audio; the second electronic device outputs the first screen projection information based on the data stored in the second memory space, including: the audio output device of the second electronic device outputs the first screen projection audio based on the data stored in the second memory space.
[0032] In one implementation, before the RDMA network card of the second electronic device receives the first request sent by the RDMA network card of the first electronic device, the method further includes: the second electronic device sends a first RDMA message to the first electronic device, the first RDMA message includes the address of a second memory space of the second electronic device, and the second memory space is used to store the screen projection information from the first electronic device.
[0033] In one implementation, before the second electronic device sends the first RDMA message to the first electronic device, it also includes: the second electronic device registers the second memory space to the RDMA network card of the second electronic device, and obtains the first key corresponding to the address of the second memory space; the first RDMA message also includes the first key, and the first request also includes the first key; based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space, including: after the RDMA network card of the second electronic device determines that the first key included in the first request is the key corresponding to the address of the second memory space, the first screen projection information is written into the second memory space.
[0034] In one implementation, before the RDMA network card of the second electronic device sends the first RDMA message to the RDMA network card of the first electronic device, the process also includes: the RDMA network card of the second electronic device and the RDMA network card of the first electronic device establish an RDMA connection, and the first RDMA message and the first request are sent through the RDMA connection.
[0035] In one implementation, after the second electronic device outputs the first screen projection information based on the data stored in the second memory space, the method includes: the second electronic device receives the second input operation; the second electronic device stores the first screen projection reverse control event corresponding to the second input operation in the third memory space; the RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, the second request includes the data of the first screen projection reverse control event and the address of the fourth memory space of the first electronic device, the second request is used to indicate that the data of the first screen projection reverse control event is written to the fourth memory space, and the fourth memory space is used to store the input event of the first electronic device.
[0036] In one implementation, before the RDMA network card of the second electronic device sends the second request to the RDMA network card of the first electronic device, it also includes: after the second electronic device detects that the first screen projection reverse control event is stored in the third memory space, the RDMA network card of the second electronic device generates a second request based on the data of the first screen projection reverse control event in the third memory space.
[0037] In one implementation, before the RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, the method further includes: the second electronic device receives a second RDMA message sent by the first electronic device, the second RDMA message including the address of the fourth memory space of the first electronic device.
[0038] In a fourth aspect, the present application provides an electronic device, comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions. When the one or more processors execute the computer instructions, the communication device executes the screen projection method in any possible implementation of the second aspect.
[0039] In a fifth aspect, the present application provides another electronic device, comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions. When the one or more processors execute the computer instructions, the communication device executes the screen projection method in any possible implementation of the third aspect.
[0040] In a sixth aspect, an embodiment of the present application provides a computer storage medium, including computer instructions. When the computer instructions are executed on an electronic device, the communication device executes the screen projection method in any possible implementation of any of the above aspects.
[0041] In the seventh aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the screen projection method in any possible implementation of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;
[0043] Figure 2A A schematic diagram of a vehicle-mounted display screen provided in an embodiment of the present application;
[0044] Figure 2B A schematic diagram of a vehicle-mounted device provided in an embodiment of the present application;
[0045] Figure 2C to Figure 2F A schematic diagram of a screen projection scenario provided in an embodiment of the present application;
[0046] FIG. 3A to FIG. 3C A schematic diagram of a screen projection scenario provided in an embodiment of the present application;
[0047] Figure 4A schematic diagram of a screen projection scenario provided in an embodiment of the present application;
[0048] Figure 5A A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0049] Figure 5B A software structure block diagram of an electronic device provided in an embodiment of the present application;
[0050] Fig. 6A A schematic diagram of a screen sharing method provided in an embodiment of the present application;
[0051] Figure 6B A flowchart for implementing screen sharing combined with a software structure provided in an embodiment of the present application;
[0052] Figure 6C A schematic diagram of a method flow for audio sharing provided in an embodiment of the present application;
[0053] Fig. 7A A schematic diagram of a method flow for reverse control of screen projection provided in an embodiment of the present application;
[0054] Figure 7B A flowchart for implementing screen projection reverse control combined with a software structure provided in an embodiment of the present application;
[0055] Figure 8 A schematic diagram of an RDMA software stack provided in an embodiment of the present application;
[0056] Fig.9A A schematic diagram of a screen sharing method provided in an embodiment of the present application;
[0057] Fig. 9B A flowchart for implementing screen sharing combined with a software structure provided in an embodiment of the present application;
[0058] Fig. 9C A flowchart of an RDMA implementation provided in an embodiment of the present application;
[0059] Fig.9D A timing diagram of a refresh cycle provided in an embodiment of the present application;
[0060] Fig.9E A schematic diagram of a method flow for audio sharing provided in an embodiment of the present application;
[0061] Fig.9F A flowchart for implementing audio sharing combined with a software structure provided in an embodiment of the present application;
[0062] Fig. 10A A schematic diagram of a method flow for reverse control of screen projection provided in an embodiment of the present application;
[0063] Fig. 10B A flowchart for implementing screen projection reverse control combined with a software structure provided in an embodiment of the present application;
[0064] Fig. 10C A schematic diagram of a method flow for audio sharing provided in an embodiment of the present application;
[0065] Fig.11 A flowchart of a screen projection method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0067] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0068] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that can be recognized by the user. The commonly used form of user interface is a graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0069] The following introduces the communication system 10 involved in the embodiment of the present application.
[0070] Figure 1 The structure diagram of a communication system 10 provided in an embodiment of the present application is exemplarily shown. Figure 1 As shown, the communication system 10 includes an electronic device 100 and one or more electronic devices connected to the electronic device 100, such as an electronic device 200.
[0071] In an embodiment of the present application, the electronic device 100 can use the screen projection technology to send specific content (such as the display content of the physical screen, the user interface of a specific application, or a media file) to one or more connected electronic devices, such as the electronic device 200; the electronic device 200 can perform interface display and / or audio output based on the data sent by the electronic device 100. On the electronic device 100 side, the user can locally control the screen projection content of the electronic device 100 to the electronic device 200; on the electronic device 200 side, through the above-mentioned screen projection content, the user can also reversely control the electronic device 100. In some embodiments, the electronic device 100 is configured with a system on chip (System on Chip, SOC) 1, and SOC1 is used to support the synthesis, rendering and display of the screen image of the electronic device 100; the electronic device 200 is configured with SOC2, and SOC2 is used to support the synthesis, rendering and display of the screen image of the electronic device 200; using the screen projection method provided in the embodiment of the present application, the electronic device 100 and the electronic device 200 can achieve cross-chip screen viewing and device collaboration.
[0072] In some embodiments, the electronic device 100 can be directly connected to the electronic device 200 via a local wired connection. In one implementation, the electronic device 100 is configured with an RDMA network card 1, and the electronic device 200 is configured with an RDMA network card 2. The RDMA network card 1 of the electronic device 100 and the electronic device 100 and the RDMA network card 2 establish a wired connection (e.g., Ethernet connection / IB connection) based on the RDMA network protocol. In some embodiments, the electronic device connects the RDMA network card by using a peripheral component interconnect express (PCIE) bus. The PCIe protocol is an end-to-end interconnection protocol that provides a solution for high-speed transmission bandwidth.
[0073] In some embodiments, the electronic device 100 can be directly connected to the electronic device 200 via a short-range wireless communication connection. Exemplarily, the electronic device 100 and the electronic device 200 can have one or more short-range communication modules such as a near field communication (NFC) communication module, a wireless fidelity (WiFi) communication module, an ultra wide band (UWB) communication module, a Bluetooth (bluetooth) communication module, a ZigBee communication module, etc. Taking the electronic device 100 as an example, the electronic device 100 can detect and scan electronic devices near the electronic device 100 by transmitting signals through a short-range communication module (such as an NFC communication module), so that the electronic device 100 can discover nearby electronic devices (such as electronic device 200) through a short-range wireless communication protocol, and establish a wireless communication connection with nearby electronic devices, and transmit data to nearby electronic devices. For example, the electronic device 100 is connected to the electronic device 200 via WiFi-direct.
[0074] In some embodiments, the electronic device 100 and the electronic device 200 can be connected to a local area network (LAN) through the electronic device 300 based on a wired connection or a WiFi connection. For example, the electronic device 300 can be a third-party device such as a router, a gateway, or an intelligent device controller. In some embodiments, the electronic device 100 and the electronic device 200 can also be indirectly connected through at least one electronic device 400 in a wide area network. For example, the electronic device 400 can be a hardware server or a cloud server implanted in a virtualized environment. It can be understood that through the electronic device 300 and / or the electronic device 400, the electronic device 100 can indirectly connect to the electronic device 200 for wireless communication and data transmission.
[0075] It can be understood that the structure shown in this embodiment does not constitute a specific limitation on the communication system 10. In other embodiments of the present application, the communication system 10 may include more or less devices than those shown in the figure.
[0076] The embodiment of the present application does not specifically limit the types of the electronic device 100 and the electronic device 200. For example, the electronic device 100 and the electronic device 200 involved in the embodiment of the present application can be a mobile phone, a wearable device (for example, a smart bracelet, a smart watch), a tablet computer, a laptop computer (laptop), a handheld computer, a notebook computer, a vehicle-mounted device, a smart TV, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a cellular phone, a personal digital assistant (personal digital assistant, PDA), an augmented reality (Augmented reality, AR)\virtual reality (virtual reality, VR) device, etc. In some embodiments, the electronic device 200 can also be a projection device such as a projector.
[0077] In an exemplary scenario, electronic device 100 and electronic device 200 belong to the same device system (e.g., an in-vehicle device). For example, electronic device 100 and electronic device 200 belong to the same in-vehicle device of a smart car. With the development of smart cars, there are more and more in-vehicle display screens of smart cars, including multiple screens such as instruments, AR-HUD, central control screen, co-pilot screen, rear screen (e.g., left rear screen and right rear screen), and window screen. For example, Figure 2A The figure shows multiple screens of a smart car. It is difficult for the GPU computing power of one SOC in the vehicle equipment to meet the needs of composite rendering of all screen images, so some manufacturers have introduced two or more SOCs for collaborative processing.
[0078] For example, Figure 2B As shown, taking two SOCs (i.e., SOC1 and SOC2) as an example, the above-mentioned vehicle-mounted device may include an electronic device 100 and an electronic device 200. The electronic device 100 includes SOC1 and a vehicle-mounted display screen (e.g., a co-pilot screen) controlled by SOC1, and the electronic device 200 includes SOC2 and a vehicle-mounted display screen (e.g., a rear screen) controlled by SOC2. The user can project the screen content of the display screen controlled by SOC1 of the vehicle-mounted device to one or more display screens controlled by SOC2.
[0079] For example, take the example of projecting the co-pilot screen controlled by SOC1 to the rear screen controlled by SOC2. Figure 2C to Figure 2F An interface implementation for screen projection between vehicle-mounted display screens is shown.
[0080] like Figure 2C As shown, the co-pilot screen plays video 1 in the user interface 11 of APP1; after detecting the user's input operation 1, the co-pilot screen displays Figure 2DThe screen projection selection interface 12 shown is used to select the screen projection content, target device and / or target screen. In one implementation, Figure 2C As shown, the user interface 11 displays a screen projection icon 101, and the input operation 1 includes a click operation on the screen projection icon 101. The embodiment of the present application does not specifically limit the input operation 1, and the input operation 1 can also act on other vehicle-mounted display screens, and the input operation 1 can also include other touch operations, voice operations, or gesture operations.
[0081] like Figure 2D As shown, the screen projection selection interface 12 includes a list of screens that can be projected in the vehicle, and the screen list may include options for any display screen other than the co-pilot screen, for example, option 102 for the right rear screen. The user can select one or more display screens in the screen list for projection.
[0082] like Figure 2D As shown, the screen projection selection interface 12 may also include a list of devices that can be projected, and the device list includes options for other devices that can be projected, such as a mobile phone option 103. The user can select one or more devices in the screen list for projection.
[0083] like Figure 2D As shown, the screen projection selection interface 12 may also include a list of contents that can be projected, and the content list includes option 104 corresponding to the display screen (i.e., the main screen screen) of the main screen (i.e., the physical screen) of the co-pilot screen, and may also include options corresponding to some applications installed on the co-pilot screen (e.g., option 105 of APP2). If the user selects option 104 of the main screen screen, the current main screen screen of the co-pilot screen will be projected to the target device and / or target screen; if the user selects option 105 of APP2, SOC1 runs APP2 on the virtual display screen, and projects the display content of the virtual display screen to the target device and / or target screen, that is, the projected content and the main screen screen of the co-pilot screen can be different, and will not affect the normal display of the co-pilot screen.
[0084] like Figure 2D and Figure 2E As shown, the screen projection selection interface 12 may also include a confirmation control 106; after the user selects the option 102 of the right rear screen and the option 104 of the main screen, the electronic device 100 detects that the user clicks the confirmation control 106; in response to the user's click operation, the electronic device 100 sends the projection data to the electronic device 200; based on the above projection data, the electronic device 200 projects the projection screen on the right rear screen, that is, the main screen of the co-pilot screen. When projecting, the right rear screen can only display the projection screen, or it can superimpose the projection screen in the form of a small window on the original display interface, which is not specifically limited here.
[0085] It can be understood that when the main screen of the co-pilot screen controlled by the user changes, the projection screen displayed on the right rear screen also changes accordingly; through the above projection screen, the user can also reversely control the co-pilot screen on the right rear screen. Figure 2F As shown, the pause operation of the user on the projection screen displayed on the right rear screen is detected (for example, a click operation on the video playback area of video 1 in the user interface 11); in response to the above-mentioned pause operation, the electronic device 100 corresponding to the co-pilot screen controls the pause of video 1, and both the co-pilot screen and the right rear screen display the pause interface 13, and the pause interface 13 indicates that video 1 is currently paused.
[0086] In another exemplary scenario, the electronic device 100 is a mobile phone, and the electronic device 200 is a large-screen device (such as a vehicle-mounted device, etc.). The mobile phone projects the user interface displayed on the screen to the large-screen device, and the user interface of the mobile phone displayed on the large-screen device can reversely control the mobile phone.
[0087] For example, Figure 3A As shown, the mobile phone detects the user's screen projection operation, which is used to trigger the screen projection to the central control screen of the vehicle-mounted device; in response to the above screen projection operation, the mobile phone sends a screen projection request to the vehicle-mounted device; the vehicle-mounted device displays a screen projection prompt box in the central control according to the screen projection request, and the screen projection prompt box is used to prompt the user to confirm whether to allow the mobile phone to project the screen. The screen projection prompt box includes a confirmation control 201 and a cancel control 202. The confirmation control 201 is used to confirm the screen projection, and the cancel control 202 is used to reject the screen projection. Reference FIG. 2C to FIG. 2E The user can also select the target device, target screen and / or screen projection content on the mobile phone, which will not be repeated here. The operation of the user triggering the screen projection is not specifically limited here.
[0088] like Figure 3A and Figure 3B As shown, after the vehicle-mounted device detects that the user clicks the confirmation control 201, the projection screen is displayed according to the projection data sent by the mobile phone, and the projection screen includes the user interface 11 currently displayed by the mobile phone. In some embodiments, no user confirmation is required, that is, no projection prompt box is required to be displayed, and the vehicle-mounted device can directly display the projection screen according to the projection data sent by the mobile phone.
[0089] like Figure 3B and Figure 3C As shown, the user interface 11 includes an icon 203 of the gallery application; after the vehicle-mounted device detects that the user clicks the icon 203 in the projection screen, the mobile phone displays the user interface 23 of the gallery application, and the vehicle-mounted device also displays the user interface 23 of the gallery application in the projection screen. That is, the user controls the mobile phone on the vehicle-mounted device side to open the gallery application.
[0090] In another exemplary scenario, the projection content sent by the electronic device 100 to the electronic device 200 has undergone immersive processing, and immersive processing refers to performing corresponding image processing (such as cropping, selecting, changing color, adding filters, etc.) on the projection screen according to the projection effect selected by the user. The above-mentioned projection effect and the corresponding image processing method are not specifically limited here.
[0091] For example, Figure 4 An immersive screen projection scenario is shown. Figure 4 As shown, the electronic device 100 projects the screen to the electronic device 200 and the electronic device 500. The projected screens displayed by the electronic device 500 and the electronic device 200 are images after the wallpaper of the electronic device 100 is cropped, discolored, and the transparency is modified. After the screen is projected, the electronic device 200, the electronic device 100, and the electronic device 500 are combined to form a specific visual effect.
[0092] The structure of the electronic device involved in the embodiments of the present application is exemplarily described below.
[0093] Figure 5A 1 shows a schematic diagram of the structure of the electronic device 100. The structure of the electronic device 200 can refer to the relevant description of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0094] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0095] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0096] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0097] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0098] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0099] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0100] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0101] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0102] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0103] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0104] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0105] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0106] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0107] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0108] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0109] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0110] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0111] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0112] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0113] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0114] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0115] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0116] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0117] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0118] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0119] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0120] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0121] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0122] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0123] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0124] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0125] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.
[0126] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0127] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0128] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.
[0129] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0130] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0131] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0132] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0133] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by approaching the microphone 170C with his mouth to input the sound signal into the microphone 170C.
[0134] The earphone jack 170D is used to connect a wired earphone.
[0135] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
[0136] The gyro sensor 180B may be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) may be determined by the gyro sensor 180B.
[0137] The air pressure sensor 180C is used to measure air pressure.
[0138] The magnetic sensor 180D includes a Hall sensor.
[0139] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0140] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser.
[0141] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.
[0142] The ambient light sensor 180L is used to sense the brightness of ambient light.
[0143] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking.
[0144] The temperature sensor 180J is used to detect the temperature.
[0145] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0146] Bone conduction sensor 180M can obtain vibration signals.
[0147] The buttons 190 include a power button, a volume button, etc. The buttons 190 may be mechanical buttons or touch buttons.
[0148] Motor 191 can generate vibration prompts.
[0149] The indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, etc.
[0150] The SIM card interface 195 is used to connect a SIM card.
[0151] The software structures of the electronic device 100 and the electronic device 200 involved in the embodiments of the present application are introduced below.
[0152] In the embodiments of the present application, the electronic device may be equipped with iOS, Android, Microsoft or other software systems, and the software system is not specifically limited here. The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The following takes the electronic device 100 and the Android system of the layered architecture as an example to illustrate the software structure of the electronic device. The software structure of the electronic device 200 can refer to the relevant description of the electronic device 100.
[0153] Figure 5B 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.
[0154] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer (Application), the application framework layer (Application Framework), the hardware abstraction layer (HAL), the local service (Native) layer and the kernel layer (Kernel). In one implementation, the layers above the kernel layer (Kernel) belong to the user state of the software system, and the kernel layer (Kernel) belongs to the kernel state of the software system.
[0155] The application layer can include a series of application packages. Figure 5B As shown, the application package may include screen projection applications, video applications, and may also include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, short message and other applications.
[0156] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0157] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0158] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0159] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0160] The Native layer is composed of some local services and link libraries. For performance reasons, applications (APPs) need to use C / C++ implementation solutions in the Native layer. The Native layer then provides solutions to the Java layer that implements the basic functions of the application through JNI to expand some computing-intensive functions.
[0161] The kernel layer is the layer between hardware and software. The kernel layer provides low-level drivers for various hardware, such as WiFi drivers, Bluetooth drivers, mobile communication drivers, display drivers, audio drivers, keyboard drivers, power drivers, sensor drivers (such as touch sensor drivers), etc. It is also responsible for file management, process management, network protocol stack, system security, and memory management.
[0162] The HAL layer is the interface layer between the kernel and the hardware circuit. Its purpose is to abstract the hardware and provide a virtual hardware platform and services for the operating system; it converts upper-layer calls into direct access and control of the hardware. The specific activity is to establish hardware-related drivers.
[0163] In some embodiments, Figure 5B As shown, the application framework layer may include a window management service (WindowManagerService, WMS), the Native layer includes a Surfaceflinger, and the HAL layer includes a hardware synthesizer (hwcomposer, HWC).
[0164] Among them, WMS is used to manage window programs and manage the entire life cycle, hierarchy and properties of window displays. For example, WMS is responsible for starting, adding and deleting windows, obtaining the size of the display screen, determining whether there is a status bar, locking the screen, capturing the screen, etc. Surfaceflinger is used to synthesize multiple layers (layers) rendered from WMS, and then send the synthesized image to the display device for display. After collecting all buffers (buffers) of visible layers, SurfaceFlinger will ask HWC how to synthesize. The synthesis methods of layers include GPU synthesis and HWC synthesis; GPU synthesis refers to the GPU using OpenGL to synthesize layers; HWC synthesis refers to the use of display controllers (Display controller) to synthesize layers. HWC can reduce the synthesis pressure of the GPU by synthesizing layers through hardware devices.
[0165] Exemplarily, when an application (such as APP1) starts an activity, it calls WMS to create and register an application window (window) corresponding to the Activity. When APP1 displays the window in the foreground, WMS instructs SurfaceFlinger to create a surface (layer) for the window. Based on the graphics drawing instructions of APP1, WMS calls the CPU / GPU to draw and render each layer, and caches them in the buffer queue (BufferQueue) respectively; Surfaceflinger receives the layer data in the buffer of all visible layers (layer) and then synthesizes them. For example, the layers displayed on the screen usually include the status bar at the top of the screen, the navigation bar (system bar) below the screen, and the UI part of the app (ie, the application interface, icons and / or plug-ins), and can also include background wallpaper (background).
[0166] In some embodiments, Figure 5B As shown, the application framework layer may include mediacodec, the Native layer includes a video encoder and a video decoder, and the HAL layer includes videocodec. The video encoder of the Native layer is used to call videocodec to encode the synthesized image and obtain the encoded video stream; correspondingly, the video decoder is used to call videocodec to decode the encoded video stream. MediaCodec is a class in the application framework layer used to encode and decode audio and video, including encoder / decoder components, which implements the encoding and decoding functions by accessing the underlying Codec.
[0167] In some embodiments, Figure 5B As shown, the application framework layer may include an audio recording module (Audiorecoder), the Native layer includes Audioflinger, an audio encoder and an audio decoder, and the HAL layer includes an audio HAL (Audio HAL). Among them, the audio recording module is used to record the audio file output by the application (such as APP1) and obtain the recorded audio. The Audioflinger of the Native layer is used to synthesize the audio sent by the application layer; the audio encoder is used to call Audiocodec to encode the synthesized audio; correspondingly, the audio decoder is used to call Audiocodec to decode the encoded audio.
[0168] In some embodiments, Figure 5BAs shown, the Native layer includes the input subsystem, and the HAL layer includes IO device nodes (e.g., / dev / input / eventX). Among them, there are many kinds of input devices for Android, such as screen, keyboard, mouse, game controller, joystick, etc. When the input device is available, the Linux kernel will create the corresponding IO device node in / dev / input, and different input devices correspond to different IO device nodes. When an input operation is performed through an input device (e.g., a screen), the driver corresponding to the input device (e.g., a touch sensor driver) processes the corresponding input information (e.g., hardware interrupts) into raw input events (including touch coordinates, touch timestamps, etc.), and stores them in the IO device nodes corresponding to the input device. The Input subsystem can retrieve the raw input event from the IO device node; the input event is encapsulated and submitted to the target window (Window) for processing.
[0169] In some embodiments, Figure 5B As shown, the kernel layer may also include a driver for driving the communication module 1 to work; for example, the communication module 1 includes one or more of a short-range wireless communication module (such as a WiFi communication module, a Bluetooth communication module or a UWB communication module, etc.), a mobile communication module and a wired communication module, etc., and accordingly, the kernel layer may include one or more of a WiFi driver, a Bluetooth driver, a UWB driver, a mobile communication driver, etc.
[0170] The following is a detailed introduction to the two implementation schemes of screen projection provided by this application in combination with the aforementioned software structure.
[0171] In the embodiment of the present application, the screen projection scheme includes two parts: screen sharing and screen projection reverse control. The specific implementation of screen sharing and screen projection reverse control in the two implementation schemes are introduced below. For ease of description, the subsequent embodiments may also refer to the electronic device 100 as the source device of the screen projection, and the electronic device 200 as the target device of the screen projection.
[0172] Solution 1: Screen projection solution based on codec
[0173] For example, Fig. 6A A screen sharing method for this solution is given below. Figure 6B The implementation process of screen sharing shown in the figure introduces the method process of screen sharing, which includes steps S101 to S109.
[0174] S101 . The electronic device 100 displays the user interface 1 of APP1 .
[0175] In some embodiments, before the electronic device 100 is projected to the electronic device 200, the electronic device 100 runs and displays the user interface 1 of APP1. Step S101 includes: APP1 sends a drawing instruction to WMS; WMS draws and renders the display content of each layer of the user interface 1 of APP1 based on the drawing instruction, and the above-mentioned drawing instruction can indicate the view (view) corresponding to each layer of the user interface, and the properties of each view (such as size, position, transparency); WMS instructs surfaceflinger to synthesize each layer; surfaceflinger calls GPU synthesis and HWC synthesis to obtain the synthesized user interface 1; HWC caches the synthesized user interface 1 in a preset buffer; the display driver sends the user interface 1 to the physical display screen of the electronic device 100 based on the data in the buffer.
[0176] In the embodiment of the present application, APP1 can be a third-party application (such as a video application) or a system application (such as a desktop application), which is not specifically limited here.
[0177] S102. After the electronic device 100 receives the screen projection operation from the user, the IO device node (ie, / dev / input / eventX) of the electronic device 100 stores the screen projection trigger event corresponding to the screen projection operation.
[0178] In some embodiments, the user triggers screen projection by a touch operation on the display screen. Step S102 includes: (1) After the touch sensor in the physical display screen detects the screen projection operation, the hardware perception information corresponding to the screen projection operation is sent to the touch sensor driver; (2) The touch sensor driver processes the hardware perception information into raw input events (for example, raw input events include touch coordinates, touch timestamps and other information), and stores them in the IO device node corresponding to the display screen (for example, / dev / input / eventX). For ease of description, the above raw input events can be referred to as screen projection trigger events.
[0179] For example, see Figure 2C In the example described, the screen projection operation may include a click operation on the confirmation control 106 displayed on the display screen. Not limited to the touch operation on the display screen, the screen projection operation involved in the embodiment of the present application may also be an input operation performed by other input devices (such as a mouse, a remote control), or may be other forms of input operations such as voice operation and gesture operation, which are not specifically limited here.
[0180] S103. The screen projection trigger event in the IO device node of the electronic device 100 is distributed to the screen projection application.
[0181] In some embodiments, step S103 includes: (3) the input subsystem reads the above original input event (i.e., the screen projection trigger event) from the IO device node. (4) the input subsystem distributes the above screen projection trigger event to the screen projection application. In one implementation, after the IMS detects the screen projection trigger event output by the above input subsystem, it calls the WMS to determine the target window corresponding to the touch event according to the layout of each window in the main screen. The target application corresponding to the above screen projection trigger event is the screen projection application to which the target window belongs.
[0182] S104 , the screen projection application instructs drawing a composite projection screen 1 to be projected to the electronic device 200 , and the composite projection screen 1 is cached in display buffer 1 .
[0183] In some embodiments, the above-mentioned screen projection trigger event indicates that the target device for screen projection is the electronic device 200, and the electronic device 100 creates a virtual display screen 1 corresponding to the electronic device 200, and the virtual display screen 1 is used to run the projection screen to the electronic device 200. When the user selects multiple target devices for screen projection, a virtual display screen is created for each target device. In some embodiments, the projection content is the main screen of the electronic device 100. There is no need to establish a virtual display screen, and the main screen of the electronic device 100 can also be projected to the electronic device 200, such as the mirror projection technology.
[0184] In some embodiments, step S104 includes: the screen projection application of the electronic device 100 establishes a business connection with the screen projection application of the electronic device 100; (5) the screen projection application instructs the WMS to create a virtual display screen 1 corresponding to the electronic device 200; (6) the WMS instructs the surfaceflinger to create the virtual display screen 1; (7) the surfaceflinger calls the GPU synthesis and the HWC synthesis to synthesize the projection screen 1 corresponding to the virtual display screen 1. The HWC stores the synthesized projection screen 1 in a preset buffer (i.e., display buffer 1). For ease of description, the buffer in the memory space of the electronic device 100 used to store the projection screen of the electronic device 200 (e.g., the image to be displayed on the virtual display screen 1) can be referred to as the display buffer of the electronic device 100 (e.g., display buffer 1). In some embodiments, the display screen of the electronic device 100 is the projection screen projected to the electronic device 200, and the above-mentioned display buffer 1 is used to cache the screen to be displayed of the electronic device 100; the electronic device 100 displays based on the image data in the display buffer 1 in the next refresh cycle.
[0185] In some embodiments, reference FIG. 2C to FIG. 2EAs described in the related description, the screen projection trigger event triggered by the user can indicate one or more of the target device, target screen and projection content of the screen projection. The electronic device 100 creates a corresponding virtual display screen according to the target device selected by the user, and determines the display content of the virtual display screen (i.e., the projection screen) according to the projection content selected by the user.
[0186] In some embodiments, when the projection content selected by the user is the main screen of the electronic device 200, and the main screen of the electronic device 200 includes the user interface 1 of APP1, the projection screen 1 includes the user interface 1; when the projection content selected by the user is not the main screen of the electronic device 200, the projection screen 1 and the main screen of the electronic device 200 may be different.
[0187] S105. The electronic device 100 encodes the projection image 1 and obtains the projection data 1.
[0188] In some embodiments, step S105 includes: (8) the video encoder obtains image data of the projection screen 1 in the display buffer 1; (9) the video encoder calls videocode to encode the above projection screen and obtain the encoded video stream; (10) videocodec sends the encoded video stream to mediacodec; (11) mediacodec sends the encoded video stream to the projection application, the projection application encrypts and packages the above data to obtain the projection data 1.
[0189] S106 , the electronic device 200 encapsulates the screen projection data 1 using the communication protocol, and then sends the encapsulated screen projection message 1 through the communication module 1 .
[0190] In some embodiments, the communication module 1 may be a wireless communication module such as a short-range communication module (e.g., a WiFi communication module, a Bluetooth communication module), a mobile communication module, or the like. Taking the WiFi communication module as an example, step S105 includes: (12) the screen projection application sends the screen projection data 1 to the TCP / IP protocol stack; (13) the TCP / IP protocol stack uses the TCP / IP protocol to encapsulate the screen projection data 1 into a screen projection message 1, and then sends the screen projection message 1 to the WiFi driver; (14) the WiFi driver sends the screen projection message 1 to the WiFi communication module; (15) the WiFi communication module sends the screen projection message 1 to the electronic device 200. It can be understood that the screen projection message 1 includes the screen projection data 1.
[0191] Not limited to the TCP / IP protocol, the embodiments of the present application can also send screen projection messages through other communication protocols, which are not specifically limited here.
[0192] S107. After decapsulating the screen projection message 1, the screen projection application of the electronic device 200 obtains the screen projection data 1.
[0193] In some embodiments, taking the WiFi communication module as an example, step S106 includes: (16) the WiFi driver obtains the screen projection message 1 through the WiFi communication module; (17) the WiFi driver sends the screen projection message 1 to the TCP / IP protocol stack; (18) the TCP / IP protocol stack uses the TCP / IP protocol to decapsulate the screen projection data 1, and then sends the decapsulated screen projection data 1 to the screen projection application.
[0194] S108. The electronic device 200 decodes the projection data 1 and obtains the decoded projection image 1.
[0195] In some embodiments, step S108 includes: (19) the screen projection application packages and decrypts the projection data 1, and sends it to Mediacodec; (20) Mediacodec decodes the audio and video of the data sent by the screen projection application, and sends it to the video decoder; (21) the video decoder calls Videocodec to decode the data sent by Mediacodec to obtain the image data of the projection screen 1; (22) Videocodec sends the image data of the projection screen 1 to the screen projection application.
[0196] S109, the electronic device 200 stores the projection screen 1 in the display buffer 2, and the physical display screen displays the projection screen 1 according to the image data of the projection screen 1 cached in the display buffer 2.
[0197] In some embodiments, step S109 includes: (23) the screen projection application instructs WMS to display the projection screen 1 in the projection window; (24) WMS instructs surfaceflinger to perform layer synthesis; (25) surfaceflinger calls GPU synthesis and HWC synthesis; (26) HWC stores the synthesized projection screen 1 in display buffer 2; (27) the display driver sends the projection screen 1 to the physical display screen of the electronic device 200 based on the image data in display buffer 2. In some embodiments, the buffer in the memory space of the electronic device 200 for storing the projection screen from the electronic device 100 can be referred to as the display buffer of the electronic device 200 (for example, display buffer 2), and the physical display screen of the electronic device 200 displays the projection screen 1 based on the data in display buffer 2. In some embodiments, display buffer 2 is used to cache the latest synthesized image output by the SF / HWC of the electronic device 200, that is, the image to be displayed on the physical display screen of the electronic device 200 in the next refresh cycle.
[0198] In some embodiments, the electronic device 200 can simultaneously display the projection screen and the interfaces of other applications installed on the electronic device 200; surfaceflinger collects the buffers of all visible layers for image synthesis, and the buffers of the visible layers include display buffer 2 corresponding to the projection screen 1. In this case, the synthesized display screen includes the projection screen 1 and the interfaces of other applications; the display driver sends the above display screen to the physical display screen of the electronic device 200.
[0199] In some embodiments, the screen projection image sent by the electronic device 100 to the electronic device 200 is playing audio and video. During the screen projection process, the electronic device 100 also sends the audio corresponding to the screen projection image to the electronic device 200. For ease of description, the audio can be referred to as screen projection audio. Figure 6C The screen projection solution provided in the embodiment of the present application also includes audio sharing, and the method flow of audio sharing includes steps S110 to S115.
[0200] S110. The screen projection application of the electronic device 100 instructs to synthesize the screen projection audio; and stores the audio data of the synthesized screen projection audio 1 in audio buffer 1.
[0201] In some embodiments, (28) the audio recording module records the audio file sent by the upper-layer application (e.g., APP1), stores the recorded audio in a buffer, and notifies the Audioflinger; (29) the Audioflinger synthesizes the projection audio 1 based on the audio data in one or more buffers; the Audio HAL obtains the synthesized projection audio 1 and stores it in the audio buffer 1. For ease of description, the buffer in the memory space of the electronic device 100 for storing the projection audio of the electronic device 200 (e.g., the audio to be output of the virtual display screen 1) can be referred to as the audio buffer of the electronic device 100 (e.g., audio buffer 1). In some embodiments, the output audio of the electronic device 100 is the projection audio sent to the electronic device 200, and the above-mentioned audio buffer 1 is used to cache the audio to be output of the electronic device 100.
[0202] In some embodiments, similar to the display buffer, the audio buffer of the electronic device 200 may also include multiple buffers, and audio buffer 2 is one of the multiple buffers. Exemplarily, the most recently acquired screen projection audio (e.g., screen projection audio 1) may be polled and cached into one of the multiple buffers in the order of the buffer addresses. The audio driver sends the most recently cached screen projection audio to the audio output device.
[0203] S111. The electronic device 100 encodes the projection audio 1 in the audio buffer 1 to obtain the projection data 2.
[0204] In some embodiments, (30) the audio encoder obtains the projection audio 1 in the audio buffer 1; (31) Audiocodec is called to encode the projection audio 1; (32) the encoded projection data 2 is sent to the projection application through mediacodec.
[0205] S112, the electronic device 100 encapsulates the screen projection data 2 using the communication protocol, and then sends the encapsulated screen projection message 2 through the communication module 1.
[0206] S113. After the electronic device 200 decapsulates the screen projection message 2, the screen projection application of the electronic device 200 obtains the screen projection data 2.
[0207] For the specific implementation of steps S112 and S113, reference may be made to the relevant description of steps S106 and S107, which will not be repeated here.
[0208] S114. The electronic device 200 decodes the projection data 2 and obtains the projection audio 1.
[0209] In some embodiments, on the electronic device 200 side, (33) the screen projection application sends the projection data 2 to the audio decoder of the Native layer through Mediacodec; (34) the audio decoder calls Audiocodec to decode the data sent by Mediacodec to obtain the projection audio 1; (35) Audiocodec then returns the projection audio 1 to the screen projection application.
[0210] S115. Cache the projection audio 1 into the audio buffer 2. The audio output device of the electronic device 200 outputs the projection audio 1 according to the audio data stored in the audio buffer 2.
[0211] In some embodiments, on the electronic device 200 side, (36) the audio recording module performs audio recording based on the audio data of the projection audio 1 sent by the upper-layer application (for example, the projection application), stores the recorded projection audio 1 in the buffer, and notifies the Audioflinger; (37) the Audioflinger synthesizes the projection audio 1 based on the audio data in the above buffer; (38) the Audio HAL obtains the synthesized projection audio 1 and stores it in the audio buffer 2.
[0212] For ease of description, the buffer in the memory space of the electronic device 200 for storing the screen projection audio from the electronic device 100 may be referred to as the audio buffer of the electronic device 200 (e.g., audio buffer 2), and the audio output device (e.g., speaker) of the electronic device 200 outputs the screen projection audio 1 based on the data in the audio buffer 2. In some embodiments, the audio buffer 2 is used to store the latest synthesized audio output by the Audio HAL, that is, the audio to be output by the audio output device of the electronic device 200.
[0213] In some embodiments, (39) the audio driver of the electronic device 200 sends the audio data in the audio buffer 2 to the audio output device; (40) the audio output device outputs the projection audio 1.
[0214] In some application scenarios, even if the projection screen sent by the electronic device 100 to the electronic device 200 is playing audio or video, during the projection process, the electronic device 100 does not need to send the audio corresponding to the projection screen to the electronic device 200. For example, in an application scenario, the electronic device 100 and the electronic device 200 are very close, and the user can hear the audio corresponding to the projection screen through the electronic device 100 without the electronic device 200 playing the audio. For example, the electronic device 100 and the electronic device 200 are in-vehicle devices in the same car.
[0215] Combination Fig. 6A and Figure 6B It can be seen that in the screen sharing stage of this solution, the electronic device 100 needs to encode the projection content (i.e. each frame of the projection screen image and / or each frame of the projection screen audio). After the encoded projection screen data is sent to the target device through the network, it needs to be decoded. The overall process of the solution involves multiple user mode and kernel mode switching (for example Figure 6B Steps (9), (11), (13), (17), (21), (22) and (26) shown), data copying between the encoder / decoder and the CPU (e.g. Figure 6B ) shown in steps (9), (21)), and the encoding / decoding process (e.g. Figure 6B Steps (9)-(11) and (19)-(22) shown), message encapsulation / decapsulation process (e.g. Figure 6B Steps (12), (13), (17) and (18) shown in the figure); this results in high CPU / GPU load, high screen projection power consumption, and large screen projection delay, which may cause the screen projection images displayed by the source device and the target device to be out of sync, affecting the user's screen projection experience. In addition, the encoding / decoding process of the projection image involves data compression, and lossy compression will result in a decrease in image quality.
[0216] For example, Fig. 7AA method flow of screen projection reverse control is proposed for this solution. Figure 7B The implementation process of screen projection reverse control shown in the figure introduces the method process of screen projection reverse control, and the screen projection reverse control operation acts on the user interface of APP1 in the projection screen. Among them:
[0217] S201. After the electronic device 200 receives the user's screen projection reverse control operation, the IO device node ( / dev / input / eventX) stores the screen projection reverse control event corresponding to the screen projection reverse control operation in event buffer2.
[0218] In some embodiments, the reverse control operation of the screen projection includes a touch operation performed by a user on the projection screen displayed by the electronic device 200. Step S201 includes: (1) after the touch sensor in the physical display screen detects the reverse control operation of the screen projection, the hardware perception information corresponding to the reverse control operation of the screen projection is sent to the touch sensor driver; (2) the touch sensor driver processes the hardware perception information into raw input events (for example, the raw input events include touch coordinates, touch timestamps, and other information), and sends it to the IO device node corresponding to the display screen (for example, / dev / input / eventX), and the IO device node stores the event in event buffer2.
[0219] For ease of description, the above-mentioned original input event can be referred to as a screen projection reverse control event; the buffer in the memory space of the electronic device 200 used to store the screen projection reverse control event of the electronic device 200 can be simply referred to as the event buffer of the electronic device 200 (for example, event buffer 2).
[0220] For example, see Figure 2F In the example described, the screen projection reverse control operation may include a click operation on the video playback area in the projection screen. Figure 3B and Figure 3C In the example described, the reverse control operation of the screen projection may include a click operation on the icon 203 of the gallery application in the screen projection. Not limited to the touch operation on the display screen, the reverse control operation of the screen projection involved in the embodiment of the present application may also be an input operation performed by other input devices (such as a mouse, a remote control), or other forms of input operations such as voice operation and gesture operation, which are not specifically limited here.
[0221] S202. The above-mentioned screen projection reverse control event in the IO device node of the electronic device 200 is distributed to the screen projection application.
[0222] In some embodiments, step S202 includes: (3) the input subsystem reads the original input event (i.e., the projection screen reverse control event) from the event buffer2 stored in the IO device node. (4) After the IMS detects the original input event output by the input subsystem, it calls the WMS to determine the target window corresponding to the touch event according to the layout of each window in the main screen. The target application corresponding to the original input event is the application corresponding to the target window (i.e., the projection screen application). (5) The WMS distributes the original input event to the projection screen application.
[0223] S203 , the screen projection application of the electronic device 200 encapsulates the screen projection reverse control event using the communication protocol, and then sends the encapsulated screen projection message 3 to the electronic device 100 through the communication module 1 .
[0224] In some embodiments, for example, the communication module 1 is a WiFi communication module, and step S105 includes: (6) the screen projection application sends an encrypted screen projection reverse control event to the TCP / IP protocol stack; (7) the TCP / IP protocol stack uses the TCP / IP protocol to encapsulate the screen projection reverse control event, and then sends a screen projection message 2 corresponding to the screen projection reverse control event to the WiFi driver; (8) the WiFi driver triggers the WiFi communication module to send the screen projection message 1 to the electronic device 200; (9) the WiFi communication module sends the screen projection message 1 to the electronic device 200. It can be understood that the screen projection message 2 includes the above-mentioned screen projection reverse control event.
[0225] S204. After the electronic device 100 decapsulates the screen projection message 3, the screen projection application obtains a screen projection reverse control event.
[0226] In some embodiments, taking the WiFi communication module as an example, step S106 includes: (10) the WiFi driver obtains the screen projection message 2 from the WiFi communication module; (11) the WiFi driver sends the screen projection message 2 to the TCP / IP protocol stack; (12) the TCP / IP protocol stack decapsulates the screen projection message 2 using the TCP / IP protocol, and sends the decapsulated screen projection reverse control event to the screen projection application.
[0227] S205. The screen projection application of the electronic device 100 distributes a screen projection reverse control event to APP1 through the input subsystem.
[0228] In some embodiments, step S205 includes: (13) the screen projection application decrypts the screen projection reverse control event and sends the decrypted screen projection reverse control event to the input subsystem; (14) the user's screen projection reverse control operation acts on APP1, and the input subsystem distributes the screen projection reverse control event to APP1 (such as a video application) running in the foreground of the virtual display screen 1 corresponding to the electronic device 200. In one implementation, after the IMS detects the screen projection reverse control event (i.e., touch event) output by the above-mentioned input subsystem, it calls WMS to determine the target window corresponding to the touch event in the virtual display screen according to the layout of each window in the virtual display screen, and the target application corresponding to the above-mentioned reverse control event is APP1 corresponding to the target window.
[0229] S206. APP1 of the electronic device 100 determines the response event corresponding to the projection screen reverse control event, and the response event indicates the display content of the projection screen 2 after the response; the projection screen 2 after the response is drawn based on the response event, and the synthesized projection screen 2 is cached in the display buffer 3.
[0230] In some embodiments, step S206 includes: (15) APP1 determines a response event according to the projection screen reverse control event, and the response event indicates the projection screen 2 after the response; APP1 sends a drawing instruction to WMS, and the drawing instruction is used to instruct the drawing of the user interface 2 after APP1 responds; (16) WMS instructs surfaceflinger to synthesize each layer; (17) surfaceflinger calls GPU synthesis and HWC synthesis to obtain the synthesized projection screen 2, and the projection screen 2 includes the user interface 2. HWC stores the synthesized projection screen 2 in the display buffer 3.
[0231] In some embodiments, display buffer 3 and display buffer 1 of electronic device 100 are the same buffer. In some embodiments, the display buffer of electronic device 100 has multiple buffers (such as display buffer 1 and display buffer 3), and electronic device 100 polls and stores the latest synthesized projection screen into one of the multiple buffers.
[0232] In some embodiments, the main screen of the physical display screen of the electronic device 100 includes the projection screen 2; the above method further includes: sending the projection screen 2 to the physical display screen of the electronic device 100. In some implementations, (18) the HWC sends the synthesized projection screen 2 to the display driver, that is, the display driver displays the image data of the projection screen 2 in the buffer 3; (19) the display driver sends the projection screen 2 to the physical display screen of the electronic device 100.
[0233] For example, see Figure 2FIn the example described, the projection screen 1 includes Figure 2F The user interface 11 of the video application shown in the figure includes a video playing area, the screen projection reverse control operation may include a click operation (i.e., a pause operation) acting on the video playing area in the projection screen 1, and the projection screen 2 includes a pause interface 13 determined in response to the above pause operation. For example, see Figure 3B and Figure 3C In the example described, the projection screen 1 includes Figure 3B The main interface 21 of the system application shown in the figure includes an icon 203 of the gallery application. The projection screen reverse control operation may include a click operation on the icon 203 in the projection screen. The projection screen 2 includes a user interface 23 of the gallery application determined in response to the above click operation.
[0234] S207, the electronic device 100 encodes the projection image 2 and obtains the projection data 3.
[0235] In some embodiments, step S207 includes Fig. 7A For details of steps (20) to (23) in the software flow shown in FIG. 1 , please refer to the relevant description of step S105, which will not be repeated here.
[0236] S208. After the electronic device 100 encapsulates the screen projection data 3 using the communication protocol, it sends the encapsulated screen projection message 4 through the communication module 1.
[0237] In some embodiments, step S208 includes Fig. 7A For details of steps (24) to (27) in the software flow shown, please refer to the relevant description of step S106, which will not be repeated here.
[0238] S209. After the electronic device 200 decapsulates the screen projection message 4, the screen projection application obtains the screen projection data 3.
[0239] In some embodiments, step S209 includes Fig. 7A For details of steps (28) to (30) in the software flow shown, please refer to the relevant description of step S107, which will not be repeated here.
[0240] S210, the electronic device 200 decodes the projection data 3 and obtains the decoded projection image 2.
[0241] In some embodiments, step S210 includes Fig. 7A For details of steps (31) to (34) in the software flow shown, please refer to the relevant description of step S108, which will not be repeated here.
[0242] S211, the electronic device 200 stores the projection screen 3 in the display buffer 4, and the physical display screen displays the projection screen 2 according to the image data of the projection screen 2 cached in the display buffer 4.
[0243] In some embodiments, in the electronic device 200, the display buffer 4 storing the projection screen 2 and the display buffer 2 storing the projection screen 1 are the same buffer.
[0244] In some embodiments, the display buffer of the electronic device 100 has multiple buffers (for example, display buffer 2 and display buffer 4), and the electronic device 100 polls and stores the latest synthesized projection screen into one of the above multiple buffers. Exemplarily, the display buffer of the electronic device 200 includes buffer a, buffer b, and buffer c; according to the address order of the buffers, the HWC polls and caches the latest synthesized projection screen into one of the above multiple buffers; when the Vsync signal of the next refresh cycle arrives, the display driver sends the latest cached projection screen to the physical display screen. For example, the HWC synthesizes projection screens a, b, and c in sequence, and the projection screens a, b, and c are cached in buffer a, buffer b, and buffer c in sequence; when the HWC synthesizes projection screen d again, projection screen d is polled and cached in buffer a, covering the original projection screen a.
[0245] In some embodiments, step S211 includes Fig. 7A For details of steps (35) to (39) in the software flow shown in FIG. 1 , please refer to the relevant description of step S109, which will not be repeated here.
[0246] In some embodiments, the projection screen 2 sent by the electronic device 100 to the electronic device 200 is used to play audio and video, and the electronic device 100 also sends the audio corresponding to the projection screen 2 to the electronic device 200. Figure 6C The relevant description will not be repeated here.
[0247] Combination Fig. 7A and Figure 7B It can be seen that in the screen projection reverse control stage of this solution, when the user's screen projection reverse control event is sent to the target application (such as APP1) of the source device, both devices on the screen projection side are involved in the kernel's processing of the screen projection reverse control event (such as Figure 7B Steps (3) to (7) on the target device side, steps (11) to (13) on the source device side), and multiple user mode and kernel mode switches (e.g. Figure 7BSteps (2), (7), and (11) shown in the figure); this results in a large response delay of the source device to the projection screen reverse control event. Coupled with the processing delay of the screen sharing of the projection screen 2 after responding to the projection screen reverse control event, the overall projection screen reverse control delay is even greater.
[0248] Solution 2: Screen projection solution based on RDMA
[0249] In solution 2, electronic device 100 and electronic device 200 support RDMA technology. RDMA technology allows user-mode applications to directly access (e.g., write or read) remote memory, bypassing the operating system and CPU, and directly read and write data in the memory of one host (e.g., data required for screen projection) to the memory of another host.
[0250] For example, Figure 8 FIG. 1 shows an RDMA software stack, which includes a user-mode software stack and a kernel-mode software stack. Figure 8 As shown in the figure, the user-state software stack includes the application layer and the user-state lib library of RDMA. The user-state lib library includes Libimumad, Librdmacm, Libibcm and Libibverbs. The kernel-state software stack includes the kernel-state lib library, the RDMA subsystem core module (Ib-core), and the RDMA network card driver. The kernel-state lib library includes ib_umad, ib_ucm, rdma_ucm and ib_uverbs.
[0251] The main functions of each lib library are to register and provide character / miscellaneous devices, perform subnet management, connection management, and provide interfaces. The kernel-mode lib library connects with the user-mode lib library through the device's file operation interface (file_operations), and converts the RDMA operations of the user-mode lib library into RDMA operations (such as read, write, release, etc.) of the kernel device (such as ib_device device).
[0252] Among them, calling the "ibv_post_send()" interface of the libibverbs library to issue IO commands can directly operate the RDMA network card's send and receive queues in user mode. This implementation avoids system calls (i.e. switching between user mode and kernel mode, and copying memory data), saves CPU resources to the greatest extent, and improves IO efficiency.
[0253] There are three RDMA network protocols for the hardware implementation of RDMA technology: Infiniband (IB), RDMA over converged ethernet (RoCE) (including RoCEv1 and RoCEv2), and internet wide area RDMA protocol (iWARP). Among them, Infiniband is a network designed specifically for RDMA, which guarantees reliable transmission at the hardware level. RoCE and iWARP are both Ethernet-based RDMA technologies that support corresponding verbs interfaces. RoCE also supports hardware-level guarantees for reliable transmission.
[0254] An RDMA network card is a network card that supports the RDMA network protocol. In the IB / RoCE protocol specification, an RDMA network card can be called a host channel adapter (HCA). In the iWARP protocol specification, an RDMA network card can be called an RNIC, which is a network interface card (NIC) with an RDMA engine.
[0255] The RDMA network card solidifies the RDMA network protocol on the network card, the network layer and the transport layer are implemented in RDMA, and the RDMA network card directly encapsulates (for example, TCP / IP protocol encapsulation) and sends the application data, and parses the received message and sends the parsed data directly to the application layer. In some embodiments, the bus interface of the RDMA network card adopts a high-speed serial computer expansion bus standard (peripheral component interconnect, PCIe) interface.
[0256] In some embodiments, during the screen sharing stage of scheme two, the electronic device 200 can use the RDMA network card 2 to directly write the image data of the projected screen in the display buffer 1 of the electronic device 100 into the display buffer 2 of the electronic device 200, and the physical display screen of the electronic device 200 displays the projected screen based on the image data in the display buffer 2.
[0257] For example, Fig.9A A screen sharing method for this solution is given below. Fig. 9B The software structure shown introduces the method flow of the screen sharing, which includes steps S301 to S310.
[0258] like Fig. 9B shows the software structure of another electronic device, such as Fig. 9BAs shown, the electronic device 100 and the electronic device 200 are configured with an RDMA network card; the kernel layer includes an RDMA network card driver corresponding to the RDMA network card.
[0259] S301 . The electronic device 100 displays the user interface 1 of APP1 .
[0260] S302. After the electronic device 100 receives the screen projection operation from the user, the IO device node (ie, / dev / input / eventX) of the electronic device 100 stores the screen projection trigger event corresponding to the screen projection operation.
[0261] S303. The screen projection trigger event in the IO device node of the electronic device 100 is distributed to the screen projection application.
[0262] For the specific implementation of steps S301 to S303 , reference may be made to the related description of the aforementioned steps S101 to S103 , which will not be repeated here.
[0263] S304 . An RDMA connection is established between the RDMA network card of the electronic device 100 and the RDMA network card of the electronic device 200 .
[0264] In some embodiments, after the screen projection application determines that the screen is projected based on the above-mentioned screen projection trigger event, it triggers the RDMA network card of the electronic device 100 to establish an RDMA connection (i.e., channel connection) with the electronic device 200. In some embodiments, based on the above-mentioned screen projection trigger event, the screen projection application sends a screen projection service connection request to the electronic device 200 through the communication module 1 (e.g., WiFi communication module); the screen projection application of the electronic device 200 sends a screen projection service connection response to the electronic device 100; after the screen projection application of the electronic device 200 determines that the electronic device 200 agrees to the screen projection based on the above-mentioned screen projection service connection response, it triggers the RDMA network card of the electronic device 100 to establish an RDMA connection with the electronic device 200.
[0265] Channel connection is used for RDMA message transmission. Fig. 9C The two NICs at both ends of each Channel connection maintain a pair of queues (Queue Pairs, QP). Each pair of QP consists of a send queue (SQ) and a receive queue (RQ). The queues manage the work queue elements (WQE) corresponding to various types of RDMA work requests (WR). WQE (i.e., the task description of WR) waits for the RDMA NIC to schedule and parse. The RDMA NIC obtains data from the buffer pointed to by WQE and sends it to the other end of the Channel connection.
[0266] S305 . The electronic device 200 sends an RDMA message 1 to the electronic device 100 . The RDMA message 1 carries the virtual address of the display buffer 2 .
[0267] In some embodiments, after establishing the RDMA connection, RDMA network card 2 sends the virtual address of display buffer 2 to RDMA network card 1, that is, RDMA network card 1 is informed in advance of the target storage address of the projection screen in electronic device 200, so that RDMA network card 1 can directly write the image data of the projection screen directly to the target storage address.
[0268] In some embodiments, RDMA message 1 also includes key 1. After establishing the RDMA connection, the electronic device 200 registers the display buffer 2 to the RDMA network card 2, obtains the key 1 (Remote key) corresponding to the display buffer 2, and the RDMA network card 2 records the correspondence between the address of the display buffer 2 and the key 1; after registration, the RDMA network card 2 sends the RDMA message 1 to the RDMA network card 1, and the RDMA message 1 includes the virtual address of the display buffer 2 and the key 1. Sending the key 1 to the RDMA network card 1 of the electronic device 100 grants the network card the authority to remotely operate the display buffer 2. In some embodiments, the RDMA message 1 may also include the memory length of the display buffer 2, and the memory length is used to indicate the maximum amount of data that can be written to the display buffer 2.
[0269] In some embodiments, reference Fig. 9B , the electronic device 200 registers the display buffer 2 to the RDMA network card 2, including: (1) the upper-layer application (such as the screen projection application) of the electronic device 200 instructs the HWC to send an instruction to the RDMA network card driver; (2) based on the instruction, the RDMA network card driver instructs the RDMA network card 2 to register the address of the display buffer 2. In one implementation, the screen projection application of the electronic device 200 instructs the HWC to send an instruction to the RDMA network card driver, including: the screen projection application of the electronic device 200 sends an instruction to the surfaceflinger through the WMS, and based on the instruction, the surfaceflinger instructs the HWC to register the address of the display buffer 2 to the RDMA network card 2; the HWC sends an instruction to the RDMA network card driver. Step S305 includes: (3) the RDMA network card 2 sends the RDMA message 1 to the RDMA network card 1.
[0270] In some embodiments, the display buffer of the electronic device 200 includes multiple buffers (e.g., buffer a, buffer b, and buffer c), and display buffer 2 is one of the multiple buffers. RDMA message 1 includes the virtual address of each buffer in the multiple buffers. In subsequent embodiments, the RDMA network card 1 of the electronic device 100 can also write the latest synthesized projection screen to one of the multiple buffers of the electronic device 200 through RDMA write request in the order of the buffer addresses. In some embodiments, RDMA message 1 can also include the memory size of each buffer.
[0271] S306 , the screen projection application of the electronic device 100 instructs drawing a composite screen projection to the projection screen 1 of the electronic device 200 .
[0272] For the specific implementation of step S305, reference may be made to the related description of the aforementioned step S104, which will not be repeated here.
[0273] S307 , after the electronic device 100 determines that the projection screen 1 is synthesized, it submits a work request WR1 to the RDMA network card 1 , where the work request WR1 is used to instruct writing the image data of the projection screen 1 into the display buffer 2 of the electronic device 200 .
[0274] In some embodiments, after the HWC determines that the projection screen 1 is synthesized (for example, determines that the image data of the projection screen 1 is written into the display buffer 1), it submits a work request WR1 to the RDMA network card 1. For example, see Fig. 9B , step S307 includes: (4) after the HWC determines that the projection screen 1 is synthesized, it submits a work request WR1 to the RDMA network card driver, and the work request WR1 includes the virtual address of the display buffer 1 storing the projection screen 1; (5) the RDMA network card driver sends the work request WR1 to the RDMA network card 1.
[0275] In some embodiments, after establishing the RDMA connection, the upper layer application (e.g., screen projection application) of the electronic device 200 instructs the HWC to turn on the enable switch 1; after turning on the enable switch 1, when it is determined that a new screen projection image has been synthesized, the HWC submits a work request WR1 to the RDMA network card 1. In some embodiments, the upper layer application of the electronic device 200 instructs the HWC to turn on the enable switch 1, including: the screen projection application of the electronic device 200 sends an instruction to the surfaceflinger through the WMS, and based on the instruction, the surfaceflinger instructs the HWC to turn on the enable switch 1.
[0276] In some embodiments, see Fig. 9CThe RDMA implementation process shown in step S306 includes: (1) When the HWC of the electronic device 100 determines that the projection screen 1 is synthesized, it submits WR1 to the RDMA network card 1. The RDMA network card 1 generates a task WQE (for example) corresponding to WR based on the above WR1 and the virtual address of the display buffer 2 carried by the RDMA message 1. Fig. 9C WQE1 as shown) and joins the SQ queue. WQE1 may include the RDMA operation type (i.e., write operation), the local data address (i.e., the virtual address of display buffer 1 storing the projection screen 1), the target storage address (i.e., the virtual address of display buffer 2 of electronic device 200) and the key 1 corresponding to display buffer 2.
[0277] S308. Based on WR1, the electronic device 100 sends an RDMA write request 1 to the electronic device 200. The RDMA write request 1 is used to indicate that the data of the projection screen 1 is written into the display buffer 2 of the electronic device 200. The RDMA write request 1 carries the virtual address of the display buffer 2 and the image data of the projection screen 1 in the display buffer 1.
[0278] In some embodiments, the RDMA write request 1 also carries the key 1 corresponding to the display buffer 2 , and the key 1 is used to verify that the electronic device 100 has the authority to operate the display buffer 2 .
[0279] In some embodiments, see Fig. 9B ,Step S308 includes: (6) based on the address of display buffer 1 indicated by WR1, RDMA network card 1 instructs the RDMA network card driver to read the data of display buffer 1; (7) RDMA network card 1 obtains the data of display buffer 1; (8) based on the data of display buffer 1, RDMA network card 1 assembles RDMA write request 1 and sends RDMA write request 1 to RDMA network card 2.
[0280] In the embodiment of the present application, the electronic device 100 can write the projection image 1 in the display buffer 1 of the electronic device 100 into the display buffer 2 of the electronic device 200 through the RDMA unilateral operation (write operation) or the RDMA bilateral operation.
[0281] In some embodiments, see Fig. 9CThe RDMA implementation process shown in step S308 includes: (2) RDMA network card 1 takes out WQE1 (i.e., the task corresponding to WR1) from SQ and parses the information WQE1; according to the virtual address of display buffer 1 in WQE1, converts it to obtain the physical address; (3) according to the physical address, reads the image data of the projection screen 1 from the memory of the electronic device 100, and assembles the RDMA write request 1; (4) RDMA network card 1 sends the RDMA write request 1 to RDMA network card 2 via the physical link of the RDMA connection (e.g., IB link / Ethernet link).
[0282] S309 . Based on the RDMA write request 1 , the RDMA network card 2 of the electronic device 200 writes the data of the display buffer 1 into the display buffer 2 .
[0283] In some embodiments, see Fig. 9B , step S308 includes: (9) after parsing the RDMA write request 1, the RDMA network card 2 sends an instruction to the RDMA network card driver; (10) based on the instruction, the RDMA network card driver writes the data of the display buffer 1 to the display buffer 2 of the local memory.
[0284] In some embodiments, see Fig. 9C In the RDMA implementation process shown, step S309 includes: (5) RDMA network card 2 parses RDMA write request 1, and converts the target storage address in RDMA write request 1 (i.e., the virtual address of display buffer 2) into the physical address of local memory; (6) writes the target data in RDMA write request 1 (i.e., the data of display buffer 1) into the physical address.
[0285] In some embodiments, see Fig. 9C The RDMA implementation process shown in the figure further includes the following steps after step S308: (9) RDMA network card 2 replies with an acknowledgment message (ACK) to RDMA network card 1. (7) RDMA network card 1 generates a completion queue element (CQE) (e.g., CQE) based on the acknowledgment message and places it in the CQ. (8) The upper layer application determines that the task is completed based on CQE1.
[0286] S310, the electronic device 200 displays the projection screen 1 according to the image data in the display buffer 2.
[0287] The specific implementation of step S310 may refer to the related description of the aforementioned step S109, which will not be repeated here.
[0288] Solution 2 uses RDMA to transmit screen projection data, which can provide microsecond access latency and about 100Gbps of throughput per connection. For example, see Fig.9D In the refresh cycle after the arrival of vsync1, the electronic device 100 draws and renders each layer and caches it in the buffer of the buffer queue; in the refresh cycle after the arrival of the next vsync (i.e. vsync2), the electronic device 100 synthesizes the projection screen (e.g. projection screen 1) according to the layers after drawing and rendering, and after the display buffer1 stores the image data of the projection screen, the data of the display buffer1 can be written to the display buffer2 of the electronic device 200 in a very short time. In this way, when the clocks of the two devices are synchronized, the electronic devices 100 and 200 can display the same projection screen in the refresh cycle after another vsync (i.e. vsync3). This solution can support higher refresh rates (e.g. 60fps, 90fps or 120fps).
[0289] In some embodiments, the projection screen sent by the electronic device 100 to the electronic device 200 is playing audio and video. During the projection process, the electronic device 100 also sends the audio corresponding to the projection screen to the electronic device 200. Fig.9E As shown, the screen projection solution also includes audio sharing, and the method flow of audio sharing includes steps S311 to S316. Fig.9F The software structure shown in FIG. 1 is used to introduce steps S311 to S316 in detail.
[0290] S311. The electronic device 200 sends an RDMA message 2 to the electronic device 100. The RDMA message 2 carries the virtual address of the audio buffer 2.
[0291] In some embodiments, after establishing the RDMA connection, RDMA network card 2 sends the virtual address of display audio buffer 2 to RDMA network card 1. That is, RDMA network card 1 is informed in advance of the target storage address of the screen projection audio in electronic device 200, so that RDMA network card 1 can directly write the audio data of the screen projection audio directly to the target storage address.
[0292] In some embodiments, RDMA message 2 also includes key 2. After establishing the RDMA connection, the electronic device 200 registers the audio buffer 2 to the RDMA network card 2, obtains the key 2 (Remote key) corresponding to the audio buffer 2, and the RDMA network card 2 records the correspondence between the address of the audio buffer 2 and the key 2; after registration, the RDMA network card 2 sends the RDMA message 2 to the RDMA network card 1, and the RDMA message 2 includes the virtual address of the audio buffer 2 and the key 2. Sending the key 2 to the RDMA network card 1 of the electronic device 100 grants the network card the authority to remotely operate the audio buffer 2. In some embodiments, the RDMA message 2 may also include the memory length of the audio buffer 2, and the memory length is used to indicate the maximum amount of data that can be written to the audio buffer 2.
[0293] In some embodiments, reference Fig.9F , the electronic device 200 registers the audio buffer 2 to the RDMA network card 2, including: (1) the upper layer application (such as the screen projection application) of the electronic device 200 instructs the Audio HAL to send an instruction to the RDMA network card driver; (2) based on the instruction, the RDMA network card driver instructs the RDMA network card 2 to register the address of the audio buffer 2. In one implementation, the screen projection application of the electronic device 200 instructs the Audio HAL to register the audio buffer 2 to the RDMA network card 2 through the Audioflinger. Step S311 includes: (3) the RDMA network card 2 sends the RDMA message 2 to the RDMA network card 1.
[0294] In some embodiments, similar to the display buffer, the audio buffer of the electronic device 200 may also include multiple buffers, and the audio buffer 2 is one of the multiple buffers. The RDMA message 2 includes the virtual address of each buffer in the multiple buffers. In subsequent embodiments, the RDMA network card 1 of the electronic device 100 may also write the latest synthesized screen projection audio to one of the multiple buffers of the electronic device 200 through an RDMA write request in the order of the buffer addresses. In some embodiments, the RDMA message 2 may also include the memory size of each buffer.
[0295] In some embodiments, the RDMA message also includes a buffer type (e.g., an audio buffer or a display buffer). In this way, the RDMA network card 1 of the electronic device 100 can recognize that the virtual address in the RDMA message 2 is the address of the audio buffer, and the virtual address in the RDMA message 1 is the address of the display buffer. For example, the buffer type included in the RDMA message 2 indicates an audio buffer.
[0296] S312. The screen projection application of the electronic device 100 instructs to synthesize the screen projection audio; and stores the audio data of the synthesized screen projection audio 1 in audio buffer 1.
[0297] For the specific implementation of step S312, please refer to Figure 6C The relevant description of step S110 is not repeated here.
[0298] S313. After the electronic device 100 determines that the synthesis of the projection screen audio 1 is completed, it submits a work request WR2 to the RDMA network card 1. The work request WR2 is used to instruct the audio data of the projection screen audio 1 to be written into the audio buffer 2 of the electronic device 200.
[0299] In some embodiments, after the Audio HAL determines that the screen projection audio 1 is synthesized (for example, it determines that the audio data of the screen projection audio 1 is written into the display buffer 1), it submits a work request WR2 to the RDMA network card 1. For example, see Fig.9F , step S313 includes: (4) After the Audio HAL determines that the screen projection audio 1 is synthesized, it submits a work request WR2 to the RDMA network card driver, and the work request WR2 includes the virtual address of the audio buffer 1 storing the screen projection audio 1; (5) The RDMA network card driver sends the work request WR2 to the RDMA network card 1.
[0300] In some embodiments, after establishing the RDMA connection, the upper layer application (e.g., screen projection application) of the electronic device 200 instructs the Audio HAL to turn on the enable switch 2; after turning on the enable switch 2, when it is detected that the screen projection audio synthesis is completed, the Audio HAL submits a work request to the RDMA network card 1. In some embodiments, the upper layer application of the electronic device 200 instructs the Audio HAL to turn on the enable switch 2, including: the screen projection application of the electronic device 200 instructs the Audio HAL to turn on the enable switch 2 through the Audioflinger.
[0301] In some embodiments, RDMA network card 1 generates WQE2 according to WR2 and adds WQE2 to the SQ queue. WQE2 may include RDMA operation type (i.e., write operation), local data address (i.e., virtual address of audio buffer 1 storing screen projection audio 1), target storage address (i.e., virtual address of audio buffer 2 of electronic device 200) and key 2 corresponding to audio buffer 2.
[0302] S314. Based on WR2, the electronic device 100 sends an RDMA write request 2 to the electronic device 200. The RDMA write request 2 is used to indicate that the data of the projection audio 1 is written into the audio buffer 2 of the electronic device 200. The RDMA write request 1 carries the virtual address of the audio buffer 2 and the audio data of the projection audio 1 in the audio buffer 1.
[0303] In some embodiments, the RDMA write request 1 also carries the key 2 corresponding to the audio buffer 2, where the key 2 is used to verify that the electronic device 100 has the authority to operate the audio buffer 2; the key 2 corresponding to the audio buffer 2.
[0304] In some embodiments, see Fig.9F ,Step S314 includes: RDMA network card 1 takes out WQE2 (i.e., the task corresponding to WR2) from SQ and parses information WQE2; according to the virtual address of audio buffer 1 in WQE, converts it to obtain the physical address; (6) RDMA network card 1 instructs the RDMA network card driver to read the data of audio buffer 1 at the physical address; (7) RDMA network card 1 obtains the data of audio buffer 1; (8) based on the data of audio buffer 1, RDMA network card 1 assembles RDMA write request 2 and sends RDMA write request 1 to RDMA network card 2.
[0305] In some embodiments, the work request WR also includes a data type (such as audio or image). In this way, the RDMA network card 2 can distinguish between the work request WR2 for the projection audio and the work request WR1 for the projection image, and then generate an RDMA write request 2 for the projection audio or an RDMA write request 1 for the projection image. For example, WR2 includes an indication that the data type is audio, and the RDMA network card 2 obtains the virtual address of the audio buffer 1 of the electronic device 100 based on the data type; then assembles the RDMA write request 2 based on the address. The data type indicated by WR1 is image, and the RDMA network card 2 obtains the virtual address of the display buffer 1 of the electronic device 100 based on the data type; then assembles the RDMA write request 1 based on the address.
[0306] S315 . Based on the RDMA write request 2 , the RDMA network card 2 of the electronic device 200 writes the data of the audio buffer 1 into the audio buffer 2 .
[0307] In some embodiments, see Fig.9F, step S308 includes: (9) parsing RDMA write request 2, RDMA network card 2 sends an instruction to the RDMA network card driver; (10) based on the instruction, the RDMA network card driver writes the data of audio buffer 1 in RDMA write request 2 into audio buffer 2 in the local memory.
[0308] In some embodiments, step S309 includes: (5) RDMA network card 2 parses RDMA write request 2, and converts the target storage address in RDMA write request 2 (i.e., the virtual address of audio buffer 2) into a physical address of local memory; (6) writes the target data in RDMA write request 2 (i.e., the data of audio buffer 1) into the physical address.
[0309] S316. The audio output device of the electronic device 200 outputs the projection audio 1 according to the audio data cached in the audio buffer 2.
[0310] For the specific implementation of step S312, please refer to Figure 6C The relevant description of step S115 is not repeated here.
[0311] In some embodiments, reference Fig. 9B and Fig.9F As described in , the RDMA network card 2 directly writes the projection image from the electronic device 100 into the local display buffer 2, and directly writes the projection audio from the electronic device 100 into the local audio buffer 2.
[0312] In some embodiments, if the electronic device 100 is projected to the electronic device 200 and the audio is also sent synchronously to the electronic device 200, it is necessary to ensure that the picture and audio of the projected image and the projected audio are synchronized (for example, projected image 1 corresponds to projected audio 1, and projected image 2 corresponds to projected audio 2).
[0313] In some embodiments, see Fig.9F , the kernel layer of the electronic device 200 includes a synchronization module, which is used to control the picture and sound synchronization of the projection screen and the projection screen audio. After the RDMA network card obtains the projection screen (for example, the projection screen 1 of step S308) through the RDMA write request 1, and obtains the projection screen audio (for example, the projection screen audio of step S314) through the RDMA write request 2, (11) the RDMA network card sends the above-mentioned projection screen 1 and projection screen audio 1 to the synchronization module through the RDMA network card driver respectively; the projection screen 1 and projection screen audio 1 can be sent at the same time, or they can be sent separately, which is not specifically limited here. After the synchronization module synchronizes the picture and sound of the received projection screen and projection screen audio, in the same refresh cycle, (12) the projection screen 1 is written into the display buffer 2, and (13) the projection screen audio 1 is written into the audio buffer 2.
[0314] For how the synchronization module synchronizes the projection image and projection audio, you can refer to the existing technology. In one implementation, RDMA write request 1 also carries the timestamp of projection image 1, and RDMA write request 2 also carries the timestamp of projection audio 1; the RDMA network card also sends the timestamp of projection image and the timestamp of projection audio to the synchronization module; when the synchronization module determines that the timestamps of the received projection image 1 and projection audio 1 are consistent, it determines that projection image 1 and projection audio 1 are synchronized, otherwise they are out of sync. When out of sync, an error can be reported to RDMA network card 1 through RDMA network card 2.
[0315] In some embodiments, during the screen projection return control phase of scheme two, the RDMA network card 3 of the electronic device 100 directly writes the screen projection return control event in the event buffer 2 of the electronic device 200 into the event buffer 1 of the electronic device 100, and the upper-layer application of the electronic device 100 responds to the event based on the input event in the event buffer 1.
[0316] For example, Fig. 10A A method flow of screen projection reverse control is proposed for this solution. Fig. 10B The implementation process of screen projection reverse control shown in the figure introduces the method process of screen projection reverse control.
[0317] S401 : The electronic device 100 sends an RDMA message 3 to the electronic device 200 . The RDMA message 3 carries the virtual address of the event buffer 1 .
[0318] For ease of description, the buffer in the memory space of the electronic device 100 for storing raw input events may be referred to as the event buffer of the electronic device 100 (e.g., event buffer 1). In some embodiments, raw input events of IO device nodes corresponding to different input devices (e.g., screen, mouse) are stored in different event buffers (e.g., event buffer 2 corresponding to the screen of the electronic device 100). RDMA message 3 carries the virtual address of each event buffer of the electronic device 100 and the identifier of the corresponding input device.
[0319] In some embodiments, after establishing the RDMA connection, RDMA network card 1 sends the virtual address of event buffer 1 to RDMA network card 2, that is, RDMA network card 2 is informed in advance of the target storage address of the original input event in the electronic device 100, so that RDMA network card 2 can directly write the screen projection reverse control event directly to the target storage address.
[0320] In some embodiments, RDMA message 3 also includes key 3. After establishing the RDMA connection, the electronic device 100 registers event buffer 1 to the RDMA network card 1, obtains key 3 (Remote key) corresponding to event buffer 1, and RDMA network card 1 records the correspondence between the address of event buffer 1 and key 3; after registration, RDMA network card 1 sends RDMA message 3 to RDMA network card 2, and RDMA message 3 includes the virtual address of event buffer 1 and key 3. Sending key 3 to the RDMA network card 2 of the electronic device 200 grants the network card the authority to remotely operate event buffer 1. In some embodiments, RDMA message 2 may also include the memory length of event buffer 1, and the memory length is used to indicate the maximum amount of data that can be written to event buffer 1.
[0321] In some embodiments, reference Fig. 10B , the electronic device 100 registers the event buffer 1 to the RDMA network card 1, including: (1) the screen projection application of the electronic device 100 instructs the IO device node (for example, / dev / input / eventX) to send an instruction to the RDMA network card driver; (2) based on the instruction, the RDMA network card driver instructs the RDMA network card 1 to register the address of the event buffer 1. Step S401 includes: (3) RDMA network card 1 sends RDMA message 3 to RDMA network card 2.
[0322] S402. After the electronic device 200 receives the user's screen projection reverse control operation, the IO device node ( / dev / input / eventX) stores the screen projection reverse control event corresponding to the screen projection reverse control operation in event buffer2.
[0323] The specific implementation of step S402 may refer to the relevant description of step S201, which will not be repeated here.
[0324] S403. After the IO device node of the electronic device 200 stores the screen projection reverse control event 1 in the event buffer 2, it submits a work request WR3 to the RDMA network card 2. The work request WR3 is used to instruct to write the screen projection reverse control event 1 into the event buffer 1 of the electronic device 100.
[0325] In some embodiments, see Fig. 10B , step S403 includes: (4) after the IO device node ( / dev / input / eventX) stores the screen projection reverse control event 1 in the event buffer 2, it submits a work request WR3 to the RDMA network card driver, and the work request WR3 includes the virtual address of the event buffer 2 storing the screen projection reverse control event 1; (5) the RDMA network card driver sends the work request WR3 to the RDMA network card 2.
[0326] In some embodiments, after establishing the RDMA connection, the upper-layer application of the electronic device 200 (for example, the screen projection application) instructs the IO device node to turn on the enable switch 3; after turning on the enable switch 3, after storing the new screen projection reverse control event in the event buffer 2, the IO device node submits a work request WR3 to the RDMA network card 2.
[0327] In some embodiments, see Fig. 10C The RDMA implementation process shown, step 403 includes: (1) After the IO device node stores the projection reverse control event 1 in the event buffer 2, it submits WR3 to the RDMA network card 2. The RDMA network card 2 generates the task WQE3 corresponding to WR3 according to the virtual address of the event buffer 1 carried by the above WR3 and the RDMA message 3, and adds it to the SQ queue. WQE3 may include the RDMA operation type (i.e., write operation), the local data address (i.e., the virtual address of the event buffer 2), the target storage address (i.e., the virtual address of the event buffer 2) and the key 3 of the event buffer 2.
[0328] In some embodiments, RDMA message 3 carries the virtual address of each event buffer of electronic device 100 and the identifier of the corresponding input device. Electronic device 200 determines that event buffer 2 of local storage screen projection reverse control event 1 corresponds to input device 1 (e.g., screen); electronic device 200 selects the virtual address of the event buffer corresponding to input device 1 (e.g., event buffer 1 corresponding to the screen) in RDMA message 3 as the target storage location.
[0329] S404, the electronic device 200 sends an RDMA write request 3 to the electronic device 100, where the RDMA write request 3 is used to instruct to write the screen projection reverse control event 1 into the event buffer 1 of the electronic device 100; the RDMA write request 3 carries the virtual address of the event buffer 1 and the data of the screen projection reverse control event 1 in the event buffer 2.
[0330] In some embodiments, the RDMA write request 3 also carries a key 3, and the key 3 is used to verify that the electronic device 200 has the authority to operate the event buffer 1.
[0331] In some embodiments, see Fig. 10BStep S404 includes: (6) based on the address of event buffer 2 indicated by WR3, RDMA network card 2 instructs the RDMA network card driver to read the data of event buffer 2; (7) RDMA network card 2 obtains the data of event buffer 2; (8) based on the data of event buffer 2, RDMA network card 2 assembles RDMA write request 3 and sends RDMA write request 3 to RDMA network card 1.
[0332] In some embodiments, see Fig. 10C The RDMA implementation process shown in step S404 includes: (2) RDMA network card 2 takes out WQE3 (i.e., the task corresponding to WR3) from SQ and parses the information WQE3; according to the virtual address of event buffer2 in WQE3, converts to obtain the physical address; (3) according to the physical address 3, reads the data of screen projection reverse control event 1 from the memory of electronic device 200, and assembles RDMA write request 3; (4) RDMA network card 2 sends RDMA write request 3 to RDMA network card 1 through RDMA connection.
[0333] S405 . Based on the RDMA write request 3 , the RDMA network card 1 of the electronic device 100 writes the data of the event buffer 2 into the event buffer 1 .
[0334] In some embodiments, see Fig. 10B , step S405 includes: (9) after parsing the RDMA write request 3, the RDMA network card 1 sends an instruction to the RDMA network card driver; (10) based on the instruction, the RDMA network card driver writes the data of the event buffer 2 in the RDMA write request 3 into the event buffer 1 of the local memory.
[0335] In some embodiments, see Fig. 10C In the RDMA implementation process shown, step S405 includes: (5) RDMA network card 1 parses RDMA write request 3, and converts the target storage address in RDMA write request 3 (i.e., the virtual address of event buffer 1) into the physical address of local memory; (6) writes the target data in RDMA write request 3 (i.e., the data in event buffer 2) into the physical address.
[0336] In some embodiments, see Fig. 10C The RDMA implementation process shown in the figure further includes after step S405: (9) RDMA network card 1 replies with an acknowledgment message (ACK) to RDMA network card 2. (7) RDMA network card 1 generates a completion queue element (CQE) (e.g., CQE3) based on the acknowledgment message and places it in the CQ. (8) The upper layer application determines that the task is completed based on CQE3.
[0337] S406. The IO device node of the electronic device 100 distributes the screen projection reverse control event to APP1 through the input subsystem.
[0338] In some embodiments, see Fig. 10B , step S103 includes: (11) the input subsystem reads the screen projection reverse control event from the event buffer1 through the IO device node. (12) the user's screen projection reverse control operation acts on APP1, and the input subsystem distributes the above screen projection reverse control event to APP1. In one implementation method, after the IMS detects the screen projection reverse control event (i.e., touch event) output by the above input subsystem, it calls the WMS to determine the target window corresponding to the touch event, and the target application corresponding to the above reverse control event is APP1 corresponding to the target window.
[0339] S407. APP1 of the electronic device 100 determines the response event corresponding to the projection screen reverse control event, and the response event indicates the display content of the projection screen 2 after the response; the projection screen 2 after the response is drawn based on the response event, and the synthesized projection screen 2 is cached in the display buffer 3.
[0340] In some embodiments, the specific implementation of step S407 may refer to the relevant description of step S206, which will not be repeated here.
[0341] S408 , after the electronic device 100 determines that the projection screen 2 is synthesized, it submits a work request WR4 to the RDMA network card 1 , where the work request WR4 is used to instruct writing the image data of the projection screen 1 into the display buffer 4 of the electronic device 200 .
[0342] In some embodiments, the specific implementation of step S408 may refer to the relevant description of step S307, which will not be repeated here.
[0343] S409. Based on WR4, the electronic device 100 sends an RDMA write request 4 to the electronic device 200. The RDMA write request 4 is used to indicate that the data of the projection screen 2 is written into the display buffer 3 of the electronic device 200. The RDMA write request 4 carries the virtual address of the display buffer 4 and the image data of the projection screen 2 in the display buffer 3.
[0344] In some embodiments, the specific implementation of step S409 may refer to the relevant description of step S308, which will not be repeated here.
[0345] S410 , based on the RDMA write request 4 , the RDMA network card 2 of the electronic device 200 writes the data of the display buffer 3 into the display buffer 4 .
[0346] In some embodiments, the specific implementation of step S410 may refer to the relevant description of step S309, which will not be repeated here.
[0347] S411, the electronic device 200 displays the projection screen 2 according to the image data stored in the display buffer 4.
[0348] The specific implementation of step S411 may refer to the related description of the aforementioned step S109, which will not be repeated here.
[0349] In some embodiments, when the electronic device 100 sends the projection screen 2 to the electronic device 200, it also sends the audio corresponding to the projection screen 2 to the electronic device 200. Fig.9E The relevant description will not be repeated here.
[0350] The embodiments provided in the present application can be adaptively combined. For example, in Solution 2 and Solution 1, the same technical concept (such as display buffer, audio buffer and event buffer) and the same implementation steps can be referenced / combined with each other.
[0351] In summary, the embodiment of the second implementation scheme combines RDMA technology to realize screen sharing, audio sharing and reverse control of screen projection in the screen projection scenario, and has the following advantages: (1) This device (such as electronic device 100 or electronic device 200) can write the data required for screen projection (such as projection screen, projection audio or projection reverse control event) from the buffer of this device directly to the buffer of another device, without the need to copy the data to the network software stack. (2) The upper-layer application can directly perform data transmission in the user state, without the need to perform context switching between kernel state and user state multiple times. (3) The upper-layer application of this device accesses the memory of another device (such as display buffer1 / audio buffer1 of electronic device 100, or event buffer2 of electronic device 200), without the need for CPU intervention of another device, thereby reducing the CPU load. (4) No encoding and decoding is required. (5) No data compression is involved, and the problem of image quality degradation caused by lossy compression can be avoided. Based on the above advantages, the CPU load, screen projection power consumption and screen projection delay can be effectively reduced, the screen projection image quality can be guaranteed, and the user experience can be effectively improved.
[0352] Based on the above embodiments, the present application provides a screen projection method, which is applied to a screen projection system, wherein the screen projection system includes a first electronic device and a second electronic device. Fig.11 , the above method includes steps S501 to S503.
[0353] S501: A first electronic device receives a first input operation, where the first input operation is used to trigger the first electronic device to project a screen onto a second electronic device.
[0354] In the embodiment of the present application, the electronic device 100 may also be referred to as a first electronic device; and the electronic device 200 may also be referred to as a second electronic device. The first input operation may include the aforementioned screen projection operation.
[0355] S502. Based on the first input operation, the remote direct memory access (RDMA) network card of the first electronic device sends a first request to the RDMA network card of the second electronic device. The first request includes the first screen projection information and the address of the second memory space of the second electronic device. The first request is used to indicate that the first screen projection information is written into the second memory space.
[0356] In some embodiments, before the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, it also includes: after the first electronic device detects that the first electronic device synthesizes the first screen projection information and stores it in the first memory space, the RDMA network card of the first electronic device generates a first request based on the first screen projection information in the first memory space.
[0357] In some embodiments, after the first electronic device receives the first input operation, before the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the above method also includes: the second electronic device sends a first RDMA message to the first electronic device, the first RDMA message includes an address of a second memory space of the second electronic device, and the second memory space is used to store the screen projection information from the first electronic device.
[0358] In some embodiments, before the RDMA network card of the second electronic device sends the first RDMA message to the RDMA network card of the first electronic device, it also includes: based on the first input operation, the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, and the first RDMA message and the first request are sent through the RDMA connection.
[0359] In some embodiments, before the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, it also includes: in response to the first input operation, the first electronic device sends a screen projection request to the second electronic device through the first communication module; the first electronic device receives the screen projection response sent by the second electronic device through the first communication module; the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, including: when determining the screen projection based on the screen projection response, the RDMA network card of the second electronic device and the RDMA network card of the first electronic device establish an RDMA connection. In the embodiment of the present application, the first communication module may include the aforementioned communication module 1.
[0360] In some embodiments, before the second electronic device sends the first RDMA message to the first electronic device, it also includes: the second electronic device registers the second memory space to the RDMA network card of the second electronic device, and obtains the first key corresponding to the address of the second memory space; the first RDMA message also includes the first key, and the first request also includes the first key; based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space, including: after the RDMA network card of the second electronic device determines that the first key included in the first request is the key corresponding to the address of the second memory space, the first screen projection information is written into the second memory space.
[0361] In some embodiments, the first projection information includes image data of the first projection screen; the second electronic device outputs the first projection information based on the data stored in the second memory space, including: the display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space.
[0362] In an embodiment of the present application, when the first screen projection information includes image data of the first projection screen, the first request may include the aforementioned RDMA write request 2, the first projection screen may include the aforementioned projection screen 1, the first memory space includes the aforementioned display buffer 1, the second memory space may include the aforementioned display buffer 2, the first RDMA message may include the aforementioned RDMA message 1, and the first key may include the aforementioned key 1.
[0363] In some embodiments, the first screen projection information includes audio data of the first screen projection audio; the second electronic device outputs the first screen projection information based on the data stored in the second memory space, including: the audio output device of the second electronic device outputs the first screen projection audio based on the data stored in the second memory space.
[0364] In an embodiment of the present application, when the first screen projection information includes audio data of the first screen projection audio, the first request may include the aforementioned RDMA write request 2, the first screen projection audio may include the aforementioned screen projection audio 1, the first memory space may include the aforementioned audio buffer 1, the second memory space may include the aforementioned audio buffer 2, the first RDMA message may include the aforementioned RDMA message 2, and the first key may include the aforementioned key 2.
[0365] In some embodiments, the first projection information includes image data of the first projection screen; the clocks of the first electronic device and the second electronic device are synchronized, and the above method also includes: in the first refresh cycle, the first projection screen is written into the first memory space of the first electronic device; in the next refresh cycle of the first refresh cycle, the display screen of the first electronic device displays the first projection screen based on the data stored in the first memory space; the RDMA network card of the second electronic device writes the first projection information into the second memory space, including: in the first refresh cycle, the RDMA network card of the second electronic device writes the first projection information into the second memory space; the second electronic device outputs the first projection information based on the data stored in the second memory space, including: in the next refresh cycle of the first refresh cycle, the display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space. In the embodiment of the present application, the first refresh cycle may include the aforementioned vsync2, and the second refresh cycle may include the aforementioned vsync3.
[0366] S503. Based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space; the second electronic device outputs the first screen projection information based on the data stored in the second memory space.
[0367] In some embodiments, after the second electronic device outputs the first screen projection information based on the data stored in the second memory space, the method includes: the second electronic device receives the second input operation; the second electronic device stores the first screen projection reverse control event corresponding to the second input operation in the third memory space; the RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, the second request includes the data of the first screen projection reverse control event and the address of the fourth memory space of the first electronic device, and the second request is used to indicate that the data of the first screen projection reverse control event is written to the fourth memory space; based on the second request, the RDMA network card of the first electronic device writes the data of the first screen projection reverse control event into the fourth memory space; based on the first screen projection reverse control event stored in the fourth memory space, the first electronic device executes a first response event.
[0368] In some embodiments, before the RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, it also includes: after the second electronic device detects that the first screen projection reverse control event is stored in the third memory space, the RDMA network card of the second electronic device generates a second request based on the data of the first screen projection reverse control event in the third memory space.
[0369] In some embodiments, before the RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, the above method also includes: the first electronic device sends a second RDMA message to the second electronic device, the second RDMA message includes the address of the fourth memory space of the first electronic device, and the fourth memory space is used to store input events of the first electronic device.
[0370] In an embodiment of the present application, the second input operation may include the aforementioned screen projection reverse control operation; the third memory space may include the aforementioned event buffer 2; the first screen projection reverse control event may include the aforementioned screen projection reverse control event 1; the fourth memory space may include the aforementioned event buffer 1; the second request may include the aforementioned RDMA write request 3; the second RDMA message may include the aforementioned RDMA message 3.
[0371] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.
[0372] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.
[0373] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0374] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.
Claims
1. A screen projection method, characterized in that: Applied to a screen projection system, the screen projection system includes a first electronic device and a second electronic device, and the method includes: The first electronic device receives a first input operation, where the first input operation is used to trigger the first electronic device to project a screen onto the second electronic device; Based on the first input operation, the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, where the first request includes first screen projection information and an address of a second memory space of the second electronic device, and the first request is used to instruct to write the first screen projection information into the second memory space; Based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space; The second electronic device outputs first screen projection information based on the data stored in the second memory space.
2. The method according to claim 1, characterized in that The first screen projection information includes image data of a first screen projection picture; and the second electronic device outputs the first screen projection information based on the data stored in the second memory space, including: The display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space.
3. The method according to claim 1, characterized in that The first screen projection information includes audio data of the first screen projection audio; The second electronic device outputting first screen projection information based on the data stored in the second memory space includes: The audio output device of the second electronic device outputs the first screen projection audio based on the data stored in the second memory space.
4. The method according to claim 1, characterized in that: Before the RDMA network card of the first electronic device sends the first request to the RDMA network card of the second electronic device, the method further includes: After the first electronic device detects that the first electronic device synthesizes the first screen projection information and stores it in the first memory space, the RDMA network card of the first electronic device generates the first request based on the first screen projection information in the first memory space.
5. The method according to claim 4, characterized in that The first screen projection information includes image data of a first screen projection picture; the first electronic device and the second electronic device are clock-synchronized, and the method further includes: In a first refresh cycle, writing the first projection image into the first memory space of the first electronic device; In a next refresh cycle of the first refresh cycle, the display screen of the first electronic device displays the first projection screen based on the data stored in the first memory space; The RDMA network card of the second electronic device writes the first screen projection information into the second memory space, including: In the first refresh cycle, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space; The second electronic device outputting first screen projection information based on the data stored in the second memory space includes: In a refresh cycle next to the first refresh cycle, the display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space.
6. The method according to claim 1, characterized in that After the first electronic device receives the first input operation, before the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the method further includes: The second electronic device sends a first RDMA message to the first electronic device, where the first RDMA message includes an address of the second memory space of the second electronic device, where the second memory space is used to store screen projection information from the first electronic device.
7. The method according to claim 6, characterized in that Before the second electronic device sends the first RDMA message to the first electronic device, the method further includes: The second electronic device registers the second memory space to the RDMA network card of the second electronic device, and obtains a first key corresponding to the address of the second memory space; the first RDMA message also includes the first key, and the first request also includes the first key; The step of writing the first screen projection information into the second memory space by the RDMA network card of the second electronic device based on the first request includes: After the RDMA network card of the second electronic device determines that the first key included in the first request is the key corresponding to the address of the second memory space, the first screen projection information is written into the second memory space.
8. The method according to claim 6, characterized in that Before the RDMA network card of the second electronic device sends the first RDMA message to the RDMA network card of the first electronic device, the method further includes: Based on the first input operation, the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, and the first RDMA message and the first request are sent through the RDMA connection.
9. The method according to claim 8, characterized in that Before the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, the method further includes: In response to the first input operation, the first electronic device sends a screen projection request to the second electronic device through the first communication module; The first electronic device receives, through the first communication module, a screen projection response sent by the second electronic device; The RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, including: When the screen projection is determined based on the screen projection response, the RDMA network card of the second electronic device and the RDMA network card of the first electronic device establish an RDMA connection.
10. The method according to claim 1, characterized in that After the second electronic device outputs the first screen projection information based on the data stored in the second memory space, the method includes: The second electronic device receives a second input operation; The second electronic device stores the first screen projection reverse control event corresponding to the second input operation in a third memory space; The RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, where the second request includes data of the first screen projection reverse control event and an address of a fourth memory space of the first electronic device, and the second request is used to instruct writing the data of the first screen projection reverse control event into the fourth memory space; Based on the second request, the RDMA network card of the first electronic device writes the data of the first screen projection reverse control event into the fourth memory space; Based on the first screen projection reverse control event stored in the fourth memory space, the first electronic device executes a first response event.
11. The method according to claim 10, characterized in that Before the RDMA network card of the second electronic device sends the second request to the RDMA network card of the first electronic device, the method further includes: After the second electronic device detects that the first screen projection reverse control event is stored in the third memory space, the RDMA network card of the second electronic device generates the second request based on the data of the first screen projection reverse control event in the third memory space.
12. The method according to claim 10, characterized in that Before the RDMA network card of the second electronic device sends the second request to the RDMA network card of the first electronic device, the method further includes: The first electronic device sends a second RDMA message to the second electronic device, where the second RDMA message includes an address of the fourth memory space of the first electronic device, where the fourth memory space is used to store input events of the first electronic device.
13. A screen projection method, characterized in that: Applicable to a first electronic device, comprising: The first electronic device receives a first input operation, where the first input operation is used to trigger the first electronic device to project a screen onto a second electronic device; Based on the first input operation, the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the first request including first screen projection information and the address of the second memory space of the second electronic device, and the first request is used to indicate that the first screen projection information is written into the second memory space.
14. The method according to claim 13, characterized in that The first screen projection information includes image data of the first screen projection picture; the first screen projection information stored in the second memory space is used to display the first screen projection picture on the display screen of the second electronic device.
15. The method according to claim 13, characterized in that The first screen projection information includes audio data of the first screen projection audio; the first screen projection information stored in the second memory space is used for the audio output device of the second electronic device to output the first screen projection audio.
16. The method according to claim 13, characterized in that Before the RDMA network card of the first electronic device sends the first request to the RDMA network card of the second electronic device, the method further includes: After the first electronic device detects that the first electronic device synthesizes the first screen projection information and stores it in the first memory space, the RDMA network card of the first electronic device generates the first request based on the first screen projection information in the first memory space.
17. The method according to claim 13, characterized in that After the first electronic device receives the first input operation, before the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the method further includes: The first electronic device receives a first RDMA message sent by the second electronic device, where the first RDMA message includes an address of the second memory space of the second electronic device, and the second memory space is used to store screen projection information from the first electronic device.
18. The method according to claim 17, characterized in that Before the RDMA network card of the second electronic device sends the first RDMA message to the RDMA network card of the first electronic device, the method further includes: Based on the first input operation, the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, and the first RDMA message and the first request are sent through the RDMA connection.
19. The method according to claim 18, characterized in that Before the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, the method further includes: In response to the first input operation, the first electronic device sends a screen projection request to the second electronic device through the first communication module; The first electronic device receives, through the first communication module, a screen projection response sent by the second electronic device; The RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection, including: When the screen projection is determined based on the screen projection response, the RDMA network card of the first electronic device and the RDMA network card of the second electronic device establish an RDMA connection.
20. The method according to claim 13, characterized in that After the RDMA network card of the first electronic device sends a first request to the RDMA network card of the second electronic device, the method includes: The RDMA network card of the first electronic device receives a second request sent by the RDMA network card of the second electronic device, where the second request includes data of the first screen projection reverse control event and an address of a fourth memory space of the first electronic device, and the second request is used to instruct to write the data of the first screen projection reverse control event into the fourth memory space; Based on the second request, the RDMA network card of the first electronic device writes the data of the first screen projection reverse control event into the fourth memory space; Based on the first screen projection reverse control event stored in the fourth memory space, the first electronic device executes a first response event.
21. The method according to claim 20, characterized in that Before the RDMA network card of the first electronic device receives the second request sent by the RDMA network card of the second electronic device, the method further includes: The first electronic device sends a second RDMA message to the second electronic device, where the second RDMA message includes an address of the fourth memory space of the first electronic device, where the fourth memory space is used to store input events.
22. A screen projection method, characterized in that: Applicable to a second electronic device, comprising: The RDMA network card of the second electronic device receives a first request sent by the RDMA network card of the first electronic device, where the first request includes first screen projection information and an address of a second memory space of the second electronic device, and the first request is used to instruct writing the first screen projection information into the second memory space; Based on the first request, the RDMA network card of the second electronic device writes the first screen projection information into the second memory space; The second electronic device outputs first screen projection information based on the data stored in the second memory space.
23. The method according to claim 22, characterized in that The first screen projection information includes image data of a first screen projection picture; and the second electronic device outputs the first screen projection information based on the data stored in the second memory space, including: The display screen of the second electronic device displays the first projection screen based on the data stored in the second memory space.
24. The method according to claim 22, characterized in that The first screen projection information includes audio data of the first screen projection audio; The second electronic device outputting first screen projection information based on the data stored in the second memory space includes: The audio output device of the second electronic device outputs the first screen projection audio based on the data stored in the second memory space.
25. The method according to claim 22, characterized in that Before the RDMA network card of the second electronic device receives the first request sent by the RDMA network card of the first electronic device, the method further includes: The second electronic device sends a first RDMA message to the first electronic device, where the first RDMA message includes an address of the second memory space of the second electronic device, where the second memory space is used to store screen projection information from the first electronic device.
26. The method according to claim 25, characterized in that Before the second electronic device sends the first RDMA message to the first electronic device, the method further includes: The second electronic device registers the second memory space to the RDMA network card of the second electronic device, and obtains a first key corresponding to the address of the second memory space; the first RDMA message also includes the first key, and the first request also includes the first key; The step of writing the first screen projection information into the second memory space by the RDMA network card of the second electronic device based on the first request includes: After the RDMA network card of the second electronic device determines that the first key included in the first request is the key corresponding to the address of the second memory space, the first screen projection information is written into the second memory space.
27. The method according to claim 25, characterized in that Before the RDMA network card of the second electronic device sends the first RDMA message to the RDMA network card of the first electronic device, the method further includes: The RDMA network card of the second electronic device establishes an RDMA connection with the RDMA network card of the first electronic device, and the first RDMA message and the first request are sent through the RDMA connection.
28. The method according to claim 22, characterized in that After the second electronic device outputs the first screen projection information based on the data stored in the second memory space, the method includes: The second electronic device receives a second input operation; The second electronic device stores the first screen projection reverse control event corresponding to the second input operation in a third memory space; The RDMA network card of the second electronic device sends a second request to the RDMA network card of the first electronic device, the second request including the data of the first screen projection reverse control event and the address of the fourth memory space of the first electronic device, the second request is used to indicate that the data of the first screen projection reverse control event is written into the fourth memory space, and the fourth memory space is used to store the input event of the first electronic device.
29. The method according to claim 28, characterized in that Before the RDMA network card of the second electronic device sends the second request to the RDMA network card of the first electronic device, the method further includes: After the second electronic device detects that the first screen projection reverse control event is stored in the third memory space, the RDMA network card of the second electronic device generates the second request based on the data of the first screen projection reverse control event in the third memory space.
30. The method according to claim 28, characterized in that Before the RDMA network card of the second electronic device sends the second request to the RDMA network card of the first electronic device, the method further includes: The second electronic device receives a second RDMA message sent by the first electronic device, where the second RDMA message includes an address of the fourth memory space of the first electronic device.
31. An electronic device comprising a memory, one or more processors, and one or more computer programs; wherein: The one or more computer programs are stored in the memory; it is characterized in that when the one or more processors execute the one or more computer programs, the electronic device implements the method as described in any one of claims 13 to 21 or claims 22 to 30.
32. A computer storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to implement the method according to any one of claims 13 to 30.
Citation Information
Patent Citations
Screen projection method, system and related device
CN115145513A
Screen projection method and related device
CN115525366A
Screen projection method and device, storage medium and computer program product
CN115904282A
Systems, methods and devices for RDMA read / write operations
US20170034268A1
