Merge "sdm: Fix memory leaks." into dev-1.0
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 37e83bc..dcf2ee8 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -483,7 +483,7 @@
case GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE:
{
private_handle_t* hnd = va_arg(args, private_handle_t*);
- bool *enable = va_arg(args, bool*);
+ uint32_t *enable = va_arg(args, uint32_t*);
if (private_handle_t::validate(hnd)) {
return res;
}
diff --git a/libqdutils/qdMetaData.cpp b/libqdutils/qdMetaData.cpp
index 635e676..79daa14 100644
--- a/libqdutils/qdMetaData.cpp
+++ b/libqdutils/qdMetaData.cpp
@@ -85,7 +85,7 @@
data->igc = *((IGC_t *)param);
break;
case SET_SINGLE_BUFFER_MODE:
- data->isSingleBufferMode = *((bool *)param);
+ data->isSingleBufferMode = *((uint32_t *)param);
break;
default:
ALOGE("Unknown paramType %d", paramType);
diff --git a/libqdutils/qdMetaData.h b/libqdutils/qdMetaData.h
index a927f75..a1d9350 100644
--- a/libqdutils/qdMetaData.h
+++ b/libqdutils/qdMetaData.h
@@ -78,7 +78,7 @@
uint32_t linearFormat;
/* Set by graphics to indicate that this buffer will be written to but not
* swapped out */
- bool isSingleBufferMode;
+ uint32_t isSingleBufferMode;
};
enum DispParamType {
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index d3fc1f5..0416daa 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -50,6 +50,7 @@
kHDMI, //!< HDMI physical display which is generally detachable.
kVirtual, //!< Contents would be rendered into the output buffer provided by the client
//!< e.g. wireless display.
+ kDisplayMax,
};
/*! @brief This enum represents states of a display device.
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index 164d438..ab69041 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -101,6 +101,7 @@
bool has_rotator_downscale = false;
bool has_non_scalar_rgb = false;
bool is_src_split = false;
+ bool perf_calc = false;
void Reset() { *this = HWResourceInfo(); }
};
@@ -264,7 +265,9 @@
struct HWLayers {
HWLayersInfo info;
HWLayerConfig config[kMaxSDELayers];
- float output_compression;
+ float output_compression = 1.0f;
+ uint32_t bandwidth = 0;
+ uint32_t clock = 0;
};
struct HWDisplayAttributes : DisplayConfigVariableInfo {
diff --git a/sdm/include/utils/rect.h b/sdm/include/utils/rect.h
index 91d70c2..c198645 100644
--- a/sdm/include/utils/rect.h
+++ b/sdm/include/utils/rect.h
@@ -42,7 +42,6 @@
void Log(DebugTag debug_tag, const char *prefix, const LayerRect &roi);
void Normalize(const uint32_t &align_x, const uint32_t &align_y, LayerRect *rect);
LayerRect Union(const LayerRect &rect1, const LayerRect &rect2);
- LayerRect Union(const LayerRectArray &rects);
LayerRect Intersection(const LayerRect &rect1, const LayerRect &rect2);
LayerRect Subtract(const LayerRect &rect1, const LayerRect &rect2);
LayerRect Reposition(const LayerRect &rect1, const int &x_offset, const int &y_offset);
diff --git a/sdm/libs/core/fb/hw_info.cpp b/sdm/libs/core/fb/hw_info.cpp
index 7a61fe7..b9a6669 100644
--- a/sdm/libs/core/fb/hw_info.cpp
+++ b/sdm/libs/core/fb/hw_info.cpp
@@ -158,6 +158,8 @@
hw_resource->is_src_split = true;
} else if (!strncmp(tokens[i], "non_scalar_rgb", strlen("non_scalar_rgb"))) {
hw_resource->has_non_scalar_rgb = true;
+ } else if (!strncmp(tokens[i], "perf_calc", strlen("perf_calc"))) {
+ hw_resource->perf_calc = true;
}
}
}
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index c51f17d..1b28cfb 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -1338,7 +1338,9 @@
if (meta_data->operation & SET_SINGLE_BUFFER_MODE) {
layer->flags.single_buffer = meta_data->isSingleBufferMode;
- layer_stack_.flags.single_buffered_layer_present = meta_data->isSingleBufferMode;
+ // Graphics can set this operation on all types of layers including FB and set the actual value
+ // to 0. To protect against SET operations of 0 value, we need to do a logical OR.
+ layer_stack_.flags.single_buffered_layer_present |= meta_data->isSingleBufferMode;
}
return kErrorNone;
diff --git a/sdm/libs/utils/rect.cpp b/sdm/libs/utils/rect.cpp
index e120287..e756464 100644
--- a/sdm/libs/utils/rect.cpp
+++ b/sdm/libs/utils/rect.cpp
@@ -138,16 +138,6 @@
return res;
}
-LayerRect Union(const LayerRectArray &rects) {
- LayerRect res;
-
- for (uint32_t i = 0; i < rects.count; i++) {
- res = Union(rects.rect[i], res);
- }
-
- return res;
-}
-
void SplitLeftRight(const LayerRect &in_rect, uint32_t split_count, uint32_t align_x,
bool flip_horizontal, LayerRect *out_rects) {
LayerRect rect_temp = in_rect;