Texture data uploading method, vehicle machine and storage medium

By converting multiple physical addresses into address mapping files and obtaining continuous virtual addresses in the embedded platform hypervisor technology, the problem of low texture data upload efficiency in the virtio-gpu semi-virtualization solution is solved, and efficient texture data upload is achieved.

CN119988247APending Publication Date: 2025-05-13ZEBRED NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411999682.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Under the hypervisor technology of embedded platforms, in the virtio-gpu paravirtualization solution, texture data upload efficiency is low, mainly due to the need to temporarily create buffers and copy discrete physical addresses, resulting in large CPU copy overhead.

Method used

By sending multiple physical addresses to the DMA-BUF module in the system core of the host operating system, the DMA-BUF module is used to convert multiple physical addresses into address mapping files. The host operating system obtains continuous virtual addresses mapped with multiple physical addresses based on the file handle of the address mapping file, and uploads texture data to the video memory space of the physical GPU.

Benefits of technology

The discrete physical memory address of GuestVM is converted into a continuous virtual address recognized by the host operating system, avoiding the copy of each physical address, reducing the CPU copying action, thereby improving the efficiency of texture data upload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988247A_ABST
    Figure CN119988247A_ABST
Patent Text Reader

Abstract

The invention discloses a texture data uploading method, a vehicle machine and a storage medium, a visitor operation system and a host operation system run on the vehicle machine based on a virtual machine manager, and the texture data uploading method comprises the steps that the visitor operation system uploads texture data to a first video memory space distributed for the visitor operation system; the visitor operating system sends a plurality of physical addresses corresponding to the first video memory space to the host operating system; a DMA-BUF module in a system kernel of the host operating system converts the plurality of physical addresses into address mapping files; and the host operating system obtains a continuous virtual address mapped with the plurality of physical addresses according to a file handle of the address mapping file, and uploads the texture data in the first video memory space to a second video memory space allocated for the physical GPU according to the continuous virtual address, so that the texture data can be used for rendering operation of the physical GPU. Through the method, the technical problem of relatively low texture data uploading efficiency is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automobile intelligent cockpits, and in particular to a texture data uploading method, a vehicle computer and a storage medium. Background Art

[0002] With the development of the automotive and chip industries, the computing power of a single SOC (System on Chip) is getting stronger and stronger. There are more and more physical screens in cars, and cars are gradually upgrading to safety, comfort, and entertainment. For these reasons, hypervisor technology has become an indispensable software foundation for smart cockpits.

[0003] Under the hypervisor technology of embedded platforms, the virtio-gpu semi-virtualization solution is the current mainstream GPU (Graphic Processing Unit) semi-virtualization technology. The large memory requested by the front-end driver of virtio-gpu is not necessarily a continuous physical address, but may be a large memory composed of a bunch of discrete physical addresses. After this pile of discrete physical addresses is shared with the HostVM (host operating system), the back-end service of virtio-gpu needs to temporarily create a buffer, and then copy these discrete physical addresses one by one to the temporarily created buffer, and then use the virtual addresses in this buffer to upload to the physical GPU. The overhead caused by these copies is very huge, resulting in low efficiency in uploading texture data. Summary of the invention

[0004] The embodiments of the present specification provide a texture data uploading method, a vehicle computer and a storage medium, which are used to solve the technical problem of low texture data uploading efficiency to at least a certain extent.

[0005] In a first aspect of the present specification, a texture data uploading method is provided, which is applied to a vehicle computer, wherein a guest operating system and a host operating system are running on the vehicle computer based on a virtual machine manager, and the method comprises: the guest operating system uploading texture data to a first video memory space allocated for the guest operating system; the guest operating system sends a plurality of physical addresses corresponding to the first video memory space to the host operating system; a DMA-BUF module in a system kernel of the host operating system converts the plurality of physical addresses into an address mapping file; the host operating system obtains continuous virtual addresses mapped to the plurality of physical addresses according to a file handle of the address mapping file, and uploads the texture data in the first video memory space to a second video memory space allocated for a physical GPU according to the continuous virtual addresses, for use by the physical GPU rendering operation.

[0006] In combination with the first aspect, in some embodiments, a front-end driver module of a GPU paravirtualization architecture runs in the guest operating system, and a back-end service module of a GPU paravirtualization architecture runs in the host operating system.

