RE: [Xpert]!! Correction for i810 driver !!
I think I finally found the time to look at this. The diff below now makes sure we only touch the OVRACT registers when the CRT timings are used ie. if TV/LCD is off or bit 28 (use VGA Mode) is 1. Please apply this to a version of the i810 driver from CVS head and test it thoroughly. Regards, Egbert. Sottek, Matthew J writes: > I'll try to summarize. > > The OVRACT register controls how the overlay lines up with the TV/LCD > output. > This alignment needs to be calculated based on the horizontal timings being > used on the TV. > > On an i810/i815 the video bios will program the timings for the TV > controller > if it is used as the primary output device. The CRT timings are then > centered > in the TV timings which allows XFree to display on the TV using one, fixed, > TV resolution that was chosen by the vbios. > > Since this mechanism was designed for compatibility with VGA, DOS etc, the > vbios is not programming the OVRACT register... this register was being set > in Set Mode which made it work for at least one TV controller in at least > one mode. > > If we base the OVRACT register programming on the sync timings set by the > vbios you can probably make it work for everyone. > > If the TV is active: >Regs 0x6-0x60023 control the timings in use by the GMCH is bit 28 > in lcdtv_c is 0 (This is usually the case). The CRTC timings are > centered in these values if bit 29 is 1 (usual case) >OVRACT needs to be programmed off the TV regs if they are in use. > If the TV is not active >CRTC regs control the timings >OVRACT needs to be programmed off the CRTC regs > > For an LCD the vbios may or may not be using the LCD/TV timings depending > on the capabilities of the LCD device. I suggest checking bit 28 of > lcdtv_c to make sure that the TV regs are in use. The centering probably > doesn't matter because the end timings are still those in the TV regs. > > At this point, if this works for both of you, I suggest committing it and > asking for lots of testing. You will have a lot of permutations of > LCD encoders, LCD displays, and TV encoders that may all behave > differently. Only widespread testing will indicate if it is an > improvement. > > Egbert, > Wherever you end up putting this you can probably replace any other > programming of OVRACT. Just make sure that if you switch away or change > modes for any reason that you read the timings again. A stand alone TV > driver could have changed them. > > > -Matt > > > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c > Somewhere near line 1522 > > unsigned int lcdtv_c=0; > unsigned int tv_htotal=0; > > /* OVRACT Register */ > lcdtv_c = INREG(0x60018); > tv_htotal = INREG(0x6); > > if((lcdtv_c & 0x8000) && > (~lcdtv_c & 0x2000) && > (tv_htotal)) { >i810Reg->OverlayActiveStart = (temp>>16) - 31; >i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; > } else { >i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; > i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; > } > > > -Original Message- > From: Egbert Eich [mailto:eich@;XFree86.Org] > Sent: Wednesday, October 16, 2002 5:44 AM > To: [EMAIL PROTECTED] > Cc: Sebastien BASTARD > Subject: RE: [Xpert]!! Correction for i810 driver !! > > > Hi Matthew, > > thanks for following up on this. > > Sottek, Matthew J writes: > > Egbert, > > Actually... I'm thinking there is a problem with this way too. We need > > another "if" in there. i.e. > > > > if((tv is on) && (vbios left a set of TV timings for us)) { > >use TV regs; > > } else { > >use crt regs; > > } > > > > Otherwise we might end up using the TV timings even when the display is > not > > on > > the TV (depending on what the vbios does when using CRT in a system that > has > > a TV controller). > > > Yes, I suspected something like this. > > > > > Check the LCDTV_C register (offset 0x60018) bit 31. If it is set then > > the TV is in use. So try this one: > > > > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c > >Somewhere near line 1522 > > > > > > unsigned int lcdtv_c=0; > > unsigned int tv_htotal=0; > > > > /* OVRACT Register */ > > lcdtv_c = INREG(0x600
RE: proof-reader's report on RE: [Xpert]!! Correction for i810 driver !!
Yup If this isn't proof that we should always just code it up, compile test and diff, then I don't know what is :) I started out with "I don't have time but I'll put in my $0.02" and now we've spent more time writing email code than it would have taken in the first place... oh well, best intentions sometimes don't work out. -Matt -Original Message- From: Dr Andrew C Aitchison [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 16, 2002 9:36 AM To: '[EMAIL PROTECTED]' Cc: Sebastien BASTARD; '[EMAIL PROTECTED]' Subject: proof-reader's report on RE: [Xpert]!! Correction for i810 driver !! On Wed, 16 Oct 2002, Sottek, Matthew J wrote: This proof-reader suggests: sed -e s/temp/tv_htotal/g > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c > Somewhere near line 1522 > > unsigned int lcdtv_c=0; > unsigned int tv_htotal=0; > > /* OVRACT Register */ > lcdtv_c = INREG(0x60018); > tv_htotal = INREG(0x6); > > if((lcdtv_c & 0x8000) && > (~lcdtv_c & 0x2000) && > (tv_htotal)) { >i810Reg->OverlayActiveStart = (temp>>16) - 31; >i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; > } else { >i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; >i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; > } -- Dr. Andrew C. Aitchison Computer Officer, DPMMS, Cambridge [EMAIL PROTECTED] http://www.dpmms.cam.ac.uk/~werdna ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert
proof-reader's report on RE: [Xpert]!! Correction for i810 driver!!
On Wed, 16 Oct 2002, Sottek, Matthew J wrote: This proof-reader suggests: sed -e s/temp/tv_htotal/g > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c > Somewhere near line 1522 > > unsigned int lcdtv_c=0; > unsigned int tv_htotal=0; > > /* OVRACT Register */ > lcdtv_c = INREG(0x60018); > tv_htotal = INREG(0x6); > > if((lcdtv_c & 0x8000) && > (~lcdtv_c & 0x2000) && > (tv_htotal)) { >i810Reg->OverlayActiveStart = (temp>>16) - 31; >i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; > } else { >i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; >i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; > } -- Dr. Andrew C. Aitchison Computer Officer, DPMMS, Cambridge [EMAIL PROTECTED] http://www.dpmms.cam.ac.uk/~werdna ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert
RE: [Xpert]!! Correction for i810 driver !!
I'll try to summarize. The OVRACT register controls how the overlay lines up with the TV/LCD output. This alignment needs to be calculated based on the horizontal timings being used on the TV. On an i810/i815 the video bios will program the timings for the TV controller if it is used as the primary output device. The CRT timings are then centered in the TV timings which allows XFree to display on the TV using one, fixed, TV resolution that was chosen by the vbios. Since this mechanism was designed for compatibility with VGA, DOS etc, the vbios is not programming the OVRACT register... this register was being set in Set Mode which made it work for at least one TV controller in at least one mode. If we base the OVRACT register programming on the sync timings set by the vbios you can probably make it work for everyone. If the TV is active: Regs 0x6-0x60023 control the timings in use by the GMCH is bit 28 in lcdtv_c is 0 (This is usually the case). The CRTC timings are centered in these values if bit 29 is 1 (usual case) OVRACT needs to be programmed off the TV regs if they are in use. If the TV is not active CRTC regs control the timings OVRACT needs to be programmed off the CRTC regs For an LCD the vbios may or may not be using the LCD/TV timings depending on the capabilities of the LCD device. I suggest checking bit 28 of lcdtv_c to make sure that the TV regs are in use. The centering probably doesn't matter because the end timings are still those in the TV regs. At this point, if this works for both of you, I suggest committing it and asking for lots of testing. You will have a lot of permutations of LCD encoders, LCD displays, and TV encoders that may all behave differently. Only widespread testing will indicate if it is an improvement. Egbert, Wherever you end up putting this you can probably replace any other programming of OVRACT. Just make sure that if you switch away or change modes for any reason that you read the timings again. A stand alone TV driver could have changed them. -Matt File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Somewhere near line 1522 unsigned int lcdtv_c=0; unsigned int tv_htotal=0; /* OVRACT Register */ lcdtv_c = INREG(0x60018); tv_htotal = INREG(0x6); if((lcdtv_c & 0x8000) && (~lcdtv_c & 0x2000) && (tv_htotal)) { i810Reg->OverlayActiveStart = (temp>>16) - 31; i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; } else { i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; } -Original Message- From: Egbert Eich [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 16, 2002 5:44 AM To: [EMAIL PROTECTED] Cc: Sebastien BASTARD Subject: RE: [Xpert]!! Correction for i810 driver !! Hi Matthew, thanks for following up on this. Sottek, Matthew J writes: > Egbert, > Actually... I'm thinking there is a problem with this way too. We need > another "if" in there. i.e. > > if((tv is on) && (vbios left a set of TV timings for us)) { >use TV regs; > } else { >use crt regs; > } > > Otherwise we might end up using the TV timings even when the display is not > on > the TV (depending on what the vbios does when using CRT in a system that has > a TV controller). Yes, I suspected something like this. > > Check the LCDTV_C register (offset 0x60018) bit 31. If it is set then > the TV is in use. So try this one: > > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c >Somewhere near line 1522 > > > unsigned int lcdtv_c=0; > unsigned int tv_htotal=0; > > /* OVRACT Register */ > lcdtv_c = INREG(0x60018); > tv_htotal = INREG(0x6); > > if((lcdtv_c & 0x8000) && (tv_htotal)) { > i810Reg->OverlayActiveStart = (temp>>16) - 31; > i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; > } else { > i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; > i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; > } > > We may need more changes than that. It is still not clear to me if the change in the OverlayActiveStart and OverlayActiveEnd settings will do on an LCD. In the end we are just reducing the ActiveStart and ActiveEnd registers by 31. I don't see why we need to do this. Also we read out the values in SetMode. When this function gets called the values of these regsiters may not be the original ones set by the BIOS any more as SetMode() may be called several times. We need to grab the value in PreInit() - or if the BIOS may change them behind our back - save and compare the value we have set and ref
RE: [Xpert]!! Correction for i810 driver !!
Hi Matthew, thanks for following up on this. Sottek, Matthew J writes: > Egbert, > Actually... I'm thinking there is a problem with this way too. We need > another "if" in there. i.e. > > if((tv is on) && (vbios left a set of TV timings for us)) { >use TV regs; > } else { >use crt regs; > } > > Otherwise we might end up using the TV timings even when the display is not > on > the TV (depending on what the vbios does when using CRT in a system that has > a TV controller). Yes, I suspected something like this. > > Check the LCDTV_C register (offset 0x60018) bit 31. If it is set then > the TV is in use. So try this one: > > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c >Somewhere near line 1522 > > > unsigned int lcdtv_c=0; > unsigned int tv_htotal=0; > > /* OVRACT Register */ > lcdtv_c = INREG(0x60018); > tv_htotal = INREG(0x6); > > if((lcdtv_c & 0x8000) && (tv_htotal)) { > i810Reg->OverlayActiveStart = (temp>>16) - 31; > i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; > } else { > i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; > i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; > } > > We may need more changes than that. It is still not clear to me if the change in the OverlayActiveStart and OverlayActiveEnd settings will do on an LCD. In the end we are just reducing the ActiveStart and ActiveEnd registers by 31. I don't see why we need to do this. Also we read out the values in SetMode. When this function gets called the values of these regsiters may not be the original ones set by the BIOS any more as SetMode() may be called several times. We need to grab the value in PreInit() - or if the BIOS may change them behind our back - save and compare the value we have set and refresh it in case it has changed. However I won't implement this until I understand better why we have to touch these values in the first place. Sebastien, could you please check what happens when these these values are left the way the BIOS set them? Regards, Egbert. ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert
RE: [Xpert]!! Correction for i810 driver !!
Egbert, Actually... I'm thinking there is a problem with this way too. We need another "if" in there. i.e. if((tv is on) && (vbios left a set of TV timings for us)) { use TV regs; } else { use crt regs; } Otherwise we might end up using the TV timings even when the display is not on the TV (depending on what the vbios does when using CRT in a system that has a TV controller). Check the LCDTV_C register (offset 0x60018) bit 31. If it is set then the TV is in use. So try this one: File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Somewhere near line 1522 unsigned int lcdtv_c=0; unsigned int tv_htotal=0; /* OVRACT Register */ lcdtv_c = INREG(0x60018); tv_htotal = INREG(0x6); if((lcdtv_c & 0x8000) && (tv_htotal)) { i810Reg->OverlayActiveStart = (temp>>16) - 31; i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; } else { i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; } -Original Message- From: Egbert Eich [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 15, 2002 10:44 AM To: [EMAIL PROTECTED] Subject: RE: [Xpert]!! Correction for i810 driver !! Sottek, Matthew J writes: > Actually... > I am not sure that reg 0x6 will be set in all cases. I may only be > programmed if there is a TVout controller present in the system. Doing > it this way is safer. Maybe someone looking for a task can make a diff out > of this and submit it to the patches list? I've checked with the docs and it looks like this patch may be correct. I'll test it in my i810 and submit it if I don't see any side effects. Thanks to both Sebastien and matt! Regards, Egbert. > > -Matt > > > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c > Somewhere near line 1522 > > > unsigned int temp=0; > >/* OVRACT Register */ >temp = INREG(0x6); >if(temp) { > i810Reg->OverlayActiveStart = (temp>>16) - 31; > i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; >} else { > i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; > i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; >} > ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert
RE: [Xpert]!! Correction for i810 driver !!
Sottek, Matthew J writes: > Actually... > I am not sure that reg 0x6 will be set in all cases. I may only be > programmed if there is a TVout controller present in the system. Doing > it this way is safer. Maybe someone looking for a task can make a diff out > of this and submit it to the patches list? I've checked with the docs and it looks like this patch may be correct. I'll test it in my i810 and submit it if I don't see any side effects. Thanks to both Sebastien and matt! Regards, Egbert. > > -Matt > > > File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c > Somewhere near line 1522 > > > unsigned int temp=0; > >/* OVRACT Register */ >temp = INREG(0x6); >if(temp) { > i810Reg->OverlayActiveStart = (temp>>16) - 31; > i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; >} else { > i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; > i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; >} > ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert
RE: [Xpert]!! Correction for i810 driver !!
Actually... I am not sure that reg 0x6 will be set in all cases. I may only be programmed if there is a TVout controller present in the system. Doing it this way is safer. Maybe someone looking for a task can make a diff out of this and submit it to the patches list? -Matt File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Somewhere near line 1522 unsigned int temp=0; /* OVRACT Register */ temp = INREG(0x6); if(temp) { i810Reg->OverlayActiveStart = (temp>>16) - 31; i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; } else { i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; } -Original Message- From: Sebastien BASTARD [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 15, 2002 2:50 AM To: < Subject: [Xpert]!! Correction for i810 driver !! Hello, I have a i810 controller with crontel 7007 out tv. With the lastest Xfree 4.2.1, the Video Direct Render didn't work correctly. In 640x480, the Video Direct Render print half image on the screen. And with 800x600, i hadn't picture. While 3 weeks, i searched a solution. I find one on a e-mail (but i forgot the name of the person who posting the test solution). I tested, and it work great ! I don't how it work (the solution), but it works. I tested in 640x480, and 800x600 resolution, 24 bits and 16 bits. Someone can modify the CSV driver 810 file ? File : xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c removed (line 1522): /* OVRACT Register */ i810Reg->OverlayActiveStart = mode->CrtcHTotal - 32; i810Reg->OverlayActiveEnd = mode->CrtcHDisplay - 32; added (1476) : unsigned int temp=0; added (line 1522) : temp = INREG(0x6); i810Reg->OverlayActiveStart = (temp>>16) - 31; i810Reg->OverlayActiveEnd = (temp & 0x3ff) - 31; P.S : Sorry for my bad english ... and sorry because i didn't used the diff program French programmer ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert ___ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert