summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykhailo Sopiha <mykhailo.sopiha@linaro.org>2019-07-08 18:28:56 +0300
committerMykhailo Sopiha <mykhailo.sopiha@linaro.org>2019-07-11 19:50:53 +0300
commit1693bc3adb0a0170fb3728959eb05cdb17336cab (patch)
tree27fb781fd7c85fc4a5b89b2e07377636268d3b98
parentb67d049c870c2b82c2883b0c10a07bc29c4cd598 (diff)
drm_hwcomposer: add non hwfb import filter
This patch adds non hwfb filter to generic drm importer with additional property "hwc.drm.exclude_non_hwfb_imports". By default this is set to false, and no logic changes are happening. On setting this option to 1 the filter is being activated on Init() function. Change-Id: I7a718a66cb6214c051335a4589d60b5833e5c545 Signed-off-by: Mykhailo Sopiha <mykhailo.sopiha@linaro.org>
-rw-r--r--platform/platformdrmgeneric.cpp14
-rw-r--r--platform/platformdrmgeneric.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/platform/platformdrmgeneric.cpp b/platform/platformdrmgeneric.cpp
index 2fcbe40..9ac601f 100644
--- a/platform/platformdrmgeneric.cpp
+++ b/platform/platformdrmgeneric.cpp
@@ -24,6 +24,7 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include <cutils/properties.h>
#include <gralloc_handle.h>
#include <hardware/gralloc.h>
#include <log/log.h>
@@ -47,7 +48,8 @@ Importer *Importer::CreateInstance(DrmDevice *drm) {
}
#endif
-DrmGenericImporter::DrmGenericImporter(DrmDevice *drm) : drm_(drm) {
+DrmGenericImporter::DrmGenericImporter(DrmDevice *drm)
+ : drm_(drm), exclude_non_hwfb_(false) {
}
DrmGenericImporter::~DrmGenericImporter() {
@@ -64,6 +66,10 @@ int DrmGenericImporter::Init() {
ALOGI("Using %s gralloc module: %s\n", gralloc_->common.name,
gralloc_->common.author);
+ char exclude_non_hwfb_prop[PROPERTY_VALUE_MAX];
+ property_get("hwc.drm.exclude_non_hwfb_imports", exclude_non_hwfb_prop, "0");
+ exclude_non_hwfb_ = static_cast<bool>(strncmp(exclude_non_hwfb_prop, "0", 1));
+
return 0;
}
@@ -168,6 +174,12 @@ int DrmGenericImporter::ReleaseBuffer(hwc_drm_bo_t *bo) {
bool DrmGenericImporter::CanImportBuffer(buffer_handle_t handle) {
if (handle == NULL)
return false;
+
+ if (exclude_non_hwfb_) {
+ gralloc_handle_t *hnd = gralloc_handle(handle);
+ return hnd->usage & GRALLOC_USAGE_HW_FB;
+ }
+
return true;
}
diff --git a/platform/platformdrmgeneric.h b/platform/platformdrmgeneric.h
index c6d2be6..88bff5f 100644
--- a/platform/platformdrmgeneric.h
+++ b/platform/platformdrmgeneric.h
@@ -43,6 +43,7 @@ class DrmGenericImporter : public Importer {
private:
const gralloc_module_t *gralloc_;
+ bool exclude_non_hwfb_;
};
} // namespace android