Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 830b041c authored by Sally Qi's avatar Sally Qi
Browse files

[HWUI] provide supportMixedColorSpaces() function for hwui.

Bug: 242588489
Test: build and flash
Change-Id: I9c6840e23891a95fdbae8e9adcfcabee33b37b07
parent 068c438d
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -58,6 +58,16 @@ public final class OverlayProperties implements Parcelable {
        return nSupportFp16ForHdr(mNativeObject);
        return nSupportFp16ForHdr(mNativeObject);
    }
    }


    /**
     * @return True if the device can support mixed colorspaces, false otherwise.
     */
    public boolean supportMixedColorSpaces() {
        if (mNativeObject == 0) {
            return false;
        }
        return nSupportMixedColorSpaces(mNativeObject);
    }

    /**
    /**
     * Release the local reference.
     * Release the local reference.
     */
     */
@@ -106,6 +116,7 @@ public final class OverlayProperties implements Parcelable {


    private static native long nGetDestructor();
    private static native long nGetDestructor();
    private static native boolean nSupportFp16ForHdr(long nativeObject);
    private static native boolean nSupportFp16ForHdr(long nativeObject);
    private static native boolean nSupportMixedColorSpaces(long nativeObject);
    private static native void nWriteOverlayPropertiesToParcel(long nativeObject, Parcel dest);
    private static native void nWriteOverlayPropertiesToParcel(long nativeObject, Parcel dest);
    private static native long nReadOverlayPropertiesFromParcel(Parcel in);
    private static native long nReadOverlayPropertiesFromParcel(Parcel in);
}
}
+12 −0
Original line number Original line Diff line number Diff line
@@ -69,6 +69,16 @@ static jboolean android_hardware_OverlayProperties_supportFp16ForHdr(JNIEnv* env
    return false;
    return false;
}
}


