Android 13에는 신호를 받지 않은 버퍼를 래칭하기 위해 AutoSingleLayer라는 새 구성이 추가되었습니다. 이 구성을 사용하면 단일 레이어만 업데이트될 때 SurfaceFlinger가 신호를 받지 않은 버퍼를 래칭할 수 있으며, 도형 변경이나 동기화 트랜잭션과 같이 레이어 전체에서 발생하는 경우는 해당하지 않습니다.
Android 13 이전에는 AOSP의 debug.sf.latch_unsignaled 플래그를 사용하여 SurfaceFlinger가 사용 사례와 상관없이 신호를 받지 않은 모든 버퍼를 래칭할 수 있습니다. 이 구성이 사용 설정되면 불완전한 버퍼를 기다리는 동안 동기화 트랜잭션이 중단되고 전체 디스플레이가 정지되는 등 원치 않는 부작용이 발생합니다.
AutoSingleLayer 모드를 사용하면 단일 노출 영역의 버퍼만 프레임에서 업데이트됩니다. 이 모드를 사용하면 게임 및 기타 전체 화면 앱이 디스플레이 정지의 영향을 받지 않으면서 신호를 받지 않은 버퍼를 래칭하고 앱 버벅거림을 줄이는 이점을 얻을 수 있습니다.
이 AOSP 기본 모드에서는 단일 레이어가 프레임에서 업데이트될 때 신호를 받지 않은 버퍼를 래칭할 수 있으며 업데이트에는 동기화 트랜잭션이나 도형 변경이 없는 버퍼 업데이트만 포함됩니다. 이 모드에서는 debug.sf.auto_latch_unsignaled가 기본적으로 true로 설정됩니다.
버퍼가 신호를 받지 않고 래칭되었는지 테스트하려면 Perfetto에서 SurfaceFlinger의 다음 트레이스를 찾습니다.
그림 1. Perfetto에서 래칭된, 신호를 받지 않은 버퍼의 트레이스
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2024-04-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"]],["최종 업데이트: 2024-04-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"]]