>> Similar issues happen with things like mirroring & multihead. Some chips
>> can do mirroring only (I have code for mach64 to do that), so in this
>> case, a single ioctl is enough to enable/disable it.
>
>You have code for mirroring on mach64? Do share :-)

Works with LT-G (wallstreet), not tested on anything else especially not on
rage Pro (which is usally real dual head, unless the LT-G),
Written by Dan Malek.


/* Experiment with PowerBook video output mode.
 * Dan Malek ([EMAIL PROTECTED])
 */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>

#define eieio() asm volatile ("eieio" : : : "memory")

main(int argc, char **argv)
{
        int     mem_fd, i;
        uint    immap_mem, *mem_word, orig;

        if ((mem_fd = open("/dev/mem", O_RDWR)) < 0) {
                perror("mem open");
                exit(2);
        }

        /* Map control registers of 3D LT on PowerBook Wallstreet.
        */
        immap_mem = (uint)mmap(NULL, 128 * 1024, (PROT_READ | PROT_WRITE),
                        MAP_SHARED, mem_fd, 0x827ff000);

        close(mem_fd);

        if ((int)immap_mem < 0) {
                perror("mmap");
                exit(1);
        }

        /* Pointer to LCD_GEN_CNTL.
        */
        mem_word = (uint *)(immap_mem + 0xcd4);

        orig = *mem_word;
        printf("%08x\n", orig);

        /* Enable LCD (was by default) and CRT.
        */
        *mem_word = (orig | 0x01000000);
        sleep(10);
        
        /* Enable CRT, disable LCD.
        */
        *mem_word = ((orig & ~0x02000000) | 0x01000000);
        sleep(10);

        /* Enable LCD only.
        */
        *mem_word = orig;

        exit(0);
}

Reply via email to