از 27 مارس 2025، توصیه می کنیم از android-latest-release
به جای aosp-main
برای ساختن و کمک به AOSP استفاده کنید. برای اطلاعات بیشتر، به تغییرات AOSP مراجعه کنید.
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
مرجع ساختار vr_module
#include < vr.h >
این HAL را برای دریافت تماسها در زمانی که از یک برنامه واقعیت مجازی (VR) استفاده میشود، اجرا کنید. برنامه های کاربردی VR مشخصاً دارای تعدادی الزامات ویژه نمایش و عملکرد هستند، از جمله:
- تأخیر سنسور کم - کل تأخیر انتها به انتها از IMU، شتاب سنج و ژیروسکوپ تا یک تماس قابل مشاهده در برنامه باید بسیار کم باشد (معمولاً کمتر از 5 میلی ثانیه). این برای پشتیبانی از سنسور HIFI مورد نیاز است.
- تأخیر نمایشگر کم - کل تأخیر انتها به انتها از فراخوانی GPU تا به روز رسانی واقعی نمایشگر باید تا حد امکان کم باشد. این امر با استفاده از SurfaceFlinger در حالت تک بافری و اطمینان از همگام سازی صحیح تماس های قرعه کشی با اسکن نمایشگر به دست می آید. این رفتار از طریق یک پسوند EGL برای برنامه ها آشکار می شود. پسوندهای EGL مورد نیاز برای این کار را در زیر ببینید.
- نمایشگر با ماندگاری پایین - تنظیمات پایداری نمایشگر باید تا حد امکان پایین تنظیم شود و در عین حال روشنایی معقول حفظ شود. برای نمایشگر معمولی که با فرکانس 60 هرتز کار میکند، پیکسلها باید کمتر از 3.5 میلیثانیه روشن شوند تا ماندگاری پایین در نظر گرفته شوند. این از ایجاد شبح در حین حرکات در تنظیمات VR جلوگیری میکند و باید از چراغها فعال شود. HAL وقتی BRIGHTNESS_MODE_LOW_PERSISTENCE تنظیم شده است.
- عملکرد ثابت GPU و CPU - هنگامی که برای یک برنامه VR حجم کاری ترکیبی GPU/CPU با فواصل منظم در فواصل زمانی منظم چندین بار در یک فریم داده می شود، زمان بندی CPU باید اطمینان حاصل کند که کار رندر برنامه به طور مداوم در عرض 1 میلی ثانیه از زمان اجرا می شود. برنامه ریزی شده و قبل از پایان پنجره قرعه کشی تکمیل شده است. برای این منظور، یک هسته CPU باید صرفاً برای رشته رندر برنامه VR در حال اجرا در حال اجرا در حالت VR رزرو شود و در cpuset "برنامه برتر" در دسترس قرار گیرد. به همین ترتیب، زمانی که پرچم POWER_HINT_SUSTAINED_PERFORMANCE در power.h HAL در حالت VR تنظیم شده است، زمانی که دستگاه در حالت VR است، باید یک CPU، GPU و ساعت گذرگاه مناسب حفظ شود تا اطمینان حاصل شود که حجم کاری رندر در مدت زمان تعیین شده برای رندر هر فریم به پایان می رسد. تحت فشار حرارتی قرار نمی گیرد.
- برنامههای افزودنی EGL مورد نیاز باید وجود داشته باشد - هر گونه تنظیمات GPU مورد نیاز برای اجازه دادن به قابلیتهای فوق، از جمله برنامههای افزودنی EGL: EGL_ANDROID_create_native_client_buffer، EGL_ANDROID_front_buffer_auto_refresh، EGL_EXT_protected_content، EGL_renderable، EGL_render_Kontent، EGL_renderable EGL_KHR_wait_sync.
- گزارش دقیق حرارتی - دماها و محدودیت های حرارتی دقیق باید در thermal.h HAL گزارش شوند. به طور خاص، دمای فعلی پوست باید بهطور دقیق برای DEVICE_TEMPERATURE_SKIN گزارش شود و vr_throttling_threshold گزارششده برای این دستگاه باید بهطور دقیق محدودیت دمایی را گزارش کند که بالاتر از آن، گاورنر حرارتی دستگاه، CPU، GPU و/یا گذرگاه را کمتر از حداقل لازم برای عملکرد ثابت میکند ( نقطه گلوله قبلی را ببینید).
به طور کلی، از فروشندگانی که این HAL را پیادهسازی میکنند، انتظار میرود که از set_vr_mode به عنوان راهنمایی برای فعال کردن تنظیم عملکرد خاص VR مورد نیاز برای هر یک از الزامات بالا استفاده کنند، و هر ویژگی دستگاه را برای حالتهای نمایش VR بهینه کنند. تماس set_vr_mode ممکن است به سادگی کاری انجام ندهد اگر هیچ بهینهسازی در دسترس نباشد یا برای برآورده کردن الزامات فوق ضروری باشد.
هیچ روشی در این HAL به طور همزمان از فریم ورک اندروید فراخوانی نخواهد شد.
تعریف در خط 82 فایل vr.h.
روش آسان برای اجرای HAL برای تنظیم هر حالتی که در زمان راهاندازی لازم است. این یک بار از VrManagerService در مرحله بوت آن فراخوانی می شود. هیچ روشی از این HAL قبل از شروع فراخوانی نخواهد شد.
تعریف در خط 96 فایل vr.h.
void(* set_vr_mode)(struct vr_module *module, bool enabled) |
وضعیت حالت VR را تنظیم کنید. حالت های احتمالی پارامتر فعال عبارتند از: false - حالت VR غیرفعال است، تمام تنظیمات مربوط به VR را خاموش کنید. درست - حالت VR فعال است، همه تنظیمات مربوط به VR را روشن کنید.
زمانی که سیستم اندروید وارد حالت VR یا خارج می شود، این نام خوانده می شود. این معمولاً زمانی اتفاق میافتد که کاربر به یک برنامه واقعیت مجازی که در حال انجام رندر استریوسکوپی است، یا از آن استفاده میکند.
تعریف در خط 107 فایل vr.h.
مستندات این ساختار از فایل زیر تولید شده است:
- hardware/libhardware/include/hardware/ vr.h
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی."],[],[],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)"]]