Radeon frame buffer driver
PATCH 1/1 Radeon frame buffer driver
Another installment of the Radeon frame buffer driver patch (still against 2.4.19-pre2).
* All colour modes > 8bpp are now DIRECTCOLOR (Geert inspired).
* Driver now uses 'ypan' to speed up scrolling even further.
* Fix CRTC pitch to match accelerator pitch (800x600x256 works again).
Driver seems okay now, plays nicely with X etc. etc. Please test if you can
P.
drivers/video/radeon.h +2 -0
@@ -379,6 +379,7 @@#define SC_TOP_LEFT 0x16EC#define SC_BOTTOM_RIGHT 0x16F0#define SRC_SC_BOTTOM_RIGHT 0x16F4 +#define RB2D_DSTCACHE_MODE 0x3428#define RB2D_DSTCACHE_CTLSTAT 0x342C#define LVDS_GEN_CNTL 0x02d0#define LVDS_PLL_CNTL 0x02d4
@@ -395,6 +396,7 @@#define RADEON_BIOS_6_SCRATCH 0x0028#define RADEON_BIOS_7_SCRATCH 0x002c +#define HDP_SOFT_RESET (1 << 26)#define CLK_PIN_CNTL 0x0001#define PPLL_CNTL 0x0002
drivers/video/radeonfb.c +340 -246
1,049 lines not on this page · raw message
include/linux/fb.h +1 -0
@@ -94,6 +94,7 @@#define FB_ACCEL_IGS_CYBER5000 35/* CyberPro 5000 */ #define FB_ACCEL_SIS_GLAMOUR 36/* SiS 300/630/540 */ #define FB_ACCEL_3DLABS_PERMEDIA3 37/* 3Dlabs Permedia 3 */ +#define FB_ACCEL_ATI_RADEON 38/* ATI Radeon */ struct fb_fix_screeninfo {char id[16 ];/* identification string eg "TT Builtin" */
Quoted 2 lines · Peter Horton
Another installment of the Radeon frame buffer driver patch (still against 2.4.19-pre2).
...
Quoted 4 lines
Driver seems okay now, plays nicely with X etc. etc. Please test if you can
Patched it into 2.4.19-pre5-ac2 (minus the earlier radeon patches that I chainsawed out several days ago :-). Have been running for a few hours now using console and X with a lot of switching back and forth. Also spent some time using xawtv and some fb goodies. Played some tuxracer just to be sure GL was okay. All seems quite well with no problems to report.
Hardware/Software:
ATI Radeon 7500/64MB
Athlon 1700+ VIA K266A
Redhat more/less 7.2.
XFree 4.2 (RH 4.2.0-6.52)
Thanks,
Signature · 1 line
-Jonathan <[email protected]>
Thanks for the patch, I'll review it this week and probably merge some of the fixes into my local version and update the driver sometime next week.
ani
Quoted 14 lines · Peter Horton
Another installment of the Radeon frame buffer driver patch (still against 2.4.19-pre2).
* All colour modes > 8bpp are now DIRECTCOLOR (Geert inspired).
* Driver now uses 'ypan' to speed up scrolling even further.
* Fix CRTC pitch to match accelerator pitch (800x600x256 works again).
Driver seems okay now, plays nicely with X etc. etc. Please test if you can
P.
Quoted 5 lines
Another installment of the Radeon frame buffer driver patch (still against 2.4.19-pre2).
* All colour modes > 8bpp are now DIRECTCOLOR (Geert inspired).
Quoted 8 lines
* Driver now uses 'ypan' to speed up scrolling even further.
* Fix CRTC pitch to match accelerator pitch (800x600x256 works again).
Driver seems okay now, plays nicely with X etc. etc. Please test if you can
P.
I really don't like all the hacks related to the palette in 15/16/32bpp mode. You shouldn't affect whatever palette gets passed from userland or apps that rely on full access to the gamma table will fail. Also, iirc, the chip's palette in 16 bits mode is 64 entries and 32 in 15 bpp, you can verify this by seeing how much entries get passed by xfbdev when it configures the 1:1 color ramp. The old code worked except for the cursor in console mode which tends to have crazy colors, I think due to fbdev code brokenness but I'm too sure about that last one.
Ben.
Quoted 14 lines · On Wed, Apr 10, 2002 at 11:06:38AM +0200, [email protected] wrote:
Quoted 5 lines
Another installment of the Radeon frame buffer driver patch (still against 2.4.19-pre2).
* All colour modes > 8bpp are now DIRECTCOLOR (Geert inspired).
Quoted 8 lines
* Driver now uses 'ypan' to speed up scrolling even further.
* Fix CRTC pitch to match accelerator pitch (800x600x256 works again).
Driver seems okay now, plays nicely with X etc. etc. Please test if you can
P.
Quoted 9 lines
I really don't like all the hacks related to the palette in 15/16/32bpp mode. You shouldn't affect whatever palette gets passed from userland or apps that rely on full access to the gamma table will fail. Also, iirc, the chip's palette in 16 bits mode is 64 entries and 32 in 15 bpp, you can verify this by seeing how much entries get passed by xfbdev when it configures the 1:1 color ramp. The old code worked except for the cursor in console mode which tends to have crazy colors, I think due to fbdev code brokenness but I'm too sure about that last one.
Please look at code.
In 32bpp mode user space can set all 256 palette indices.
In 15 bit mode user space can set all 32 palette indices.
In 16bpp mode user space can set all 32 palette indices for red and blue, and all 64 palette indices for green.
The reason 16bpp mode fails when using "fbtv" is that "fbtv" only initialises the first 32 palette indices for green, but the captured video uses all 64 values. I patched "fbtv" to initialise all 64 indices and it worked fine. I think this is a bug in "fbtv" (and other such apps).
There is a hack in the code to support "fbtv" in 16bpp mode, but it is only used if you pass the driver the "fb16fix" flag, and it limits the green component to 5 bits. I used it for testing but it doesn't need to live any longer. If people want to use "fbtv" they should use 15 or 32 bit mode.
Test it, in all modes, I have.
The other hack is one that sets the top indices in the palette to white when palette index 0 is set. This is needed for the soft cursor to work as the soft cursor just flips all the bits in each pixel, which doesn't work in DIRECTCOLOR modes. Other drivers do similiar things. I've started to look at using the accelerator engine for flipping the cursor but there are locking issues involved which I want to get right.
P.
Quoted 1 line
Please look at code.
Ok, I may have been confused by looking only at the patch file
Quoted 6 lines
In 32bpp mode user space can set all 256 palette indices.
In 15 bit mode user space can set all 32 palette indices.
In 16bpp mode user space can set all 32 palette indices for red and blue, and all 64 palette indices for green.
Fine, though I noticed the get_cmap_len got changed to
+ return var->bits_per_pixel == 8 ? 256 : 16;
Quoted 11 lines
The reason 16bpp mode fails when using "fbtv" is that "fbtv" only initialises the first 32 palette indices for green, but the captured video uses all 64 values. I patched "fbtv" to initialise all 64 indices and it worked fine. I think this is a bug in "fbtv" (and other such apps).
There is a hack in the code to support "fbtv" in 16bpp mode, but it is only used if you pass the driver the "fb16fix" flag, and it limits the green component to 5 bits. I used it for testing but it doesn't need to live any longer. If people want to use "fbtv" they should use 15 or 32 bit mode.
Ok use a fixed fbtv, I agree.
Quoted 8 lines
Test it, in all modes, I have.
The other hack is one that sets the top indices in the palette to white when palette index 0 is set. This is needed for the soft cursor to work as the soft cursor just flips all the bits in each pixel, which doesn't work in DIRECTCOLOR modes. Other drivers do similiar things. I've started to look at using the accelerator engine for flipping the cursor but there are locking issues involved which I want to get right.
Maybe we should use the HW cursor. Setting the top indice will cause problem with MacOnLinux as MacOS don't use the same color layout as most unix apps.
Anyway, I'll look at your patch more closely and test it asap,
Ben.
drivers/video/radeonfb.c line 2257
Quoted 4 lines · On Wed, Apr 10, 2002 at 11:57:31AM +0100, [email protected] wrote:
Fine, though I noticed the
get_cmap_lengot changed todrivers/video/radeonfb.c +1
-0+return var->bits_per_pixel ==8 ?256 :16 ;
The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
P.
Quoted 10 lines · Peter Horton
drivers/video/radeonfb.c line 2257
Quoted 4 lines · On Wed, Apr 10, 2002 at 11:57:31AM +0100, [email protected] wrote:
Fine, though I noticed the
get_cmap_lengot changed todrivers/video/radeonfb.c +1
-0+return var->bits_per_pixel ==8 ?256 :16 ;The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
However, this change will make the driver not save/restore all color map entries on VC switch in graphics mode.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Quoted 7 lines
Quoted 4 lines
The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
However, this change will make the driver not save/restore all color map entries on VC switch in graphics mode.
Geert, didn't you tell me the fbdev apps were responsible for restoring their cmap on console switch ?
Ben.
Quoted 10 lines · On Wed, 10 Apr 2002 [email protected] wrote:
Quoted 7 lines
Quoted 4 lines
The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
However, this change will make the driver not save/restore all color map entries on VC switch in graphics mode.
Geert, didn't you tell me the fbdev apps were responsible for restoring their cmap on console switch ?
Probably not (unless you can quote me on that :-)
The color map is saved/restored in radeonfb_switch().
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Quoted 5 lines
Probably not (unless you can quote me on that :-)
The color map is saved/restored in
radeonfb_switch().Gr{oetje,eeting}s,
Yes, the console color map is, but isn't an fbdev app like MOL or X supposed to restore it's own colormap when switched back in ? Well, I may be able to quote you on this...
Quoted 10 lines
Quoted 6 lines
- When using > 8 bit depth, who is supposed to set the linear gamma ramp ? (My understanding is that a client app is responsible to set it's own cmap properly, but it also looks like some apps rely on the default beeing set to a linear gamma ramp). Should I set it this way in
set_parby default and then let the app eventually change it ?If your fbdev claims to be in truecolor mode, your fbdev should do it. If your fbdev claims to be in directcolor mode, the application should do it (if the app wants truecolor mode).
Ok, actually, you weren't talking about console switch. Though I'm pretty sure MOL at least will properly restore it's colormap, I don't know for XFree.
So Peter, it seems you have to save/restore it all finally.
Ben.
Quoted 4 lines
The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
Well, I wouldn't use aty128fb as a reference ;) Though I agree that if it's really only used for the kernel console, we don't care.
Ben.
Quoted 10 lines · Geert Uytterhoeven
Quoted 5 lines · Peter Horton
The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
However, this change will make the driver not save/restore all color map entries on VC switch in graphics mode.
Well I thought this didn't matter because if we only use 16 entries they will all be saved / restored. But there is a problem because the copy of the entire palette that we keep is per card and will be lost on VC switch, though the kernel will restore the first 16 entries. Really we need to keep a copy of the relevant part of the palette for each display (256 for 8bpp, 32 for 15 bit mode, 64 for 16bpp and 256 for 32bpp). Looking at a handful of drivers this seems to be a common error, so it can't be causing users much grief. I don't think changing the size of the colour map fixes this though (I need to look at the code when I get home).
On a side note would you take a patch that changed the cursor xor value in fbcon-cfb16/24/32 to the correct value if the display is DIRECTCOLOR rather than TRUECOLOR? We could then avoid having to set spurious palette indices to make the soft cursor work. I note that fbcon-cfb8 does the right thing.
I think the correct xor values are
depth 15 0x3DEF depth 16 0x79EF depth 24/32 0x000F0F0F
P.
Quoted 11 lines · Peter Horton
Quoted 9 lines · Geert Uytterhoeven
Quoted 5 lines · Peter Horton
The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
However, this change will make the driver not save/restore all color map entries on VC switch in graphics mode.
Quoted 10 lines
Well I thought this didn't matter because if we only use 16 entries they will all be saved / restored. But there is a problem because the copy of the entire palette that we keep is per card and will be lost on VC switch, though the kernel will restore the first 16 entries. Really we need to keep a copy of the relevant part of the palette for each display (256 for 8bpp, 32 for 15 bit mode, 64 for 16bpp and 256 for 32bpp). Looking at a handful of drivers this seems to be a common error, so it can't be causing users much grief. I don't think changing the size of the colour map fixes this though (I need to look at the code when I get home).
Or: few fbdev applications expect a correct behavior. IIRC XF68_FBDev also saves/restores the palette itself.
Quoted 11 lines
On a side note would you take a patch that changed the cursor xor value in fbcon-cfb16/24/32 to the correct value if the display is DIRECTCOLOR rather than TRUECOLOR? We could then avoid having to set spurious
I think the correct xor values are
depth 15 0x3DEF depth 16 0x79EF depth 24/32 0x000F0F0FP.
In general, this is not correct, since no one guarantees that in e.g. depth 32 the alpha bits are in the 8 most significant bits of the pixel value. But in directcolor mode XORing with the 16th entry of the pseudo palette should be OK. So yes, I guess we (cfr. the CC to linux-fbdev-devel) would take a patch for that...
That's why for 2.5.x we plan to add a 17th entry to the pseudo palette, so the fbdev can specify the correct XOR value.
Quoted 2 lines
palette indices to make the soft cursor work. I note that fbcon-cfb8 does the right thing.
Yes, but fbcon-cfb8 does the right thing for pseudocolor modes only :-( There does exist non-pseudocolor depth 8 hardware (e.g. RGB332).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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
Quoted 12 lines · Geert Uytterhoeven
Quoted 10 lines · Peter Horton
drivers/video/radeonfb.c line 2257
Quoted 4 lines · On Wed, Apr 10, 2002 at 11:57:31AM +0100, [email protected] wrote:
Fine, though I noticed the
get_cmap_lengot changed todrivers/video/radeonfb.c +1
-0+return var->bits_per_pixel ==8 ?256 :16 ;The colour map is only used by the kernel and the kernel only uses 16 entries so there isn't any reason to waste memory by making it any larger. I checked a few other drivers and they do the same (aty128fb for one).
Quoted 3 lines
However, this change will make the driver not save/restore all color map entries on VC switch in graphics mode.
My error. Apologies. I was getting confused between the colour map with the console colour <-> pixel value mapping (pointed to by ->dispsw_data)
- too many variables with similiar names :-(
P.