[Fix] Banding problem fix with launcherPro on widgets.

Search This thread

hg3atintin

Senior Member
Jan 30, 2010
713
58
On all roms there is a banding problem due to our screens 65 k colors.

But launcherpro fixes the banding problems on widgets :) But on some gingerbread roms it does not.

I have not made this fix. But I have tested it on some roms. Im am just sharing this. credit goes to Tytung who took his time and fixed this in his latest 2.5 rom and GPC + other developers that may have found this already.

I have tried it on Tyweens cm7 rom, Tytungs rom and some other. But it "maybe" works on others to? Like gpc's one?

= When using launcher pro with this fix. The launcher will have no banding problems on widgets and on the homescreen. But other banding problems will still be there like it was before.

So without fix ,the clock widget will look like crap in launcher pro in tyweens cm7 rom. But with the fix it will look smooth.

The zip changes the libsurfaceflinger.so.

Flash in cwm.
 

Attachments

  • gradient-fix_update.zip
    431.8 KB · Views: 785
Last edited:

malaeus

Senior Member
Mar 27, 2009
934
21
will this work on other HD2 NAND roms using launcherpro? like using hyperdroid CM7?
 

iamgpc

Senior Member
Sep 19, 2008
141
261
Taiwan
The source code

If you are a developer of source code maker, the following is my fix for banding issue. (NOT Tytung, i don't know how he fix it:( )


The source code path :
/frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp

Function position:
Code:
sp<Layer> SurfaceFlinger::createNormalSurface(
        const sp<Client>& client, DisplayID display,
        uint32_t w, uint32_t h, uint32_t flags,
        PixelFormat& format)
{
    // initialize the surfaces
    switch (format) { // TODO: take h/w into account
    case PIXEL_FORMAT_TRANSPARENT:
    case PIXEL_FORMAT_TRANSLUCENT:
        format = PIXEL_FORMAT_RGBA_8888;
        break;
    case PIXEL_FORMAT_OPAQUE:
        //format = PIXEL_FORMAT_RGBX_8888;
 	format = PIXEL_FORMAT_RGB_565;
        break;
    }

    sp<Layer> layer = new Layer(this, display, client);
    status_t err = layer->setBuffers(w, h, format, flags);
    if (LIKELY(err != NO_ERROR)) {
        LOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
        layer.clear();
    }
    return layer;
}

Modified code:
Code:
case PIXEL_FORMAT_OPAQUE:
        //format = PIXEL_FORMAT_RGBX_8888;
 	format = PIXEL_FORMAT_RGB_565;
        break;

Reason:
It is caused by the display driver is not match with HD2. The gingerbread has fix it on driver level with new pixel format RGBX_8888, however it is still not working for HD2. So we have to force the default pixel format into RGB565 :D
 
Last edited:

tytung

Senior Member
Jun 21, 2010
3,574
15,005
sites.google.com
If you are a developer of source code maker, the following is my fix for banding issue. (NOT Tytung, i don't know how he fix it:( )

skip...

I think I need to clarify something.

Gpc sent a private message and asked me how I fixed the color banding issue on 27th March 2011, 09:50 PM.
P.S.: Admin can confirm this.

Because I was busy at that time, I replied his question by only giving him this link including libsurfaceflinger.so.

Then maybe he fixed this issue from the source code by himself, but he really got hints from me.



Let us go back about 20 days ago.

In fact, I tried to solve this color banding issue since 13th March 2011, and I shared my possible method in my thread.
http://xdaforums.com/showpost.php?p=12049180&postcount=2487

When I had time, I released a modified/recompiled libsurfaceflinger.so on 21st March 2011, and requested other users to test it.
http://xdaforums.com/showpost.php?p=12241393&postcount=2846

Then I included this .so file in my v2.5 ROM.
Gpc saw my change log and sent me a private message, and ...

That's the whole story.
 
Last edited:
Jul 15, 2010
21
1
I'm not getting 3g, only EDGE on this ROM. My APN settings are right and data is definitely on so I don't know what the problem is. I have a T-Mobile HD2 and T-Mobile. Please help.
 

Blubster

Senior Member
Oct 28, 2007
295
30
Annecy
OnePlus 6
Xiaomi Poco F1
Tried this fix, and i am truly impressed! No longer banding using ADW Ex and even XDA App! It does not seem to "fix" only launcher pro to me! :)

EDIT : copilot still has banding though, but not a big deal given the improvements elsewhere! :)
 
Last edited:

iamgpc

Senior Member
Sep 19, 2008
141
261
Taiwan
When I had time, I released a modified/recompiled libsurfaceflinger.so on 21st March 2011, and requested other users to test it.
http://xdaforums.com/showpost.php?p=12241393&postcount=2846.
humm,

Do you modify the libsurfaceflinger like mine? Do you compile with BOARD_NO_RGBX_8888 := true to fix this isse?

Because my libsurfaceflinger is changed for my personal using. I also modify somewhere else for my testing, so that I cannot use your libsurfaceflinger.

I don't know what you modify in your source code, so I have to find out the root cause.

