A projection control system based on mirror extension mode switching display

By constructing a virtual double-buffered display pipeline at the operating system kernel level and pointer flipping at the video memory level, combined with window state memory and network coding control, the problems of black screen, flickering and window disorder in screen casting mode switching are solved, achieving a smooth screen casting switching experience.

CN123137598APending Publication Date: 2026-11-20SHENZHEN LIHUA HECHUANG TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611210987.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-11
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing screen mirroring mode switching technology causes the screen to briefly go black or flicker, window layout to become chaotic, and network traffic to surge, resulting in lag and affecting user experience.

Method used

A virtual double-buffered display pipeline is built at the operating system kernel level. The pointers between the main screen memory area and the virtual extended memory area are flipped at the video memory level. Combined with asynchronous video memory block copying, window state memory and reconstruction mechanism, and deep network coding control strategy, a smooth network flow is generated.

Benefits of technology

It achieves a seamless visual transition during screen mirroring switching, avoids black screen flickering caused by monitor reset, and allows windows to quickly return to their original positions, ensuring a consistent user experience and smooth network performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137598A_ABST
    Figure CN123137598A_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer data display processing technology, and specifically to a screen projection control system based on mirrored extended mode switching. The invention aims to solve the problems of black screen flickering, window misalignment, and network lag caused by existing screen projection switching methods. This invention addresses these issues by constructing a virtual double-buffered display pipeline at the kernel level and allocating an independent video memory area; upon intercepting the switching command, it extracts the window state to generate a desktop topology mapping table and locks the streaming bitrate; it directly executes the flipping operation of the screen projection encoder's video memory read pointer between the main screen and the virtual extended video memory area, and sends a transition frame differential data stream during the transition period, thereby avoiding system-level hot-plug events; finally, it reconstructs the coordinate data using an affine transformation matrix and injects it back into the window manager. This invention achieves seamless transition of the projected screen from the hardware level, ensuring consistency in window layout and stability of network transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer data display and processing technology, and to a screen projection control system based on mirrored extended mode switching display. Background Technology

[0002] Wireless screen mirroring technology, a core function of modern computers and smart devices, allows users to transmit their device's display content to a remote large screen in real time, enhancing the convenience of meeting presentations, home entertainment, and collaborative work. Screen mirroring typically includes two core modes: mirroring and extension. Mirroring mode completely replicates the device's main screen to a remote display, while extension mode uses the remote display as an extension of the device's main screen, creating a larger logical desktop space. Each mode has its advantages in different application scenarios.

[0003] Existing screen mirroring mode switching technologies typically use the native display settings interface provided by the operating system. When a user issues a switching command, the application requests the operating system to change its display configuration, such as changing from dual-screen extended mode to single-screen mirroring mode. Upon receiving the request, the operating system reinitializes the graphics driver subsystem, releases or reallocates display resources, and forces all applications to redraw their interfaces to adapt to the new desktop resolution and layout.

[0004] However, this switching method, which relies on the operating system's native interface, has inherent technical flaws. Because the switching process involves resetting the underlying graphics pipeline, it often causes a brief blackout or flickering of the screen, affecting the smoothness of the user experience. Simultaneously, when switching from extended mode to mirrored mode, application windows that were originally located in the extended screen area often have their logical coordinates invalidated in the new desktop space, and are frequently forced to stack at the edge of the main screen by the operating system, resulting in a chaotic window layout and even some windows becoming inaccessible. Furthermore, drastic changes in displayed content can trigger the video encoder to generate keyframes containing large amounts of data, and the sudden increase in network traffic can easily cause transmission stutters. Summary of the Invention

[0005] In view of this, in order to solve the problems mentioned in the background technology, a screen projection control system based on mirror extension mode switching display is proposed.

[0006] The objective of this invention can be achieved through the following technical solution: This invention provides a screen projection control system based on mirrored extended mode switching display, including: a video memory allocation module, which loads a virtual display driver at the operating system kernel layer to construct a virtual double-buffered display pipeline, and allocates a main screen video memory area and a virtual extended video memory area in the video memory.

[0007] The network encoding control state generation module intercepts the screen casting mode switching command, extracts the window state parameters of the currently active process to generate a historical desktop topology mapping table, and locks the current network transmission bitrate limit according to the screen casting mode switching command to pause the key frame generation request and obtain the network encoding control state.

[0008] The video memory pointer flip state generation module flips the video memory read pointer of the screen projection encoder between the main screen video memory area and the virtual extended video memory area according to the screen projection mode switching instruction, and obtains the video memory pointer flip state.

[0009] The smooth network stream generation module extracts a transition frame from the spare frame buffer and generates a differential data stream to be sent to the receiving end during the transition of the video memory pointer flip state. After the video memory pointer flip state is completed, the push stream bit rate is restored to obtain the smooth network stream.

[0010] The reconstructed coordinate matrix generation module reads the historical desktop topology mapping table to calculate the affine transformation matrix based on the target display domain resolution corresponding to the screen casting mode switching command, and uses the affine transformation matrix to reconstruct the window coordinate data to obtain the reconstructed coordinate matrix.

[0011] The target logical position regression module reconstructs the coordinate matrix and injects it into the operating system's window manager to reposition the active window to the target logical position.

[0012] Compared with the prior art, the embodiments of the present invention have at least the following advantages or beneficial effects: (1) The present invention constructs a virtual double-buffered display pipeline at the operating system kernel layer. When switching the projection mode, it directly performs the "encoder read pointer flipping" operation between the main screen video memory area and the virtual extended video memory area at the video memory level, and cooperates with asynchronous video memory block copying. This mechanism effectively avoids the global display hot-plug event triggered by calling the system native interface in the traditional method. Combined with transition frame extraction and differential streaming technology, it eliminates the black screen and flickering phenomenon caused by display pipeline reset from the hardware bottom layer, and realizes the visual seamless connection in the projection switching process.

[0013] (2) This invention proposes a window state memory and reconstruction mechanism. Before switching, the system automatically extracts and saves the window states of all active processes and generates a historical desktop topology mapping table; after switching, it calculates the affine transformation matrix by combining the target display domain resolution difference, and directly injects the reconstructed coordinate matrix into the window manager at the operating system's underlying layer. This mechanism not only avoids the problems of window disorder, overlap, or deviation from the visible area caused by forced rearrangement at the underlying layer, but also forces active windows to quickly return to the correct logical position, ensuring the visual coherence and operational continuity of the user's workspace.

