Multi-window implementation method, device and medium based on Linux embedded system

By reconstructing the display standard structure and initializing the OpenGL program function library in the Linux embedded system, combined with the synchronization management of Vsync processing threads, a multi-window system under OpenGLES FBDEV is realized, solving the problems of single-window rendering and multi-process synchronization, and improving Improved rendering experience and flexibility.

CN114237532BActive Publication Date: 2024-09-06ALLWINNER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111448378.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2024-09-06
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

OpenGLES under the existing Linux frame cache device only supports single-window output rendering and cannot achieve multi-window rendering. There are synchronization problems in multi-process/thread environments, making it difficult to support multi-window management and screen synthesis operating system design.

Method used

By combining the packaging library with the IC display driver, the display standard structure of the Linux embedded system is reconstructed to realize the multi-threaded, multi-process and multi-window system solution under OpenGLES FBDEV, including reconstructing the EGL interface variables, thread variables and GPU thread management variables. Initialize the OpenGL program function library, perform multi-window creation, frame buffer object exchange and window display position adjustment, and perform synchronization management through the Vsync processing thread.

Benefits of technology

Without changing the original GPU manufacturer's code, it achieves support for multi-window systems, improves the OpenGLES rendering experience and flexibility under fbdev, and solves the synchronization problem in a multi-process/thread environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114237532B
    Figure CN114237532B
Patent Text Reader

Abstract

The present invention relates to a technical solution of a multi-window implementation method, device and medium based on a Linux embedded system, including: reconstruction, reconstructing the display standard structure of the Linux embedded system; initialization, loading the reconstructed OpenGL program function library and performing initialization; multi-window implementation, executing window creation, frame buffer object creation, frame buffer object exchange, window display and window display position adjustment of multiple windows through multiple functions in the reconstructed OpenGL program function library; synchronous thread processing, executing display thread synchronization processing through Vsync processing thread, and executing synchronization signal management of rendering thread and frame buffer object management through display sending thread. The beneficial effects of the present invention are: on the basis of not changing the OpenGLES library and OpenGLES application provided by the GPU manufacturer, a set of methods for realizing multi-window / multi-process / multi-thread rendering is designed, which improves the rendering experience and flexibility of OpenGLES under fbdev.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a multi-window implementation method, device and medium based on a Linux embedded system. Background Art

[0002] In the actual GPU window system, FBDEV is the basic Linux window system, but its single-window disadvantage means that the operating system can only operate one visible window, which means that it is not possible for multiple applications to operate the rendering on the screen at the same time like Android and Wayland. There is no implementation of a multi-window system under FBDEV. Usually, the implementation requires FBO to be copied to the FBDEV cache for display, and synchronization in a multi-process system is very cumbersome.

[0003] The existing technology is to render to the cache of the frame buffer under FBDEV. If multiple processes want to use GPU rendering or other image producers (such as VE) need to display, there is a competition problem for the same frame buffer.

[0004] The implementation of OpenGLES under the Linux frame buffer device can only support single-window output rendering output to the frame buffer of the frame buffer device. It cannot support multi-window rendering like Android and Wayland, and cannot well support operating system designs with multiple processes / threads, window management or screen synthesis processes. Summary of the invention

[0005] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art, and provide a multi-window implementation method, device and medium based on a Linux embedded system. The technical solution of the present invention realizes a multi-threaded, multi-process multi-window system solution under OpenGLES FBDEV by combining the characteristics of the encapsulation library with the IC display driver without changing the original GPU manufacturer's code.

[0006] The technical solution of the present invention includes a multi-window implementation method based on a Linux embedded system, characterized in that the method includes: reconstruction, reconstructing a display standard structure of the Linux embedded system, and the reconstructed standard structure is used to describe EGL interface variables, thread variables and GPU thread management variables; initialization, loading a reconstructed OpenGL program function library and an external API function library, and performing initialization; multi-window implementation, executing window creation, frame buffer object creation, frame buffer object exchange, window display and window display position adjustment of multiple windows through multiple functions in the reconstructed OpenGL program function library; synchronous thread processing, executing display thread synchronization processing through a Vsync processing thread, and executing synchronization signal management of a rendering thread and management of frame buffer objects through a display sending thread.

