Merge "overlay: Reset pipes on config failure"
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 677bb4e..bcae381 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -182,6 +182,12 @@
IonController::IonController()
{
mIonAlloc = new IonAlloc();
+ mUseTZProtection = false;
+ char property[PROPERTY_VALUE_MAX];
+ if ((property_get("persist.gralloc.cp.level3", property, NULL) <= 0) ||
+ (atoi(property) != 1)) {
+ mUseTZProtection = true;
+ }
}
int IonController::allocate(alloc_data& data, int usage)
@@ -201,26 +207,28 @@
if(usage & GRALLOC_USAGE_PRIVATE_IOMMU_HEAP)
ionFlags |= ION_HEAP(ION_IOMMU_HEAP_ID);
- //MM Heap is exclusively a secure heap.
- if(usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) {
- //XXX: Right now the MM heap is the only secure heap we have. When we
- //have other secure heaps, we can change this.
- if(usage & GRALLOC_USAGE_PROTECTED) {
+ if(usage & GRALLOC_USAGE_PROTECTED) {
+ if ((mUseTZProtection) && (usage & GRALLOC_USAGE_PRIVATE_MM_HEAP)) {
ionFlags |= ION_HEAP(ION_CP_MM_HEAP_ID);
ionFlags |= ION_SECURE;
- }
- else {
- ALOGW("GRALLOC_USAGE_PRIVATE_MM_HEAP \
- cannot be used as an insecure heap!\
- trying to use IOMMU instead !!");
+ } else {
+ // for targets/OEMs which do not need HW level protection
+ // do not set ion secure flag & MM heap. Fallback to IOMMU heap.
ionFlags |= ION_HEAP(ION_IOMMU_HEAP_ID);
}
+ } else if(usage & GRALLOC_USAGE_PRIVATE_MM_HEAP) {
+ //MM Heap is exclusively a secure heap.
+ //If it is used for non secure cases, fallback to IOMMU heap
+ ALOGW("GRALLOC_USAGE_PRIVATE_MM_HEAP \
+ cannot be used as an insecure heap!\
+ trying to use IOMMU instead !!");
+ ionFlags |= ION_HEAP(ION_IOMMU_HEAP_ID);
}
if(usage & GRALLOC_USAGE_PRIVATE_ADSP_HEAP)
ionFlags |= ION_HEAP(ION_ADSP_HEAP_ID);
- if(usage & GRALLOC_USAGE_PROTECTED)
+ if(ionFlags & ION_SECURE)
data.allocType |= private_handle_t::PRIV_FLAGS_SECURE_BUFFER;
// if no flags are set, default to
diff --git a/libgralloc/alloc_controller.h b/libgralloc/alloc_controller.h
index 5fe81fa..8954d39 100644
--- a/libgralloc/alloc_controller.h
+++ b/libgralloc/alloc_controller.h
@@ -65,6 +65,7 @@
private:
IonAlloc* mIonAlloc;
+ bool mUseTZProtection;
};
} //end namespace gralloc
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 23eed45..8589204 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -121,7 +121,9 @@
//Calculates total rendering area for RGB layers
unsigned int renderArea = 0;
unsigned int w=0, h=0;
- for (unsigned int i=0; i<list->numHwLayers; i++) {
+ // Skipping last layer since FrameBuffer layer should not affect
+ // which composition to choose
+ for (unsigned int i=0; i<list->numHwLayers -1; i++) {
private_handle_t *hnd = (private_handle_t *)list->hwLayers[i].handle;
if (hnd) {
if (BUFFER_TYPE_UI == hnd->bufferType) {
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 16c2c8f..b33b744 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -109,6 +109,13 @@
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].ydpi = ydpi;
ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period = 1000000000l / fps;
+ //Unblank primary on first boot
+ if(ioctl(fb_fd, FBIOBLANK,FB_BLANK_UNBLANK) < 0) {
+ ALOGE("%s: Failed to unblank display", __FUNCTION__);
+ return -errno;
+ }
+ ctx->dpyAttr[HWC_DISPLAY_PRIMARY].isActive = true;
+
return 0;
}