Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vc4: Android HWUI rendering on RPI3 freezes screen #117

Closed
babyimp opened this issue Oct 18, 2017 · 5 comments
Closed

vc4: Android HWUI rendering on RPI3 freezes screen #117

babyimp opened this issue Oct 18, 2017 · 5 comments

Comments

@babyimp
Copy link

babyimp commented Oct 18, 2017

Hi,

I'm working with Android Things in Google.
When HWUI rendering is enabled on RPI3 where Android Things DP5.1 is installed, app screen is frozen.

Steps to reproduce:

  1. Install Android Things DP5.1 on RPI3
  2. Boot RPI3
  3. Change the system property
    % adb connect xx.xx.xx.xx
    % adb shell setprop persist.sys.ui.hw true
  4. Reboot RPI3

Now, booting animation is okay, but IoTLauncher is not rendered properly. Then, ANR occurs.
According to ANR log (attached) for IoTLauncher, HWUI renderer seems to wait for other to signal fence.

This issue might be more relevant to mesa, but I hope to get some hints to solve this issue here.

anr_log.txt

@anholt
Copy link
Owner

anholt commented Oct 18, 2017

Could you come up with a testcase for piglit or intel-gpu-tools that exposes whatever fencing issue you have?

I actually suspect that your UI may be trying to use extensions that don't exist -- we don't have android native fences exposed (our implementation is all implicitly synced, so we've never needed explicit fencing).

@babyimp
Copy link
Author

babyimp commented Oct 23, 2017

You mean, unless mesa supports android native fences, it may not be possible to enable HW UI rendering?

@anholt
Copy link
Owner

anholt commented Oct 24, 2017

From the log you appear to be running drm_hwcomposer, which has the following code:

  // These extensions are all technically required but not always reported due
  // to meta EGL filtering them out.
  if (!HasExtension("EGL_KHR_image_base", egl_extensions))
    ALOGW("EGL_KHR_image_base extension not supported");

  if (!HasExtension("EGL_ANDROID_image_native_buffer", egl_extensions))
    ALOGW("EGL_ANDROID_image_native_buffer extension not supported");

  if (!HasExtension("EGL_ANDROID_native_fence_sync", egl_extensions))
    ALOGW("EGL_ANDROID_native_fence_sync extension not supported");

If you're running drm_hwcomposer, then you really need those extensions and the fact that it tries to run at all without them exposed is a bug imo.

The next step in implementing native_fence_sync is to build some piglit tests we can run that do actual rendering, not just API error validation (upstreamed DEQP or VK-GL-CTS tests doing so would also be fine).

@babyimp
Copy link
Author

babyimp commented Jan 4, 2018

This issue has been unintentionally solved after upgrading to 4.9 and tuning selinux policy for sw_sync.

@babyimp babyimp closed this as completed Jan 4, 2018
@stschake
Copy link

stschake commented Jan 4, 2018

4.9 has no vc4 dma fence support, which is what you want for sync_file and that in consequence makes EGL_ANDROID_native_fence on the mainline kernel interface impossible.

So you might want to check why you are running drm_hwcomposer, because without the EGL extension it can't do it's optimized GL composition and the moment it has to fallback to that, you will crash.

I have a branch for vc4 native fence lying around, but its only been tested on kmscube and you obviously need a kernel with the dma fence support first (see torvalds/linux@cdec4d3)

anholt pushed a commit that referenced this issue Jul 25, 2018
…sfers

This bug happens only when the UDC needs to sleep during usb_ep_dequeue,
as is the case for (at least) dwc3.

[  382.200896] BUG: scheduling while atomic: screen/1808/0x00000100
[  382.207124] 4 locks held by screen/1808:
[  382.211266]  #0:  (rcu_callback){....}, at: [<c10b4ff0>] rcu_process_callbacks+0x260/0x440
[  382.219949]  #1:  (rcu_read_lock_sched){....}, at: [<c1358ba0>] percpu_ref_switch_to_atomic_rcu+0xb0/0x130
[  382.230034]  #2:  (&(&ctx->ctx_lock)->rlock){....}, at: [<c11f0c73>] free_ioctx_users+0x23/0xd0
[  382.230096]  #3:  (&(&ffs->eps_lock)->rlock){....}, at: [<f81e7710>] ffs_aio_cancel+0x20/0x60 [usb_f_fs]
[  382.230160] Modules linked in: usb_f_fs libcomposite configfs bnep btsdio bluetooth ecdh_generic brcmfmac brcmutil intel_powerclamp coretemp dwc3 kvm_intel ulpi udc_core kvm irqbypass crc32_pclmul crc32c_intel pcbc dwc3_pci aesni_intel aes_i586 crypto_simd cryptd ehci_pci ehci_hcd gpio_keys usbcore basincove_gpadc industrialio usb_common
[  382.230407] CPU: 1 PID: 1808 Comm: screen Not tainted 4.14.0-edison+ #117
[  382.230416] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48
[  382.230425] Call Trace:
[  382.230438]  <SOFTIRQ>
[  382.230466]  dump_stack+0x47/0x62
[  382.230498]  __schedule_bug+0x61/0x80
[  382.230522]  __schedule+0x43/0x7a0
[  382.230587]  schedule+0x5f/0x70
[  382.230625]  dwc3_gadget_ep_dequeue+0x14c/0x270 [dwc3]
[  382.230669]  ? do_wait_intr_irq+0x70/0x70
[  382.230724]  usb_ep_dequeue+0x19/0x90 [udc_core]
[  382.230770]  ffs_aio_cancel+0x37/0x60 [usb_f_fs]
[  382.230798]  kiocb_cancel+0x31/0x40
[  382.230822]  free_ioctx_users+0x4d/0xd0
[  382.230858]  percpu_ref_switch_to_atomic_rcu+0x10a/0x130
[  382.230881]  ? percpu_ref_exit+0x40/0x40
[  382.230904]  rcu_process_callbacks+0x2b3/0x440
[  382.230965]  __do_softirq+0xf8/0x26b
[  382.231011]  ? __softirqentry_text_start+0x8/0x8
[  382.231033]  do_softirq_own_stack+0x22/0x30
[  382.231042]  </SOFTIRQ>
[  382.231071]  irq_exit+0x45/0xc0
[  382.231089]  smp_apic_timer_interrupt+0x13c/0x150
[  382.231118]  apic_timer_interrupt+0x35/0x3c
[  382.231132] EIP: __copy_user_ll+0xe2/0xf0
[  382.231142] EFLAGS: 00210293 CPU: 1
[  382.231154] EAX: bfd4508c EBX: 00000004 ECX: 00000003 EDX: f3d8fe50
[  382.231165] ESI: f3d8fe51 EDI: bfd4508d EBP: f3d8fe14 ESP: f3d8fe08
[  382.231176]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  382.231265]  core_sys_select+0x25f/0x320
[  382.231346]  ? __wake_up_common_lock+0x62/0x80
[  382.231399]  ? tty_ldisc_deref+0x13/0x20
[  382.231438]  ? ldsem_up_read+0x1b/0x40
[  382.231459]  ? tty_ldisc_deref+0x13/0x20
[  382.231479]  ? tty_write+0x29f/0x2e0
[  382.231514]  ? n_tty_ioctl+0xe0/0xe0
[  382.231541]  ? tty_write_unlock+0x30/0x30
[  382.231566]  ? __vfs_write+0x22/0x110
[  382.231604]  ? security_file_permission+0x2f/0xd0
[  382.231635]  ? rw_verify_area+0xac/0x120
[  382.231677]  ? vfs_write+0x103/0x180
[  382.231711]  SyS_select+0x87/0xc0
[  382.231739]  ? SyS_write+0x42/0x90
[  382.231781]  do_fast_syscall_32+0xd6/0x1a0
[  382.231836]  entry_SYSENTER_32+0x47/0x71
[  382.231848] EIP: 0xb7f75b05
[  382.231857] EFLAGS: 00000246 CPU: 1
[  382.231868] EAX: ffffffda EBX: 00000400 ECX: bfd4508c EDX: bfd4510c
[  382.231878] ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: bfd45020
[  382.231889]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
[  382.232281] softirq: huh, entered softirq 9 RCU c10b4d90 with preempt_count 00000100, exited with 00000000?

Tested-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants