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

m6mirror kind of (m7mirror)



I got the following mail from Jessy Blanchette. It turns out that he has
a M6 based video chip (instead of a M7).

I have no idea if this can be useful to M6 or M7 users. I have not yet
tried it.

Christophe

-----Message suivi-----

From: Jessy Blanchette <Jessy.Blanchette@VirtualMethod.com>
To: christophe@ufies.org
Subject: m3mirror on radeon
Date: 05 Feb 2003 18:48:16 -0600

Hello,

I just read your page and just found out about Ben's tool for the mirroring 
(m3mirror).  Looking at the source I modified the ioctl's to work on the 
newer set.

I own a 550 with an M7 LY Radeon, and the modified version works with mine. 
(At least with my kernel (from Ben) 2.4.20)
-- 
Christophe Barbé <christophe@cattlegrid.net>
#include <stdio.h>
#include <errno.h>

#include <linux/ioctl.h>
#include <linux/radeonfb.h>


#define __u32 unsigned int

#define LCD_ON 0x01
#define CRT_ON 0x02

static void
usage(void)
{
	printf("syntax: m3mirror [crt:0|1] [lcd:0|1]\n");
}

main(int ac, char **av)
{
	int fd, rc, i;
	unsigned long value, orig;

	printf("ATI Rage M7 mirror tool, v0.1\n");
	fd = open("/dev/fb0", 0);
	if (fd < 0) {
		perror("open /dev/fb0");
		exit(1);
	}
	rc = ioctl(fd, FBIO_RADEON_GET_MIRROR, &value);
	if (rc != 0) {
		printf("error %d getting mirror value\n");
		goto bail;
	}
	printf("Mirror is currently: lcd: %s, crt: %s\n",
		(value & LCD_ON) ? "on" : "off",
		(value & CRT_ON) ? "on" : "off");
	orig = value;
	for(i=1; i<ac; i++) {
		if (!strncmp(av[i], "lcd:", 4)) {
			if (atoi((av[i])+4))
				value |= LCD_ON;
			else
				value &= ~LCD_ON;
		} else if (!strncmp(av[i], "crt:", 4)) {
			if (atoi((av[i])+4))
				value |= CRT_ON;
			else
				value &= ~CRT_ON;
		} else {
			usage();
			rc = -EINVAL;
			goto bail;
		}
	}
	if (orig != value) {
		rc = ioctl(fd, FBIO_RADEON_SET_MIRROR, &value);
		if (rc != 0) {
			printf("error %d setting mirror value\n");
			exit(rc);
		}
		printf("Mirror is now: lcd: %s, crt: %s\n",
			(value & LCD_ON) ? "on" : "off",
			(value & CRT_ON) ? "on" : "off");
	}
bail:
	close(fd);	
	exit(rc);
}

Reply to: