Article View: comp.lsi
Article #751Re: Magic on a Sun 110?
From: david
Date: Fri, 06 Feb 1987 19:55
Date: Fri, 06 Feb 1987 19:55
87 lines
3309 bytes
3309 bytes
In article <8702052032.AA08704@mimsy.umd.edu> smb@MIMSY.UMD.EDU (Steve
M. Burinsky) writes:
>I tried to run Magic on a 110, but it always came up in black and white mode.
>I was working on a demo system running Sun 3.2. I traced the problem to
>the way Magic determines what type of display it is running on. On Suns,
>Magic does a FBIOGTYPE ioctl on /dev/fb which returns the frame buffer
>type (amoung other things). The 110 *should* return FBTYPE_SUN4COLOR,
>but instead returns FBTYPE_SUN2BW. Apparently, the system doesn't know
>about the on-board frame buffer (/dev/cgfour0). I checked the EEPROM settings
>for the frame buffer default, but to no avail.
Wrong, ioctl breath! In order to allow pre-3.2 programs to run on the 110
(albeit in monochrome mode), the cg4 frame buffer emulates a bw2.
The easiest way for a pixrect program to determine if it's running on a
color frame buffer is to do a pr_open() and look at the depth of the
returned pixrect. (If you want to get fancy you can use
pr_available_plane_groups()).
If you can't modify Magic, here's a program which will lock the frame
buffer in its native (FBTYPE_SUN4COLOR) mode:
/*
* cg4lock -- locks cg4 in native mode
*/
#include <stdio.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sun/fbio.h>
#define error(args) { printf args ; exit(1); }
main(argc, argv)
int argc;
char *argv[];
{
char *dev;
int fd;
struct fbgattr attr;
dev = argc > 1 ? argv[1] : "/dev/fb";
/* open frame buffer */
if ((fd = open(dev, O_RDWR)) < 0)
error(("%s: open failed for %s\n", argv[0], dev));
/*
* get attributes, make sure it's a cg4 and not
* owned by another process
*/
if (ioctl(fd, FBIOGATTR, &attr) == -1)
error(("%s: get attributes failed for %s\n",
argv[0], dev));
if (attr.real_type != FBTYPE_SUN4COLOR)
error(("%s: device %s is not a cg4\n", argv[0], dev));
if (attr.owner != 0)
error(("%s: device %s is owned by process %d\n",
argv[0], dev, attr.owner));
/* set emulation type to cg4 */
attr.sattr.flags = 0;
attr.sattr.emu_type = FBTYPE_SUN4COLOR;
if (ioctl(fd, FBIOSATTR, &attr.sattr) < 0)
error(("%s: set attributes failed for %s\n",
argv[0], dev));
while (1)
sleep(30000);
}
Run it in the background, then start your pixrect program.
For more information on the cg4, emulation mode, etc. refer to the
SunOS 3.2 release manual.
Disclaimer: No one else at Sun understands this, so how could they be
responsible for it?
--
David DiGiacomo {decvax, ihnp4, ucbvax}!sun!david david@sun.arpa
Sun Microsystems, Mt. View, CA (415) 691-7495
David DiGiacomo {decvax, ihnp4, ucbvax}!sun!david david@sun.arpa
Sun Microsystems, Mt. View, CA (415) 691-7495
Technical Details
Message-ID:
<12845@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-spam!ames!oliveb!sun!david!davidReferences:
<8702052032.AA08704@mimsy.umd.edu>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-spam!ames!oliveb!sun!david!david From: david@david.UUCP Newsgroups: comp.lsi Subject: Re: Magic on a Sun 110? Message-ID: <12845@sun.uucp> Date: Fri, 6-Feb-87 14:55:06 EST Article-I.D.: sun.12845 Posted: Fri Feb 6 14:55:06 1987 Date-Received: Sun, 8-Feb-87 04:09:44 EST References: <8702052032.AA08704@mimsy.umd.edu> Sender: news@sun.uucp Organization: Sun Microsystems, Mountain View Lines: 87