surfaceflinger: simplify P3 support in RE

RE always knows how to convert sRGB/P3/BT2020 to P3.  The conversion
is enabled by SurfaceFlinger whenever the color mode is P3 (and when
hasWideColorDisplay is true).  This change simplifies or removes
some wide color state functions from RE, and moves the burden to
SurfaceFlinger.  It also changes GLES20RenderEngine::drawMesh to
inspect mDataSpace and mOutputDataSpace directly.

This allows us to enable the conversion in more cases more easily.
For example, we can choose to set the RE output dataspace to P3 even
when the display color mode is NATIVE.

Test: manual with UiBench
Change-Id: I5e701dd6b01764efbbab967dc4a26a4d008dfc09
diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
index 6e86ea2..db3f792 100644
--- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
+++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
@@ -72,27 +72,20 @@
                                     const half4& color) override;
 
     // Color management related functions and state
-    void setColorMode(android_color_mode mode);
-    void setSourceDataSpace(android_dataspace source);
-    void setSourceY410BT2020(bool enable);
-    void setWideColor(bool hasWideColor);
-    bool usesWideColor();
-
-    // Current color mode of display using the render engine
-    android_color_mode mColorMode = HAL_COLOR_MODE_NATIVE;
+    void setSourceY410BT2020(bool enable) override;
+    void setSourceDataSpace(android_dataspace source) override;
+    void setOutputDataSpace(android_dataspace dataspace) override;
 
     // Current dataspace of layer being rendered
-    android_dataspace mDataSpace = HAL_DATASPACE_V0_SRGB;
+    android_dataspace mDataSpace = HAL_DATASPACE_UNKNOWN;
 
-    // Indicate if wide-color mode is needed or not
-    bool mDisplayHasWideColor = false;
-    bool mUseWideColor = false;
-    uint64_t mWideColorFrameCount = 0;
+    // Current output dataspace of the render engine
+    android_dataspace mOutputDataSpace = HAL_DATASPACE_UNKNOWN;
 
     // Currently only supporting sRGB, BT2020 and DisplayP3 color spaces
+    const bool mPlatformHasWideColor = false;
     mat4 mSrgbToDisplayP3;
     mat4 mBt2020ToDisplayP3;
-    bool mPlatformHasWideColor = false;
 
     virtual void setupLayerTexturing(const Texture& texture);
     virtual void setupLayerBlackedOut();