summaryrefslogtreecommitdiff
path: root/sdm/libs/core
diff options
context:
space:
mode:
authorSushil Chauhan <sushilchauhan@codeaurora.org>2018-06-04 13:19:00 -0700
committerSushil Chauhan <sushilchauhan@codeaurora.org>2018-06-04 17:18:21 -0700
commit11509b77dcbb9470dc9ab1dd122bee78a55f84ae (patch)
tree78e471dbda481ec53bd72693cfbcd67707e88035 /sdm/libs/core
parent90e659a257c1569a6f81a7f732d65cd6fafa6054 (diff)
downloaddisplay-11509b77dcbb9470dc9ab1dd122bee78a55f84ae.tar.gz
sdm: Reduce the fb_id cache limit for UI layers
Reduce the fb_id cache limit for UI layers to 3 and for Rotator use cases to 2. This is required to reduce orphaned allocations in pre-rotation use cases. CRs-Fixed: 2253973 Change-Id: I3989c0179d5a97b596605dd5405b89abbba5c509
Diffstat (limited to 'sdm/libs/core')
-rw-r--r--sdm/libs/core/drm/hw_device_drm.cpp39
-rw-r--r--sdm/libs/core/drm/hw_device_drm.h6
2 files changed, 30 insertions, 15 deletions
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index aa318be3..aee7cae3 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -258,9 +258,11 @@ void HWDeviceDRM::Registry::Register(HWLayers *hw_layers) {
LayerBuffer *input_buffer = &layer.input_buffer;
HWRotatorSession *hw_rotator_session = &hw_layers->config[i].hw_rotator_session;
HWRotateInfo *hw_rotate_info = &hw_rotator_session->hw_rotate_info[0];
+ fbid_cache_limit_ = input_buffer->flags.video ? VIDEO_FBID_LIMIT : UI_FBID_LIMIT;
if (hw_rotator_session->mode == kRotatorOffline && hw_rotate_info->valid) {
input_buffer = &hw_rotator_session->output_buffer;
+ fbid_cache_limit_ = ROTATOR_FBID_LIMIT;
}
MapBufferToFbId(&layer, input_buffer);
@@ -300,16 +302,20 @@ void HWDeviceDRM::Registry::MapBufferToFbId(Layer* layer, LayerBuffer* buffer) {
}
uint64_t handle_id = buffer->handle_id;
- bool legacy_path = !handle_id || disable_fbid_cache_;
-
- 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.
+ if (!handle_id || disable_fbid_cache_) {
+ // In legacy path, clear fb_id map in each frame.
layer->buffer_map->buffer_map.clear();
- }
+ } else {
- if (layer->buffer_map->buffer_map.find(handle_id) != layer->buffer_map->buffer_map.end()) {
- // Found fb_id for given handle_id key
- return;
+ if (layer->buffer_map->buffer_map.find(handle_id) != layer->buffer_map->buffer_map.end()) {
+ // Found fb_id for given handle_id key
+ return;
+ }
+
+ if (layer->buffer_map->buffer_map.size() >= fbid_cache_limit_) {
+ // Clear fb_id map, if the size reaches cache limit.
+ layer->buffer_map->buffer_map.clear();
+ }
}
uint32_t fb_id = 0;
@@ -325,14 +331,19 @@ void HWDeviceDRM::Registry::MapOutputBufferToFbId(LayerBuffer *output_buffer) {
}
uint64_t handle_id = output_buffer->handle_id;
-
- 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.
+ if (!handle_id || disable_fbid_cache_) {
+ // In legacy path, clear output buffer map in each frame.
output_buffer_map_.clear();
- }
+ } else {
- if (output_buffer_map_.find(handle_id) != output_buffer_map_.end()) {
- return;
+ if (output_buffer_map_.find(handle_id) != output_buffer_map_.end()) {
+ return;
+ }
+
+ if (output_buffer_map_.size() >= UI_FBID_LIMIT) {
+ // Clear output buffer map, if the size reaches cache limit.
+ output_buffer_map_.clear();
+ }
}
uint32_t fb_id = 0;
diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h
index 728b47c5..9caa0955 100644
--- a/sdm/libs/core/drm/hw_device_drm.h
+++ b/sdm/libs/core/drm/hw_device_drm.h
@@ -44,6 +44,10 @@
#define IOCTL_LOGE(ioctl, type) \
DLOGE("ioctl %s, device = %d errno = %d, desc = %s", #ioctl, type, errno, strerror(errno))
+#define UI_FBID_LIMIT 3
+#define VIDEO_FBID_LIMIT 16
+#define ROTATOR_FBID_LIMIT 2
+
namespace sdm {
class HWInfoInterface;
@@ -157,7 +161,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;
+ uint8_t fbid_cache_limit_ = UI_FBID_LIMIT;
};
protected: