Subject: Re: X under netbsd/dreamcast
To: Christian Groessler <cpg@aladdin.de>
From: Marcus Comstedt <marcus@mc.pp.se>
List: port-dreamcast
Date: 02/04/2003 00:32:05
Christian Groessler <cpg@aladdin.de> writes:

> Do you have some simple example on how to mmap the framebuffer?

IIRC, it was something along the lines of

  int fd;
  unsinged short *ptr;
  int gfx_mode = WSDISPLAYIO_MODE_MAPPED;
  int text_mode = WSDISPLAYIO_MODE_EMUL;

  /* Open the device */
  fd = open("/dev/ttyE0", O_RDWR);

  /* Switch to graphics mode */
  ioctl(fd, WSDISPLAYIO_SMODE, &gfx_mode);

  /* Map the framebuffer */
  ptr = mmap(NULL, 640*480*2, PROT_READ|PROT_WRITE, MAP_SHARED,
             fd, 0);

  /* Draw on screen using ptr...*/

  /* Go back to text mode (don't forget this!) */
  ioctl(fd, WSDISPLAYIO_SMODE, &text_mode);


With appropriate error checks added of course.  And it's important to
do the last ioctl() before exiting, otherwise you'll lose the system
console (unless you're using a serial port console).


> Could you provide the diffs to get GGI running? :-)

If I can find them...  This was like 1.5 years ago...


  // Marcus