A GPU 3D display method based on a Linux system

By requesting an independent hardware layer in the Linux system and directly transmitting display information, the problem of Linux GPU 3D display transmission relying on the window manager is solved, achieving efficient independent display transmission and resource conservation.

CN115357328BActive Publication Date: 2026-11-27SHENZHEN ZHONGWEIDIAN TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211021379.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-24
Publication Date
2026-11-27
Estimated Expiration
2042-08-24

AI Technical Summary

Technical Problem

Existing Linux GPU 3D display methods rely on window managers, which cannot independently display individual 3D windows, and suffer from image tearing issues and high resource consumption.

Method used

By pre-applying for an independent hardware layer in the Linux system, display information can be directly obtained and passed to the KMS driver via a custom ioctl. GEM is used to manage the video memory address and format, enabling independent display and avoiding memory copying and compositing steps.

Benefits of technology

It improves display efficiency, saves GPU and CPU resources, avoids image tearing, simplifies the debugging process, and purely stores 3D rendering results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115357328B_ABST
    Figure CN115357328B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image display, in particular to a GPU 3D sending display method based on Linux system, which comprises the following steps: S1, a KMS driver is initialized to pre-apply an independent hardware layer as a special layer for 3D sending display; S2, before 3D copy sending display, sending display pixel information is acquired and directly transmitted to the KMS driver through a self-defined ioctl; S3, the KMS driver finds the GEM corresponding information including the memory address and format through the information, and displays through the independent hardware layer to complete the sending display. The present application does not depend on the page turning function of the window manager, the trigger mechanism condition is simple, there is no memory copy, the sending display efficiency is further provided, the GPU and CPU resources are saved, the 3D case result is more convenient for research and development debugging, the current corresponding memory storage content is pure case result without mixing other contents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image display technology, and in particular to a GPU 3D display method based on a Linux system. Background Technology

[0002] Currently, Linux GPUs are primarily implemented based on the Xorg framework. The 3D rendering portion has evolved to rely on Xorg's DRI (Direct Rendering Infrastructure) extension, which has now reached DRI3. DRI, DRI2, and DRI3 were all developed to address various rendering and rendering issues. In particular, DRI2 and DRI3 implement offscreen pixmap support in the window manager, primarily using pageflip triggered by the window manager to solve image tearing problems. This involves processes such as window compositing and pixmap copying.

[0003] The Xorg 3D display mechanism is already quite sophisticated, especially with the application of DRI3 technology. However, there are some issues: it requires window manager support and cooperation, and the paging object is the entire screen pixel map (scanout), not individual 3D case windows. Furthermore, when displaying 3D data, the current 3D pixel map is copied and composited to the main screen pixel map. After a series of operations by Xorg and KMS, the final screen pixel map is displayed uniformly. Summary of the Invention

[0004] This invention provides a GPU 3D display delivery method based on a Linux system, aiming to improve the efficiency of GPU 3D display delivery.

[0005] This invention provides a GPU 3D display method based on a Linux system, comprising the following steps: S1.KMS driver initialization pre-allocates an independent hardware layer as a dedicated 3D display layer; S2. Before sending the 3D copy to the display, obtain the pixel image information to be displayed and directly pass the information to the KMS driver through a custom ioctl; ioctl is a function in the device driver that manages the device's I / O channels; The S3.KMS driver locates the corresponding information in the GEM (Graphics Execution Manager), including the memory address and format, and displays it through an independent hardware layer to complete the display delivery.

[0006] As a further improvement of the present invention, step S2 includes: When creating a case in S21.3D, the bo and pixmap information are initialized, and the bo information is cached for matching. S22. Wait for the 3D case rendering to complete, then automatically trigger the display. S23. Determine whether the submitted display box (bo) and pixmap are the content of the current 3D case, and determine whether the KMS driver supports independent display submission; if the bo is generated by the 3D case and the KMS driver supports independent display submission, then proceed to step S24; if the bo is not generated by the 3D case, or the KMS driver does not support independent display submission, then jump to the default display submission method. S24. Obtain the current bo information, including gem handle, width, length, format, and alignment; S25. Integrate the information into a specific structure and send the information to KMS via a custom ioctl; 3d case is a 3D running example; 3d bo is a 3D buffer obj, a memory object used to store the image after the 3D rendering is completed, and represents the result of running 3d case.

