Subject: framebuffer mmap access
To: None <port-alpha@netbsd.org>
From: Brett D. Slager <bds@snarf.thnet.com>
List: port-alpha
Date: 03/14/1999 18:26:33
I've been working on MI wscons Xserver support, and I've run into a
problem.  -current kernels built back in Feb. are able to mmap the
tga framebuffer, and access the memory, but the only thing that happens
is the display goes reverse video.  No X background or cursor.
Everything else seems to be working:  with xev I can verify that keyboard
and mouse input work, but the framebuffer seems to be mapped wrong.
After building a more recent kernel (today, Mar 14) framebuffer mmaps
succeed, but touching any of the mapped memory bombs on a SEGV.

Here's a script of a test program (included) that demonstrates:

Script started on Sun Mar 14 16:53:24 1999
% gdb tgacls
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (alpha--netbsd), Copyright 1996 Free Software Foundation, Inc...
(gdb) run
Starting program: /usera/bds/src/tgacls/tgacls 
WSDISPLAYIO_GINFO: height = 768, width = 1024, depth = 8, cmsize = 256
mapaddr = 0x160100000
tgaregs = 0x160200000

Program received signal SIGSEGV, Segmentation fault.
main () at tgacls.c:75
75              switch (tgaregs[TGA_REG_VHCR] & 0x1ff) {
(gdb) quit
The program is running.  Quit anyway (and kill it)? (y or n) y
% exit

Script done on Sun Mar 14 16:54:14 1999

Here's the test program.  It's basically bits ripped out of the tga
driver source to get some info and clear the screen.  It assumes
T8-02 tga, but there are knobs for other cards in the source.

begin 644 tgacls.tar.gz
M'XL("'@^[#8``W1G86-L<RYT87(`[5=M;]M&#,Y7Z5=P*1K(CNI(\DN\MF[A
M)FX:I&X"VV@[;(4@2R?[$%DR)#E.MO6_C_<B2XZU%/N0#-C$#[X[WD,>>3R2
M<CISW"`YVGM,@I9QW&[#'D#;:K;8B&3(42Z@TSEN&LUCLV,!F$:SV=R#]J-:
M)6F5I$X,L#?UD@=QZSDAP5,8]+24BO@/G6OBTX`\RAFF871:K;^/OVFV>?RM
MCM4Q\*&`:1EM<P^,1['F'OW/XW\UNCSK@7@%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;%99=NH[7'H^_[YQ\%IL4+QTXJU;J?8Y)8]7[)"`I+!T;(8XZ96*-$U
M3=.P!L0XR\!P").SOCT<#.V3T>!L7'Y6KDZ>)1D<G:QIZL[Y08SW*].'JNS/
M'TY&WS!LQJV)C@,V+A?;"Q@OT<VL.';-GRV\$F4:$^>:*>,0\QZDLP7!^#FK
M("UB?G0V/L"""N5[B8MYN>8.\B5W+VNJN"<P==!$!3N";FD;*$A(;1F'*525
M39O8-?MS9O:Q>"L/M1BN6:RYH9L.SAZK?!R'6VER"%ATMAOXS@%%+3+8&Q:S
MJ.SJ')K2<(;U'Q*"6>0E,"68@036L=CQ8V=!T!"?Q(U&`Y4R34E`R%(S>;>7
MN3A&(YT@@"DK5#3D+6I);TF`#B77.NM<)'2F@=",-XP,AN>8I"&2=M=`])V;
MD:N2)MR__[.KKR/[ZAMKI;>^)-%3P0T()@XS*'%C@A\BI2=Q%#M*@.0QK!II
ME#=HH/!:!@W]S=X%8Q_V@-64R-=6-BIM6G9:8Q6AGJ]9!N?Q.01:RYK^KLO"
M2&X/\80=JJ*QK[Z:&T0)P4\F9'VO_J]65%%%%5544445551111555%%%%554
.447_9?H+B4>_(``H```)
`
end

Btw, this is on a multia if it makes any difference.

I haven't changed any kernel source: this is with the stock tga driver.
Any ideas on why this doesn't work?

-- Brett