From 840a257b9e3b35d4892d85bffe83700045e39c3f Mon Sep 17 00:00:00 2001 From: Naseer Ahmed Date: Thu, 29 Mar 2012 14:30:17 -0400 Subject: [PATCH] gralloc: Initialize and handle allocType correctly. CRs-fixed: 346154 (cherry picked from commit a235dd6b4e8efe3cc432057806b3d5fb2cb4881d) Change-Id: Ie657f6e52df5a4b39c9fa04e74aabe1135e5bdd5 --- libgralloc/alloc_controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp index c76b31b..1ff19d8 100644 --- a/libgralloc/alloc_controller.cpp +++ b/libgralloc/alloc_controller.cpp @@ -115,6 +115,7 @@ int IonController::allocate(alloc_data& data, int usage, bool noncontig = false; data.uncached = useUncached(usage); + data.allocType = 0; if(usage & GRALLOC_USAGE_PRIVATE_UI_CONTIG_HEAP) ionFlags |= ION_HEAP(ION_SF_HEAP_ID); @@ -140,9 +141,10 @@ int IonController::allocate(alloc_data& data, int usage, ionFlags |= ION_SECURE; if(usage & GRALLOC_USAGE_PRIVATE_DO_NOT_MAP) - data.allocType = private_handle_t::PRIV_FLAGS_NOT_MAPPED; + data.allocType |= private_handle_t::PRIV_FLAGS_NOT_MAPPED; else data.allocType &= ~(private_handle_t::PRIV_FLAGS_NOT_MAPPED); + // if no flags are set, default to // EBI heap, so that bypass can work // we can fall back to system heap if @@ -164,7 +166,7 @@ int IonController::allocate(alloc_data& data, int usage, } if(ret >= 0 ) { - data.allocType = private_handle_t::PRIV_FLAGS_USES_ION; + data.allocType |= private_handle_t::PRIV_FLAGS_USES_ION; if(noncontig) data.allocType |= private_handle_t::PRIV_FLAGS_NONCONTIGUOUS_MEM; if(ionFlags & ION_SECURE) @@ -265,6 +267,7 @@ int PmemAshmemController::allocate(alloc_data& data, int usage, int compositionType) { int ret = 0; + data.allocType = 0; // Make buffers cacheable by default data.uncached = false;