changeset 6650:345958ed44e5

removed genfb and nvidia drivers
author alex
date Fri, 05 Jul 2002 15:38:56 +0000
parents 59450f72078f
children 8f49c75a2824
files vidix/drivers/Makefile vidix/drivers/genfb_vid.c vidix/drivers/nvidia.h vidix/drivers/nvidia_vid.c
diffstat 4 files changed, 0 insertions(+), 538 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/drivers/Makefile	Fri Jul 05 15:34:17 2002 +0000
+++ b/vidix/drivers/Makefile	Fri Jul 05 15:38:56 2002 +0000
@@ -29,18 +29,6 @@
 MACH64_LIBS=-L../../libdha -ldha
 MACH64_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W -DRAGE128
 
-NVIDIA_VID=nvidia_vid.so
-NVIDIA_SRCS=nvidia_vid.c
-NVIDIA_OBJS=nvidia_vid.o
-NVIDIA_LIBS=-L../../libdha -ldha -lm
-NVIDIA_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W
-
-GENFB_VID=genfb_vid.so
-GENFB_SRCS=genfb_vid.c
-GENFB_OBJS=genfb_vid.o
-GENFB_LIBS=-L../../libdha -ldha -lm
-GENFB_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W
-
 MGA_VID=mga_vid.so
 MGA_SRCS=mga_vid.c
 MGA_OBJS=mga_vid.o
