drm_hwcomposer: Implement BI and FB caching

This allows saving for about 2-6% of frame time spending in the HWC API
thread (value depends on CPU maturity).

Framework does not create a new buffer for every frame. Instead in 98%
of cases it sends the same buffers over and over (doing circular
shifting of the swapchain).

We can avoid redundant BufferInfo getting and FrameBuffer importing for
the whole layer.

To do this properly first we have to ensure we're having a deal with the
swapchain, not a set of unique buffers. This procedure internally called
the swap chain reassembling.

After we ensure CLIENT is using swapchain, we can safely store BI and
FB for every chain element and reuse it.

Example for single layer:

Frame # |  Buffer Unique ID |     State
 --     | --                | --
      1 |               301 | Reassembling...
      2 |               302 | Reassembling...
      3 |               303 | Reassembling...
      4 |               301 | Caching... (Chain reassembled!)
      5 |               302 | Caching...
      6 |               303 | Caching...
      7 |               301 | Reusing cached data
      8 |               302 | Reusing cached data
      9 |               303 | Reusing cached data
    ... |               ... | ...................
    999 |               304 | Not in cache, purge the cache.
   1000 |               305 | Reassembling...

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
3 files changed
tree: 7df3e5259da677940d8bd19c5ef7f9f9696cb0a5
  1. .ci/
  2. backend/
  3. bufferinfo/
  4. compositor/
  5. drm/
  6. hwc2_device/
  7. tests/
  8. utils/
  9. .clang-format
  10. .clang-tidy
  11. .gitlab-ci.yml
  12. Android.bp
  13. build_deploy.sh
  14. MODULE_LICENSE_APACHE2
  15. NOTICE
  16. presubmit.sh
  17. 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-14 -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!