[0014] (3) This invention introduces a deep network coding control strategy. The upper limit of the transmission bit rate is locked and the key frame generation request is intercepted at the moment the switching command is intercepted; only low bit rate differential data streams are sent during the transition period; after the video memory pointer flips and stabilizes, the step-wise smooth recovery of the push stream bit rate is performed. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a schematic diagram of the system module structure connection of the present invention.

[0017] Figure 2 This is a bar chart showing the memory consumption of the dual-buffered pipeline at different resolutions according to the present invention.

[0018] Figure 3 This is a graph showing the smooth recovery of the streaming bitrate during the screen mirroring mode switching process of this invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] Please see Figure 1 The present invention provides a screen projection control system based on mirrored extended mode switching display, including: a video memory area allocation module, a network encoding control state generation module, a video memory pointer flip state generation module, a smooth network flow generation module, a reconstructed coordinate matrix generation module, and a target logical position regression module.

[0021] The memory allocation module is connected to the network coding control state generation module. Both the memory allocation module and the network coding control state generation module are connected to the memory pointer flip state generation module. The memory pointer flip state generation module is connected to the smooth network flow generation module. Both the memory allocation module and the smooth network flow generation module are connected to the reconstructed coordinate matrix generation module. The reconstructed coordinate matrix generation module is connected to the target logical position regression module.

[0022] See Figure 2The video memory allocation module loads a virtual display driver at the operating system kernel layer to build a virtual double-buffered display pipeline, and allocates a main screen video memory area and a virtual extended video memory area in the video memory.

[0023] In a specific embodiment of the present invention, a virtual double-buffered display pipeline is constructed by loading a virtual display driver at the operating system kernel layer, and a main screen video memory area and a virtual extended video memory area are opened in the video memory, including: injecting a virtual display driver into the operating system kernel layer to obtain the driver loading state.

[0024] By utilizing the driver loading state, a virtual extended screen is registered with the operating system, generating a dual-pipeline rendering state where the physical main screen and the virtual extended screen coexist.

[0025] Based on the dual-pipeline rendering state, independent frame buffers are divided in the video memory to generate the main screen video memory area and the virtual extended video memory area.

[0026] Specifically, this step aims to establish a parallel display processing environment, providing a foundation for seamless switching between subsequent screen mirroring modes. The implementation process begins with injecting a virtual display driver into the operating system kernel layer. This virtual display driver is a specially designed software module, typically developed based on the operating system's standard graphics display driver architecture, such as the WDDM architecture under Windows or the DRM framework under Linux. Its function is to register virtual display EDID extended display identification data parameters with the system bus, simulating a physically non-existent display device for the operating system, making the operating system believe that an additional display is connected to the system. The injection operation is completed by calling the driver loading interface provided by the operating system, and after execution, a driver loading status is returned. This driver loading status is a Boolean value or status code used to explicitly indicate whether the driver has been successfully loaded and accepted by the operating system kernel layer.

[0027] A successful driver loading is a prerequisite for subsequent operations. Using this successful driver loading, the program then sends a registration request to the operating system's Graphics-Device-Interface to formally declare the existence of a virtual extended screen. Upon receiving this request, the operating system updates its internal list of display devices, thus generating a dual-pipeline rendering state where the physical primary screen and the virtual extended screen coexist. In this state, the operating system's window manager and rendering engine simultaneously manage and render graphical content for both the physical primary screen and the newly registered virtual extended screen, just as if two physical monitors were connected.

[0028] Finally, based on the established dual-pipeline rendering state, independent frame buffers need to be allocated in the GPU's video memory for each of the two display pipelines. A frame buffer is a specific area in video memory used to store a complete frame of image data. The allocation operation generates a primary screen video memory area and a virtual extended video memory area. These two video memory areas are physically isolated, ensuring that read / write operations on one area will not interfere with the other. The size of each video memory area is determined by the resolution and color depth of its corresponding screen. The size of the primary screen video memory area is calculated using the following formula:

[0029] In the formula, This represents the amount of storage space required for the main screen's video memory area, measured in bytes. and These represent the horizontal and vertical resolutions of the physical main screen, i.e., the number of pixels in the horizontal and vertical directions, respectively. The product of the two represents the total number of pixels. These parameters are determined by the hardware specifications of the physical display device. This represents the color depth of each pixel, measured in bytes per pixel. This value is based on the current display settings of the operating system; for example, it is set to 4 bytes for the 32-bit true color display mode commonly found on mainstream display devices.

[0030] Similarly, the size of the virtual extended video memory area is calculated using the following formula:

[0031] In the formula, This represents the amount of storage space required for the virtual extended video memory area, measured in bytes. and These represent the horizontal and vertical resolutions of the virtual extended screen, i.e., the number of pixels in the horizontal and vertical directions, respectively. These parameters can be configured when loading the virtual display driver to meet the needs of different screen projection scenarios. The definition is consistent with that in the calculation of the main screen video memory area. Through these two calculations, the system ensures that accurate and sufficient video memory space is allocated to the two display pipelines.

[0032] For example, assume that the physical main screen hardware connected to the current computer system has a resolution of 1920x1080 pixels and the operating system uses a 32-bit true color display mode.

[0033] First, the virtual display driver is injected into the operating system kernel layer. Once this operation is successful, the system returns a driver loading status with a status code of 1, indicating successful loading.

[0034] Using this driver loading state with a value of 1, the program registers a virtual extended screen with the same resolution of 1920x1080 pixels with the operating system. After the operating system confirms the registration, a dual-pipeline rendering state is generated. At this time, the system device manager will display two monitors: one is the physical main screen, and the other is the virtual extended screen.

[0035] Subsequently, based on this dual-pipeline rendering state, the frame buffer is partitioned in the video memory. At this point, the parameters are set as follows: physical main screen horizontal resolution. The vertical resolution is 1920. The horizontal resolution is 1080p. The vertical resolution is 1920. 1080. Color depth per pixel. It is 4 bytes.

[0036] Calculate the size of the main screen's video memory area using the formula. Bytes. Next, calculate the size of the virtual extended video memory area. byte.

[0037] After the calculation was completed, the system allocated two independent memory regions, each 8,294,400 bytes in size, in the video memory, as the main screen video memory region and the virtual extended video memory region, respectively, thus completing the entire process.

