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

Commit 99fcc211 authored by Alec Mouri's avatar Alec Mouri
Browse files

Expose underlying panel vsync to SurfaceControl's display mode

Bug: 301462354
Test: builds
Test: dumpsys display
Change-Id: I2e7a0d1dd65ce795747f5c0bc9d2402fac245008
parent b8653e30
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1789,7 +1789,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;
@@ -1810,6 +1815,7 @@ public final class SurfaceControl implements Parcelable {
                    + ", xDpi=" + xDpi
                    + ", yDpi=" + yDpi
                    + ", refreshRate=" + refreshRate
                    + ", vsyncRate=" + vsyncRate
                    + ", appVsyncOffsetNanos=" + appVsyncOffsetNanos
                    + ", presentationDeadlineNanos=" + presentationDeadlineNanos
                    + ", supportedHdrTypes=" + Arrays.toString(supportedHdrTypes)
@@ -1827,6 +1833,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)
@@ -1835,8 +1842,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;
@@ -1230,6 +1231,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);
@@ -2393,6 +2395,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 =