Processing method, related device, electronic device and computer-readable storage medium
By coordinating the user interface thread and the asynchronous thread, preloading and caching resource processing solves the problem of time-consuming data reading when updating the display interface of single-core wearable devices and improves the display frame rate.
Patent Information
- Application Number
- CN202410089302.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-22
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2044-01-22
AI Technical Summary
When a single-core wearable device based on a real-time operating system updates the display interface, the user interface thread takes a long time to read data from image and font resource files, resulting in a drop in the display frame rate.
The user interface thread and asynchronous thread work together. The asynchronous thread preloads resources and saves them to the cache when the user interface thread is idle. The user interface thread reads and renders resources from the cache when needed.
This reduces the time it takes for the user interface thread to read data and improves the display frame rate of electronic devices.
Smart Images

Figure CN119248430B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic devices, and in particular to a processing method, related devices, electronic devices, and computer-readable storage media. Background Art
[0002] Single-core wearable devices such as watches and bracelets based on real-time operating systems (RTOS) have only one central processing unit (CPU), and only one thread is scheduled at the same time.
[0003] When receiving a message to update the display interface content, the User Interface (UI) thread reads image data and font data from the image resource file and font resource file into the cache. This process takes a long time. As a result, the entire process of reading files, loading images and text, and calling the graphics processing unit (GPU) for rendering also takes a long time, affecting the display frame rate of the electronic device. Summary of the Invention
[0004] The present application provides a processing method, related devices, electronic devices and computer-readable storage media, which can reduce the time it takes for a UI thread to read data, thereby improving the display frame rate of the electronic device.
[0005] In a first aspect, the present application provides a processing method for an electronic device using a real-time operating system, wherein after the electronic device is powered on, a user interface thread and an asynchronous thread are running, and the user interface thread has a higher priority than the asynchronous thread; the electronic device includes a display screen; the method comprises:
[0006] The user interface thread obtains a first message, where the first message is used to trigger the display screen to update display content, where the content to be displayed corresponds to multiple frames;
[0007] triggering the user interface thread to respond to the first message and determine an identifier of a resource that needs to be preloaded;
[0008] Triggering the user interface thread to send a second message to the asynchronous thread, where the second message carries the identifier;
[0009] When the user interface thread is idle, triggering the asynchronous thread to read the preloaded resources from the relevant file according to the identifier, and saving the read preloaded resources into the first cache;
[0010] When the first cache includes resources of the frame to be displayed, triggering the user interface thread to read the resources corresponding to the frame to be displayed in the first cache;
[0011] The graphics processor is triggered to render the resource corresponding to the to-be-displayed frame read from the first cache to obtain the to-be-displayed frame.
[0012] When the technical solution provided by this embodiment is adopted, the user interface thread sends the identifier of the resources that need to be preloaded to the asynchronous thread. When the user interface thread is idle, the asynchronous thread reads the preloaded resources from the relevant files and saves the read preloaded resources to the first cache. When the first cache includes resources of the frame to be displayed, the interface thread reads the resources corresponding to the frame to be displayed in the first cache. The graphics processor renders the resources corresponding to the frame to be displayed read from the first cache to obtain the frame to be displayed. This application uses the asynchronous thread to save the resources of the frame to be displayed to the first cache, which can avoid the user interface thread directly reading the relevant resources from the file corresponding to the frame to be displayed. Since the asynchronous thread performs the relevant operations when the graphical user interface thread is idle, the adoption of this solution can reduce the time it takes for the graphical user interface thread to read data, which is beneficial to improving the display frame rate of the electronic device.
[0013] In some possible implementations, the user interface thread is idle, including when the graphics processor renders resources corresponding to the to-be-displayed frame read from the first cache.
[0014] In some possible implementations, after obtaining the frame to be displayed, the method further includes:
[0015] Saving the frame to be displayed in a second buffer;
[0016] The frame to be displayed is read from the second buffer, and the frame to be displayed is displayed on the display screen.
[0017] In some possible implementations, the resources that need to be preloaded include: picture resources and character resources.
[0018] In some possible implementations, the identifier of the resource that needs to be preloaded includes: an identification code of a picture corresponding to the picture resource, and an identification code of a character corresponding to the character resource.
[0019] In some possible implementations, the first cache includes: a third cache and a fourth cache, the third cache is used to store picture information corresponding to the identification code of the picture; the fourth cache is used to store character information corresponding to the identification code of the character.
[0020] In some possible implementations, the method further includes:
[0021] When the first cache does not include the resource of the frame to be displayed, the user interface thread is triggered to read the resource of the frame to be displayed from the relevant file into the first cache.
[0022] In a second aspect, the present application provides a processing device for an electronic device using a real-time operating system, wherein the electronic device runs a user interface thread and an asynchronous thread after startup, and the user interface thread has a higher priority than the asynchronous thread; the electronic device includes a display screen; and the device includes:
[0023] an acquiring unit, configured to acquire a first message through the user interface thread, wherein the first message is used to trigger the display screen to update display content, and the content to be displayed corresponds to multiple frames;
[0024] a determining unit, configured to trigger the user interface thread to respond to the first message and determine an identifier of a resource that needs to be preloaded;
[0025] a sending unit, configured to trigger the user interface thread to send a second message to the asynchronous thread, where the second message carries the identifier;
[0026] a processing unit, configured to trigger the asynchronous thread to read the preloaded resources from the relevant file according to the identifier and save the read preloaded resources into the first cache when the user interface thread is idle;
[0027] a reading unit, configured to trigger the user interface thread to read the resource corresponding to the frame to be displayed in the first cache when the resource of the frame to be displayed is included in the first cache;
[0028] The rendering unit is configured to trigger a graphics processor to render resources corresponding to the to-be-displayed frame read from the first cache, to obtain the to-be-displayed frame.
[0029] In some possible implementations, the user interface thread is idle, including when the graphics processor renders resources corresponding to the to-be-displayed frame read from the first cache.
[0030] In some possible implementations, the processing unit is further configured to, after the rendering unit obtains the frame to be displayed, save the frame to be displayed into a second cache, and read the frame to be displayed from the second cache, and display the frame to be displayed through the display screen.
[0031] In some possible implementations, the resources that need to be preloaded include: picture resources and character resources.
[0032] In some possible implementations, the identifier of the resource that needs to be preloaded includes: an identification code of a picture corresponding to the picture resource, and an identification code of a character corresponding to the character resource.
[0033] In some possible implementations, the first cache includes: a third cache and a fourth cache, the third cache is used to store picture information corresponding to the identification code of the picture; the fourth cache is used to store character information corresponding to the identification code of the character.
[0034] In some possible implementations, when the first cache does not include the resource of the frame to be displayed, the processing unit is further configured to trigger the user interface thread to read the resource of the frame to be displayed from the relevant file into the first cache.
[0035] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory; the memory is coupled to the processor, the memory is used to store computer program code, the computer program code comprises computer instructions, and the processor calls the computer instructions to enable the electronic device to execute any one of the methods in the technical solution described in the first aspect.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium, which includes instructions. When the instructions are executed on an electronic device, the electronic device executes any one of the methods in the technical solution described in the first aspect.
[0037] It should be understood that the technical solutions provided in the second to fourth aspects above all have technical features that correspond to the communication methods provided in the first aspect and its possible implementation methods, and therefore the beneficial effects that can be achieved are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1A This is a schematic diagram of an application scenario in which the processing method provided in one embodiment of the present application is applicable;
[0039] Figure 1B This is a schematic diagram of an application scenario in which the processing method provided in one embodiment of the present application is applicable;
[0040] Figure 2A This is a flowchart of a processing method provided in one embodiment of the present application;
[0041] Figure 2B This is a schematic diagram of the interaction process between the user interface thread and the asynchronous thread in one embodiment of the present application;
[0042] Figure 3Ais a schematic diagram of a process for rendering and displaying image frame data according to an embodiment of the present application;
[0043] Figure 3B This is a flowchart of a processing method provided in one embodiment of the present application;
[0044] Figure 4 This is a flowchart of a processing method provided in one embodiment of the present application;
[0045] Figure 5 is a structural diagram of an electronic device shown in an embodiment of the present application;
[0046] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. 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 article is merely a description of the association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0048] In the following, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the technical features indicated. Therefore, a feature specified as "first," "second," or "third" may explicitly or implicitly include one or more of the features.
[0049] Figure 1A and Figure 1B This is a schematic diagram of an application scenario where the processing method provided in the embodiment of this application is applicable. Figure 1A As shown, the user operates the electronic device by touching the display screen of the smart watch; Figure 1B As shown, the user operates the electronic device by touching the display screen of the smart watch. In addition, the smart watch communicates with the mobile phone, for example, the smart watch can communicate with the mobile phone via Bluetooth.
[0050] The processing method, related apparatus, electronic device, and computer-readable storage medium provided in the embodiments of the present application can be applied to wearable devices such as smart watches and wrist bands. The embodiments of the present application do not impose any restrictions on the specific type of electronic device. For simplicity, the electronic device in the embodiments of the present application is described using a smart watch as an example.
[0051] The processing method provided by the present application is described below in conjunction with specific embodiments. The method is used for an electronic device using a real-time operating system. After the electronic device is turned on, a user interface thread and an asynchronous thread are run. The user interface thread has a higher priority than the asynchronous thread. The electronic device includes a display screen. See Figure 2A , Figure 2A It is a flowchart of a processing method provided in an embodiment of the present application, which may include steps 201 to 206.
[0052] 201. The user interface thread obtains a first message, where the first message is used to trigger the display screen to update display content, and the content to be displayed corresponds to multiple frames.
[0053] For example, when the electronic device is a smartwatch, the first message may be to view contact information on the smartwatch. Contact information may include image information and text information. The image information may include a contact icon; the text information may include the contact name, phone number, and other information. Different contact information can be browsed by sliding.
[0054] In some possible embodiments, the first message may also be checking chat information in an APP such as WeChat.
[0055] It should be noted that the content displayed on the display screen when the first message triggers the display screen to update can be information stored in the relevant files in the smart watch. Figure 1A In some possible embodiments, the content displayed on the display screen after the first message triggers the update can also be information obtained from relevant files in the smartphone, and the smartphone can communicate with the smartwatch via Bluetooth or other means. The corresponding scenario is as follows Figure 1B shown.
[0056] 202. Trigger the user interface thread to respond to the first message and determine the identifier of the resource that needs to be preloaded.
[0057] The resources that need to be preloaded include: picture resources and character resources. The identification of the resources that need to be preloaded includes: the identification code of the picture corresponding to the picture resource and the identification code of the character corresponding to the character resource.
[0058] 203. Trigger the user interface thread to send a second message to the asynchronous thread, where the second message carries the identifier.
[0059] 204. When the user interface thread is idle, trigger the asynchronous thread to read the preloaded resources from the relevant file according to the identifier, and save the read preloaded resources into the first cache.
[0060] like Figure 2B As shown, you can determine whether the user interface thread is idle. If so, execute Figure 2AIf not, step 204 is not executed until the user interface thread is idle, at which point step 204 is executed again. It will be appreciated that if the user interface thread is not idle, since the user interface thread has a higher priority than the asynchronous thread, the user interface thread is scheduled first. When the user interface thread is idle, the asynchronous thread is scheduled. Because the content to be displayed corresponds to multiple frames, the asynchronous thread may read the preloaded resources all at once or multiple times.
[0061] In some possible embodiments, the user interface thread is idle, including when the graphics processor renders resources corresponding to the to-be-displayed frame read from the first cache.
[0062] In some possible embodiments, the first cache includes: a third cache and a fourth cache, the third cache is used to store picture information corresponding to the identification code of the picture; the fourth cache is used to store character information corresponding to the identification code of the character.
[0063] 205. When the first cache includes resources of the frame to be displayed, trigger the user interface thread to read the resources corresponding to the frame to be displayed in the first cache.
[0064] 206. Trigger the graphics processor to render the resources corresponding to the frame to be displayed read from the first cache to obtain the frame to be displayed.
[0065] When the technical solution provided by this embodiment is adopted, the user interface thread sends the identifier of the resources that need to be preloaded to the asynchronous thread. When the user interface thread is idle, the asynchronous thread reads the preloaded resources from the relevant files and saves the read preloaded resources to the first cache. When the first cache includes resources of the frame to be displayed, the interface thread reads the resources corresponding to the frame to be displayed in the first cache. The graphics processor renders the resources corresponding to the frame to be displayed read from the first cache to obtain the frame to be displayed. This application uses the asynchronous thread to save the resources of the frame to be displayed to the first cache, which can avoid the user interface thread directly reading the relevant resources from the file corresponding to the frame to be displayed. Since the asynchronous thread performs the relevant operations when the graphical user interface thread is idle, the adoption of this solution can reduce the time it takes for the graphical user interface thread to read data, which is beneficial to improving the display frame rate of the electronic device.
[0066] See Figure 3A , Figure 3AThis is a schematic diagram of the image frame data rendering and display process shown in an embodiment of the present application. In order to improve the refresh smoothness of the UI interface, the relevant embodiment provides a dual frame buffer technology, that is, two frame buffers are provided. During the image frame data rendering and display process, one frame buffer is used to render the image frame data, and the other frame buffer is used to send the image. One frame buffer corresponds to one image frame, or one frame of image frame data. See Figure 3A The electronic device provides frame buffers Buffer1 and Buffer2, where Buffer1 is used to render image frame data, and Buffer2 is used to send images. That is, after the graphics processor renders the UI interface, it stores the resulting image frame data in Buffer1. The electronic device then copies the data in Buffer1 to Buffer2. The user interface thread then sends the image frame data in Buffer2 to the display screen for display. In this way, Buffer1 can continue to be used for rendering the next image frame data.
[0067] See Figure 3B , Figure 3B It is a flowchart of a processing method provided in an embodiment of the present application, which may include steps 301 to 308.
[0068] 301. The user interface thread obtains a first message, where the first message is used to trigger the display screen to update display content, and the content to be displayed corresponds to multiple frames.
[0069] For example, when the electronic device is a smartwatch, the first message may be to view contact information on the smartwatch. Contact information may include image information and text information. The image information may include a contact icon; the text information may include the contact name, phone number, and other information. Different contact information can be browsed by sliding.
[0070] In some possible embodiments, the first message may also be checking chat information in an APP such as WeChat.
[0071] It should be noted that the content displayed on the display screen when the first message triggers the display screen to update can be information stored in the relevant files in the smart watch. Figure 1A In some possible embodiments, the content displayed on the display screen after the first message triggers the update can also be information obtained from relevant files in the smartphone, and the smartphone can communicate with the smartwatch via Bluetooth or other means. The corresponding scenario is as follows Figure 1B shown.
[0072] 302. Trigger the user interface thread to respond to the first message and determine the identifier of the resource that needs to be preloaded.
[0073] The resources that need to be preloaded include: picture resources and character resources. The identification of the resources that need to be preloaded includes: the identification code of the picture corresponding to the picture resource and the identification code of the character corresponding to the character resource.
[0074] 303. Trigger the user interface thread to send a second message to the asynchronous thread, where the second message carries the identifier.
[0075] 304. When the user interface thread is idle, trigger the asynchronous thread to read the preloaded resources from the relevant file according to the identifier, and save the read preloaded resources into the first cache.
[0076] In some possible embodiments, the user interface thread is idle, including when the graphics processor renders resources corresponding to the to-be-displayed frame read from the first cache.
[0077] In some possible embodiments, the first cache includes: a third cache and a fourth cache, the third cache is used to store picture information corresponding to the identification code of the picture; the fourth cache is used to store character information corresponding to the identification code of the character.
[0078] 305. When the first cache includes resources of the frame to be displayed, trigger the user interface thread to read the resources corresponding to the frame to be displayed in the first cache.
[0079] 306. Trigger the graphics processor to render the resources corresponding to the frame to be displayed read from the first cache to obtain the frame to be displayed.
[0080] 307. Save the frame to be displayed into the second cache.
[0081] 308. Read the frame to be displayed from the second buffer, and display the frame to be displayed on the display screen.
[0082] See Figure 4 , Figure 4 It is a flowchart of a processing method provided in an embodiment of the present application, which may include steps 401 to 410.
[0083] 401. The user interface thread obtains a first message, where the first message is used to trigger the display screen to update display content, and the content to be displayed corresponds to multiple frames.
[0084] For example, when the electronic device is a smartwatch, the first message may be to view contact information on the smartwatch. Contact information may include image information and text information. The image information may include a contact icon; the text information may include the contact name, phone number, and other information. Different contact information can be browsed by sliding.
[0085] In some possible embodiments, the first message may also be checking chat information in an APP such as WeChat.
[0086] It should be noted that the content displayed on the display screen when the first message triggers the display screen to update can be information stored in the relevant files in the smart watch. Figure 1A In some possible embodiments, the content displayed on the display screen after the first message triggers the update can also be information obtained from relevant files in the smartphone, and the smartphone can communicate with the smartwatch via Bluetooth or other means. The corresponding scenario is as follows Figure 1B shown.
[0087] 402. Trigger the user interface thread to respond to the first message and determine the identifier of the resource that needs to be preloaded.
[0088] The resources that need to be preloaded include: picture resources and character resources. The identification of the resources that need to be preloaded includes: the identification code of the picture corresponding to the picture resource and the identification code of the character corresponding to the character resource.
[0089] 403. Trigger the user interface thread to send a second message to the asynchronous thread, where the second message carries the identifier.
[0090] 404. When the user interface thread is idle, trigger the asynchronous thread to read the preloaded resources from the relevant file according to the identifier, and save the read preloaded resources into the first cache.
[0091] In some possible embodiments, the user interface thread is idle, including when the graphics processor renders resources corresponding to the to-be-displayed frame read from the first cache.
[0092] In some possible embodiments, the first cache includes: a third cache and a fourth cache, the third cache is used to store picture information corresponding to the identification code of the picture; the fourth cache is used to store character information corresponding to the identification code of the character.
[0093] 405. Determine whether the first cache includes resources of the frame to be displayed.
[0094] If the first buffer contains the resource of the frame to be displayed, then step 407 is executed. If the first buffer does not contain the resource of the frame to be displayed, then step 406 is executed.
[0095] 406. Trigger the user interface thread to read the resources of the frame to be displayed from the relevant file into the first cache.
[0096] 407. Trigger the user interface thread to read the resources corresponding to the frame to be displayed in the first cache.
[0097] 408. Trigger the graphics processor to render the resources corresponding to the frame to be displayed read from the first cache to obtain the frame to be displayed.
[0098] 409. Save the frame to be displayed into the second cache.
[0099] 410. Read the frame to be displayed from the second buffer, and display the frame to be displayed on the display screen.
[0100] When the technical solution provided by this embodiment is adopted, the user interface thread sends the identifier of the resources that need to be preloaded to the asynchronous thread. When the user interface thread is idle, the asynchronous thread reads the preloaded resources from the relevant files and saves the read preloaded resources to the first cache. When the first cache includes resources of the frame to be displayed, the interface thread reads the resources corresponding to the frame to be displayed in the first cache. The graphics processor renders the resources corresponding to the frame to be displayed read from the first cache to obtain the frame to be displayed. This application uses the asynchronous thread to save the resources of the frame to be displayed to the first cache, which can avoid the user interface thread directly reading the relevant resources from the file corresponding to the frame to be displayed. Since the asynchronous thread performs the relevant operations when the graphical user interface thread is idle, the adoption of this solution can reduce the time it takes for the graphical user interface thread to read data, which is beneficial to improving the display frame rate of the electronic device.
[0101] The present application also provides a processing device for an electronic device using a real-time operating system. After the electronic device is powered on, a user interface thread and an asynchronous thread are run, and the user interface thread has a higher priority than the asynchronous thread. The electronic device includes a display screen. The processing device includes an acquisition unit, a determination unit, a sending unit, a processing unit, a reading unit, and a rendering unit. The acquisition unit is configured to acquire a first message from the user interface thread, the first message being configured to trigger the display screen to update display content, where the content to be displayed corresponds to multiple frames. The determination unit is configured to trigger the user interface thread to respond to the first message and determine an identifier of a resource to be preloaded. The sending unit is configured to trigger the user interface thread to send a second message to the asynchronous thread, the second message carrying the identifier. The processing unit is configured to, when the user interface thread is idle, trigger the asynchronous thread to read the preloaded resource from a related file based on the identifier and save the preloaded resource to a first cache. The reading unit is configured to, when the first cache includes resources for a frame to be displayed, trigger the user interface thread to read the resources corresponding to the frame to be displayed in the first cache. The rendering unit is configured to trigger a graphics processor to render the resources corresponding to the frame to be displayed read from the first cache to obtain the frame to be displayed.
[0102] In some possible implementations, the idle state of the user interface thread includes: when the graphics processor renders resources corresponding to the to-be-displayed frame read from the first cache.
[0103] In some possible implementations, the processing unit is further configured to, after the rendering unit obtains the frame to be displayed, save the frame to be displayed in the second cache, and read the frame to be displayed from the second cache, and display the frame to be displayed on the display screen.
[0104] In some possible implementations, the resources that need to be preloaded include: image resources and character resources.
[0105] In some possible implementations, the identification of the resource that needs to be preloaded includes: an identification code of a picture corresponding to the picture resource, and an identification code of a character corresponding to the character resource.
[0106] In some possible implementations, the first cache includes: a third cache and a fourth cache, the third cache is used to store picture information corresponding to the identification code of the picture; the fourth cache is used to store character information corresponding to the identification code of the character.
[0107] In some possible implementations, when the first cache does not include resources of the frame to be displayed, the processing unit is further configured to trigger the user interface thread to read the resources of the frame to be displayed from the relevant file into the first cache.
[0108] It should be noted that the specific implementation of each unit can refer to the description of the previous method embodiment, and for the sake of brevity, it will not be repeated here.
[0109] like Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application. The electronic device 500 may be the above-mentioned smart watch, or a smart bracelet, etc. The wearable device may specifically include: a processor 501 and a memory 502, wherein the memory 502 stores a computer program 503. The electronic device 500 may also include a touch screen, which includes a sensor and a display screen. The above-mentioned components may be coupled via a communication bus 504. The computer program 503 is stored in the above-mentioned memory 502. The computer program includes computer instructions. The processor 501 calls the computer instructions to cause the electronic device to perform the relevant steps in the above-mentioned method embodiment.
[0110] Figure 6 This is a structural diagram of an electronic device provided in one embodiment of the present application, which can specifically be a wearable terminal device such as a watch, a smart bracelet, etc. that uses a real-time operating system. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device 600.
[0111] See also Figure 6The electronic device 600 may include a processor 610, an external memory interface 620, an internal memory 621, a universal serial bus (USB) interface 630, a charging management module 640, a power management module 641, a battery 642, an antenna 1, an antenna 2, a mobile communication module 650, a wireless communication module 660, an audio module 670, a speaker 670A, a receiver 670B, a microphone 670C, an earphone interface 670D, a sensor module 680, a button 690, a motor 691, an indicator 692, a camera 693, a screen 694, and a subscriber identification module (SIM) card interface 695, etc. Among them, the sensor module 680 can include a pressure sensor 680A, a gyroscope sensor 680B, an air pressure sensor 680C, a magnetic sensor 680D, an acceleration sensor 680E, a distance sensor 680F, a proximity light sensor 680G, a fingerprint sensor 680H, a temperature sensor 680J, a touch sensor 680K, an ambient light sensor 680L, a bone conduction sensor 680M, etc.
[0112] The processor 610 may include a processing unit, for example, the processor 610 may include an AP, a CP, a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into a single processor. The electronic device may schedule only one thread at a time.
[0113] The controller may be the nerve center and command center of the electronic device 600. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0114] The processor 610 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 610 is a cache memory. This memory can store instructions or data that the processor 610 has just used or is reusing. If the processor 610 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 610, and thus improves system efficiency. The processor may also be provided with a low-power memory (e.g., Island low power consumption) to reduce power consumption.
[0115] Electronic device 600 implements display functionality through a GPU, screen 694, and an application processor. A GPU is a microprocessor for image processing that connects screen 694 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 610 may include one or more GPUs that execute program instructions to generate or modify display information.
[0116] The screen 694 is used to display images, characters, videos, etc. In some embodiments, the electronic device 600 may include 1 or N screens 694, where N is an integer greater than 1.
[0117] The electronic device 600 can implement a shooting function through an ISP, a camera 693, a video codec, a GPU, a screen 694, and an application processor.
[0118] The ISP processes data fed back by camera 693. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and transformed into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 693.
[0119] The camera 693 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 600 may include 1 or N cameras 693, where N is an integer greater than 1.
[0120] The external memory interface 620 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 600. The external memory card communicates with the processor 610 via the external memory interface 620 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0121] The internal memory 621 can be used to store computer executable program codes, which include instructions. The processor 610 executes various functional applications and data processing of the electronic device 600 by running the instructions stored in the internal memory 621. The internal memory 621 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 600 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 621 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0122] The accelerometer 680E can detect the magnitude of the acceleration of the electronic device 600 in all directions (generally three axes). When the electronic device 600 is stationary, it can detect the magnitude and direction of gravity. The accelerometer 680E can also be used to identify the posture of the electronic device 600. Of course, the accelerometer 680E can also be combined with the gyroscope 680B to identify the posture of the electronic device 600.
[0123] The gyroscope sensor 680B can be used to determine the motion posture of the electronic device 400. In some embodiments, the angular velocity of the electronic device 600 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 680B. The gyroscope sensor 680B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 680B detects the angle of the electronic device 600 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 600 through reverse movement to achieve anti-shake. The gyroscope sensor 680B can also be used for horizontal and vertical screen switching, navigation, and somatosensory game scenes.
[0124] It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 600. In other embodiments of the present application, the electronic device 600 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0125] The electronic device provided in the embodiments of the present application may be user equipment (UE), such as a smart watch, a smart bracelet, or the like.
[0126] In addition, an operating system runs on the above components, such as a real-time operating system.
[0127] above Figure 6 This is only an example of the composition of an electronic device. In actual applications, the electronic device may include all or part of the modules and devices of the above technical architecture, as well as other modules and devices not mentioned in the above technical architecture. Of course, it may also include only the modules and devices of the above technical architecture, and this embodiment does not limit this.
[0128] An embodiment of the present application further provides a computer-readable storage medium storing instructions. When the instructions are executed on an electronic device, the electronic device executes the steps in the above-mentioned method embodiments.
[0129] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0130] The present application implements all or part of the processes in the above-described method embodiments by instructing the relevant hardware through a computer program. The computer program may be stored in a computer-readable storage medium. When executed by a processor, the computer program may implement the steps of each of the above-described method embodiments. The computer program includes computer program code, which may be in source code form, object code form, an executable file, or some intermediate form. The computer-readable medium may include at least: any entity or device capable of carrying the computer program code to a camera / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium.
[0131] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0132] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0133] In the embodiments provided in this application, it should be understood that the disclosed methods and electronic devices can be implemented in other ways. For example, the method / device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0134] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0135] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0136] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0137] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0138] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A processing method, characterized in that: An electronic device using a real-time operating system, wherein after the electronic device is powered on, a user interface thread and an asynchronous thread are run, and the user interface thread has a higher priority than the asynchronous thread; The electronic device includes a display screen; the method includes: The user interface thread obtains a first message, where the first message is used to trigger the display screen to update display content, where the content to be displayed corresponds to multiple frames; triggering the user interface thread to respond to the first message and determine an identifier of a resource that needs to be preloaded; Triggering the user interface thread to send a second message to the asynchronous thread, where the second message carries the identifier; When the user interface thread is idle, triggering the asynchronous thread to read the preloaded resources from the relevant file according to the identifier and saving the read preloaded resources into the first cache; when the user interface thread is idle, including: when the graphics processor renders the resources corresponding to the frame to be displayed read from the first cache; When the first cache includes resources of the frame to be displayed, triggering the user interface thread to read the resources corresponding to the frame to be displayed in the first cache; The graphics processor is triggered to render the resource corresponding to the to-be-displayed frame read from the first cache to obtain the to-be-displayed frame.
2. The method according to claim 1, characterized in that After obtaining the frame to be displayed, the method further includes: Saving the frame to be displayed in a second buffer; The frame to be displayed is read from the second buffer, and the frame to be displayed is displayed on the display screen.
3. The method according to claim 1, characterized in that The resources that need to be preloaded include: picture resources and character resources.
4. The method according to claim 3, characterized in that The identification of the resource that needs to be preloaded includes: an identification code of the picture corresponding to the picture resource, and an identification code of the character corresponding to the character resource.
5. The method according to claim 4, characterized in that The first cache includes: a third cache and a fourth cache, the third cache is used to store picture information corresponding to the identification code of the picture; the fourth cache is used to store character information corresponding to the identification code of the character.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: When the first cache does not include the resource of the frame to be displayed, the user interface thread is triggered to read the resource of the frame to be displayed from the relevant file into the first cache.
7. A processing device, characterized in that: An electronic device using a real-time operating system, wherein after the electronic device is powered on, a user interface thread and an asynchronous thread are run, and the user interface thread has a higher priority than the asynchronous thread; The electronic device includes a display screen; the device includes: an acquiring unit, configured to acquire a first message through the user interface thread, wherein the first message is used to trigger the display screen to update display content, and the content to be displayed corresponds to multiple frames; a determining unit, configured to trigger the user interface thread to respond to the first message and determine an identifier of a resource that needs to be preloaded; a sending unit, configured to trigger the user interface thread to send a second message to the asynchronous thread, where the second message carries the identifier; a processing unit, configured to trigger the asynchronous thread to read the preloaded resources from the relevant file according to the identifier and save the read preloaded resources into the first cache when the user interface thread is idle; when the user interface thread is idle, including: when the graphics processor renders the resources corresponding to the frame to be displayed read from the first cache; a reading unit, configured to trigger the user interface thread to read the resource corresponding to the frame to be displayed in the first cache when the resource of the frame to be displayed is included in the first cache; A rendering unit is configured to trigger the graphics processor to render resources corresponding to the to-be-displayed frame read from the first cache, to obtain the to-be-displayed frame.
8. An electronic device, characterized in that: The electronic device includes: a processor and a memory; the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, and the processor calls the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes instructions, and when the instructions are executed on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Media content caching method and device, computing equipment and storage medium
CN115795190A