Loading graphics/java/android/graphics/HardwareRenderer.java +15 −0 Original line number Diff line number Diff line Loading @@ -633,6 +633,19 @@ public class HardwareRenderer { } } /** * Sets the colormode with the desired SDR white point. * * The white point only applies if the color mode is an HDR mode * * @hide */ public void setColorMode(@ActivityInfo.ColorMode int colorMode, float whitePoint) { nSetSdrWhitePoint(mNativeProxy, whitePoint); mColorMode = colorMode; nSetColorMode(mNativeProxy, colorMode); } /** * Blocks until all previously queued work has completed. * Loading Loading @@ -1227,6 +1240,8 @@ public class HardwareRenderer { private static native void nSetColorMode(long nativeProxy, int colorMode); private static native void nSetSdrWhitePoint(long nativeProxy, float whitePoint); private static native int nSyncAndDrawFrame(long nativeProxy, long[] frameInfo, int size); private static native void nDestroy(long nativeProxy, long rootRenderNode); Loading libs/hwui/Properties.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ bool Properties::isolatedProcess = false; int Properties::contextPriority = 0; int Properties::defaultRenderAhead = -1; float Properties::defaultSdrWhitePoint = 200.f; bool Properties::load() { bool prevDebugLayersUpdates = debugLayersUpdates; Loading libs/hwui/Properties.h +2 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ public: static int defaultRenderAhead; static float defaultSdrWhitePoint; private: static ProfileType sProfileType; static bool sDisableProfileBars; Loading libs/hwui/jni/android_graphics_HardwareRenderer.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -223,6 +223,11 @@ static void android_view_ThreadedRenderer_setColorMode(JNIEnv* env, jobject claz proxy->setColorMode(static_cast<ColorMode>(colorMode)); } static void android_view_ThreadedRenderer_setSdrWhitePoint(JNIEnv* env, jobject clazz, jlong proxyPtr, jfloat sdrWhitePoint) { Properties::defaultSdrWhitePoint = sdrWhitePoint; } static int android_view_ThreadedRenderer_syncAndDrawFrame(JNIEnv* env, jobject clazz, jlong proxyPtr, jlongArray frameInfo, jint frameInfoSize) { LOG_ALWAYS_FATAL_IF(frameInfoSize != UI_THREAD_FRAME_INFO_SIZE, Loading Loading @@ -671,6 +676,7 @@ static const JNINativeMethod gMethods[] = { {"nSetLightGeometry", "(JFFFF)V", (void*)android_view_ThreadedRenderer_setLightGeometry}, {"nSetOpaque", "(JZ)V", (void*)android_view_ThreadedRenderer_setOpaque}, {"nSetColorMode", "(JI)V", (void*)android_view_ThreadedRenderer_setColorMode}, {"nSetSdrWhitePoint", "(JF)V", (void*)android_view_ThreadedRenderer_setSdrWhitePoint}, {"nSyncAndDrawFrame", "(J[JI)I", (void*)android_view_ThreadedRenderer_syncAndDrawFrame}, {"nDestroy", "(JJ)V", (void*)android_view_ThreadedRenderer_destroy}, {"nRegisterAnimatingRenderNode", "(JJ)V", Loading libs/hwui/utils/Color.cpp +2 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <algorithm> #include <cmath> #include <Properties.h> namespace android { namespace uirenderer { Loading Loading @@ -344,13 +345,9 @@ SkColor LabToSRGB(const Lab& lab, SkAlpha alpha) { static_cast<uint8_t>(rgb.b * 255)); } // Note that SkColorSpace doesn't have the notion of an unspecified SDR white // level. static constexpr float kDefaultSDRWhiteLevel = 150.f; skcms_TransferFunction GetPQSkTransferFunction(float sdr_white_level) { if (sdr_white_level <= 0.f) { sdr_white_level = kDefaultSDRWhiteLevel; sdr_white_level = Properties::defaultSdrWhitePoint; } // The generic PQ transfer function produces normalized luminance values i.e. // the range 0-1 represents 0-10000 nits for the reference display, but we Loading Loading
graphics/java/android/graphics/HardwareRenderer.java +15 −0 Original line number Diff line number Diff line Loading @@ -633,6 +633,19 @@ public class HardwareRenderer { } } /** * Sets the colormode with the desired SDR white point. * * The white point only applies if the color mode is an HDR mode * * @hide */ public void setColorMode(@ActivityInfo.ColorMode int colorMode, float whitePoint) { nSetSdrWhitePoint(mNativeProxy, whitePoint); mColorMode = colorMode; nSetColorMode(mNativeProxy, colorMode); } /** * Blocks until all previously queued work has completed. * Loading Loading @@ -1227,6 +1240,8 @@ public class HardwareRenderer { private static native void nSetColorMode(long nativeProxy, int colorMode); private static native void nSetSdrWhitePoint(long nativeProxy, float whitePoint); private static native int nSyncAndDrawFrame(long nativeProxy, long[] frameInfo, int size); private static native void nDestroy(long nativeProxy, long rootRenderNode); Loading
libs/hwui/Properties.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ bool Properties::isolatedProcess = false; int Properties::contextPriority = 0; int Properties::defaultRenderAhead = -1; float Properties::defaultSdrWhitePoint = 200.f; bool Properties::load() { bool prevDebugLayersUpdates = debugLayersUpdates; Loading
libs/hwui/Properties.h +2 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ public: static int defaultRenderAhead; static float defaultSdrWhitePoint; private: static ProfileType sProfileType; static bool sDisableProfileBars; Loading
libs/hwui/jni/android_graphics_HardwareRenderer.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -223,6 +223,11 @@ static void android_view_ThreadedRenderer_setColorMode(JNIEnv* env, jobject claz proxy->setColorMode(static_cast<ColorMode>(colorMode)); } static void android_view_ThreadedRenderer_setSdrWhitePoint(JNIEnv* env, jobject clazz, jlong proxyPtr, jfloat sdrWhitePoint) { Properties::defaultSdrWhitePoint = sdrWhitePoint; } static int android_view_ThreadedRenderer_syncAndDrawFrame(JNIEnv* env, jobject clazz, jlong proxyPtr, jlongArray frameInfo, jint frameInfoSize) { LOG_ALWAYS_FATAL_IF(frameInfoSize != UI_THREAD_FRAME_INFO_SIZE, Loading Loading @@ -671,6 +676,7 @@ static const JNINativeMethod gMethods[] = { {"nSetLightGeometry", "(JFFFF)V", (void*)android_view_ThreadedRenderer_setLightGeometry}, {"nSetOpaque", "(JZ)V", (void*)android_view_ThreadedRenderer_setOpaque}, {"nSetColorMode", "(JI)V", (void*)android_view_ThreadedRenderer_setColorMode}, {"nSetSdrWhitePoint", "(JF)V", (void*)android_view_ThreadedRenderer_setSdrWhitePoint}, {"nSyncAndDrawFrame", "(J[JI)I", (void*)android_view_ThreadedRenderer_syncAndDrawFrame}, {"nDestroy", "(JJ)V", (void*)android_view_ThreadedRenderer_destroy}, {"nRegisterAnimatingRenderNode", "(JJ)V", Loading
libs/hwui/utils/Color.cpp +2 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <algorithm> #include <cmath> #include <Properties.h> namespace android { namespace uirenderer { Loading Loading @@ -344,13 +345,9 @@ SkColor LabToSRGB(const Lab& lab, SkAlpha alpha) { static_cast<uint8_t>(rgb.b * 255)); } // Note that SkColorSpace doesn't have the notion of an unspecified SDR white // level. static constexpr float kDefaultSDRWhiteLevel = 150.f; skcms_TransferFunction GetPQSkTransferFunction(float sdr_white_level) { if (sdr_white_level <= 0.f) { sdr_white_level = kDefaultSDRWhiteLevel; sdr_white_level = Properties::defaultSdrWhitePoint; } // The generic PQ transfer function produces normalized luminance values i.e. // the range 0-1 represents 0-10000 nits for the reference display, but we Loading