[ltp] A20p (r128 mobility 3M) XF86 4.1 S/Video -> SCART TV success

Vivek linux-thinkpad@linux-thinkpad.org
Tue, 4 Feb 2003 11:52:46 +0000 (GMT)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---1782332633-1686920837-1044359566=:8914
Content-Type: TEXT/PLAIN; charset=US-ASCII


Ok, here are the instructions I slapped together before:
The patch is against debianised xfree86 4.1, but _should_ apply to
vanilla 4.1 or 4.2 - if not, send me your r128_driver.c and I'll
run up a new patch for you.

Incidentally - it could be argued that the BIOS is as much to blame as the
driver: It contains many modelines, but only one dot clock.

Theproblem with the driver is that it _silently_ throws your modes
away. The patched version tells you which modes are being rejected,
and lists all the modes it knows about.

############################################################################

The file you want to patch is

  xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c

( The patch is against a debianised r128_driver.c but it seems to apply
  cleanly to a non-debianised r128_driver.c : no conflicts here )

The only file you need to replace after rebuilding is r128_drv.o, which
should live somewhere like:

  /usr/X11R6/lib/modules/drivers/

Once you have the new r128_drv.o running (restart X completely - depending
on your settings, you may have to restart xdm or gdm or whatever, as they
may not restart X when you log out - they don't by default).

You MUST be in a sufficiently low res mode, or the TV will just sit there.
720x576 works for me.

Next you need atitvout:

   http://www.stud.uni-hamburg.de/users/lennart/projects/atitvout/
   (I just used the debian package)

Now:

   sudo atitvout -f t

kicks the S/Video output to the tv into life ( I used an S/Video ->
SCART cable )

   sudo atitvout -f l

kicks the display back to LCD. The laptop is capable of simultaneous
display.

If you change modes, you MUST reissue the atitvout command to get TV
output back, changing modes kills the S/Video output.

If you want your video player app to use the screen properly, get
it to use the Xv or GL extension to get a fullscreen window:

  'xine -V Xv -f -g -p azumanga_daioh.avi' # for example
           ^^^^^^^^
otherwise it won't use the right size display.
( If you're using Xine, set the config level to the highest level of
  expertise and choose all the resize_stream options as well. )

I think that's everything.

#########################################################################
# gory details
#########################################################################

For the record, below are the modelines the card will _actually_ support.
Any other resolution will be bounced by the driver (XF86 4.1), and in fact
the only data used by the driver are the displayed resolution numbers
(eg 1400 and 1050) and (with my patch) the dotclock. Without my patch,
the dotclock you supply is ignored.

NOTE: the first two modes have dc values < 12.5 MHz, and are unusable.
You _might_ be able to get them going by bumping the dc value higher:
I have assumed that the laptop wants everything @ 60 Hz because the
only out-of-the-box mode that worked was 1400x1050, which was at 60Hz.

NOTE: after switching resolutions (xvidtune -next), the display may be
scrambled: hitting the lid-closed-cutout-switch ( or closing and
reopening the lid ) fixes this for me.

The relationship between the modeline numbers is as follows:

 "label@refresh" dc hdisp hsstart hsstop htotal vdisp vsstart vsstop vtotal

 (dc * 1000000) / (htotal * vtotal) = refresh
 hdisp and vdisp _must_ match an entry in the VBIOS, or your mode will be
 rejected.

 Where dc is in MHz, and refresh is in Hz.

CAVEAT: I am not a video driver hacker or anything, I just found a place
in the code where user data was silently discarded, and then an error
returned based on the new (magic) data, without ever telling anyone why.
I _could_ be completely wrong, but it seems to work, and it's not
black magic or rocket surgery or anything.

(--) R128(0): VBIOS mode: "320x350@60" 10.19 320 368 375 464 350 351 354 366
(--) R128(0): VBIOS mode: "320x400@60" 11.58 320 368 375 464 400 401 404 416
(--) R128(0): VBIOS mode: "320x400@60" 15.18 320 368 382 608 400 400 403 416
(--) R128(0): VBIOS mode: "320x480@60" 18.09 320 368 382 608 480 480 483 496
(--) R128(0): VBIOS mode: "400x600@60" 25.43 400 448 462 688 600 600 603 616
(--) R128(0): VBIOS mode: "512x384@60" 19.20 512 560 574 800 384 384 387 400
(--) R128(0): VBIOS mode: "640x350@60" 20.38 640 688 702 928 350 350 353 366
(--) R128(0): VBIOS mode: "640x400@60" 23.16 640 688 702 928 400 400 403 416
(--) R128(0): VBIOS mode: "640x475@60" 27.34 640 688 702 928 475 475 478 491
(--) R128(0): VBIOS mode: "640x480@60" 27.62 640 688 702 928 480 480 483 496
(--) R128(0): VBIOS mode: "720x480@60" 30.00 720 768 782 1008 480 480 483 496
(--) R128(0): VBIOS mode: "720x576@60" 35.80 720 768 782 1008 576 576 579 592
(--) R128(0): VBIOS mode: "800x600@60" 40.21 800 848 862 1088 600 600 603 616
(--) R128(0): VBIOS mode: "848x480@60" 33.81 848 896 910 1136 480 480 483 496
(--) R128(0): VBIOS mode: "1024x768@60" 61.72 1024 1072 1086 1312 768 769 772 784
(--) R128(0): VBIOS mode: "1280x1024@60" 97.84 1280 1328 1342 1568 1024 1025 1028 1040
(--) R128(0): VBIOS mode: "1400x1050@60" 108.00 1400 1448 1462 1688 1050 1050 1053 1066


---1782332633-1686920837-1044359566=:8914
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="r128_driver.c.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.44.0302041152460.8914@salmon.pepperfish.net>
Content-Description: 
Content-Disposition: attachment; filename="r128_driver.c.patch"

LS0tIHIxMjhfZHJpdmVyLmRlYmlhbi1vcmlnLmMJU3VuIEZlYiAgMiAxMjoy
MzoxNCAyMDAzDQorKysgcjEyOF9kcml2ZXIuYwlTdW4gRmViICAyIDExOjU5
OjEyIDIwMDMNCkBAIC02MTYsNiArNjE2LDU2IEBADQogCX0NCiAgICAgfQ0K
IA0KKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorICAgICAq
IE9rLCBpZiB3ZSdyZSBvbiBhbiBMQ0QsIGR1bXAgdGhlIGF2YWlsYWJsZSBt
b2RlcywgYXNzdW1pbmcgdGhlIGZyZXEgICoNCisgICAgICogaXMgNjBIeiAo
IFJhZ2UgTW9iaWxpdHkgTTMgZm9yY2VzIHRoZSBkb3RjbG9jayB0byAxMDhN
aHogLSB0aGlzIGlzICAgKg0KKyAgICAgKiBub3QgcmVxdWlyZWQgb3IgdXN1
YWxseSBldmVuIGNvcnJlY3QgKSBPbmUgbm90ZTogV2hlbiBjaGFuZ2luZyBt
b2RlcywqDQorICAgICAqIGl0IG1heSBiZSBuZWNlc3NhcnkgdG8gY2xvc2Ug
dGhlIGxpZCBhbmQgcmVvcGVuIGl0LCBvciBhdCBsZWFzdCBwcm9kICoNCisg
ICAgICogdGhlIGxpZC1jbG9zZWQgY3V0b3V0IHN3aXRjaCAtIHRoaXMgc2Vl
bXMgdG8gd2FrZSB0aGUgY2hpcHNldCB1cCAgICAgKg0KKyAgICAgKiBwcm9w
ZXJseSAtIHRoZSBkaXNwbGF5IG1heSBiZSBzY3JhbWJsZWQgdGlsbCB5b3Ug
ZG8gdGhpcyAgICAgICAgICAgICAqDQorICAgICAqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKiovDQorICAgIGlmKCBpbmZvLT5IYXNQYW5lbFJlZ3MgICAg
ICAgICAgICAgICAgICAgICAgICAgJiYNCisJaW5mby0+QklPU0Rpc3BsYXkg
IT0gUjEyOF9CSU9TX0RJU1BMQVlfQ1JUICYmDQorICAgICAgICBpbmZvLT5W
QklPUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICkNCisgICAg
ew0KKyAgICAgICAgaW50IGk7DQorCWZvciAoaSA9IGluZm8tPkZQQklPU3N0
YXJ0KzY0OyBSMTI4X0JJT1MxNihpKSAhPSAwOyBpICs9IDIpDQorICAgICAg
ICB7DQorICAgICAgICAgICAgZmxvYXQgY2xvY2s7DQorICAgICAgICAgICAg
aW50IGZyZXE7DQorICAgICAgICAgICAgaW50IGhkaXNwbCwgaHN5bmNzLCBo
c3luY2UsIGh0b3RhbDsNCisgICAgICAgICAgICBpbnQgdmRpc3BsLCB2c3lu
Y3MsIHZzeW5jZSwgdnRvdGFsOw0KKwkgICAgaW50IGogPSBSMTI4X0JJT1Mx
NihpKTsNCisgICAgICAgICAgICBpZiggUjEyOF9CSU9TMTYoais1KSApIHsg
aiAgPSBSMTI4X0JJT1MxNihqKzUpOyB9DQorICAgICAgICAgICAgZWxzZSAg
ICAgICAgICAgICAgICAgICB7IGogKz0gOTsgICAgICAgICAgICAgICAgfQ0K
Kw0KKyAgICAgICAgICAgIGNsb2NrICA9IChDQVJEMzIpUjEyOF9CSU9TMTYo
aikgKiAxMDsgICAgICAgICAgICANCisgICAgICAgICAgICBoZGlzcGwgPSAo
IChSMTI4X0JJT1MxNihqICsgMTApICYgMHgwMWZmICkgKyAxICkgKiA4Ow0K
KyAgICAgICAgICAgIGhzeW5jcyA9ICggKFIxMjhfQklPUzE2KGogKyAxMikg
JiAweDAxZmYgKSArIDEgKSAqIDg7DQorICAgICAgICAgICAgaHN5bmNlID0g
aHN5bmNzICsgKCBSMTI4X0JJT1M4KGogKyAxNCkgJiAweDFmICk7DQorICAg
ICAgICAgICAgaHRvdGFsID0gKCAoUjEyOF9CSU9TMTYoaiArIDgpICYgMHgw
MWZmKSArIDEgKSAqIDg7DQorICAgICAgICAgICAgdmRpc3BsID0gKCBSMTI4
X0JJT1MxNihqICsgMTcpICYgMHgwN2ZmICkgKyAxOw0KKyAgICAgICAgICAg
IHZzeW5jcyA9ICggUjEyOF9CSU9TMTYoaiArIDE5KSAmIDB4MDdmZiApICsg
MTsNCisgICAgICAgICAgICB2c3luY2UgPSB2c3luY3MgKyAoIChSMTI4X0JJ
T1MxNihqICsgMTkpID4+IDExKSAmIDB4MWYgKTsNCisgICAgICAgICAgICB2
dG90YWwgPSAoIFIxMjhfQklPUzE2KGogKyAxNSkgJiAweDA3ZmYgKSArIDE7
DQorICAgICAgICAgICAgLyogdGhyb3cgYXdheSB0aGUgY2xvY2ssIGl0J3Mg
dXN1YWxseSB3cm9uZyAqLw0KKyAgICAgICAgICAgIGZyZXEgICA9IDYwOyAv
KiByZWZyZXNoIHJhdGUsIEh6ICovDQorICAgICAgICAgICAgY2xvY2sgID0g
ZnJlcSAqIGh0b3RhbCAqIHZ0b3RhbCAvICAxMDAwOw0KKyAgICAgICAgICAg
IA0KKyAgICAgICAgICAgIHhmODZEcnZNc2coIHBTY3JuLT5zY3JuSW5kZXgs
IFhfUFJPQkVELA0KKyAgICAgICAgICAgICAgICAgICAgICAgICJWQklPUyBt
b2RlOiBcIiVkeCVkQCVkXCIiDQorICAgICAgICAgICAgICAgICAgICAgICAg
IiAlLjJmICVkICVkICVkICVkICVkICVkICVkICVkXG4iLA0KKyAgICAgICAg
ICAgICAgICAgICAgICAgIGhkaXNwbCwgdmRpc3BsLCBmcmVxICAsDQorICAg
ICAgICAgICAgICAgICAgICAgICAgKGNsb2NrIC8gMTAwMCksDQorICAgICAg
ICAgICAgICAgICAgICAgICAgaGRpc3BsLCBoc3luY3MsIGhzeW5jZSwgaHRv
dGFsICwNCisgICAgICAgICAgICAgICAgICAgICAgICB2ZGlzcGwsIHZzeW5j
cywgdnN5bmNlLCB2dG90YWwgKTsNCisgICAgICAgIH0NCisgICAgfQ0KKyAg
ICBlbHNlDQorICAgIHsNCisgICAgICAgIHhmODZEcnZNc2coIHBTY3JuLT5z
Y3JuSW5kZXgsIFhfUFJPQkVELCAiV2hlcmUncyB0aGUgQklPUz9cbiIgKTsN
CisgICAgfQ0KKyAgICANCiAgICAgcmV0dXJuIFRSVUU7DQogfQ0KIA0KQEAg
LTI4NTQsMTIgKzI5MDQsMTYgQEANCiANCiAJICAgIGlmIChtb2RlLT5DcnRj
SERpc3BsYXkgPT0gUjEyOF9CSU9TMTYoaikgJiYNCiAJCW1vZGUtPkNydGNW
RGlzcGxheSA9PSBSMTI4X0JJT1MxNihqKzIpKSB7DQorICAgICAgICAgICAg
ICAgIGludCBiaW9zX2NsayA9IDA7DQorICAgICAgICAgICAgICAgIA0KIAkJ
LyogQXNzdW1lIHdlIGFyZSB1c2luZyBleHBhbmRlZCBtb2RlICovDQogCQlp
ZiAoUjEyOF9CSU9TMTYoais1KSkgaiAgPSBSMTI4X0JJT1MxNihqKzUpOw0K
IAkJZWxzZSAgICAgICAgICAgICAgICAgIGogKz0gOTsNCiANCi0JCW1vZGUt
PkNsb2NrID0gKENBUkQzMilSMTI4X0JJT1MxNihqKSAqIDEwOw0KLQ0KKyAg
ICAgICAgICAgICAgICBiaW9zX2NsayA9IChDQVJEMzIpUjEyOF9CSU9TMTYo
aikgKiAxMDsNCisgICAgICAgICAgICAgICAgaWYoICFtb2RlLT5DbG9jayAp
DQorICAgICAgICAgICAgICAgICAgICBtb2RlLT5DbG9jayA9IGJpb3NfY2xr
Ow0KKyAgICAgICAgICAgICAgICANCiAJCW1vZGUtPkhEaXNwbGF5ICAgPSBt
b2RlLT5DcnRjSERpc3BsYXkgICA9DQogCQkgICAgKChSMTI4X0JJT1MxNihq
KzEwKSAmIDB4MDFmZikrMSkqODsNCiAJCW1vZGUtPkhTeW5jU3RhcnQgPSBt
b2RlLT5DcnRjSFN5bmNTdGFydCA9DQpAQCAtMjg3NywxMCArMjkzMSwyMyBA
QA0KIAkJICAgIG1vZGUtPkNydGNWU3luY1N0YXJ0ICsgKChSMTI4X0JJT1Mx
NihqKzE5KSA+PiAxMSkgJiAweDFmKTsNCiAJCW1vZGUtPlZUb3RhbCAgICAg
PSBtb2RlLT5DcnRjVlRvdGFsICAgICA9DQogCQkgICAgKFIxMjhfQklPUzE2
KGorMTUpICYgMHgwN2ZmKSsxOw0KLQ0KKyAgICAgICAgICAgICAgICB4Zjg2
RHJ2TXNnKCBwU2Nybi0+c2NybkluZGV4LCBYX0lORk8sDQorICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICJBVEkgVkJJT1MgQUNDRVBURUQgbW9kZSAl
ZHglZCAiDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICIobGlzdGVk
OiBjbG9jayAlZCA8QklPUzolZD4sIChofHYpc3luYyAlZHwlZClcbiIsDQor
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGUtPkNydGNIRGlzcGxh
eSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsDQorICAgICAgICAg
ICAgICAgICAgICAgICAgICAgIG1vZGUtPkNydGNWRGlzcGxheSAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAsDQorICAgICAgICAgICAgICAgICAg
ICAgICAgICAgIG1vZGUtPkNsb2NrICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAg
IGJpb3NfY2xrICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGUtPkNs
b2NrIC8gKCBtb2RlLT5IVG90YWwgICkgICAgICAgICAgICAgICAgICAsDQor
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICggbW9kZS0+Q2xvY2sgKiAx
MDAwICkgLw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICggbW9k
ZS0+SFRvdGFsICogbW9kZS0+VlRvdGFsICkgICAgICAgICAgICAgICAgKTsN
CiAJCXJldHVybiBNT0RFX09LOw0KIAkgICAgfQ0KIAl9DQorICAgICAgICB4
Zjg2RHJ2TXNnKCBwU2Nybi0+c2NybkluZGV4LCBYX0lORk8sDQorICAgICAg
ICAgICAgICAgICAgICAiQVRJIFZCSU9TIFJFSkVDVEVEIG1vZGUgJWR4JWQg
KG5vdCBsaXN0ZWQpXG4iLA0KKyAgICAgICAgICAgICAgICAgICAgbW9kZS0+
Q3J0Y0hEaXNwbGF5ICAgICAsDQorICAgICAgICAgICAgICAgICAgICBtb2Rl
LT5DcnRjVkRpc3BsYXkgICAgICk7DQogCXJldHVybiBNT0RFX05PTU9ERTsN
CiAgICAgfQ0KIA0K
---1782332633-1686920837-1044359566=:8914--