[0038] The network encoding control state generation module intercepts the screen casting mode switching command, extracts the window state parameters of the currently active process to generate a historical desktop topology mapping table, and locks the current network transmission bitrate limit according to the screen casting mode switching command to pause the key frame generation request and obtain the network encoding control state.

[0039] In a specific embodiment of the present invention, the screen casting mode switching command is intercepted, the window state parameters of the currently active process are extracted to generate a historical desktop topology mapping table, and the current network transmission bitrate limit is locked according to the screen casting mode switching command to pause the key frame generation request to obtain the network encoding control state, including: in response to the screen casting mode switching command, pausing the call to the operating system's native display settings interface to obtain the system interception state.

[0040] Based on the system interception state, all currently active processes are traversed, and the handle, resolution scaling ratio, and coordinate matrix of the active window are extracted to obtain the window state parameters.

[0041] The window state parameters are stored in memory according to the process hierarchy to generate a historical desktop topology mapping table.

[0042] In response to the screen mirroring mode switching command, the real-time bandwidth data of the current network transmission channel is obtained to obtain the current network transmission bit rate limit.

[0043] The bitrate lock state is obtained by configuring the encoder's output limit parameters using the current network transmission bitrate limit.

[0044] Based on the bitrate lock state, the encoder's full screen refresh request is intercepted to pause the keyframe generation request and generate a network encoding control state.

[0045] Specifically, the core task of this step is to simultaneously perform two key operations when receiving the screen mirroring mode switching command. The first is to accurately record the geometry and hierarchy information of all currently active windows for subsequent window layout restoration. The second is to pre-control the network encoding transmission to ensure a smooth and lag-free video stream during the switching process.

[0046] When a user triggers a screen mirroring mode switch, the system generates a screen mirroring mode switch command. To avoid screen blackouts or flickering caused by switching the operating system's native display mode, the program first responds to this screen mirroring mode switch command by deploying an API-Hook (Application Programming Interface Hook) or message filtering driver at the operating system kernel layer to intercept and suspend calls to the operating system's native display settings interface. This suspension operation allows the application to take over the management of the display mode, thus generating a system interception state. This system interception state is an internal flag indicating that subsequent display state changes will be controlled by the program's logic, rather than the operating system's default behavior.

[0047] In system interception mode, the desktop window layout is temporarily "frozen." The program immediately traverses all running processes in the current operating system and extracts the window state parameters of each active window. Simultaneously, the system allocates a separate memory block in video memory or system memory as a spare frame buffer and calls a video memory read instruction to capture and lock the last complete frame of the currently active screen (main screen or virtual extended screen) at the moment the screen mirroring mode switching instruction is triggered. This frame buffer serves as the reference source for subsequent screen transitions. Window state parameters are a dataset describing window characteristics, specifically containing three core elements. The first is a handle, a unique numerical identifier assigned to each window by the operating system for precise identification and manipulation of a specific window. The second is the resolution scaling factor, which describes the ratio between the window's logical size and physical pixel size in a high-resolution screen environment, ensuring the window scales correctly at different resolutions. The third is a coordinate matrix, which defines the window's precise position and size in the entire desktop virtual coordinate space, typically including the x and y coordinates of the window's top-left corner, as well as the window's width and height.

[0048] After collecting the window state parameters of all active windows, these parameters are structured and stored in a dedicated memory space according to their front-to-back occlusion order on the screen, i.e., their process hierarchy. This storage structure with hierarchical information ultimately generates a historical desktop topology mapping table. This mapping table is a complete snapshot of the current desktop layout, providing a precise basis for restoring window positions in new display modes.

[0049] Simultaneously, in response to the same screen mirroring mode switching command, the program initiates a network status adjustment process. It monitors the performance of the current network transmission channel in real time, obtaining real-time bandwidth data through statistical analysis of recent data packet sending and acknowledgment times. This data is used as the current network transmission bitrate cap. The formula for calculating this cap is:

[0050] In the formula, This represents the current network transmission rate limit, measured in bits per second (bps) or kilobits per second (kbps). It refers to the average network transmission rate measured within a short time window (e.g., 500 milliseconds) in the past, and its unit is... Maintain consistency. This is a safety factor, with a value set between 0 and 1. Based on over 500 transmission tests under different network environments, [the following is a summary of the data]. Setting it to 0.9 can maximize the use of available bandwidth while ensuring transmission stability, effectively avoiding congestion caused by network fluctuations.

[0051] Once the current network transmission bitrate limit is obtained, the program will immediately use this value to configure the output limit parameters of the video encoder, forcing the bitrate of the video stream generated by the encoder to not exceed [a certain value]. After this configuration is completed, the encoder enters a rate-locked state.

[0052] Based on this rate-locked state, the program further sends instructions to the encoder to intercept its full-frame refresh request. Full-frame refresh requests are typically used to generate keyframes in a video sequence. Keyframes contain complete image information and are extremely large in data volume. During the brief transition period of mode switching, sending new keyframes is not only unnecessary but also impacts the already limited bandwidth. Therefore, by pausing keyframe generation requests, the amount of data transmitted during the transition can be significantly reduced. Ultimately, rate locking and keyframe pausing together constitute the network encoding control state, ensuring the smoothness and fluidity of the network stream during switching.

[0053] For example, suppose the user is in extended screen mirroring mode, with a physical main screen resolution of 1920x1080 and a virtual extended screen resolution of 1920x1080. Three active windows are open on the desktop: window A (text editor), window B (browser), and window C (file manager), with window B covering window A and window C located on the virtual extended screen. The user then clicks the button to switch to mirroring mode, and the system generates a screen mirroring mode switching command.

[0054] In response to this screen mirroring mode switching command, the program first pauses calls to the system display settings interface, generating a system interception state. Based on this system interception state, the program iterates through the active windows on the desktop and extracts their respective window state parameters as follows: Window A has a handle of 0x1A2B, a resolution scaling factor of 1.0, and a coordinate matrix of [x:200, y:150, width:800, height:600]. Window B has a handle of 0x3C4D, a resolution scaling factor of 1.0, and a coordinate matrix of [x:400, y:250, width:1024, height:768]. Window C has a handle of 0x5E6F, a resolution scaling factor of 1.0, and a coordinate matrix of [x:2020, y:100, width:700, height:500]. The x-coordinate value of 2020 (1920+100) indicates that it is located on a virtual extended screen.

