summaryrefslogtreecommitdiff
path: root/libqdutils
diff options
context:
space:
mode:
authorSaurabh Shah <saurshah@codeaurora.org>2016-10-24 17:16:01 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-28 07:23:10 -0800
commitc5b2b70479378a295590179676e6e276256358a0 (patch)
tree8bdfc0bf61ee7f6eade927fb4bc3a7192141c1cc /libqdutils
parent2bace11fc46d0d3f4ad138174f7bfd3ca041b5b7 (diff)
downloaddisplay-c5b2b70479378a295590179676e6e276256358a0.tar.gz
gralloc/qdutils: Remove unused gralloc code, add driver type check
Remove unused code related to macro tiling from galloc and qdutils. Add API to check for driver type and query caps based on driver. Change-Id: I36cfa5529395c69deb886080be1c904ff5c9ad15 CRs-fixed: 1109207
Diffstat (limited to 'libqdutils')
-rw-r--r--libqdutils/qd_utils.cpp48
-rw-r--r--libqdutils/qd_utils.h7
2 files changed, 50 insertions, 5 deletions
diff --git a/libqdutils/qd_utils.cpp b/libqdutils/qd_utils.cpp
index b84ae870..170b1d87 100644
--- a/libqdutils/qd_utils.cpp
+++ b/libqdutils/qd_utils.cpp
@@ -27,6 +27,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <unistd.h>
#include "qd_utils.h"
namespace qdutils {
@@ -81,7 +82,31 @@ static int getExternalNode(const char *type) {
return -1;
}
-int querySDEInfo(HWQueryType type, int *value) {
+static int querySDEInfoDRM(HWQueryType type, int *value) {
+ char property[PROPERTY_VALUE_MAX] = {0};
+
+ // TODO(user): If future targets don't support WB UBWC, add separate
+ // properties in target specific system.prop and have clients like WFD
+ // directly rely on those.
+ switch(type) {
+ case HAS_UBWC:
+ case HAS_WB_UBWC: // WFD stack still uses this
+ *value = 1;
+ property_get("debug.gralloc.gfx_ubwc_disable", property, "0");
+ if(!(strncmp(property, "1", PROPERTY_VALUE_MAX)) ||
+ !(strncmp(property, "true", PROPERTY_VALUE_MAX))) {
+ *value = 0;
+ }
+ break;
+ default:
+ ALOGE("Invalid query type %d", type);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int querySDEInfoFB(HWQueryType type, int *value) {
FILE *fileptr = NULL;
const char *featureName;
char stringBuffer[MAX_STRING_LENGTH];
@@ -90,9 +115,6 @@ int querySDEInfo(HWQueryType type, int *value) {
char *tokens[maxCount] = { NULL };
switch(type) {
- case HAS_MACRO_TILE:
- featureName = "tile_format";
- break;
case HAS_UBWC:
featureName = "ubwc";
break;
@@ -134,6 +156,18 @@ int querySDEInfo(HWQueryType type, int *value) {
return 0;
}
+int querySDEInfo(HWQueryType type, int *value) {
+ if (!value) {
+ return -EINVAL;
+ }
+
+ if (getDriverType() == DriverType::DRM) {
+ return querySDEInfoDRM(type, value);
+ }
+
+ return querySDEInfoFB(type, value);
+}
+
int getHDMINode(void) {
return getExternalNode("dtv panel");
}
@@ -241,4 +275,10 @@ int getDPTestConfig(uint32_t *panelBpp, uint32_t *patternType) {
return 0;
}
+DriverType getDriverType() {
+ const char *fb_caps = "/sys/devices/virtual/graphics/fb0/mdp/caps";
+ // 0 - File exists
+ return access(fb_caps, F_OK) ? DriverType::DRM : DriverType::FB;
+}
+
}; //namespace qdutils
diff --git a/libqdutils/qd_utils.h b/libqdutils/qd_utils.h
index 5e8d1bf3..7b3ae40a 100644
--- a/libqdutils/qd_utils.h
+++ b/libqdutils/qd_utils.h
@@ -47,7 +47,6 @@
namespace qdutils {
enum HWQueryType {
- HAS_MACRO_TILE = 0,
HAS_UBWC = 1,
HAS_WB_UBWC = 2
};
@@ -65,5 +64,11 @@ int getHDMINode(void);
bool isDPConnected();
int getDPTestConfig(uint32_t *panelBpp, uint32_t *patternType);
+enum class DriverType {
+ FB = 0,
+ DRM,
+};
+DriverType getDriverType();
+
}; //namespace qdutils
#endif