comparison vidix/drivers/radeon_vid.c @ 12286:b52e831261b1

support for ATI fireglx
author alex
date Mon, 26 Apr 2004 08:59:22 +0000
parents be548f4433b3
children a84160d660af
comparison
equal deleted inserted replaced
12285:67b8d64af8c7 12286:b52e831261b1
1 /* 1 /*
2 radeon_vid - VIDIX based video driver for Radeon and Rage128 chips 2 radeon_vid - VIDIX based video driver for Radeon and Rage128 chips
3 Copyrights 2002 Nick Kurshev. This file is based on sources from 3 Copyrights 2002 Nick Kurshev. This file is based on sources from
4 GATOS (gatos.sf.net) and X11 (www.xfree86.org) 4 GATOS (gatos.sf.net) and X11 (www.xfree86.org)
5 Licence: GPL 5 Licence: GPL
6
7 31.12.2002 added support for fglrx drivers by Marcel Naziri (zwobbl@zwobbl.de)
8 6.04.2004 fixes to allow compiling vidix without X11 (broken in original patch)
6 PPC support by Alex Beregszaszi 9 PPC support by Alex Beregszaszi
7 */ 10 */
8 11
9 #include <errno.h> 12 #include <errno.h>
10 #include <stdio.h> 13 #include <stdio.h>
19 #include "../../libdha/pci_names.h" 22 #include "../../libdha/pci_names.h"
20 #include "../vidix.h" 23 #include "../vidix.h"
21 #include "../fourcc.h" 24 #include "../fourcc.h"
22 #include "../../libdha/libdha.h" 25 #include "../../libdha/libdha.h"
23 #include "radeon.h" 26 #include "radeon.h"
27
28 #ifdef HAVE_X11
29 #include <X11/Xlib.h>
30 #endif
24 31
25 #ifdef RAGE128 32 #ifdef RAGE128
26 #define RADEON_MSG "[rage128]" 33 #define RADEON_MSG "[rage128]"
27 #define X_ADJUST 0 34 #define X_ADJUST 0
28 #else 35 #else
196 DECLARE_VREG(IDCT_AUTH), 203 DECLARE_VREG(IDCT_AUTH),
197 DECLARE_VREG(IDCT_CONTROL), 204 DECLARE_VREG(IDCT_CONTROL),
198 DECLARE_VREG(CONFIG_CNTL) 205 DECLARE_VREG(CONFIG_CNTL)
199 }; 206 };
200 207
208 #ifdef HAVE_X11
209 static uint32_t firegl_shift = 0;
210 #endif
201 static void * radeon_mmio_base = 0; 211 static void * radeon_mmio_base = 0;
202 static void * radeon_mem_base = 0; 212 static void * radeon_mem_base = 0;
203 static int32_t radeon_overlay_off = 0; 213 static int32_t radeon_overlay_off = 0;
204 static uint32_t radeon_ram_size = 0; 214 static uint32_t radeon_ram_size = 0;
205 /* Restore on exit */ 215 /* Restore on exit */
908 VENDOR_ATI, 918 VENDOR_ATI,
909 0, 919 0,
910 { 0, 0, 0, 0} 920 { 0, 0, 0, 0}
911 }; 921 };
912 922
923 #ifdef HAVE_X11
924 void probe_fireGL_driver() {
925 Display *dp = XOpenDisplay ((void*)0);
926 int n = 0;
927 char **extlist = XListExtensions (dp, &n);
928 XCloseDisplay (dp);
929 if (extlist) {
930 int i;
931 int ext_fgl = 0, ext_fglrx = 0;
932 for (i = 0; i < n; i++) {
933 if (!strcmp(extlist[i], "ATIFGLEXTENSION")) ext_fgl = 1;
934 if (!strcmp(extlist[i], "ATIFGLRXDRI")) ext_fglrx = 1;
935 }
936 if (ext_fgl) {
937 printf(RADEON_MSG" ATI FireGl driver detected");
938 firegl_shift = 0x500000;
939 if (!ext_fglrx) {
940 printf(", but DRI seems not to be activated\n");
941 printf(RADEON_MSG" Output may not work correctly, check your DRI configuration!");
942 }
943 printf("\n");
944 }
945 }
946 }
947 #endif
913 948
914 int vixProbe( int verbose,int force ) 949 int vixProbe( int verbose,int force )
915 { 950 {
916 pciinfo_t lst[MAX_PCI_DEVICES]; 951 pciinfo_t lst[MAX_PCI_DEVICES];
917 unsigned i,num_pci; 952 unsigned i,num_pci;
942 printf("[radeon] Device is disabled, ignoring\n"); 977 printf("[radeon] Device is disabled, ignoring\n");
943 continue; 978 continue;
944 } 979 }
945 #ifndef RAGE128 980 #ifndef RAGE128
946 if(idx != -1) 981 if(idx != -1)
982 #ifdef HAVE_X11
983 probe_fireGL_driver();
984 #endif
947 { 985 {
948 switch(ati_card_ids[idx]) { 986 switch(ati_card_ids[idx]) {
949 /* Original radeon */ 987 /* Original radeon */
950 case DEVICE_ATI_RADEON_R100_QD: 988 case DEVICE_ATI_RADEON_R100_QD:
951 case DEVICE_ATI_RADEON_R100_QE: 989 case DEVICE_ATI_RADEON_R100_QE:
1667 rgb_size = radeon_get_xres()*radeon_get_yres()*((radeon_vid_get_dbpp()+7)/8); 1705 rgb_size = radeon_get_xres()*radeon_get_yres()*((radeon_vid_get_dbpp()+7)/8);
1668 nfr = info->num_frames; 1706 nfr = info->num_frames;
1669 for(;nfr>0; nfr--) 1707 for(;nfr>0; nfr--)
1670 { 1708 {
1671 radeon_overlay_off = radeon_ram_size - info->frame_size*nfr; 1709 radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
1710 #ifdef HAVE_X11
1711 radeon_overlay_off -= firegl_shift;
1712 #endif
1672 radeon_overlay_off &= 0xffff0000; 1713 radeon_overlay_off &= 0xffff0000;
1673 if(radeon_overlay_off >= (int)rgb_size ) break; 1714 if(radeon_overlay_off >= (int)rgb_size ) break;
1674 } 1715 }
1675 if(nfr <= 3) 1716 if(nfr <= 3)
1676 { 1717 {
1677 nfr = info->num_frames; 1718 nfr = info->num_frames;
1678 for(;nfr>0; nfr--) 1719 for(;nfr>0; nfr--)
1679 { 1720 {
1680 radeon_overlay_off = radeon_ram_size - info->frame_size*nfr; 1721 radeon_overlay_off = radeon_ram_size - info->frame_size*nfr;
1722 #ifdef HAVE_X11
1723 radeon_overlay_off -= firegl_shift;
1724 #endif
1681 radeon_overlay_off &= 0xffff0000; 1725 radeon_overlay_off &= 0xffff0000;
1682 if(radeon_overlay_off > 0) break; 1726 if(radeon_overlay_off > 0) break;
1683 } 1727 }
1684 } 1728 }
1685 if(nfr <= 0) return EINVAL; 1729 if(nfr <= 0) return EINVAL;