[0055] These window state parameters are stored in memory according to the process hierarchy of [Window B, Window A, Window C] (Window B is at the top level), generating a historical desktop topology mapping table.

[0056] Simultaneously, the program acquires real-time bandwidth data of the current network transmission channel and measures the average network transmission rate over the last 500 milliseconds. for Safety factor Set to 0.9.

[0057] Calculate the current network transmission bit rate limit The program configures the encoder's maximum output bit rate to... This puts the network into a rate-locked state. Subsequently, the program intercepts the encoder's full-frame refresh request and pauses keyframe generation. These two actions together generate the network encoding control state, completing the entire preparation process.

[0058] The video memory pointer flip state generation module flips the video memory read pointer of the screen projection encoder between the main screen video memory area and the virtual extended video memory area according to the screen projection mode switching instruction, and obtains the video memory pointer flip state.

[0059] In a specific embodiment of the present invention, according to the screen casting mode switching instruction, the video memory read pointer of the screen casting encoder is flipped between the main screen video memory area and the virtual extended video memory area to obtain the video memory pointer flipping state, including: parsing the screen casting mode switching instruction to obtain the target switching mode.

[0060] When the target switching mode is from extended mode to mirror mode, the video memory read pointer of the screen projection encoder is flipped directly from the virtual extended video memory area to the main screen video memory area to obtain the first flip instruction.

[0061] The asynchronous memory block copying operation is initiated based on the first flip instruction, generating a memory pointer flip state.

[0062] Specifically, after saving the window layout snapshot and pre-controlling the network encoding, this step executes the core operation of switching the content source for the projection. The entire process begins with the generated projection mode switching command. The program first needs to parse this command to clarify the user's intended switching direction, i.e., to obtain the target switching mode. The target switching mode is a clear identifier, such as switching from extended mode to mirrored mode, or vice versa.

[0063] This step describes the scenario of switching from extended mode to mirrored mode. In this scenario, the screen mirroring encoder is reading and encoding the content of the virtual extended video memory area before the switch to achieve screen mirroring of the extended screen. When it is confirmed that the target switching mode is from extended mode to mirrored mode, the system will immediately operate on the video memory read pointer of the screen mirroring encoder. This video memory read pointer is essentially a memory address, which tells the encoder from which starting position in the video memory to start capturing image data. The operation is to flip this pointer from the base address of the virtual extended video memory area it is currently pointing to, directly pointing to the base address of the main screen video memory area. This pointer modification instruction is the first flip instruction. The execution of this instruction is instantaneous; it directly changes the encoder's data source, causing the encoder to switch the captured content from the virtual extended screen to the physical main screen starting from the next frame.

[0064] The flipping of a pointer can be expressed by the following formula:

[0065] In the formula, This represents the memory address held by the video memory read pointer of the screen projection encoder. This represents the starting physical address of the partitioned main screen video memory area. This address is a fixed value determined by the graphics driver during the video memory partitioning process. Essentially, this operation assigns the address of the main screen video memory area to the encoder's source address variable.

[0066] After issuing the first flip instruction, thus completing the pointer flip, the system immediately initiates an asynchronous memory block copy operation to ensure the continuity of display logic and the immediacy of switching back to extended mode. Asynchronous means that this copying task runs in the background of the graphics processing unit (GPU) and does not block the current main processing flow. This operation continuously copies the contents of the main screen's memory area completely to the virtual extended memory area. The purpose of this is to keep the content of the virtual extended screen consistent with the main screen in real time, providing logical support for mirrored mode. Once this asynchronous copying operation is started, the entire system enters the memory pointer flip state. This state signifies that the data source switch has been completed and background data synchronization is underway, providing a clear signal for subsequent smooth transition processing.

[0067] For example, following the steps above, the system is currently in extended projection mode, and the user has issued a projection mode switching command to switch from extended mode to mirror mode. Both the physical main screen and the virtual extended video memory area have been allocated in video memory, each with a size of 8,294,400 bytes. Assuming the available starting address of the video memory is 0x80000000, then the address range of the main screen video memory area is [0x80000000, 0x807E8FFF], and the address range of the virtual extended video memory area is [0x807E9000, 0x80FD1FFF].

[0068] The program first parses the screen mirroring mode switching command and obtains the target switching mode as "switching from extended mode to mirror mode".

[0069] Before switching, the video memory read pointer of the screen projection encoder It points to the starting address of the virtual extended video memory area, that is... .

[0070] Because the target switching mode matches, the system generates the first flip instruction. Executing this instruction flips the screen projection encoder's video memory read pointer directly from the virtual extended video memory area to the main screen video memory area. The pointer address changes as follows: The value was updated from 0x807E9000 to 0x80000000.

[0071] From this moment on, the screen encoder begins to read data from the main screen's memory area for encoding and streaming.

[0072] Based on the successful execution of the first flip instruction, the system immediately initiates an asynchronous memory block copy operation. This operation instruction continuously executes the following task in the background: copying a memory block with a source address of 0x80000000 and a size of 8,294,400 bytes to a memory region with a target address of 0x807E9000.

[0073] With the initiation of this asynchronous copy operation, the system state is updated to the video memory pointer flip state, indicating that the core switching operation has been completed and the transition synchronization phase has begun.

[0074] According to the screen casting mode switching instruction, the video memory read pointer of the screen casting encoder is flipped between the main screen video memory area and the virtual extended video memory area to obtain the video memory pointer flipping state. It also includes: when the target switching mode is switching from mirror mode to extended mode, the video memory block copying operation is stopped to obtain the copying stop state.

[0075] By utilizing the copy stop state, the video memory read pointer of the screen projection encoder is switched back to the virtual extended video memory area to obtain the second flip instruction.

[0076] The second flip instruction updates the reading source of the projection encoder, generating the video memory pointer flip state.

[0077] Specifically, this step explains the core switching logic of the content source when switching from mirror mode back to extended mode, as a reverse operation. When the system receives the screen casting mode switching command from mirror mode to extended mode, the first thing it needs to handle is the background task that runs continuously in mirror mode to keep the content of the two screens synchronized.

[0078] To achieve the mirroring effect, the system initiates an asynchronous memory block copying operation, which continuously copies the contents of the main screen memory to the virtual extended memory. When the target switching mode changes from mirror mode to extended mode, this synchronization operation must be terminated because in extended mode, the two display areas need to carry their own independent content. Therefore, the system sends a command to the graphics processing unit to immediately stop the memory block copying operation. After the operation successfully stops, the system receives a copy stop status, which is an acknowledgment signal indicating that data synchronization between the main screen memory and the virtual extended memory has been broken, and both can be used as independent frame buffers.