[0007] In combination with the first aspect, in some embodiments, before the guest operating system uploads texture data to the first video memory space allocated for the guest operating system, it also includes: the front-end driver module applies for the first video memory space from the system kernel of the host operating system, wherein the first video memory space includes multiple memory areas corresponding to the multiple physical addresses, and the multiple physical addresses are discrete.

[0008] In combination with the first aspect, in some embodiments, the guest operating system sends multiple physical addresses corresponding to the first video memory space to the host operating system, including: the front-end driver module initiates a texture upload request and the multiple physical addresses to the back-end service module.

[0009] In combination with the first aspect, in some embodiments, after the guest operating system uploads texture data to the first video memory space allocated for the guest operating system, it also includes: the back-end service module sends the multiple physical addresses to the DMA-BUF module in response to the texture upload request.

[0010] In combination with the first aspect, in some embodiments, the texture data uploading method further includes: the DMA-BUF module obtains the file handle of the address mapping file; the DMA-BUF module passes the file handle of the address mapping file to the backend service module.

[0011] In combination with the first aspect, in some embodiments, the DMA-BUF module converts the multiple physical addresses into an address mapping file, including: the DMA-BUF module maps the multiple physical addresses to a continuous virtual address to obtain the address mapping file.

[0012] In combination with the first aspect, in some embodiments, the host operating system obtains the continuous virtual addresses mapped to the multiple physical addresses according to the file handle of the address mapping file, including: the back-end service module calls a first target function to access the address mapping file based on the file handle, and obtains the continuous virtual addresses from the address mapping file; wherein, the first target function is a function that maps the file content of the address mapping file to the address space of the process.

[0013] In combination with the first aspect, in some embodiments, uploading the texture data in the first video memory space to the second video memory space allocated for the physical GPU according to the continuous virtual address includes: the backend service module calling a second target function in the open graphics library to upload the texture data to the second video memory space allocated for the physical GPU according to the continuous virtual address;

[0014] The second objective function is a function for allocating video memory for the texture data and uploading the texture data.

[0015] In the second aspect of the present specification, a vehicle computer is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the texture data uploading method described in any embodiment of the first aspect is implemented.

[0016] In a third aspect of the present specification, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, the texture data uploading method described in any embodiment of the first aspect is implemented.

[0017] One or more technical solutions provided by the embodiments of this specification have at least the following technical effects or advantages:

[0018] By sending multiple physical addresses to the DMA-BUF module in the system kernel of the host operating system, the DMA-BUF module is used to convert the multiple physical addresses into an address mapping file; the host operating system obtains the continuous virtual addresses mapped to the multiple physical addresses according to the file handle of the address mapping file, and uploads the texture data in the first video memory space to the second video memory space allocated to the physical GPU according to the continuous virtual addresses. Thus, the discrete physical memory addresses corresponding to the first video memory space applied by the GuestVM are converted into continuous virtual addresses that can be directly recognized by the host operating system, so that the host operating system can use the continuous virtual addresses to directly upload the texture content of the GuestVM to the real video memory of the physical GPU, which is convenient for the physical GPU to perform rendering operations, and there is no need to copy each physical address one by one, thus avoiding a large number of CPU copy actions. Therefore, the efficiency of texture data upload can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present specification. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0020] Figure 1A system architecture diagram of a texture data uploading method according to an embodiment of this specification is shown;

[0021] Figure 2 A flowchart of a texture data uploading method provided in an embodiment of this specification is shown;

[0022] Figure 3 The structure diagram of the vehicle computer in the embodiment of this specification is shown. DETAILED DESCRIPTION

[0023] In order to better understand the above technical scheme, the technical scheme of the embodiments of this specification is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of this specification and the specific features in the embodiments are detailed descriptions of the technical scheme of the embodiments of this specification, rather than limitations on the technical scheme of this specification. In the absence of conflict, the embodiments of this specification and the technical features in the embodiments can be combined with each other.