[0007] According to the multi-window implementation method based on Linux embedded system, the reconstruction includes: reconstructing the API function of OpenGLES / EGL, wherein the EGL interface variables include off-screen buffer variables and display resource variables, the off-screen buffer variables and the display resource variables are respectively used to represent the data types of external EGLSurface and EGLDisplay, the thread variables are used to represent the variables owned by each thread, and the GPU thread management variables are used to represent the OpenGLES / EGL native variables of the native GPU manufacturer.

[0008] According to the multi-window implementation method based on Linux embedded system, initialization includes: starting the rendering program to execute data loading, including loading the native OpenGLES / EGL library, and reconstructing the standard OpenGLES / EGL API function through the reconstruction; starting the Vsync processing thread to synchronize the producer and consumer of the window.

[0009] According to the multi-window implementation method based on Linux embedded system, the multi-window implementation includes: the window creation creates an off-screen rendering object through the eglCreateWindowSurface function, initializes the off-screen buffer variable and initializes the consumer hardware layer, and creates at least one window in the same process or multiple processes, and the multiple windows do not affect each other; the frame buffer object is created by applying for a cache with the number of frame buffer objects through the eglMakeCurrent function, and creates a corresponding number of frame buffer objects, initializes the corresponding off-screen buffer variables, and creates thread variables for storing necessary thread variable data; the frame buffer object is exchanged by exchanging the frame buffer objects in the off-screen buffer variables through eglSwapBuffers, the rendering operation is drawn into the frame buffer object, and a sync signal is created, submitted to the display sending thread, and a new frame buffer object is obtained and bound; the window display is performed by the glBindFramebuffer function to bind the application to the frame buffer object, and sequentially executes the acquisition of thread context variables, the acquisition of the off-screen buffer window, the acquisition of the frame buffer object of the write function, and the execution of binding; the window display position is adjusted by placing different windows in different channels and layers of the consumer through the eglSetSurfaceExt function.

[0010] According to the multi-window implementation method based on Linux embedded system, the multi-window implementation further includes: specifying a window to be displayed on a corresponding consumer through eglGetDisplay, and if the consumer is acquiring the window for the first time, a display sending thread for the corresponding consumer will be created.

[0011] According to the multi-window implementation method based on Linux embedded system, the Vsync processing thread includes: controlling the display sending thread to execute smooth frame sending; returning the cyclically used cache for synchronization window; and sending rendering beats to applications that need vsync signals.

[0012] According to the multi-window implementation method based on Linux embedded system, the display thread includes: limiting the display of one frame of picture in the same vsync cycle; sync signal management of synchronous rendering thread; and coordinating multi-buffer consumption of frame buffer objects based on the consumer perspective.

[0013] According to the multi-window implementation method based on Linux embedded system, the method further includes eliminating side effects of the affected API functions.

[0014] The technical solution of the present invention also includes a multi-window implementation device based on a Linux embedded system, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and is characterized in that the processor implements any of the above method steps when executing the computer program.

[0015] The technical solution of the present invention also includes a computer-readable storage medium, which stores a computer program, and is characterized in that when the computer program is executed by a processor, any of the method steps described is implemented.

[0016] The beneficial effects of the present invention are: on the basis of not changing the OpenGLES library and OpenGLES application provided by the GPU manufacturer, a method for realizing multi-window / multi-process / multi-thread rendering is designed, thereby improving the rendering experience and flexibility of OpenGLES under fbdev. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The present invention is further described below in conjunction with the accompanying drawings and embodiments;

[0018] Figure 1 Shown is an overall flow chart according to an embodiment of the present invention.

[0019] Figure 2 Shown is a library initialization flow chart according to an embodiment of the present invention.