[0079] Using this copy-stopped state as a prerequisite for execution, the system can safely proceed to the next step. The program will switch the screen projection encoder's memory read pointer from the main screen memory area it is currently pointing to back to the virtual extended memory area. This pointer switching instruction is the second flip instruction. The execution of this instruction means that the screen projection encoder's data acquisition source will change from the physical main screen's image to the virtual extended screen's image.

[0080] The pointer switching operation can be expressed by the following formula:

[0081] In the formula, It still represents the memory address held by the video memory read pointer of the screen projection encoder. This represents the starting physical address of the partitioned virtual extended video memory area. This operation assigns the base address of the virtual extended video memory area to the encoder's source address variable, completing the logical switch of the data source.

[0082] Finally, to prevent the encoder from reading dirty data from the old main screen image remaining in the virtual extended video memory area at the moment copying stops, after updating the reading source of the projection encoder based on the second flip instruction, the system will actively wait for the operating system's rendering engine to write at least one frame of completely new independent desktop image data to the virtual extended video memory area before officially opening encoding and streaming, generating a video memory pointer flip state. This state signifies that the content source switch from mirrored to extended mode has been successfully completed without ghosting, laying the foundation for possible subsequent window rearrangements, such as moving some windows to the extended screen and smooth adjustments to the network stream.

[0083] For example, following the steps described above, the system is currently in mirroring mode. The video memory read pointer of the mirroring encoder... The current address points to the starting address of the main screen's video memory area, 0x80000000. Simultaneously, an asynchronous video memory block copying operation is running in the background, continuously copying the video memory contents from address 0x80000000 to 0x807E8FFF to the virtual extended video memory area starting at address 0x807E9000. At this point, the user issues a command to switch from mirror mode to extended mode.

[0084] The system parses the screen mirroring mode switching command and obtains the target switching mode as "switching from mirror mode to extended mode". Based on this target switching mode, the system first sends a command to the graphics processing unit to stop the ongoing memory block copying operation. After the operation stops, the system obtains the copying stopped status.

[0085] Using this copy-stopped state, the system generates a second flip instruction, switching the projector encoder's video memory read pointer back to the virtual extended video memory area. The pointer address changes as follows: The value was updated from 0x80000000 to 0x807E9000.

[0086] Based on the execution of the second flip instruction, the reading source of the screen projection encoder was successfully updated to the virtual extended video memory area. The system then generates a video memory pointer flip state, indicating that the projected content has been successfully switched to an independent virtual extended screen image, completing the switch from mirror mode to extended mode.

[0087] See Figure 3 The smooth network stream generation module extracts a transition frame from the spare frame buffer and generates a differential data stream to be sent to the receiving end during the transition of the video memory pointer flip state. After the video memory pointer flip state is completed, the push stream bit rate is restored to obtain the smooth network stream.

[0088] In a specific embodiment of the present invention, during the transition period of the video memory pointer flip state, a transition frame is extracted from the spare frame buffer and a differential data stream is generated and sent to the receiving end. After the video memory pointer flip state is completed, the push stream bitrate is restored to obtain a smooth network stream. This includes: monitoring the execution cycle of the video memory pointer flip state to obtain a transition time window.

[0089] Within the transition time window, a gradient frame that retains the previous frame is extracted from the spare frame buffer and used as the transition frame.

[0090] The transition frame is encoded to generate a low-bit-rate differential data stream and sent to the receiving end. After the transition time window ends, the push stream bit rate is increased in a stepwise manner to generate a smooth network stream.

[0091] Specifically, this step follows the toggle of the video memory read pointer. Its core objective is to provide a visually continuous and network-transmitted smooth video stream to the receiving end during the brief transition period of mode switching, avoiding black screens, stuttering, or screen tearing. The entire process begins with monitoring the generated video memory pointer toggle state. The system continuously tracks the execution cycle of this state, from the pointer toggle and asynchronous copying until the system confirms the new data source is stable. This defined time period is the transition time window. The duration of this window is set to a fixed value based on statistical analysis of over a hundred hardware switching tests to ensure that the time required for state switching can be covered on devices with different performance levels.

[0092] Within a defined transition time window, to avoid visually jumping by directly pushing a new, significantly different image to the receiving end, the system does not immediately encode the content from the video memory pointed to by the new pointer. Instead, the program extracts a transition frame from a spare frame buffer. The spare frame buffer is the memory area where the system saves the last valid frame before the switch when the screen mirroring mode switching command is intercepted. The transition frame is not simply a retransmission of the last frame, but a gradient frame generated after special processing of that frame. Specifically, the system uses the graphics processing unit's shaders or image processing algorithms to, based on the extracted last frame, linearly or non-linearly decay the luminance weights of the RGB color channels of the global pixels of the image frame by frame, according to the elapsed time of the transition time window, or performs alpha blending calculations on the image with a solid color background to generate a transition image that gradually fades from the original image to the solid color background. Since standard video encoding streams typically do not include a transparency channel, this visual buffering animation effect based on pre-mixing or luminance decay provides a visual buffer for subsequent image transitions.

[0093] After acquiring the transition frames, the system encodes them. Keyframe generation requests are paused, and the encoder will only generate differentially encoded frames at this point. The changes between transition frames are minor and regular, such as only changes in transparency, resulting in a low-bitrate differential data stream after encoding. This low-bitrate differential data stream is sent to the receiving end, maintaining the continuity of the video stream while adhering to the set current network transmission bitrate limit, thus avoiding network strain.

[0094] When the transition time window ends, it means the memory pointer flipping state is complete, and the encoder has stably read data from the main screen memory. At this point, the streaming bitrate needs to be restored from the restricted state to a normal level. To avoid network congestion caused by sudden bitrate increases, the system adopts a step-by-step strategy to increase the streaming bitrate. The streaming bitrate will be smoothly increased according to a preset recovery curve until it reaches the target streaming bitrate value allowed by the current network conditions. This complete process of sending a low bitrate transition stream and then smoothly restoring the bitrate ultimately generates the smooth network stream seen by the receiver. The streaming bitrate recovery process can be described by the following formula:

