diff options
author | Sushil Chauhan <sushilchauhan@codeaurora.org> | 2018-05-23 15:25:52 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-05-24 10:19:51 -0700 |
commit | 6a2813e96d567c5c9fdfb2d25534d9d4c2fdaab9 (patch) | |
tree | d17a32e3829a50e09c5bae6058da6a65a88499f6 /sdm/libs/core/drm | |
parent | 74bfd05b0bee6f0dbd951dd3dc731343bc745170 (diff) | |
download | display-6a2813e96d567c5c9fdfb2d25534d9d4c2fdaab9.tar.gz |
sdm: Clear fb_id map if it exceeds the size limit
Clear the fb_id map of SDM HW layer, if it exceeds the size limit.
It is required for cases like pre-rotation where new buffer handles
are allocated and new unique handle ids are used on same HWC layer
for consecutive draw cycles involving device rotations.
CRs-Fixed: 2247747
Change-Id: Iec71c42572f589717ad8f5677f84ff16e0aaaf01
Diffstat (limited to 'sdm/libs/core/drm')
-rw-r--r-- | sdm/libs/core/drm/hw_device_drm.cpp | 9 | ||||
-rw-r--r-- | sdm/libs/core/drm/hw_device_drm.h | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp index adb7b95d..aa318be3 100644 --- a/sdm/libs/core/drm/hw_device_drm.cpp +++ b/sdm/libs/core/drm/hw_device_drm.cpp @@ -300,9 +300,10 @@ void HWDeviceDRM::Registry::MapBufferToFbId(Layer* layer, LayerBuffer* buffer) { } uint64_t handle_id = buffer->handle_id; + bool legacy_path = !handle_id || disable_fbid_cache_; - if (!handle_id || disable_fbid_cache_) { - // Legacy: Remove & Create fb_id in each frame + if (legacy_path || (layer->buffer_map->buffer_map.size() > fbid_cache_limit_)) { + // Clear fb_id map in each frame in legacy path or if the map size exceeds limit. layer->buffer_map->buffer_map.clear(); } @@ -325,8 +326,8 @@ void HWDeviceDRM::Registry::MapOutputBufferToFbId(LayerBuffer *output_buffer) { uint64_t handle_id = output_buffer->handle_id; - if (!handle_id || disable_fbid_cache_) { - // Legacy: Remove & Create fb_id in each frame + if (!handle_id || disable_fbid_cache_ || (output_buffer_map_.size() > fbid_cache_limit_)) { + // Clear output buffer map in each frame in legacy path or if the map size exceeds limit. output_buffer_map_.clear(); } diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h index 203b6bb6..728b47c5 100644 --- a/sdm/libs/core/drm/hw_device_drm.h +++ b/sdm/libs/core/drm/hw_device_drm.h @@ -157,6 +157,7 @@ class HWDeviceDRM : public HWInterface { bool disable_fbid_cache_ = false; std::unordered_map<uint64_t, std::shared_ptr<LayerBufferObject>> output_buffer_map_ {}; BufferAllocator *buffer_allocator_ = {}; + const uint8_t fbid_cache_limit_ = 16; }; protected: |