Hi Tung,

I have tested my FB driver, it’s OK! And I found Boot logo can swap color, but 
android system can’t. 

I’m puzzled with this. Does system not use FB?

Best regards,
Qingwei

From: lqw1...@gmail.com 
Sent: Friday, September 09, 2011 1:58 PM
To: Tung Dang 
Cc: android-porting 
Subject: Re: [android-porting] i.MX51 BBG: How to swap red color with blue on 
DISP2 (RGB565 -> BGR565)

Hi Tung,

Thank you! 

I have ever done the similar thing with our FB driver, but it did not take 
effect. Maybe our platform made some special changes, or driver has bugs. I’ll 
check them carefully.

BTW, I wonder if there is another way to implement, e.g. modify fbmem.c or 
other files.

Best regards,
Qingwei

From: Tung Dang 
Sent: Friday, September 09, 2011 1:19 PM
To: lqw1...@gmail.com 
Cc: android-porting 
Subject: Re: [android-porting] i.MX51 BBG: How to swap red color with blue on 
DISP2 (RGB565 -> BGR565)

Hi QingWei,

Last time I tried to swap the color on Android VNC Server, which use the 
virtual frame buffer driver in kernel/drivers/video/vfb.c
In your case, you should do the same with your FB driver. You should check your 
kernel boot parameter also, to make sure the input setting for your Video 
Output is RGB565. 
But last time I did on Android 2.2, I am not very sure what has been changed 
with the display mechanism on new Android.

<<kernel/drivers/video/vfb.c>>

static int vfb_check_var(struct fb_var_screeninfo *var,
             struct fb_info *info)
{
    u_long line_length;

    /*
     *  FB_VMODE_CONUPDATE and FB_VMODE_SMOOTH_XPAN are equal!
     *  as FB_VMODE_SMOOTH_XPAN is only used internally
     */

    if (var->vmode & FB_VMODE_CONUPDATE) {
        var->vmode |= FB_VMODE_YWRAP;
        var->xoffset = info->var.xoffset;
        var->yoffset = info->var.yoffset;
    }

    /*
     *  Some very basic checks
     */
    if (!var->xres)
        var->xres = 1;
    if (!var->yres)
        var->yres = 1;
    if (var->xres > var->xres_virtual)
        var->xres_virtual = var->xres;
    if (var->yres > var->yres_virtual)
        var->yres_virtual = var->yres;
    if (var->bits_per_pixel <= 1)
        var->bits_per_pixel = 1;
    else if (var->bits_per_pixel <= 8)
        var->bits_per_pixel = 8;
    else if (var->bits_per_pixel <= 16)
        var->bits_per_pixel = 16;
    else if (var->bits_per_pixel <= 24)
        var->bits_per_pixel = 24;
    else if (var->bits_per_pixel <= 32)
        var->bits_per_pixel = 32;
    else
        return -EINVAL;

    if (var->xres_virtual < var->xoffset + var->xres)
        var->xres_virtual = var->xoffset + var->xres;
    if (var->yres_virtual < var->yoffset + var->yres)
        var->yres_virtual = var->yoffset + var->yres;

    /*
     *  Memory limit
     */
    line_length =
        get_line_length(var->xres_virtual, var->bits_per_pixel);
    if (line_length * var->yres_virtual > videomemorysize)
        return -ENOMEM;

    /*
     * Now that we checked it we alter var. The reason being is that the video
     * mode passed in might not work but slight changes to it might make it 
     * work. This way we let the user know what is acceptable.
     */
    switch (var->bits_per_pixel) {
    case 1:
    case 8:
        var->red.offset = 0;
        var->red.length = 8;
        var->green.offset = 0;
        var->green.length = 8;
        var->blue.offset = 0;
        var->blue.length = 8;
        var->transp.offset = 0;
        var->transp.length = 0;
        break;
    case 16:        /* RGBA 5551 */
        if (var->transp.length) {
            var->red.offset = 0;
            var->red.length = 5;
            var->green.offset = 5;
            var->green.length = 5;
            var->blue.offset = 10;
            var->blue.length = 5;
            var->transp.offset = 15;
            var->transp.length = 1;
        } else {    /* RGB 565 */
            var->red.offset = 0; /* => modify to 11 */
            var->red.length = 5;
            var->green.offset = 5;
            var->green.length = 6;
            var->blue.offset = 11; /* => modify to 0 */
            var->blue.length = 5;
            var->transp.offset = 0;
            var->transp.length = 0;
        }
        break;
    case 24:        /* RGB 888 */
        var->red.offset = 0;
        var->red.length = 8;
        var->green.offset = 8;
        var->green.length = 8;
        var->blue.offset = 16;
        var->blue.length = 8;
        var->transp.offset = 0;
        var->transp.length = 0;
        break;
    case 32:        /* RGBA 8888 */
        var->red.offset = 0;
        var->red.length = 8;
        var->green.offset = 8;
        var->green.length = 8;
        var->blue.offset = 16;
        var->blue.length = 8;
        var->transp.offset = 24;
        var->transp.length = 8;
        break;
    }
    var->red.msb_right = 0;
    var->green.msb_right = 0;
    var->blue.msb_right = 0;
    var->transp.msb_right = 0;

    return 0;
}

Regards,
Tung


On Fri, Sep 9, 2011 at 9:48 AM, <lqw1...@gmail.com> wrote:

  Hi, Dang,

  We’re using driver/video/mxc/mxc_ipuv3_fb.c as framebuffer driver, and I 
think the only thing I should do is modify check_var to re-define fb_bitfield, 
right?

  Or I should modify other file? Could you please give a example or further 
tips?

  Thanks a lot!

  BR,
  Qingwei

  From: Tung Dang 
  Sent: Friday, September 09, 2011 8:42 AM
  To: lqw1...@gmail.com 
  Cc: android-porting 
  Subject: Re: [android-porting] i.MX51 BBG: How to swap red color with blue on 
DISP2 (RGB565 -> BGR565)

  Hi Qingwei,

  The correct way is to modify in your frame buffer display driver , just swap 
between B and R
  The frame buffer display driver is in your linux kernel driver 
/linux-xxx/drivers/video 

  Regards,
  Tung


  On Thu, Sep 8, 2011 at 8:43 PM, <lqw1...@gmail.com> wrote:

    Hi,

    Now I have to use BGR565 instead of RGB565, so I modified following codes, 
but they have no effect.
    file:
    mxc_ipuv3_fb.c, function: mxcfb_check_var
    ......
    switch
    (var->bits_per_pixel) {
    case 8:
        ......
        break;
    case 16:
       var->red.length = 5;
       var->red.offset = 11;   ----> 0
       var->red.msb_right = 0;
       var->green.length = 6;
       var->green.offset = 5;
       var->green.msb_right = 0;
       var->blue.length = 5;
       var->blue.offset = 0;   ---->11
       var->blue.msb_right = 0;
       ......
       break;
    case 24:
    ......

    And then, I modified _ipu_ch_params_set_packing in 
drivers/mxc/ipu3/ipu_param_mem.h, and found the color of UI is correct, but 
camera preview/taking photo/recording, video playing are not correct (R and B 
color are reversed).

    I think the best way is to modify framebuffer, but I don’t know how to do.

    Does anyone have some ideas?

    BR,
    Qingwei

    -- 
    unsubscribe: android-porting+unsubscr...@googlegroups.com
    website: http://groups.google.com/group/android-porting


-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to