Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,710
    • Issues 2,710
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 904
    • Merge requests 904
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Merge requests
  • !16515

[DO NOT MERGE] Android: Use perfetto.dev to trace GPU internal metrics

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Roman Stratiienko requested to merge roman.stratiienko/mesa:pps-producer into main May 15, 2022
  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 7

Meson within AOSP scripts can't be used to produce executables (they need some extensive rework to do it).

Therefore this patch is not for merging into mainline/mesa. User can cherry-pick it prior to debugging.

How to use (panfrost-specific example):

  1. Add pps-producer into your device.mk:
    PRODUCT_PACKAGES += pps-producer
  1. Build/deploy android.

  2. Enable additional panfrost IOCTLs, run:

    adb root
    adb shell "echo Y > /sys/module/panfrost/parameters/unstable_ioctls"
  1. Run adb root && adb shell pps-producer, check output in terminal.
    [557.448]        pps_driver.cc:88 Driver selected: panfrost
    [557.449]   pps_datasource.cc:139 Waiting for start

Keep this daemon running, use another terminal for remaining stuff.

  1. Ensure data source is registered by pps-producer daemon Run adb shell perfetto --query , check if output contains:
    gpu.counters.panfrost                    pps-producer ()
  1. Open perfetto.dev in the browser. Click record new trace, enable all necessary events. I could not find any option to add custom dataset using perfetto web UI, therefore you have to click "Recording command", copy and paste it into any text editor and add the following section:
    data_sources: {
      config {
        name: "gpu.counters.panfrost"
        gpu_counter_config {
          counter_period_ns: 1000000
        }
      }
    }
  1. Copy modified commands from the editor and paste them into separate terminal. After record complete check pps-producer is still running. It can fail time-to-time, in this case you have to restart it and repeat the procedure.

  2. Pull the trace from the device:

   adb pull /data/misc/perfetto-traces/trace ~/trace
  1. Open the trace using https://perfetto.dev/ web UI

  2. Have a fun with debugging.

Edited May 15, 2022 by Roman Stratiienko
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: pps-producer