Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Further info on the Picasso II blues



On Thu, 5 Sep 1996, Phil Kernick wrote:

> Hi Bernd,
> 
> > A workaround would be to disable the Hardwarecursor in the kernel.
> > Edit grf_cl.c and look for the cl_ioctl function.
> 
> After disabling the hardware cursor, I finally get a cursor using Xcl!
> 
> As to the question of why the HW cursor works for AmigaOS, but not NetBSD
> with a 1M Picasso, I am happy to test any configurations.
> 
> I'd do a little poking around myself, but I'm limited in that I can't write
> to /dev/mem, and as such I can't look at the VGA registers.
> 

No need to write to /dev/kmem for this purpose. There is a defined 
interface for accessing VGA-Registers which is used by e.g. the Xserver. 
An example code could look like this:

#include <sys/file.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <amiga/dev/grfioctl.h>
#include <amiga/dev/grf_clreg.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int grffd;
    struct grfvideo_mode gv;
    volatile unsigned char *fb;
    volatile unsigned char *vgaba;

    /* open grf device */
    grffd = open("/dev/grf3", O_RDWR);
    if (grffd < 0)
        {
        perror("showreg");
        return(0);
        }

    /* vgaba is the VGA register base mapped to user space */
    vgaba = mmap(0, 65536, PROT_READ|PROT_WRITE, 0, grffd, 0);
    if ((int)vgaba <0)
        {
        perror("showreg mmap");
        return(0);
        }

    /* print contents of VGA registers */
   for (i=0;i<0x1d;i++)
     printf ("CRT%x: %x\n",i, (unsigned int)RCrt(vgaba,i)); /* CRT Regs */

   for (i=0;i<=0x1F;i++)
     printf ("SEQ%x: %x\n",i, (unsigned int)RSeq(vgaba,i)); /*Sequencer Regs*/


   /* Maybe you want other regs too */


    munmap(vgaba, 65536); /* unmap vgabase */


    close(grffd); /* close device */


    return(0);
}


Try this instead! Maybe it must be run as root, depends on the 
permissions of /dev/grf3.

This is also much saver as you are able to write to the vga registers _only_.

Have fun,

-- 
Michael Teske (teske%wotan.desy.de@localhost)




Home | Main Index | Thread Index | Old Index