A partire dal 27 marzo 2025, ti consigliamo di utilizzare android-latest-release
anziché aosp-main
per compilare e contribuire ad AOSP. Per ulteriori informazioni, vedi Modifiche ad AOSP.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Riferimento alla struttura vr_module
#include <
vr.h
>
Implementa questo HAL per ricevere i callback quando viene utilizzata un'applicazione di realtà virtuale (VR). Le applicazioni VR hanno in genere una serie di requisiti speciali per la visualizzazione e le prestazioni, tra cui:
-
Bassa latenza del sensore: la latenza end-to-end totale dall'IMU, dall'accelerometro e dal giroscopio a un callback visibile all'applicazione deve essere estremamente bassa (in genere inferiore a 5 ms). Questo è necessario per il supporto del sensore HiFi.
-
Bassa latenza di visualizzazione: la latenza end-to-end totale dalle chiamate di disegno della GPU all'aggiornamento effettivo della visualizzazione deve essere il più bassa possibile. Questo risultato viene ottenuto utilizzando SurfaceFlinger in modalità con buffer singolo e assicurando che le chiamate di disegno siano sincronizzate correttamente con la scansione del display. Questo comportamento è esposto alle applicazioni tramite un'estensione EGL. Di seguito sono riportate le estensioni EGL necessarie per questo.
-
Display a bassa persistenza: le impostazioni di persistenza del display devono essere impostate il più basso possibile, mantenendo al contempo una luminosità ragionevole. Per un display tipico a 60 Hz, i pixel devono essere illuminati per un periodo inferiore o uguale a 3,5 ms per essere considerati a bassa persistenza. In questo modo si evitano i "ghost" durante i movimenti in un'impostazione VR e l'opzione deve essere attivata dall'HAL
lights.h
quando è impostato BRIGHTNESS_MODE_LOW_PERSISTENCE.
-
Prestazioni coerenti della GPU e della CPU: quando viene fornito un carico di lavoro misto GPU/CPU per un'applicazione VR con picchi di lavoro a intervalli regolari più volte al frame, la pianificazione della CPU deve garantire che il lavoro del thread di rendering dell'applicazione venga eseguito in modo coerente entro 1 ms dalla pianificazione e completato prima della fine della finestra di disegno. A questo scopo, un singolo core della CPU deve essere riservato esclusivamente al thread di rendering dell'applicazione VR in esecuzione in modalità VR e reso disponibile nel set cpu "top-app". Analogamente, è necessario mantenere una frequenza di clock appropriata per la CPU, la GPU e il bus per garantire che il carico di lavoro di rendering venga completato entro il tempo a disposizione per il rendering di ogni frame quando il flag POWER_HINT_SUSTAINED_PERFORMANCE è stato impostato nell'HAL
power.h
in modalità VR quando il dispositivo non è sottoposto a throttling termico.
-
Devono essere presenti le estensioni EGL richieste: sono necessarie tutte le impostazioni GPU necessarie per consentire le funzionalità sopra indicate, incluse le estensioni EGL: EGL_ANDROID_create_native_client_buffer, EGL_ANDROID_front_buffer_auto_refresh, EGL_EXT_protected_content, EGL_KHR_mutable_render_buffer, EGL_KHR_reusable_sync ed EGL_KHR_wait_sync.
-
Report termici accurati: temperature e limiti termici accurati devono essere registrati nell'HAL
thermal.h
. Nello specifico, la temperatura cutanea attuale deve essere registrata con precisione per DEVICE_TEMPERATURE_SKIN e la soglia vr_throttling_threshold registrata per questo dispositivo deve indicare con precisione il limite di temperatura oltre il quale il governor termico del dispositivo riduce le frequenze di clock della CPU, della GPU e/o del bus al di sotto del minimo necessario per prestazioni costanti (vedi punto elenco precedente).
In generale, i fornitori che implementano questo HAL devono utilizzare set_vr_mode come suggerimento per attivare la messa a punto delle prestazioni specifica per la realtà virtuale necessaria per uno dei requisiti sopra indicati e per attivare le funzionalità del dispositivo ottimali per le modalità di visualizzazione VR. La chiamata set_vr_mode potrebbe semplicemente non fare nulla se non sono disponibili o necessarie ottimizzazioni per soddisfare i requisiti sopra indicati.
Nessun metodo in questo HAL verrà chiamato contemporaneamente dal framework Android.
Definizione nella riga
82
del file
vr.h
.
Metodi comuni del modulo. Questo
deve essere
il primo membro di
vr_module
poiché gli utenti di questa struttura possono trasmettere un
hw_module_t
a un
vr_module
puntatore in contesti in cui è noto che il
hw_module_t
fa riferimento a un
vr_module
.
Definizione nella riga
89
del file
vr.h
.
Metodo di utilità per l'implementazione dell'HAL per configurare qualsiasi stato necessario all'avvio del runtime. Viene chiamato una volta da VrManagerService durante la fase di avvio. Nessun metodo di questo HAL verrà chiamato prima di init.
Definizione nella riga
96
del file
vr.h
.
Definizione nella riga
110
del file
vr.h
.
void(* set_vr_mode)(struct
vr_module
*module, bool enabled)
|
Imposta lo stato della modalità VR. I possibili stati del parametro abilitato sono: false: la modalità VR è disattivata, disattiva tutte le impostazioni specifiche per la realtà virtuale. true: la modalità VR è attivata, attiva tutte le impostazioni specifiche per la realtà virtuale.
Viene chiamato ogni volta che il sistema Android entra o esce dalla modalità VR. Questo accade in genere quando l'utente passa a o da un'applicazione VR che esegue il rendering stereoscopico.
Definizione nella riga
107
del file
vr.h
.
La documentazione di questa struttura è stata generata dal seguente file:
-
hardware/libhardware/include/hardware/
vr.h
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-26 UTC."],[],[],null,["# Android Hardware Abstraction Layer: vr_module Struct Reference\n\nvr_module Struct Reference\n==========================\n\n[Data Fields](#pub-attribs) \nvr_module Struct Reference \n\n`\n#include \u003c\n`[vr.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)`\n\u003e\n`\n\n|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| struct [hw_module_t](/reference/hal/structhw__module__t) | [common](/reference/hal/structvr__module#a71ea01183b3998cad6a2301a37a42fc7) |\n| ||\n| void(\\* | [init](/reference/hal/structvr__module#a1621887a15b003a1ba7be81d52b0abb0) )(struct [vr_module](/reference/hal/structvr__module) \\*module) |\n| ||\n| void(\\* | [set_vr_mode](/reference/hal/structvr__module#a8c9e8990b6b65b068703cd615be68fb5) )(struct [vr_module](/reference/hal/structvr__module) \\*module, bool enabled) |\n| ||\n| void \\* | [reserved](/reference/hal/structvr__module#aa1a42885ba14c2168dc14d3f219b5e99) \\[8-2\\] |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nImplement this HAL to receive callbacks when a virtual reality (VR) application is being used. VR applications characteristically have a number of special display and performance requirements, including:\n\n- Low sensor latency - Total end-to-end latency from the IMU, accelerometer, and gyro to an application-visible callback must be extremely low (\\\u003c5ms typically). This is required for HIFI sensor support.\n- Low display latency - Total end-to-end latency from the GPU draw calls to the actual display update must be as low as possible. This is achieved by using SurfaceFlinger in a single-buffered mode, and assuring that draw calls are synchronized with the display scanout correctly. This behavior is exposed via an EGL extension to applications. See below for the EGL extensions needed for this.\n- Low-persistence display - Display persistence settings must be set as low as possible while still maintaining a reasonable brightness. For a typical display running at 60Hz, pixels should be illuminated for \\\u003c=3.5ms to be considered low-persistence. This avoids ghosting during movements in a VR setting, and should be enabled from the [lights.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/lights.h) HAL when BRIGHTNESS_MODE_LOW_PERSISTENCE is set.\n- Consistent performance of the GPU and CPU - When given a mixed GPU/CPU workload for a VR application with bursts of work at regular intervals several times a frame, the CPU scheduling should ensure that the application render thread work is run consistently within 1ms of when scheduled, and completed before the end of the draw window. To this end, a single CPU core must be reserved for solely for the currently running VR application's render thread while in VR mode, and made available in the \"top-app\" cpuset. Likewise, an appropriate CPU, GPU, and bus clockrate must be maintained to ensure that the rendering workload finishes within the time allotted to render each frame when the POWER_HINT_SUSTAINED_PERFORMANCE flag has been set in the [power.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/power.h) HAL while in VR mode when the device is not being thermally throttled.\n- Required EGL extensions must be present - Any GPU settings required to allow the above capabilities are required, including the EGL extensions: EGL_ANDROID_create_native_client_buffer, EGL_ANDROID_front_buffer_auto_refresh, EGL_EXT_protected_content, EGL_KHR_mutable_render_buffer, EGL_KHR_reusable_sync, and EGL_KHR_wait_sync.\n- Accurate thermal reporting - Accurate thermal temperatures and limits must be reported in the [thermal.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/thermal.h) HAL. Specifically, the current skin temperature must accurately be reported for DEVICE_TEMPERATURE_SKIN and the vr_throttling_threshold reported for this device must accurately report the temperature limit above which the device's thermal governor throttles the CPU, GPU, and/or bus clockrates below the minimum necessary for consistent performance (see previous bullet point).\n\n\nIn general, vendors implementing this HAL are expected to use set_vr_mode as a hint to enable VR-specific performance tuning needed for any of the above requirements, and to turn on any device features optimal for VR display modes. The set_vr_mode call may simply do nothing if no optimizations are available or necessary to meet the above requirements.\n\n\nNo methods in this HAL will be called concurrently from the Android framework.\n\n\nDefinition at line\n[82](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\nof file\n[vr.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\n.\n\nField Documentation\n-------------------\n\n\n|-----------------------------------------------------------------|\n| struct [hw_module_t](/reference/hal/structhw__module__t) common |\n\n\nCommon methods of the module. This\n*must*\nbe the first member of\n[vr_module](/reference/hal/structvr__module)\nas users of this structure may cast a\n[hw_module_t](/reference/hal/structhw__module__t)\nto a\n[vr_module](/reference/hal/structvr__module)\npointer in contexts where it's known that the\n[hw_module_t](/reference/hal/structhw__module__t)\nreferences a\n[vr_module](/reference/hal/structvr__module)\n.\n\n\nDefinition at line\n[89](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\nof file\n[vr.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\n.\n\n|-----------------------------------------------------------------------------|\n| void(\\* init)(struct [vr_module](/reference/hal/structvr__module) \\*module) |\n\n\nConvenience method for the HAL implementation to set up any state needed at runtime startup. This is called once from the VrManagerService during its boot phase. No methods from this HAL will be called before init.\n\n\nDefinition at line\n[96](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\nof file\n[vr.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\n.\n\n|------------------------|\n| void\\* reserved\\[8-2\\] |\n\n\nDefinition at line\n[110](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\nof file\n[vr.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\n.\n\n|--------------------------------------------------------------------------------------------------|\n| void(\\* set_vr_mode)(struct [vr_module](/reference/hal/structvr__module) \\*module, bool enabled) |\n\n\nSet the VR mode state. Possible states of the enabled parameter are: false - VR mode is disabled, turn off all VR-specific settings. true - VR mode is enabled, turn on all VR-specific settings.\n\n\nThis is called whenever the the Android system enters or leaves VR mode. This will typically occur when the user switches to or from a VR application that is doing stereoscopic rendering.\n\n\nDefinition at line\n[107](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\nof file\n[vr.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [vr.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/vr.h)"]]