qdutils: Query MDP caps for UBWC feature
- querySDEInfo queries MDP caps to check if UBWC is supported on H/W.
- Gralloc calls querySDEInfo api to check if UBWC feature is enabled
by MDP driver.
CRs-Fixed: 1013911
Change-Id: I9114c4d8286842f19619302484ee4690c59fcb29
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 147b9cb..581d112 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -100,14 +100,10 @@
//------------- MDPCapabilityInfo-----------------------//
MDPCapabilityInfo :: MDPCapabilityInfo() {
- isMacroTileSupported = false;
qdutils::querySDEInfo(HAS_MACRO_TILE, &isMacroTileSupported);
+ qdutils::querySDEInfo(HAS_UBWC, &isUBwcSupported);
}
-int MDPCapabilityInfo :: isMacroTilingSupportedByMDP(){
- return isMacroTileSupported;
- }
-
//------------- AdrenoMemInfo-----------------------//
AdrenoMemInfo::AdrenoMemInfo()
{
@@ -938,20 +934,23 @@
static bool isUBwcSupported(int format)
{
- // Existing HAL formats with UBWC support
- switch(format)
- {
- case HAL_PIXEL_FORMAT_BGR_565:
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_RGBX_8888:
- case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
- case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
- case HAL_PIXEL_FORMAT_RGBA_1010102:
- case HAL_PIXEL_FORMAT_RGBX_1010102:
- return true;
- default:
- return false;
+ if (MDPCapabilityInfo::getInstance().isUBwcSupportedByMDP()) {
+ // Existing HAL formats with UBWC support
+ switch(format)
+ {
+ case HAL_PIXEL_FORMAT_BGR_565:
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
+ return true;
+ default:
+ break;
+ }
}
+ return false;
}
bool isUBwcEnabled(int format, int usage)
diff --git a/libgralloc/gr.h b/libgralloc/gr.h
index e7d449e..5fe1bdb 100644
--- a/libgralloc/gr.h
+++ b/libgralloc/gr.h
@@ -201,7 +201,9 @@
class MDPCapabilityInfo : public android::Singleton <MDPCapabilityInfo>
{
- int isMacroTileSupported;
+ int isMacroTileSupported = 0;
+ int isUBwcSupported = 0;
+
public:
MDPCapabilityInfo();
/*
@@ -210,8 +212,14 @@
* @return 1 : supported
* 0 : not supported
*/
- int isMacroTilingSupportedByMDP();
-
+ int isMacroTilingSupportedByMDP() { return isMacroTileSupported; }
+ /*
+ * Function to return whether MDP supports UBWC feature
+ *
+ * @return 1 : supported
+ * 0 : not supported
+ */
+ int isUBwcSupportedByMDP() { return isUBwcSupported; }
};
#endif /* GR_H_ */
diff --git a/libqdutils/qd_utils.cpp b/libqdutils/qd_utils.cpp
index 254df30..6453b58 100644
--- a/libqdutils/qd_utils.cpp
+++ b/libqdutils/qd_utils.cpp
@@ -62,6 +62,10 @@
featureName = "tile_format";
break;
+ case HAS_UBWC:
+ featureName = "ubwc";
+ break;
+
default:
ALOGE("Invalid query type %d", type);
return -EINVAL;
diff --git a/libqdutils/qd_utils.h b/libqdutils/qd_utils.h
index 2b9ca74..0392e05 100644
--- a/libqdutils/qd_utils.h
+++ b/libqdutils/qd_utils.h
@@ -48,6 +48,7 @@
enum HWQueryType {
HAS_MACRO_TILE = 0,
+ HAS_UBWC = 1,
};
enum {