[0020] Figure 3 FIG. 4 is a flowchart of a buffer exchange process according to an embodiment of the present invention.

[0021] Figure 4 FIG. 4 is a flowchart of a frame buffer object binding according to an embodiment of the present invention.

[0022] Figure 5 Shown is a flowchart of a Vsync processing thread according to an embodiment of the present invention.

[0023] Figure 6 Shown is a workflow diagram of a display thread according to an embodiment of the present invention.

[0024] Figure 7 Shown is a diagram of an apparatus according to an embodiment of the present invention. DETAILED DESCRIPTION

[0025] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.

[0026] In the description of the present invention, “several” means one or more, “more” means more than two, “greater than”, “less than”, “exceed”, etc. are understood as not including the number itself, and “above”, “below”, “within”, etc. are understood as including the number itself.

[0027] In the description of the present invention, the consecutive numbering of the method steps is for the convenience of review and understanding. Combined with the overall technical scheme of the present invention and the logical relationship between the various steps, adjusting the implementation order between the steps will not affect the technical effect achieved by the technical scheme of the present invention.

[0028] In the description of the present invention, unless otherwise clearly defined, words such as "setting" should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meaning of the above words in the present invention in combination with the specific content of the technical solution.

[0029] Figure 1 The figure shows the overall flow chart according to the embodiment of the present invention. The process of this embodiment is as follows: reconstruction, reconstructing the display standard structure of the Linux embedded system, and the reconstructed standard structure is used to describe the EGL interface variables, thread variables and GPU thread management variables; initialization, loading the reconstructed OpenGL program function library and performing initialization; multi-window implementation, through multiple functions in the reconstructed OpenGL program function library, executing multi-window window creation, frame buffer object creation, frame buffer object exchange, window display and window display position adjustment; synchronous thread processing, executing display thread synchronization processing through the Vsync processing thread, and executing the rendering thread synchronization signal management and frame buffer object management through the display sending thread.

[0030] The embodiments of the present invention redefine some Kronos standard structures to record some information required by the embodiments of the present invention. The main structure definitions are as follows:

[0031] a) aw_surface_t: External to this library is the EGLSurface (off-screen buffer allocated by EGL) type

[0032]

[0033] Table 1 Member variables of aw_surface_t

[0034] In Table 1, n = FBO_NUM

[0035] b)aw_display_resoure: corresponds to the external EGLDisplay type

[0036] variable type effect s_list Doubly Linked List Used to save the surface variables under this display id EGLDisplay Native Kronos display structure R_mCond Conditional Waiting Used to notify the display thread that a new rendering buffer is generated V_mCond Conditional Waiting Used by the vsync thread to notify vsync events

[0037] Table 2 Variable composition of aw_display_resoure

[0038] c) Thread variable structure thread_context, which is a thread variable owned by each thread and is used to implement multi-threaded and multi-context rendering. The important data is shown in the following table;

[0039] variable type effect r_surface aw_surface_t Used to record the read surface set under this thread; w_surface aw_surface_t Used to record the write surface set under this thread Ctx EGLContext Used to record Kronos standard EGLContext variables

[0040] Table 3 thread variable structure thread_context variable

[0041] d)gpu_context_t

[0042] variable type effect egl EGL API function pointer array Used to save the API implementation function of the native GPU manufacturer gl GL API function pointer array Used to save the API implementation function of the native GPU manufacturer

[0043] Table 4 gpu_context_t function variables

[0044] Figure 2 FIG. 1 is a flowchart of the initialization of the library according to an embodiment of the present invention. Figure 2 , which can be summarized as:

[0045] When a normal rendering program loads aw_OpenGL.so, it needs to handle some special events, including loading the native OpenGLES / EGL library and reconstructing the standard OpenGLES / EGL API functions; starting the Vsync processing thread and focusing on reconstructing the OpenGLES / EGL API that produces side effects.

[0046] The partially reconstructed function based on the technical solution of the present invention is as follows:

