Apply changes from AOSP relevant for opengl renderer.

45c24e282112b7632ffa690f220cf2e4e0ebbe47
bf5add6bd5d87796621799d9da82db06b5d15f60
6aa81f9c3d516536eb27fcb4ca7e6d4f2ec1f5b1
57501158002f2b81b0aecec9ecf609970950ae85
31694ac75cee03be2fd13e978c61797f0b5c72c4
43c42cfd5f7b2a7e47bffeb9a4e148dd35a88f59
a85d7d3c12fbb639277488a3810a6b5833fe1f33
47ea21f83af03c38cb710ad4204ce38b561dea6b
2cab88d5153a1965f5a5bbd43982de992c617828
06ebcd593ed97f99ed1e6d2672a71dd29e249cda
e21a341cd5c66f8faaa2c9a93282cdad7ac0261e
e9704e22d9d307e655b6f2bfd80de6aedd40fd3a