Open liuyq opened 1 year ago
some message in logcat
01-01 00:05:45.873 0 0 I : ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
03-13 04:07:07.517 2392 2392 E HWComposer: presentAndGetReleaseFences: present failed for display 0: BadParameter (4)
03-13 04:07:07.518 4132 4167 E BLASTBufferQueue: [VRI[RetainedDisplayTestActivity]#1](f:0,a:3) Faking releaseBufferCallback from transactionCompleteCallback
03-13 04:07:07.533 2361 2422 E hwc-drm-atomic-state-manager: Failed to commit pset ret=-16
03-13 04:07:07.533 2361 2422 E hwc-drm-atomic-state-manager: Composite failed for pipeline HDMI-A-1
03-13 04:07:07.533 2361 2422 E hwc-drm-atomic-state-manager: Failed to commit pset ret=-16
03-13 04:07:07.533 2361 2422 E hwc-drm-atomic-state-manager: Failed to clean-up active composition for pipeline HDMI-A-1
03-13 04:07:07.533 2361 2422 E hwc-display: Failed to apply the frame composition ret=-16
03-13 04:07:07.534 2392 2392 E HWComposer: presentAndGetReleaseFences: present failed for display 0: BadParameter (4)
01-01 00:05:45.889 0 0 I : ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
supported modes with hdmi dongle
# local
03-13 04:04:21.464 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=1, width=1920, height=1080, fps=60.000004, alternativeRefreshRates=[24.000002, 50.0]}
03-13 04:04:21.464 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=2, width=1920, height=1080, fps=50.0, alternativeRefreshRates=[24.000002, 60.000004]}
03-13 04:04:21.463 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=3, width=1920, height=1080, fps=24.000002, alternativeRefreshRates=[50.0, 60.000004]}
03-13 04:04:21.463 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=4, width=1280, height=1024, fps=75.02467, alternativeRefreshRates=[]}
03-13 04:04:21.464 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=5, width=1280, height=720, fps=60.000004, alternativeRefreshRates=[50.0]}
03-13 04:04:21.463 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=6, width=1280, height=720, fps=50.0, alternativeRefreshRates=[60.000004]}
03-13 04:04:21.464 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=7, width=800, height=600, fps=75.0, alternativeRefreshRates=[56.250004, 60.31654]}
03-13 04:04:21.463 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=8, width=800, height=600, fps=60.31654, alternativeRefreshRates=[56.250004, 75.0]}
03-13 04:04:21.463 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=9, width=800, height=600, fps=56.250004, alternativeRefreshRates=[60.31654, 75.0]}
03-13 04:04:21.463 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=10, width=720, height=576, fps=50.0, alternativeRefreshRates=[]}
03-13 04:04:21.463 4090 4122 I DisplayTest: ===LIUYQ=== mode: {id=11, width=720, height=480, fps=60.000004, alternativeRefreshRates=[]}
# lab
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=1, width=2048, height=1152, fps=60.000004, alternativeRefreshRates=[]}
03-13 04:03:00.885 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=2, width=1920, height=1080, fps=60.000004, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=4, width=1680, height=1050, fps=59.954254, alternativeRefreshRates=[]}
03-13 04:03:00.885 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=3, width=1600, height=1200, fps=60.000004, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=5, width=1400, height=1050, fps=59.978443, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=7, width=1440, height=900, fps=74.98442, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=6, width=1280, height=1024, fps=75.02467, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=8, width=1280, height=800, fps=59.810326, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=9, width=1280, height=768, fps=74.893074, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=10, width=1280, height=720, fps=60.000004, alternativeRefreshRates=[]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=11, width=800, height=600, fps=75.0, alternativeRefreshRates=[56.250004, 60.31654]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=12, width=800, height=600, fps=60.31654, alternativeRefreshRates=[56.250004, 75.0]}
03-13 04:03:00.886 4553 4592 I DisplayTest: ===LIUYQ=== mode: {id=13, width=800, height=600, fps=56.250004, alternativeRefreshRates=[60.31654, 75.0]}
$ source build/envsetup.sh
$ lunch aosp_arm64-userdebug
$ mmm cts/tests/tests/display/
$ adb install out/host/linux-x86/cts/android-cts/testcases/CtsDisplayTestCases/arm64/CtsDisplayTestCases.apk
$ adb shell am instrument -w --abi arm64-v8a -e debug false -e newRunListenerMode true -e log false -e timeout_msec 300000 -e class android.display.cts.DisplayTest#testModeSwitchOnPrimaryDisplay android.display.cts/androidx.test.runner.AndroidJUnitRunne
// drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c dsi_encoder_phy_mode_valid
+ printk(KERN_INFO "====LIUYQ==== Checking mode %ix%i@%i clock: %i...",
+ mode->hdisplay, mode->vdisplay,
+ drm_mode_vrefresh(mode), mode->clock);
// tests/tests/display/src/android/display/cts/DisplayTest.java
/**
* Test that a mode switch to every reported display mode is successful.
*/
@Test
public void testModeSwitchOnPrimaryDisplay() throws Exception {
Display.Mode[] modes = mDefaultDisplay.getSupportedModes();
Log.i(TAG, "LIUYQ testModeSwitchOnPrimaryDisplay modes.length=" + modes.length);
assumeTrue("Need two or more display modes to exercise switching.", modes.length > 1);
try {
mDisplayManager.setShouldAlwaysRespectAppRequestedMode(true);
assertTrue(mDisplayManager.shouldAlwaysRespectAppRequestedMode());
mInitialRefreshRateSwitchingType =
DisplayUtil.getRefreshRateSwitchingType(mDisplayManager);
mDisplayManager.setRefreshRateSwitchingType(DisplayManager.SWITCHING_TYPE_NONE);
final DisplayTestActivity activity = launchActivity(mRetainedDisplayTestActivity);
// Create a deterministically shuffled list of display modes, which ends with the
// current active mode. We'll switch to the modes in this order. The active mode is last
// so we don't need an extra mode switch in case the test completes successfully.
Display.Mode activeMode = mDefaultDisplay.getMode();
List<Display.Mode> modesList = new ArrayList<>(modes.length);
for (Display.Mode mode : modes) {
if (mode.getModeId() != activeMode.getModeId()) {
modesList.add(mode);
}
}
Random random = new Random(42);
Collections.shuffle(modesList, random);
modesList.add(activeMode);
Log.i(TAG, "===LIUYQ=== modesList.length= " + modesList.size());
for (Display.Mode mode : modesList) {
Log.i(TAG, "===LIUYQ=== mode: " + mode);
}
for (Display.Mode mode : modesList) {
if (
(mode.getPhysicalWidth() == 1920 && mode.getPhysicalHeight() == 1080) ||
(mode.getPhysicalWidth() == 1600 && mode.getPhysicalHeight() == 1200) ||
(mode.getPhysicalWidth() == 1280 && mode.getPhysicalHeight() == 1024) ||
(mode.getPhysicalWidth() == 1280 && mode.getPhysicalHeight() == 720) ||
(mode.getPhysicalWidth() == 800 && mode.getPhysicalHeight() == 600) ||
(mode.getPhysicalWidth() == 720 && mode.getPhysicalHeight() == 576)
){
continue;
}
Log.i(TAG, "===LIUYQ=== test mode: " + mode);
testSwitchToModeId(activity, mode);
}
} finally {
mDisplayManager.setShouldAlwaysRespectAppRequestedMode(false);
mDisplayManager.setRefreshRateSwitchingType(mInitialRefreshRateSwitchingType);
}
}
private void testSwitchToModeId(DisplayTestActivity activity, Display.Mode targetMode)
throws Exception {
final DisplayModeState initialMode = new DisplayModeState(mDefaultDisplay);
Log.i(TAG, "Testing switching to mode " + targetMode + ". Current mode = " + initialMode);
final CountDownLatch changeSignal = new CountDownLatch(1);
final AtomicInteger changeCounter = new AtomicInteger(0);
final AtomicInteger changesToReachTargetMode = new AtomicInteger(0);
DisplayListener listener = new DisplayListener() {
private DisplayModeState mLastMode = initialMode;
private boolean mIsDesiredModeReached = false;
@Override
public void onDisplayAdded(int displayId) {}
@Override
public void onDisplayChanged(int displayId) {
if (displayId != mDefaultDisplay.getDisplayId()) {
return;
}
DisplayModeState newMode = new DisplayModeState(mDefaultDisplay);
if (mLastMode.equals(newMode)) {
// We assume this display change is caused by an external factor so it's
// unrelated.
return;
}
Log.i(TAG, "Switched mode from=" + mLastMode + " to=" + newMode);
changeCounter.incrementAndGet();
if (targetMode.getPhysicalHeight() == newMode.mHeight
&& targetMode.getPhysicalWidth() == newMode.mWidth
&& Math.abs(targetMode.getRefreshRate() - newMode.mRefreshRate)
< REFRESH_RATE_TOLERANCE
&& !mIsDesiredModeReached) {
mIsDesiredModeReached = true;
changeSignal.countDown();
changesToReachTargetMode.set(changeCounter.get());
}
mLastMode = newMode;
}
@Override
public void onDisplayRemoved(int displayId) {}
};
Handler handler = new Handler(Looper.getMainLooper());
mDisplayManager.registerDisplayListener(listener, handler);
final CountDownLatch presentationSignal = new CountDownLatch(1);
handler.post(() -> {
activity.setPreferredDisplayMode(targetMode);
presentationSignal.countDown();
});
assertTrue(presentationSignal.await(5, TimeUnit.SECONDS));
// Wait until the display change is effective.
assertTrue(changeSignal.await(5, TimeUnit.SECONDS));
DisplayModeState currentMode = new DisplayModeState(mDefaultDisplay);
assertEquals(targetMode.getPhysicalHeight(), currentMode.mHeight);
assertEquals(targetMode.getPhysicalWidth(), currentMode.mWidth);
assertEquals(targetMode.getRefreshRate(), currentMode.mRefreshRate, REFRESH_RATE_TOLERANCE);
boolean isResolutionSwitch = initialMode.mHeight != targetMode.getPhysicalHeight()
|| initialMode.mWidth != targetMode.getPhysicalHeight();
boolean isRefreshRateSwitch =
Math.abs(initialMode.mRefreshRate - targetMode.getRefreshRate())
> REFRESH_RATE_TOLERANCE;
// When both resolution and refresh rate are changed the transition can happen with two
// mode switches:
// 1) When the frame rate vote is applied in
// java.com.android.server.wm.WindowState#updateFrameRateSelectionPriorityIfNeeded
// 2) When the DisplayManager policy is applied to RefreshRateConfigs in SurfaceFlinger.
// TODO(b/199895248) Expect only 1 mode change.
Truth.assertThat(changesToReachTargetMode.get())
.isAtMost((isResolutionSwitch && isRefreshRateSwitch) ? 2 : 1);
// Make sure no more display mode changes are registered.
Thread.sleep(Duration.ofSeconds(3).toMillis());
// When a resolution switch occurs the DisplayManager policy in RefreshRateConfigs
// is cleared and later reapplied. This may lead to two additional mode switches.
// TODO(b/200265160) Expect no changes.
Truth.assertThat(changeCounter.get() - changesToReachTargetMode.get())
.isAtMost(isResolutionSwitch ? 2 : 0);
// Many TV apps use the vendor.display-size sysprop to detect the display size (although
// it's not an official API). In Android S the bugs which required this workaround were
// fixed and the sysprop should be either unset or should have the same value as the
// official API. The assertions are done after the delay above because on some
// devices the sysprop is not updated immediately after onDisplayChanged is called.
if (PropertyUtil.getVendorApiLevel() >= Build.VERSION_CODES.S) {
Point vendorDisplaySize = getVendorDisplaySize();
if (vendorDisplaySize != null) {
assertEquals(targetMode.getPhysicalWidth(), vendorDisplaySize.x);
assertEquals(targetMode.getPhysicalHeight(), vendorDisplaySize.y);
}
}
mDisplayManager.unregisterDisplayListener(listener);
}
frameworks/base/core/java/android/view/Display.java getSupportedModes ---> updateDisplayInfoLocked frameworks/base/core/java/android/hardware/display/DisplayManagerGlobal.java getDisplayInfo ---> getDisplayInfoLocked frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java getDisplayInfo ---> getDisplayInfoInternal final DisplayInfo info = getDisplayInfoForFrameRateOverride(display.getFrameRateOverrides(), display.getDisplayInfoLocked(), callingUid);
frameworks/base/services/core/java/com/android/server/display/LogicalDisplayMapper.java public LogicalDisplay getDisplayLocked(int displayId) {
drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
echo 0x2 > /sys/module/drm/parameters/debug
tradefed-output-20230328102802.zip
03-28 10:10:10 D/ModuleDefinition: Running module armeabi-v7a CtsDisplayTestCases[instant]
03-28 10:10:51 I/ModuleListener: [1/1] 6EDCB009004013EF android.display.cts.DisplayTest#testModeSwitchOnPrimaryDisplay FAILURE: java.lang.AssertionError^M
at org.junit.Assert.fail(Assert.java:87)^M
at org.junit.Assert.assertTrue(Assert.java:42)^M
at org.junit.Assert.assertTrue(Assert.java:53)^M
at android.display.cts.DisplayTest.testSwitchToModeId(DisplayTest.java:720)^M
at android.display.cts.DisplayTest.testModeSwitchOnPrimaryDisplay(DisplayTest.java:624)^M
03-28 10:11:23 W/NativeDevice: There is no reboot history since 1679998278000
03-28 10:11:23 E/ModuleDefinition: Detected a soft-restart after module armeabi-v7a CtsDisplayTestCases[instant]
03-28 10:11:26 E/LeakedThreadStatusChecker: We have 3 threads instead of 1. List: [Thread[Invocation-6EDCB009004013EF,5,Invocation-6EDCB009004013EF], Thread[BackgroundDeviceAction-logcat -v threadtime,uid,5,Invocation-6EDCB009004013EF], Thread[Timer-1,5,Invocation-6EDCB009004013EF]]
03-28 10:11:26 W/ITestSuite: System status checker [com.android.tradefed.suite.checker.LeakedThreadStatusChecker] failed
03-28 10:11:26 W/DeviceSettingChecker: Setting in namespace global fails:
ota_disable_automatic_update is not found before module run
Setting in namespace secure fails:
verifier_verify_adb_installs is not found before module run
03-28 10:11:26 W/ITestSuite: System status checker [com.android.tradefed.suite.checker.DeviceSettingChecker] failed
03-28 10:11:26 W/ITestSuite: There are failed system status checkers: {com.android.tradefed.suite.checker.LeakedThreadStatusChecker=We have 3 threads instead of 1. List: [Thread[Invocation-6EDCB009004013EF,5,Invocation-6EDCB009004013EF], Thread[BackgroundDeviceAction-logcat -v threadtime,uid,5,Invocation-6EDCB009004013EF], Thread[Timer-1,5,Invocation-6EDCB009004013EF]], com.android.tradefed.suite.checker.DeviceSettingChecker=Setting in namespace global fails:
ota_disable_automatic_update is not found before module run
Setting in namespace secure fails:
verifier_verify_adb_installs is not found before module run
}
03-28 10:11:30 D/ModuleDefinition: Running module armeabi-v7a CtsDisplayTestCases
03-28 10:13:29 I/ModuleListener: [1/1] 6EDCB009004013EF android.display.cts.DisplayTest#testModeSwitchOnPrimaryDisplay FAILURE: android.os.DeadSystemRuntimeException: android.os.DeadSystemException^M
at android.app.ActivityClient.finishActivity(ActivityClient.java:168)^M
at android.app.Activity.finish(Activity.java:6688)^M
at android.app.Activity.finish(Activity.java:6705)^M
at android.display.cts.DisplayTest.tearDown(DisplayTest.java:230)^M
... 35 trimmed^M
Caused by: android.os.DeadSystemException^M
... 40 more^M
03-28 10:13:30 W/TestAppInstallSetup: error uninstalling package 'android.display.cts': Unknown failure: cmd: Can't find service: package
03-28 10:19:39 W/DeviceStateMonitor: Device 6EDCB009004013EF package manager is unresponsive
03-28 10:23:56 W/DeviceStateMonitor: Device 6EDCB009004013EF package manager is unresponsive
03-28 10:23:58 D/NativeDevice: Device 6EDCB009004013EF state is now NOT_AVAILABLE
03-28 10:24:13 D/NativeDevice: Device 6EDCB009004013EF state is now FASTBOOT
03-28 10:28:01 W/DeviceStateMonitor: Device 6EDCB009004013EF package manager is unresponsive
03-28 10:28:01 W/NativeDevice: AdbCommandRejectedException (device '6EDCB009004013EF' not found) when attempting shell id on device 6EDCB009004013EF
03-28 10:28:01 W/NativeDevice: AdbCommandRejectedException (device '6EDCB009004013EF' not found) when attempting shell id on device 6EDCB009004013EF
03-28 10:28:01 W/NativeDevice: AdbCommandRejectedException (device '6EDCB009004013EF' not found) when attempting shell id on device 6EDCB009004013EF
03-28 10:28:01 E/NativeDevice: Exception occurred during recovery adb root:
03-28 10:28:01 E/NativeDevice: Attempted shell id multiple times on device 6EDCB009004013EF without communication success. Aborting.
logcat drm_hwcomposer
03-28 10:11:22.309 1000 2412 2412 E HWComposer: presentAndGetReleaseFences: present failed for display 0: BadParameter (4)
03-28 10:11:22.310 1000 2412 2412 I DisplayDevice: Display 0 policy changed
03-28 10:11:22.310 1000 2412 2412 I DisplayDevice: Previous: {{defaultModeId=0, allowGroupSwitching=false, primaryRange=[0.00 Hz, 340282346638528859811704183484516925440.00 Hz], appRequestRange=[0.00 Hz, 340282346638528859811704183484516925440.00 Hz]}}
03-28 10:11:22.310 1000 2412 2412 I DisplayDevice: Current: {{defaultModeId=0, allowGroupSwitching=false, primaryRange=[0.00 Hz, 60.00 Hz], appRequestRange=[0.00 Hz, inf Hz]}}
03-28 10:11:22.310 1000 2412 2412 I DisplayDevice: 0 mode changes were performed under the previous policy
03-28 10:11:22.312 10078 4589 5497 E BLASTBufferQueue: [VRI[MainActivity]#2](f:0,a:2) Faking releaseBufferCallback from transactionCompleteCallback
03-28 10:11:22.313 10057 3186 3673 I OpenGLRenderer: Davey! duration=30346ms; Flags=1, FrameTimelineVsyncId=19758, IntendedVsync=3579032086847, Vsync=3579515420161, InputEventId=0, HandleInputStart=3579521177990, AnimationStart=3579521180490, PerformTraversalsStart=3579521428823, DrawStart=3609365034653, FrameDeadline=3579048753513, FrameInterval=3579521169656, FrameStartTime=16666666, SyncQueued=3609372414653, SyncStart=3609372957153, IssueDrawCommandsStart=3609373257987, SwapBuffers=3609377485487, FrameCompleted=3609379586320, DequeueBufferDuration=0, QueueBufferDuration=843333, GpuCompleted=3609379494653, SwapBuffersCompleted=3609379586320, DisplayPresentTime=0, CommandSubmissionCompleted=3609377485487,
03-28 10:11:22.313 10059 2897 3348 E BLASTBufferQueue: [VRI[StatusBar]#1](f:0,a:4) Faking releaseBufferCallback from transactionCompleteCallback
03-28 10:11:22.314 1000 2572 2979 E BLASTBufferQueue: [VRI[Overlay #1: 181x161, 214 dpi]#0](f:0,a:2) Faking releaseBufferCallback from transactionCompleteCallback
03-28 10:11:22.325 1000 2572 2590 W ImageReader_JNI: Unable to acquire a buffer item, very likely client tried to acquire more than maxImages buffers
03-28 10:11:22.331 1000 2382 2444 E hwc-drm-atomic-state-manager: Failed to commit pset ret=-16
03-28 10:11:22.331 1000 2382 2444 E hwc-drm-atomic-state-manager: Composite failed for pipeline HDMI-A-1
03-28 10:11:22.331 1000 2382 2444 E hwc-drm-atomic-state-manager: Failed to commit pset ret=-16
03-28 10:11:22.331 1000 2382 2444 E hwc-drm-atomic-state-manager: Failed to clean-up active composition for pipeline HDMI-A-1
03-28 10:11:22.331 1000 2382 2444 E hwc-display: Failed to apply the frame composition ret=-16
03-28 10:11:22.332 1000 2412 2412 E HWComposer: presentAndGetReleaseFences: present failed for display 0: BadParameter (4)
03-28 10:11:22.334 10057 3186 3673 E BLASTBufferQueue: [VRI[Taskbar]#3](f:0,a:2) Faking releaseBufferCallback from transactionCompleteCallback
03-28 10:11:22.334 10059 2897 3348 E BLASTBufferQueue: [VRI[StatusBar]#1](f:0,a:3) Faking releaseBufferCallback from transactionCompleteCallback
03-28 10:11:22.336 1000 2412 2412 W SurfaceFlinger: Multiple displays claim to accept input for the same layer stack: 0
03-28 10:11:22.346 1000 2382 2444 E hwc-drm-atomic-state-manager: Failed to commit pset ret=-16
03-28 10:11:22.346 1000 2382 2444 E hwc-drm-atomic-state-manager: Composite failed for pipeline HDMI-A-1
03-28 10:11:22.346 1000 2382 2444 E hwc-drm-atomic-state-manager: Failed to commit pset ret=-16
03-28 10:11:22.346 1000 2382 2444 E hwc-drm-atomic-state-manager: Failed to clean-up active composition for pipeline HDMI-A-1
03-28 10:11:22.346 1000 2382 2444 E hwc-display: Failed to apply the frame composition ret=-16
03-28 10:11:22.346 1000 2412 2412 E HWComposer: presentAndGetReleaseFences: present failed for display 0: BadParameter (4)
console log when no mode switched