1. 03 Jul, 2020 4 commits
  2. 01 Jul, 2020 1 commit
  3. 26 Jun, 2020 2 commits
    • Paul Howgego's avatar
      drm_hwcomposer: Fix invalid buffer_handle_t pointer · 3f17bc09
      Paul Howgego authored
      In Android 11, at boot time, I see the following sequence of
      calls from SurfaceFlinger that trigger this:
      
        // Composition type for layer is saved in DRM HWC Layer validated_type_
        validateDisplay()
      
        // Layer composition type saved in DRM HWC Layer sf_type_
        acceptDisplayChanges()
      
        // Composition type in Layer sf_type_ is now "client" so DRM HWC doesn't
        // update the Layer buffer pointer
        setLayerBuffer()
      
        // DRM HWC Layer sf_type_ is now changed back to "device"
        setLayerCompositionType()
      
        // DRM HWC iterates through the layers and finds that Layer composition
        // type in sf_type_ is "device"  so thinks it is fine to calls
        // importBuffer() but this Layer now has an invalid pointer as the
        // setLayerBuffer() was ignored.
        validateDisplay()
      
      Thus this patch, changes the logic to always update the
      buffer_handle_t pointer in setLayerBuffer regardless of
      composition type rather than keeping the invalid buffer_handle_t
      in the Layer obect. The composition type may be changed back to
      device composition by setLayerCompositionType at which point the
      Layer object needs to have saved the buffer_handle_t.
      
      Not sure how we could reproduce the same sequence of calls on
      another Android version.
      Signed-off-by: Paul Howgego's avatarPaul Howgego <paul.howgego@arm.com>
      [jstultz: Reword and add context from merge request to the commit message]
      Signed-off-by: John Stultz's avatarJohn Stultz <john.stultz@linaro.org>
      Change-Id: I88a11ee2fee742d6154a482455a8532a95e681d3
      3f17bc09
    • Andrii Chepurnyi's avatar
      drm_hwcomposer: Propagate PLATFORM_SDK_VERSION to cflags · a63d66c7
      Andrii Chepurnyi authored
      PLATFORM_SDK_VERSION is needed for already present
      code (GetDisplayIdentificationData/GetDisplayCapabilities),
      which implements some of the android.hardware.graphics.composer@2.3 API.
      Signed-off-by: Andrii Chepurnyi's avatarAndrii Chepurnyi <andrii_chepurnyi@epam.com>
      Signed-off-by: John Stultz's avatarJohn Stultz <john.stultz@linaro.org>
      Change-Id: I1a5019e9d8ae327db41f55cee0ba3636f913928f
      a63d66c7
  4. 14 Apr, 2020 1 commit
  5. 21 Feb, 2020 1 commit
  6. 20 Feb, 2020 1 commit
    • Peter Collingbourne's avatar
      drm_hwcomposer: Improve error messages. · c77052eb
      Peter Collingbourne authored
      - Don't negate errno before passing to strerror, at least on
        bionic this results in "Unknown error -x" instead of the actual
        error.
      - Fix another error message to print strerror(errno) instead of the
        returned fd which will always be -1.
      - Fix another error message to call strerror for consistency.
      Signed-off-by: Peter Collingbourne's avatarPeter Collingbourne <pcc@google.com>
      c77052eb
  7. 19 Feb, 2020 3 commits
  8. 11 Feb, 2020 1 commit
  9. 10 Feb, 2020 1 commit
  10. 04 Feb, 2020 1 commit
  11. 24 Jan, 2020 1 commit
  12. 16 Jan, 2020 2 commits
    • Roman Kovalivskyi's avatar
      drm_hwcomposer: Remove redundant hotplug call · 30957087
      Roman Kovalivskyi authored
      Initial hotplug state is reported back during callback registration,
      but during VTS tests we've noticed error that is caused by calling
      hotplug with same display twice.
      
      HandleInitialHotplugState calls hotplug function for each connected
      display, so it covers HWC_DISPLAY_PRIMARY too, therefore first call
      should be removed, as it is redundant and causes minor error.
      Signed-off-by: Roman Kovalivskyi's avatarRoman Kovalivskyi <roman.kovalivskyi@globallogic.com>
      30957087
    • Roman Kovalivskyi's avatar
      drm_hwcomposer: Add check to vsync routine to avoid crash on callback · 521a4c85
      Roman Kovalivskyi authored
      Vsync could be disabled during routine being running and this could
      potentially lead to crash on callback invocation. Crash happens if
      VSyncControl(false) was called when Routine has cached callback and
      unlocked mutex but haven't callback yet. At this point we can't be
      sure that callback is still valid so invoking it is incorrect
      behaviour.
      
      Second check if vsync is enabled drastically shortens window when we
      could go into invalid state, from the whole vblank invocation to
      several machine instructions between check and invocation.
      
      Please note that we can't check against cached value in this case,
      therefore operations on this flag should be atomic instead.
      Signed-off-by: Roman Kovalivskyi's avatarRoman Kovalivskyi <roman.kovalivskyi@globallogic.com>
      521a4c85
  13. 04 Jan, 2020 1 commit
  14. 19 Dec, 2019 1 commit
  15. 17 Dec, 2019 1 commit
    • Roman Stratiienko's avatar
      drm_hwcomposer: Choose client layer range to achieve minimal GPU load · b7b81cfb
      Roman Stratiienko authored
      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: default avatarRoman Stratiienko <roman.stratiienko@globallogic.com>
      b7b81cfb
  16. 16 Dec, 2019 2 commits
    • Roman Kovalivskyi's avatar
      drm_hwcomposer: Add simplistic SetColorTransform implementation · 12b91a35
      Roman Kovalivskyi authored
      VTS tests for SET_COLOR_TRANSFORM fails for now since
      SetColorTransform is marked as unsupported function. this commit tries
      to address this issue. We can't make complete implementation of those
      features for our platform for now, so we'd just save arguments for
      future use and force client composition if any color transformation is
      requested. This is perfectly acceptable way to pass VTS testcase for
      SET_COLOR_TRANSFORM.
      
      Commit da5839cf ("drm_hwcomposer: Add support for GetColorModes &
      SetCursorPosition") implements GetColorModes and SetCursorPosition
      simply by adding fields that store this values for future
      uses. Therefore we assume that it is okay to use this approach to at
      least support interface part.
      
      Please note that if transform hint is identity then no
      transformation should be applied. If hint is arbitrary matrix then
      given matrix should be applier after composition, though for now we'd
      just force client composition instead. This behavior is required by
      HAL interface as stated in
      hardware/interfaces/graphics/composer/2.1/IComposerClient.hal, line
      738 from repository
      https://android.googlesource.com/platform/hardware/interfaces, tag
      android-10.0.0_r14
      
      Please note that color transform matrix argument is an array that has
      16 elements by contract, as it is 4x4 matrix. This is why
      MATRIX_SIZE has such value.
      Signed-off-by: Roman Kovalivskyi's avatarRoman Kovalivskyi <roman.kovalivskyi@globallogic.com>
      12b91a35
    • Roman Kovalivskyi's avatar
      drm_hwcomposer: Add simplistic SetLayerColor implementation · bb37569e
      Roman Kovalivskyi authored
      VTS tests for SET_LAYER_COLOR fails for now since SetLayerColor is
      unsupported function. Tis commit tries to address this issue. We can't
      fully implement it for now, therefore simplistic implementation that
      just saves argument for future uses and satisfies the interface could
      be used instead, for now.
      
      Commit da5839cf ("drm_hwcomposer: Add support for GetColorModes &
      SetCursorPosition") implements GetColorModes and SetCursorPosition in
      the same fashion, simply by adding fields that store this values for
      future uses, therefore we assume that it is okay to use this approach
      here too.
      Signed-off-by: Roman Kovalivskyi's avatarRoman Kovalivskyi <roman.kovalivskyi@globallogic.com>
      bb37569e
  17. 09 Dec, 2019 1 commit
    • Vincent Donnefort's avatar
      drm_hwcomposer: Add refcount for GEM handle · f67c365d
      Vincent Donnefort authored
      The linux kernel doesn't provide reference counting for the handle
      returned by FD_TO_HANDLE ioctl. It means that if the same Gralloc buffer
      is imported twice, the first GEM_CLOSE will destroy the handle even if it
      is still in use by another import.
      
      Remedy this issue by doing the reference counting directly in the DRM
      generic platform support: ImportHandle() will increase the reference,
      while ReleaseHandle() will decrease and close it, if necessary.
      Signed-off-by: Vincent Donnefort's avatarVincent Donnefort <vincent.donnefort@arm.com>
      f67c365d
  18. 04 Dec, 2019 1 commit
    • Roman Stratiienko's avatar
      drm_hwcomposer: Introduce dumpsys metrics · 0d1a2cdb
      Roman Stratiienko authored
      To make optimal performance/power consumption ratio we want to use composing by
      dedicated hardware to merge as much as possible composition cases.
      We are going to continuously optimize and improve drm_hwcomposer HAL, that
      makes high demand on formal validation process.
      
      Introduce "pixel operation" definition. It should be in direct ratio with power
      consumption, but currently it roughly calculated as sum of pixels merged by
      each layer.
      In some future we should apply some average gains depending of operation type
      to calculate pixops more precisely. (e.g. scaling should take more pixops than
      blending, and blending should take more that copying, etc.).
      Using pixops could be very helpful when drm_hwc HAL have a choice which layer
      sets to merge by GPU, making possible minimal energy model based planning.
      
      Create statistics of the following events:
      1. Total frames count
      2. Total pixel operations
      3. Pixel operations validated to use GPU (CLIENT)
      4. Calculate composer efficiency: DEVICE/TOTAL operations ratio
      5. Failed atomic validation commits count
      6. Failed atomic presenting commits count
      
      Usage:
       - $ adb shell dumpsys SurfaceFlinger
      Statistics will be shown at the end of the dump in 2 forms:
      1. Since system launched
      2. Since last dumpsys command called
      
      Using statistics for the regression slope monitoring example:
      1. Boot the board without the change
      2. Use touch or keyboard (avoid using of mouse pointer) to do some predefined
      actions (open application, start video, etc.)
      3. Save the metrics
      4. Boot the board with the change
      5. Do exactly the same actions as in (2)
      6. Save the metrics
      7. Use metrics before and after change to indicate regression slope
      Signed-off-by: default avatarRoman Stratiienko <roman.stratiienko@globallogic.com>
      0d1a2cdb
  19. 03 Dec, 2019 1 commit
    • Matteo Franchin's avatar
      drm_hwcomposer: Fix returned fence in PresentDisplay · c56eede3
      Matteo Franchin authored
      DrmHwcTwo::HwcDisplay::PresentDisplay was always returning -1 as the
      present fence. This commits ensures the fence fd is correctly retrieved
      after doing the commit-frame operation. It also updates outdated logic
      that caused PresentDisplay to return the retire fence rather than the
      present fence.
      
      DrmHwcTwo::HwcDisplay::AddFenceToPresentFence is also changed so that
      it assumes it is given ownership of the file descriptor it receives as
      argument. This function was indeed called consistently with this
      behaviour, which meant the dup led to leakage of file descriptors.
      
      With the changes above this patch fixes a failure in the CTS test
      dEQP-VK.wsi.android.display_timing.fifo.display_timing (for example
      running Android 10 on HiKey960). The test failed with the error
      "Unexpectedly received invalid timestamp." reported multiple times in
      the logcat output.
      
      Change-Id: If662e5239895b8b0e2ea31fd99747855f901a427
      Signed-off-by: Matteo Franchin's avatarMatteo Franchin <matteo.franchin@arm.com>
      c56eede3
  20. 28 Nov, 2019 2 commits
  21. 27 Nov, 2019 1 commit
  22. 21 Nov, 2019 3 commits
  23. 20 Nov, 2019 1 commit
    • Roman Stratiienko's avatar
      drm_hwcomposer: Fix mixed layer composition · f2647231
      Roman Stratiienko authored
      Fix cases when mixed layer composition require non-device layer in the middle:
      
      '''
      Layer z_order - SF type    - validated type before - validated type fixed
                  0 - DEVICE     - CLIENT                - CLIENT
                  1 - DEVICE     - DEVICE                - CLIENT
                  2 - DEVICE     - DEVICE                - CLIENT
                  3 - SOLIDCOLOR - CLIENT                - CLIENT
                  4 - DEVICE     - DEVICE                - DEVICE
      '''
      
      In such composition SF will merge layers 0 and 3 and hwcomposer will
      merge <SF>,1,2,4 that results incorrect merging order.
      
      Issue was observed on the rcar3 (imagination importer), db845c and allwinner H3
      (Generic importer) platforms.
      Reproduces with compositions that requires 'cursor' or 'dim' layers.
      How to reproduce:
       1. Connect USB mouse when on home screen, you should see mouse cursor
          under icons (Tested with Launcher3QuickStep desktop)
       2. Go to Settings -> WIFI -> Connect to the AP, then you should see
          password dialog under AP list.
      
      Solution:
      1. Mark intermediate layers as CLIENT to ensure CLIENT section is in range
      from bottom layer to most top CLIENT layer.
      
      2. Use this layer composition to validate if DRM can handle it.
      Signed-off-by: default avatarRoman Stratiienko <roman.stratiienko@globallogic.com>
      f2647231
  24. 11 Nov, 2019 1 commit
    • Roman Stratiienko's avatar
      drm_hwcomposer: Add Imagination platform support · e3ed48d7
      Roman Stratiienko authored
      External Android.bp file should be created in order to build this module:
      ```
      cc_library_shared {
          name: "hwcomposer.drm_imagination",
          defaults: ["hwcomposer.drm_defaults"],
          srcs: [":drm_hwcomposer_platformimagination"],
          whole_static_libs: ["drm_hwcomposer"],
          shared_libs: ["libion"],
          include_dirs: [
              "path/to/imgtec/include/files",
          ],
      }
      ```
      libion is needed to make ion.h header visible `linux/ion.h`.
      Signed-off-by: default avatarRoman Stratiienko <roman.stratiienko@globallogic.com>
      e3ed48d7
  25. 06 Nov, 2019 1 commit
  26. 22 Oct, 2019 4 commits