sdm: Do not allow decimation on UBWC framebuffer
MDP hardware cannot apply decimation on UBWC tiled framebuffer.
CRs-Fixed: 867832
Change-Id: I6f2f37955ac9e2b4a6d7888c146930dd3863f385
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index 6e9a14d..784597d 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -386,7 +386,7 @@
DisplayError CompManager::ValidateScaling(const LayerRect &crop, const LayerRect &dst,
bool rotate90) {
- return resource_intf_->ValidateScaling(crop, dst, rotate90);
+ return resource_intf_->ValidateScaling(crop, dst, rotate90, Debug::IsUbwcTiledFrameBuffer());
}
DisplayError CompManager::ValidateCursorPosition(Handle display_ctx, HWLayers *hw_layers,
diff --git a/sdm/libs/core/resource_default.cpp b/sdm/libs/core/resource_default.cpp
index f664c06..ab66ac8 100644
--- a/sdm/libs/core/resource_default.cpp
+++ b/sdm/libs/core/resource_default.cpp
@@ -554,7 +554,8 @@
return error;
}
- error = ValidateScaling(src_rect, dst_rect, false);
+ bool ubwc_tiled = IsUBWCFormat(layer.input_buffer->format);
+ error = ValidateScaling(src_rect, dst_rect, false, ubwc_tiled);
if (error != kErrorNone) {
return error;
}
@@ -702,7 +703,7 @@
return kErrorNone;
}
-DisplayError ResourceDefault::ValidatePipeParams(HWPipeInfo *pipe_info) {
+DisplayError ResourceDefault::ValidatePipeParams(HWPipeInfo *pipe_info, bool ubwc_tiled) {
DisplayError error = kErrorNone;
const LayerRect &src_rect = pipe_info->src_roi;
@@ -713,7 +714,7 @@
return error;
}
- error = ValidateScaling(src_rect, dst_rect, false);
+ error = ValidateScaling(src_rect, dst_rect, false, ubwc_tiled);
if (error != kErrorNone) {
return error;
}
@@ -722,7 +723,7 @@
}
DisplayError ResourceDefault::ValidateScaling(const LayerRect &crop, const LayerRect &dst,
- bool rotate90) {
+ bool rotate90, bool ubwc_tiled) {
DisplayError error = kErrorNone;
float scale_x = 1.0f;
@@ -733,7 +734,7 @@
return error;
}
- error = ValidateDownScaling(scale_x, scale_y);
+ error = ValidateDownScaling(scale_x, scale_y, ubwc_tiled);
if (error != kErrorNone) {
return error;
}
@@ -746,11 +747,12 @@
return kErrorNone;
}
-DisplayError ResourceDefault::ValidateDownScaling(float scale_x, float scale_y) {
+DisplayError ResourceDefault::ValidateDownScaling(float scale_x, float scale_y, bool ubwc_tiled) {
if ((UINT32(scale_x) > 1) || (UINT32(scale_y) > 1)) {
float max_scale_down = FLOAT(hw_res_info_.max_scale_down);
- if (hw_res_info_.has_decimation) {
+ // MDP H/W cannot apply decimation on UBWC tiled framebuffer
+ if (!ubwc_tiled && hw_res_info_.has_decimation) {
max_scale_down *= FLOAT(kMaxDecimationDownScaleRatio);
}
@@ -867,7 +869,8 @@
return kErrorNotSupported;
}
- error = ValidatePipeParams(left_pipe);
+ bool ubwc_tiled = IsUBWCFormat(layer.input_buffer->format);
+ error = ValidatePipeParams(left_pipe, ubwc_tiled);
if (error != kErrorNone) {
goto PipeConfigExit;
}
@@ -876,7 +879,7 @@
// Make sure the left and right ROI are conjunct
right_pipe->src_roi.left = left_pipe->src_roi.right;
right_pipe->dst_roi.left = left_pipe->dst_roi.right;
- error = ValidatePipeParams(right_pipe);
+ error = ValidatePipeParams(right_pipe, ubwc_tiled);
}
PipeConfigExit:
@@ -915,4 +918,17 @@
return kErrorNotSupported;
}
+bool ResourceDefault::IsUBWCFormat(LayerBufferFormat format) {
+ switch (format) {
+ case kFormatRGBA8888Ubwc:
+ case kFormatRGBX8888Ubwc:
+ case kFormatRGB565Ubwc:
+ case kFormatYCbCr420SPVenusUbwc:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
} // namespace sdm
diff --git a/sdm/libs/core/resource_default.h b/sdm/libs/core/resource_default.h
index a19022d..990e102 100644
--- a/sdm/libs/core/resource_default.h
+++ b/sdm/libs/core/resource_default.h
@@ -51,7 +51,7 @@
virtual void Purge(Handle display_ctx);
virtual DisplayError SetMaxMixerStages(Handle display_ctx, uint32_t max_mixer_stages);
virtual DisplayError ValidateScaling(const LayerRect &crop, const LayerRect &dst,
- bool rotate90);
+ bool rotate90, bool ubwc_tiled);
DisplayError ValidateCursorConfig(Handle display_ctx, const Layer& layer, bool is_top);
DisplayError ValidateCursorPosition(Handle display_ctx, HWLayers *hw_layers, int x, int y);
@@ -130,8 +130,8 @@
bool CalculateCropRects(const LayerRect &scissor, LayerRect *crop, LayerRect *dst);
DisplayError ValidateLayerDimensions(const Layer &layer);
DisplayError ValidateDimensions(const LayerRect &crop, const LayerRect &dst);
- DisplayError ValidatePipeParams(HWPipeInfo *pipe_info);
- DisplayError ValidateDownScaling(float scale_x, float scale_y);
+ DisplayError ValidatePipeParams(HWPipeInfo *pipe_info, bool ubwc_tiled);
+ DisplayError ValidateDownScaling(float scale_x, float scale_y, bool ubwc_tiled);
DisplayError ValidateUpScaling(float scale_x, float scale_y);
DisplayError GetScaleFactor(const LayerRect &crop, const LayerRect &dst, float *scale_x,
float *scale_y);
@@ -141,6 +141,7 @@
DisplayError AlignPipeConfig(const Layer &layer, HWPipeInfo *left_pipe, HWPipeInfo *right_pipe);
void ResourceStateLog(void);
DisplayError CalculateDecimation(float downscale, uint8_t *decimation);
+ bool IsUBWCFormat(LayerBufferFormat format);
Locker locker_;
HWResourceInfo hw_res_info_;
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index 4df63d9..33f94b9 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -120,5 +120,18 @@
return (value == 1);
}
+bool Debug::IsUbwcTiledFrameBuffer() {
+ int ubwc_disabled = 0;
+ int ubwc_framebuffer = 0;
+
+ debug_.debug_handler_->GetProperty("debug.gralloc.gfx_ubwc_disable", &ubwc_disabled);
+
+ if (!ubwc_disabled) {
+ debug_.debug_handler_->GetProperty("debug.gralloc.enable_fb_ubwc", &ubwc_framebuffer);
+ }
+
+ return (ubwc_framebuffer == 1);
+}
+
} // namespace sdm