[0095] In the formula, This represents any point in the recovery phase after the transition time window has ended. The instantaneous streaming bit rate, measured in bits per second (bps) or kilobits per second (kbps). It is the calculated and locked upper limit of the current network transmission bit rate. It is the target push bitrate that is reassessed based on the current real-time network conditions. It is the time elapsed since the end of the transition time window, and its value ranges from 0 to... . This is the total bitrate recovery time. This value is set based on the characteristics of the network transport protocol, for example, set to 1000 milliseconds to provide a gentle bitrate ramp-up and avoid triggering network congestion control. When equal hour, achieve The bitrate has been restored.

[0096] For example, following the aforementioned steps, the system has entered the video memory pointer toggling state, and the network encoder is in the network encoding control state, with the current network transmission bitrate limit set to [value missing]. It is locked at 7200kbps.

[0097] The system begins monitoring the execution cycle of the memory pointer toggling state. Based on hardware test data, this cycle is set to 300 milliseconds, thus obtaining a 300-millisecond transition time window.

[0098] Within this 300-millisecond transition window, the system extracts the last extended screen frame before the handover from the spare frame buffer. Based on this frame, a series of gradient frames are generated as transition frames; for example, the image fades out linearly within 300 milliseconds. These transition frames are processed by the encoder. Due to the minimal changes between frames, the generated differential data stream bitrate is only 500kbps, far below the 7200kbps upper limit, and is successfully transmitted to the receiving end.

[0099] After the 300ms transition time window ends, the memory pointer toggles. The system then begins to gradually increase the streaming bitrate. Assuming that the target streaming bitrate is determined after re-evaluating the network at this point... For 10000kbps, bitrate recovery time Set to 1000 milliseconds.

[0100] The streaming bitrate will be restored according to a formula. For example, at 500 milliseconds after the start of the restoration phase. Instantaneous streaming bitrate The calculation process is as follows: .

[0101] The bitrate will continue to increase smoothly until it reaches 10000kbps after 1000 milliseconds. Through this series of operations, the system ultimately generates and transmits a smooth network stream, ensuring a high-quality viewing experience for the receiving end during mode switching.

[0102] The reconstructed coordinate matrix generation module reads the historical desktop topology mapping table to calculate the affine transformation matrix based on the target display domain resolution corresponding to the screen casting mode switching command, and uses the affine transformation matrix to reconstruct the window coordinate data to obtain the reconstructed coordinate matrix.

[0103] In a specific embodiment of the present invention, based on the target display domain resolution corresponding to the screen casting mode switching command, the historical desktop topology mapping table is read to calculate the affine transformation matrix, and the window coordinate data is reconstructed using the affine transformation matrix to obtain the reconstructed coordinate matrix, including: obtaining the difference between the target display domain resolution corresponding to the screen casting mode switching command and the current physical resolution to obtain the resolution difference.

[0104] The coordinate scaling ratio and translation vector are calculated based on the resolution difference and the historical desktop topology mapping table, and an affine transformation matrix is ​​generated.

[0105] The original coordinates and occlusion relationships in the historical desktop topology mapping table are recalculated using an affine transformation matrix to generate a reconstructed coordinate matrix.

[0106] Specifically, after the smooth transition of the video stream during the screen mirroring mode switch is complete, this step aims to resolve the desktop window layout issues caused by the change in display mode. It uses a saved desktop snapshot to calculate the correct position of all active windows in the new display mode.

[0107] The process is triggered by intercepted screen mirroring mode switching commands. First, the program parses the target display domain resolution from these commands. The target display domain resolution refers to the logical pixel size occupied by the entire desktop after the switch. For example, when switching from extended mode to mirrored mode, the target display domain resolution is the resolution of the physical main screen. The program obtains this target display domain resolution and the global logical desktop resolution before the switch (i.e., the sum of the logical resolutions of the main screen and the virtual extended screen), and analyzes the difference between the two to obtain the resolution difference. This resolution difference is not a simple numerical value, but rather a description of the change in the topology of the desktop virtual space; it indicates which desktop areas will no longer be visible after the switch.

[0108] Next, the system reads the generated historical desktop topology mapping table and, combined with the resolution difference obtained in the previous step, calculates an affine transformation matrix for each window that needs to be repositioned. An affine transformation matrix is ​​a mathematical tool that can perform various transformations on geometric objects, such as scaling, rotation, and translation, through a single matrix operation. In this scenario, it is mainly used for translating and scaling windows. This matrix consists of two core parts: the coordinate scaling ratio and the translation vector. The coordinate scaling ratio determines whether the window size needs to be adjusted, while the translation vector determines the distance and direction the window needs to be moved.

[0109] In scenarios where switching from extended mode to mirrored mode, windows that were originally located on the virtual extended screen need to be moved back to the main screen display area. The original coordinates of a window... The new coordinates are obtained after affine transformation. The process can be represented by the following matrix multiplication:

[0110] In the formula, This is the affine transformation matrix. and It represents the components of the coordinate scaling ratio in the horizontal and vertical directions. and These are the horizontal and vertical components of the translation vector. Simultaneously, the window's geometry will also be transformed according to the scaling ratio; that is, the reconstructed width equals the original width multiplied by [the original width]. The reconstructed height is equal to the original height multiplied by For windows that are already on the main screen, their affine transformation matrix is ​​an identity matrix, i.e. This indicates that the position and size remain unchanged. For windows that were originally on the virtual extended screen, they need to be translated back to the main screen. The translation vector is calculated based on the width of the main screen, and the scaling ratio is usually 1, unless the resolution of the target display device is different from that of the original extended screen.

[0111] Finally, the system uses the calculated affine transformation matrix to recalculate the original coordinates of each window recorded in the historical desktop topology mapping table. This calculation process iterates through all windows in the mapping table, applying the corresponding affine transformation to the coordinate matrix of each window to generate a completely new set of coordinate data. Simultaneously, the system also considers the occlusion relationships between windows, i.e., their... The axis order is fully inherited from the historical desktop topology mapping table, ensuring that the top-level window remains on top after rearrangement. This set of data, containing the new coordinates and the original occlusion relationships, ultimately constitutes the reconstructed coordinate matrix, providing precise instructions for the next step of the actual window rearrangement operation.

