Refactor gralloc to reduce usage of global variables and remove macros am: 42b24c4513
am: 07c8ed8581

Change-Id: I9141ddb8c2b522e995d684795278b60a2c80006b