hwc: Add support for Macro Tile feature
Macro tile is enabled only if all the conditions are met:
1. GPU hardware should support Macro Tiling.
2. MDSS hardware should support Macro Tiling.
3. USAGE flags shouldnt contain GRALLOC_USAGE_SW_READ_OFTEN and
GRALLOC_USAGE_SW_WRITE_OFTEN.
4. RGB 16bit and 32bit formats.
5. persist.hwc.macro_tile_enable flag should be enabled.
PRIV_FLAGS_TILE_RENDERED flag is added to indicate whether the layer
is rendered/composited in Macro Tiling or Linear format.
Change-Id: Ie3139839c84d76c5d1a2300f33910a09eb7336f4
diff --git a/liboverlay/overlayUtils.cpp b/liboverlay/overlayUtils.cpp
index 1377182..30de1db 100644
--- a/liboverlay/overlayUtils.cpp
+++ b/liboverlay/overlayUtils.cpp
@@ -36,6 +36,7 @@
#include "overlayUtils.h"
#include "mdpWrapper.h"
#include "mdp_version.h"
+#include <hardware/hwcomposer_defs.h>
// just a helper static thingy
namespace {
@@ -145,6 +146,34 @@
return -1;
}
+// This function returns corresponding tile format
+// MDSS support following RGB tile formats
+// 32 bit formats
+// 16 bit formats
+int getMdpFormat(int format, bool tileEnabled)
+{
+ if(!tileEnabled) {
+ return getMdpFormat(format);
+ }
+ switch (format) {
+ case HAL_PIXEL_FORMAT_RGBA_8888 :
+ return MDP_RGBA_8888_TILE;
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ return MDP_RGBX_8888_TILE;
+ case HAL_PIXEL_FORMAT_RGB_565:
+ // Currenty Driver doesnt support 565 tile format
+ return MDP_RGB_565;
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ return MDP_BGRA_8888_TILE;
+ case HAL_PIXEL_FORMAT_BGRX_8888:
+ return MDP_BGRX_8888_TILE;
+ default:
+ return getMdpFormat(format);
+ }
+}
+
+
+
//Takes mdp format as input and translates to equivalent HAL format
//Refer to graphics.h, gralloc_priv.h, msm_mdp.h for formats.
int getHALFormat(int mdpFormat) {