liuyq / android-issues

place to write notes about investigation on android issues
0 stars 0 forks source link

aosp-hikey: android.display.cts.DisplayTest#testModeSwitchOnPrimaryDisplay cause adb no response #22

Open liuyq opened 1 year ago

liuyq commented 1 year ago

console log when no mode switched

console:/ $ [  340.377699] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  340.482858] ------------[ cut here ]------------
[  340.493847] [CRTC:29:crtc-0] vblank wait timed out
[  340.498850] WARNING: CPU: 3 PID: 2361 at drivers/gpu/drm/drm_atomic_helper.c:1386 drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  340.510425] Modules linked in:
[  340.513486] CPU: 3 PID: 2361 Comm: composer@2.1-se Not tainted 4.19.278-g89c8d6ab661e-dirty #1
[  340.522097] Hardware name: HiKey Development Board (DT)
[  340.527323] pstate: 60400005 (nZCv daif +PAN -UAO)
[  340.532191] pc : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c

[  340.538112] lr : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  340.544192] sp : ffffff800e12ba10
[  340.547503] x29: ffffff800e12ba40 x28: 00000000000012a7 
[  340.552816] x27: 0000000000000188 x26: 0000000000000038 
[  340.558129] x25: 0000000000000000 x24: 0000000000000001 
console:/ $ [  340.563442] x23: 0000000000000000 x22: ffffffc074dab080 
[  340.569784] x21: ffffff8009151aeb x20: ffffffc074d4f800 
[  340.575096] x19: ffffffc045f84300 x18: 0000000000000001 
[  340.580407] x17: 0000000000000000 x16: 0000000000000000 
[  340.585720] x15: ffffff8008da53ac x14: ffffff8008ef1330 
[  340.591033] x13: 000000000000b4ec x12: 00000000d0555555 
[  340.596345] x11: 0000000000000000 x10: 0000000000000000 
[  340.601657] x9 : f9c216069042a400 x8 : f9c216069042a400 
[  340.606969] x7 : 5d302d637472633a x6 : ffffff80094a6d22 
[  340.612282] x5 : 0000000000000000 x4 : 0000000000000008 
[  340.617595] x3 : 0000000000000036 x2 : 0000000000000001 
[  340.622907] x1 : 0000000000000000 x0 : 0000000000000026 
[  340.628219] Call trace:
[  340.630667]  drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  340.636240]  drm_atomic_helper_commit_tail+0xd8/0x15c
[  340.641292]  commit_tail+0x4c/0x74
[  340.644692]  drm_atomic_helper_commit+0x310/0x32c
[  340.649398]  drm_atomic_connector_commit_dpms+0x110/0x128
[  340.654798]  drm_mode_obj_set_property_ioctl+0x154/0x2c8
[  340.660110]  drm_connector_property_set_ioctl+0x44/0x68
[  340.665336]  drm_ioctl_kernel+0x100/0x140
[  340.669344]  drm_ioctl+0x27c/0x404
[  340.672746]  do_vfs_ioctl+0x4dc/0x728
[  340.676407]  __arm64_sys_ioctl+0x70/0x98
[  340.680331]  el0_svc_common+0x9c/0x180
[  340.684079]  el0_svc_handler+0x28/0x60
[  340.687827]  el0_svc+0x8/0x300
[  340.690880] ---[ end trace 41c8724a288657d8 ]---
[  340.710656] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.225196] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.237402] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.260464] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.335037] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.364479] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.398312] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.410230] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.495574] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.528353] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.545446] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.564099] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.577477] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.611847] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.626924] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.660011] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.677707] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.694526] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.728383] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.744470] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.827907] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.911500] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.927535] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.944015] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.961332] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.977996] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  341.993280] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.012607] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.027442] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.045104] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.060624] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.110077] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.128055] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.145045] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.160358] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.193937] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.210576] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.227071] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.243962] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.260811] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.277429] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.294552] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.310386] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.328787] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.346799] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.360229] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.377876] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.395371] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.419398] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.432287] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.447270] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.464278] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.479559] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.497818] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.514167] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  342.532059] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  343.829528] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  343.844762] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  343.861856] ====LIUYQ==== Checking mode 720x480@60 clock: 26666...
[  347.239571] servicemanager: Notifying apexservice they don't (previously: do) have clients when we now have no record of a client
[  347.258484] AidlLazyServiceRegistrar: Process has 0 (of 1 available) client(s) in use after notification apexservice has clients: 0
[  347.270419] AidlLazyServiceRegistrar: Trying to shut down the service. No clients in use for any service in process.
[  347.281397] servicemanager: Unregistering apexservice
[  347.286506] BpBinder: onLastStrongRef automatically unlinking death recipients: <uninit descriptor>
[  347.295775] AidlLazyServiceRegistrar: Unregistered all clients and exiting
[  347.307815] init: Service 'apexd' (pid 2173) exited with status 0 oneshot service took 331.881012 seconds in background
[  347.318742] init: Sending signal 9 to service 'apexd' (pid 2173) process group...
[  347.326630] libprocessgroup: Successfully killed process cgroup uid 0 pid 2173 in 0ms
[  350.942956] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:29:crtc-0] flip_done timed out
[  351.006673] ------------[ cut here ]------------
[  351.011308] [CRTC:29:crtc-0] vblank wait timed out
[  351.016183] WARNING: CPU: 1 PID: 57 at drivers/gpu/drm/drm_atomic_helper.c:1386 drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  351.027575] Modules linked in:
[  351.030637] CPU: 1 PID: 57 Comm: kworker/u16:2 Tainted: G        W         4.19.278-g89c8d6ab661e-dirty #1
[  351.040290] Hardware name: HiKey Development Board (DT)
[  351.045520] Workqueue: events_unbound commit_work
[  351.050228] pstate: 60400005 (nZCv daif +PAN -UAO)
[  351.055020] pc : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  351.060940] lr : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  351.066859] sp : ffffff80096bbc80
[  351.070171] x29: ffffff80096bbcb0 x28: 00000000000012a7 
[  351.075484] x27: 0000000000000188 x26: 0000000000000038 
[  351.080798] x25: 0000000000000000 x24: 0000000000000001 
[  351.086111] x23: 0000000000000000 x22: ffffffc074dab080 
[  351.091423] x21: ffffff8009151aeb x20: ffffffc074d4f800 
[  351.096736] x19: ffffffc01eee7100 x18: 0000000000000001 
[  351.102048] x17: 0000000000000000 x16: 0000000000000000 
[  351.107360] x15: ffffff8008da53ac x14: ffffff8008ef1330 
[  351.112672] x13: 000000000000be52 x12: 00000000d0555555 
[  351.117986] x11: 0000000000000000 x10: 0000000000000000 
[  351.123297] x9 : f9c216069042a400 x8 : f9c216069042a400 
[  351.128610] x7 : 5d302d637472633a x6 : ffffff80094a6d22 
[  351.133922] x5 : 0000000000000000 x4 : 0000000000000008 
[  351.139234] x3 : 0000000000000036 x2 : 0000000000000001 
[  351.144546] x1 : 0000000000000000 x0 : 0000000000000026 
[  351.149859] Call trace:
[  351.152306]  drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  351.157878]  drm_atomic_helper_commit_tail+0xd8/0x15c
[  351.162930]  commit_tail+0x4c/0x74
[  351.166331]  commit_work+0x10/0x18
[  351.169734]  process_one_work+0x1ec/0x430
[  351.173743]  worker_thread+0x260/0x4a8
[  351.177493]  kthread+0x134/0x150
[  351.180722]  ret_from_fork+0x10/0x18
[  351.184296] ---[ end trace 41c8724a288657d9 ]---
[  361.182992] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:29:crtc-0] flip_done timed out
[  371.423047] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:31:HDMI-A-1] flip_done timed out
[  371.486746] ------------[ cut here ]------------
[  371.491422] [CRTC:29:crtc-0] vblank wait timed out
[  371.496411] WARNING: CPU: 1 PID: 2422 at drivers/gpu/drm/drm_atomic_helper.c:1386 drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  371.507993] Modules linked in:
[  371.511077] CPU: 1 PID: 2422 Comm: HwBinder:2361_2 Tainted: G        W         4.19.278-g89c8d6ab661e-dirty #1
[  371.521093] Hardware name: HiKey Development Board (DT)
[  371.526338] pstate: 60400005 (nZCv daif +PAN -UAO)
[  371.531148] pc : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  371.537088] lr : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  371.543019] sp : ffffff800e273a10
[  371.546344] x29: ffffff800e273a40 x28: 00000000000012a7 
[  371.551678] x27: 0000000000000188 x26: 0000000000000038 
[  371.557010] x25: 0000000000000000 x24: 0000000000000001 
[  371.562342] x23: 0000000000000000 x22: ffffffc074dab080 
[  371.567673] x21: ffffff8009151aeb x20: ffffffc074d4f800 
[  371.573005] x19: ffffffc03b247500 x18: 0000000000000001 
[  371.578336] x17: 0000000000000000 x16: 0000000000000000 
[  371.583668] x15: ffffff8008da53ac x14: ffffff8008ef1330 
[  371.589001] x13: 000000000000c0aa x12: 00000000d0555555 
[  371.594332] x11: 0000000000000000 x10: 0000000000000000 
[  371.599663] x9 : f9c216069042a400 x8 : f9c216069042a400 
[  371.604995] x7 : 206b6e616c627620 x6 : ffffff80094a6d22 
[  371.610325] x5 : 0000000000000000 x4 : 0000000000000000 
[  371.615656] x3 : 0000000000000036 x2 : 0000000000000001 
[  371.620988] x1 : 0000000000000000 x0 : 0000000000000026 
[  371.626319] Call trace:
[  371.628786]  drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  371.634377]  drm_atomic_helper_commit_tail+0xd8/0x15c
[  371.639445]  commit_tail+0x4c/0x74
[  371.642864]  drm_atomic_helper_commit+0x310/0x32c
[  371.647588]  drm_atomic_connector_commit_dpms+0x110/0x128
[  371.653006]  drm_mode_obj_set_property_ioctl+0x154/0x2c8
[  371.658334]  drm_connector_property_set_ioctl+0x44/0x68
[  371.663578]  drm_ioctl_kernel+0x100/0x140
[  371.667603]  drm_ioctl+0x27c/0x404
[  371.671023]  do_vfs_ioctl+0x4dc/0x728
[  371.674699]  __arm64_sys_ioctl+0x70/0x98
[  371.678642]  el0_svc_common+0x9c/0x180
[  371.682409]  el0_svc_handler+0x28/0x60
[  371.686175]  el0_svc+0x8/0x300
[  371.689242] ---[ end trace 41c8724a288657da ]---
[  372.373461] binder: undelivered TRANSACTION_COMPLETE
[  372.378948] binder: undelivered transaction 50753, process died.
[  372.386153] binder: undelivered transaction 50754, process died.
[  373.721155] binder: 3184:3184 transaction failed 29189/-22, size 104-0 line 3077
[  381.918720] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:29:crtc-0] flip_done timed out
[  381.982703] ------------[ cut here ]------------
[  381.987346] [CRTC:29:crtc-0] vblank wait timed out
[  381.992245] WARNING: CPU: 3 PID: 57 at drivers/gpu/drm/drm_atomic_helper.c:1386 drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  382.003638] Modules linked in:
[  382.006704] CPU: 3 PID: 57 Comm: kworker/u16:2 Tainted: G        W         4.19.278-g89c8d6ab661e-dirty #1
[  382.016360] Hardware name: HiKey Development Board (DT)
[  382.021591] Workqueue: events_unbound commit_work
[  382.026301] pstate: 60400005 (nZCv daif +PAN -UAO)
[  382.031095] pc : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  382.037018] lr : drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  382.042937] sp : ffffff80096bbc80
[  382.046250] x29: ffffff80096bbcb0 x28: 00000000000012a7 
[  382.051566] x27: 0000000000000188 x26: 0000000000000038 
[  382.056882] x25: 0000000000000000 x24: 0000000000000001 
[  382.062197] x23: 0000000000000000 x22: ffffffc074dab080 
[  382.067513] x21: ffffff8009151aeb x20: ffffffc074d4f800 
[  382.072828] x19: ffffffc03b247b00 x18: 0000000000000001 
[  382.078144] x17: 0000000000000000 x16: 0000000000000000 
[  382.083459] x15: ffffff8008da53ac x14: ffffff8008ef1330 
[  382.088775] x13: 000000000000c71a x12: 00000000d0555555 
[  382.094090] x11: 0000000000000000 x10: 0000000000000000 
[  382.099404] x9 : f9c216069042a400 x8 : f9c216069042a400 
[  382.104720] x7 : 206b6e616c627620 x6 : ffffff80094a6d22 
[  382.110035] x5 : 0000000000000000 x4 : 0000000000000000 
[  382.115350] x3 : 0000000000000036 x2 : 0000000000000001 
[  382.120666] x1 : 0000000000000000 x0 : 0000000000000026 
[  382.125981] Call trace:
[  382.128430]  drm_atomic_helper_wait_for_vblanks+0x1cc/0x20c
[  382.134006]  drm_atomic_helper_commit_tail+0xd8/0x15c
[  382.139060]  commit_tail+0x4c/0x74
[  382.142463]  commit_work+0x10/0x18
[  382.145867]  process_one_work+0x1ec/0x430
[  382.149878]  worker_thread+0x260/0x4a8
[  382.153629]  kthread+0x134/0x150
[  382.156859]  ret_from_fork+0x10/0x18
[  382.160435] ---[ end trace 41c8724a288657db ]---
liuyq commented 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...
liuyq commented 1 year ago

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]}
liuyq commented 1 year ago
$ 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);
    }
liuyq commented 1 year ago

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) {

define DRM_DEBUG_DRIVER(fmt, ...) \

drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)

echo 0x2 > /sys/module/drm/parameters/debug

liuyq commented 1 year ago

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)