Subject: console mode switching (was:'direct' VRAM access, how ?)
To: None <port-arm32@NetBSD.ORG>
From: Peter Berg <Peter.Berg@ww.tu-freiberg.de>
List: port-arm32
Date: 03/01/1997 13:38:18
> > But how can I determine the address of the upper left edge of the screen ?
> > The address I get from the mmap call is somewhere on the screen.
> > Are there any ioctl's to set a specified video mode e.g. x800y600c36k ?
> 
> there is in vidcconsle.c - see sys/arch/arm32/dev/console/vidcconsole.c at
> approx line 1580, and sys/arch/arm32/include/vconsole.h at approx line 250

I did. As far as good, the video mode setting now works, but not correct. It 
has the same problem as the setvideo command. The new video mode is set (if I 
start X then it starts in the mode set by my program) *but* if I don't start X 
the console *never* switches into the new mode ?!? Why ???

Rob: How do you switch to the video mode set by the ioctl in the X-server ?


Thanks, 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 |
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



here is my code:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

        vidcpointer = mmap(
                                0, 
                                (size_t)768432, 
                                PROT_READ | PROT_WRITE, 
                                MAP_FILE | MAP_SHARED, 
                                fd, 
                                (off_t)0 
                            );
                            
        printf("vidc_pointer: %Lx error: ",vidcpointer);
        printf(strerror(errno)); printf("\r\n");
        
        // 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;
                
        // ... and set it
        ioctl(fd,CONSOLE_MODE,&video_mode);
        ioctl(fd,CONSOLE_RESETSCREEN,&video_mode);
        
        
        for (i=0; i<768432; i++)
        {
                *vidcpointer++ = 255;
        }
        close(fd);
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~