WO2021078161A1 - Method for processing rendering instruction in simulator and mobile terminal - Google Patents

Method for processing rendering instruction in simulator and mobile terminal Download PDF

Info

Publication number
WO2021078161A1
WO2021078161A1 PCT/CN2020/122528 CN2020122528W WO2021078161A1 WO 2021078161 A1 WO2021078161 A1 WO 2021078161A1 CN 2020122528 W CN2020122528 W CN 2020122528W WO 2021078161 A1 WO2021078161 A1 WO 2021078161A1
Authority
WO
WIPO (PCT)
Prior art keywords
rendering
instruction
instructions
sent
rendering instructions
Prior art date
Application number
PCT/CN2020/122528
Other languages
French (fr)
Chinese (zh)
Inventor
何书杰
罗朴良
李斌飞
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021078161A1 publication Critical patent/WO2021078161A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Definitions

  • the embodiments of the present application relate to the field of electronic technology, and in particular, to a method for processing rendering instructions in an emulator and a mobile terminal.
  • the Android emulator can simulate the running environment of the Android mobile phone on the personal computer, so that the user can run the application (such as games, etc.) of the Android phone on the personal computer.
  • running Android applications through the Android emulator has the following advantages:
  • the screen of a personal computer is usually larger than the screen of a mobile phone, and a large screen can provide a better visual experience; there is no power consumption or network Concerns about traffic; using the keyboard and mouse of a personal computer, the control performance is smoother; multiple Android applications can be run at the same time; the computing performance of a personal computer is usually stronger than that of a mobile phone, which can break through the limitations of mobile phone performance (such as CPU Central Processing Unit) wait wait wait wait.
  • mobile phone performance such as CPU Central Processing Unit
  • the bandwidth of the transmission pipeline affects the speed of the rendering instruction transmission. If the pipeline bandwidth is small, the rendering instruction transmission may be slow, and the screen may drop frames and freezes, which will affect the user experience. Therefore, there is an urgent need to improve the transmission capability of the simulator.
  • the embodiment of the present application provides a method for processing rendering instructions in the simulator, which can improve the transmission capacity of the transmission pipeline of the simulator and avoid phenomena such as frame drop and freeze on the screen.
  • an embodiment of the present application provides a method for processing rendering instructions in a simulator, including: traversing the rendering instructions to be sent, and the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions; The obtained asynchronous execution rendering instruction is compressed to obtain a first instruction compressed package; the first instruction compressed package is sent; the first instruction compressed package is decompressed, and the decompressed asynchronous execution rendering instruction is executed.
  • traversing the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions
  • the obtained asynchronous execution rendering instruction is compressed to obtain a first instruction compressed package; the first instruction compressed package is sent; the first instruction compressed package is decompressed, and the decompressed asynchronous execution rendering instruction is executed.
  • the traversing the rendering instructions to be sent includes: detecting the rendering instructions to be sent one by one according to the order in which they are to be sent.
  • the asynchronously executed rendering instruction obtained by executing the decompression includes: sending the asynchronously executed rendering instruction to a GPU, and the GPU generates a rendering image.
  • the method further includes: sending the synchronous execution rendering instruction obtained by the traversal.
  • the method before the traversal of the rendering instructions to be sent, the method further includes: detecting the type of the rendering instructions and marking them.
  • the detection of the type of rendering instruction includes: for a rendering instruction with a return value of void, marking it as an asynchronous execution rendering instruction; for a rendering instruction with a return value of non-void, marking it as a synchronous execution rendering instruction.
  • the detecting the type of the rendering instruction includes: using an instruction function symbol table to detect the type of the rendering instruction.
  • the method before the traversing the rendering instructions to be sent, the method further includes: detecting a first bandwidth required by an application currently running in the simulator; and determining whether the first bandwidth is Exceeds the maximum bandwidth capability supported by the simulator.
  • the traversing the rendering instruction to be sent includes: if the traversal obtains the synchronous execution rendering instruction, then suspend the traversal and send the synchronous execution rendering instruction; if the traversal obtains the asynchronous execution rendering instruction, continue Traverse until it encounters a synchronous execution instruction and pause the traversal.
  • an embodiment of the present application provides a mobile terminal, which includes one or more processors, a memory, and one or more programs; wherein, one or more programs are stored in the memory and configured to be One or more processors are executed, and one or more programs include instructions for executing the method according to the first aspect.
  • an embodiment of the present application provides a storage medium for storing computer software instructions, and the computer software instructions are used to execute the method described in the first aspect.
  • embodiments of the present application provide a computer program product, which when the computer program product is run, causes a computer to execute the method described in the first aspect.
  • the transmission capacity of the simulator can be improved, and the user experience can be improved.
  • FIG. 1 is a schematic diagram of a simulator transmission instruction provided by an embodiment of the application
  • FIG. 2 is a schematic structural diagram of an operating system provided by an embodiment of the application.
  • FIG. 3 is a flowchart of a method for processing rendering instructions in a simulator provided by an embodiment of the application
  • FIG. 4 is a schematic diagram of another simulator transmission instruction provided by an embodiment of the application.
  • FIG. 5 is a flowchart of another method for processing rendering instructions in a simulator according to an embodiment of the application
  • FIG. 6 is a flowchart of another method for processing rendering instructions in a simulator provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of another simulator transmission instruction provided by an embodiment of the application.
  • the mobile terminals described in this application may include mobile phones, tablet computers, wearable devices (for example, watches, bracelets, smart helmets, etc.), personal computers (PC), vehicle-mounted devices, smart home devices, and augmented reality (augmented reality (AR)/virtual reality (VR) equipment, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDAs), etc.
  • Some embodiments of the present application take a personal computer as an example. It should be understood that these embodiments can also be applied to other types of mobile terminals.
  • the application program (application, app) involved in this application may be referred to as an application, which is a software program that can realize one or more specific functions.
  • an application which is a software program that can realize one or more specific functions.
  • multiple applications can be installed in a mobile terminal, for example, sports applications, music applications, dictionary applications, and so on.
  • the application may be an application that has been installed when the mobile terminal is shipped from the factory, or an application that the user downloads from the network or obtains from other electronic devices in the process of using the mobile terminal.
  • Third-party applications usually refer to applications developed by non-mobile terminal manufacturers. For example, for Huawei For mobile phones, third-party applications can be applications developed by developers other than Huawei.
  • the simulator can simulate the system or operating environment of the B terminal on the A terminal, and run the application on the B terminal on the A terminal.
  • a common one such as an Android emulator, can simulate the operating environment of the Android mobile phone on the personal computer, so that the user can run the application (such as games, etc.) of the Android phone on the personal computer.
  • To install Microsoft’s Take the personal computer of the system as an example.
  • Android emulator software can be installed on the personal computer; the user can run Android applications (such as apk files) in the Android emulator software, and these Android applications can be downloaded by the user through the Android emulator software , It can also be downloaded by users through channels other than Android emulator software (such as browsers, etc.).
  • the screen of a personal computer is usually larger than the screen of a mobile phone, and a large screen can provide a better visual experience; there is no power consumption or network Traffic concerns; using a personal computer’s keyboard and mouse, the control performance is smoother; multiple Android applications can be run at the same time; the computing performance of a personal computer is usually stronger than that of a mobile phone, which can break through the limitations of mobile phone performance (such as CPU Central Processing Unit Central Processing Unit) wait wait wait wait.
  • mobile phone performance such as CPU Central Processing Unit Central Processing Unit
  • the user installs the simulator client (guest) on the personal computer (host), the simulator client transmits instructions and other data to the personal computer through a transmission pipe (pipe), and the personal computer uses its own
  • the GPU Graphic Processing Unit
  • Rendering refers to the process of generating images from the model in the computer drawing process, which is generally performed by the graphics card GPU.
  • the Android emulator software sends screen rendering instructions to the personal computing operating system, and the personal computer processes these rendering instructions through its own GPU and finally generates the game screen.
  • OpenGL Open Graphics Library
  • API application programming interface
  • FIG. 2 shows a schematic diagram of the architecture of the Android Android system.
  • the Android operating system architecture is divided into four layers, from high-level to bottom-level divided into application layer, application framework layer, function library layer and Linux kernel layer.
  • the application layer is the top layer of the Android operating system architecture, including the core application software assembled by the Android operating system, such as email clients, text messages, calls, calendars, maps, browsers, contacts, etc.
  • application software assembled by the Android operating system
  • developers can write application software and install it to this layer.
  • application programs are developed in Java language, which is completed by calling API (Application Programming Interface) provided by the application framework layer.
  • the application framework layer (Application Framework) mainly provides developers with access to various APIs used by the application. Developers use the application framework layer to communicate with the underlying Android (such as the function library layer, the Linux kernel layer, etc.) Interactive and develop your own applications.
  • the application framework layer is mainly a series of services and management systems of the Android operating system.
  • the application framework layer mainly includes the following key services:
  • Activity Manager (Activity Manager) is used to manage the application life cycle and provide common navigation rollback functions
  • Content Providers are used to manage data sharing and access between different applications
  • the Notification Manager is used to control the application to display prompt information (such as Alerts, Notifications, etc.) to the user in the status bar;
  • Resource Manager Provides non-code resources (such as strings, graphics, and layout files, etc.) for use by application programs;
  • Package Manager (Package Manager) is mainly used to manage the applications of the Android operating system
  • View with a rich and extensible collection of views, can be used to build an application, which specifically includes a list (List), a grid (Grid), a text box (TextBox), a button (Button), and embeddable Web browser;
  • the location manager (Location Manager) mainly allows applications to access the current geographic location of the mobile phone.
  • the library layer (Libraries) is the support of the application framework and an important link between the application framework layer and the Linux kernel layer.
  • the function library layer includes some function libraries compiled by the computer program C language or C++ language, these function libraries can be used by different components in the Android operating system, and they provide services for developers through the Android application framework.
  • the function library includes the libc function library, which is specially customized for embedded Linux-based devices; the function library also includes the Android operating system multimedia library (Media Framework), which supports the playback and playback of audio/video in multiple encoding formats. Recording, while supporting still image files, as well as common audio/video encoding formats.
  • the function library also includes the interface management library (Surface Manager), which is mainly responsible for managing access to the display system. It is specifically used to manage the interaction between display and access operations when multiple applications are executed. It is also responsible for 2D drawing and 3D. The drawing is displayed and synthesized.
  • the function library layer also includes other function libraries for implementing various functions of Android operating system phones, such as: SGL (Scalable Graphics Library): 2D graphics and image processing engine based on XML (Extensible Markup Language) files; SSL (Secure Sockets Layer) ): Located between TVP/IP protocol (TransmissionControlProtocol/InternetProtocol, Transmission Control Protocol/Internet Protocol) and various application layer protocols, providing support for data communication; OpenGL/ES: 3D effect support; SQLite: relational database engine ; Webkit: Web browser engine; FreeType: Bitmap and Vector font support; etc.
  • SGL Scalable Graphics Library
  • XML Extensible Markup Language
  • SSL Secure Sockets Layer
  • TVP/IP protocol TransmissionControlProtocol/InternetProtocol, Transmission Control Protocol/Internet Protocol
  • OpenGL/ES 3D effect support
  • SQLite relational database engine
  • Webkit Web browser engine
  • FreeType Bitmap and Vector font support
  • Android Runtime is a running environment on the Android operating system, and a new virtual machine used by the Android operating system.
  • AOT Address-Of-Time
  • Android Runtime using AOT (Ahead-Of-Time) technology, when an application is installed for the first time, the bytecode of the application will be pre-compiled into machine code, making the program a real local application. After running it again, the compilation step is omitted, and the startup and execution will become faster.
  • Android Runtime can also be replaced by Core Libraries and Dalvik Virtual Machine.
  • the core function library provides most of the functions in the Java language API (Application Programming Interface), and provides an interface to the application framework layer to call the underlying library through the JNI (Java Native Interface) method. It also contains some core APIs of Android, such as android.os, android.net, android.media and so on.
  • the Dalvik virtual machine uses a JIT (Just-in-Time) runtime compilation mechanism. Every time a process is started, the virtual machine needs to recompile the bytecode in the background, which will have a certain impact on the startup speed. Every Android application runs in an instance in a Dalvik virtual machine, and each Dalvik virtual machine instance is an independent process space.
  • the Dalvik virtual machine is designed to efficiently run multiple virtual machines on one device.
  • the executable file format of the Dalvik virtual machine is .dex.
  • the dex format is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed. What needs to be mentioned is that the Dalvik virtual machine relies on the Linux kernel to provide basic functions (threads, low-level memory management). It is understandable that Android Runtime and Dalvik belong to different types of virtual machines, and those skilled in the art can choose different forms of virtual machines in different situations.
  • Android's core system services are all based on the Linux kernel.
  • the Linux kernel also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to mobile devices.
  • the main drivers are: Display Driver: Linux-based Frame Buffer driver.
  • Keyboard Driver Keyboard Driver (KeyBoard Driver): As the keyboard driver of the input device.
  • Flash driver Flash Memory Driver
  • MTD memory technology device
  • Camera Driver A commonly used Linux-based v4l2 (Video for Linux) driver.
  • Audio Driver A commonly used advanced Linux sound system driver based on ALSA (Advanced Linux Sound Architecture).
  • Bluetooth Driver Wireless transmission technology based on IEEE 802.15.1 standard.
  • WiFi Drive A driver based on the IEEE 802.11 standard.
  • Binder (IPC) driver A special driver for Android that has a separate device node and provides the function of inter-process communication. Power Management: For example, battery power, etc.
  • the bandwidth of the transmission pipeline affects the speed of the rendering instruction transmission. If the pipeline bandwidth is small, it may cause the rendering instruction transmission to be slow, resulting in low GPU utilization of the personal computer (also known as GPU starvation) , Making the simulator performance degraded.
  • the maximum bandwidth capacity supported by the emulators on the market is about 1GB/s-2GB/s, which can render ordinary 1080P game screens (the bandwidth of 1080P screens is about 500MB/s); but with more and more high-definition game screens With the advent of, the rendering of simulators is becoming more and more inadequate.
  • the bandwidth required for 4K game screens is about 2GB/s, which has exceeded the maximum bandwidth capacity that ordinary simulators can support, so there will be screen drop frames, freezes, etc. Phenomenon that affects user experience. Therefore, there is an urgent need to improve the transmission capability of the simulator.
  • this application proposes a solution that can compress rendering instructions.
  • compressing rendering instructions the amount of transmission data of rendering instructions can be reduced, and it can be reduced to the bandwidth capability supported by the simulator's transmission pipeline.
  • rendering instructions can be transmitted smoothly and in time, avoiding frame dropping and freezing, etc., improving rendering fluency, and improving user experience.
  • rendering instructions can be divided into synchronously executing rendering instructions and asynchronously executing rendering instructions. Synchronous execution of rendering instructions needs to be executed synchronously and waiting for the return value, and asynchronous execution of rendering instructions needs to be executed asynchronously and does not need to wait for the return value. To execute an instruction synchronously, it is necessary to wait for the execution of this instruction to complete and obtain the return value before executing other instructions, while asynchronous execution can be executed concurrently without waiting for the return value. For multiple synchronously executed rendering instructions, it is necessary to wait for one instruction to be executed and get the return value result before the next instruction can be executed, so multiple synchronously executed rendering instructions cannot be compressed and sent together.
  • Figure 3 provides a method for processing rendering instructions in the simulator, which includes the following steps:
  • Traverse rendering instructions to be sent where the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions.
  • the simulator client can traverse the rendering instructions to be sent, and the rendering instructions to be sent may include synchronously executing rendering instructions and asynchronously executing rendering instructions. The traversal can be detected one by one according to the sequence of the rendering instructions to be sent.
  • the simulator client may compress them to reduce the bandwidth required for transmission.
  • Asynchronous execution of the rendering instruction does not need to be executed synchronously, nor does it need to wait for the return value, so it can be compressed to obtain the first instruction compressed package.
  • For the synchronous execution of rendering instructions it may be transmitted without compression.
  • the emulator client can send rendering instructions to the mobile terminal for processing. Since step 301 compresses the asynchronously executed rendering instructions, the bandwidth requirement of the transmission pipeline can be met.
  • the mobile terminal introduces the first command compressed package through the transmission pipe.
  • the mobile terminal decompresses the received first instruction compression package, and obtains the asynchronous execution rendering instruction that needs to be rendered. These rendering instructions can be sent to the GPU for rendering, and corresponding rendering images are generated.
  • the emulator client can detect three rendering instructions to be sent-A rendering instruction, B rendering instruction and C rendering instruction, where A rendering instruction, B The rendering instruction is to execute the rendering instruction asynchronously, and the C rendering instruction is to execute the rendering instruction synchronously.
  • the simulator client traverses the above three rendering instructions to be sent, and obtains the two asynchronous rendering instructions of A rendering instruction and B rendering instruction in turn.
  • the simulator client can temporarily save (such as stored in the system cache), and not Send it to the host immediately, but compress the two asynchronously executed rendering instructions to obtain the first instruction compression package. Then, the simulator client sends the first instruction compressed package to the host for decompression, and the host obtains the decompressed A rendering instruction and B rendering instruction.
  • These two rendering instructions can be sent to the GPU for execution to obtain a rendered image.
  • For the C rendering instruction because the rendering instruction is executed synchronously, it needs to be executed synchronously and the return value is obtained, so it cannot be compressed into the first instruction compression package, but is sent to the host separately for execution by the GPU.
  • the type of the rendering instruction can be detected and marked in advance. For example, for a rendering instruction with a return value of void, it can be marked as an asynchronous execution rendering instruction; for a rendering with a return value of non-void Instructions can be marked as synchronous execution of rendering instructions.
  • After marking classify and store the asynchronous execution rendering instructions (compressible) and synchronous execution rendering instructions (uncompressible).
  • the stored marked rendering instruction classification can be directly called without re-checking, thereby saving running time.
  • the simulator is reinstalled or the user deletes the application data, the classification needs to be rechecked.
  • the instruction function symbol table can also be used to detect and mark the type of rendering instruction in advance.
  • the instruction function symbol table is a preset symbol table, and you can know whether a certain instruction executes the rendering instruction synchronously or asynchronously by looking up the table. For example, for the following rendering instruction: syn-h-wb-4b-whnc-10y-whenrub-return(1), looking up the instruction function symbol table shows that this is a synchronous execution instruction.
  • the currently running application in the simulator can be an already started application or an application that the user will start.
  • the required bandwidth is different.
  • the required bandwidth can be detected after the display mode is detected.
  • the rendering instructions need to be compressed to meet the bandwidth requirements of the transmission pipeline, otherwise the picture freezes and frame drops may occur.
  • the maximum bandwidth capability supported by the simulator can be judged in advance. If the maximum bandwidth capability supports the current application, there is no need to compress rendering instructions.
  • FIG. 6 provides another method of processing rendering instructions in the simulator, including the following steps:
  • Traverse rendering instructions to be sent where the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions.
  • step 602 If the traversal obtains the synchronous execution rendering instruction, pause the traversal and execute step 606; if the traverse obtains the asynchronous execution rendering instruction, continue the traversal, and pause the traversal when the synchronous execution instruction is encountered.
  • the traversal needs to be suspended, and the synchronously executed rendering instructions are sent first (step 606). If the traversal result is an asynchronous execution rendering instruction, it will not be sent temporarily. Instead, it will continue to traverse the remaining asynchronous execution rendering instructions until the next synchronous execution rendering instruction is encountered. Then, the asynchronous execution rendering instructions obtained can be compressed. Send, and then send the synchronous execution rendering command.
  • step 603 Compress the asynchronously executed rendering instruction obtained by traversing in step 602 to obtain a first instruction compression package.
  • 605 Decompress the first command compression package, and execute the asynchronous execution rendering command obtained by the decompression.
  • step 606 Send the synchronous execution rendering instruction obtained by traversal in step 602, and execute the synchronous execution rendering instruction.
  • the emulator client can detect the 4 rendering instructions to be sent-A rendering instruction, B rendering instruction, C rendering instruction and D rendering instruction, where A Rendering instructions, B rendering instructions, and D rendering instructions are rendering instructions that are executed asynchronously, and C rendering instructions are rendering instructions that are executed synchronously.
  • the emulator client traverses the above 4 rendering instructions to be sent, and obtains two asynchronous rendering instructions A rendering instruction and B rendering instruction in turn.
  • the emulator client can temporarily save it instead of sending it to the host immediately.
  • the simulator client sends the first instruction compressed package to the host for decompression, and the host obtains the decompressed A rendering instruction and B rendering instruction.
  • These two rendering instructions can be sent to the GPU for execution to obtain a rendered image.
  • the rendering instruction because the rendering instruction is executed synchronously, it needs to be executed synchronously and the return value is obtained, so it cannot be compressed into the first instruction compression package, but is sent to the host separately for execution by the GPU. Then continue to traverse the rest of the rendering instructions, such as the D rendering instruction. Because the rendering instructions are executed asynchronously, the traversal continues until the next synchronous execution rendering instruction is encountered. . . Repeat the above steps.
  • the first scene is to use the emulator to play high-definition games (for example, the screen reaches 4K resolution or higher).
  • the emulator guest can receive the message of the game start event.
  • the guest can traverse the rendering instructions currently to be sent, and divide the current rendering instructions into synchronous execution rendering instructions and asynchronous execution rendering instructions according to the function symbol table. For asynchronously executed rendering instructions, it may not be sent temporarily, but compressed together with other asynchronously executed rendering instructions that have been traversed, and then sent to the host for rendering processing.
  • the traversed synchronous execution rendering instructions can be sent separately.
  • the second scenario is to use the simulator to watch high-definition video (for example, the picture reaches a resolution of 4K or more).
  • the emulator guest can receive the message of the video playback event.
  • the guest can traverse the rendering instructions currently to be sent, and divide the current rendering instructions into synchronous execution rendering instructions and asynchronous execution rendering instructions according to the function symbol table. For asynchronously executed rendering instructions, it may not be sent temporarily, but compressed together with other asynchronously executed rendering instructions that have been traversed, and then sent to the host for rendering processing.
  • the traversed synchronous execution rendering commands can be sent separately.
  • the bandwidth required by the video can be compared with the maximum bandwidth capability supported by the simulator. If the maximum bandwidth capability supported by the simulator is exceeded, the asynchronous execution rendering instructions obtained by the traversal need to be compressed.
  • the third scene is the office scene using the simulator.
  • the simulator guest can receive the message of the start of the office event.
  • the guest can traverse the rendering instructions currently to be sent, and divide the current rendering instructions into synchronous execution rendering instructions and asynchronous execution rendering instructions according to the function symbol table. For asynchronously executed rendering instructions, it may not be sent temporarily, but compressed together with other asynchronously executed rendering instructions that have been traversed, and then sent to the host for rendering processing.
  • the traversed synchronous execution rendering instructions can be sent separately.
  • the mobile terminal includes one or more processors, a memory, and one or more programs; wherein, one or more programs are stored in the memory and configured to be configured by one or more
  • the processor executes, and the one or more programs include instructions, and the instructions are used to execute the methods described in FIGS. 3-7.
  • This application also provides a storage medium for storing computer software instructions, which are used to execute the methods described in FIGS. 3-7.
  • the present application also provides a computer program product, which, when the computer program product is run, causes the computer to execute the method described in FIGS. 3-7.
  • the disclosed device and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be divided. It can be combined or integrated into another device, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate parts may or may not be physically separate.
  • the parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, and the software product is stored in a storage medium. It includes several instructions to make a device (may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.

Abstract

A method for processing a rendering instruction in a simulator. The method comprises: traversing a rendering instruction to be sent (301), the rendering instruction comprising a synchronous execution rendering instruction and an asynchronous execution rendering instruction; compressing the asynchronous executive rendering instruction obtained by traversing, so as to obtain a first instruction compressed packet (302); sending the first instruction compressed packet (303); and decompressing the first instruction compressed packet and executing the decompressed asynchronous executive rendering instruction (304). By means of the method above, the capability of data transmission of a simulator may be improved.

Description

一种在模拟器中处理渲染指令的方法及移动终端Method for processing rendering instructions in simulator and mobile terminal
本申请要求在2019年10月23日提交中国国家知识产权局、申请号为201911012928.0的中国专利申请的优先权,发明名称为“一种在模拟器中处理渲染指令的方法及移动终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the State Intellectual Property Office of China with an application number of 201911012928.0 on October 23, 2019. The title of the invention is "A method for processing rendering instructions in a simulator and a mobile terminal" in China The priority of the patent application, the entire content of which is incorporated in this application by reference.
技术领域Technical field
本申请实施例涉及电子技术领域,尤其涉及一种在模拟器中处理渲染指令的方法及移动终端。The embodiments of the present application relate to the field of electronic technology, and in particular, to a method for processing rendering instructions in an emulator and a mobile terminal.
背景技术Background technique
安卓模拟器可以在个人计算机端模拟出安卓手机端的运行环境,从而用户可以在个人计算机上运行安卓手机的应用程序(例如游戏等)。相比于在安卓手机上运行安卓应用程序,通过安卓模拟器运行安卓应用程序有以下优点:个人计算机的屏幕通常比手机屏幕大,大屏幕可以获得更好的视觉体验;不存在消耗电量、网络流量的顾虑;使用个人计算机的键盘鼠标,操控性能更流畅;可以同时运行多个安卓应用程序;个人计算机的计算性能通常强于手机,可以突破手机性能的限制(如CPU Central Processing Unit中央处理单元等);等等。在模拟器运行过程中,传输管道的带宽大小影响着渲染指令传输的快慢,如果管道带宽小,可能造成渲染指令传输较慢,会出现画面掉帧、卡顿等现象,影响用户体验。所以,亟需提高模拟器的传输能力。The Android emulator can simulate the running environment of the Android mobile phone on the personal computer, so that the user can run the application (such as games, etc.) of the Android phone on the personal computer. Compared with running Android applications on Android phones, running Android applications through the Android emulator has the following advantages: The screen of a personal computer is usually larger than the screen of a mobile phone, and a large screen can provide a better visual experience; there is no power consumption or network Concerns about traffic; using the keyboard and mouse of a personal computer, the control performance is smoother; multiple Android applications can be run at the same time; the computing performance of a personal computer is usually stronger than that of a mobile phone, which can break through the limitations of mobile phone performance (such as CPU Central Processing Unit) wait wait wait. During the operation of the simulator, the bandwidth of the transmission pipeline affects the speed of the rendering instruction transmission. If the pipeline bandwidth is small, the rendering instruction transmission may be slow, and the screen may drop frames and freezes, which will affect the user experience. Therefore, there is an urgent need to improve the transmission capability of the simulator.
发明内容Summary of the invention
本申请实施例提供一种在模拟器中处理渲染指令,能够提高模拟器传输管道的传输能力,避免画面掉帧、卡顿等现象。The embodiment of the present application provides a method for processing rendering instructions in the simulator, which can improve the transmission capacity of the transmission pipeline of the simulator and avoid phenomena such as frame drop and freeze on the screen.
为达到上述目的,本申请实施例采用如下技术方案:To achieve the foregoing objectives, the following technical solutions are adopted in the embodiments of the present application:
第一方面,本申请实施例提供一种在模拟器中处理渲染指令的方法,包括:遍历待发送的渲染指令,所述待发送的渲染指令包括同步执行渲染指令和异步执行渲染指令;将遍历得到的所述异步执行渲染指令进行压缩,得到第一指令压缩包;发送所述第一指令压缩包;解压缩所述第一指令压缩包,执行解压缩得到的所述异步执行渲染指令。通过对异步执行渲染指令进行压缩,提高了传输效率。In the first aspect, an embodiment of the present application provides a method for processing rendering instructions in a simulator, including: traversing the rendering instructions to be sent, and the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions; The obtained asynchronous execution rendering instruction is compressed to obtain a first instruction compressed package; the first instruction compressed package is sent; the first instruction compressed package is decompressed, and the decompressed asynchronous execution rendering instruction is executed. By compressing asynchronously executed rendering instructions, the transmission efficiency is improved.
在一种可能的实现方式中,所述遍历待发送的渲染指令,包括:按照待发送的顺序逐一检测所述待发送的渲染指令。In a possible implementation manner, the traversing the rendering instructions to be sent includes: detecting the rendering instructions to be sent one by one according to the order in which they are to be sent.
在一种可能的实现方式中,所述执行解压缩得到的所述异步执行渲染指令,包括:将所述异步执行渲染指令发送给GPU,由所述GPU生成渲染画面。In a possible implementation manner, the asynchronously executed rendering instruction obtained by executing the decompression includes: sending the asynchronously executed rendering instruction to a GPU, and the GPU generates a rendering image.
在一种可能的实现方式中,所述方法还包括:发送遍历得到的所述同步执行渲染指令。In a possible implementation manner, the method further includes: sending the synchronous execution rendering instruction obtained by the traversal.
在一种可能的实现方式中,在所述遍历待发送的渲染指令之前,所述方法还包括:检测渲染指令的类型并进行标记。In a possible implementation manner, before the traversal of the rendering instructions to be sent, the method further includes: detecting the type of the rendering instructions and marking them.
在一种可能的实现方式中,所述检测渲染指令的类型,包括:对于返回值为void的渲染指令,标记为异步执行渲染指令;对于返回值为非void的渲染指令,标记为同步执行渲染指令。In a possible implementation manner, the detection of the type of rendering instruction includes: for a rendering instruction with a return value of void, marking it as an asynchronous execution rendering instruction; for a rendering instruction with a return value of non-void, marking it as a synchronous execution rendering instruction.
在一种可能的实现方式中,所述检测渲染指令的类型,包括:使用指令函数符号表来检测所述渲染指令的类型。In a possible implementation manner, the detecting the type of the rendering instruction includes: using an instruction function symbol table to detect the type of the rendering instruction.
在一种可能的实现方式中,在所述遍历待发送的渲染指令之前,所述方法还包括:检测所述模拟器中当前运行的应用所需要的第一带宽;判断所述第一带宽是否超过所述模拟器支持的最大带宽能力。In a possible implementation manner, before the traversing the rendering instructions to be sent, the method further includes: detecting a first bandwidth required by an application currently running in the simulator; and determining whether the first bandwidth is Exceeds the maximum bandwidth capability supported by the simulator.
在一种可能的实现方式中,所述遍历待发送的渲染指令,包括:如果遍历得到同步执行渲染指令,则暂停遍历并发送所述同步执行渲染指令;如果遍历得到异步执行渲染指令,则继续遍历,直到遇到同步执行指令时暂停遍历。In a possible implementation manner, the traversing the rendering instruction to be sent includes: if the traversal obtains the synchronous execution rendering instruction, then suspend the traversal and send the synchronous execution rendering instruction; if the traversal obtains the asynchronous execution rendering instruction, continue Traverse until it encounters a synchronous execution instruction and pause the traversal.
第二方面,本申请实施例提供一种移动终端,该移动终端包括一个或多个处理器,存储器,一个或多个程序;其中,一个或多个程序被存储在存储器中并被配置为被一个或多个处理器执行,一个或多个程序包括指令,指令用于执行如第一方面所述的方法。In a second aspect, an embodiment of the present application provides a mobile terminal, which includes one or more processors, a memory, and one or more programs; wherein, one or more programs are stored in the memory and configured to be One or more processors are executed, and one or more programs include instructions for executing the method according to the first aspect.
第三方面,本申请实施例提供一种存储介质,用于存储计算机软件指令,计算机软件指令用于执行如第一方面所述的方法。In a third aspect, an embodiment of the present application provides a storage medium for storing computer software instructions, and the computer software instructions are used to execute the method described in the first aspect.
第四方面,本申请实施例提供一种计算机程序产品,当运行计算机程序产品时,使得计算机执行如第一方面所述的方法。In a fourth aspect, embodiments of the present application provide a computer program product, which when the computer program product is run, causes a computer to execute the method described in the first aspect.
通过以上方案,可以提高模拟器的传输能力,改善用户体验。Through the above scheme, the transmission capacity of the simulator can be improved, and the user experience can be improved.
附图说明Description of the drawings
图1为本申请实施例提供的一种模拟器传输指令的示意图;FIG. 1 is a schematic diagram of a simulator transmission instruction provided by an embodiment of the application;
图2为本申请实施例提供的一种操作系统的结构示意图;FIG. 2 is a schematic structural diagram of an operating system provided by an embodiment of the application;
图3为本申请实施例提供的一种在模拟器中处理渲染指令的方法流程图;3 is a flowchart of a method for processing rendering instructions in a simulator provided by an embodiment of the application;
图4为本申请实施例提供的另一种模拟器传输指令的示意图;FIG. 4 is a schematic diagram of another simulator transmission instruction provided by an embodiment of the application;
图5为本申请实施例提供的另一种在模拟器中处理渲染指令的方法流程图;FIG. 5 is a flowchart of another method for processing rendering instructions in a simulator according to an embodiment of the application;
图6为本申请实施例提供的另一种在模拟器中处理渲染指令的方法流程图;6 is a flowchart of another method for processing rendering instructions in a simulator provided by an embodiment of the application;
图7为本申请实施例提供的另一种模拟器传输指令的示意图。FIG. 7 is a schematic diagram of another simulator transmission instruction provided by an embodiment of the application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this document is only a description of related objects The association relationship of indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: A alone exists, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" refers to two or more than two.
本申请所述的移动终端可以包括诸如手机、平板电脑、可穿戴设备(例如,手表、手环、智能头盔等)、个人计算机(personal computer,PC),车载设备、智能家居设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等。本申请一些实施例以个人计算机为例,可以理解的是,这些实施例也可应用于其他类型的移动终端。The mobile terminals described in this application may include mobile phones, tablet computers, wearable devices (for example, watches, bracelets, smart helmets, etc.), personal computers (PC), vehicle-mounted devices, smart home devices, and augmented reality ( augmented reality (AR)/virtual reality (VR) equipment, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDAs), etc. Some embodiments of the present application take a personal computer as an example. It should be understood that these embodiments can also be applied to other types of mobile terminals.
本申请涉及的应用程序(application,app),可以简称应用,为能够实现某项或多项特定功能的软件程序。通常,移动终端中可以安装多个应用,例如,运动类应用,音乐类应用,词典类应用等。可以理解的是,应用可以是移动终端出厂时已安装的应用,也可以是用户在 使用移动终端的过程中从网络下载或从其他电子设备获取的应用。第三方应用通常是指非移动终端生产商开发的应用,例如对于华为
Figure PCTCN2020122528-appb-000001
手机,第三方应用可以是除了华为以外的其他开发者开发的应用。
The application program (application, app) involved in this application may be referred to as an application, which is a software program that can realize one or more specific functions. Generally, multiple applications can be installed in a mobile terminal, for example, sports applications, music applications, dictionary applications, and so on. It is understandable that the application may be an application that has been installed when the mobile terminal is shipped from the factory, or an application that the user downloads from the network or obtains from other electronic devices in the process of using the mobile terminal. Third-party applications usually refer to applications developed by non-mobile terminal manufacturers. For example, for Huawei
Figure PCTCN2020122528-appb-000001
For mobile phones, third-party applications can be applications developed by developers other than Huawei.
模拟器可以在A终端上模拟出B终端的系统或运行环境,将B终端上的应用程序在A终端上运行。常见的例如安卓模拟器,可以在个人计算机端模拟出安卓手机端的运行环境,从而用户可以在个人计算机上运行安卓手机的应用程序(例如游戏等)。以安装了微软公司的
Figure PCTCN2020122528-appb-000002
系统的个人计算机为例,可以在个人计算机上安装安卓模拟器软件;用户可以在安卓模拟器软件中运行安卓应用程序(例如apk文件),这些安卓应用程序可以是用户通过安卓模拟器软件下载的,也可以是用户通过除了安卓模拟器软件以外的渠道下载的(例如浏览器等)。相比于在安卓手机上运行安卓应用程序,通过安卓模拟器运行安卓应用程序有以下优点:个人计算机的屏幕通常比手机屏幕大,大屏幕可以获得更好的视觉体验;不存在消耗电量、网络流量的顾虑;使用个人计算机的键盘鼠标,操控性能更流畅;可以同时运行多个安卓应用程序;个人计算机的计算性能通常强于手机,可以突破手机性能的限制(如CPU Central Processing Unit中央处理单元等);等等。
The simulator can simulate the system or operating environment of the B terminal on the A terminal, and run the application on the B terminal on the A terminal. A common one, such as an Android emulator, can simulate the operating environment of the Android mobile phone on the personal computer, so that the user can run the application (such as games, etc.) of the Android phone on the personal computer. To install Microsoft’s
Figure PCTCN2020122528-appb-000002
Take the personal computer of the system as an example. Android emulator software can be installed on the personal computer; the user can run Android applications (such as apk files) in the Android emulator software, and these Android applications can be downloaded by the user through the Android emulator software , It can also be downloaded by users through channels other than Android emulator software (such as browsers, etc.). Compared with running Android applications on Android phones, running Android applications through the Android emulator has the following advantages: The screen of a personal computer is usually larger than the screen of a mobile phone, and a large screen can provide a better visual experience; there is no power consumption or network Traffic concerns; using a personal computer’s keyboard and mouse, the control performance is smoother; multiple Android applications can be run at the same time; the computing performance of a personal computer is usually stronger than that of a mobile phone, which can break through the limitations of mobile phone performance (such as CPU Central Processing Unit Central Processing Unit) wait wait wait.
目前使用模拟器玩游戏的过程中,会出现掉帧现象,导致画面不流畅,用户体验不佳。如图1所示,用户在个人计算机端(host端)安装模拟器客户端(guest端),模拟器客户端通过传输管道(pipe)向个人计算机端传输指令等数据,个人计算机端通过自身的GPU(Graphic Processing Unit图形处理器)对这些指令进行处理(例如对渲染指令进行渲染)。渲染是指在计算机绘图过程中从模型生成图像的过程,一般通过显卡GPU来执行。例如,当在安卓模拟器软件上运行安卓游戏应用程序时,安卓模拟器软件会向个人计算操作系统发送画面渲染指令,个人计算机通过自身GPU处理这些渲染指令并最终生成游戏画面。常见的渲染模式包括DirectX引擎渲染和OpenGL引擎渲染,由于OpenGL引擎兼容性较强,本申请以OpenGL渲染模式为例介绍模拟器的渲染过程,可以理解的是,这些例子也可以适用于DirectX引擎渲染。OpenGL(Open Graphics Library,开放图形库)是用于渲染2D、3D矢量图形的跨语言、跨平台的应用程序编程接口(API)。At present, when using the emulator to play games, there will be frame dropping, resulting in unsmooth images and poor user experience. As shown in Figure 1, the user installs the simulator client (guest) on the personal computer (host), the simulator client transmits instructions and other data to the personal computer through a transmission pipe (pipe), and the personal computer uses its own The GPU (Graphic Processing Unit) processes these instructions (for example, renders the rendering instructions). Rendering refers to the process of generating images from the model in the computer drawing process, which is generally performed by the graphics card GPU. For example, when an Android game application is run on the Android emulator software, the Android emulator software sends screen rendering instructions to the personal computing operating system, and the personal computer processes these rendering instructions through its own GPU and finally generates the game screen. Common rendering modes include DirectX engine rendering and OpenGL engine rendering. Due to the strong compatibility of OpenGL engine, this application uses OpenGL rendering mode as an example to introduce the rendering process of the simulator. It is understandable that these examples can also be applied to DirectX engine rendering. . OpenGL (Open Graphics Library) is a cross-language and cross-platform application programming interface (API) for rendering 2D and 3D vector graphics.
本申请以安卓模拟器为例,图2示出了安卓Android系统的架构示意图。Android操作系统架构分为四层,从高层到底层分为应用程序层,应用程序框架层,函数库层和Linux内核层。This application takes the Android emulator as an example, and Figure 2 shows a schematic diagram of the architecture of the Android Android system. The Android operating system architecture is divided into four layers, from high-level to bottom-level divided into application layer, application framework layer, function library layer and Linux kernel layer.
1、应用程序层:1. Application layer:
应用程序层(Applications)是Android操作系统架构的最上一层,包括Android操作系统装配的核心应用软件,例如电子邮件客户端、短信、通话、日历、地图、浏览器、联系人等。当然,对于开发者来说,开发者可以编写应用软件并安装到该层。一般而言,应用程序都是使用Java语言开发,通过调用应用程序框架层所提供的API(Application Programming Interface)来完成。The application layer (Applications) is the top layer of the Android operating system architecture, including the core application software assembled by the Android operating system, such as email clients, text messages, calls, calendars, maps, browsers, contacts, etc. Of course, for developers, developers can write application software and install it to this layer. Generally speaking, application programs are developed in Java language, which is completed by calling API (Application Programming Interface) provided by the application framework layer.
2、应用程序框架层:2. Application framework layer:
应用程序框架层(Application Framework),主要是为开发者提供了可以访问应用程序所使用的各种API,开发者通过应用程序框架层来与Android底层(例如函数库层、Linux内核层等)进行交互,开发自己的应用。该应用程序框架层主要是Android操作系统的一系列的服务和管理系统。应用程序框架层主要包括如下关键服务:The application framework layer (Application Framework) mainly provides developers with access to various APIs used by the application. Developers use the application framework layer to communicate with the underlying Android (such as the function library layer, the Linux kernel layer, etc.) Interactive and develop your own applications. The application framework layer is mainly a series of services and management systems of the Android operating system. The application framework layer mainly includes the following key services:
活动管理器(Activity Manager)用来管理应用程序生命周期并提供常用的导航回退功能;Activity Manager (Activity Manager) is used to manage the application life cycle and provide common navigation rollback functions;
内容提供器(Content Providers),用来管理不同应用程序间的数据共享和访问;Content Providers are used to manage data sharing and access between different applications;
通知管理器(Notification Manager),用于控制应用程序在状态栏显示提示信息(例如警告(Alerts)、通知消息(Notifications)等)给用户;The Notification Manager is used to control the application to display prompt information (such as Alerts, Notifications, etc.) to the user in the status bar;
资源管理器(Resource Manager):提供非代码资源(如字符串、图形和布局文件(Layoutfile)等)供应用程序使用;Resource Manager: Provides non-code resources (such as strings, graphics, and layout files, etc.) for use by application programs;
包管理器(Package Manager)主要用于对Android操作系统的应用程序进行管理;Package Manager (Package Manager) is mainly used to manage the applications of the Android operating system;
视图(View),具有丰富的、可扩展的视图集合,可用于构建一个应用程序,它具体包括列表(List)、网格(Grid)、文本框(TextBox)、按钮(Button),以及可嵌入的网页浏览器;View, with a rich and extensible collection of views, can be used to build an application, which specifically includes a list (List), a grid (Grid), a text box (TextBox), a button (Button), and embeddable Web browser;
位置管理器(Location Manager),主要是让应用程序可以访问到手机当前的地理位置。The location manager (Location Manager) mainly allows applications to access the current geographic location of the mobile phone.
3、函数库层:3. Function library layer:
函数库层(Libraries)是应用程序框架的支撑,是连接应用程序框架层与Linux内核层的重要纽带。函数库层包括一些由计算机程序C语言或C++语言编译的函数库,这些函数库能被Android操作系统中的不同的组件使用,它们通过Android应用程序框架为开发者提供服务。具体地,函数库包括libc函数库,它是专门为基于embedded linux的设备定制的;函数库还包括Android操作系统多媒体库(Media Framework),该库支持多种编码格式的音频/视频的回放和录制,同时支持静态图像文件,以及常见的音频/视频编码格式。函数库还包括界面管理库(Surface Manager),主要负责管理针对显示系统的访问,具体用于在执行多个应用程序时候,负责管理显示与存取操作间的互动,另外也负责2D绘图与3D绘图进行显示合成。The library layer (Libraries) is the support of the application framework and an important link between the application framework layer and the Linux kernel layer. The function library layer includes some function libraries compiled by the computer program C language or C++ language, these function libraries can be used by different components in the Android operating system, and they provide services for developers through the Android application framework. Specifically, the function library includes the libc function library, which is specially customized for embedded Linux-based devices; the function library also includes the Android operating system multimedia library (Media Framework), which supports the playback and playback of audio/video in multiple encoding formats. Recording, while supporting still image files, as well as common audio/video encoding formats. The function library also includes the interface management library (Surface Manager), which is mainly responsible for managing access to the display system. It is specifically used to manage the interaction between display and access operations when multiple applications are executed. It is also responsible for 2D drawing and 3D. The drawing is displayed and synthesized.
函数库层中还包括其他的用于实现Android操作系统手机各个功能的函数库,例如:SGL(Scalable Graphics Library):基于XML(Extensible Markup Language)文件的2D图形图像处理引擎;SSL(Secure Sockets Layer):位于TVP/IP协议(TransmissionControlProtocol/InternetProtocol,传输控制协议/互联网络协议)与各种应用层协议之间,为数据通讯提供支持;OpenGL/ES:3D效果的支持;SQLite:关系型数据库引擎;Webkit:Web浏览器引擎;FreeType:位图(Bitmap)及矢量(Vector)字体支持;等等。The function library layer also includes other function libraries for implementing various functions of Android operating system phones, such as: SGL (Scalable Graphics Library): 2D graphics and image processing engine based on XML (Extensible Markup Language) files; SSL (Secure Sockets Layer) ): Located between TVP/IP protocol (TransmissionControlProtocol/InternetProtocol, Transmission Control Protocol/Internet Protocol) and various application layer protocols, providing support for data communication; OpenGL/ES: 3D effect support; SQLite: relational database engine ; Webkit: Web browser engine; FreeType: Bitmap and Vector font support; etc.
Android Runtime是一种在Android操作系统上的运行环境,是Android操作系统所使用的一种新的虚拟机。在Android Runtime中,采用AOT(Ahead-Of-Time)技术,应用程序在第一次安装的时候,该应用程序的字节码就会被预先编译成机器码,让程序成为真正的本地应用,之后再次运行,就省去了编译这一步骤,启动和执行都会变得更加快速。Android Runtime is a running environment on the Android operating system, and a new virtual machine used by the Android operating system. In Android Runtime, using AOT (Ahead-Of-Time) technology, when an application is installed for the first time, the bytecode of the application will be pre-compiled into machine code, making the program a real local application. After running it again, the compilation step is omitted, and the startup and execution will become faster.
在本申请另外的一些例子中,Android Runtime也可以由核心函数库(Core Libraries)和Dalvik虚拟机(Dalvik Virtual Machine)代替。核心函数库提供了Java语言API(Application Programming Interface)中的大多数功能,主要通过JNI(Java Native Interface)的方式向应用程序框架层提供调用底层程序库的接口。同时也包含了Android的一些核心API,如android.os、android.net、android.media等等。Dalvik虚拟机使用一种JIT(Just-in-Time)的运行时编译的机制,每次启动一个进程都需要虚拟机在后台重新编译字节码,会对启动速度有一定的影响。每一个Android应用程序都运行在是一个Dalvik虚拟机中的实例中,每一个Dalvik虚拟机实例都是一个独立的进程空间。Dalvik虚拟机设计成在一个设备可以高效地运行多个虚拟机。Dalvik虚拟机可执行文件格式是.dex,dex格式是专为Dalvik设计的一种压缩格式,适合内存和处理器速度有限的系统。需要提出的是Dalvik虚拟机依赖于Linux内核提供基本功能(线程、底层内存管理)。可以理解的是,Android Runtime、Dalvik属于不同类型的虚拟机,本领域技术人员可以在不同情况下选用不同形式的虚拟机。In some other examples of this application, Android Runtime can also be replaced by Core Libraries and Dalvik Virtual Machine. The core function library provides most of the functions in the Java language API (Application Programming Interface), and provides an interface to the application framework layer to call the underlying library through the JNI (Java Native Interface) method. It also contains some core APIs of Android, such as android.os, android.net, android.media and so on. The Dalvik virtual machine uses a JIT (Just-in-Time) runtime compilation mechanism. Every time a process is started, the virtual machine needs to recompile the bytecode in the background, which will have a certain impact on the startup speed. Every Android application runs in an instance in a Dalvik virtual machine, and each Dalvik virtual machine instance is an independent process space. The Dalvik virtual machine is designed to efficiently run multiple virtual machines on one device. The executable file format of the Dalvik virtual machine is .dex. The dex format is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed. What needs to be mentioned is that the Dalvik virtual machine relies on the Linux kernel to provide basic functions (threads, low-level memory management). It is understandable that Android Runtime and Dalvik belong to different types of virtual machines, and those skilled in the art can choose different forms of virtual machines in different situations.
4、Linux内核层:4. Linux kernel layer:
Android的核心系统服务,如安全性、内存管理、进程管理、网络协议栈和驱动模型等都 基于Linux内核。Linux内核同时也作为硬件和软件栈之间的抽象层。该层有许多与移动设备相关的驱动程序,主要的驱动有:显示驱动(Display Driver):基于Linux的帧缓冲(Frame Buffer)驱动。键盘驱动(KeyBoard Driver):作为输入设备的键盘驱动。Flash驱动(Flash Memory Driver):基于MTD(memory technology device内存技术设备)的Flash驱动程序。照相机驱动(Camera Driver):常用的基于Linux的v4l2(Video for Linux)驱动。音频驱动(Audio Driver):常用的基于ALSA(Advanced Linux Sound Architecture)的高级Linux声音体系驱动。蓝牙驱动(Bluetooth Driver):基于IEEE 802.15.1标准的无线传输技术。WiFi驱动(WiFi Drive):基于IEEE 802.11标准的驱动程序。Binder(IPC)驱动:Android的一个特殊的驱动程序,具有单独的设备节点,提供进程间通讯的功能。电源管理(Power Management):比如电池电量等。Android's core system services, such as security, memory management, process management, network protocol stack, and driver model, are all based on the Linux kernel. The Linux kernel also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to mobile devices. The main drivers are: Display Driver: Linux-based Frame Buffer driver. Keyboard Driver (KeyBoard Driver): As the keyboard driver of the input device. Flash driver (Flash Memory Driver): Flash driver based on MTD (memory technology device). Camera Driver: A commonly used Linux-based v4l2 (Video for Linux) driver. Audio Driver: A commonly used advanced Linux sound system driver based on ALSA (Advanced Linux Sound Architecture). Bluetooth Driver: Wireless transmission technology based on IEEE 802.15.1 standard. WiFi Drive: A driver based on the IEEE 802.11 standard. Binder (IPC) driver: A special driver for Android that has a separate device node and provides the function of inter-process communication. Power Management: For example, battery power, etc.
在模拟器运行过程中,传输管道pipe的带宽大小影响着渲染指令传输的快慢,如果管道带宽小,可能造成渲染指令传输较慢,从而导致个人计算机的GPU利用率低(也叫GPU饥饿现象),使得模拟器性能下降。目前市面上的模拟器支持的最大带宽能力约为1GB/s–2GB/s,可以渲染普通的1080P游戏画面(1080P画面的带宽大约是500MB/s);但随着越来越多高清游戏画面的出现,模拟器的渲染越来越力不从心,例如4K游戏画面所需的带宽大约是2GB/s,已经超过了普通模拟器所能支持的最大带宽能力,所以会出现画面掉帧、卡顿等现象,影响用户体验。所以,亟需提高模拟器的传输能力。During the operation of the simulator, the bandwidth of the transmission pipeline affects the speed of the rendering instruction transmission. If the pipeline bandwidth is small, it may cause the rendering instruction transmission to be slow, resulting in low GPU utilization of the personal computer (also known as GPU starvation) , Making the simulator performance degraded. At present, the maximum bandwidth capacity supported by the emulators on the market is about 1GB/s-2GB/s, which can render ordinary 1080P game screens (the bandwidth of 1080P screens is about 500MB/s); but with more and more high-definition game screens With the advent of, the rendering of simulators is becoming more and more inadequate. For example, the bandwidth required for 4K game screens is about 2GB/s, which has exceeded the maximum bandwidth capacity that ordinary simulators can support, so there will be screen drop frames, freezes, etc. Phenomenon that affects user experience. Therefore, there is an urgent need to improve the transmission capability of the simulator.
本申请针对以上问题,提出可以压缩渲染指令的解决方案,通过压缩渲染指令,可以减小渲染指令的传输数据量,使之降低到模拟器传输管道所能支持的带宽能力之内。这样可以顺利、及时地传输渲染指令,避免出现画面掉帧、卡顿等现象,提高渲染流畅度,改善用户体验。In view of the above problems, this application proposes a solution that can compress rendering instructions. By compressing rendering instructions, the amount of transmission data of rendering instructions can be reduced, and it can be reduced to the bandwidth capability supported by the simulator's transmission pipeline. In this way, rendering instructions can be transmitted smoothly and in time, avoiding frame dropping and freezing, etc., improving rendering fluency, and improving user experience.
然而,并不是所有渲染指令都支持压缩。渲染指令可以分为同步执行渲染指令和异步执行渲染指令。同步执行渲染指令需要同步执行且等待返回值,异步执行渲染指令需要异步执行且不需要等待返回值。同步执行某个指令,需要等待这个指令执行完成,取得返回值后才能执行其他指令,而异步执行可以并发执行,无需等待返回值。对于多条同步执行渲染指令,需要等待一个指令执行完得到返回值结果后,才能执行下一个指令,所以多条同步执行渲染指令不能一起压缩后发送。However, not all rendering instructions support compression. Rendering instructions can be divided into synchronously executing rendering instructions and asynchronously executing rendering instructions. Synchronous execution of rendering instructions needs to be executed synchronously and waiting for the return value, and asynchronous execution of rendering instructions needs to be executed asynchronously and does not need to wait for the return value. To execute an instruction synchronously, it is necessary to wait for the execution of this instruction to complete and obtain the return value before executing other instructions, while asynchronous execution can be executed concurrently without waiting for the return value. For multiple synchronously executed rendering instructions, it is necessary to wait for one instruction to be executed and get the return value result before the next instruction can be executed, so multiple synchronously executed rendering instructions cannot be compressed and sent together.
图3提供了一种在模拟器中处理渲染指令的方法,该方法包括以下步骤:Figure 3 provides a method for processing rendering instructions in the simulator, which includes the following steps:
301:遍历待发送的渲染指令,所述待发送的渲染指令包括同步执行渲染指令和异步执行渲染指令。301: Traverse rendering instructions to be sent, where the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions.
模拟器客户端在运行的过程中,例如打开模拟器中的游戏开始运行时,需要发送渲染指令给移动终端处理。在发送渲染指令前,模拟器客户端可以遍历待发送的渲染指令,这些待发送的渲染指令可以包括同步执行渲染指令和异步执行渲染指令。遍历可以按照待发送的渲染指令的先后顺序逐一检测。During the running of the emulator client, for example, when the game in the emulator is opened to start running, it needs to send a rendering instruction to the mobile terminal for processing. Before sending the rendering instructions, the simulator client can traverse the rendering instructions to be sent, and the rendering instructions to be sent may include synchronously executing rendering instructions and asynchronously executing rendering instructions. The traversal can be detected one by one according to the sequence of the rendering instructions to be sent.
302:将遍历得到的异步执行渲染指令进行压缩,得到第一指令压缩包。302: Compress the asynchronously executed rendering instructions obtained by the traversal to obtain the first instruction compression package.
对于遍历得到的异步执行渲染指令(也可以叫做第一异步执行渲染指令集合),模拟器客户端可以对其进行压缩,以减小传输所需要的带宽。异步执行渲染指令不需要同步执行,也不需要等待返回值,所以可以进行压缩,得到第一指令压缩包。对于同步执行渲染指令,则可以不进行压缩来传输。For the asynchronously executed rendering instructions obtained by the traversal (also referred to as the first asynchronously executed rendering instruction set), the simulator client may compress them to reduce the bandwidth required for transmission. Asynchronous execution of the rendering instruction does not need to be executed synchronously, nor does it need to wait for the return value, so it can be compressed to obtain the first instruction compressed package. For the synchronous execution of rendering instructions, it may be transmitted without compression.
303:发送第一指令压缩包。303: Send the first command compressed package.
模拟器客户端可以把渲染指令发送给移动终端来处理。由于步骤301对异步执行渲染指令进行了压缩,可以满足传输管道的带宽要求。移动终端通过传输管道介绍该第一指令压缩 包。The emulator client can send rendering instructions to the mobile terminal for processing. Since step 301 compresses the asynchronously executed rendering instructions, the bandwidth requirement of the transmission pipeline can be met. The mobile terminal introduces the first command compressed package through the transmission pipe.
304:解压缩第一指令压缩包,执行解压缩得到的异步执行渲染指令。304: Decompress the first instruction compression package, and execute the asynchronous execution rendering instruction obtained by the decompression.
移动终端对收到的第一指令压缩包进行解压缩,得到需要渲染的异步执行渲染指令。这些渲染指令可以发送给GPU进行渲染,生成相应的渲染画面。The mobile terminal decompresses the received first instruction compression package, and obtains the asynchronous execution rendering instruction that needs to be rendered. These rendering instructions can be sent to the GPU for rendering, and corresponding rendering images are generated.
如图4所示,例如使用安卓模拟器运行游戏应用,模拟器客户端可以检测待发送的3条渲染指令——分别是A渲染指令,B渲染指令和C渲染指令,其中A渲染指令、B渲染指令是异步执行渲染指令,C渲染指令是同步执行渲染指令。As shown in Figure 4, for example, using an Android emulator to run a game application, the emulator client can detect three rendering instructions to be sent-A rendering instruction, B rendering instruction and C rendering instruction, where A rendering instruction, B The rendering instruction is to execute the rendering instruction asynchronously, and the C rendering instruction is to execute the rendering instruction synchronously.
模拟器客户端对上述待发送的3条渲染指令进行遍历,依次得到A渲染指令和B渲染指令这两条异步执行渲染指令,模拟器客户端可以暂时保存(比如存储在系统缓存中)、不立即发送给host端,而是对这两条异步执行渲染指令进行压缩,得到第一指令压缩包。然后,模拟器客户端将第一指令压缩包发送给host端解压缩,host端得到解压缩后的A渲染指令和B渲染指令。这两条渲染指令可以发送给GPU执行,得到渲染画面。对于C渲染指令,因为是同步执行渲染指令,需要同步执行且得到返回值,所以不能压缩到第一指令压缩包,而是单独发送给host端交给GPU执行。The simulator client traverses the above three rendering instructions to be sent, and obtains the two asynchronous rendering instructions of A rendering instruction and B rendering instruction in turn. The simulator client can temporarily save (such as stored in the system cache), and not Send it to the host immediately, but compress the two asynchronously executed rendering instructions to obtain the first instruction compression package. Then, the simulator client sends the first instruction compressed package to the host for decompression, and the host obtains the decompressed A rendering instruction and B rendering instruction. These two rendering instructions can be sent to the GPU for execution to obtain a rendered image. For the C rendering instruction, because the rendering instruction is executed synchronously, it needs to be executed synchronously and the return value is obtained, so it cannot be compressed into the first instruction compression package, but is sent to the host separately for execution by the GPU.
可选的,对于模拟器遍历到的渲染指令,可以提前检测渲染指令的类型并进行标记,例如对于返回值为void的渲染指令,可以标记为异步执行渲染指令;对于返回值为非void的渲染指令,可以标记为同步执行渲染指令。标记后对异步执行渲染指令(可压缩)和同步执行渲染指令(不可压缩)进行分类并存储。在下一次运行应用的时候,可以直接调用存储的已标记的渲染指令分类,而不需要再次检测,从而节约运行时间。可选的,除非重新安装模拟器,或者用户删除应用程序数据,才需要重新检测分类。Optionally, for the rendering instructions traversed by the simulator, the type of the rendering instruction can be detected and marked in advance. For example, for a rendering instruction with a return value of void, it can be marked as an asynchronous execution rendering instruction; for a rendering with a return value of non-void Instructions can be marked as synchronous execution of rendering instructions. After marking, classify and store the asynchronous execution rendering instructions (compressible) and synchronous execution rendering instructions (uncompressible). When the application is run next time, the stored marked rendering instruction classification can be directly called without re-checking, thereby saving running time. Optionally, unless the simulator is reinstalled or the user deletes the application data, the classification needs to be rechecked.
可选的,也可以使用指令函数符号表来提前检测渲染指令的类型并进行标记。指令函数符号表是一种预设的符号表,可以通过查表知道某条指令是同步执行渲染指令还是异步执行渲染指令。例如,对于以下渲染指令:syn-h-wb-4b-whnc-10y-whenrub-return(1),通过指令函数符号表查表可知这是一条同步执行指令。Optionally, the instruction function symbol table can also be used to detect and mark the type of rendering instruction in advance. The instruction function symbol table is a preset symbol table, and you can know whether a certain instruction executes the rendering instruction synchronously or asynchronously by looking up the table. For example, for the following rendering instruction: syn-h-wb-4b-whnc-10y-whenrub-return(1), looking up the instruction function symbol table shows that this is a synchronous execution instruction.
当然,由于压缩渲染指令也要消耗时间和CPU资源,所以还有一种模拟器处理渲染指令的方法,如图5所示,包括以下步骤:Of course, since compressing rendering instructions also consumes time and CPU resources, there is also a method for the simulator to process rendering instructions, as shown in Figure 5, which includes the following steps:
501:检测模拟器中当前运行的应用所需要的第一带宽;501: Detect the first bandwidth required by the application currently running in the simulator;
模拟器中当前运行的应用,可以是已经启动的应用,也可以是用户将要启动的应用。对于不同的应用(例如普通游戏和高清游戏),所需要的带宽是不一样的。可选的,由于某些应用可以在启动后选择不同的显示模式(例如普通和高清),可以在检测到显示模式后再检测需要的带宽。The currently running application in the simulator can be an already started application or an application that the user will start. For different applications (such as ordinary games and high-definition games), the required bandwidth is different. Optionally, since some applications can select different display modes (such as normal and high-definition) after starting, the required bandwidth can be detected after the display mode is detected.
502:判断第一带宽是否超过模拟器支持的最大带宽能力。502: Determine whether the first bandwidth exceeds the maximum bandwidth capability supported by the simulator.
不同的模拟器有不同的最大带宽能力。如果第一带宽没有超过模拟器支持的最大带宽能力,则不需要压缩渲染指令。Different simulators have different maximum bandwidth capabilities. If the first bandwidth does not exceed the maximum bandwidth capability supported by the simulator, there is no need to compress rendering instructions.
503:如果第一带宽超过模拟器支持的最大带宽能力,遍历待发送的渲染指令。503: If the first bandwidth exceeds the maximum bandwidth capability supported by the simulator, traverse the rendering instructions to be sent.
如果第一带宽超过模拟器支持的最大带宽能力,则需要压缩渲染指令,以满足传输管道的带宽要求,否则会出现画面卡顿、掉帧现象。If the first bandwidth exceeds the maximum bandwidth capability supported by the emulator, the rendering instructions need to be compressed to meet the bandwidth requirements of the transmission pipeline, otherwise the picture freezes and frame drops may occur.
504:将遍历得到的异步执行渲染指令进行压缩,得到第一指令压缩包。504: Compress the asynchronously executed rendering instructions obtained by the traversal to obtain a first instruction compression package.
505:发送第一指令压缩包。505: Send the first command compressed package.
506:解压缩第一指令压缩包,执行解压缩得到的异步执行渲染指令。506: Decompress the first instruction compression package, and execute the asynchronous execution rendering instruction obtained by the decompression.
通过图5的方法,可以提前对模拟器支持的最大带宽能力进行判断,如果最大带宽能力 支持当前应用,则不需要压缩渲染指令。With the method shown in Figure 5, the maximum bandwidth capability supported by the simulator can be judged in advance. If the maximum bandwidth capability supports the current application, there is no need to compress rendering instructions.
在实际运行过程中,模拟器可能要发送很多条渲染指令,这里面既有同步执行渲染指令,也有异步执行渲染指令。图6提供了另一种模拟器中处理渲染指令的方法,包括以下步骤:In the actual running process, the simulator may have to send a lot of rendering instructions, which include both synchronous execution of rendering instructions and asynchronous execution of rendering instructions. Figure 6 provides another method of processing rendering instructions in the simulator, including the following steps:
601:遍历待发送的渲染指令,所述待发送的渲染指令包括同步执行渲染指令和异步执行渲染指令。601: Traverse rendering instructions to be sent, where the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions.
602:如果遍历得到同步执行渲染指令,则暂停遍历,执行步骤606;如果遍历得到异步执行渲染指令,则继续遍历,当遇到同步执行指令时暂停遍历。602: If the traversal obtains the synchronous execution rendering instruction, pause the traversal and execute step 606; if the traverse obtains the asynchronous execution rendering instruction, continue the traversal, and pause the traversal when the synchronous execution instruction is encountered.
由于只能对异步执行渲染指令进行压缩,所以只要遍历得到同步执行渲染指令,就需要暂停遍历,先发送该同步执行渲染指令(步骤606)。如果遍历得到的是异步执行渲染指令,则暂不发送,而是继续遍历其余的异步执行渲染指令,直到遇到下一条同步执行渲染指令,然后,对于得到的这些异步执行渲染指令可以进行压缩后发送,随后发送同步执行渲染指令。Since only the asynchronously executed rendering instructions can be compressed, as long as the traversal obtains the synchronously executed rendering instructions, the traversal needs to be suspended, and the synchronously executed rendering instructions are sent first (step 606). If the traversal result is an asynchronous execution rendering instruction, it will not be sent temporarily. Instead, it will continue to traverse the remaining asynchronous execution rendering instructions until the next synchronous execution rendering instruction is encountered. Then, the asynchronous execution rendering instructions obtained can be compressed. Send, and then send the synchronous execution rendering command.
603:将步骤602遍历得到的异步执行渲染指令进行压缩,得到第一指令压缩包。603: Compress the asynchronously executed rendering instruction obtained by traversing in step 602 to obtain a first instruction compression package.
604:发送第一指令压缩包。604: Send the first command compressed package.
605:解压缩第一指令压缩包,执行解压缩得到的异步执行渲染指令。605: Decompress the first command compression package, and execute the asynchronous execution rendering command obtained by the decompression.
606:发送步骤602遍历得到的同步执行渲染指令,执行该同步执行渲染指令。606: Send the synchronous execution rendering instruction obtained by traversal in step 602, and execute the synchronous execution rendering instruction.
607:继续遍历待发送的渲染指令,重复执行步骤602-606.607: Continue to traverse the rendering instructions to be sent, and repeat steps 602-606.
通过图6的方法,可以应对存在多条渲染指令的场景,提高传输效率。Through the method of FIG. 6, it is possible to deal with a scene where there are multiple rendering instructions, and to improve transmission efficiency.
如图7所示,例如使用安卓模拟器运行游戏应用,模拟器客户端可以检测待发送的4条渲染指令——分别是A渲染指令,B渲染指令、C渲染指令和D渲染指令,其中A渲染指令、B渲染指令和D渲染指令是异步执行渲染指令,C渲染指令是同步执行渲染指令。As shown in Figure 7, for example, using the Android emulator to run a game application, the emulator client can detect the 4 rendering instructions to be sent-A rendering instruction, B rendering instruction, C rendering instruction and D rendering instruction, where A Rendering instructions, B rendering instructions, and D rendering instructions are rendering instructions that are executed asynchronously, and C rendering instructions are rendering instructions that are executed synchronously.
模拟器客户端对上述待发送的4条渲染指令进行遍历,依次得到A渲染指令和B渲染指令这两条异步执行渲染指令,模拟器客户端可以暂时保存、不立即发送给host端,而是继续遍历,然后遇到同步执行渲染指令——C渲染指令,则暂停遍历,对得到的两条异步执行渲染指令进行压缩,得到第一指令压缩包。然后,模拟器客户端将第一指令压缩包发送给host端解压缩,host端得到解压缩后的A渲染指令和B渲染指令。这两条渲染指令可以发送给GPU执行,得到渲染画面。对于C渲染指令,因为是同步执行渲染指令,需要同步执行且得到返回值,所以不能压缩到第一指令压缩包,而是单独发送给host端交给GPU执行。然后继续遍历其余的渲染指令,如D渲染指令,因为是异步执行渲染指令,就继续遍历直到遇到下一条同步执行渲染指令。。。重复上述步骤。The emulator client traverses the above 4 rendering instructions to be sent, and obtains two asynchronous rendering instructions A rendering instruction and B rendering instruction in turn. The emulator client can temporarily save it instead of sending it to the host immediately. Continue the traversal, and then encounter the synchronous execution rendering instruction-the C rendering instruction, then pause the traversal, compress the obtained two asynchronous execution rendering instructions, and obtain the first instruction compression package. Then, the simulator client sends the first instruction compressed package to the host for decompression, and the host obtains the decompressed A rendering instruction and B rendering instruction. These two rendering instructions can be sent to the GPU for execution to obtain a rendered image. For the C rendering instruction, because the rendering instruction is executed synchronously, it needs to be executed synchronously and the return value is obtained, so it cannot be compressed into the first instruction compression package, but is sent to the host separately for execution by the GPU. Then continue to traverse the rest of the rendering instructions, such as the D rendering instruction. Because the rendering instructions are executed asynchronously, the traversal continues until the next synchronous execution rendering instruction is encountered. . . Repeat the above steps.
下面介绍三个具体的场景:Here are three specific scenarios:
第一个场景是使用模拟器玩高清游戏(例如画面达到4K分辨率以上)。对于这个场景,用户在打开高清游戏(或者在游戏的设置里选择高清模式)后,模拟器guest端可以收到游戏启动事件的消息。guest端可以遍历当前待发送的渲染指令,根据函数符号表将当前的渲染指令分为同步执行渲染指令和异步执行渲染指令。对于异步执行渲染指令,可以暂时不发送,而是和遍历到的其他异步执行渲染指令一起进行压缩后发送给host端执行渲染处理。对于遍历到的同步执行渲染指令,可以单独发送。The first scene is to use the emulator to play high-definition games (for example, the screen reaches 4K resolution or higher). For this scenario, after the user opens the high-definition game (or selects the high-definition mode in the game settings), the emulator guest can receive the message of the game start event. The guest can traverse the rendering instructions currently to be sent, and divide the current rendering instructions into synchronous execution rendering instructions and asynchronous execution rendering instructions according to the function symbol table. For asynchronously executed rendering instructions, it may not be sent temporarily, but compressed together with other asynchronously executed rendering instructions that have been traversed, and then sent to the host for rendering processing. The traversed synchronous execution rendering instructions can be sent separately.
第二个场景是使用模拟器观看高清视频(例如画面达到4K分辨率以上)。用户在打开高清视频(或者在视频的播放设置里选择高清模式)后,模拟器guest端可以收到视频播放事件的消息。guest端可以遍历当前待发送的渲染指令,根据函数符号表将当前的渲染指令分为同步执行渲染指令和异步执行渲染指令。对于异步执行渲染指令,可以暂时不发送,而是和遍历到的其他异步执行渲染指令一起进行压缩后发送给host端执行渲染处理。对于遍历到的同 步执行渲染指令,可以单独发送。可选的,在开始播放之前,可以先把视频需要的带宽和模拟器支持的最大带宽能力做对比,如果超出模拟器支持的最大带宽能力,则需要对遍历得到的异步执行渲染指令进行压缩。The second scenario is to use the simulator to watch high-definition video (for example, the picture reaches a resolution of 4K or more). After the user opens the high-definition video (or selects the high-definition mode in the video playback settings), the emulator guest can receive the message of the video playback event. The guest can traverse the rendering instructions currently to be sent, and divide the current rendering instructions into synchronous execution rendering instructions and asynchronous execution rendering instructions according to the function symbol table. For asynchronously executed rendering instructions, it may not be sent temporarily, but compressed together with other asynchronously executed rendering instructions that have been traversed, and then sent to the host for rendering processing. The traversed synchronous execution rendering commands can be sent separately. Optionally, before starting to play, the bandwidth required by the video can be compared with the maximum bandwidth capability supported by the simulator. If the maximum bandwidth capability supported by the simulator is exceeded, the asynchronous execution rendering instructions obtained by the traversal need to be compressed.
第三个场景是使用模拟器办公的场景。用户在打开办公软件后,模拟器guest端可以收到开始办公事件的消息。guest端可以遍历当前待发送的渲染指令,根据函数符号表将当前的渲染指令分为同步执行渲染指令和异步执行渲染指令。对于异步执行渲染指令,可以暂时不发送,而是和遍历到的其他异步执行渲染指令一起进行压缩后发送给host端执行渲染处理。对于遍历到的同步执行渲染指令,可以单独发送。可选的,在开始办公之前,可以先把办公软件需要的带宽和模拟器支持的最大带宽能力做对比,如果超出模拟器支持的最大带宽能力,则需要对遍历得到的异步执行渲染指令进行压缩。The third scene is the office scene using the simulator. After the user opens the office software, the simulator guest can receive the message of the start of the office event. The guest can traverse the rendering instructions currently to be sent, and divide the current rendering instructions into synchronous execution rendering instructions and asynchronous execution rendering instructions according to the function symbol table. For asynchronously executed rendering instructions, it may not be sent temporarily, but compressed together with other asynchronously executed rendering instructions that have been traversed, and then sent to the host for rendering processing. The traversed synchronous execution rendering instructions can be sent separately. Optionally, before starting the office, you can compare the bandwidth required by the office software with the maximum bandwidth capability supported by the simulator. If the maximum bandwidth capability supported by the simulator is exceeded, the asynchronous execution rendering commands obtained from the traversal need to be compressed. .
本申请还提供一种移动终端,所述移动终端包括一个或多个处理器,存储器,一个或多个程序;其中,一个或多个程序被存储在存储器中并被配置为被一个或多个处理器执行,这一个或多个程序包括指令,该指令用于执行上述图3-图7所述的方法。This application also provides a mobile terminal. The mobile terminal includes one or more processors, a memory, and one or more programs; wherein, one or more programs are stored in the memory and configured to be configured by one or more The processor executes, and the one or more programs include instructions, and the instructions are used to execute the methods described in FIGS. 3-7.
本申请还提供一种存储介质,用于存储计算机软件指令,该指令用于执行上述图3-图7所述的方法。This application also provides a storage medium for storing computer software instructions, which are used to execute the methods described in FIGS. 3-7.
本申请还提供一种计算机程序产品,当运行所述计算机程序产品时,使得计算机执行上述图3-图7所述的方法。The present application also provides a computer program product, which, when the computer program product is run, causes the computer to execute the method described in FIGS. 3-7.
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can understand that for the convenience and conciseness of the description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functions as required. The function module is completed, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be divided. It can be combined or integrated into another device, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate parts may or may not be physically separate. The parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, and the software product is stored in a storage medium. It includes several instructions to make a device (may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉 本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above content is only the specific implementation of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Covered in the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (12)

  1. 一种在模拟器中处理渲染指令的方法,其特征在于,所述方法包括:A method for processing rendering instructions in a simulator, characterized in that the method includes:
    遍历待发送的渲染指令,所述待发送的渲染指令包括同步执行渲染指令和异步执行渲染指令;Traverse the rendering instructions to be sent, where the rendering instructions to be sent include synchronously executing rendering instructions and asynchronously executing rendering instructions;
    将遍历得到的所述异步执行渲染指令进行压缩,得到第一指令压缩包;Compressing the asynchronously executed rendering instructions obtained by the traversal to obtain a first instruction compression package;
    发送所述第一指令压缩包;Sending the first instruction compressed package;
    解压缩所述第一指令压缩包,执行解压缩得到的所述异步执行渲染指令。Decompress the first instruction compression package, and execute the asynchronous execution rendering instruction obtained by the decompression.
  2. 根据权利要求1所述的方法,其特征在于,所述遍历待发送的渲染指令,包括:The method according to claim 1, wherein the traversing the rendering instructions to be sent comprises:
    按照待发送的顺序逐一检测所述待发送的渲染指令。The rendering instructions to be sent are detected one by one according to the order to be sent.
  3. 根据权利要求1所述的方法,其特征在于,所述执行解压缩得到的所述异步执行渲染指令,包括:The method according to claim 1, wherein the asynchronously executing rendering instruction obtained by executing the decompression comprises:
    将所述异步执行渲染指令发送给GPU,由所述GPU生成渲染画面。The asynchronous execution rendering instruction is sent to the GPU, and the GPU generates a rendering image.
  4. 根据权利要求1-3所述的方法,其特征在于,所述方法还包括:The method according to claims 1-3, wherein the method further comprises:
    发送遍历得到的所述同步执行渲染指令。The synchronous execution rendering instruction obtained by the traversal is sent.
  5. 根据权利要求1-4所述的方法,其特征在于,在所述遍历待发送的渲染指令之前,所述方法还包括:The method according to claims 1-4, characterized in that, before the traversing the rendering instructions to be sent, the method further comprises:
    检测渲染指令的类型并进行标记。Detect and mark the type of rendering instruction.
  6. 根据权利要求5所述的方法,其特征在于,所述检测渲染指令的类型,包括:The method according to claim 5, wherein said detecting the type of rendering instruction comprises:
    对于返回值为void的渲染指令,标记为异步执行渲染指令;对于返回值为非void的渲染指令,标记为同步执行渲染指令。Rendering instructions with a return value of void are marked as asynchronously executed rendering instructions; for rendering instructions with a return value of non-void, they are marked as synchronously executed rendering instructions.
  7. 根据权利要求5所述的方法,其特征在于,所述检测渲染指令的类型,包括:The method according to claim 5, wherein said detecting the type of rendering instruction comprises:
    使用指令函数符号表来检测所述渲染指令的类型。The instruction function symbol table is used to detect the type of the rendering instruction.
  8. 根据权利要求1-7所述的方法,其特征在于,在所述遍历待发送的渲染指令之前,所述方法还包括:7. The method according to claims 1-7, characterized in that, before the traversing the rendering instructions to be sent, the method further comprises:
    检测所述模拟器中当前运行的应用所需要的第一带宽;Detecting the first bandwidth required by the application currently running in the simulator;
    判断所述第一带宽是否超过所述模拟器支持的最大带宽能力。It is determined whether the first bandwidth exceeds the maximum bandwidth capability supported by the simulator.
  9. 根据权利要求1-8所述的方法,其特征在于:所述遍历待发送的渲染指令,包括:8. The method according to claims 1-8, wherein the traversing the rendering instructions to be sent comprises:
    如果遍历得到同步执行渲染指令,则暂停遍历并发送所述同步执行渲染指令;If the traversal obtains the synchronous execution rendering instruction, pause the traversal and send the synchronous execution rendering instruction;
    如果遍历得到异步执行渲染指令,则继续遍历,直到遇到同步执行指令时暂停遍历。If the traversal obtains the asynchronous execution rendering instruction, the traversal continues until the traversal is suspended when the synchronous execution instruction is encountered.
  10. 一种移动终端,所述移动终端包括一个或多个处理器,存储器,一个或多个程序;其中,所述一个或多个程序被存储在所处存储器中并被配置为被所述一个或多个处理器执行,所述一个或多个程序包括指令,所述指令用于执行如权利要求1-9所述的方法。A mobile terminal includes one or more processors, a memory, and one or more programs; wherein the one or more programs are stored in the memory and configured to be used by the one or more Executed by multiple processors, the one or more programs include instructions for executing the method according to claims 1-9.
  11. 一种存储介质,用于存储计算机软件指令,所述计算机软件指令用于执行如权利要求1-9所述的方法。A storage medium for storing computer software instructions, and the computer software instructions are used to execute the method according to claims 1-9.
  12. 一种计算机程序产品,当运行所述计算机程序产品时,使得计算机执行如权利要求1-9所述的方法。A computer program product, when running the computer program product, causes a computer to execute the method according to claims 1-9.
PCT/CN2020/122528 2019-10-23 2020-10-21 Method for processing rendering instruction in simulator and mobile terminal WO2021078161A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911012928.0 2019-10-23
CN201911012928.0A CN110968395B (en) 2019-10-23 2019-10-23 Method for processing rendering instruction in simulator and mobile terminal

Publications (1)

Publication Number Publication Date
WO2021078161A1 true WO2021078161A1 (en) 2021-04-29

Family

ID=70029840

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/122528 WO2021078161A1 (en) 2019-10-23 2020-10-21 Method for processing rendering instruction in simulator and mobile terminal

Country Status (2)

Country Link
CN (1) CN110968395B (en)
WO (1) WO2021078161A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110968395B (en) * 2019-10-23 2024-02-09 华为技术有限公司 Method for processing rendering instruction in simulator and mobile terminal
CN112214370A (en) * 2020-10-28 2021-01-12 京东数字科技控股股份有限公司 Debugging equipment and method for large-screen terminal
CN114035967A (en) * 2022-01-10 2022-02-11 北京蔚领时代科技有限公司 Resource sharing rendering method and device based on server
CN114025238B (en) * 2022-01-10 2022-04-05 北京蔚领时代科技有限公司 Native android application cloud virtualization method based on Linux server

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104142852A (en) * 2014-08-04 2014-11-12 福州靠谱网络有限公司 Method for achieving graph acceleration of android simulator on computer
CN104156213A (en) * 2014-08-12 2014-11-19 百度在线网络技术(北京)有限公司 Android application running method and device
US20150082298A1 (en) * 2013-09-19 2015-03-19 Qiu Shi WANG Packaging and deploying hybrid applications
CN107741863A (en) * 2017-10-08 2018-02-27 深圳市星策网络科技有限公司 The driving method and device of a kind of video card
CN110968395A (en) * 2019-10-23 2020-04-07 华为技术有限公司 Method for processing rendering instruction in simulator and mobile terminal

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101526915B (en) * 2009-04-28 2011-09-07 中国人民解放军国防科学技术大学 Method for supporting parallel input and output (I/O) of trace files in parallel simulation
CN104679486B (en) * 2013-11-28 2019-05-28 华为技术有限公司 A kind of processing method of graph data, apparatus and system
CN105224390B (en) * 2015-09-22 2019-11-22 宁夏大学 A kind of method of virtual desktop compression

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150082298A1 (en) * 2013-09-19 2015-03-19 Qiu Shi WANG Packaging and deploying hybrid applications
CN104142852A (en) * 2014-08-04 2014-11-12 福州靠谱网络有限公司 Method for achieving graph acceleration of android simulator on computer
CN104156213A (en) * 2014-08-12 2014-11-19 百度在线网络技术(北京)有限公司 Android application running method and device
CN107741863A (en) * 2017-10-08 2018-02-27 深圳市星策网络科技有限公司 The driving method and device of a kind of video card
CN110968395A (en) * 2019-10-23 2020-04-07 华为技术有限公司 Method for processing rendering instruction in simulator and mobile terminal

Also Published As

Publication number Publication date
CN110968395B (en) 2024-02-09
CN110968395A (en) 2020-04-07

Similar Documents

Publication Publication Date Title
WO2021078161A1 (en) Method for processing rendering instruction in simulator and mobile terminal
US11829787B2 (en) Multi-process model for cross-platform applications
US9047102B2 (en) Instant remote rendering
US8957905B2 (en) Cross-environment user interface mirroring
US8819705B2 (en) User interaction support across cross-environment applications
US8675000B2 (en) Command buffers for web-based graphics rendering
US8933949B2 (en) User interaction across cross-environment applications through an extended graphics context
US20140365861A1 (en) Prefetching binary data for use by a browser plugin
CN112035172A (en) Operating system starting method, device, server and storage medium
US20240004831A1 (en) Method and apparatus for media scene description
WO2023005459A1 (en) Exception handling method and apparatus, computer device, and storage medium
WO2022150080A1 (en) Method and apparatus for media scene description

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20878198

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20878198

Country of ref document: EP

Kind code of ref document: A1