اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release بدلاً من aosp-main لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
قفل المخزن المؤقت بدون إرسال إشارة باستخدام AutoSingleLayer
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يضيف نظام التشغيل Android 13 إعدادًا جديدًا يُعرف باسم
AutoSingleLayer لتأمين
المخازن المؤقتة التي لم يتم إرسال إشارات لها. يتيح هذا الإعداد لـ SurfaceFlinger تثبيت ملف تخزين مؤقت بدون إرسال إشارة عند تعديل طبقة واحدة فقط، وليس في الحالات التي تحدث
على مستوى جميع الطبقات، مثل تغييرات الأشكال الهندسية أو معاملات المزامنة.
قبل Android 13، كانت علامة debug.sf.latch_unsignaled
في AOSP تتيح لـ SurfaceFlinger قفل جميع المخازن المؤقتة غير المُرسَلة، بغض النظر عن حالة استخدامها. عند تفعيل هذا الإعداد، تظهر تأثيرات جانبية غير مرغوب فيها، مثل
إيقاف معاملات المزامنة وتجميد الشاشة بالكامل أثناء الانتظار لتحميل
المخازن المؤقتة غير المكتملة.
في وضع AutoSingleLayer، يتم تعديل مخزن مؤقت لسطح واحد فقط
في إطار. يتيح هذا الوضع للألعاب والتطبيقات الأخرى التي تعمل في وضع ملء الشاشة الاستفادة
من قفل ذاكرة التخزين المؤقت غير المُرسَلة وتقليل الارتباك في التطبيقات بدون أن يتأثر
بعمليات تجميد الشاشة.
يقرأ SurfaceFlinger LatchUnsignaledConfig عند التشغيل.
في ما يلي الإعدادات المحتملة:
LatchUnsignaledConfig::AutoSingleLayer
في هذا الوضع التلقائي لنظام التشغيل AOSP، يُسمح بتثبيت المخازن المؤقتة غير المُرسَلة إشارات عند تعديل
طبقة واحدة في إطار، ويشمل التعديل تحديثًا للمخزن المؤقت
فقط بدون معاملات مزامنة أو تغييرات في الأشكال الهندسية. في هذا الوضع، يتم ضبط debug.sf.auto_latch_unsignaled
على true تلقائيًا.
LatchUnsignaledConfig::Disabled
يوقف هذا الوضع سلوك القفَل غير المُعلَن عنه ويقفِل
المعاملات التي تم الإبلاغ عنها فقط. يؤدي هذا الوضع أيضًا إلى إيقاف وضع AutoSingleLayer. ل
ضبط هذا الوضع، اضبط debug.sf.latch_unsignaled و
debug.sf.auto_latch_unsignaled على false.
LatchUnsignaledConfig::Always
في هذا الوضع، يتم قفل جميع وحدات التخزين المؤقت بدون إرسال إشارة. لضبط هذا الوضع، اضبط
debug.sf.latch_unsignaled على true.
الاختبار AutoSingleLayer
لاختبار ما إذا كان المخزن المؤقت قد تم تثبيته بدون إرسال إشارة، ابحث عن عمليات التتبُّع التالية
من SurfaceFlinger في Perfetto:
الشكل 1: تتبع مخزن مؤقت غير مُعلَن عنه في Perfetto
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Unsignaled buffer latching with AutoSingleLayer\n\nAndroid 13 adds a new configuration called\n[`AutoSingleLayer`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.h#160) for latching\nunsignaled buffers. This configuration lets SurfaceFlinger latch an unsignaled\nbuffer when only a single layer is updating, and not for the cases that occur\nacross layers, such as geometry changes or sync transactions.\n\nBefore Android 13, the `debug.sf.latch_unsignaled` flag\nin AOSP lets SurfaceFlinger latch all unsignaled buffers, regardless of the use\ncase. When this configuration is enabled, there are undesired side effects, such\nas breaking sync transactions and freezing the entire display while waiting on\nincomplete buffers.\n\nWith the `AutoSingleLayer` mode, only a buffer of a single surface is updated\nin a frame. This mode enables games and other fullscreen apps to get the benefit\nof latching unsignaled buffers and reducing app jank while remaining unaffected\nby display freezes.\n\nAutoSingleLayer mode settings\n-----------------------------\n\nIn Android 13,\n[`AutoSingleLayer`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.h#160) is the default\nmode for the latch unsignaled buffer feature. This mode is controlled by the\nsystem property [`debug.sf.auto_latch_unsignaled`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.cpp#454).\n\nSurfaceFlinger reads [`LatchUnsignaledConfig`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.cpp#449) on boot.\nHere are the possible configurations:\n\n- `LatchUnsignaledConfig::AutoSingleLayer`\n\n In this AOSP default mode, latching unsignaled buffers is permitted when a\n single layer is updated in a frame, and the update includes just a buffer\n update with no sync transactions or geometry changes. In this mode, [`debug.sf.auto_latch_unsignaled`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.cpp#454)\n is set to `true` by default.\n- `LatchUnsignaledConfig::Disabled`\n\n This mode disables the latch unsignaled behavior and latches only signaled\n transactions. This mode also disables the `AutoSingleLayer` mode. To\n configure this mode, set [`debug.sf.latch_unsignaled`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.cpp#450) and\n [`debug.sf.auto_latch_unsignaled`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.cpp#454) to `false`.\n- `LatchUnsignaledConfig::Always`\n\n In this mode, all buffers are latched unsignaled. To configure this mode, set\n [`debug.sf.latch_unsignaled`](https://android.googlesource.com/platform/frameworks/native/+/refs/heads/android16-release/services/surfaceflinger/SurfaceFlinger.cpp#450) to `true`.\n | **Note:** This mode takes priority over setting `AutoSingleLayer` but can cause display freezing and other undesired effects. This mode might be deprecated in future releases.\n\nTest `AutoSingleLayer`\n----------------------\n\nTo test whether a buffer is latched unsignaled, look for the following traces\nfrom SurfaceFlinger in [Perfetto](https://developer.android.com/topic/performance/tracing):\n\n**Figure 1.** Trace of a latched unsignaled buffer in Perfetto"]]