All of lore.kernel.org
 help / color / mirror / Atom feed
* [powerpc] offb: red / blue color inversion
@ 2016-06-09 12:25 Mathieu Malaterre
  2016-06-17  7:11 ` Geert Uytterhoeven
  2016-09-13 13:37 ` Mathieu Malaterre
  0 siblings, 2 replies; 3+ messages in thread
From: Mathieu Malaterre @ 2016-06-09 12:25 UTC (permalink / raw)
  To: linux-fbdev

Dear all,

I am trying to fix an issue with color inversion in the current offb.c
implementation. I am using a Mac Mini G4 (PPC) with:

[    0.844144] fb0: Open Firmware frame buffer device on
/pci@f0000000/ATY,RockHopper2Parent@10/ATY,RockHopper2_A@0

reported as [*]. I have tried looking at the upstream code source, and
it appears that my configuration falls into the 'cmap_simple'. But
other than that I failed to understand what could be wrong (palette
would be setup backward).

What are the low level tool (user-space) I can use to try to
understand what is wrong with offb on my machine without rebuilding
the kernel (CONFIG_FB_OF is not a module) ?

Thanks much,



[*] $ fbset -i

mode "800x600-186"
    # D: 100.000 MHz, H: 119.048 kHz, V: 186.012 Hz
    geometry 800 600 800 600 8
    timings 10000 16 16 16 16 8 8
    rgba 8/0,8/0,8/0,0/0
endmode

Frame buffer device information:
    Name        : OFfb ATY,RockHo
    Address     : 0x9c008000
    Size        : 614400
    Type        : PACKED PIXELS
    Visual      : PSEUDOCOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 1024
    Accelerator : No

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [powerpc] offb: red / blue color inversion
  2016-06-09 12:25 [powerpc] offb: red / blue color inversion Mathieu Malaterre
@ 2016-06-17  7:11 ` Geert Uytterhoeven
  2016-09-13 13:37 ` Mathieu Malaterre
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2016-06-17  7:11 UTC (permalink / raw)
  To: linux-fbdev

Hi Mathieu,

On Thu, Jun 9, 2016 at 2:25 PM, Mathieu Malaterre <malat@debian.org> wrote:
> I am trying to fix an issue with color inversion in the current offb.c
> implementation. I am using a Mac Mini G4 (PPC) with:
>
> [    0.844144] fb0: Open Firmware frame buffer device on
> /pci@f0000000/ATY,RockHopper2Parent@10/ATY,RockHopper2_A@0
>
> reported as [*]. I have tried looking at the upstream code source, and
> it appears that my configuration falls into the 'cmap_simple'. But
> other than that I failed to understand what could be wrong (palette
> would be setup backward).

The palette code for cmap_simple writes the color components in the
order RGB, while your card seems to need BGR.

Hence either the cmap_addr/cmap_data registers are wrong, or
you have to add a cmap_inverted type that writes in the BGR order.

For both cases, you have to add a check to offb_init_palette_hacks() in
drivers/video/fbdev/offb.c.

> What are the low level tool (user-space) I can use to try to
> understand what is wrong with offb on my machine without rebuilding
> the kernel (CONFIG_FB_OF is not a module) ?

I'm afraid you can't do much from userspace.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [powerpc] offb: red / blue color inversion
  2016-06-09 12:25 [powerpc] offb: red / blue color inversion Mathieu Malaterre
  2016-06-17  7:11 ` Geert Uytterhoeven
@ 2016-09-13 13:37 ` Mathieu Malaterre
  1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Malaterre @ 2016-09-13 13:37 UTC (permalink / raw)
  To: linux-fbdev

Geert,

On Fri, Jun 17, 2016 at 9:11 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Mathieu,
>
> On Thu, Jun 9, 2016 at 2:25 PM, Mathieu Malaterre <malat@debian.org> wrote:
>> I am trying to fix an issue with color inversion in the current offb.c
>> implementation. I am using a Mac Mini G4 (PPC) with:
>>
>> [    0.844144] fb0: Open Firmware frame buffer device on
>> /pci@f0000000/ATY,RockHopper2Parent@10/ATY,RockHopper2_A@0
>>
>> reported as [*]. I have tried looking at the upstream code source, and
>> it appears that my configuration falls into the 'cmap_simple'. But
>> other than that I failed to understand what could be wrong (palette
>> would be setup backward).
>
> The palette code for cmap_simple writes the color components in the
> order RGB, while your card seems to need BGR.
>
> Hence either the cmap_addr/cmap_data registers are wrong, or
> you have to add a cmap_inverted type that writes in the BGR order.
>
> For both cases, you have to add a check to offb_init_palette_hacks() in
> drivers/video/fbdev/offb.c.

Well I tried a (very naive) patch as follow:

--- a/drivers/video/fbdev/offb.c 2016-09-13 15:33:41.043843352 +0200
+++ b/drivers/video/fbdev/offb.c 2016-08-20 18:11:18.000000000 +0200
@@ -133,9 +133,9 @@
  switch (par->cmap_type) {
  case cmap_simple:
  writeb(regno, par->cmap_adr);
- writeb(blue, par->cmap_data);
- writeb(green, par->cmap_data);
  writeb(red, par->cmap_data);
+ writeb(green, par->cmap_data);
+ writeb(blue, par->cmap_data);
  break;
  case cmap_M3A:
  /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */

However it does not seems to fix the Red / Blue color inversion I am seeing.

Could you please be a little more verbose in the way I need to reorder
color component from RGB to BGR ?

Thanks again
-M

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-13 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09 12:25 [powerpc] offb: red / blue color inversion Mathieu Malaterre
2016-06-17  7:11 ` Geert Uytterhoeven
2016-09-13 13:37 ` Mathieu Malaterre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.