EGL: Plumb HDR metadata

HDR metadata comes in bit by bit via eglSurfaceAttribute.
Don't want to call native_window_set_buffers_smpte2086_metadata
for every piece, instead wait until eglSwapBuffers and call
native_window_set_buffers_smpte2086_metadata then.
Does require changing the state of the surface, so some const
goes away.

Bug: 63710530
Test: adb -d shell am start -n \
      com.drawelements.deqp/android.app.NativeActivity \
      -e cmdLine '"deqp --deqp-case=dEQP-EGL.functional.hdr_metadata.* \
      --deqp-log-filename=/sdcard/dEQP-Log.qpa"'
Test: adb shell /data/nativetest/test-opengl-gl2_basic/test-opengl-gl2_basic
Test: adb shell /data/nativetest/test-opengl-gl_basic/test-opengl-gl_basic
Change-Id: I2e428ec18737f6caa8c0e1893705b7796fd77272
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index bda91bb..4e1de5c 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -142,8 +142,10 @@
     EGLBoolean getColorSpaceAttribute(EGLint attribute, EGLint* value) const;
     EGLBoolean getSmpte2086Attribute(EGLint attribute, EGLint* value) const;
     EGLBoolean getCta8613Attribute(EGLint attribute, EGLint* value) const;
-    const android_smpte2086_metadata getSmpte2086Metadata();
-    const android_cta861_3_metadata getCta8613Metadata();
+    EGLBoolean getSmpte2086Metadata(android_smpte2086_metadata& smpte2086) const;
+    EGLBoolean getCta8613Metadata(android_cta861_3_metadata& cta861_3) const;
+    void resetSmpte2086Metadata() { egl_smpte2086_dirty = false; }
+    void resetCta8613Metadata() { egl_cta861_3_dirty = false; }
 
     // Try to keep the order of these fields and size unchanged. It's not public API, but
     // it's not hard to imagine native games accessing them.
@@ -176,6 +178,10 @@
         EGLint maxContentLightLevel;
         EGLint maxFrameAverageLightLevel;
     };
+
+    bool egl_smpte2086_dirty;
+    bool egl_cta861_3_dirty;
+
     egl_smpte2086_metadata egl_smpte2086_metadata;
     egl_cta861_3_metadata egl_cta861_3_metadata;
 };