* pm2fb fixes
@ 2004-04-20 23:46 Jim Hague
2004-04-21 4:51 ` Marcelo Ramos
0 siblings, 1 reply; 8+ messages in thread
From: Jim Hague @ 2004-04-20 23:46 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: James Simmons
The conversion of pm2fb to using framebuffer_alloc() introduced a null pointer
dereference bug.
This patch fixes this bug, and a silly problem in pm2fb_blank(). There's also
some minor tidying.
The patch is against 2.6.6-rc1.
===== drivers/video/pm2fb.c 1.25 vs edited =====
--- 1.25/drivers/video/pm2fb.c Fri Apr 16 17:30:02 2004
+++ edited/drivers/video/pm2fb.c Tue Apr 20 11:56:53 2004
@@ -63,6 +63,16 @@
#endif
/*
+ * The 2.4 driver calls reset_card() at init time, where it also sets the
+ * initial mode. I don't think the driver should touch the chip until
+ * the console sets a video mode. So I was calling this at the start
+ * of setting a mode. However, certainly on 1280x1024 depth 16 on my
+ * PCI Graphics Blaster Exxtreme this causes the display to smear
+ * slightly. I don't know why. Guesses to jim.hague@acm.org.
+ */
+#undef RESET_CARD_ON_MODE_SET
+
+/*
* Driver data
*/
static char *mode __initdata = NULL;
@@ -340,16 +350,7 @@
}
}
-#if 0
-/*
- * FIXME:
- * The 2.4 driver calls this at init time, where it also sets the
- * initial mode. I don't think the driver should touch the chip
- * until the console sets a video mode. So I was calling this
- * at the start of setting a mode. However, certainly on 1280x1024
- * depth 16 this causes the display to smear slightly.
- * I don't know why. Guesses to jim.hague@acm.org.
- */
+#ifdef RESET_CARD_ON_MODE_SET
static void reset_card(struct pm2fb_par* p)
{
if (p->type == PM2_TYPE_PERMEDIA2V)
@@ -501,6 +502,8 @@
u32 vsync;
vsync = video;
+
+ DPRINTK("video = 0x%x\n", video);
/*
* The hardware cursor needs +vsync to recognise vert retrace.
@@ -660,6 +663,9 @@
u32 xres;
int data64;
+#ifdef RESET_CARD_ON_MODE_SET
+ reset_card(par);
+#endif
reset_config(par);
clear_palette(par);
@@ -721,8 +727,7 @@
info->fix.visual =
(depth == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
- info->fix.line_length =
- info->var.xres * ((info->var.bits_per_pixel + 7) >> 3);
+ info->fix.line_length = info->var.xres * depth / 8;
info->cmap.len = 256;
/*
@@ -803,6 +808,8 @@
break;
}
set_pixclock(par, pixclock);
+ DPRINTK("Setting graphics mode at %dx%d depth %d\n",
+ info->var.xres, info->var.yres, info->var.bits_per_pixel);
return 0;
}
@@ -843,7 +850,8 @@
* var->{color}.offset contains start of bitfield
* var->{color}.length contains length of bitfield
* {hardwarespecific} contains width of DAC
- * cmap[X] is programmed to (X << red.offset) | (X << green.offset) |
(X << blue.offset)
+ * cmap[X] is programmed to
+ * (X << red.offset) | (X << green.offset) | (X << blue.offset)
* RAMDAC[X] is programmed to (red, green, blue)
*
* Pseudocolor:
@@ -856,8 +864,9 @@
* does not use RAMDAC (usually has 3 of them).
* var->{color}.offset contains start of bitfield
* var->{color}.length contains length of bitfield
- * cmap is programmed to (red << red.offset) | (green << green.offset
) |
- * (blue << blue.offset) | (transp << transp.offset
)
+ * cmap is programmed to
+ * (red << red.offset) | (green << green.offset) |
+ * (blue << blue.offset) | (transp << transp.offset)
* RAMDAC does not exist
*/
#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
@@ -962,6 +971,11 @@
struct pm2fb_par *par = (struct pm2fb_par *) info->par;
u32 video = par->video;
+ DPRINTK("blank_mode %d\n", blank_mode);
+
+ /* Turn everything on, then disable as requested. */
+ video |= (PM2F_VIDEO_ENABLE | PM2F_HSYNC_MASK | PM2F_VSYNC_MASK);
+
switch (blank_mode) {
case 0: /* Screen: On; HSync: On, VSync: On */
break;
@@ -1030,15 +1044,12 @@
return err;
}
- size = sizeof(struct fb_info) + sizeof(struct pm2fb_par) + 256 * sizeof(
u32);
-
+ size = sizeof(struct pm2fb_par) + 256 * sizeof(u32);
info = framebuffer_alloc(size, &pdev->dev);
if ( !info )
return -ENOMEM;
- memset(info, 0, size);
-
- default_par = info->par;
-
+ default_par = (struct pm2fb_par *) info->par;
+
switch (pdev->device) {
case PCI_DEVICE_ID_TI_TVP4020:
strcpy(pm2fb_fix.id, "TVP4020");
@@ -1112,7 +1123,6 @@
info->fbops = &pm2fb_ops;
info->fix = pm2fb_fix;
- info->par = default_par;
info->pseudo_palette = (void *)(default_par + 1);
info->flags = FBINFO_FLAG_DEFAULT;
--
Jim Hague - jim.hague@acm.org Never trust a computer you can't lift.
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: pm2fb fixes
2004-04-20 23:46 pm2fb fixes Jim Hague
@ 2004-04-21 4:51 ` Marcelo Ramos
2004-04-21 10:14 ` Jim Hague
0 siblings, 1 reply; 8+ messages in thread
From: Marcelo Ramos @ 2004-04-21 4:51 UTC (permalink / raw)
To: linux-fbdev-devel
[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]
El (On) Wed, 21 Apr 2004 00:46:44 +0100 (BST)
Jim Hague <jim.hague@acm.org> escribió (wrote):
> The conversion of pm2fb to using framebuffer_alloc() introduced a null pointer
> dereference bug.
>
> This patch fixes this bug, and a silly problem in pm2fb_blank(). There's also
> some minor tidying.
>
> The patch is against 2.6.6-rc1.
I applied the patch and now the kernel oops is gone. How can I change the
resolution? If I don't specify the mode then i get 640x480-60 but if i use
video=pm2fb:mode:1024x768 (or any other resolution) I get 640x400-70. am I
passing the driver the argument with a wrong format?
TIA
--
_____________________________________________________________
_____ ____________
Marcelo Ramos | \/ __ |
Fedora Core 1 | Linux 2.6.5 | |_/ /
Socio UYLUG Nro 125 | \
Linux registered user #118109 |____|\/|____|\______\
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: pm2fb fixes
2004-04-21 4:51 ` Marcelo Ramos
@ 2004-04-21 10:14 ` Jim Hague
2004-04-21 16:26 ` Marcelo Ramos
0 siblings, 1 reply; 8+ messages in thread
From: Jim Hague @ 2004-04-21 10:14 UTC (permalink / raw)
To: Marcelo Ramos; +Cc: linux-fbdev-devel
On 21-Apr-2004 Marcelo Ramos wrote:
>> This patch fixes this bug, and a silly problem in pm2fb_blank(). There's
>> also some minor tidying.
>
> I applied the patch and now the kernel oops is gone. How can I change the
> resolution? If I don't specify the mode then i get 640x480-60 but if i use
> video=pm2fb:mode:1024x768 (or any other resolution) I get 640x400-70. am I
> passing the driver the argument with a wrong format?
The 2.6 version of pm2fb currently only has three possible arguments, 'mode',
'lowvsync' and 'lowhsync'. I think I'm the only person needing the last two.
When compiled in to the kernel, the argument syntax imitates other 2.6 drivers.
Arguments are comma separated, and any argument that isn't 'lowvsync' or
'lowhsync' is assumed to be a modedb specification,'<hres>x<vres>-<refresh>'.
You probably want:
video=pm2fb:1024x768-70
--
Jim Hague - jim.hague@acm.org Never trust a computer you can't lift.
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm2fb fixes
2004-04-21 10:14 ` Jim Hague
@ 2004-04-21 16:26 ` Marcelo Ramos
2004-04-21 18:21 ` Jim Hague
0 siblings, 1 reply; 8+ messages in thread
From: Marcelo Ramos @ 2004-04-21 16:26 UTC (permalink / raw)
To: linux-fbdev-devel
[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]
El (On) Wed, 21 Apr 2004 11:14:42 +0100 (BST)
Jim Hague <jim.hague@acm.org> escribió (wrote):
[...]
> The 2.6 version of pm2fb currently only has three possible arguments, 'mode',
> 'lowvsync' and 'lowhsync'. I think I'm the only person needing the last two.
>
> When compiled in to the kernel, the argument syntax imitates other 2.6
> drivers. Arguments are comma separated, and any argument that isn't 'lowvsync'
> or'lowhsync' is assumed to be a modedb
> specification,'<hres>x<vres>-<refresh>'. You probably want:
>
> video=pm2fb:1024x768-70
That line didn't work but using @70 instead of -70 worked like a charm. Thanks
very much for you info! :)
Now i'm a happy framebuffer user again.
Keep the excellent work.
Regards.
--
_____________________________________________________________
_____ ____________
Marcelo Ramos | \/ __ |
Fedora Core 1 | Linux 2.6.5 | |_/ /
Socio UYLUG Nro 125 | \
Linux registered user #118109 |____|\/|____|\______\
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: pm2fb fixes
2004-04-21 16:26 ` Marcelo Ramos
@ 2004-04-21 18:21 ` Jim Hague
2004-04-21 20:22 ` Marcelo Ramos
2004-04-22 13:43 ` Marcelo Ramos
0 siblings, 2 replies; 8+ messages in thread
From: Jim Hague @ 2004-04-21 18:21 UTC (permalink / raw)
To: Marcelo Ramos; +Cc: linux-fbdev-devel
On 21-Apr-2004 Marcelo Ramos wrote:
>> video=pm2fb:1024x768-70
>
> That line didn't work but using @70 instead of -70 worked like a charm.
Oh, duh. Of course. Sorry - serious brain fade on my part. -70 is the 2.4
syntax.
> Now i'm a happy framebuffer user again.
Good news.
BTW, I'd be interested in hearing if you see any unusual behaviour. Fox
example, when switching from X to the console I see a thin white line about 1
pixel high across the bottom of the screen. Typically the line has substantial
breaks in a couple of places.
Also when shutting down from gdm with the full screen display, my console
background goes a bluey sort of shade.
Something looks like it isn't quite right. I haven't located what, yet; not
that I've looked very hard.
--
Jim Hague - jim.hague@acm.org Never trust a computer you can't lift.
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm2fb fixes
2004-04-21 18:21 ` Jim Hague
@ 2004-04-21 20:22 ` Marcelo Ramos
2004-04-22 13:43 ` Marcelo Ramos
1 sibling, 0 replies; 8+ messages in thread
From: Marcelo Ramos @ 2004-04-21 20:22 UTC (permalink / raw)
To: linux-fbdev-devel
[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]
El (On) Wed, 21 Apr 2004 19:21:34 +0100 (BST)
Jim Hague <jim.hague@acm.org> escribió (wrote):
> BTW, I'd be interested in hearing if you see any unusual behaviour. Fox
> example, when switching from X to the console I see a thin white line about 1
> pixel high across the bottom of the screen. Typically the line has substantial
> breaks in a couple of places.
I see the same here. The line disappears when the boot messages make the screen
to scroll up.
> Also when shutting down from gdm with the full screen display, my console
> background goes a bluey sort of shade.
I'll check tonight (i'm very busy now to reboot) and will told you what i see.
Regards.
--
_____________________________________________________________
_____ ____________
Marcelo Ramos | \/ __ |
Fedora Core 1 | Linux 2.6.5 | |_/ /
Socio UYLUG Nro 125 | \
Linux registered user #118109 |____|\/|____|\______\
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: pm2fb fixes
2004-04-21 18:21 ` Jim Hague
2004-04-21 20:22 ` Marcelo Ramos
@ 2004-04-22 13:43 ` Marcelo Ramos
2004-04-22 15:36 ` Jim Hague
1 sibling, 1 reply; 8+ messages in thread
From: Marcelo Ramos @ 2004-04-22 13:43 UTC (permalink / raw)
To: linux-fbdev-devel
[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]
El (On) Wed, 21 Apr 2004 19:21:34 +0100 (BST)
Jim Hague <jim.hague@acm.org> escribió (wrote):
> BTW, I'd be interested in hearing if you see any unusual behaviour. Fox
> example, when switching from X to the console I see a thin white line about 1
> pixel high across the bottom of the screen. Typically the line has substantial
> breaks in a couple of places.
Sorry, i didn't read well the first time :/
I see a thin white line like you describe *only* when booting and it disappears
when the boot messages make the screen to scroll up.
I don't see any problem when switching from X to the console.
> Also when shutting down from gdm with the full screen display, my console
> background goes a bluey sort of shade.
I don't see that here.
Regards.
--
_____________________________________________________________
_____ ____________
Marcelo Ramos | \/ __ |
Fedora Core 1 | Linux 2.6.5 | |_/ /
Socio UYLUG Nro 125 | \
Linux registered user #118109 |____|\/|____|\______\
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: pm2fb fixes
2004-04-22 13:43 ` Marcelo Ramos
@ 2004-04-22 15:36 ` Jim Hague
0 siblings, 0 replies; 8+ messages in thread
From: Jim Hague @ 2004-04-22 15:36 UTC (permalink / raw)
To: Marcelo Ramos; +Cc: linux-fbdev-devel
On 22-Apr-2004 Marcelo Ramos wrote:
> El (On) Wed, 21 Apr 2004 19:21:34 +0100 (BST)
> Jim Hague <jim.hague@acm.org> escribió (wrote):
>> BTW, I'd be interested in hearing if you see any unusual behaviour.
>
> Sorry, i didn't read well the first time :/
> I see a thin white line like you describe *only* when booting and it
> disappears
> when the boot messages make the screen to scroll up.
>
> I don't see any problem when switching from X to the console.
>
>> Also when shutting down from gdm with the full screen display, my console
>> background goes a bluey sort of shade.
>
> I don't see that here.
Thanks for the feedback. It sounds like it's working OK for you.
The problem I'm having with gdm is, I think, mode related. My consoles are at 8
bit colour depth, but X runs at 16 bit. If I boot and login via gdm, when I
hotkey to consoles the mode is correctly switched back to 8 bit. If I hotkey
back to X and then log out back to gdm and then hotkey to consoles, the mode
isn't switched back to 8 bit but is switched to (i.e. remains at) 16 bit depth.
In case anyone else is interested, this is on freshly updated Debian Sid.
--
Jim Hague - jim.hague@acm.org Never trust a computer you can't lift.
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-04-22 15:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-20 23:46 pm2fb fixes Jim Hague
2004-04-21 4:51 ` Marcelo Ramos
2004-04-21 10:14 ` Jim Hague
2004-04-21 16:26 ` Marcelo Ramos
2004-04-21 18:21 ` Jim Hague
2004-04-21 20:22 ` Marcelo Ramos
2004-04-22 13:43 ` Marcelo Ramos
2004-04-22 15:36 ` Jim Hague
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).