--- a/vidix/drivers/genfb_vid.c	Fri Jul 05 15:34:17 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-#include <fcntl.h>
-
-#include "../vidix.h"
-#include "../fourcc.h"
-#include "../../libdha/libdha.h"
-#include "../../libdha/pci_ids.h"
-
-#define DEMO_DRIVER 1
-
-static int fd;
-
-static void *mmio_base = 0;
-static void *mem_base = 0;
-static int32_t overlay_offset = 0;
-static uint32_t ram_size = 0;
-
-static int probed = 0;
-
-/* VIDIX exports */
-
-static vidix_capability_t genfb_cap =
-{
-    "General Framebuffer",
-    "alex",
-    TYPE_OUTPUT,
-    { 0, 0, 0, 0 },
-    2048,
-    2048,
-    4,
-    4,
-    -1,
-    FLAG_UPSCALER|FLAG_DOWNSCALER,
-    -1,
-    -1,
-    { 0, 0, 0, 0 }
-};
-
-unsigned int vixGetVersion(void)
-{
-    return(VIDIX_VERSION);
-}
-
-int vixProbe(int verbose,int force)
-{
-    int err = 0;
-#ifdef DEMO_DRIVER
-    err = ENOSYS;
-#endif
-    
-    printf("[genfb] probe\n");
-
-    fd = open("/dev/fb0", O_RDWR);
-    if (fd < 0)
-    {
-	printf("Error occured durint open: %s\n", strerror(errno));
-	err = errno;
-    }
-    
-    probed = 1;
-
-    return(err);
-}
-
-int vixInit(void)
-{
-    printf("[genfb] init\n");
-    
-    if (!probed)
-    {
-	printf("Driver was not probed but is being initialized\n");
-	return(EINTR);
-    }
-
-    return(0);
-}
-
-void vixDestroy(void)
-{
-    printf("[genfb] destory\n");
-    return;
-}
-
-int vixGetCapability(vidix_capability_t *to)
-{
-    memcpy(to, &genfb_cap, sizeof(vidix_capability_t));
-    return(0);
-}
-
-int vixQueryFourcc(vidix_fourcc_t *to)
-{
-    printf("[genfb] query fourcc (%x)\n", to->fourcc);
-
-    to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
-		VID_DEPTH_4BPP | VID_DEPTH_8BPP |
-		VID_DEPTH_12BPP | VID_DEPTH_15BPP |
-		VID_DEPTH_16BPP | VID_DEPTH_24BPP |
-		VID_DEPTH_32BPP;
-
-    to->flags = 0;
-    return(0);
-}
-
-int vixConfigPlayback(vidix_playback_t *info)
-{
-    printf("[genfb] config playback\n");
-
-    info->num_frames = 2;
-    info->frame_size = info->src.w*info->src.h+(info->src.w*info->src.h)/2;
-    info->dest.pitch.y = 32;
-    info->dest.pitch.u = info->dest.pitch.v = 16;
-    info->offsets[0] = 0;
-    info->offsets[1] = info->frame_size;
-    info->offset.y = 0;
-    info->offset.v = ((info->src.w+31) & ~31) * info->src.h;
-    info->offset.u = info->offset.v+((info->src.w+31) & ~31) * info->src.h/4;    
-    info->dga_addr = malloc(info->num_frames*info->frame_size);   
-    printf("[genfb] frame_size: %d, dga_addr: %x\n",
-	info->frame_size, info->dga_addr);
-
-    return(0);
-}
-
-int vixPlaybackOn(void)
-{
-    printf("[genfb] playback on\n");
-    return(0);
-}
-
-int vixPlaybackOff(void)
-{
-    printf("[genfb] playback off\n");
-    return(0);
-}
-
-int vixPlaybackFrameSelect(unsigned int frame)
-{
-    printf("[genfb] frameselect: %d\n", frame);
-    return(0);
-}
--- a/vidix/drivers/nvidia.h	Fri Jul 05 15:34:17 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#include <inttypes.h>
-
-#define RIVA_FIFO_FREE(hwptr, cnt) \
-{ \
-    while (nv_fifo_space < (cnt)) { \
-	nv_fifo_space = hwptr->fifo_free >> 2; \
-    } \
-    nv_fifo_space -= (cnt); \
-}
-
-typedef struct {
-    uint32_t	reserved00[4];
-    uint16_t	fifo_free;
-    uint16_t	nop[1];
-    uint32_t	reserved01[0x03b];
-    
-    uint32_t	no_operation;
-    uint32_t	notify;
-    uint32_t	reserved02[0x01e];
-    uint32_t	set_context_dma_notifies;
-    uint32_t	set_context_dma_image;
-    uint32_t	set_context_pattern;
-    uint32_t	set_context_rop;
-    uint32_t	set_context_beta1;
-    uint32_t	set_context_surface;
-    uint32_t	reserved03[0x05a];
-    uint32_t	set_color_format;
-    uint32_t	set_operation;
-    int16_t	clip_x;
-    int16_t	clip_y;
-    uint16_t	clip_height;
-    uint16_t	clip_width;
-    int16_t	image_out_x;
-    int16_t	image_out_y;
-    uint16_t	image_out_height;
-    uint16_t	image_out_width;
-    uint32_t	du_dx;
-    uint32_t	du_dy;
-    uint32_t	reserved04[0x38];
-    uint16_t	image_in_height;
-    uint16_t	image_in_width;
-    uint32_t	image_in_format;
-    uint32_t	image_in_offset;
-    uint32_t	image_in_point;
-    uint32_t	reserved05[0x6fc];
-} RivaScaledImage;
-
-#define dump_scaledimage(x) { \
-    printf("clip: pos: %dx%d, size: %dx%d\n", \
-	x->clip_x, x->clip_y, x->clip_height, x->clip_width); \
-    printf("image_out: pos: %dx%d, size: %dx%d\n", \
-	x->image_out_x, x->image_out_y, x->image_out_height, x->image_out_width); \
-    printf("image_in: size: %dx%d format: %x offset: %x\n", \
-	x->image_in_height, x->image_in_width, x->image_in_format, x->image_in_offset); \
-}
--- a/vidix/drivers/nvidia_vid.c	Fri Jul 05 15:34:17 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,326 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-
-#include "../vidix.h"
-#include "../fourcc.h"
-#include "../../libdha/libdha.h"
-#include "../../libdha/pci_ids.h"
-#include "../../libdha/pci_names.h"
-
-#include "nvidia.h"
-
-static void *ctrl_base = 0;
-static void *fb_base = 0;
-static int32_t overlay_offset = 0;
-static uint32_t ram_size = 0;
-
-static unsigned int *PFB;
-static unsigned int *PCIO;
-static unsigned int *PGRAPH;
-static unsigned int *PRAMIN;
-static unsigned int *FIFO;
-static unsigned int *PMC;
-
-typedef unsigned char U008;
-
-#define NV_WR08(p,i,d)	(((U008 *)(p))[i]=(d))
-
-unsigned int nv_fifo_space = 0;
-
-void CRTCout(unsigned char index, unsigned char val)
-{
-    NV_WR08(PCIO, 0x3d4, index);
-    NV_WR08(PCIO, 0x3d5, val);
-}
-
-volatile RivaScaledImage *ScaledImage;
-
-#define CARD_FLAGS_NONE		0x00
-#define CARD_FLAGS_NOTSUPPORTED	0x01
-
-struct nv_card_id_s
-{
-    const unsigned int id ;
-    const char name[32];
-    const int core;
-    const int flags;
-};
-
-static const struct nv_card_id_s nv_card_id;
-
-static const struct nv_card_id_s nv_card_ids[]=
-{
-    { DEVICE_NVIDIA_RIVA_TNT2_NV5, "nVidia TNT2 (NV5) ", 5, CARD_FLAGS_NOTSUPPORTED},
-    { DEVICE_NVIDIA_VANTA_NV6, "nVidia Vanta (NV6.1)", 6, CARD_FLAGS_NOTSUPPORTED},
-    { DEVICE_NVIDIA_VANTA_NV62, "nVidia Vanta (NV6.2)", 6, CARD_FLAGS_NOTSUPPORTED}
-};
-
-static int find_chip(unsigned int chip_id)
-{
-    unsigned int i;
-    
-    for (i = 0; i < sizeof(nv_card_ids)/sizeof(struct nv_card_id_s); i++)
-	if (chip_id == nv_card_ids[i].id)
-	    return(i);
-    return(-1);
-}
-
-static pciinfo_t pci_info;
-static int probed = 0;
-
-/* VIDIX exports */
-
-static vidix_capability_t nvidia_cap =
-{
-    "NVIDIA driver for VIDIX",
-    "alex",
-    TYPE_OUTPUT,
-    { 0, 0, 0, 0 },
-    2046,
-    2047,
-    4,
-    4,
-    -1,
-    FLAG_NONE,
-    VENDOR_NVIDIA,
-    0,
-    { 0, 0, 0, 0 }
-};
-
-unsigned int vixGetVersion(void)
-{
-    return(VIDIX_VERSION);
-}
-
-int vixProbe(int verbose,int force)
-{
-    pciinfo_t lst[MAX_PCI_DEVICES];
-    unsigned int i, num_pci;
-    int err;
-    
-    printf("[nvidia] probe\n");
-
-    err = pci_scan(lst, &num_pci);
-    if (err)
-    {
-	printf("Error occured during pci scan: %s\n", strerror(err));
-	return err;
-    }
-    else
-    {
-	err = ENXIO;
-	
-	for (i = 0; i < num_pci; i++)
-	{
-	    if (lst[i].vendor == VENDOR_NVIDIA)
-	    {
-		int idx;
-		
-		idx = find_chip(lst[i].device);
-		if (idx == -1)
-		    continue;
-		if (nv_card_ids[idx].flags & CARD_FLAGS_NOTSUPPORTED)
-		{
-		    printf("Found chip: %s, but not supported!\n",
-			nv_card_ids[idx].name);
-		    continue;
-		}
-		else
-		
-		    printf("Found chip: %s\n", nv_card_ids[idx].name);
-		
-		memcpy(&nv_card_id, &nv_card_ids[idx], sizeof(struct nv_card_id_s));
-		nvidia_cap.device_id = nv_card_ids[idx].id;
-		err = 0;
-		memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
-		probed = 1;
-
-		printf("bus:card:func = %x:%x:%x\n",
-		    pci_info.bus, pci_info.card, pci_info.func);
-		printf("vendor:device = %x:%x\n",
-		    pci_info.vendor, pci_info.device);
-		printf("base0:base1:base2:baserom = %x:%x:%x:%x\n",
-		    pci_info.base0, pci_info.base1, pci_info.base2,
-		    pci_info.baserom);
-		break;
-	    }
-	}
-    }
-
-    if (err)
-	printf("No chip found\n");
-    return(err);
-}
-
-int vixInit(void)
-{
-    int card_option;
-    
-    printf("[nvidia] init\n");
-    
-    pci_config_read(pci_info.bus, pci_info.card, pci_info.func, 0x40,
-	4, &card_option);
-    printf("card_option: %x\n", card_option);
-    
-    if (!probed)
-    {
-	printf("Driver was not probed but is being initialized\n");
-	return(EINTR);
-    }
-    
-    ctrl_base = map_phys_mem(pci_info.base0, 0x00800000);
-    if (ctrl_base == (void *)-1)
-	return(ENOMEM);
-    fb_base = map_phys_mem(pci_info.base1, 0x01000000);
-    if (fb_base == (void *)-1)
-	return(ENOMEM);
-
-    printf("ctrl_base: %p, fb_base: %p\n", ctrl_base, fb_base);
-
-    PFB = 	ctrl_base+0x00100000;
-    PGRAPH =	ctrl_base+0x00400000;
-    PRAMIN =	ctrl_base+0x00710000;
-    FIFO =	ctrl_base+0x00800000;
-    PCIO =	ctrl_base+0x00601000;
-    PMC = 	ctrl_base+0x00000000;
-    printf("pfb: %p, pgraph: %p, pramin: %p, fifo: %p, pcio: %p\n",
-	PFB, PGRAPH, PRAMIN, FIFO, PCIO);
-    
-    ScaledImage = FIFO+0x8000/4;
-    printf("ScaledImage: %p\n", ScaledImage);
-
-    /* unlock */
-    CRTCout(0x11, 0xff);
-
-    printf("fifo_free: %d\n", ScaledImage->fifo_free);
-
-    RIVA_FIFO_FREE(ScaledImage, 10);
-    
-    dump_scaledimage(ScaledImage);
-    
-    /* create scaled image object */
-    *(PRAMIN+0x518) = 0x0100A037;
-    *(PRAMIN+0x519) = 0x00000C02;
-    
-    /* put scaled image object into subchannel */
-    *(FIFO+0x2000) = 0x80000011;
-
-    /* ram size detection */
-    switch(nv_card_id.core)
-    {
-	case 5:
-	{
-	    if (*(PFB+0x0) & 0x00000100)
-	    {
-		printf("first ver\n");
-		ram_size = ((*(PFB+0x0) >> 12) & 0x0f) * 1024 * 2 + 1024 * 2;
-	    }
-	    else
-	    {
-		printf("second ver (code: %d)\n",
-		    *(PFB+0x0) & 0x00000003);
-		switch(*(PFB+0x0) & 0x00000003)
-		{
-		    case 0:
-			ram_size = 1024*32;
-			break;
-		    case 1:
-			ram_size = 1024*4;
-			break;
-		    case 2:
-			ram_size = 1024*8;
-			break;
-		    case 3:
-			ram_size = 1024*16;
-			break;
-		    default:
-			printf("Unknown ram size code: %d\n",
-			    *(PFB+0x0) & 0x00000003);
-			break;
-		}
-	    }
-	    break;
-	}
-	default:
-	    printf("Unknown core: %d\n", nv_card_id.core);
-    }
-
-    printf("ram_size: %d\n", ram_size);
-    return 0;
-}
-
-void vixDestroy(void)
-{
-    printf("[nvidia] destory\n");
-}
-
-int vixGetCapability(vidix_capability_t *to)
-{
-    memcpy(to, &nvidia_cap, sizeof(vidix_capability_t));
-    return(0);
-}
-
-int vixQueryFourcc(vidix_fourcc_t *to)
-{
-    printf("[nvidia] query fourcc (%x)\n", to->fourcc);
-    to->flags = 0;
-    to->depth = VID_DEPTH_32BPP;
-    return 0;
-}
-
-int vixConfigPlayback(vidix_playback_t *info)
-{
-    int fb_pixel_size = 32/8;
-    int fb_line_len = 1280*4;
-    char buffer = 0;
-    int offset = 0;
-    int x,y,h,w;
-    int bpp = 32 >> 3;
-    int size;
-
-    printf("[nvidia] config playback\n");
-    
-    x = info->src.x;
-    y = info->src.y;
-    h = info->src.h;
-    w = info->src.w;
-    
-    w = (w + 1) & ~1;
-    
-    size = h * (((w << 1) + 63) & ~63) / bpp;
-    
-    
-    PMC[(0x8900/4)+buffer] = offset;
-    PMC[(0x8928/4)+buffer] = (h << 16) | w;
-    PMC[(0x8930/4)+buffer] = ((y << 4) & 0xffff0000) | (x >> 12);
-    PMC[(0x8938/4)+buffer] = (w << 20) / info->dest.w;
-    PMC[(0x8938/4)+buffer] = (h << 20) / info->dest.h;
-    
-    info->dga_addr = fb_base + (info->dest.w - info->src.w) * fb_pixel_size /
-		    2 + (info->dest.h - info->src.h) * fb_line_len / 2;
-    
-    info->num_frames = 1;
-    info->frame_size = info->src.w*info->src.h+(info->src.w*info->src.h)/2;
-    info->offsets[0] = 0;
-    info->offset.y = 0;
-    info->offset.v = ((info->src.w + 31) & ~31) * info->src.h;
-    info->offset.u = info->offset.v+((info->src.w + 31) & ~31) * info->src.h / 4;
-//    info->dga_addr = malloc(info->num_frames*info->frame_size);
-    return 0;
-}
-
-int vixPlaybackOn(void)
-{
-    printf("[nvidia] playback on\n");
-    return 0;
-}
-
-int vixPlaybackOff(void)
-{
-    printf("[nvidia] playback off\n");
-    return 0;
-}