[0112] For example, following the steps described above, the system is switching from extended mode to mirrored mode. The physical home screen resolution is 1920x1080. The generated historical desktop topology map records the window state parameters of the three active windows: window (On the main screen): The coordinate matrix is ​​[x:200, y:150, width:800, height:600]. Window B (on the main screen): The coordinate matrix is ​​[x:400, y:250, width:1024, height:768]. Window C (on the virtual extended screen): The coordinate matrix is ​​[x:2020, y:100, width:700, height:500].

[0113] The occlusion relationship is such that window B is on top of window A, and window C is at the bottom layer.

[0114] First, the system obtains the target display domain resolution corresponding to the screen mirroring mode switching command, which is 1920x1080 in mirror mode. Before the switch, the global logical desktop resolution is 3840x1080, with the main screen and the virtual extended screen horizontally stitched together. The resulting resolution difference indicates that all areas with an x-coordinate greater than or equal to 1920 will become invisible. Based on this resolution difference and the historical desktop topology mapping table, the system begins to calculate the affine transformation matrix.

[0115] For windows A and B, since their x-coordinates are both less than 1920, they are located in the main screen area and do not need to be moved. Therefore, their affine transformation matrix is ​​the identity matrix, i.e., the coordinate scaling ratio. Translation vector .

[0116] For window C, its x-coordinate is 2020, which exceeds the main screen's width and needs to be translated. The translation distance is the width of the main screen, 1920 pixels. Therefore, its coordinate scaling ratio is... The translation vector is .

[0117] Affine transformation matrix of window C for: .

[0118] The original coordinates of window C are recalculated using this affine transformation matrix. The original coordinates of the top-left corner of window C are (2020, 100).

[0119] The calculation process is as follows: , .

[0120] The new coordinates of window C are (100, 100). Since the scaling factor is 1, its width and height remain unchanged.

[0121] The final reconstructed coordinate matrix is ​​as follows: Window A: [x:200, y:150, width:800, height:600]. Window B: [x:400, y:250, width:1024, height:768]. Window C: [x:100, y:100, width:700, height:500]. The occlusion relationship remains unchanged, with window B above window A and window C at the bottom layer. This reconstructed coordinate matrix is ​​ready to be injected into the operating system.

[0122] The target logical position regression module reconstructs the coordinate matrix and injects it into the operating system's window manager to reposition the active window to the target logical position.

[0123] In a specific embodiment of the present invention, the reconstructed coordinate matrix is ​​injected into the window manager of the operating system in reverse so that the active window is returned to the target logical position. This includes: calling the underlying application programming interface of the operating system to establish a communication link with the window manager to obtain the injection channel.

[0124] The reconstructed coordinate matrix is ​​sent to the window manager via the injection channel to obtain coordinate update instructions.

[0125] The coordinate update command forces the window manager to rearrange the active windows according to the reconstructed coordinate matrix, so that the active window is returned to the target logical position.

[0126] Specifically, this step is the final execution stage of the entire window layout restoration process. Its task is to apply the calculated theoretical window layout scheme to the operating system's desktop. The core of the entire operation is interaction with the operating system's window manager. The window manager is a core graphics subsystem in the operating system, which is fully responsible for the creation, destruction, movement, scaling, and stacking of all windows on the screen.

[0127] To manipulate windows, a program first needs to call the operating system's low-level application programming interfaces (APIs). For example, in a Windows operating system environment, this involves calling system-level window management functions like `SetWindowPos` and `MoveWindow` from the Win32-API; or in a Linux environment, it involves calling the relevant interfaces of the X11 system library or the Wayland display server protocol. These interfaces are direct function libraries provided by the operating system to software developers, allowing programs to have fine-grained control over core system functions. By calling specific interface functions, the program can request to establish a direct communication link with the window manager. Once this request is received and verified by the window manager, a stable injection channel—essentially a system-level inter-process communication pipe or a message queue with high execution privileges—is successfully established. This injection channel is a logical data transmission path that allows the program to bypass the regular user interaction process and send commands directly to the window manager.

[0128] With the injection channel in place, the program reads the generated reconstructed coordinate matrix. This matrix contains the target position, size, and occlusion relationships of each active window. The program iterates through each record in this matrix, packaging each window's unique handle and its new coordinate data into a structured message. This message is the coordinate update instruction. The program then sends this series of coordinate update instructions one by one to the window manager through the injection channel.

[0129] When the window manager receives coordinate update instructions through the injection channel, it executes these instructions directly. Using the window handles contained in the coordinate update instructions, the window manager can accurately identify the active window that needs to be operated on. Subsequently, it forcibly updates the internal properties of this active window, modifying its position and size to the new values ​​specified in the instructions, and adjusting its stacking order on the screen according to the hierarchy information in the instructions. This process is executed sequentially for all active windows in the reconstructed coordinate matrix. Ultimately, all windows are precisely rearranged to their correct positions in the switched mode, thus achieving the return of active windows to their target logical positions and completing a seamless restoration of the entire desktop layout.

[0130] For example, following the steps described above, the system has calculated and generated a reconstructed coordinate matrix based on the switch from extended mode to mirrored mode. This matrix contains the following data: Window A (handle 0x1A2B): target coordinate matrix is ​​[x:200, y:150, width:800, height:600]. Window B (handle 0x3C4D): target coordinate matrix is ​​[x:400, y:250, width:1024, height:768]. Window C (handle 0x5E6F): target coordinate matrix is ​​[x:100, y:100, width:700, height:500].

[0131] The occlusion relationship is such that window B is on top of window A, and window C is at the bottom layer.

[0132] First, the program calls the operating system's low-level application programming interface to establish a communication link with the system's window manager, thereby obtaining an injection channel that can send commands. Then, through this injection channel, the program converts the data in the reconstructed coordinate matrix into coordinate update commands and sends them.

[0133] The first coordinate update instruction targets window C, containing the window handle 0x5E6F and its new position and size data [x:100, y:100, width:700, height:500]. The second coordinate update instruction targets window A, containing the window handle 0x1A2B and its position and size data [x:200, y:150, width:800, height:600]. The third coordinate update instruction targets window B, containing the window handle 0x3C4D and its position and size data [x:400, y:250, width:1024, height:768], and also includes its top-level hierarchy information. Upon receiving these coordinate update instructions, the window manager immediately begins execution.

[0134] It first locates window C with handle 0x5E6F, forcibly moves it from its original logical position (x=2020), and redraws it to position (100,100) on the main screen. Then, it processes the instructions for windows A and B, ensuring their positions are correct, and draws window B above window A based on the hierarchy information.