[0024] A texture data uploading method provided in an embodiment of the present specification is applied to a vehicle computer. Figure 1 The system architecture diagram of the texture data uploading method in the embodiment of this specification is shown. Figure 1 As shown, the vehicle computer 10 runs a guest operating system (GuestVM) 110 and a host operating system (HostVM) 120 based on a hypervisor (VirtualMachine Monitor) 130. Hypervisor is an intermediate layer operating system running between physical hardware and the operating system. The operating system running on the Hypervisor is called a VM (Virtual Machine). The guest operating system (GuestVM) 110 and the host operating system (HostVM) 120 can use one of Linux, Alios, and Android. A front-end driver module of a GPU semi-virtualization architecture runs in the guest operating system 110, and a back-end service module of a GPU semi-virtualization architecture runs in the host operating system 120. It can be understood that the GPU semi-virtualization architecture can be a virtio-gpu architecture, wherein the virtio-gpu architecture is a GPU semi-virtualization architecture developed based on the virtio protocol.

[0025] Figure 2 FIG. 1 shows a flowchart of a texture data uploading method provided in an embodiment of this specification. Figure 2 As shown, the texture data uploading method provided in the embodiment of this specification includes the following steps S101 to S104.

[0026] In step S101 : the guest operating system uploads texture data to the first video memory space allocated for the guest operating system.

[0027] In some embodiments, during a texture data upload operation, an application (APP) or a graphics library in the guest operating system first uploads the texture data that needs to be uploaded to the physical GPU to a first video memory space created by a front-end driver module running on the guest operating system.

[0028] In some embodiments, the front-end driver module can upload the texture data of the application or the graphics library to the first video memory space through the API (Application Programming Interface) interface of OpenGL (Open Graphics Library). Specifically, the front-end driver module can call the second target function of OpenGL to upload the texture data of the application or the graphics library to the first video memory space, wherein the second target function is a function for allocating video memory for texture data and uploading texture data, such as: glTexImage2D function or other functions with similar functions.

[0029] In some embodiments, the front-end driver module applies for a first video memory space from the system kernel of the host operating system, and the first video memory space applied for by the front-end driver module includes multiple memory areas corresponding to multiple discrete physical addresses. In other words: one memory area corresponds to a continuous physical address, and the physical addresses of different memory areas are scattered and discontinuous. The first video memory space belongs to a large memory, which is applied for from the system kernel of the host operating system by the front-end driver module through calling the vmalloc function or other functions with similar functions and through the TTM (Tiled Memory Allocator) memory management mechanism or the GEM (Graphics ExecutionManager) memory management mechanism. The multiple physical addresses corresponding to the applied first video memory space are often discontinuous, wherein the vmalloc function is used for dynamic memory allocation.

[0030] In step S102: the guest operating system sends a plurality of physical addresses corresponding to the first video memory space to the host operating system.

[0031] It is understandable that the front-end driver module of the guest operating system initiates a texture upload request and each physical address corresponding to the first video memory space to the back-end service module of the host operating system, and each physical address includes the following address information: starting position, ending position and address size, etc.

[0032] In step S103: the DMA-BUF module in the system kernel of the host operating system converts the multiple physical addresses into an address mapping file.

[0033] In some embodiments, after the back-end service module of the host operating system receives the texture upload request from the front-end driver module, in response to the texture upload request, each physical address corresponding to the first video memory space is sent to the DMA-BUF (Direct Memory Access buffer) module in the system kernel of the host operating system. It should be noted that the DMA-BUF module is a module for sharing buffers in the system kernel of the host operating system. The DMA-BUF module is used to solve the problem of shared buffers between the CPU and various peripheral drivers. The DMA-BUF module can be part of a GPU semi-virtualization architecture developed based on the virtio protocol.

[0034] In some embodiments, the backend service module may call the third target function and send it to the DMA-BUF (Direct Memory Access buffer) module. The third target function may be a function for implementing communication between the user space program and the device driver of the kernel space, such as an ioctl function or other functions with similar functions.

[0035] In some embodiments, the DMA-BUF module running in the system kernel of the host operating system converts the above-mentioned multiple physical addresses corresponding to the first video memory space into an address mapping file, and obtains the file handle of the address mapping file (English abbreviation: fd, English full name: File Descriptor, also called file descriptor), which points to the address mapping file. The file handle of the address mapping file is passed to the back-end service module so that the back-end service module can access the address mapping file according to the file handle of the address mapping file.

