Subject: Re: 16bpp setting for X
To: Peter Teichmann <teich-p@Rcs1.urz.tu-dresden.de>
From: Peter Berg <Peter.Berg@ww.tu-freiberg.de>
List: port-arm32
Date: 03/02/1997 13:24:08
This is a multipart MIME message.

--===_0_Sun_Mar__2_13:15:57_MET_1997
Content-Type: text/plain; charset=us-ascii

> Hi,
> 
> unfortunately I cannot help you with your problem, but it seems to me that
> you perhaps could help me with mine.
> 
> >From your code I can see that you are able to use 16bpp at 800x600 pixels.
>  
> >         // define video mode ... 
> >         video_mode.pixel_rate = 50000;
> >         video_mode.hswr      = 100;
> >         video_mode.hbsr      = 42;
> >         video_mode.hdsr      = 42;
> >         video_mode.hder      = 800;
> >         video_mode.hber      = 42;
> >         video_mode.hcr       = 14;
> >         video_mode.vswr      = 6;
> >         video_mode.vbsr      = 23;
> >         video_mode.vdsr      = 0;
> >         video_mode.vder      = 600;
> >         video_mode.vber      = 0;
> >         video_mode.vcr       = 37;
> >         video_mode.bitsperpixel = 16;
> >         video_mode.sync_pol  = 0;
> >         video_mode.frame_rate = 72;
> 
> I never managed to get X running in 16bpp video modi and to get a
> readable display. I described this problem a month ago or so in
> this mailing list, but got only the answer that nobody really knows
> why it does not work, but that this is normal in resolutions other than
> 1024x768.
> 
> So if zou really managed to get something running in 16 bpp and not
> 1024x768 pixels, please tell me how you did it.

I'm a little bit surprised about this too because I too read this and thought 
it wasn't possible. I've finished yesterday the mdf parser so that you now 
able to use any mode from the mdf file.
I tried it with x640y480c32k and x800y600c32 and it worked in both cases 
without any problems.

I've included the 'library' (ATM the only function provided is the parse_mdf 
one) in this mail; now you can write your own setvideo program. I've no time 
to write a cmd-line parser for it ATM.

Apart from this, a setvideo -x 800 -y 600 -c 16 works too on my machine, so
if this doesn't work for you, the other code will probaly also not work.
(you need Xarm27 for 16bpp)

If this shouldn't work for you I can make my custom kernel available on my 
website (but I see no reason why the voy-48xx kernel shouldn'n work, I've
changed nothing in the console code).



Ciao, Peter

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
|                                                                          |
|                            >>> FutureGroove <<<                          |
|                                                                          |
| Peter Berg                                       Music production &      |
|                                                  softwaredevelopment     |
| w3: http://www.ww.tu-freiberg.de/~pberg                                  |
| email: Peter.Berg@ww.tu-freiberg.de                                      |
|                                           part time system administrator |
|                                                   at *.ww.tu-freiberg.de |
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/




you can use the following code for this:

#include <sys/types.h>
#include <machine/vidc.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <machine/vconsole.h>

#include <vidc.h>

main()
{
videomemory_t vidc;
caddr_t vidcpointer;
int fd;
int i;
struct vidc_mode video_mode;

	fd = open("/dev/vidcvideo0", O_RDWR | O_NONBLOCK, (mode_t)0644);
	
	// the mmap call can be ommited for this I think
	vidcpointer = mmap(
				0, 
			   	(size_t)768432, 
			    	PROT_READ | PROT_WRITE, 
			    	MAP_SHARED, 
			    	fd, 
			    	(off_t)0 
			    );
	// parameters: xres, yres, bpp, framerate, struct vidc_mode
    	// if framerate = NULL the highest found will be used
	// caution: no error checking is done ATM, if you want use an undefined
	// mode you will get undefined values for the vidc, you can damage
	// your hardware with this !!! be carefull !!! Use it at your own
	// risk !
	//
	parse_mdf(640,480,16,NULL,&video_mode);
			
	//  set it
	ioctl(fd,CONSOLE_MODE,&video_mode);
	ioctl(fd,CONSOLE_RESETSCREEN,&video_mode);	
	
	close(fd);
}



--===_0_Sun_Mar__2_13:15:57_MET_1997
Content-Type: application/octet-stream
Content-Description: vidc.h
Content-Transfer-Encoding: x-uuencode

