Fork: Skip sharing GL_LUMINANCE textures

Due bugs in some drivers, sharing GL_LUMINANCE fails and causes causes a
NPE crash. WebRTC is the only feature using GL_LUMINANCE textures which
do not require to be shared, so skip them altogether.

Forking because situation in trunk has changed significantly and this is
no longer appropriate.

BUG: 19366032
Change-Id: I09c076068e1f38daa344009ca7b12cf30ead6df1
diff --git a/gpu/command_buffer/service/mailbox_manager_sync.cc b/gpu/command_buffer/service/mailbox_manager_sync.cc
index 65376af..8f352d0 100644
--- a/gpu/command_buffer/service/mailbox_manager_sync.cc
+++ b/gpu/command_buffer/service/mailbox_manager_sync.cc
@@ -36,6 +36,17 @@
   if (texture->pool() == GL_TEXTURE_POOL_MANAGED_CHROMIUM)
     return true;
 
+  // ==================== FORK ====================
+  // Skip GL_LUMINANCE textures used in WebRTC due to driver bugs.
+  // WebRTC textures do not require sharing to be gin with.
+  GLenum type;
+  GLenum internal_format;
+  if (texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format) &&
+      internal_format == GL_LUMINANCE) {
+    return true;
+  }
+  // ================== END FORK ==================
+
   return false;
 }