[0047] (1) eglCreateWindowSurface, this function mainly creates PbufferSurface, initializes some aw_surface_t variables and some initializations of the display hardware layer, and uses this PbufferSurface mechanism to achieve the effect of multiple surfaces.

[0048] (2) eglMakeCurrent: The processing in this function mainly applies for FBO_NUM buffers and creates FBO, partially initializes the aw_surface_t variable, and creates a thread variable to save the necessary thread variable data.

[0049] (3) eglSwapBuffers, used to exchange the FBO in aw_surface_t, draw the previous drawcall into the FBO, create a sync signal, submit it to the display thread, obtain and bind the new FBO, and perform necessary waiting in the process. The main process reference Figure 3 :

[0050] (4) glBindFramebuffer. Since the FBO method is used to implement the surface, and Kronos stipulates that the FBO named 0 is the currently bound surface, the Surface is actually based on the created FBO (the FBO named write_fbo), so some processing needs to be done on this function. The processing flow is as follows: Figure 4 process.

[0051] (5) eglSetSurfaceExt: To support the display of multiple surfaces on one display, this extension function places different surfaces into different channels and layers of the display, thus achieving the effect of a window manager.

[0052] (6) eglGetDisplay, restructure this function to specify the display screen on which the surface is displayed, and if it is the first time to obtain the display, it will create a display sending thread for the display.

[0053] Figure 5 The flowchart of the Vsync processing thread according to the embodiment of the present invention is shown as follows:

[0054] Check whether there is an event in the vsync thread. If so, traverse the display configuration so that the c_read_fbo thread in the temporary linked list is updated to the read_fbo, wake up the corresponding rendering thread (eglSwapBuffers) to perform cache swap and rendering, and notify the display thread of a vsync event after completion.

[0055] The functions of the Vsync processing thread include: smoothing the frame delivery of the display thread and ensuring that only one frame can be delivered in the same vsync cycle; internally synchronizing the surface's recycled buffer to prevent the rendering thread from getting the buffer being displayed, causing screen distortion; and sending rendering beats to applications that care about vsync signals to enable smooth rendering of the application.

[0056] Figure 6The figure shows a workflow diagram of the display thread according to an embodiment of the present invention. The process includes:

[0057] Detect the appearance of a new display surface in the display list, update the surface to be displayed to the temporary list, take the surface in the temporary list, wait for the sync signal, and submit it to the display after receiving the sync signal. If read_fbo++ is used, determine whether there is any data in the display list. If so, loop this process until all data is sent to the display.

[0058] The display delivery thread is mainly used for display delivery, and its main functions are as follows: smooth display delivery to ensure that each frame can be displayed smoothly on the screen; sync signal management for synchronizing rendering threads; and managing FBO's multi-buffer consumption from the consumer's perspective.

[0059] Figure 7 The figure shows a device diagram according to an embodiment of the present invention. The device includes a memory 100 and a processor 200, wherein the processor 200 stores a computer program, and the computer program is used to perform: reconstruction, reconstructing the display standard structure of the Linux embedded system, and the reconstructed standard structure is used to describe the EGL interface variables, thread variables and GPU thread management variables; initialization, loading the reconstructed OpenGL program function library and performing initialization; multi-window implementation, through multiple functions in the reconstructed OpenGL program function library, executing multi-window window creation, frame buffer object creation, frame buffer object exchange, window display and window display position adjustment; synchronous thread processing, executing display thread synchronization processing through Vsync processing thread, and executing rendering thread synchronization signal management and frame buffer object management through display sending thread. Among them, the memory 100 is used to store data.

[0060] It should be appreciated that the method steps in the embodiments of the present invention can be implemented or implemented by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer readable memory. The method can use standard programming techniques. Each program can be implemented in a high-level process or object-oriented programming language to communicate with a computer system. However, if necessary, the program can be implemented in an assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, the program can be run on a programmed ASIC for this purpose.