begin 644 vidc.h
M"F5X=&5R;B!I;G0@<&%R<V5?;61F*&EN="`L(&EN="`L(&EN="P@:6YT("P@
6<W1R=6-T('9I9&-?;6]D92`J*3L*"FEN
`
end

--===_0_Sun_Mar__2_13:15:57_MET_1997
Content-Type: application/octet-stream
Content-Description: libvidc.a
Content-Transfer-Encoding: x-uuencode

begin 644 libvidc.a
M(3QA<F-H/@I?7RY364U$148@("`@("`@.#4W,C4V-S4R("`@,"`@("`@,"`@
M("`@-C0T("`@("`R."`@("`@("`@8`H(`````````&`````+````7W!A<G-E
M7VUD9@`*<&UD9BYO("`@("`@("`@(#@U-S(U-C<T."`@(#`@("`@(#`@("`@
M(#$P,#8T-"`@,S8S,2`@("`@(&`*`(\!!W`'`````````````#`#````````
M$`(````````E9```*"5D2'HI```@````+V5T8R]M;VYI=&]R+F-O;F8```!(
M>BD`<W1A<G1M;V1E````(P```&5N9&UO9&4`<&EX96Q?<F%T93H`<WEN8U]P
M;VPZ````:%]T:6UI;F=S.@``+````'9?=&EM:6YG<SH```T*<&%R<V5D('9A
M;'5E<SH-"@``#0IP:7AE;')A=&4Z("5D('-Y;F-?<&]L.B`E9``````-"FAS
M=W(Z("5D(&AB<W(Z("5D(&AD<W(Z("5D(&AD97(Z("5D(&AB97(Z("5D(&AC
M<B`Z("5D``T*=G-W<CH@)60@=F)S<CH@)60@=F1S<CH@)60@=F1E<CH@)60@
M=F)E<CH@)60@=F-R(#H@)60`#0H-"@``````````!`````P````0````)```
M`"@````T````.````$````!,````6````&0```!H````=````(@```"H````
MX````!@!```-P*#A$-@MZ02P3.)"WDWB"-!-XA0`"^48$`OE'"`+Y2`P"^5(
M/TOB)#$+Y8H_2^(4(!OEA!`?Y0,`H.'^___KRC]+XA@@&^68$!_E`P"@X?[_
M_^L@,!OE``!3XP8```I"/DOB"#!#XB`@&^6X$!_E`P"@X?[__^L$``#J0CY+
MX@@P0^+,$!_E`P"@X?[__^L$,)OE("`;Y3P@@^4$,)OE'"`;Y30@@^5I+Z#C
M`!"@X_0`'^7^___K`#"@X30T"^4T-!OE`0!SXP$``!H``.#C2P$`Z@``H.$`
M,*#C,#0+Y4(^2^(),$/B`2"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
MY4@_2^(H%!_E`P"@X?[__^L`,*#A``!3XSX```HD(1OE"C""X@,`H.'^___K
M`#"@X00@F^4<,(+E2#]+XF04'^4#`*#A_O__ZP`PH.$!((/B*"$+Y2@!&^7^
M___K`#"@X00@F^4@,(+ED!0?Y2@!&^7^___K`#"@X0$@@^(H(0OE*`$;Y?[_
M_^L`,*#A!"";Y20P@N6\%!_E*`$;Y?[__^L`,*#A`2"#XB@A"^4H`1OE_O__
MZP`PH.$$()OE*#""Y>@4'^4H`1OE_O__ZP`PH.$!((/B*"$+Y2@!&^7^___K
M`#"@X00@F^4L,(+E%!4?Y2@!&^7^___K`#"@X0$@@^(H(0OE*`$;Y?[__^L`
M,*#A!"";Y3`P@N5(/TOB`P"@X?[__^LX-!OE``!3XP```!H```#JYO[_ZE@%
M'^7^___K!#";Y000F^4X()/E`!"1Y6P%'^7^___K!#";Y00@F^4$$)OE!,";
MY1C@G.4$X"WE!,";Y13@G.4$X"WE!,";Y1#@G.4$X"WE##"3Y0@@DN4$$)'E
MK`4?Y?[__^L,T(WB!#";Y00@F^4$$)OE!,";Y3#@G.4$X"WE!,";Y2S@G.4$
MX"WE!,";Y2C@G.4$X"WE)#"3Y2`@DN4<$)'E\`4?Y?[__^L,T(WB^`4?Y?[_
M_^LT!!OE_O__ZP``H./____J$*@;Z2`!```$```$)`$```0```0H`0``!```
M!"P!```$```$,`$```0```0T`0``!```!#@!```$```$/`$```0```1``0``
M!```!$0!```$```$2`$```0```1,`0``!```!%`!```$```$5`$```0```18
M`0``!```!%P!```$```$8`$```0```1D`0``!```!*0!```G```.N`$``"<`
M``[<`0``)P``#O0!```G```.'`(``"H```Y<`@``+P``#M`"```S```.\`(`
M`#,```XP`P``,P``#E`#```S```.=`,``#,```Z0`P``,P``#L0#```S```.
M\`,``#,```X,!```/```#B@$```S```.1`0``#P```Y@!```,P``#GP$```\
M```.F`0``#,```ZL!```/```#L0$```S```.V`0``#P```[P!```,P``#@0%
M```\```.'`4``#,```XP!0``/```#D@%```S```.7`4``#P```YX!0``,P``
M#I0%```\```.L`4``#,```[$!0``/```#MP%```S```.\`4``#P```X(!@``
M,P``#AP&```\```.-`8``#,```Y(!@``/```#F`&```S```.=`8``#P```Z,
M!@``0```#J@&``!````.P`8``$````X$!P``0```#DP'``!````.6`<``$``
M``Y@!P``0P``#@0````$`````````!,````$`````````"4````$````````
M`"D````$````!````"T````$````#````#$````$````$````#4````$````
M)````#D````$````*````#X````$````-````$,````$````.````$@````$
M````0````$T````$````3````%(````$````6````%<````$````9````%P`
M```$````:````&$````$````=````&8````$````B````&L````$````J```
M`'`````$````X````'4````$````&`$``'H````$````(`$``'X````$````
M)`$``((````$````*`$``(8````$````+`$``(H````$````,`$``(X````$
M````-`$``),````$````.`$``)@````$````/`$``)T````$````0`$``*(`
M```$````1`$``*<````$````2`$``*P````$````3`$``+$````$````4`$`
M`+8````$````5`$``+L````$````6`$``,`````$````7`$``,4````$````
M8`$``,H````$````9`$``,\````%````:`$``-H````!`````````.,````$
M````Y`$``.8````$````^`$``.D````!`````````.\````$````/`(``/(`
M```$````;`<``/4````$````0`(``/@````$````2`(``/P````!````````
M``(!```$````E`(```8!```$````F`(```H!```$````Y`(```X!```!````
M`````!8!```$````$`,``!H!```$````(`,``!X!```$````K`,``"(!```$
M````K`,``"8!```$````D`8``"H!```$````Y`,``"X!```$````D`8``#(!
M```$````'`0``#8!```!`````````#P!```$````5`0``$`!```$````;`4`
M`$0!```$````A`8``$@!```!`````````%`!```$````H`8``%0!```$````
MI`8``%@!```!`````````%\!``!G8V,R7V-O;7!I;&5D+@!?7U]G;G5?8V]M
M<&EL961?8P!,0S``3$,R`$Q#-`!,0S8`3$,X`$Q#,3``3$,Q,@!,0S$T`$Q#
M,38`3$,Q.`!,0S(P`$Q#,C(`3$,R-`!,0S(V`$Q#,C@`3$,S,`!,0S,R`$Q#
M,S0`3$,Q`$Q#,P!,0S4`3$,W`$Q#.0!,0S$Q`$Q#,3,`3$,Q-0!,0S$W`$Q#
M,3D`3$,R,0!,0S(S`$Q#,C4`3$,R-P!,0S(Y`$Q#,S$`3$,S,P!,0S,U`%]P
M87)S95]M9&8`7W-P<FEN=&8`3#8`3#<`7V]P96X`3#@`3#4`3#D`3#$R`%]R
M96%D`$PQ-0!,,3,`3#$X`%]S=')S='(`3#$W`$PQ-@!,,3D`3#(P`$PR,0!,
M,C(`3#(S`$PR-`!?871O:0!,,C4`3#(V`$PR-P!?<')I;G1F`$PR.`!,,3``
(7V-L;W-E``HR
`
end

--===_0_Sun_Mar__2_13:15:57_MET_1997--