A GPU driver-based Linux desktop watermark implementation method and device
By rendering watermark textures and target image textures in a GPU-driven display server, the problem of poor watermark performance and easy uninstallation in existing technologies when watermarks are displayed on the screen, captured in screenshots, and connected to a remote desktop is solved, thus enabling secure display and sharing of watermark-overlayed images.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING FENGHUA CHUANGZHI TECHNOLOGY CO LTD
- Filing Date
- 2026-01-21
- Publication Date
- 2026-05-29
Smart Images

Figure CN122115184A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method and apparatus for implementing Linux desktop watermarking based on GPU drivers. Background Technology
[0002] The digitization of information has greatly improved the efficiency and methods of information expression, making data exchange an extremely simple process. Complex data exchanges can be completed through electronic devices such as computers and mobile phones. However, data security is not guaranteed during these exchanges. Data leaks can occur through methods such as taking photos, screenshots, and remote desktop access. Therefore, adding traceable watermark information to computer displays can improve data security. Currently, application-level watermarking technologies exist that can attach watermarks to screen displays and screenshots, but these software and watermarking technologies have the following drawbacks: (1) The watermarks on the screen display and screenshots can be removed by uninstalling these applications, thereby achieving the purpose of leaking secrets.
[0003] (2) It is difficult to simultaneously satisfy the watermarking effect when displaying on the screen, capturing the screen and connecting to the remote desktop, which poses a security risk.
[0004] Therefore, overcoming the shortcomings of the existing technology is an urgent problem to be solved in this technical field. Summary of the Invention
[0005] The technical problem this invention aims to solve is how to reduce the security risk of data leakage while satisfying the watermarking effects displayed on the screen and shared by external applications.
[0006] The present invention adopts the following technical solution: Firstly, a method for implementing Linux desktop watermarking based on GPU drivers is provided, including: Obtain watermark configuration information and convert the watermark configuration information into a watermark texture; Acquire target image data and convert the target image data into target image texture; When a watermark overlay image needs to be displayed on the desktop, both the watermark texture and the target image texture are rendered into the first preset frame buffer of the display server to obtain the watermark overlay image; the first preset frame buffer is switched to realize the display of the watermark overlay image. When it is necessary to achieve external sharing of the watermark overlay image, both the watermark texture and the target image texture are rendered into the second preset frame buffer of the display server to obtain the watermark overlay image; the watermark overlay image in the second preset frame buffer is shared to external applications to achieve external sharing of the watermark overlay image.
[0007] Preferably, the first preset frame buffer is a back buffer; The second preset frame buffer is a temporary frame buffer created by the display server.
[0008] Preferably, the step of rendering both the watermark texture and the target image texture into a first preset frame buffer of the display server to obtain a watermark overlay image; and performing switching processing on the first preset frame buffer to display the watermark overlay image, specifically includes: Both the watermark texture and the target image texture are rendered to the back buffer of the display server to obtain a watermark overlay image; This will switch the back buffer in the display server to the front buffer. Display the watermark overlay image from the front buffer onto the screen.
[0009] Preferably, the step of rendering both the watermark texture and the target image texture into a second preset frame buffer of the display server to obtain a watermark overlay image; and sharing the watermark overlay image in the second preset frame buffer to external applications to achieve external sharing of the watermark overlay image, specifically includes: An external application sends a data sharing request to the display server; The display server creates the temporary frame buffer according to the data sharing request; Both the watermark texture and the target image texture are rendered into the temporary frame buffer to obtain a watermark overlay image; The display server shares the watermarked overlay image in the temporary frame buffer to external applications.
[0010] Preferably, the step of acquiring target image data and converting the target image data into target image texture further includes: Obtain the region in the target image texture that needs to be updated, and use the region as the region to be updated; Obtain the coordinates of the region to be updated as the coordinates to be updated; Get the watermark texture to be updated at the coordinates to be updated, and get the target image texture to be updated at the coordinates to be updated. Both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the first preset frame buffer or the coordinates to be updated in the second preset frame buffer.
[0011] Preferably, the step of acquiring target image data and converting the target image data into target image texture further includes: Obtain the regions in the target image texture that need to be updated. When the number of regions that need to be updated is greater than a preset number, obtain the minimum preset graphic range that includes all regions that need to be updated. Obtain the coordinates of the minimum preset graphic range as the coordinates to be updated; Get the watermark texture to be updated at the coordinates to be updated, and get the target image texture to be updated at the coordinates to be updated. Both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the first preset frame buffer or the coordinates to be updated in the second preset frame buffer.
[0012] Preferably, the watermark configuration information includes one or more of the following: watermark string content, font size, font tilt angle, watermark font color, and watermark transparency.
[0013] Preferably, the step of obtaining watermark configuration information and converting the watermark configuration information into a watermark texture specifically includes: The watermark data is obtained based on one or more of the watermark string content, font size, font tilt angle, watermark font color, and watermark transparency. Convert the watermark data into a watermark texture in texture space.
[0014] Secondly, a GPU-driven Linux desktop watermarking implementation device is provided, comprising at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the processor to perform the GPU-driven Linux desktop watermarking implementation method.
[0015] Thirdly, the present invention also provides a non-volatile computer storage medium storing computer-executable instructions that are executed by one or more processors to perform the method described in the first aspect.
[0016] Fourthly, a chip is provided, comprising: a processor and an interface for calling and running a computer program stored in memory, performing the method as described in the first aspect.
[0017] Fifthly, a computer program product containing instructions is provided that, when executed on a computer or processor, causes the computer or processor to perform the method as described in the first aspect.
[0018] In a sixth aspect, a GPU-driven Linux desktop watermarking implementation system is provided, including a GPU-driven Linux desktop watermarking implementation device as described in the second aspect, and using a GPU-driven Linux desktop watermarking implementation method as described in the first aspect.
[0019] This invention provides a method and apparatus for implementing Linux desktop watermarking based on GPU drivers. The method involves acquiring watermark configuration information, converting the watermark configuration information into a watermark texture, acquiring target image data, and converting the target image data into a target image texture. Both the watermark texture and the target image texture are rendered into a first preset frame buffer of a display server to obtain a watermark overlay image. Switching processing is performed on the first preset frame buffer to display the watermark overlay image. Both the watermark texture and the target image texture are then rendered into a second preset frame buffer of the display server to obtain another watermark overlay image. The watermark overlay image in the second preset frame buffer is shared with external applications to achieve external sharing of the watermark overlay image. This method simultaneously satisfies both the watermark effect displayed on the screen and the watermark effect shared with external applications. Furthermore, by setting the watermark function on the display server, the watermark function is prevented from being uninstalled, reducing the security risk of data leakage. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0021] Figure 1 This is a flowchart of a method for implementing Linux desktop watermarking based on GPU driver, provided by an embodiment of the present invention. Figure 2 This is a flowchart of a screen display method for a Linux desktop watermarking implementation method based on GPU driver provided in an embodiment of the present invention; Figure 3 This is a flowchart of an external application sharing method for a Linux desktop watermarking implementation method based on GPU driver provided in an embodiment of the present invention; Figure 4 This is a flowchart of a method for rendering the area to be updated in a Linux desktop watermarking implementation method based on GPU driver, provided by an embodiment of the present invention. Figure 5 This is a flowchart of a method for rendering the area to be updated in another Linux desktop watermarking implementation method based on GPU driver provided in an embodiment of the present invention. Figure 6This is a flowchart of a screen display method for another GPU-driven Linux desktop watermarking implementation method provided in this embodiment of the invention. Figure 7 This is a flowchart of an external application sharing method for another GPU-driven Linux desktop watermarking implementation method provided in this embodiment of the invention; Figure 8 This is a flowchart illustrating a method for implementing Linux desktop watermarking based on GPU drivers and applying it to screen display, as provided in an embodiment of the present invention. Figure 9 This is a flowchart of a method for implementing Linux desktop watermarking based on GPU driver and applied to screen capture, provided by an embodiment of the present invention. Figure 10 This is a flowchart of a method for implementing Linux desktop watermarking based on GPU driver and applied to remote desktop connection, provided by an embodiment of the present invention. Figure 11 This is a schematic diagram of a Linux desktop watermarking implementation device based on GPU driver provided in an embodiment of the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0023] In the description of this invention, the terms "inner", "outer", "longitudinal", "lateral", "upper", "lower", "top", "bottom", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and do not require that this invention must be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.
[0024] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0025] Embodiment 1 of this invention provides a method for implementing Linux desktop watermarking based on GPU drivers, such as... Figure 1 As shown, the method flow includes: In step 101, watermark configuration information is obtained and converted into watermark texture.
[0026] The scenario applied in this embodiment is to add watermarking functionality to the display server of a graphics processing unit (GPU). The display server is a component of the GPU driver. The system uses the display server as a window management system to achieve graphical display. The system desktop screen display, screenshots, and remote desktop display all need to be implemented through the display server. Therefore, adding watermarking functionality to the display server can simultaneously take into account the watermarking functions of screen display, screenshots, and remote desktop display.
[0027] The watermark configuration information may include one or more of the following: watermark string content, font size, font tilt angle, watermark font color, and watermark transparency; a customized watermark function is used to convert one or more of the following into watermark data, and to convert the watermark data into a watermark texture in texture space. Specifically, a watermark texture is created in texture space, and the watermark data is loaded into the watermark texture; the watermark texture is then rendered to a display server to obtain the corresponding watermark image.
[0028] In step 102, target image data is acquired and converted into target image texture.
[0029] The target image data is the valid data that needs to be displayed on the screen or shared. The target image data is converted into a target image texture. Specifically, the target image texture is created in the texture space, and the target image data is loaded into the watermark texture. The target image texture is then rendered into the frame buffer corresponding to the display server, so that it can be displayed in different scenes.
[0030] In step 103, when it is necessary to display the watermark overlay image on the desktop, both the watermark texture and the target image texture are rendered into the first preset frame buffer of the display server to obtain the watermark overlay image; the first preset frame buffer is switched to realize the display of the watermark overlay image.
[0031] In step 104, when it is necessary to achieve external sharing of the watermark overlay image, both the watermark texture and the target image texture are rendered into the second preset frame buffer of the display server to obtain the watermark overlay image; the watermark overlay image in the second preset frame buffer is shared to external applications to achieve external sharing of the watermark overlay image.
[0032] Displaying image data on the screen requires rendering the watermark texture and the target image texture into their respective frame buffers located in video memory, while keeping the watermark texture on top. This allows the watermark texture to be overlaid on the target image texture, resulting in the watermark overlay image. Specifically, keeping the watermark texture on top involves first drawing the target image texture into the corresponding frame buffer, and then drawing the watermark texture into the corresponding frame buffer.
[0033] The first preset frame buffer and the second preset frame buffer correspond to two different application scenarios of the watermark image. When rendered to the first preset frame buffer, it is used to display the watermark overlay image on the host screen; when rendered to the second preset frame buffer, it is used to share the watermark overlay image with other external applications, such as sharing it with other programs via screenshot or sharing it via remote desktop; the external applications include screenshot applications or remote desktop applications, etc.
[0034] In this embodiment, the display server is a window management system within the GPU used for graphical display. Configuration items to be edited in the watermark, such as time, location, and name, can be predefined in the GPU's flash memory. The display server then retrieves the watermark configuration information and target image data, performs corresponding texture conversion, and renders the converted texture in the display server's internal frame buffer. This enables the display of the watermarked image or its external sharing. Since the display server cannot be actively uninstalled, the watermark function is prevented from being actively uninstalled, ensuring security during data exchange. Furthermore, since the system desktop's screen display, screenshots, and remote desktop display all require the display server, the watermark function within the display server can simultaneously handle watermark display in screen displays, screenshots, and remote desktop displays, further enhancing security during data exchange and reducing the risk of data leakage.
[0035] In this embodiment, the frame buffer includes a main buffer, a back buffer, and a front buffer. The main buffer is used to store image data to be displayed. Image data of each window on the desktop will be rendered to the main buffer. The back buffer and the front buffer are two buffers. The back buffer and the front buffer can switch between each other. When the back buffer is switched to a new front buffer, the original front buffer is switched to a new back buffer, and the display displays the image data in the new front buffer on the screen.
[0036] In this embodiment, the back buffer and the front buffer can be switched between each other. Two buffers are used for switching because rendering on the display server is done pixel by pixel, and rendering takes time. If only one buffer is used for both rendering and display, the rendering speed may not keep up with the display speed, resulting in an incompletely rendered image and causing flickering. Using double buffering, the front buffer is used for screen display, and the back buffer is used for rendering. The two buffers are switched after each frame of rendering, so the image is displayed immediately without flickering.
[0037] Therefore, according to the above description, when it is necessary to display an image with a watermark on the screen, in this embodiment, the first preset frame buffer is a back buffer. By rendering both the watermark texture and the target image texture to the back buffer of the display server, and after rendering is complete, the back buffer is switched to a new front buffer for display, thus displaying the watermark-overlayed image on the screen. This embodiment involves the following design, such as... Figure 2 As shown, the method flow is as follows: In step 201, both the watermark texture and the target image texture are rendered to the back buffer of the display server to obtain a watermark overlay image.
[0038] In this embodiment, the target image data to be displayed on the screen is first transmitted to the main buffer, watermark data and target image data in the main buffer are obtained, and the watermark data is converted into a watermark texture in the texture space, and the target image data is converted into a target image texture in the texture space. The display server calls the GPU rendering interface to render both the watermark texture and the target image texture to the back buffer of the display server.
[0039] In step 202, the back buffer in the display server is switched to the front buffer.
[0040] After rendering is complete, the back buffer in the display server will be switched to the front buffer, and the original front buffer will be switched to the back buffer for rendering the next frame.
[0041] In step 203, the watermark overlay image in the front buffer is displayed on the screen.
[0042] When the back buffer switches to a new front buffer, the original front buffer switches to the new back buffer, and the display shows the image data in the new front buffer on the screen. Further, the subsequently newly converted watermark texture and the target image texture are rendered into the new back buffer, which then switches to the front buffer, displaying the watermark overlay image in the front buffer on the screen. The display of subsequent watermark overlay images is performed cyclically according to the above steps, with the back buffer and front buffer in the display server repeatedly switching in this loop.
[0043] When sharing a watermarked image with other external applications, the main buffer only contains the target image data and not the watermark data. Furthermore, after the watermark data is converted into a watermark texture, it cannot be rendered together with the target image texture in the main buffer. Therefore, the main buffer alone cannot obtain the watermarked overlay image. Thus, this embodiment also involves the following design: Figure 3 As shown, the specific method and process are as follows: In step 301, the external application sends a data sharing request to the display server.
[0044] In this embodiment, the external application can be a screenshot application or a remote desktop application.
[0045] In step 302, the display server creates a temporary frame buffer according to the data sharing request.
[0046] In step 303, both the watermark texture and the target image texture are rendered into the temporary frame buffer to obtain a watermark overlay image.
[0047] In step 304, the display server shares the watermark overlay image in the temporary frame buffer to an external application.
[0048] Since the main buffer does not contain watermark data, and the watermark texture cannot be rendered together with the target image in the main buffer, in order to ensure that the watermark texture and the target image texture can be rendered in the same frame buffer to obtain a watermark overlay image, in this embodiment, the display server creates a new temporary frame buffer, which is the second preset frame buffer, and renders the watermark texture and the target image texture together into the temporary frame buffer.
[0049] Based on the above embodiments, this embodiment further considers that when continuously displaying an image with a watermark, most of the image content in the image to be displayed may not change for a certain period of time, and only some areas of the image may change. For example, when a window application is opened, the window only occupies a part of the entire screen display area. In this case, only the image at the window position changes, while the images of other parts remain unchanged. Therefore, it is not necessary to re-render and update the watermark for the entire display area every time. Only the areas that need to be changed need to be re-rendered and updated. Therefore, this embodiment provides another optimized method for implementing Linux desktop watermarking based on GPU drivers, which saves GPU performance and improves the efficiency of watermark drawing.
[0050] This embodiment involves the following design: like Figure 4 As shown, the method flow includes: In step 401, the region in the target image texture that needs to be updated is obtained, and the region is taken as the region to be updated.
[0051] When the target image data is updated, the display client sends a request to the display server. This request specifies the area of the target image data that needs updating; this area is the area to be updated, and it requires both target image and watermark updates. In this embodiment, the display client can be various running programs on the host machine. For example, if a browser program needs to open an interface window in a specific area of the desktop, the program sends a corresponding request to the display server. The display server can then obtain the area to be updated and the update content based on the request.
[0052] It should be noted that in this embodiment, the update of the target image is due to a change in the display client screen, requesting the display server to display the corresponding change. Therefore, the display server needs to update the target image in the area to be updated. As for the watermark update, the watermark content does not change in the above process, but the watermark needs to be displayed on top of the target image. Therefore, the watermark in the area to be updated needs to be redrawn.
[0053] In step 402, the coordinates of the region to be updated are obtained as the coordinates to be updated.
[0054] After identifying the area to be updated, obtain the position coordinates of the area to be updated in all images to be displayed, and use these coordinates as the coordinates to be updated.
[0055] In step 403, the watermark texture to be updated at the coordinates to be updated is obtained, and the target image texture to be updated at the coordinates to be updated is obtained.
[0056] It is important to note that both the watermark texture and the target image texture are texture data covering the entire display area, including areas that need to be updated and areas that do not. Therefore, the areas that need to be updated are cropped from the watermark texture and the target image texture according to the coordinates to be updated. The watermark texture to be updated is the watermark texture that needs to be redrawn at the coordinates to be updated, and the target image texture to be updated is the target image texture that needs to be changed at the coordinates to be updated.
[0057] In step 404, both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the first preset frame buffer or the coordinates to be updated in the second preset frame buffer.
[0058] The first preset frame buffer is a back buffer, and the second preset frame buffer is a temporary frame buffer.
[0059] If the previously rendered image still exists in the first or second preset frame buffer, the obtained watermark texture to be updated and the target image texture to be updated are rendered to the corresponding positions in the first or second preset frame buffer, and the image positions that need to be updated in the previously rendered image are overwritten to obtain a new and complete watermark overlay image.
[0060] Furthermore, in most cases, multiple different regions need to be updated simultaneously, and the number of these regions may be too large. If each region is calculated and updated separately, the computational performance consumption will be relatively large. Therefore, this embodiment further involves the following design: In step 501, the regions in the target image texture that need to be updated are obtained. When the number of regions that need to be updated is greater than a preset number, the minimum preset graphic range containing all regions that need to be updated is obtained.
[0061] When the target image data is updated, the display client sends a request specifying the area of the target image data that needs to be redrawn. This area is the area to be updated, and it requires both target image and watermark updates. If more than a preset number of areas need updating, it indicates that too many areas need updating. Rendering each area individually would require significant computational resources. The preset number is set by those skilled in the art based on actual conditions; in this embodiment, the preset number can be 2. The preset graphic range is also set by those skilled in the art based on actual conditions; in this embodiment, the preset image range can be a rectangle.
[0062] In step 502, the coordinates of the minimum preset graphic range are obtained as the coordinates to be updated.
[0063] In step 503, the watermark texture to be updated at the coordinates to be updated is obtained, and the target image texture to be updated at the coordinates to be updated is obtained.
[0064] It is important to note that both the watermark texture and the target image texture are texture data covering the entire display area, including areas that need to be updated and areas that do not. Therefore, corresponding areas are cropped from the watermark texture and the target image texture based on the coordinates to be updated. The watermark texture to be updated includes all watermark textures that need to be updated, as well as some watermark textures that do not need to be updated; similarly, the target image texture to be updated includes all target image textures that need to be updated, as well as some target image textures that do not need to be updated.
[0065] In step 504, both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the first preset frame buffer or the coordinates to be updated in the second preset frame buffer.
[0066] The first preset frame buffer is a back buffer, and the second preset frame buffer is a temporary frame buffer.
[0067] The image rendered at the previous moment still exists in the first preset frame buffer or the second preset frame buffer. Therefore, the coordinate position to be updated in the first preset frame buffer or the second preset frame buffer is found. The obtained watermark texture to be updated and the target image texture to be updated are rendered to the corresponding position in the first preset frame buffer or the second preset frame buffer. The image position that needs to be updated in the image rendered at the previous moment is overwritten to obtain a new complete watermark overlay image.
[0068] Correspondingly, the methods and steps for displaying watermarked images on the screen or sharing them with external applications also need to be adjusted, as follows: When you need to display a watermark overlaid image on the screen, such as Figure 6 As shown, the method flow is as follows: In step 601, both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the back buffer to obtain a watermark overlay image.
[0069] In step 602, the back buffer in the display server is switched to the front buffer.
[0070] In step 603, the watermark overlay image in the front buffer is displayed on the screen.
[0071] When it is necessary to share a watermarked image with external applications, such as Figure 7 As shown, the method flow is as follows: In step 701, the external application sends a data sharing request to the display server.
[0072] In step 702, the display server creates the temporary frame buffer according to the data sharing request.
[0073] In step 703, both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the temporary frame buffer to obtain a watermark overlay image.
[0074] In step 704, the display server shares the watermark overlay image in the temporary frame buffer to an external application.
[0075] Based on the above embodiments, this paper presents a method flow for applying the GPU-driven Linux desktop watermarking implementation method to screen display on common operating systems.
[0076] First, the screen display process in the operating system provided in this embodiment will be introduced: (1) The desktop management system ukui transmits the target image data to be displayed on the screen to the main buffer; (2) The display server obtains the target image data in the main buffer and converts the target image data into the target image texture in the texture space; (3) The display server calls the GPU rendering interface to render the target image texture into the back buffer; (4) The back buffer and the front buffer are switched, and the display controller scans the image data in the front buffer to complete the display of the user interface.
[0077] The GPU-driven Linux desktop watermarking implementation method of this embodiment will be embedded in the above screen display process, such as... Figure 8 As shown, the process is as follows: In step 801, the desktop management system UKUI transmits the target image data that needs to be displayed on the screen to the main buffer.
[0078] In step 802, the GPU driver reads watermark configuration information from the GPU Flash storage medium. The watermark configuration information includes watermark string, watermark font size, watermark string tilt angle, watermark font color, and watermark transparency. Watermark data is generated according to the watermark configuration information, and the watermark data is converted into a watermark texture in the texture space.
[0079] In step 803, the display server obtains the target image data in the main buffer and converts the target image data into the target image texture in the texture space; In step 804, the regions in the target image data that need to be updated are obtained. When there are two or more regions that need to be updated, the smallest rectangle containing all the regions that need to be updated is obtained as the update region, and the coordinates to be updated are obtained based on the update region.
[0080] In step 805, both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the back buffer to obtain a watermark overlay image.
[0081] In step 806, the back buffer and the front buffer are switched, and the display controller scans the image data in the front buffer to display the watermark overlay image on the user interface.
[0082] Based on the above embodiments, this paper presents a method flow for applying the GPU-driven Linux desktop watermarking implementation method to screenshots on common operating systems.
[0083] First, let's introduce the operating system provided in this embodiment: (1) The desktop management system kwin_x11 transmits the target image data that needs to be displayed on the screen to the main buffer; (2) The display server responds to the image export request of the screenshot application, returns the target image data in the main buffer to the screenshot application, and completes the screenshot.
[0084] The GPU-driven Linux desktop watermarking implementation method of this embodiment will be embedded in the above screenshot process, such as... Figure 9 As shown, the process is as follows: In step 901, the desktop management system kwin_x11 transmits the target image data that needs to be displayed on the screen to the main buffer.
[0085] In step 902, the GPU driver reads watermark configuration information from the GPU Flash storage medium. The watermark configuration information includes watermark string, watermark font size, watermark string tilt angle, watermark font color, and watermark transparency. Watermark data is generated according to the watermark configuration information, and the watermark data is converted into a watermark texture in the texture space.
[0086] In step 903, the display server obtains the target image data in the main buffer and converts the target image data into the target image texture in the texture space.
[0087] In step 904, the regions in the target image data that need to be updated are obtained. When there are two or more regions that need to be updated, the smallest rectangle containing all the regions that need to be updated is obtained as the update region, and the coordinates to be updated are obtained based on the update region.
[0088] In step 905, the display server responds to the screenshot application's request by creating a temporary frame buffer.
[0089] In step 906, both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the temporary frame buffer to obtain a watermark overlay image.
[0090] In step 907, the display server returns a temporary frame buffer to the screenshot application, thus completing the watermark effect when taking a screenshot.
[0091] Based on the above embodiments, this paper presents a method flow for applying the GPU-driven Linux desktop watermarking implementation method to remote desktop connections on common operating systems.
[0092] First, the remote desktop connection method in the operating system provided in this embodiment will be introduced: (1) The desktop management system kwin_x11 transmits the target image data that needs to be displayed on the screen to the main buffer; (2) The display server responds to the image export request of the remote desktop connection application and shares the target image data in the main buffer to the shared memory of the remote desktop connection application. The remote desktop connection application displays the image data in the shared memory.
[0093] The Linux desktop watermarking implementation method based on GPU driver of this embodiment will be embedded in the above remote desktop connection process, such as... Figure 10 As shown, the process is as follows: In step 1001, the desktop management system kwin_x11 transmits the target image data that needs to be displayed on the screen to the main buffer.
[0094] In step 1002, the GPU driver reads watermark configuration information from the GPU Flash storage medium. The watermark configuration information includes watermark string, watermark font size, watermark string tilt angle, watermark font color, and watermark transparency. Watermark data is generated according to the watermark configuration information, and the watermark data is converted into a watermark texture in the texture space.
[0095] In step 1003, the display server obtains the target image data in the main buffer and converts the target image data into the target image texture in the texture space.
[0096] In step 1004, the regions in the target image data that need to be updated are obtained. When there are two or more regions that need to be updated, the smallest rectangle containing all the regions that need to be updated is obtained as the update region, and the coordinates to be updated are obtained based on the update region.
[0097] In step 1005, the display server responds to the screenshot application's request and creates a temporary frame buffer.
[0098] In step 1006, both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the temporary frame buffer to obtain a watermark overlay image.
[0099] In step 1007, the display server shares the watermark overlay image in the temporary frame buffer to the shared memory of the remote desktop connection application, and the remote desktop connection application displays the watermark overlay image in the shared memory.
[0100] Based on the above embodiments, such as Figure 11 The diagram shown is a schematic representation of a GPU-driven Linux desktop watermarking implementation device according to an embodiment of the present invention. This GPU-driven Linux desktop watermarking implementation device includes one or more processors 111 and a memory 112.
[0101] The processor 111 and the memory 112 can be connected via a bus or other means.
[0102] The memory 112, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs and non-volatile computer-executable programs, such as the GPU-driven Linux desktop watermarking implementation method in the above embodiments. The processor 111 executes the GPU-driven Linux desktop watermarking implementation method by running the non-volatile software programs and instructions stored in the memory 112.
[0103] Memory 112 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 112 may optionally include memory remotely located relative to processor 111, and these remote memories may be connected to processor 111 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0104] The program instructions / modules are stored in the memory 112. When executed by one or more processors 111, they execute the GPU-driven Linux desktop watermarking implementation method described in the above embodiments. For example, they execute the methods described above. Figures 1-10 The steps shown.
[0105] This invention also provides a computer storage medium storing computer program instructions; when these computer program instructions are executed by a processor, they implement the GPU-driven Linux desktop watermarking implementation method provided in this invention.
[0106] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for implementing Linux desktop watermarking based on GPU drivers, characterized in that, include: Obtain watermark configuration information and convert the watermark configuration information into a watermark texture; Acquire target image data and convert the target image data into target image texture; When a watermark overlay image needs to be displayed on the desktop, both the watermark texture and the target image texture are rendered into the first preset frame buffer of the display server to obtain the watermark overlay image; the first preset frame buffer is switched to realize the display of the watermark overlay image. When it is necessary to achieve external sharing of the watermark overlay image, both the watermark texture and the target image texture are rendered into the second preset frame buffer of the display server to obtain the watermark overlay image; the watermark overlay image in the second preset frame buffer is shared to external applications to achieve external sharing of the watermark overlay image.
2. The method for implementing Linux desktop watermarking based on GPU driver according to claim 1, characterized in that, The first preset frame buffer is a back buffer; The second preset frame buffer is a temporary frame buffer created by the display server.
3. The method for implementing Linux desktop watermarking based on GPU driver according to claim 2, characterized in that, The watermark texture and the target image texture are both rendered into the first preset frame buffer of the display server to obtain a watermark overlay image; The first preset frame buffer is switched to display the watermark overlay image, specifically including: Both the watermark texture and the target image texture are rendered to the back buffer of the display server to obtain a watermark overlay image; This will switch the back buffer in the display server to the front buffer. Display the watermark overlay image from the front buffer onto the screen.
4. The method for implementing Linux desktop watermarking based on GPU driver according to claim 2, characterized in that, The watermark texture and the target image texture are both rendered to the second preset frame buffer of the display server to obtain a watermark overlay image; Sharing the watermarked overlay image in the second preset frame buffer to external applications enables external sharing of the watermarked overlay image, specifically including: An external application sends a data sharing request to the display server; The display server creates the temporary frame buffer according to the data sharing request; Both the watermark texture and the target image texture are rendered into the temporary frame buffer to obtain a watermark overlay image; The display server shares the watermarked overlay image in the temporary frame buffer to external applications.
5. The Linux desktop watermarking implementation method based on GPU driver according to claim 1, characterized in that, The step of acquiring target image data and converting the target image data into target image texture further includes: Obtain the region in the target image texture that needs to be updated, and use the region as the region to be updated; Obtain the coordinates of the region to be updated as the coordinates to be updated; Get the watermark texture to be updated at the coordinates to be updated, and get the target image texture to be updated at the coordinates to be updated. Both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the first preset frame buffer or the coordinates to be updated in the second preset frame buffer.
6. The Linux desktop watermarking implementation method based on GPU driver according to claim 1, characterized in that, The step of acquiring target image data and converting the target image data into target image texture further includes: Obtain the regions in the target image texture that need to be updated. When the number of regions that need to be updated is greater than a preset number, obtain the minimum preset graphic range that includes all regions that need to be updated. Obtain the coordinates of the minimum preset graphic range as the coordinates to be updated; Get the watermark texture to be updated at the coordinates to be updated, and get the target image texture to be updated at the coordinates to be updated. Both the watermark texture to be updated and the target image texture to be updated are rendered onto the coordinates to be updated in the first preset frame buffer or the coordinates to be updated in the second preset frame buffer.
7. The Linux desktop watermarking implementation method based on GPU driver according to claim 1, characterized in that, The watermark configuration information includes one or more of the following: watermark string content, font size, font tilt angle, watermark font color, and watermark transparency.
8. The Linux desktop watermarking implementation method based on GPU driver according to claim 7, characterized in that, The step of obtaining watermark configuration information and converting the watermark configuration information into a watermark texture specifically includes: The watermark data is obtained based on one or more of the watermark string content, font size, font tilt angle, watermark font color, and watermark transparency. Convert the watermark data into a watermark texture in texture space.
9. A Linux desktop watermarking implementation device based on GPU driver, characterized in that, The system includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the processor to perform the GPU-driven Linux desktop watermarking implementation method according to any one of claims 1-8.
10. A non-volatile computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by one or more processors, are used to implement the GPU-driven Linux desktop watermarking implementation method as described in any one of claims 1-8.