drm_hwcomposer: Choose client layer range to achieve minimal GPU load

1. Allow CLIENT layer at any position.
2. Check all possible layer combination and choose most efficient
   based on total pixel operations value.

Use case 1 - Layer count is greater than available planes
Table shows difference before and after this commit for 4 or 2 planes cases:

```
z_order   layer      size        pixels  before(4)  after(4) before(2) after(2)
-
0         Wallpaper  1960x1080   2MiP    CLIENT     DEVICE   CLIENT    DEVICE
1         Launcher   1960x1080   2MiP    CLIENT     DEVICE   CLIENT    CLIENT
2         Status bar 1960x80     0.15MiP DEVICE     DEVICE   CLIENT    CLIENT
3         Nav. bar   1960x80     0.15MiP DEVICE     CLIENT   CLIENT    CLIENT
4         Cursor     24x24       576P    DEVICE     CLIENT   DEVICE    CLIENT

Total pixels merged by CLIENT (GPU)      4MiP  ->   0.15MiP  4.3MiP -> 2.3MiP
```

Use case 2 - Unsupported layer type in the middle (Dim layer, etc):
Table shows difference before and after this commit for 4 or 2 planes cases:

```
z_order   layer      size        pixels  before(4)  after(4) before(2) after(2)
-
0         App        1960x1080   2MiP    CLIENT     DEVICE   CLIENT    DEVICE
1         Status bar 1960x80     0.15MiP CLIENT     DEVICE   CLIENT    CLIENT
2         Nav. bar   1960x80     0.15MiP CLIENT     DEVICE   CLIENT    CLIENT
3         Dim layer  1960x1080   2MiP    CLIENT     CLIENT   CLIENT    CLIENT
4         Dialog     1000x500    0.5MiP  DEVICE     CLIENT   DEVICE    CLIENT

Total pixels merged by CLIENT (GPU)      4.3MiP ->  2.5MiP   4.3MiP -> 2.8MiP
```

Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
2 files changed
tree: 1058c9c8b758b9f93925851a11fb7b4f1a074201
  1. compositor/
  2. drm/
  3. include/
  4. platform/
  5. tests/
  6. utils/
  7. .clang-format
  8. .gitlab-ci-checkcommit.sh
  9. .gitlab-ci.yml
  10. Android.bp
  11. drmhwctwo.cpp
  12. MODULE_LICENSE_APACHE2
  13. NOTICE
  14. README.md
README.md

drm_hwcomposer

Patches to drm_hwcomposer are very much welcome, we really want this to be the universal HW composer implementation for Android and similar platforms So please bring on porting patches, bugfixes, improvements for documentation and new features.

A short list of contribution guidelines:

  • Submit changes via gitlab merge requests on gitlab.freedesktop.org

  • drm_hwcomposer is Apache 2.0 Licensed and we require contributions to follow the developer's certificate of origin: http://developercertificate.org/

  • When submitting new code please follow the naming conventions documented in the generated documentation. Also please make full use of all the helpers and convenience macros provided by drm_hwcomposer. The below command can help you with formatting of your patches:

    `git diff | clang-format-diff-5.0 -p 1 -style=file`
    
  • Hardware specific changes should be tested on relevant platforms before committing.

If you need inspiration, please checkout our TODO issues

Happy hacking!