<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chen Jasber on Medium]]></title>
        <description><![CDATA[Stories by Chen Jasber on Medium]]></description>
        <link>https://medium.com/@jasber9999?source=rss-850ae998b1d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3hjr6oQM8kNZripH.</url>
            <title>Stories by Chen Jasber on Medium</title>
            <link>https://medium.com/@jasber9999?source=rss-850ae998b1d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:55:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jasber9999/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tracking layers of Surfaceflinger with winscope]]></title>
            <link>https://medium.com/jas-android-notes/tracking-layers-of-surfaceflinger-with-winscope-ebce09d9b780?source=rss-850ae998b1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebce09d9b780</guid>
            <category><![CDATA[winscope]]></category>
            <category><![CDATA[androiddebugging]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[surfaceflinger]]></category>
            <dc:creator><![CDATA[Chen Jasber]]></dc:creator>
            <pubDate>Thu, 13 Feb 2020 10:04:09 GMT</pubDate>
            <atom:updated>2020-02-13T10:04:09.769Z</atom:updated>
            <content:encoded><![CDATA[<p>Address your visual issue came from surfaceflinger</p><p>Winscope is a prebuilt tool in AOSP which can help you track a period of layers updating of surfaceflinger with any re-building on debug codes or installing any extra module. The simple steps as follows collects trace of layers in surfaceflinger.</p><pre>[enable tracing]<br>adb root<br>adb shell service call SurfaceFlinger 1025 i32 1</pre><pre>[disable tracing]<br>adb shell service call SurfaceFlinger 1025 i32 0</pre><pre>[get your trace file]<br>adb pull /data/misc/wmtrace/layers_trace.pb</pre><p>The tools to open “layers_trace.pb” is called ‘Winscope’, which can be found in ./prebuilts/misc/common/winscope/winscope.html of AOSP. The html file is Winscope, a tool written with javascript. Open winscope.html with a browser and then you can open .pd file in its page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4qQdojkxPVEFutBsP2PRPg.jpeg" /><figcaption>record of layers updating in a period of time</figcaption></figure><p>In my experience, stepping into issue with add debug codes and replace modules in target system are still needed. It almost can not find where is the problem with only browsing these information. But it provide a quick and easy way to get approach on many visual problems from surfaceflinger.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebce09d9b780" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jas-android-notes/tracking-layers-of-surfaceflinger-with-winscope-ebce09d9b780">Tracking layers of Surfaceflinger with winscope</a> was originally published in <a href="https://medium.com/jas-android-notes">JAS Android Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging with Android systrace tags]]></title>
            <link>https://medium.com/jas-android-notes/debugging-with-android-systrace-tags-42360f673359?source=rss-850ae998b1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/42360f673359</guid>
            <category><![CDATA[systrace]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[atrace]]></category>
            <dc:creator><![CDATA[Chen Jasber]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 07:19:39 GMT</pubDate>
            <atom:updated>2020-02-06T07:19:39.030Z</atom:updated>
            <content:encoded><![CDATA[<p>Set your own trace information</p><p>As we know, Android systrace tool provides a good perspective on time-line debugging. The original AOSP already provides valuable systrace tags for profiling performance or other time-line related issues.</p><h3>What does it tell by browsing systrace results ?</h3><p>The following is part of a systrace result (a html file). In this example, the “FrameMissed”, “GpuFrameMissed”, and “HwcFrameMissed” tell the system slows on GPU side with less 60 fps for rendering, not at display side. (refs on an Android-10 platform)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JG50xZwV9YrD-RsEu6l3ew.jpeg" /></figure><p>The source codes would tell more details about these tags. Search Android sources like: “ATRACE_INT(“FrameMissed”, …);” in related modules. (it’s frameworks/native/services/surfaceflinger in this example)</p><h3>Put self-defined information in systrace result</h3><p>People may need more information than default for debugging/profiling Android or their own modules (drivers, customized libs, …). These is the steps to get your own information in systrace.</p><ol><li>Include Trace.h and set trace tag categories</li></ol><pre>#include &lt;utils/Trace.h&gt;<br>#define ATRACE_TAG ATRACE_TAG_GRAPHICS</pre><p>more categories of tag are defined in <a href="http://androidxref.com/9.0.0_r3/xref/system/">system</a>/<a href="http://androidxref.com/9.0.0_r3/xref/system/core/">core</a>/<a href="http://androidxref.com/9.0.0_r3/xref/system/core/include/">include</a>/<a href="http://androidxref.com/9.0.0_r3/xref/system/core/include/cutils/">cutils</a>/<a href="http://androidxref.com/9.0.0_r3/xref/system/core/include/cutils/trace.h">trace.h</a></p><ol><li>Call ATRACE utility functions for your need like:</li></ol><pre>ATRACE_INT(“My Hint String”, 32_bits_int_variable_in_your_code);<br>ATRACE_INT64(“My Hint String”, 64_bits_int_variable_in_your_code);</pre><pre>// get your own func stack in systrace time line<br>ATRACE_CALL();</pre><pre>// set the name of thread block appears in systrace<br>ATRACE_NAME(“My Hint String”);</pre><p>3. Compile and execute your own changes and get systrace results</p><p>The following shows result of “my_test_function”.</p><pre>void my_test_function()<br>{<br>    ATRACE_NAME(&quot;My Test Function&quot;);<br>    // this is my test funciton<br>    for (int i=0; i &lt; 10;i++)<br>    {<br>        ATRACE_INT(&quot;counter&quot;, i);<br>    }<br><br>    ATRACE_CALL();^M<br>    ATRACE_NAME(&quot;&quot;);^M<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6sOQ1nL49MtOzQ_U8SJocw.jpeg" /><figcaption>systrace of “my_test_function”</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42360f673359" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jas-android-notes/debugging-with-android-systrace-tags-42360f673359">Debugging with Android systrace tags</a> was originally published in <a href="https://medium.com/jas-android-notes">JAS Android Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evolution of Android HWComposer architecture]]></title>
            <link>https://medium.com/jas-android-notes/evolution-of-android-hwcomposer-architecture-339721581bc0?source=rss-850ae998b1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/339721581bc0</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[hwc]]></category>
            <category><![CDATA[surfaceflinger]]></category>
            <category><![CDATA[hwcomposer]]></category>
            <dc:creator><![CDATA[Chen Jasber]]></dc:creator>
            <pubDate>Tue, 04 Feb 2020 06:09:38 GMT</pubDate>
            <atom:updated>2020-02-04T06:36:15.942Z</atom:updated>
            <content:encoded><![CDATA[<p>Migrating from HWC1 to HWC2</p><h3>HWC1, Simple and straight forward</h3><p>The initial version of hardware composer interface of Android is simply designed as a Ready-Go two steps mechanism. The descriptions of all layers from SurfaceFlinger for composition are passed in first with “prepare” call to check whether composer can do this kind of composition or not. If composer (means device) has problem to do, it may change part of passed-in description to match its acceptance. The step can be realized as “validate” action to composer. The next step then goes with “set” call to ask composer to present the composition result of previous acceptance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*mUEUKzsrHL7aBM1BSs-1Jw.jpeg" /><figcaption>hwcomposer1</figcaption></figure><h3>HWC2, Context based management</h3><p>Composer module is asked to do more states management in v2 version (hwcomposer2.h). Comparing to previous version, the major difference of hardware composer interface is to management the states of composed layers which we may call context of layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*ZafhkRjrbj15k8kBHY4UbQ.jpeg" /></figure><p>The managing states includes various of features of composed layers, configurations of display (modes) and v-sync related synchronization. Pushing these works to composer side may partially offload surfaceflinger and also leave some capability of optimization to composer at device side. Since implementor of composer knows more on optimization for its specific display hardware system rather than surfaceflinger at common side.</p><p>The basic infrastructure of hardware composer v2 also follows the same validated-then-go flow, but breaks it into more detailed function calls. The process is majorly constructed by validateDisplay(), acceptDisplayChanges(), getCompositionTypes() and presentDisplay().</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*Ui7Kxah3K0_K4Wnl0itNhg.jpeg" /><figcaption>hwcomposer2</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=339721581bc0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jas-android-notes/evolution-of-android-hwcomposer-architecture-339721581bc0">Evolution of Android HWComposer architecture</a> was originally published in <a href="https://medium.com/jas-android-notes">JAS Android Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to debug Android hwui/skia]]></title>
            <link>https://medium.com/jas-android-notes/how-to-debug-android-hwui-skia-20f54615417?source=rss-850ae998b1d------2</link>
            <guid isPermaLink="false">https://medium.com/p/20f54615417</guid>
            <category><![CDATA[skia]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Chen Jasber]]></dc:creator>
            <pubDate>Mon, 03 Feb 2020 09:55:05 GMT</pubDate>
            <atom:updated>2020-02-03T09:55:05.509Z</atom:updated>
            <content:encoded><![CDATA[<h4>Looking at the problems of system ui (reference to Android_P AOSP)</h4><h3>Properties for debugging</h3><p>There are several properties could be changed to identify your system ui problem. You can find them in Android source codes at frameworks/base/libs/hwui/Properties.h</p><p>Your may also use a quick identifying on problem with some options in developer options, set of “drawing”, “hardware accelerated rendering”.</p><h3>dump ui logs and use skia debugger</h3><p>Changing some options or properties may only help you identify UI problem initially. However, you may need a logger to get detailed actions of Android system ui. These kind of tools are usually available from GPU vendors for opengl apps or Android egl trace. But they properly don’t work for system ui. You may need hwui(so called skia) dump and debugger built in Android frameworks. The usage is described as follows.</p><ol><li>Build a debug verson libhwui.so</li></ol><p>You may need to enable “skia dump” mechanism which is not turned on by default.</p><pre>in frameworks/base/libs/hwui/Properties.cpp</pre><pre>change Properties::debuggingEnabled to be &quot;true&quot;, then partialy compile module &quot;libhwui.so&quot; to replace original libs under /system/lib/ in your Android target system.</pre><p>2. Control Properties</p><p>You may use some properties trigger the logger as follows.</p><pre>setprop debug.hwui.capture_skp_enabled 1<br>=&gt; To enable/disable the whole dump mechanism.</pre><pre>setprop debug.hwui.capture_skp_frames 1<br>=&gt; set the number of frames to dump (default is 1 if this property is not set)<br>Then use stop/start to restart your Android system and make previous setting effective.</pre><pre>setprop debug.hwui.skp_filename /data/skdump1.skp<br>=&gt; This is to set the name and path of your dump files. Make sure the folder is accessible (chmod 777) and turn off selinux. You may get each dump file for each frame. It will stop dump data when the number of frames you set are finished. You may trigger the same logging by setting filename differently from previous one.</pre><pre>Source can be found in <a href="http://androidxref.com/9.0.0_r3/xref/frameworks/base/libs/hwui/pipeline/skia/">frameworks/base/libs/hwui/pipeline/skia/</a>SkiaPipeline.cpp</pre><p>3. Browsing hwui/skia dump files by debugger.skia.org</p><p>The dump files are readable in plane text. You may need to browse with specific browser. The browser is web based at <a href="https://debugger.skia.org/">https://debugger.skia.org/</a></p><p>You may check detailed UI rendering steps by steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TrBFQaNkCg0XO2VrOU14LQ.jpeg" /><figcaption>There are list of rendering actions, resulted image, and scaledup image for checking every pixels.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20f54615417" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jas-android-notes/how-to-debug-android-hwui-skia-20f54615417">How to debug Android hwui/skia</a> was originally published in <a href="https://medium.com/jas-android-notes">JAS Android Notes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>