Re: radeonfb: strange blue lines after 'setterm -inversescreen on'

Jurriaan <[email protected]>
Newsgroups gmane.linux.fbdev.user
Message-ID <[email protected]>
From: Jurriaan <[email protected]>
Date: Wed, Apr 07, 2004 at 06:33:52PM +0200
> From: Jurriaan <[email protected]>
> Date: Tue, Apr 06, 2004 at 07:52:25PM +0200
> > 
> > At the moment, I only have Ati and Matrox cards, Ati has the problem,
> > Matrox doesn't. I also tested with a 8x16 font, instead of my regular
> > 12x22 font, but that didn't make any difference.
> > 
Carefull experimentation, and browsing in the 2.4.25 and xfree86 sources
has shown:

1) in radeon_accel.c, calling cfb_fillrect() in radeonfb_fillrect makes
the problem go away, but this disables (part of) the accelerated
routines.

void radeonfb_fillrect(struct fb_info *info, const struct fb_fillrect *region)
{
        struct radeonfb_info *rinfo = info->par;
        struct fb_fillrect modded;
        int vxres, vyres;

        if (info->state != FBINFO_STATE_RUNNING)
                return;
-        if (radeon_accel_disabled()) {
+        if (1 || radeon_accel_disabled()) {
                cfb_fillrect(info, region);
                return;
        }

2) in 2.4.25, there is something different about the color handling. In
particular, radeonfb.c:rectfill() operates on clr, where clr is defined
differently, depending on the color-depth of the display:

#ifdef FBCON_HAS_CFB32
static void fbcon_radeon32_clear(struct vc_data *conp, struct display *p,
                               int srcy, int srcx, int height, int width)
{
        struct radeonfb_info *rinfo = (struct radeonfb_info *)(p->fb_info);
        u32 clr;

        clr = ((u32 *)p->dispsw_data)[attr_bgcol_ec(p, conp)];

        srcx *= fontwidth(p);
        srcy *= fontheight(p);
        width *= fontwidth(p);
        height *= fontheight(p);

        radeon_rectfill(rinfo, srcy, srcx, height, width, clr);
}

essentially, p_dispsw_data contains for a given 8-bit color value x

x | (x << 8) | (x << 16) | (x << 24)

so 0x07 becomes 0x07070707

3) If I adapt 2.6's radeon_accel.c:radeonfb_prim_fillrect() like this:

static void radeonfb_prim_fillrect(struct radeonfb_info *rinfo,
                                   const struct fb_fillrect *region)
{
        int color;

        radeon_fifo_wait(4);

        OUTREG(DP_GUI_MASTER_CNTL,
                rinfo->dp_gui_master_cntl  /* contains, like GMC_DST_32BPP */
                | GMC_BRUSH_SOLID_COLOR
                | ROP3_P);
        color = region->color | (region->color << 8);
        color = color | (color << 16);
        OUTREG(DP_BRUSH_FRGD_CLR, color);
        OUTREG(DP_WRITE_MSK, 0xffffffff);
        OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM));

        radeon_fifo_wait(2);
        OUTREG(DST_Y_X, (region->dy << 16) | region->dx);
        OUTREG(DST_WIDTH_HEIGHT, (region->width << 16) | region->height);
}

my problem is solved. Previously, it just read

        OUTREG(DP_BRUSH_FRGD_CLR, region->color);

This is obviously a hack, and only works in 32-bits color. 

I would be interested in the view of the maintainer. If this is the
right solution, do you want a patch that tries to fix this?

Thanks everyone for mailing back-and-forth, and testing. Please test if
this fixes the problem on your radeon-machine as well, if possible.

Jurriaan
-- 
And all the while, all the while, I still hear that call
To the land of gold and poison that beckons to us all
Do you think you're so brave just to go running to that which beckons to us all?
	New Model Army - Valleys of Green and Grey
Debian (Unstable) GNU/Linux 2.6.5-mm1 2x6062 bogomips 0.14 0.11


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.