According to Google search on "android color banding", you can find a JAVA solution on color banding.

http://stuffthathappens.com/blog/2010/06/04/android-color-banding/

It says the PixelFormat will take effect on banding issue. Take a look on surfaceflinger source code, you can find out the PixelFormat.OPAQUE and PixelFormat.RGBA_8888 will cause the different result.

Finally, you just have to modify the PixelFormat.OPAQUE from RGBX_8888 to RGB_565 :cool::cool::cool:
 
Last edited:

tytung

Senior Member
Jun 21, 2010
3,574
15,005
sites.google.com
humm,

Do you modify the libsurfaceflinger like mine? Do you compile with BOARD_NO_RGBX_8888 := true to fix this isse?

Because my libsurfaceflinger is changed for my personal using. I also modify somewhere else for my testing, so that I cannot use your libsurfaceflinger.

I don't know what you modify in your source code, so I have to find out the root cause.

According to Google search on "android color banding", you can find a JAVA solution on color banding.

http://stuffthathappens.com/blog/2010/06/04/android-color-banding/

It says the PixelFormat will take effect on banding issue. Take a look on surfaceflinger source code, you can find out the PixelFormat.OPAQUE and PixelFormat.RGBA_8888 will cause the different result.

Finally, you just have to modify the PixelFormat.OPAQUE from RGBX_8888 to RGB_565 :cool::cool::cool:

Yes, I compiled with BOARD_NO_RGBX_8888 := true to fix this issue.
BTW, you didn't know how I modified my source code because you didn't say that you want to see my modified source code in the private message.
Anyway, I only changed the color support of the config file from RGBX_8888 to RGB_565.
And you don't need to modify SurfaceFlinger.cpp because setting NO_RGBX_8888 in config file is enough.
Below is the detail.

Before Google released Gingerbread OTA 2.3.3, we could only use Froyo OTA's proprietary files to work with Gingerbread source code when we compiled AOSP Gingerbread 2.3.2 or 2.3.1.
And Froyo's proprietary files are not compatible with Gingerbread source code, so we needed to fix the RGB_565 problem by applying the following two commits at that time.
https://github.com/CyanogenMod/andr...mmit/d06cf2371b2db46ab4ecedea832e4c17f3591165
https://github.com/CyanogenMod/andr...mmit/baa078471f4198bd73819794f2713a845305a227

After Google released Gingerbread OTA 2.3.3, we used Gingerbread OTA's proprietary files to work with Gingerbread source code when we compiled AOSP Gingerbread 2.3.3.
At the same time, I removed these two commits above when compiling a new GB 2.3.3 ROM.
That's why hg3atintin (Thanks to him.) told me that my GB 2.3.3 ROM had the color banding issue but my GB 2.3.2 ROM didn't.
Finally, I added back these two commits and compiled a new surfaceflinger.so.
Then the color banding issue is improved.
 
  • Like
Reactions: Major_Sarcasm

Rando81

Senior Member
Sep 4, 2008
165
13
it fixed my launcherpro :p , calculator had severe banding but its fixed too
nice job mate
 

ludetekniq

New member
Dec 27, 2007
2
0
How do I apply this fix to my AmericAndroid SD build? Any help would be appreciated...

P.S. I searched this thread and others and cant figure it out, please point me in the right direx... What is CWM btw because it says to flash with CWM?
 

666Duvel666

Senior Member
Aug 13, 2008
76
2
Vila Nova de Gaia
How do I apply this fix to my AmericAndroid SD build? Any help would be appreciated...

P.S. I searched this thread and others and cant figure it out, please point me in the right direx... What is CWM btw because it says to flash with CWM?


Hi ludetekniq.

You're in the wrong place. This is NAND development forum and not SD development. You can only install this fix if you have a NAND Rom in your HD2.

;)

EDIT: CWM = Clockworkmod Recovery. It's a tool that we use, to help flashing and recover Roms on NAND.
 
Last edited:

666Duvel666

Senior Member
Aug 13, 2008
76
2
Vila Nova de Gaia
silly question..lol
what is the banding problem? :))

Well... from what I understood, its an issue related to the color depth of HD2 screens. Our HD2 Android is displaying 16 bit color insted of 32 bit because of a driver's issue... it loses quality because it's displaying less colors. With 32 bit you will see a smoother color gradient.

Please devs correct me if i'm wrong!