[0007] As a further improvement of the present invention, step S3 includes: S31.KMS receives and processes the information, including obtaining the video memory address through the gem handle, determining whether to re-clipping, and determining whether the width and height are normal. S32. Set the dedicated layer DP hardware register according to the display information, perform 3D image display, and complete the display work.

[0008] As a further improvement of the present invention, after performing step S3, the method further includes the following step: S4. If steps S31 to S32 are executed normally, KMS determines that the display is successful and returns the bo information to XserverDDX; if steps S31 to S32 are not executed normally, KMS determines that the display is failed and continues to process the next display content.

[0009] As a further improvement of the present invention, the GPU 3D display delivery method further includes the following steps: S5. The Xserver DDX checks whether the KMS returned information successfully. If successful, it returns directly, and the display is complete. That is, DDX parses the information returned by KMS and returns information indicating whether the display was successfully sent. Generally, it is successful. If successful, the display process is complete. If it fails, it falls back to the default display method.

[0010] As a further improvement of the present invention, the default display method includes the following steps: Copy the region information to scanout; compose all layers that need to be composited; generate a display request with KMS via DRM, KMS sets the general layer DP hardware register for display, and the display is completed.

[0011] As a further improvement of the present invention, after the default display is completed, the process returns to step S2 to execute the next cycle.

[0012] As a further improvement of the present invention, after the display work is completed in step S32, the process returns to step S2 to execute the next cycle.

[0013] The beneficial effects of this invention are: it does not rely on the page-turning function of the window manager, and the triggering mechanism is simple; there is no memory copying, which further improves the display efficiency and saves GPU and CPU resources; it is more convenient to develop and debug 3D case results, and the content currently stored in memory is pure case results without any other content mixed in. Attached Figure Description

[0014] Figure 1 This is a flowchart illustrating the GPU 3D display method based on the Linux system in this invention. Detailed Implementation

[0015] 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.

[0016] The implementation of the GPU 3D display method based on the Linux system of this invention includes: S1.KMS driver initialization pre-allocates an independent hardware layer as a dedicated 3D display layer; S2. Before sending the 3D copy to the display, obtain the pixel map information to be sent to the display and directly pass the information to the KMS driver through a custom ioctl; the pixel map information includes parameters such as GEM handle, length, and width; The S3.KMS driver finds the corresponding video memory address, format, and other information of the GEM through relevant information, and displays it through an independent hardware layer to complete the display delivery.

[0017] Furthermore, the original display path no longer needs to be traversed; it can be returned directly. Since the content sent to KMS is a pre-rendered bo, it doesn't need to be copied and can be sent directly for display. With the support of the DRI2 and DRI3 swapbuff mechanism, no tearing will occur.

[0018] like Figure 1 As shown, the implementation steps of this invention involve two parts: KMS and Xserver DDX. The KMS steps are named Kxx, and the Xserver DDX steps are named Dxx.

[0019] The specific implementation steps are as follows: K1.KMS driver initializes a dedicated 3D display layer.

[0020] When creating a bo in D1.3D case, the bo and pixmap information are initialized, and the bo information is cached for matching.

[0021] D2. Wait for the 3D case rendering to complete, then automatically trigger the display.

[0022] D3. Determine whether the submitted display box (bo) and pixmap are the content of the current 3D case, and other conditions, such as whether the driver supports independent display submission; if the bo is generated by the 3D case or the KMS driver supports independent display submission, then proceed to step D4; if the bo is not generated by the 3D case or the KMS driver does not support independent display submission, then jump to the default display submission method.

[0023] D4. Obtain current bo information, such as gem handle, width, length, format, alignment, etc.

[0024] D5. Integrate the information into a specific structure and send the information to KMS via a custom ioctl.

[0025] K2.KMS receives and processes the information, such as obtaining the video memory address through the gem handle, determining whether to re-clipping, and checking whether the width and height are normal.