[0036] It can be understood that the DMA-BUF module converts the above-mentioned multiple physical addresses corresponding to the first video memory space into an address mapping file, including: the DMA-BUF module splices the above-mentioned multiple physical addresses corresponding to the first video memory space to map the above-mentioned multiple physical addresses to a continuous virtual address, thereby obtaining a DMA-BUF file, that is, obtaining an address mapping file.

[0037] In step S104: the host operating system obtains continuous virtual addresses mapped to multiple physical addresses according to the file handle of the address mapping file, and uploads the texture data in the first video memory space to the second video memory space allocated to the physical GPU according to the continuous virtual addresses for use by the physical GPU rendering operation.

[0038] In some embodiments, the backend service module receives a file handle and accesses the address mapping file through the first target function and the file handle to obtain continuous virtual addresses associated with the above-mentioned multiple physical addresses from the address mapping file.

[0039] Specifically, the backend service module calls the first target function based on the file handle of the address mapping file to access the address mapping file and obtains the continuous virtual addresses corresponding to the above multiple physical addresses from the address mapping file, wherein the file handle is used when calling the first target function.

[0040] It is understandable that the first target function is a function used to map the file content of the address mapping file to the address space of the process. For example, the first target function can be an mmap function or other functions with similar functions. It should be noted that the parameters of the mmap function include the starting address, length, protection mode, mapping flag, file handle and file offset of the mapping area (that is, the DMA-BUF file). After the mmap function is successfully called, a pointer to the mapping area is returned. The user space program can directly access the file content in the DMA-BUF file through this pointer, thereby obtaining continuous virtual addresses related to the above-mentioned multiple physical addresses.

[0041] In some embodiments, the backend service module of the host operating system calls the second target function in the OpenGL to upload the texture data in the first video memory space to the second video memory space allocated for the physical GPU according to the continuous virtual address. It can be understood that the second video memory space is the real video memory requested by the GPU driver of the physical GPU.

[0042] It can be understood that the second target function is a function for allocating video memory for texture data and uploading texture data, and may adopt the glTexImage2D function or other functions with similar functions.

[0043] It is understandable that the backend service module includes the Libvirglrenderer submodule, and the backend service module passes the continuous virtual address to the Libvirglrenderer submodule, which calls the second target function in the open graphics library and directly uploads the texture data uploaded by the guest operating system to the first video memory space to the second video memory space corresponding to the physical GPU with the continuous virtual address. It should be noted that the Libvirglrenderer submodule is an open source library that is responsible for parsing the instructions sent from the guest operating system and converting them into instructions for the host operating system to operate the physical GPU.

[0044] It is understandable that after the backend service module of the host operating system completes uploading the texture data, it needs to return a status message indicating that the texture data has been uploaded to the front-end driver module running on the guest operating system, thereby completing a complete upload operation, facilitating the guest operating system to perform the next rendering operation.

[0045] Based on the same inventive concept, an embodiment of this specification also provides a vehicle computer. Figure 3 The schematic diagram of the structure of the vehicle computer in the embodiment of this specification is shown. Figure 3 As shown, the vehicle computer includes a memory 304, a processor 302, and a computer program stored in the memory 304 and executable on the processor 302. When the processor 302 executes the computer program, the texture data uploading method of any of the above embodiments is implemented.

[0046] Among them, Figure 3 In the embodiment of the present invention, a bus architecture (represented by bus 300) is shown, which may include any number of interconnected buses and bridges, and bus 300 connects various circuits including one or more processors represented by processor 302 and memory represented by memory 304. Bus 300 may also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are not further described herein. Bus interface 305 provides an interface between bus 300 and receiver 301 and transmitter 303. Receiver 301 and transmitter 303 may be the same element, namely a transceiver, providing a unit for communicating with various other devices over a transmission medium. Processor 302 is responsible for managing bus 300 and general processing, while memory 304 may be used to store data used by processor 302 when performing operations.

[0047] Based on the same inventive concept, an embodiment of this specification further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the texture data uploading method described in any of the above embodiments is implemented.