[0061] Furthermore, the operations of the processes described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) that is executed collectively on one or more processors, by hardware, or a combination thereof. The computer program includes a plurality of instructions that may be executed by one or more processors.

[0062] Further, the method can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, a RAM, a ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the process described herein. In addition, the machine-readable code, or portions thereof, can be transmitted via a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention also includes the computer itself.

[0063] The computer program can be applied to input data to perform the functions described herein, thereby converting the input data to generate output data stored in a non-volatile memory. The output information can also be applied to one or more output devices such as consumers. In a preferred embodiment of the present invention, the converted data represents physical and tangible objects, including specific visual depictions of physical and tangible objects produced on consumers.

[0064] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.

Claims

1. A multi-window implementation method based on Linux embedded system, characterized in that: The method includes: Reconstruction: Reconstruct the display standard structure of the Linux embedded system. The reconstructed standard structure is used to describe EGL interface variables, thread variables and GPU thread management variables; Initialization: load the reconstructed OpenGL program function library and external API function library, and perform initialization; Multi-window implementation, executing window creation, frame buffer object creation, frame buffer object exchange, window display and window display position adjustment of multiple windows through multiple functions in the reconstructed OpenGL program function library; Synchronous thread processing, executing display thread synchronization processing through Vsync processing thread, and executing rendering thread synchronization signal management and frame buffer object management through display thread; The reconstruction includes: Reconstruct the API function of OpenGLES / EGL, wherein the EGL interface variables include off-screen buffer variables and display resource variables, the off-screen buffer variables and display resource variables are used to represent the data types of external EGLSurface and EGLDisplay respectively, the thread variables are used to represent the variables owned by each thread, and the GPU thread management variables are used to represent the OpenGLES / EGL native variables of the native GPU manufacturer; The initialization includes: Starting a rendering program to perform data loading, including loading a native OpenGLES / EGL library, and reconstructing a standard OpenGLES / EGL API function through the reconstruction; Start the Vsync processing thread to synchronize the producer and consumer of the window; The multi-window implementation includes: The window creation creates an off-screen rendering object through the eglCreateWindowSurface function, initializes the off-screen buffer variable and initializes the consumer hardware layer, and creates at least one window in the same process or multiple processes, and the multiple windows do not affect each other; The creation of the frame buffer object applies for a cache with the number of frame buffer objects through the eglMakeCurrent function, creates a corresponding number of frame buffer objects, initializes the corresponding off-screen buffer variables, and creates thread variables for storing necessary thread variable data; The frame buffer object is exchanged by exchanging the frame buffer object in the off-screen buffer variable through eglSwapBuffers, drawing the rendering operation into the frame buffer object, creating a sync signal, submitting it to the display thread, and obtaining and binding a new frame buffer object; The window display uses the glBindFramebuffer function to bind the frame buffer object of the application program, and sequentially executes the steps of obtaining thread context variables, obtaining the off-screen buffer window, obtaining the frame buffer object of the write function, and performing binding; The window display position adjustment places different windows into different channels and layers of the consumer through the eglSetSurfaceExt function; The multi-window implementation further includes: The specified window is displayed on the corresponding screen through eglGetDisplay. If the screen is obtained for the first time, a display thread for the corresponding screen will be created.

2. The multi-window implementation method based on Linux embedded system according to claim 1, characterized in that: The Vsync processing thread includes: Smooth frame delivery is performed on the display thread, and the display is limited to one frame in the same vsync cycle; Return the buffer used in a cycle for synchronizing windows; and issue rendering beats to applications that require vsync signals.

3. The multi-window implementation method based on Linux embedded system according to claim 1, characterized in that: The display thread includes: limiting the display of one frame of picture in the same vsync cycle; managing the sync signal of the synchronous rendering thread; and coordinating the multi-buffer consumption of the frame buffer object based on the consumer's perspective.

4. The multi-window implementation method based on Linux embedded system according to claim 1, characterized in that: The method also includes eliminating side effects of the affected API functions.

5. A multi-window implementation device based on a Linux embedded system, the device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.