Cheers from Portugal!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    On all roms there is a banding problem due to our screens 65 k colors.

    But launcherpro fixes the banding problems on widgets :) But on some gingerbread roms it does not.

    I have not made this fix. But I have tested it on some roms. Im am just sharing this. credit goes to Tytung who took his time and fixed this in his latest 2.5 rom and GPC + other developers that may have found this already.

    I have tried it on Tyweens cm7 rom, Tytungs rom and some other. But it "maybe" works on others to? Like gpc's one?

    = When using launcher pro with this fix. The launcher will have no banding problems on widgets and on the homescreen. But other banding problems will still be there like it was before.

    So without fix ,the clock widget will look like crap in launcher pro in tyweens cm7 rom. But with the fix it will look smooth.

    The zip changes the libsurfaceflinger.so.

    Flash in cwm.
    5
    The source code

    If you are a developer of source code maker, the following is my fix for banding issue. (NOT Tytung, i don't know how he fix it:( )


    The source code path :
    /frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp

    Function position:
    Code:
    sp<Layer> SurfaceFlinger::createNormalSurface(
            const sp<Client>& client, DisplayID display,
            uint32_t w, uint32_t h, uint32_t flags,
            PixelFormat& format)
    {
        // initialize the surfaces
        switch (format) { // TODO: take h/w into account
        case PIXEL_FORMAT_TRANSPARENT:
        case PIXEL_FORMAT_TRANSLUCENT:
            format = PIXEL_FORMAT_RGBA_8888;
            break;
        case PIXEL_FORMAT_OPAQUE:
            //format = PIXEL_FORMAT_RGBX_8888;
     	format = PIXEL_FORMAT_RGB_565;
            break;
        }
    
        sp<Layer> layer = new Layer(this, display, client);
        status_t err = layer->setBuffers(w, h, format, flags);
        if (LIKELY(err != NO_ERROR)) {
            LOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err));
            layer.clear();
        }
        return layer;
    }

    Modified code:
    Code:
    case PIXEL_FORMAT_OPAQUE:
            //format = PIXEL_FORMAT_RGBX_8888;
     	format = PIXEL_FORMAT_RGB_565;
            break;

    Reason:
    It is caused by the display driver is not match with HD2. The gingerbread has fix it on driver level with new pixel format RGBX_8888, however it is still not working for HD2. So we have to force the default pixel format into RGB565 :D
    5
    If you are a developer of source code maker, the following is my fix for banding issue. (NOT Tytung, i don't know how he fix it:( )

    skip...

    I think I need to clarify something.

    Gpc sent a private message and asked me how I fixed the color banding issue on 27th March 2011, 09:50 PM.
    P.S.: Admin can confirm this.

    Because I was busy at that time, I replied his question by only giving him this link including libsurfaceflinger.so.

    Then maybe he fixed this issue from the source code by himself, but he really got hints from me.



    Let us go back about 20 days ago.

    In fact, I tried to solve this color banding issue since 13th March 2011, and I shared my possible method in my thread.
    http://xdaforums.com/showpost.php?p=12049180&postcount=2487

    When I had time, I released a modified/recompiled libsurfaceflinger.so on 21st March 2011, and requested other users to test it.
    http://xdaforums.com/showpost.php?p=12241393&postcount=2846

    Then I included this .so file in my v2.5 ROM.
    Gpc saw my change log and sent me a private message, and ...

    That's the whole story.
    1
    humm,

    Do you modify the libsurfaceflinger like mine? Do you compile with BOARD_NO_RGBX_8888 := true to fix this isse?

    Because my libsurfaceflinger is changed for my personal using. I also modify somewhere else for my testing, so that I cannot use your libsurfaceflinger.

    I don't know what you modify in your source code, so I have to find out the root cause.

    According to Google search on "android color banding", you can find a JAVA solution on color banding.

    http://stuffthathappens.com/blog/2010/06/04/android-color-banding/

    It says the PixelFormat will take effect on banding issue. Take a look on surfaceflinger source code, you can find out the PixelFormat.OPAQUE and PixelFormat.RGBA_8888 will cause the different result.

    Finally, you just have to modify the PixelFormat.OPAQUE from RGBX_8888 to RGB_565 :cool::cool::cool:

    Yes, I compiled with BOARD_NO_RGBX_8888 := true to fix this issue.
    BTW, you didn't know how I modified my source code because you didn't say that you want to see my modified source code in the private message.
    Anyway, I only changed the color support of the config file from RGBX_8888 to RGB_565.
    And you don't need to modify SurfaceFlinger.cpp because setting NO_RGBX_8888 in config file is enough.
    Below is the detail.

    Before Google released Gingerbread OTA 2.3.3, we could only use Froyo OTA's proprietary files to work with Gingerbread source code when we compiled AOSP Gingerbread 2.3.2 or 2.3.1.
    And Froyo's proprietary files are not compatible with Gingerbread source code, so we needed to fix the RGB_565 problem by applying the following two commits at that time.
    https://github.com/CyanogenMod/andr...mmit/d06cf2371b2db46ab4ecedea832e4c17f3591165
    https://github.com/CyanogenMod/andr...mmit/baa078471f4198bd73819794f2713a845305a227

    After Google released Gingerbread OTA 2.3.3, we used Gingerbread OTA's proprietary files to work with Gingerbread source code when we compiled AOSP Gingerbread 2.3.3.
    At the same time, I removed these two commits above when compiling a new GB 2.3.3 ROM.
    That's why hg3atintin (Thanks to him.) told me that my GB 2.3.3 ROM had the color banding issue but my GB 2.3.2 ROM didn't.
    Finally, I added back these two commits and compiled a new surfaceflinger.so.
    Then the color banding issue is improved.