[0048] By sending multiple physical addresses to the DMA-BUF module in the system kernel of the host operating system, the DMA-BUF module is used to convert the multiple physical addresses into an address mapping file; the host operating system obtains the continuous virtual addresses mapped to the multiple physical addresses according to the file handle of the address mapping file, and uploads the texture data in the first video memory space to the second video memory space allocated to the physical GPU according to the continuous virtual addresses. Thus, the discrete physical memory addresses corresponding to the first video memory space applied by the GuestVM are converted into continuous virtual addresses that can be directly recognized by the host operating system, so that the host operating system can use the continuous virtual addresses to directly upload the texture content of the GuestVM to the real video memory of the physical GPU, which is convenient for the physical GPU to perform rendering operations, and there is no need to copy each physical address one by one, thus avoiding a large number of CPU copy actions. Therefore, the efficiency of texture data upload can be improved.

[0049] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that has the functions specified in one or more boxes.

[0050] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0051] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0052] Although the preferred embodiments of this specification have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of this specification.

[0053] Obviously, those skilled in the art can make various changes and modifications to this specification without departing from the spirit and scope of this specification. Thus, if these modifications and variations of this specification fall within the scope of the claims of this specification and their equivalents, this specification is also intended to include these modifications and variations.

Claims

1. A texture data uploading method, characterized in that: Applied to a vehicle computer, in which a guest operating system and a host operating system are running based on a virtual machine manager, the method includes: The guest operating system uploads the texture data to a first video memory space allocated for the guest operating system; The guest operating system sends a plurality of physical addresses corresponding to the first video memory space to the host operating system; The DMA-BUF module in the system kernel of the host operating system converts the multiple physical addresses into an address mapping file; The host operating system obtains continuous virtual addresses mapped to the multiple physical addresses according to the file handle of the address mapping file, and uploads the texture data in the first video memory space to the second video memory space allocated to the physical GPU according to the continuous virtual addresses for use by the physical GPU rendering operation.

2. The texture data uploading method according to claim 1, characterized in that: A front-end driver module of a GPU paravirtualization architecture runs in the guest operating system, and a back-end service module of a GPU paravirtualization architecture runs in the host operating system.

3. The texture data uploading method according to claim 2, characterized in that: Before the guest operating system uploads the texture data to the first video memory space allocated for the guest operating system, the method further includes: The front-end driver module applies for the first video memory space from the system kernel of the host operating system, wherein the first video memory space includes a plurality of memory areas corresponding to the plurality of physical addresses, and the plurality of physical addresses are discrete.

4. The texture data uploading method according to claim 2, characterized in that: The guest operating system sends a plurality of physical addresses corresponding to the first video memory space to the host operating system, including: The front-end driving module initiates a texture upload request and the multiple physical addresses to the back-end service module.

5. The texture data uploading method according to claim 4, characterized in that: After the guest operating system uploads the texture data to the first video memory space allocated for the guest operating system, the method further includes: The backend service module sends the multiple physical addresses to the DMA-BUF module in response to the texture upload request.

6. The texture data uploading method according to claim 5, characterized in that: Also includes: The DMA-BUF module obtains the file handle of the address mapping file; The DMA-BUF module transfers the file handle of the address mapping file to the backend service module.

7. The method of claim 2, wherein the DMA-BUF module converts the plurality of physical addresses into an address mapping file, comprising: The DMA-BUF module maps the multiple physical addresses to a segment of continuous virtual addresses to obtain the address mapping file.

8. The texture data uploading method according to claim 2, characterized in that: The host operating system obtains the continuous virtual addresses mapped to the multiple physical addresses according to the file handle of the address mapping file, including: The backend service module calls a first target function to access the address mapping file based on the file handle, and obtains the continuous virtual address from the address mapping file; The first target function is a function for mapping the file content of the address mapping file to the address space of the process.

9. The texture data uploading method according to claim 2, characterized in that: The uploading, according to the continuous virtual addresses, the texture data in the first video memory space to the second video memory space allocated to the physical GPU comprises: The backend service module calls a second target function in the open graphics library to upload the texture data to a second video memory space allocated to the physical GPU according to the continuous virtual address; The second objective function is a function for allocating video memory for the texture data and uploading the texture data.

10. A vehicle computer, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the texture data uploading method according to any one of claims 1 to 9 is implemented.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the texture data uploading method described in any one of claims 1 to 9 is implemented.