linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kernel: matrox fb - missing files, doesn't compile
@ 2002-12-13  6:13 Ariel
  0 siblings, 0 replies; 8+ messages in thread
From: Ariel @ 2002-12-13  6:13 UTC (permalink / raw)
  To: vandrove; +Cc: linux-fbdev-devel


Kernel 2.5.51.

I tried copying the fbcon*.h files from 2.2.19 kernel, but that didn't
help much.

Clip from .config:

# Graphics support
CONFIG_FB=y
CONFIG_VIDEO_SELECT=y
CONFIG_FB_MATROX=y
CONFIG_FB_MATROX_G100A=y
CONFIG_FB_MATROX_G100=y
CONFIG_FB_MATROX_I2C=y
CONFIG_FB_MATROX_MAVEN=y

(I also have I2C on.)

Output of make:

make -f scripts/Makefile.build obj=drivers/video/matrox
  gcc -Wp,-MD,drivers/video/matrox/.matroxfb_base.o.d -D__KERNEL__
-Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2
-fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2
-march=i686 -Iarch/i386/mach-generic -fomit-frame-pointer -nostdinc
-iwithprefix include    -DKBUILD_BASENAME=matroxfb_base
-DKBUILD_MODNAME=matroxfb_base -DEXPORT_SYMTAB  -c -o
drivers/video/matrox/matroxfb_base.o drivers/video/matrox/matroxfb_base.c
In file included from drivers/video/matrox/matroxfb_base.c:105:
drivers/video/matrox/matroxfb_base.h:52: video/fbcon.h: No such file or
directory
drivers/video/matrox/matroxfb_base.h:53: video/fbcon-cfb4.h: No such file
or directory
drivers/video/matrox/matroxfb_base.h:54: video/fbcon-cfb8.h: No such file
or directory
drivers/video/matrox/matroxfb_base.h:55: video/fbcon-cfb16.h: No such file
or directory
drivers/video/matrox/matroxfb_base.h:56: video/fbcon-cfb24.h: No such file
or directory
drivers/video/matrox/matroxfb_base.h:57: video/fbcon-cfb32.h: No such file
or directory
In file included from drivers/video/matrox/matroxfb_base.c:105:
drivers/video/matrox/matroxfb_base.h:341: warning: `struct display'
declared inside parameter list
drivers/video/matrox/matroxfb_base.h:341: warning: its scope is only this
definition or declaration, which is probably not what you want.
drivers/video/matrox/matroxfb_base.h:342: warning: `struct display'
declared inside parameter list
drivers/video/matrox/matroxfb_base.h:558: field `dispsw' has incomplete
type
drivers/video/matrox/matroxfb_base.c:148: warning: braces around scalar
initializer
drivers/video/matrox/matroxfb_base.c:148: warning: (near initialization
for `vesafb_defined.rotate')
drivers/video/matrox/matroxfb_base.c:148: warning: excess elements in
scalar initializer
drivers/video/matrox/matroxfb_base.c:148: warning: (near initialization
for `vesafb_defined.rotate')
drivers/video/matrox/matroxfb_base.c:148: warning: excess elements in
scalar initializer
drivers/video/matrox/matroxfb_base.c:148: warning: (near initialization
for `vesafb_defined.rotate')
drivers/video/matrox/matroxfb_base.c:148: warning: excess elements in
scalar initializer
drivers/video/matrox/matroxfb_base.c:148: warning: (near initialization
for `vesafb_defined.rotate')
drivers/video/matrox/matroxfb_base.c:148: warning: excess elements in
scalar initializer
drivers/video/matrox/matroxfb_base.c:148: warning: (near initialization
for `vesafb_defined.rotate')
drivers/video/matrox/matroxfb_base.c:148: warning: excess elements in
scalar initializer
drivers/video/matrox/matroxfb_base.c:148: warning: (near initialization
for `vesafb_defined.rotate')
drivers/video/matrox/matroxfb_base.c: In function `my_install_cmap':
drivers/video/matrox/matroxfb_base.c:158: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c: In function `matrox_pan_var':
drivers/video/matrox/matroxfb_base.c:186: warning: implicit declaration of
function `fontheight'
drivers/video/matrox/matroxfb_base.c:186: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:186: warning: implicit declaration of
function `fontwidth'
drivers/video/matrox/matroxfb_base.c:169: warning: `pos' might be used
uninitialized in this function
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_pan_display':
drivers/video/matrox/matroxfb_base.c:279: `fb_display' undeclared (first
use in this function)
drivers/video/matrox/matroxfb_base.c:279: (Each undeclared identifier is
reported only once
drivers/video/matrox/matroxfb_base.c:279: for each function it appears
in.)
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_updatevar':
drivers/video/matrox/matroxfb_base.c:303: `fb_display' undeclared (first
use in this function)
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_set_var':
drivers/video/matrox/matroxfb_base.c:688: `fb_display' undeclared (first
use in this function)
drivers/video/matrox/matroxfb_base.c:690: structure has no member named
`disp'
drivers/video/matrox/matroxfb_base.c:700: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:701: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:702: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:703: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:704: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:705: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:706: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:707: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:711: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:721: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:725: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:728: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:729: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:735: structure has no member named
`changevar'
drivers/video/matrox/matroxfb_base.c:736: structure has no member named
`changevar'
drivers/video/matrox/matroxfb_base.c:802: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:678: warning: `display' might be used
uninitialized in this function
drivers/video/matrox/matroxfb_base.c:738: warning: `pos' might be used
uninitialized in this function
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_get_cmap':
drivers/video/matrox/matroxfb_base.c:866: structure has no member named
`disp'
drivers/video/matrox/matroxfb_base.c:867: `fb_display' undeclared (first
use in this function)
drivers/video/matrox/matroxfb_base.c:876: warning: implicit declaration of
function `fb_get_cmap'
drivers/video/matrox/matroxfb_base.c:877: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:878: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:880: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_set_cmap':
drivers/video/matrox/matroxfb_base.c:890: structure has no member named
`disp'
drivers/video/matrox/matroxfb_base.c:890: `fb_display' undeclared (first
use in this function)
drivers/video/matrox/matroxfb_base.c:899: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:900: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:903: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:910: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_ioctl':
drivers/video/matrox/matroxfb_base.c:1009: structure has no member named
`switch_con'
drivers/video/matrox/matroxfb_base.c: At top level:
drivers/video/matrox/matroxfb_base.c:1188: unknown field `fb_set_var'
specified in initializer
drivers/video/matrox/matroxfb_base.c:1188: warning: initialization from
incompatible pointer type
drivers/video/matrox/matroxfb_base.c:1189: unknown field `fb_get_cmap'
specified in initializer
drivers/video/matrox/matroxfb_base.c:1189: warning: initialization from
incompatible pointer type
drivers/video/matrox/matroxfb_base.c:1190: unknown field `fb_set_cmap'
specified in initializer
drivers/video/matrox/matroxfb_base.c:1190: warning: initialization from
incompatible pointer type
drivers/video/matrox/matroxfb_base.c:1192: warning: initialization from
incompatible pointer type
drivers/video/matrox/matroxfb_base.c:1194: warning: initialization from
incompatible pointer type
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_switch':
drivers/video/matrox/matroxfb_base.c:1207: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:1222: structure has no member named
`disp'
drivers/video/matrox/matroxfb_base.c:1224: `fb_display' undeclared (first
use in this function)
drivers/video/matrox/matroxfb_base.c:1226: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:1235: derefe member named `changevar'
drivers/video/matrox/matroxfb_base.c:1757: structure has no member named
`disp'
drivers/video/matrox/matroxfb_base.c:1758: structure has no member named
`switch_con'
drivers/video/matrox/matroxfb_base.c:1759: structure has no member named
`updatevar'
drivers/video/matrox/matroxfb_base.c:1875: structure has no member named
`modename'
drivers/video/matrox/matroxfb_base.c: In function `matroxfb_probe':
drivers/video/matrox/matroxfb_base.c:1986: storage size of `global_disp'
isn't known
drivers/video/matrox/matroxfb_base.c:2028: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:2028: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:2028: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:2028: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:2028: dereferencing pointer to
incomplete type
drivers/video/matrox/matroxfb_base.c:2028: dereferencing pointer to
incomplete type
driver might be used uninitialized in this function
make[3]: *** [drivers/video/matrox/matroxfb_base.o] Error 1
make[2]: *** [drivers/video/matrox] Error 2
make[1]: *** [drivers/video] Error 2
make: *** [drivers] Error 2
root@blueberry:/usr/src/linux-2.5.51#


	-Ariel



-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

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

* Re: kernel: matrox fb - missing files, doesn't compile
@ 2002-12-13 10:09 Petr Vandrovec
  2002-12-15  0:30 ` Antonino Daplas
  0 siblings, 1 reply; 8+ messages in thread
From: Petr Vandrovec @ 2002-12-13 10:09 UTC (permalink / raw)
  To: Ariel; +Cc: linux-fbdev-devel

On 13 Dec 02 at 1:13, Ariel wrote:
> Kernel 2.5.51.
> 
> I tried copying the fbcon*.h files from 2.2.19 kernel, but that didn't
> help much.

Either go for 2.5.50, or you'll have to wait several weeks. After looking
at current kernel interface it looks like that I'll have to write
matroxcon to get at least same level of functionality which was
available before, and it will definitely take weeks, or maybe months.

Current interface just supports only cfb, and only very bad for my needs.
And because of matroxfb supports also other modes (such as native text
mode, or loading font into accelerator), bye-bye. For now I recommend you 
either to not upgrade, or use vesafb. Besides that accel_putcs() does not 
call fb_sync when using font width which is not multiple of 8, and that 
with fonts greater than 16*16 pixels (I believe that such fonts are still 
supported...) it will corrupt memory...

You can also try to use complete drivers/video, include/video, plus
some of drivers/char and include/linux from 2.5.50... You should be
able to get working system that way too.
                                                    Petr Vandrovec
                                                    vandrove@vc.cvut.cz
                                                    


-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

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

* Re: Re: kernel: matrox fb - missing files, doesn't compile
  2002-12-15  0:30 ` Antonino Daplas
@ 2002-12-14 22:44   ` Petr Vandrovec
  2002-12-15 17:45     ` Antonino Daplas
  2002-12-22  8:42   ` Geert Uytterhoeven
  1 sibling, 1 reply; 8+ messages in thread
From: Petr Vandrovec @ 2002-12-14 22:44 UTC (permalink / raw)
  To: Antonino Daplas; +Cc: Ariel, Linux Fbdev development list

On Sun, Dec 15, 2002 at 05:30:43AM +0500, Antonino Daplas wrote:
> On Fri, 2002-12-13 at 15:09, Petr Vandrovec wrote:
> > Current interface just supports only cfb, and only very bad for my needs.
> > And because of matroxfb supports also other modes (such as native text
> > mode, or loading font into accelerator), bye-bye. For now I recommend you 
> > either to not upgrade, or use vesafb. Besides that accel_putcs() does not 
> > call fb_sync when using font width which is not multiple of 8, and that 
> Can you explain why an fb_sync is needed for every character?

It is not needed after every character. But I thought that it will be called
before we return to userspace... And I want to rely on fb_sync
because of hardware setup to change fg_color and bg_color is very costly.

In my tests I'm not able to get accelerated code running faster than
at 50% of old speed with 12x22 font, and I'm hoping that eliminating these
two PCI writes could speed it a bit... It will not get on par, but better than
nothing.
 
> > with fonts greater than 16*16 pixels (I believe that such fonts are still 
> > supported...) it will corrupt memory...
> 
> I agree.  To be more specific, buffer overruns will occur if (xres *
> fontheight/8 > 8192).  The pixmap needs to be dynamically allocated and
> resized somewhere in the fbcon layer (ideally in accel_setup(), but this
> was removed).  For those concerned about this problem, you can try this
> patch as a temporary measure until fbcon is fixed. It should not cause
> to much slowdown:

But we may try to allocate buffers of order 2 or even 3 with kmalloc, and
if I remember fork() problems with allocating stack with order=1 correctly,
it is not best idea under the sun. But using physically non-continuous
area is probably even worse idea.

> For anyone concerned, this is a heads up:  The data in the pixmap must
> be read completely by the hardware before exiting, otherwise font
> corruption will occur.  If you think this will be a problem, the
> function can be easily modified to do multiple buffering instead.

What if I'll decide to paint characters through busmastering? Then
I need font data in buffers allocated by pci_alloc_consistent...
In the past it was not a win to use busmastering, but now, when
upper layers might prepare images much larger than 8x16, it may be 
worth of rechecking that...
					Best regards,
						Petr Vandrovec
						vandrove@vc.cvut.cz



-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

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

* Re: Re: kernel: matrox fb - missing files, doesn't compile
  2002-12-13 10:09 kernel: matrox fb - missing files, doesn't compile Petr Vandrovec
@ 2002-12-15  0:30 ` Antonino Daplas
  2002-12-14 22:44   ` Petr Vandrovec
  2002-12-22  8:42   ` Geert Uytterhoeven
  0 siblings, 2 replies; 8+ messages in thread
From: Antonino Daplas @ 2002-12-15  0:30 UTC (permalink / raw)
  To: Petr Vandrovec; +Cc: Ariel, Linux Fbdev development list

On Fri, 2002-12-13 at 15:09, Petr Vandrovec wrote:
> Current interface just supports only cfb, and only very bad for my needs.
> And because of matroxfb supports also other modes (such as native text
> mode, or loading font into accelerator), bye-bye. For now I recommend you 
> either to not upgrade, or use vesafb. Besides that accel_putcs() does not 
> call fb_sync when using font width which is not multiple of 8, and that 
Can you explain why an fb_sync is needed for every character?

> with fonts greater than 16*16 pixels (I believe that such fonts are still 
> supported...) it will corrupt memory...

I agree.  To be more specific, buffer overruns will occur if (xres *
fontheight/8 > 8192).  The pixmap needs to be dynamically allocated and
resized somewhere in the fbcon layer (ideally in accel_setup(), but this
was removed).  For those concerned about this problem, you can try this
patch as a temporary measure until fbcon is fixed. It should not cause
to much slowdown:

For anyone concerned, this is a heads up:  The data in the pixmap must
be read completely by the hardware before exiting, otherwise font
corruption will occur.  If you think this will be a problem, the
function can be easily modified to do multiple buffering instead.
 
Comments?

Tony

diff -Naur linux-2.5.51/drivers/video/console/fbcon.c linux/drivers/video/console/fbcon.c
--- linux-2.5.51/drivers/video/console/fbcon.c	2002-12-14 23:33:50.000000000 +0000
+++ linux/drivers/video/console/fbcon.c	2002-12-14 23:35:10.000000000 +0000
@@ -390,7 +390,9 @@
 	unsigned int cellsize = vc->vc_font.height * width;
 	struct fb_image image;
 	u16 c = scr_readw(s);
-	static u8 pixmap[8192];
+	static int xres = 0;
+	static int fontheight = 0;
+	static u8 *pixmap = NULL;
 	
 	image.fg_color = attr_fgcol(p, c);
 	image.bg_color = attr_bgcol(p, c);
@@ -399,9 +401,24 @@
 	image.height = vc->vc_font.height;
 	image.depth = 1;
 
-/*	pixmap = kmalloc((info->var.bits_per_pixel + 7) >> 3 *
-				vc->vc_font.height, GFP_KERNEL); 
-*/
+	/*
+	 * FIXME: This code segment has to be placed 
+	 *        somewhere else to allow freeing of 
+	 *        memory on exit and to reduce unnecessary
+	 *        processing.
+	 */
+	if (xres != info->var.xres || 
+	    fontheight != vc->vc_font.height) {
+		xres = info->var.xres;
+		fontheight = vc->vc_font.height;
+
+		if (info->fbops->fb_sync)
+			info->fbops->fb_sync(info);
+		if (pixmap != NULL)
+			kfree(pixmap);
+		pixmap = kmalloc((xres + 7)/8 *
+				 fontheight, GFP_KERNEL); 
+	}
 				
 	if (!(vc->vc_font.width & 7) && pixmap != NULL) {
 		unsigned int pitch = width * count, i, j;
@@ -432,10 +449,6 @@
 			image.dx += vc->vc_font.width;
 		}	
 	}
