Subject: Re: 'direct' VRAM access, how ?
To: None <port-arm32@NetBSD.ORG>
From: Robert Black <r.black@ic.ac.uk>
List: port-arm32
Date: 02/27/1997 20:08:55
On Feb 27,  4:18pm, Peter Berg wrote:
> Subject: 'direct' VRAM access, how ?
> Hi folks,
>
> because my last query didn't reached the mailinglist for some unknown
reasons,
> here it is again:
>
> How can I map the video ram from the console device into my userspace for
> 'direct' vram access ?
>
> I tried :
>
>         fd = open("/dev/console", O_RDWR | O_NONBLOCK, (mode_t)0644);
                     ^^^^^^^^^^^^
should be /dev/vidcvideo0

>         vidcpointer = mmap(
>                                 (caddr_t)VMEM_VBASE,
>                                 (size_t)1024,
>                                 PROT_READ | PROT_WRITE,
>                                 MAP_FILE | MAP_SHARED,
>                                 fd,
>                                 (off_t)0
>                             );
>
>         printf("vidc_pointer: %Lx error: ",vidcpointer);
>         printf(strerror(errno)); printf("\r\n");
>
> ... but the mmap functions always returns a "Invalid argument" error. What
> have I to do for that the VRAM is correctly mapped into my userspace ?

Wrong device I'm afraid. Note that you won't be able to do this whilst running
X even if you are using another virtual terminal or everything will go pear
shaped. Also make sure that under all exit conditions the program explicitly
closes the device or you will hit a horrible console bug (probably forcing you
to reboot). The new console code should handle this correctly, but the device
name is going to change again.

Cheers

Rob