NetBSD-Bugs archive

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

Re: xsrc/49495



The following reply was made to PR kern/49495; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: Patrick Welche <prlw1%cam.ac.uk@localhost>
Subject: Re: xsrc/49495
Date: Thu, 14 May 2015 00:23:19 +0000

 This is a multi-part message in MIME format.
 --=_j4H1Dtu0UMIkgkrRSI18P508xTD6/eku
 
 [resent to gnats-bugs, hoping that's the right address for PR followup]
 
 Can you please try running the attached program and seeing whether
 anything shows up on your display?
 
 make writefb
 ./writefb /dev/ttyE0 0xff350053
 
 (Run as root; this will permanently set ttyE0 into dumbfb mode, unless
 you write another program that puts it back into text mode.)
 
 This will determine whether the problem is just with the kernel
 driver, or whether X is actually involved too.
 
 --=_j4H1Dtu0UMIkgkrRSI18P508xTD6/eku
 Content-Type: text/plain; charset="ISO-8859-1"; name="writefb"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="writefb.c"
 
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/time.h>
 
 #include <dev/wscons/wsconsio.h>
 
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
 
 #define	howmany(n, d)	(((n) + ((d) - 1)) / (d))
 #define	roundup(n, d)	(howmany(n, d) * (d))
 
 static void
 signal_ignore(int signo __unused)
 {
 }
 
 int
 main(int argc, char **argv)
 {
 	const char *device;
 	char *ep;
 	unsigned long value;
 	int fd;
 	struct wsdisplay_fbinfo fbi;
 	unsigned int mode;
 	size_t fbsize;
 	uint32_t *fb;
 	size_t i;
 
 	setprogname(argv[0]);
 	if (signal(SIGPIPE, &signal_ignore) =3D=3D SIG_ERR)
 		err(1, "signal(SIGPIPE)");
 
 	if (argc !=3D 3)
 		errx(1, "Usage: %s <device> <value>\n", getprogname());
 
 	device =3D argv[1];
 	errno =3D 0;
 	value =3D strtoul(argv[2], &ep, 0);
 	if ((argv[2][0] =3D=3D '\0') || (*ep !=3D '\0'))
 		errx(1, "bad value");
 	if ((errno =3D=3D ERANGE) && (value =3D=3D ULONG_MAX))
 		errx(1, "value too large");
 
 	fd =3D open(argv[1], O_RDWR);
 	if (fd =3D=3D -1)
 		err(1, "open fb");
 
 	if (ioctl(fd, WSDISPLAYIO_GINFO, &fbi) =3D=3D -1)
 		err(1, "ioctl(WSDISPLAYIO_GINFO)");
 	warnx("width    %u", fbi.width);
 	warnx("height   %u", fbi.height);
 	warnx("depth    %u", fbi.depth);
 	warnx("cmsize   %u", fbi.cmsize);
 
 	if (fbi.depth !=3D 32)
 		errx(1, "bad depth");
 
 	if (ioctl(fd, WSDISPLAYIO_GMODE, &mode) =3D=3D -1)
 		err(1, "ioctl(WSDISPLAYIO_GMODE)");
 	warnx("mode	%u", mode);
 
 	mode =3D WSDISPLAYIO_MODE_DUMBFB;
 	if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) =3D=3D -1)
 		err(1, "ioctl(WSDISPLAYIO_SMODE)");
 
 	fbsize =3D roundup((fbi.width * fbi.height * howmany(fbi.depth, 8)),
 	    getpagesize());
 	fb =3D mmap(NULL, fbsize, (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0);
 	if (fb =3D=3D MAP_FAILED)
 		err(1, "mmap fb");
 
 	for (i =3D 0; i < (fbsize / 4); i++)
 		fb[i] =3D value;
 
 	if (munmap(fb, fbsize) =3D=3D -1)
 		err(1, "munmap fb");
 
 	if (close(fd) =3D=3D -1)
 		err(1, "close fb");
 
 	return 0;
 }
 
 --=_j4H1Dtu0UMIkgkrRSI18P508xTD6/eku--
 


Home | Main Index | Thread Index | Old Index