-	/*
-	if (pixmap);
-		kfree(pixmap);
-	*/	
 }
 
 void accel_clear_margins(struct vc_data *vc, struct display *p,






-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

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

* Re: Re: kernel: matrox fb - missing files, doesn't compile
  2002-12-14 22:44   ` Petr Vandrovec
@ 2002-12-15 17:45     ` Antonino Daplas
  2002-12-22  8:44       ` Geert Uytterhoeven
  0 siblings, 1 reply; 8+ messages in thread
From: Antonino Daplas @ 2002-12-15 17:45 UTC (permalink / raw)
  To: Petr Vandrovec; +Cc: Ariel, Linux Fbdev development list

On Sun, 2002-12-15 at 03:44, Petr Vandrovec wrote:
> On Sun, Dec 15, 2002 at 05:30:43AM +0500, Antonino Daplas wrote:
> > On Fri, 2002-12-13 at 15:09, Petr Vandrovec wrote:
> > > Current interface just supports only cfb, and only very bad for my needs.
> > > And because of matroxfb supports also other modes (such as native text
> > > mode, or loading font into accelerator), bye-bye. For now I recommend you 
> > > either to not upgrade, or use vesafb. Besides that accel_putcs() does not 
> > > call fb_sync when using font width which is not multiple of 8, and that 
> > Can you explain why an fb_sync is needed for every character?
> 
> It is not needed after every character. But I thought that it will be called
> before we return to userspace... And I want to rely on fb_sync
> because of hardware setup to change fg_color and bg_color is very costly.
> 
I see. 

> In my tests I'm not able to get accelerated code running faster than
> at 50% of old speed with 12x22 font, and I'm hoping that eliminating these
> two PCI writes could speed it a bit... It will not get on par, but better than
> nothing.
>  
> > > with fonts greater than 16*16 pixels (I believe that such fonts are still 
> > > supported...) it will corrupt memory...
> > 
> > I agree.  To be more specific, buffer overruns will occur if (xres *
> > fontheight/8 > 8192).  The pixmap needs to be dynamically allocated and
> > resized somewhere in the fbcon layer (ideally in accel_setup(), but this
> > was removed).  For those concerned about this problem, you can try this
> > patch as a temporary measure until fbcon is fixed. It should not cause
> > to much slowdown:
> 
> But we may try to allocate buffers of order 2 or even 3 with kmalloc, and
> if I remember fork() problems with allocating stack with order=1 correctly,
> it is not best idea under the sun. But using physically non-continuous
> area is probably even worse idea.
You mean the multiple buffering?  Sorry, I did not mean classic
multi-buffering, just a single buffer with size at least 2x that
required.  Then the buffer will just be "walked" by adjusting the buffer
offset.  Once the offset reaches the end of the buffer, we just call
fb_sync() then reset the offset to 0.

> 
> > For anyone concerned, this is a heads up:  The data in the pixmap must
> > be read completely by the hardware before exiting, otherwise font
> > corruption will occur.  If you think this will be a problem, the
> > function can be easily modified to do multiple buffering instead.
> 
> What if I'll decide to paint characters through busmastering? Then
> I need font data in buffers allocated by pci_alloc_consistent...
> In the past it was not a win to use busmastering, but now, when
> upper layers might prepare images much larger than 8x16, it may be 
> worth of rechecking that...

True, using kmalloc() to cache a good-sized pixmap is probably not the
best idea in all cases (in my case, it is best when the pixmap is in
graphics memory). I submitted a proposal before that allows more
flexibility: it will let the drivers decide on how it wants the buffers
allocated, the size of the buffer, specific alignment requirements, or
if it even actually needs one. Other driver-specific needs can probably
be added if necessary.

However, the change is a bit more invasive and complex and thus probably
did not hold very well with the maintainers.  So I submitted a patch
that is simpler but less flexible.  In my case, I have to do an extra
copy of the pixmap contents to graphics memory or directly to the
graphics pipeline depending on the size/alignment and proceed from
there.  It's not the best solution, but definitely better than doing one
imageblit/character.

I really don't have a say on any of this... I just submit patches, you
have to ask James or Geert about these.

Tony



-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

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

* Re: Re: kernel: matrox fb - missing files, doesn't compile
  2002-12-15  0:30 ` Antonino Daplas
  2002-12-14 22:44   ` Petr Vandrovec
@ 2002-12-22  8:42   ` Geert Uytterhoeven
  1 sibling, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2002-12-22  8:42 UTC (permalink / raw)
  To: Antonino Daplas; +Cc: Petr Vandrovec, Ariel, Linux Fbdev development list

On 15 Dec 2002, Antonino Daplas wrote:
> On Fri, 2002-12-13 at 15:09, Petr Vandrovec wrote:
> > Current interface just supports only cfb, and only very bad for my needs.
> > And because of matroxfb supports also other modes (such as native text
> > mode, or loading font into accelerator), bye-bye. For now I recommend you 
> > either to not upgrade, or use vesafb. Besides that accel_putcs() does not 
> > call fb_sync when using font width which is not multiple of 8, and that 
> Can you explain why an fb_sync is needed for every character?
> 
> > with fonts greater than 16*16 pixels (I believe that such fonts are still 
> > supported...) it will corrupt memory...
> 
> I agree.  To be more specific, buffer overruns will occur if (xres *
> fontheight/8 > 8192).  The pixmap needs to be dynamically allocated and
> resized somewhere in the fbcon layer (ideally in accel_setup(), but this
> was removed).  For those concerned about this problem, you can try this
> patch as a temporary measure until fbcon is fixed. It should not cause
> to much slowdown:

What about making putcs() check for overflows? I.e. large putcs() will just be
split in multiple image blit calls.

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



-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/

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

* Re: Re: kernel: matrox fb - missing files, doesn't compile
  2002-12-15 17:45     ` Antonino Daplas
@ 2002-12-22  8:44       ` Geert Uytterhoeven
  2002-12-27 15:02         ` Antonino Daplas
  0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2002-12-22  8:44 UTC (permalink / raw)
  To: Antonino Daplas; +Cc: Petr Vandrovec, Ariel, Linux Fbdev development list

On 15 Dec 2002, Antonino Daplas wrote:
> On Sun, 2002-12-15 at 03:44, Petr Vandrovec wrote:
> > What if I'll decide to paint characters through busmastering? Then
> > I need font data in buffers allocated by pci_alloc_consistent...
> > In the past it was not a win to use busmastering, but now, when
> > upper layers might prepare images much larger than 8x16, it may be 
> > worth of rechecking that...
> 
> True, using kmalloc() to cache a good-sized pixmap is probably not the
> best idea in all cases (in my case, it is best when the pixmap is in
> graphics memory). I submitted a proposal before that allows more
> flexibility: it will let the drivers decide on how it wants the buffers
> allocated, the size of the buffer, specific alignment requirements, or
> if it even actually needs one. Other driver-specific needs can probably
> be added if necessary.

Add address/size fields in fb_info to let the driver tell it already allocated
a suitable buffer? If those are NULL, fbcon can fall back to its own buffer
(e.g. static and fixed 8 kiB buffer).

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



-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/

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

* Re: Re: kernel: matrox fb - missing files, doesn't compile
  2002-12-22  8:44       ` Geert Uytterhoeven
@ 2002-12-27 15:02         ` Antonino Daplas
  0 siblings, 0 replies; 8+ messages in thread
From: Antonino Daplas @ 2002-12-27 15:02 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux Fbdev development list, James Simmons

On Sun, 2002-12-22 at 16:44, Geert Uytterhoeven wrote:
> On 15 Dec 2002, Antonino Daplas wrote:
> > On Sun, 2002-12-15 at 03:44, Petr Vandrovec wrote:
> > > What if I'll decide to paint characters through busmastering? Then
> > > I need font data in buffers allocated by pci_alloc_consistent...
> > > In the past it was not a win to use busmastering, but now, when
> > > upper layers might prepare images much larger than 8x16, it may be 
> > > worth of rechecking that...
> > 
> > True, using kmalloc() to cache a good-sized pixmap is probably not the
> > best idea in all cases (in my case, it is best when the pixmap is in
> > graphics memory). I submitted a proposal before that allows more
> > flexibility: it will let the drivers decide on how it wants the buffers
> > allocated, the size of the buffer, specific alignment requirements, or
> > if it even actually needs one. Other driver-specific needs can probably
> > be added if necessary.
> 
> Add address/size fields in fb_info to let the driver tell it already allocated
> a suitable buffer? If those are NULL, fbcon can fall back to its own buffer
> (e.g. static and fixed 8 kiB buffer).
> 

How about the following?

Drivers can choose to fill up the fb_pixmap structure for
device-specific buffer requirements:


#define FB_PIXMAP_SYSMEM    0
#define FB_PIXMAP_IOMEM     1

struct fb_pixmap {
	__u32 loc;              /* location of buffer */
	__u8  *addr;            /* address of buffer */
	__u32 size;             /* size of buffer */
	__u32 align;            /* byte alignment per scanline */
};

Drivers can allocate the buffer in system memory (FB_PIXMAP_SYSMEM) or
io/graphics memory (FB_PIXMAP_IOMEM) and specify the alignment of each
line of pixels.  Otherwise, accel_putcs will default to using the
statically allocated buffer with a 1-byte alignment per scanline.

Attached is a patch against 2.5.52. Other changes:  

call fb_sync() if framebuffer memory is to be accessed (cfb_* drawing
functions, fb_read and fb_write).

Tony

diff -Nuar linux-2.4.52/drivers/video/cfbcopyarea.c linux/drivers/video/cfbcopyarea.c
--- linux-2.4.52/drivers/video/cfbcopyarea.c	2002-12-27 14:39:27.000000000 +0000
+++ linux/drivers/video/cfbcopyarea.c	2002-12-27 14:38:27.000000000 +0000
@@ -375,6 +375,9 @@
 	dst_idx += area->dy*next_line*8 + area->dx*p->var.bits_per_pixel;
 	src_idx += area->sy*next_line*8 + area->sx*p->var.bits_per_pixel;
 	
+	if (p->fbops->fb_sync)
+		p->fbops->fb_sync(p);
+
 	if (rev_copy) {
 		while (area->height--) {
 			dst_idx -= next_line*8;
diff -Nuar linux-2.4.52/drivers/video/cfbfillrect.c linux/drivers/video/cfbfillrect.c
--- linux-2.4.52/drivers/video/cfbfillrect.c	2002-12-27 14:39:30.000000000 +0000
+++ linux/drivers/video/cfbfillrect.c	2002-12-27 14:38:32.000000000 +0000
@@ -397,6 +397,10 @@
 	dst_idx += rect->dy*p->fix.line_length*8+rect->dx*bpp;
 	/* FIXME For now we support 1-32 bpp only */
 	left = BITS_PER_LONG % bpp;
+
+	if (p->fbops->fb_sync)
+		p->fbops->fb_sync(p);
+
 	if (!left) {
 		u32 pat = pixel_to_pat32(p, fg);
 		void (*fill_op32)(unsigned long *dst, int dst_idx, u32 pat, u32 n) = NULL;
diff -Nuar linux-2.4.52/drivers/video/cfbimgblt.c linux/drivers/video/cfbimgblt.c
--- linux-2.4.52/drivers/video/cfbimgblt.c	2002-12-27 14:39:23.000000000 +0000
+++ linux/drivers/video/cfbimgblt.c	2002-12-27 14:38:22.000000000 +0000
@@ -322,6 +322,9 @@
 	bitstart &= ~(bpl - 1);
 	dst1 = p->screen_base + bitstart;
 
+	if (p->fbops->fb_sync)
+		p->fbops->fb_sync(p);
+
 	if (image->depth == 1) {
 		if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
 		    p->fix.visual == FB_VISUAL_DIRECTCOLOR) {
diff -Nuar linux-2.4.52/drivers/video/console/fbcon.c linux/drivers/video/console/fbcon.c
--- linux-2.4.52/drivers/video/console/fbcon.c	2002-12-27 14:39:13.000000000 +0000
+++ linux/drivers/video/console/fbcon.c	2002-12-27 14:38:09.000000000 +0000
@@ -378,16 +378,26 @@
 	info->fbops->fb_fillrect(info, &region);
 }	
 
+static inline void syswriteb(u8 val, u8 *addr)
+{
+	*addr = val;
+}
+
+static inline void iowriteb(u8 val, u8 *addr) 
+{
+	fb_writeb(val, addr);
+}
+
 void accel_putcs(struct vc_data *vc, struct display *p,
 			const unsigned short *s, int count, int yy, int xx)
 {
+	static char pixmap[8192];
 	struct fb_info *info = p->fb_info;
 	unsigned short charmask = p->charmask;
 	unsigned int width = ((vc->vc_font.width + 7)/8);
 	unsigned int cellsize = vc->vc_font.height * width;
 	struct fb_image image;
 	u16 c = scr_readw(s);
-	static u8 pixmap[8192];
 	
 	image.fg_color = attr_fgcol(p, c);
 	image.bg_color = attr_bgcol(p, c);
@@ -396,30 +406,60 @@
 	image.height = vc->vc_font.height;
 	image.depth = 1;
 
-/*	pixmap = kmalloc((info->var.bits_per_pixel + 7) >> 3 *
-				vc->vc_font.height, GFP_KERNEL); 
-*/
-				
-	if (!(vc->vc_font.width & 7) && pixmap != NULL) {
-		unsigned int pitch = width * count, i, j;
+	if (!(vc->vc_font.width & 7)) {
+		unsigned int pitch, i, j;
 		char *src, *dst, *dst0;
+		void (*write_op)(u8 val, u8 *addr) = syswriteb;
+
+		if (info->pixmap.addr != NULL) {
+			unsigned int align = (info->pixmap.align) ?
+				info->pixmap.align - 1 : 0;
+
+			pitch = (width * count + align) & ~(align);
+			if (pitch * vc->vc_font.height > info->pixmap.size)
+				/* 
+				 * FIXME: do multiple blit's instead
+				 *        of exiting
+				 */
+				return;
+
+			dst0 = info->pixmap.addr;
+			image.data = info->pixmap.addr;
+			switch (info->pixmap.loc) {
+			case FB_PIXMAP_IOMEM:
+				write_op = iowriteb;
+				break;
+			case FB_PIXMAP_SYSMEM:
+			default:
+				write_op = syswriteb;
+				break;
+			}
+		}
+		else {
+			pitch = width * count;
+			dst0 = pixmap;
+			image.data = pixmap;
+			if (pitch * vc->vc_font.height > 8192) 
+				/* 
+				 * FIXME: do multiple blit's instead
+				 *        of exiting
+				 */
+				return;
+		}
 
-		dst0 = pixmap;
 		image.width = vc->vc_font.width * count;
-		image.data = pixmap;
 		while (count--) {
 			src = p->fontdata + (scr_readw(s++) & charmask) * cellsize;
 			dst = dst0;
 			for (i = image.height; i--; ) {
 				for (j = 0; j < width; j++) 
-					dst[j] = *src++;
+					write_op(*src++, dst + j);
 				dst += pitch;
 			}
 			dst0 += width;
 		}
 		info->fbops->fb_imageblit(info, &image);
-		if (info->fbops->fb_sync)
-			info->fbops->fb_sync(info);
+		
 	} else {
 		image.width = vc->vc_font.width;
 		while (count--) {
@@ -429,10 +469,6 @@
 			image.dx += vc->vc_font.width;
 		}	
 	}
-	/*
-	if (pixmap);
-		kfree(pixmap);
-	*/	
 }
 
 void accel_clear_margins(struct vc_data *vc, struct display *p,
diff -Nuar linux-2.4.52/drivers/video/fbmem.c linux/drivers/video/fbmem.c
--- linux-2.4.52/drivers/video/fbmem.c	2002-12-27 14:39:19.000000000 +0000
+++ linux/drivers/video/fbmem.c	2002-12-27 14:41:30.000000000 +0000
@@ -392,6 +392,9 @@
 	if (!info || ! info->screen_base)
 		return -ENODEV;
 
+	if (info->fbops->fb_sync)
+		info->fbops->fb_sync(info);
+
 	if (info->fbops->fb_read)
 		return info->fbops->fb_read(file, buf, count, ppos);
 	
@@ -425,6 +428,9 @@
 	if (!info || !info->screen_base)
 		return -ENODEV;
 
+	if (info->fbops->fb_sync)
+		info->fbops->fb_sync(info);
+
 	if (info->fbops->fb_write)
 		return info->fbops->fb_write(file, buf, count, ppos);
 	
diff -Nuar linux-2.4.52/include/linux/fb.h linux/include/linux/fb.h
--- linux-2.4.52/include/linux/fb.h	2002-12-27 14:39:43.000000000 +0000
+++ linux/include/linux/fb.h	2002-12-27 14:41:31.000000000 +0000
@@ -294,6 +294,16 @@
 	struct fb_cmap cmap;	/* color map info */
 };
 
+#define FB_PIXMAP_SYSMEM    0
+#define FB_PIXMAP_IOMEM     1
+
+struct fb_pixmap {
+	__u32 loc;              /* location of buffer */
+	__u8  *addr;            /* address of buffer */
+	__u32 size;             /* size of buffer */
+	__u32 align;            /* byte alignment per scanline */
+};
+
 /*
  * hardware cursor control
  */
@@ -386,6 +396,7 @@
    struct fb_monspecs monspecs;         /* Current Monitor specs */
    struct fb_cursor cursor;		/* Current cursor */	
    struct fb_cmap cmap;                 /* Current cmap */
+   struct fb_pixmap pixmap;             /* Current pixmap */
    struct fb_ops *fbops;
    char *screen_base;                   /* Virtual address */
    struct vc_data *display_fg;		/* Console visible on this display */




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

end of thread, other threads:[~2002-12-27 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-13 10:09 kernel: matrox fb - missing files, doesn't compile Petr Vandrovec
2002-12-15  0:30 ` Antonino Daplas
2002-12-14 22:44   ` Petr Vandrovec
2002-12-15 17:45     ` Antonino Daplas
2002-12-22  8:44       ` Geert Uytterhoeven
2002-12-27 15:02         ` Antonino Daplas
2002-12-22  8:42   ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2002-12-13  6:13 Ariel

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).