[0026] K3. Based on the display information, set the dedicated layer DP hardware register to perform 3D image display, and the display work is completed.

[0027] K4. Determine whether the display was successfully sent based on whether steps K2 to K3 were executed normally, and then return the information to Xserver DDX.

[0028] D6. Xserver DDX checks the information returned by KMS. If successful, it returns directly, the display is completed, and jumps to step D11. If it fails, it falls back to the default display method and goes through the long call stack process of the traditional method, as briefly described in steps D7 to D10.

[0029] D7. Copy region information to scanout.

[0030] D8. Perform composite operations by traversing all layers that need to be composited; and other operations.

[0031] D9. Send display requests via DRM and KMS.

[0032] D10. KMS sets the default general layer DP hardware register for display.

[0033] D11. Display complete.

[0034] Once the display is complete, meaning one cycle ends, the process returns to step D2 for repeated execution. Steps D2 to D11 constitute one complete cycle.

[0035] Application scenarios of this invention: (1) Window manager PageFlip does not support certain scenarios; (2) There is a need to further improve display efficiency and save GPU and CPU resources; (3) The results of 3D case generation need to be analyzed independently.

[0036] The advantages are: (1) The pageflip function does not rely on the window manager and has simple triggering conditions.

[0037] (2) There are no steps such as memory copying and window compositing, which saves GPU and CPU resources and greatly improves the efficiency of display delivery.

[0038] (3) It is more convenient to develop and debug 3D case results. The current memory storage content is pure case results without any other content.

[0039] This invention solves the problem of triggering page turning without relying on the window manager, independently sending and displaying individual 3D case windows, and performing copying and compositing actions without relying on the window manager. Because the displayed file is a pre-rendered BO, there is no copying or compositing stage. In addition, with the support of DRI2 and DRI3 swapbuffer, there will be no tearing during the display process. Moreover, it is more efficient and faster than the traditional method, saves more memory space, and saves CPU and GPU resources.

[0040] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.

Claims

1. A GPU 3D display method based on a Linux system, characterized in that, Includes the following steps: S1.KMS driver initialization pre-allocates an independent hardware layer as a dedicated 3D display layer; S2. Before sending the 3D copy to the display, obtain the pixel image information to be sent to the display and directly pass the information to the KMS driver through a custom ioctl; The S3.KMS driver locates the information corresponding to the GEM, including the video memory address and format, and displays it through an independent hardware layer to complete the display delivery. Step S2 includes: When creating a case in S21.3D, the bo and pixmap information are initialized, and the bo information is cached for matching. S22. Wait for the 3D case rendering to complete, then automatically trigger the display. S23. Determine whether the submitted display box (bo) and pixmap are the contents of the current 3D case, and at the same time determine whether the KMS driver supports independent display submission; if the bo is generated by the 3D case and the KMS driver supports independent display submission, then proceed to step S24; if the bo is not generated by the 3D case, or the KMS driver does not support independent display submission, then jump to the default display submission method. S24. Obtain the current bo information, including gem handle, width, length, format, and alignment; S25. Integrate the information into a specific structure and send the information to KMS via a custom ioctl; Step S3 includes: S31.KMS receives and processes the information, including obtaining the video memory address through the gem handle, determining whether to re-clipping, and determining whether the width and height are normal. S32. Set the dedicated layer DP hardware register according to the display information, perform 3D image display, and complete the display work; After performing step S3, the method further includes the following step: S4. If steps S31 to S32 are executed normally, KMS determines that the display was successfully sent and returns the bo information to XserverDDX; S5. Xserver DDX checks whether the KMS returned information successfully. If successful, it returns directly, and the display is complete; if it fails, it falls back to the default display method. The default method for displaying data includes the following steps: Copy the region information to scanout; compose all layers that need to be composited; send a display request to KMS via DRM, KMS sets the general layer DP hardware register for display, and the display is completed.

2. The GPU 3D display method based on a Linux system according to claim 1, characterized in that, After the default display is completed, return to step S2 to execute the next cycle.

3. The GPU 3D display method based on a Linux system according to claim 1, characterized in that, After the display is completed in step S32, the process returns to step S2 and repeats for the next cycle.