[0135] After executing all coordinate update instructions, the layout of the active windows on the screen is consistent with the reconstructed coordinate matrix. Window C, which was originally located in the virtual extended screen, has now been moved to its target logical position on the main screen, and the entire desktop layout has been restored.

[0136] The above content is merely an example and illustration of the concept of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described, or use similar methods to replace them, as long as they do not deviate from the concept of the invention or exceed the scope defined by the present invention, and all such modifications and additions should fall within the protection scope of the present invention.

Claims

1. A screen projection control system based on mirrored extended mode switching display, characterized in that, include: The video memory allocation module loads the virtual display driver at the operating system kernel layer to build a virtual double-buffered display pipeline, and allocates the main screen video memory area and the virtual extended video memory area in the video memory. The network coding control state generation module intercepts the screen projection mode switching command, extracts the window state parameters of the currently active process to generate a historical desktop topology mapping table, and locks the current network transmission bit rate limit according to the screen projection mode switching command to pause the key frame generation request and obtain the network coding control state. The video memory pointer flip state generation module flips the video memory read pointer of the screen projection encoder between the main screen video memory area and the virtual extended video memory area according to the screen projection mode switching instruction to obtain the video memory pointer flip state. The smooth network stream generation module extracts the transition frame from the spare frame buffer and generates a differential data stream to send to the receiving end during the transition of the video memory pointer flip state. After the video memory pointer flip state is completed, it restores the push stream bitrate to obtain the smooth network stream. The reconstructed coordinate matrix generation module reads the historical desktop topology mapping table to calculate the affine transformation matrix according to the target display domain resolution corresponding to the screen casting mode switching command, and uses the affine transformation matrix to reconstruct the window coordinate data to obtain the reconstructed coordinate matrix. The target logical position regression module reconstructs the coordinate matrix and injects it into the operating system's window manager to reposition the active window to the target logical position.

2. The screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: The operating system kernel layer loads a virtual display driver to construct a virtual double-buffered display pipeline, and allocates a main screen video memory area and a virtual extended video memory area in the video memory, including: Inject a virtual display driver into the operating system kernel layer to obtain the driver loading status; Register the virtual extended screen with the operating system using the driver loading state, and generate a dual-pipeline rendering state in which the physical main screen and the virtual extended screen coexist. Based on the dual-pipeline rendering state, independent frame buffers are divided in the video memory to generate the main screen video memory area and the virtual extended video memory area.

3. The screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: Intercepting the screen mirroring mode switching command, extracting the window state parameters of the currently active process to generate a historical desktop topology mapping table, including: In response to the screen mirroring mode switching command, the system suspends calls to the operating system's native display settings interface to obtain the system interception status; Based on the system interception status, all active processes are traversed to extract the handle, resolution scaling ratio, and coordinate matrix of the active window to obtain the window state parameters. The window state parameters are stored in memory according to the process hierarchy to generate a historical desktop topology mapping table.

4. A screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: Based on the screen mirroring mode switching command, the current network transmission bitrate limit is locked to pause the keyframe generation request and obtain the network encoding control state, including: In response to the screen mirroring mode switching command, obtain the real-time bandwidth data of the current network transmission channel to obtain the current network transmission bit rate limit; The bitrate lock state is obtained by configuring the encoder's output limit parameters using the current network transmission bitrate limit. Based on the bitrate lock state, the encoder's full screen refresh request is intercepted to pause the keyframe generation request and generate a network encoding control state.

5. A screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: According to the screen casting mode switching command, the video memory read pointer of the screen casting encoder is flipped between the main screen video memory area and the virtual extended video memory area to obtain the video memory pointer flipping state, including: Parse the screen mirroring mode switching command to obtain the target switching mode; When the target switching mode is switching from extended mode to mirror mode, the video memory read pointer of the screen projection encoder is flipped directly from the virtual extended video memory area to the main screen video memory area to obtain the first flip instruction. The asynchronous memory block copying operation is initiated based on the first flip instruction, generating a memory pointer flip state.

6. A screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: During the transition of the memory pointer flip state, a transition frame is extracted from the spare frame buffer and a differential data stream is generated and sent to the receiving end. After the memory pointer flip state is completed, the streaming bitrate is restored to obtain a smooth network stream, including: The transition time window is obtained by monitoring the execution cycle of the video memory pointer flip state; Within the transition time window, extract the gradient frame that retains the previous frame from the spare frame buffer as the transition frame. The transition frame is encoded to generate a low-bit-rate differential data stream and sent to the receiving end. After the transition time window ends, the push stream bit rate is increased in a stepwise manner to generate a smooth network stream.

7. A screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: Based on the target display domain resolution corresponding to the screen casting mode switching command, the historical desktop topology mapping table is read to calculate the affine transformation matrix. The window coordinate data is reconstructed using the affine transformation matrix to obtain the reconstructed coordinate matrix, including: Obtain the resolution difference by comparing the target display domain resolution corresponding to the screen mirroring mode switching command with the current physical resolution; Calculate the coordinate scaling ratio and translation vector based on the resolution difference and the historical desktop topology mapping table, and generate the affine transformation matrix. The original coordinates and occlusion relationships in the historical desktop topology mapping table are recalculated using an affine transformation matrix to generate a reconstructed coordinate matrix.

8. A screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: The reconstructed coordinate matrix is ​​then injected into the operating system's window manager to reposition the active window to the target logical location, including: The injection channel is obtained by calling the operating system's low-level application programming interface to establish a communication link with the window manager; The reconstructed coordinate matrix is ​​sent to the window manager via the injection channel to obtain coordinate update instructions; The coordinate update command forces the window manager to rearrange the active windows according to the reconstructed coordinate matrix, so that the active window is returned to the target logical position.

9. A screen projection control system based on mirrored extended mode switching display according to claim 1, characterized in that: According to the screen casting mode switching instruction, the video memory read pointer of the screen casting encoder is flipped between the main screen video memory area and the virtual extended video memory area to obtain the video memory pointer flipping state, and the process also includes: When the target switching mode is switched from mirror mode to extended mode, the video memory block copying operation is stopped and the copying is stopped. By utilizing the copy stop state, the video memory read pointer of the screen projection encoder is switched back to the virtual extended video memory area to obtain the second flip instruction; The second flip instruction updates the reading source of the projection encoder, generating the video memory pointer flip state.