קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ב-Android 13 נוספה הגדרה חדשה בשם AutoSingleLayer לנעילה של מאגרים ללא אות. ההגדרה הזו מאפשרת ל-SurfaceFlinger לנעול מאגר ללא אות כשרק שכבה אחת מתעדכנת, ולא במקרים שמתרחשים בשכבות שונות, כמו שינויים בגיאומטריה או טרנזקציות סנכרון.
לפני Android 13, הדגל debug.sf.latch_unsignaled ב-AOSP מאפשר ל-SurfaceFlinger לנעול את כל המאגרים ללא אות, ללא קשר לתרחיש לדוגמה. כשהתצורה הזו מופעלת, יש לה תופעות לוואי לא רצויות, כמו הפרעה לעסקאות סנכרון והקפאה של כל המסך בזמן ההמתנה למאגרים חלקיים.
במצב 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 (שעון UTC).
[[["התוכן קל להבנה","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 (שעון UTC)."],[],[],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"]]