static jboolean android_hardware_OverlayProperties_supportMixedColorSpaces(JNIEnv* env,
                                                                           jobject thiz,
                                                                           jlong nativeObject) {
    gui::OverlayProperties* properties = reinterpret_cast<gui::OverlayProperties*>(nativeObject);
    if (properties != nullptr && properties->supportMixedColorSpaces) {
        return true;
    }
    return false;
}

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Serialization
// Serialization
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
@@ -128,6 +138,8 @@ static const JNINativeMethod gMethods[] = {
    { "nGetDestructor", "()J", (void*) android_hardware_OverlayProperties_getDestructor },
    { "nGetDestructor", "()J", (void*) android_hardware_OverlayProperties_getDestructor },
    { "nSupportFp16ForHdr",  "(J)Z",
    { "nSupportFp16ForHdr",  "(J)Z",
            (void*)  android_hardware_OverlayProperties_supportFp16ForHdr },
            (void*)  android_hardware_OverlayProperties_supportFp16ForHdr },
    { "nSupportMixedColorSpaces", "(J)Z",
            (void*) android_hardware_OverlayProperties_supportMixedColorSpaces },
    { "nWriteOverlayPropertiesToParcel", "(JLandroid/os/Parcel;)V",
    { "nWriteOverlayPropertiesToParcel", "(JLandroid/os/Parcel;)V",
            (void*) android_hardware_OverlayProperties_write },
            (void*) android_hardware_OverlayProperties_write },
    { "nReadOverlayPropertiesFromParcel", "(Landroid/os/Parcel;)J",
    { "nReadOverlayPropertiesFromParcel", "(Landroid/os/Parcel;)J",
+4 −2
Original line number Original line Diff line number Diff line
@@ -1334,6 +1334,8 @@ public class HardwareRenderer {
            final OverlayProperties overlayProperties = defaultDisplay.getOverlaySupport();
            final OverlayProperties overlayProperties = defaultDisplay.getOverlaySupport();
            boolean supportFp16ForHdr = overlayProperties != null
            boolean supportFp16ForHdr = overlayProperties != null
                    ? overlayProperties.supportFp16ForHdr() : false;
                    ? overlayProperties.supportFp16ForHdr() : false;
            boolean supportMixedColorSpaces = overlayProperties != null
                    ? overlayProperties.supportMixedColorSpaces() : false;


            for (int i = 0; i < allDisplays.length; i++) {
            for (int i = 0; i < allDisplays.length; i++) {
                final Display display = allDisplays[i];
                final Display display = allDisplays[i];
@@ -1361,7 +1363,7 @@ public class HardwareRenderer {
            nInitDisplayInfo(largestWidth, largestHeight, defaultDisplay.getRefreshRate(),
            nInitDisplayInfo(largestWidth, largestHeight, defaultDisplay.getRefreshRate(),
                    wideColorDataspace, defaultDisplay.getAppVsyncOffsetNanos(),
                    wideColorDataspace, defaultDisplay.getAppVsyncOffsetNanos(),
                    defaultDisplay.getPresentationDeadlineNanos(),
                    defaultDisplay.getPresentationDeadlineNanos(),
                    supportFp16ForHdr);
                    supportFp16ForHdr, supportMixedColorSpaces);


            mDisplayInitialized = true;
            mDisplayInitialized = true;
        }
        }
@@ -1542,7 +1544,7 @@ public class HardwareRenderer {


    private static native void nInitDisplayInfo(int width, int height, float refreshRate,
    private static native void nInitDisplayInfo(int width, int height, float refreshRate,
            int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos,
            int wideColorDataspace, long appVsyncOffsetNanos, long presentationDeadlineNanos,
            boolean supportsFp16ForHdr);
            boolean supportsFp16ForHdr, boolean nInitDisplayInfo);


    private static native void nSetDrawingEnabled(boolean drawingEnabled);
    private static native void nSetDrawingEnabled(boolean drawingEnabled);


+4 −0
Original line number Original line Diff line number Diff line
@@ -108,6 +108,10 @@ void DeviceInfo::setSupportFp16ForHdr(bool supportFp16ForHdr) {
    get()->mSupportFp16ForHdr = supportFp16ForHdr;
    get()->mSupportFp16ForHdr = supportFp16ForHdr;
}
}


void DeviceInfo::setSupportMixedColorSpaces(bool supportMixedColorSpaces) {
    get()->mSupportMixedColorSpaces = supportMixedColorSpaces;
}

void DeviceInfo::onRefreshRateChanged(int64_t vsyncPeriod) {
void DeviceInfo::onRefreshRateChanged(int64_t vsyncPeriod) {
    mVsyncPeriod = vsyncPeriod;
    mVsyncPeriod = vsyncPeriod;
}
}
+4 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,9 @@ public:
    static void setSupportFp16ForHdr(bool supportFp16ForHdr);
    static void setSupportFp16ForHdr(bool supportFp16ForHdr);
    static bool isSupportFp16ForHdr() { return get()->mSupportFp16ForHdr; };
    static bool isSupportFp16ForHdr() { return get()->mSupportFp16ForHdr; };


    static void setSupportMixedColorSpaces(bool supportMixedColorSpaces);
    static bool isSupportMixedColorSpaces() { return get()->mSupportMixedColorSpaces; };

    // this value is only valid after the GPU has been initialized and there is a valid graphics
    // this value is only valid after the GPU has been initialized and there is a valid graphics
    // context or if you are using the HWUI_NULL_GPU
    // context or if you are using the HWUI_NULL_GPU
    int maxTextureSize() const;
    int maxTextureSize() const;
@@ -92,6 +95,7 @@ private:
    int mMaxTextureSize;
    int mMaxTextureSize;
    sk_sp<SkColorSpace> mWideColorSpace = SkColorSpace::MakeSRGB();
    sk_sp<SkColorSpace> mWideColorSpace = SkColorSpace::MakeSRGB();
    bool mSupportFp16ForHdr = false;
    bool mSupportFp16ForHdr = false;
    bool mSupportMixedColorSpaces = false;
    SkColorType mWideColorType = SkColorType::kN32_SkColorType;
    SkColorType mWideColorType = SkColorType::kN32_SkColorType;
    int mDisplaysSize = 0;
    int mDisplaysSize = 0;
    int mPhysicalDisplayIndex = -1;
    int mPhysicalDisplayIndex = -1;
Loading