Cannot capture the SurfaceFlinger

Hi,

I want to capture android’s SurfaceFlinger using PVRCarbon.
I tried to capture with the PVRCarbon GUI tool, but there is no ‘SurfaceFlinger’ on the list.
image

Is it impossible? or any other way?

Hello YoungJun,

I’ll pass your query onto the Carbon team, in the meantime a couple things to note. it looks like you’re using an outdated version of Carbon, the newest version is available on our new developer portal : Downloads - Imagination Developers

Secondly, I’d recommend using PVRTune while running another application, as I know that the surface flinger shows up while running another application. I might also recommend taking a carbon recording of another application, and checking the list of function calls to see if any of them are owned by the surface flinger.

I’ll further investigate profiling the surface flinger itself.

All the best,
Lawrence

Hi Lawrence,

Thanks for your effort. I changed the newer Carbon version with your comment, but it is not on the list.
Secondly thing, You’re right. An update to the screen is required for the surface flinger to work. I ran PVRTune as your recommendation but still couldn’t check the surface flinger.

I hope your help.

Thanks,
Youngjun

Hi Youngjun,

Just to double check and help us identify the difficulties, which PowerVR device are you using? and do you know the DDK version?
When I take a recording of an SDK example with PVRTuneDeveloper 21.1, I see a render task with a different PID interrupting the application’s render task. You can distinguish the PID at a glance by the colour on the top of the task, the surface flinger should stand out from being different from the surrounding tasks, as you can see below.

Screenshot 2021-06-02 160444
Screenshot 2021-06-02 161644

I’m still looking into capturing the surface flinger directly, and will let you know if I find anything further

Hi Lawrence,

Thanks for your effort. This is my device information,

Driver Version: Rogue_DDK_Android rogueddk 1.13@5776728 (Unknown) (release) build options: 0x00000010 android
Device Name: PowerVR_9XTP
GPU variant BVNC: 27.5.254.2 (HW)
Firmware Version: 1.13 @ 5776728 (release) build options: 0x80000010 android

I’ll also do try to capture the surface flinger.

Thanks,
Youngjun

Hi Youngjun,

I’ve had some feedback from the tools team, and it should theoretically be possible with Carbon, it involves a similar process to capturing the Weston compositor. You have to manually set up the layers on the system.
You can find more detailed instructions for loading PVRCarbon layers to start recordings from within the documentation folder inside carbon for more detail, but I’ll also list the steps here.

  • Copy the layers inside Recorder/Android/[DEVICE_CPU_ARCHITECTURE]/ to /data/local/debug/gles
adb root
adb disable-verity
adb reboot
adb root
adb shell setenforce 0
adb shell mkdir -p "/data/local/debug/gles"
adb push libEGL.so "/data/local/debug/gles"
adb push libGLESv2.so "/data/local/debug/gles"
adb push libPVRCarbon.so "/data/local/debug/gles"
adb push libGlLayer_PowerVR_carbon.so "/data/local/debug/gles"
  • Enable the PVRRecording Layer globally
adb shell settings put global enable_gpu_debug_layers 1 
adb shell setprop debug.gles.layers libGlLayer_PowerVR_carbon.so
  • Upon restarting surface flinger the Carbon recording layer might be able to start recording, killing surface flinger should cause android to restart it.
adb shell pidof surfaceflinger
adb shell kill -9 <PID Returned from the previous statement>

However Since you said that the surface flinger is not appearing inside of PVRTune this might raise some issues. Tune uses the GPU counters, so any work submitted to the GPU should be appearing there. If Tune is not detecting the surface flinger, this might suggest that surface flinger is being accelerated by another piece of hardware or not being accelerated at all. If this is the case, Carbon won’t be able to record this workload since it might not be done via API calls, and carbon captures its recordings via a list of API calls.

Hopefully this method is successful, all the best,
Lawrence

© Imagination Technologies Limited. All rights reserved.
Privacy PolicyTerms & ConditionsTrademarksCookies