diff options
Diffstat (limited to 'hw/xfree86/os-support/bsd/alpha_video.c')
-rw-r--r-- | hw/xfree86/os-support/bsd/alpha_video.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index d3aa25961..aa3313dc3 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.2.2.1 2003/05/09 02:30:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.5 2003/04/03 16:50:04 dawes Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -215,7 +215,7 @@ checkDevMem(Bool warn) /* Try the aperture driver first */ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, + base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); if (base != MAP_FAILED) { @@ -235,7 +235,7 @@ checkDevMem(Bool warn) #endif if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ|PROT_WRITE, + base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); if (base != MAP_FAILED) { @@ -308,8 +308,10 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM, strerror(errno)); } - base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); + base = mmap((caddr_t)0, Size, + (flags & VIDMEM_READONLY) ? + PROT_READ : (PROT_READ | PROT_WRITE), + MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); if (base == MAP_FAILED) { FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n", @@ -325,9 +327,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) FatalError("%s: Address 0x%x outside allowable range\n", "xf86MapVidMem", Base); } - base = mmap(0, Size, PROT_READ|PROT_WRITE, MAP_FLAGS, - xf86Info.screenFd, - (unsigned long)Base + BUS_BASE); + base = mmap(0, Size, + (flags & VIDMEM_READONLY) ? + PROT_READ : (PROT_READ | PROT_WRITE), + MAP_FLAGS, xf86Info.screenFd, + (unsigned long)Base + BUS_BASE); if (base == MAP_FAILED) { FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", |