CN115660940B - Graphic application frame rate synchronization method based on vertical blanking simulation - Google Patents

Graphic application frame rate synchronization method based on vertical blanking simulation Download PDF

Info

Publication number
CN115660940B
CN115660940B CN202211408722.1A CN202211408722A CN115660940B CN 115660940 B CN115660940 B CN 115660940B CN 202211408722 A CN202211408722 A CN 202211408722A CN 115660940 B CN115660940 B CN 115660940B
Authority
CN
China
Prior art keywords
interrupt
vblank
list
time
gpu
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211408722.1A
Other languages
Chinese (zh)
Other versions
CN115660940A (en
Inventor
温研
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Lingjiu Microelectronics Co ltd
Original Assignee
Beijing Linzhuo Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Linzhuo Information Technology Co Ltd filed Critical Beijing Linzhuo Information Technology Co Ltd
Priority to CN202211408722.1A priority Critical patent/CN115660940B/en
Publication of CN115660940A publication Critical patent/CN115660940A/en
Application granted granted Critical
Publication of CN115660940B publication Critical patent/CN115660940B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a graphic application frame rate synchronization method based on vertical blanking simulation, which realizes the control of an application refresh rate, namely a frame rate by modifying a DRM drive support library provided by a Linux kernel to control a vertical blanking mechanism, further realizes that the frame rates adopted by different GPUs when executing the same graphic application test program are kept consistent, does not need a user to execute modification operation, further reduces the complexity of user operation and improves the control accuracy.

Description

Graphic application frame rate synchronization method based on vertical blanking simulation
Technical Field
The invention belongs to the technical field of computer image processing, and particularly relates to a graphic application frame rate synchronization method based on vertical blanking simulation.
Background
One of the main graphics rendering methods is a method of rendering three-dimensional graphics using a special graphics processor (Graphic Processing Unit, GPU). The GPU is also called a display core, a visual processor and a display chip, is a microprocessor which is specially used for carrying out image and graphic related operation on personal computers, workstations, game machines and some mobile devices (such as tablet computers, smart phones and the like), adopts the GPU to enable the graphics card to reduce the dependence on a CPU and carry out partial original CPU work, and particularly adopts the core technology of hardware T & L (geometric transformation and illumination processing), cube environment texture mapping and vertex mixing, texture compression and concave-convex mapping, double texture four-pixel 256-bit rendering engine and the like when in 3D graphics processing, and the hardware T & L technology can be regarded as a mark of the GPU. The manufacturers of GPUs are mainly NVIDIA, ATI and AMD.
GPUs typically provide graphics rendering capabilities through standard API interfaces, such as OpenGL, openGL ES, vulkan, direct X, etc., which are commonly referred to as graphics interfaces, which graphics applications ultimately implement graphics rendering by invoking. There are multiple different versions of each graphics interface, such as 4.6 for the latest version of OpenGL and 3.2 for the latest version of OpenGL ES. For a GPU adopting a DRM (Direct Rendering Manager) driving architecture, the DRM driver of the GPU comprises a DRM driver realized by a GPU manufacturer and a DRM driver supporting library provided by a Linux kernel, wherein the DRM driver supporting library is various common supporting functions provided by the Linux kernel.
The common test mode used in the process of testing GPUs is to compare and analyze the performances of GPUs according to the differences of rendering results of the same graphics application test program on different GPUs, and the first problem to be solved in such tests is how to ensure that the GPUs to be tested all use the same frame rate (FPS). In the existing GPU test, the consistency of the frame rate is ensured by setting related parameters of an operating system and a display, however, the mode increases the operation complexity for a user and has relatively low precision.
Disclosure of Invention
In view of this, the present invention provides a method for synchronizing frame rates of graphics applications based on vertical blanking simulation, which can achieve that the frame rates adopted by different GPUs when executing the same graphics application test program are kept consistent.
The invention provides a graphic application frame rate synchronization method based on vertical blanking simulation, which comprises the following steps:
step 1, closing all graphic application programs on a computing platform, and disabling a graphic acceleration function of a window manager; establishing an interrupt list, wherein the interrupt list is used for recording the occurrence time of the first vblank interrupt and the time interval between the subsequent vblank interrupt and the first vblank interrupt, and the interrupt list is made to be empty; determining a currently used GPU;
step 2, enabling the graphic application test program to start vblank interrupt by adopting a UMD driver path corresponding to the current GPU; executing a graphic application test program, capturing vblank interrupt record interrupt time as current time, if the interrupt list is empty, storing the current time as first interrupt time into the interrupt list, otherwise, storing the difference between the current time and the first interrupt time into the interrupt list as a time interval, and storing the interrupt list after the graphic application test program is executed;
step 3, if the graphic application test program is executed on all the GPUs, executing step 4; otherwise, the GPU is replaced to execute the step 2;
step 4, selecting an interrupt list with the least record number in the interrupt list obtained in the step 2 as a standard vertical blanking event queue, and determining a GPU (graphics processing unit) required to be adopted for executing the graphic application test program;
step 5, enabling the graphic application test program to use a UMD driver path corresponding to the currently adopted GPU, and prohibiting the use of vblank interruption; executing the graphic application test program, recording the starting time, constructing a vblank interrupt data structure when the time interval between the executing time and the starting time is equal to the time interval in the standard vertical blanking event queue, and adding the vblank interrupt data structure into the vblank event queue of the kernel until the graphic application test program is executed;
step 6, if the graphic application test program is executed on all the GPUs, ending the process; otherwise, the GPU is replaced to execute the step 5.
Further, in the step 1, the method of creating the interrupt list is to call a function in the Linux kernel DRM driver support library to obtain a GPU kernel driver data structure of the type drm_crtc_functions, and allocate an interrupt list vblank_interrupt_list to the drm_crtc_functions.
Further, the method for starting the vblank interrupt in the step 2 is to call a function enable_vblank in a Linux kernel DRM driver support library to start the vblank interrupt.
Further, in the step 5, the method of prohibiting the use of vblank interrupt is to call the disable_vblank function in the Linux kernel DRM driver support library to prohibit the use of vblank interrupt.
Further, the current time in step 2 is obtained by recording the time of program execution by using a high-precision timer provided by a kernel.
The beneficial effects are that:
the invention realizes the control of the application refresh rate, namely the frame rate by modifying the DRM drive support library provided by the Linux kernel to control the vertical blanking mechanism, thereby realizing that the frame rates adopted by different GPUs when executing the same graphic application test program are kept consistent, without the need of a user to execute modification operation, further reducing the complexity of the user operation and improving the control accuracy.
Detailed Description
The present invention will be described in detail with reference to the following examples.
The rendering frame rate of a graphics application is not only related to GPU performance, but also to the related configuration of the operating system graphics driver, so the rendering frame rate employed when running the same graphics application on different GPUs is often different. GPU vendors typically do not provide DRM driven source code, so the core idea of the present invention is: the control of the application refresh rate, i.e. the frame rate, is realized by modifying the DRM driven support library provided by the Linux kernel to control the vertical blanking mechanism. Wherein vertical blanking, vblank (Vertical Blank), is used to achieve the synchronized operation of page flip and vertical blanking during graphics image rendering. DRM core provides a number of auxiliary functions for vertical blanking management, including mainly pseudo-interrupt filtering, vblank count statistics, flipping, and resetting.
The invention provides a graphic application frame rate synchronization method based on vertical blanking simulation, which specifically comprises the following steps:
step 1, closing all graphic application programs on a computing platform, and disabling the graphic acceleration function of a window manager to ensure that only the graphic application test program on the computing platform uses the graphic acceleration function driven by the GPU; calling a function in a DRM drive support library of a Linux kernel to establish an interrupt list, wherein the interrupt list is used for recording the occurrence time of a first interrupt and the time interval between a subsequent interrupt and the first interrupt, and initializing the interrupt list to be empty; the currently used GPU is determined.
Step 2, enabling the graphic application test program to search UMD driver paths corresponding to the current GPU preferentially, and calling a function in a DRM driver support library of a Linux kernel to start vblank interrupt; and executing the graphic application test program, capturing the vblank interrupt record interrupt time as the current time in the execution process, if the interrupt list is empty, storing the current time as the first interrupt time into the interrupt list, otherwise, storing the difference between the current time and the first interrupt time into the interrupt list as a time interval, and storing the interrupt list after the graphic application test program is executed.
The UMD Driver is a User-Mode Driver (UMD). In order to ensure the accuracy of the recorded time, a high-accuracy timer provided by a kernel is adopted in the process of executing the program to record the time of executing the program.
Step 3, if the graphic application test program is executed on all the GPUs, executing step 4; otherwise, the GPU is replaced to execute the step 2.
And 4, selecting the interrupt list with the least record number in the interrupt lists of all the GPUs obtained in the step 2 as a standard vertical blanking event queue, and determining the GPU required to be adopted for executing the graphic application test program.
Step 5, enabling the graphic application test program to use a UMD driver path corresponding to the currently adopted GPU, and calling a function in the DRM driver support library of the Linux kernel to prohibit the use of vblank interrupt; executing the graphic application test program, recording the starting time, constructing a vblank interrupt data structure when the time interval between the executing time and the starting time is equal to the time interval in the standard vertical blanking event queue, and adding the vblank interrupt data structure into the vblank event queue of the kernel until the graphic application test program is executed.
The method comprises the steps of recording starting time and executing time of a program by adopting a high-precision timer provided by a kernel, calculating a time difference between the executing time and the starting time, and taking the time difference as a time interval.
Step 6, if the graphic application test program is executed on all the GPUs, ending the process; otherwise, the GPU is replaced to execute the step 5.
Examples:
the embodiment adopts the graphics application frame rate synchronization method based on vertical blanking simulation to realize that graphics application test programs are operated on two different GPUs with the same frame rate, and specifically comprises the following steps:
s1, installing two different GPUs on the same computer, running the same graphic application test program graphics App by adopting the different GPUs in sequence, and recording vblank event sequences on the different GPUs. That is, the following steps are performed for each GPU:
s1.1, closing all graphic application programs on Linux, disabling the graphic acceleration function of a window manager, and ensuring that no other application uses the graphic acceleration function driven by the GPU at the same time when the graphics App starts to run;
s1.2, notifying a modified Linux kernel, acquiring a data structure of which the type of a GPU kernel driver is drm_crtc_functions, and calling an enable_vblank function to start vblank interrupt, wherein the drm_crtc_functions data structure is a data structure registered to the kernel when the DRM driver of the GPU kernel is initialized; additionally distributing an interruption list vblank_interrupt_list for the data structure, and initializing the vblank_interrupt_list to be empty;
s1.3, adding the UMD driving path of the GPU to the forefront end of the library searching path of the Graphiapp so that the graphic application testing program preferentially searches the UMD driving program path corresponding to the current GPU, and then running the Graphiapp;
s1.4, modifying a drm_crtc_handle_vblank function in a DRM drive support library of a Linux kernel, adding an element with the length of 64 bits for vblank_interface_list, if the element to be added currently is the first element in vblank_interface_list, recording the current time as the element in vblank_interface_list by adopting a high-precision timer of the Linux kernel, otherwise, adding the time interval of the current time and the time recorded by the first element as the element in vblank_interface_list; and calling a standard flow of the drm_crtc_handle_vblank, and executing a test program.
S2, acquiring the number of elements contained in the vblank_interrupt_list on each GPU from the kernel by adopting an ioctl interface of the Linux system, wherein the number of elements contained in the vblank_interrupt_list can represent the frame rate of each GPU.
S3, comparing the vblank_inter-rupt_list on different GPUs, selecting a list with the least number of elements as a short_vblank_inter-rupt_list, and taking the short_vblank_inter-rupt_list as a standard vertical blanking event queue.
S4, transmitting the shortest_vblank_interface_list to the modified Linux kernel through the ioctl interface.
S5, simulating a vblank event by the Linux kernel based on shortest_vblank_interrupt_list, and re-executing the graphics App on each GPU, wherein the method comprises the following steps of:
s5.1, acquiring a data structure of which the type of GPU kernel driver is drm_crtc_functions, and calling a disable_vblank function to prohibit the use of vblank interrupt;
s5.2, executing a graphics App, recording starting time, adding a high-precision timer of a kernel for each time interval in a short_vblank_interval_list, after the interval time is passed, constructing a vblank data structure in a timer response function, adding the vblank data structure into a vblank event queue of the kernel, calling a drm_update_vblank_count to update the vblank count, acquiring the next interval, and adding the high-precision timer of the kernel until the execution of the graphics application test program is completed.
Through the process, the Graphiapp can be ensured to run on different GPUs in the Linux system at the frame rate corresponding to the short_vblank_interface_list.
In summary, the above embodiments are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (5)

1. A method for synchronizing a frame rate of a graphics application based on vertical blanking simulation, comprising the steps of:
step 1, closing all graphic application programs on a computing platform, and disabling a graphic acceleration function of a window manager; establishing an interrupt list, wherein the interrupt list is used for recording the occurrence time of the first vblank interrupt and the time interval between the subsequent vblank interrupt and the first vblank interrupt, and the interrupt list is made to be empty; determining a currently used GPU;
step 2, enabling the graphic application test program to start vblank interrupt by adopting a UMD driver path corresponding to the current GPU; executing a graphic application test program, capturing vblank interrupt record interrupt time as current time, if the interrupt list is empty, storing the current time as first interrupt time into the interrupt list, otherwise, storing the difference between the current time and the first interrupt time into the interrupt list as a time interval, and storing the interrupt list after the graphic application test program is executed;
step 3, if the graphic application test program is executed on all the GPUs, executing step 4; otherwise, the GPU is replaced to execute the step 2;
step 4, selecting an interrupt list with the least record number in the interrupt list obtained in the step 2 as a standard vertical blanking event queue, and determining a GPU (graphics processing unit) required to be adopted for executing the graphic application test program;
step 5, enabling the graphic application test program to use a UMD driver path corresponding to the currently adopted GPU, and prohibiting the use of vblank interruption; executing the graphic application test program, recording the starting time, constructing a vblank interrupt data structure when the time interval between the executing time and the starting time is equal to the time interval in the standard vertical blanking event queue, and adding the vblank interrupt data structure into the vblank event queue of the kernel until the graphic application test program is executed;
step 6, if the graphic application test program is executed on all the GPUs, ending the process; otherwise, the GPU is replaced to execute the step 5.
2. The method for synchronizing frame rates of graphics applications according to claim 1, wherein the method for creating the interrupt list in step 1 is to call a function in a Linux kernel DRM driver support library to obtain a GPU kernel driver type of a drm_crtc_functions data structure, and allocate an interrupt list vblank_interrupt_list to the drm_crtc_functions.
3. The method for synchronizing frame rates of graphics applications according to claim 1, wherein the method for starting vblank interrupt in step 2 is to call a function enable_vblank in a Linux kernel DRM driver support library to start vblank interrupt.
4. The method for synchronizing frame rates of graphics applications according to claim 1, wherein the disabling of vblank interrupt in step 5 is disabling of vblank interrupt by invoking disable_vblank function in Linux kernel DRM driver support library.
5. The method for synchronizing frame rates of graphics applications according to claim 1, wherein the current time in step 2 is obtained by recording the time of program execution using a high-precision timer provided by a kernel.
CN202211408722.1A 2022-11-11 2022-11-11 Graphic application frame rate synchronization method based on vertical blanking simulation Active CN115660940B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211408722.1A CN115660940B (en) 2022-11-11 2022-11-11 Graphic application frame rate synchronization method based on vertical blanking simulation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211408722.1A CN115660940B (en) 2022-11-11 2022-11-11 Graphic application frame rate synchronization method based on vertical blanking simulation

Publications (2)

Publication Number Publication Date
CN115660940A CN115660940A (en) 2023-01-31
CN115660940B true CN115660940B (en) 2023-04-28

Family

ID=85021013

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211408722.1A Active CN115660940B (en) 2022-11-11 2022-11-11 Graphic application frame rate synchronization method based on vertical blanking simulation

Country Status (1)

Country Link
CN (1) CN115660940B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103282956A (en) * 2010-12-13 2013-09-04 Ati科技无限责任公司 Method and apparatus for providing indication of a static frame
CN104282286A (en) * 2014-10-30 2015-01-14 广东欧珀移动通信有限公司 Method and system for adjusting display refresh rate of smart mobile terminal according to application scene
CN104917990A (en) * 2014-03-12 2015-09-16 索尼电脑娱乐美国公司 Video frame rate compensation through adjustment of vertical blanking
CN106296566A (en) * 2016-08-12 2017-01-04 南京睿悦信息技术有限公司 A kind of virtual reality mobile terminal dynamic time frame compensates rendering system and method
CN112269603A (en) * 2020-10-16 2021-01-26 北京技德系统技术有限公司 Graphic display method and device for compatibly running Android application on Linux
CN113849451A (en) * 2020-06-27 2021-12-28 英特尔公司 Low power refresh during semi-active workloads
CN113852732A (en) * 2020-06-27 2021-12-28 英特尔公司 Synchronization between one or more display panels and a display engine
CN114708370A (en) * 2022-03-29 2022-07-05 北京麟卓信息科技有限公司 Method for detecting graphics rendering mode of Linux platform

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110063305A1 (en) * 2009-09-16 2011-03-17 Nvidia Corporation Co-processing techniques on heterogeneous graphics processing units
WO2018124331A1 (en) * 2016-12-28 2018-07-05 재단법인대구경북과학기술원 Graph processing system and method for operating graph processing system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103282956A (en) * 2010-12-13 2013-09-04 Ati科技无限责任公司 Method and apparatus for providing indication of a static frame
CN104917990A (en) * 2014-03-12 2015-09-16 索尼电脑娱乐美国公司 Video frame rate compensation through adjustment of vertical blanking
CN108449566A (en) * 2014-03-12 2018-08-24 索尼互动娱乐有限责任公司 Video frame rate compensation is carried out by adjusting vertical blanking
CN104282286A (en) * 2014-10-30 2015-01-14 广东欧珀移动通信有限公司 Method and system for adjusting display refresh rate of smart mobile terminal according to application scene
CN106296566A (en) * 2016-08-12 2017-01-04 南京睿悦信息技术有限公司 A kind of virtual reality mobile terminal dynamic time frame compensates rendering system and method
CN113849451A (en) * 2020-06-27 2021-12-28 英特尔公司 Low power refresh during semi-active workloads
CN113852732A (en) * 2020-06-27 2021-12-28 英特尔公司 Synchronization between one or more display panels and a display engine
CN112269603A (en) * 2020-10-16 2021-01-26 北京技德系统技术有限公司 Graphic display method and device for compatibly running Android application on Linux
CN114708370A (en) * 2022-03-29 2022-07-05 北京麟卓信息科技有限公司 Method for detecting graphics rendering mode of Linux platform

Also Published As

Publication number Publication date
CN115660940A (en) 2023-01-31

Similar Documents

Publication Publication Date Title
US11119528B2 (en) Backward compatibility through use of spoof clock and fine grain frequency control
CN111737019B (en) Method and device for scheduling video memory resources and computer storage medium
CN112947969B (en) Page off-screen rendering method, device, equipment and readable medium
CN112346935B (en) Rendering time-consuming acquisition and display method, performance monitoring method, device and equipment
CN115409687B (en) Rendering difference detection method based on display buffer synthesis
CN110968395A (en) Method for processing rendering instruction in simulator and mobile terminal
WO2019143460A1 (en) Techniques for tracking graphics processing resource utilization
CN116185743A (en) Dual graphics card contrast debugging method, device and medium of OpenGL interface
CN115660940B (en) Graphic application frame rate synchronization method based on vertical blanking simulation
JP5242788B2 (en) Partition-based performance analysis for graphics imaging
US12002142B2 (en) Performance overhead optimization in GPU scoping
WO2021142780A1 (en) Methods and apparatus for reducing frame latency
CN117830457B (en) Rendering synchronization optimization method based on intra-frame semaphore
US11238772B2 (en) Methods and apparatus for compositor learning models
WO2021042331A1 (en) Methods and apparatus for graphics and display pipeline management
Just et al. Performance measurement capabilities of vr juggler: real-time monitoring of immersive applications

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20240108

Address after: 430000 No. 1 Baihe Road, Guandong Industrial Park, Wuhan East Lake New Technology Development Zone, Wuhan, Hubei Province

Patentee after: Wuhan lingjiu Microelectronics Co.,Ltd.

Address before: 310, 312, floor 3, No. 27, No. 801, Changlin, Xisanqi, Haidian District, Beijing 100085

Patentee before: BEIJING LINZHUO INFORMATION TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right