Skip to content

[WIP/RFC] drm_hwcomposer: Add checking if we can import a buffer

Alexey Firago requested to merge afirago/drm-hwcomposer:can-import-buffer into master

Current ValidateDisplay logic (at least on platformhisi) has number of minor issues:

  • On bootanimation stage it keeps spamming logcat with E hwc-drm-display-composition: Planner failed provisioning planes ret=-22 This is because buffer was allocated without GRALLOC_USAGE_HW_FB, was fake-imported and error was generated on plane provisioning stage here This error is generated and forces client composition only if there was only 1 layer
  • In case when there are more than one layer to compose/provision, we rely on logic here to skip fake-imported buffers and send them to client composition. This logic assigns set_validated_type() to HWC2::Composition::Device until we run out of avail_planes
  • This logic is failing on the following case - on Android 8, on a platform similar to hikey (Xilinx MPSoC using Mali Utgard gralloc) we have 8 DRM planes. 1 primary plane which supports RGB formats and 7 overlay planes for video (supports only NV12). After boot, on Android Home Screen Surfaceflinger asks to compose 4 layers (sf_type()==HWC2::Composition::Device). All of them without GRALLOC_USAGE_HW_FB, so we are fake-importing all of them and not generating error (since initial_layers>1). Since avail_planes==8 and we have 4 layers, we are setting validated_type to HWC2::Composition::Device for all 4 layers. This results in nothing displayed on the screen.

Proposal to handle this situation is to add CanImportBuffer() function to the Importer interface. Platform specific importer should check in this function if it can import given buffer_handle_t. For example platformhisi will return false for buffers without GRALLOC_USAGE_HW_FB.

This function should be used on ValidateDisplay step (and CreateComposition(true)) to avoid the need of 'fake-importing' of buffers. Buffers which cannot be imported, will be sent to client composition explicitly.

Please comment.

Merge request reports