Search code examples
androidandroid-sourcesurfaceflinger

Source crop & Frame values in dumpsys SurfaceFlinger output


I am working on a project on SurfaceFlinger. So, when is the "source-crop" area different from "frame" area(these are the values that appear in the dumpsys SurfaceFlinger output). In other words, when/why are the layer-contents (rendered by the app) scaled. Or are they rendered by the app itself after scaling. If not, does SurfaceFlinger take the layer-content, scales them and then composites them? Also, who decides the "frame" rectangle, the app or SurfaceFlinger?


Solution

  • See the Android System-Level Graphics document. In particular, the SurfaceView section has a sub-section on use of the hardware scaler that addresses this, but I recommend reading the full thing if you want to understand the details.

    Most content is rendered 1:1 for best quality. Apps can choose to scale up a SurfaceView for performance reasons. The sizes are set by the Window Manager.

    One common situation in which scaling is performed is video playback. You generally want the video to fill as much of the screen as possible, regardless of whether it's SD or HD content.