drm_hwcomposer: pre-filter modes provided to HWC2

Currently LocalDisplayAdapter in AOSP filters out similar modes based
on their currently limited supported attributes: width/height/refresh.

This leads to a situation where important modes are discarded, like the
preferred mode and/or the active mode, leading SurfaceFlinger to select
an unwanted and potentially invalid  mode in the list provided by
drm-hwcomposer to HWC2.

Let's pre-filter the modes provided to HWC2 by :
- systematically adding the preferred mode
- systematically adding the current active mode, if different
  from preferred mode
- keeping the interlaced modes filtering-out if no other non-interlace
  modes with same widthXheight exists (for HD-Ready 1080i TVs or CVBS)
- discarding modes if a similar mode with same widthXheight@refresh was
  already selected for HWC2

This mimics the behavior of LocalDisplayAdapter filtering algorithm,
but keeps the important modes from the DRM Point Of View and drops the
duplicate modes while keeping the mode ordering from DRM in account.

This local filtering should ultimately go out when HWC2 can actually
handle mode Attributes to describe Preferred mode, Interlaced, 3D...
and LocalDisplayAdapter uses these Attributes for filtering duplicate
modes.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: John Stultz <john.stultz@linaro.org>
1 file changed
tree: 1cb0077617acc634bfc9866833227247c4e30178
  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!