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

Commit f225ab5e authored by Alec Mouri's avatar Alec Mouri Committed by Android (Google) Code Review
Browse files

Merge "Expose underlying panel vsync to SurfaceControl's display mode" into main

parents c21f1304 99fcc211
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1790,7 +1790,12 @@ public final class SurfaceControl implements Parcelable {
        public float xDpi;
        public float yDpi;

        // Some modes have peak refresh rate lower than the panel vsync rate.
        public float refreshRate;
        // Fixed rate of vsync deadlines for the panel.
        // This can be higher then the peak refresh rate for some panel technologies
        // See: VrrConfig.aidl
        public float vsyncRate;
        public long appVsyncOffsetNanos;
        public long presentationDeadlineNanos;
        public int[] supportedHdrTypes;
@@ -1811,6 +1816,7 @@ public final class SurfaceControl implements Parcelable {
                    + ", xDpi=" + xDpi
                    + ", yDpi=" + yDpi
                    + ", refreshRate=" + refreshRate
                    + ", vsyncRate=" + vsyncRate
                    + ", appVsyncOffsetNanos=" + appVsyncOffsetNanos
                    + ", presentationDeadlineNanos=" + presentationDeadlineNanos
                    + ", supportedHdrTypes=" + Arrays.toString(supportedHdrTypes)
@@ -1828,6 +1834,7 @@ public final class SurfaceControl implements Parcelable {
                    && Float.compare(that.xDpi, xDpi) == 0
                    && Float.compare(that.yDpi, yDpi) == 0
                    && Float.compare(that.refreshRate, refreshRate) == 0
                    && Float.compare(that.vsyncRate, vsyncRate) == 0
                    && appVsyncOffsetNanos == that.appVsyncOffsetNanos
                    && presentationDeadlineNanos == that.presentationDeadlineNanos
                    && Arrays.equals(supportedHdrTypes, that.supportedHdrTypes)
@@ -1836,8 +1843,9 @@ public final class SurfaceControl implements Parcelable {

        @Override
        public int hashCode() {
            return Objects.hash(id, width, height, xDpi, yDpi, refreshRate, appVsyncOffsetNanos,
                    presentationDeadlineNanos, group, Arrays.hashCode(supportedHdrTypes));
            return Objects.hash(id, width, height, xDpi, yDpi, refreshRate, vsyncRate,
                    appVsyncOffsetNanos, presentationDeadlineNanos, group,
                    Arrays.hashCode(supportedHdrTypes));
        }
    }

+3 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ static struct {
    jfieldID xDpi;
    jfieldID yDpi;
    jfieldID refreshRate;
    jfieldID vsyncRate;
    jfieldID appVsyncOffsetNanos;
    jfieldID presentationDeadlineNanos;
    jfieldID group;
@@ -1231,6 +1232,7 @@ static jobject convertDisplayModeToJavaObject(JNIEnv* env, const ui::DisplayMode
    env->SetFloatField(object, gDisplayModeClassInfo.yDpi, config.yDpi);

    env->SetFloatField(object, gDisplayModeClassInfo.refreshRate, config.refreshRate);
    env->SetFloatField(object, gDisplayModeClassInfo.vsyncRate, config.vsyncRate);
    env->SetLongField(object, gDisplayModeClassInfo.appVsyncOffsetNanos, config.appVsyncOffset);
    env->SetLongField(object, gDisplayModeClassInfo.presentationDeadlineNanos,
                      config.presentationDeadline);
@@ -2394,6 +2396,7 @@ int register_android_view_SurfaceControl(JNIEnv* env)
    gDisplayModeClassInfo.xDpi = GetFieldIDOrDie(env, modeClazz, "xDpi", "F");
    gDisplayModeClassInfo.yDpi = GetFieldIDOrDie(env, modeClazz, "yDpi", "F");
    gDisplayModeClassInfo.refreshRate = GetFieldIDOrDie(env, modeClazz, "refreshRate", "F");
    gDisplayModeClassInfo.vsyncRate = GetFieldIDOrDie(env, modeClazz, "vsyncRate", "F");
    gDisplayModeClassInfo.appVsyncOffsetNanos =
            GetFieldIDOrDie(env, modeClazz, "appVsyncOffsetNanos", "J");
    gDisplayModeClassInfo.presentationDeadlineNanos =