From 904f485bc6013060e81b627be61314b3d7fe5ef8 Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Mon, 31 Aug 2015 12:01:48 -0700 Subject: [PATCH] SurfaceControl: Add colorTransform to DisplayInfo Adds the colorTransform field, which defines a vendor-specific color transform (e.g., wide gamut, sRGB, etc.) to the PhysicalDisplayInfo class, and populates it from the corresponding field from ISurfaceComposer. Bug: 20853317 Change-Id: Ic59ca5142bdaa73c42d9c044d7aae345255f1dad --- core/java/android/view/SurfaceControl.java | 8 ++++++-- core/jni/android_view_SurfaceControl.cpp | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 5970c3f738a08..bcf9b2c7fe7c0 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -484,6 +484,7 @@ public class SurfaceControl { public boolean secure; public long appVsyncOffsetNanos; public long presentationDeadlineNanos; + public int colorTransform; public PhysicalDisplayInfo() { } @@ -507,7 +508,8 @@ public class SurfaceControl { && yDpi == other.yDpi && secure == other.secure && appVsyncOffsetNanos == other.appVsyncOffsetNanos - && presentationDeadlineNanos == other.presentationDeadlineNanos; + && presentationDeadlineNanos == other.presentationDeadlineNanos + && colorTransform == other.colorTransform; } @Override @@ -525,6 +527,7 @@ public class SurfaceControl { secure = other.secure; appVsyncOffsetNanos = other.appVsyncOffsetNanos; presentationDeadlineNanos = other.presentationDeadlineNanos; + colorTransform = other.colorTransform; } // For debugging purposes @@ -533,7 +536,8 @@ public class SurfaceControl { return "PhysicalDisplayInfo{" + width + " x " + height + ", " + refreshRate + " fps, " + "density " + density + ", " + xDpi + " x " + yDpi + " dpi, secure " + secure + ", appVsyncOffset " + appVsyncOffsetNanos - + ", bufferDeadline " + presentationDeadlineNanos + "}"; + + ", bufferDeadline " + presentationDeadlineNanos + + ", colorTransform " + colorTransform + "}"; } } diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 77af341590f7d..20352eb7d96bb 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -64,6 +64,7 @@ static struct { jfieldID secure; jfieldID appVsyncOffsetNanos; jfieldID presentationDeadlineNanos; + jfieldID colorTransform; } gPhysicalDisplayInfoClassInfo; static struct { @@ -401,6 +402,8 @@ static jobjectArray nativeGetDisplayConfigs(JNIEnv* env, jclass clazz, info.appVsyncOffset); env->SetLongField(infoObj, gPhysicalDisplayInfoClassInfo.presentationDeadlineNanos, info.presentationDeadline); + env->SetIntField(infoObj, gPhysicalDisplayInfoClassInfo.colorTransform, + info.colorTransform); env->SetObjectArrayElement(configArray, static_cast(c), infoObj); env->DeleteLocalRef(infoObj); } @@ -663,6 +666,8 @@ int register_android_view_SurfaceControl(JNIEnv* env) clazz, "appVsyncOffsetNanos", "J"); gPhysicalDisplayInfoClassInfo.presentationDeadlineNanos = GetFieldIDOrDie(env, clazz, "presentationDeadlineNanos", "J"); + gPhysicalDisplayInfoClassInfo.colorTransform = GetFieldIDOrDie(env, clazz, + "colorTransform", "I"); jclass rectClazz = FindClassOrDie(env, "android/graphics/Rect"); gRectClassInfo.bottom = GetFieldIDOrDie(env, rectClazz, "bottom", "I");