Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. typedef void *pointer;
  3.  
  4. typedef unsigned int memType;
  5.  
  6. typedef struct { float hi, lo; } range;
  7.  
  8.  
  9. typedef enum
  10. {
  11.     CHIP_FAMILY_UNKNOW,
  12.     CHIP_FAMILY_LEGACY,
  13.     CHIP_FAMILY_RADEON,
  14.     CHIP_FAMILY_RV100,
  15.     CHIP_FAMILY_RS100,    /* U1 (IGP320M) or A3 (IGP320)*/
  16.     CHIP_FAMILY_RV200,
  17.     CHIP_FAMILY_RS200,    /* U2 (IGP330M/340M/350M) or A4 (IGP330/340/345/350), RS250 (IGP 7000) */
  18.     CHIP_FAMILY_R200,
  19.     CHIP_FAMILY_RV250,
  20.     CHIP_FAMILY_RS300,    /* RS300/RS350 */
  21.     CHIP_FAMILY_RV280,
  22.     CHIP_FAMILY_R300,
  23.     CHIP_FAMILY_R350,
  24.     CHIP_FAMILY_RV350,
  25.     CHIP_FAMILY_RV380,    /* RV370/RV380/M22/M24 */
  26.     CHIP_FAMILY_R420,     /* R420/R423/M18 */
  27.     CHIP_FAMILY_RV410,    /* RV410, M26 */
  28.     CHIP_FAMILY_RS400,    /* xpress 200, 200m (RS400) Intel */
  29.     CHIP_FAMILY_RS480,    /* xpress 200, 200m (RS410/480/482/485) AMD */
  30.     CHIP_FAMILY_RV515,    /* rv515 */
  31.     CHIP_FAMILY_R520,     /* r520 */
  32.     CHIP_FAMILY_RV530,    /* rv530 */
  33.     CHIP_FAMILY_R580,     /* r580 */
  34.     CHIP_FAMILY_RV560,    /* rv560 */
  35.     CHIP_FAMILY_RV570,    /* rv570 */
  36.     CHIP_FAMILY_RS600,
  37.     CHIP_FAMILY_RS690,
  38.     CHIP_FAMILY_RS740,
  39.     CHIP_FAMILY_R600,     /* r600 */
  40.     CHIP_FAMILY_R630,
  41.     CHIP_FAMILY_RV610,
  42.     CHIP_FAMILY_RV630,
  43.     CHIP_FAMILY_RV670,
  44.     CHIP_FAMILY_RV620,
  45.     CHIP_FAMILY_RV635,
  46.     CHIP_FAMILY_RS780,
  47.     CHIP_FAMILY_RV770,
  48.     CHIP_FAMILY_LAST
  49. } RADEONChipFamily;
  50.  
  51. #define IS_RV100_VARIANT ((rhdPtr->ChipFamily == CHIP_FAMILY_RV100)  ||  \
  52.         (rhdPtr->ChipFamily == CHIP_FAMILY_RV200)  ||  \
  53.         (rhdPtr->ChipFamily == CHIP_FAMILY_RS100)  ||  \
  54.         (rhdPtr->ChipFamily == CHIP_FAMILY_RS200)  ||  \
  55.         (rhdPtr->ChipFamily == CHIP_FAMILY_RV250)  ||  \
  56.         (rhdPtr->ChipFamily == CHIP_FAMILY_RV280)  ||  \
  57.         (rhdPtr->ChipFamily == CHIP_FAMILY_RS300))
  58.  
  59.  
  60. #define IS_R300_VARIANT ((info->ChipFamily == CHIP_FAMILY_R300)  ||  \
  61.         (info->ChipFamily == CHIP_FAMILY_RV350) ||  \
  62.         (info->ChipFamily == CHIP_FAMILY_R350)  ||  \
  63.         (info->ChipFamily == CHIP_FAMILY_RV380) ||  \
  64.         (info->ChipFamily == CHIP_FAMILY_R420)  ||  \
  65.         (info->ChipFamily == CHIP_FAMILY_RV410) ||  \
  66.         (info->ChipFamily == CHIP_FAMILY_RS400) ||  \
  67.         (info->ChipFamily == CHIP_FAMILY_RS480))
  68.  
  69. #define IS_AVIVO_VARIANT ((info->ChipFamily >= CHIP_FAMILY_RV515))
  70.  
  71. #define IS_DCE3_VARIANT ((info->ChipFamily >= CHIP_FAMILY_RV620))
  72.  
  73. #define IS_R500_3D ((info->ChipFamily == CHIP_FAMILY_RV515)  ||  \
  74.         (info->ChipFamily == CHIP_FAMILY_R520)   ||  \
  75.         (info->ChipFamily == CHIP_FAMILY_RV530)  ||  \
  76.         (info->ChipFamily == CHIP_FAMILY_R580)   ||  \
  77.         (info->ChipFamily == CHIP_FAMILY_RV560)  ||  \
  78.         (info->ChipFamily == CHIP_FAMILY_RV570))
  79.  
  80. #define IS_R300_3D ((info->ChipFamily == CHIP_FAMILY_R300)  ||  \
  81.         (info->ChipFamily == CHIP_FAMILY_RV350) ||  \
  82.         (info->ChipFamily == CHIP_FAMILY_R350)  ||  \
  83.         (info->ChipFamily == CHIP_FAMILY_RV380) ||  \
  84.         (info->ChipFamily == CHIP_FAMILY_R420)  ||  \
  85.         (info->ChipFamily == CHIP_FAMILY_RV410) ||  \
  86.         (info->ChipFamily == CHIP_FAMILY_RS690) ||  \
  87.         (info->ChipFamily == CHIP_FAMILY_RS600) ||  \
  88.         (info->ChipFamily == CHIP_FAMILY_RS740) ||  \
  89.         (info->ChipFamily == CHIP_FAMILY_RS400) ||  \
  90.     (info->ChipFamily == CHIP_FAMILY_RS480))
  91.  
  92.  
  93. typedef enum {
  94.         CARD_PCI,
  95.         CARD_AGP,
  96.         CARD_PCIE
  97. } RADEONCardType;
  98.  
  99. enum radeon_chip_flags {
  100.     RADEON_FAMILY_MASK  =  0x0000ffffUL,
  101.     RADEON_FLAGS_MASK   =  0xffff0000UL,
  102.     RADEON_IS_MOBILITY  =  0x00010000UL,
  103.     RADEON_IS_IGP       =  0x00020000UL,
  104.     RADEON_SINGLE_CRTC  =  0x00040000UL,
  105.     RADEON_IS_AGP       =  0x00080000UL,
  106.     RADEON_HAS_HIERZ    =  0x00100000UL,
  107.     RADEON_IS_PCIE      =  0x00200000UL,
  108.     RADEON_NEW_MEMMAP   =  0x00400000UL,
  109.     RADEON_IS_PCI       =  0x00800000UL,
  110.     RADEON_IS_IGPGART   =  0x01000000UL,
  111. };
  112.  
  113.  
  114. /*
  115.  * Errata workarounds
  116.  */
  117. typedef enum {
  118.        CHIP_ERRATA_R300_CG             = 0x00000001,
  119.        CHIP_ERRATA_PLL_DUMMYREADS      = 0x00000002,
  120.        CHIP_ERRATA_PLL_DELAY           = 0x00000004
  121. } RADEONErrata;
  122.  
  123. typedef struct
  124. {
  125.     u32_t pci_device_id;
  126.     RADEONChipFamily chip_family;
  127.     int mobility;
  128.     int igp;
  129.     int nocrtc2;
  130.     int nointtvout;
  131.     int singledac;
  132. } RADEONCardInfo;
  133.  
  134.  
  135. #define RHD_FB_BAR         0
  136. #define RHD_MMIO_BAR       2
  137.  
  138. #define RHD_MEM_GART       1
  139. #define RHD_MEM_FB         2
  140.  
  141. #define RADEON_DEFAULT_GART_SIZE         8       /* MB (must be 2^n and > 4MB) */
  142. #define R300_DEFAULT_GART_SIZE           32      /* MB (for R300 and above) */
  143. #define RADEON_DEFAULT_RING_SIZE         1       /* MB (must be page aligned) */
  144. #define RADEON_DEFAULT_BUFFER_SIZE       2       /* MB (must be page aligned) */
  145. #define RADEON_DEFAULT_GART_TEX_SIZE     1       /* MB (must be page aligned) */
  146.  
  147. #define RADEON_DEFAULT_CP_TIMEOUT        100000  /* usecs */
  148.  
  149. #define RADEON_DEFAULT_PCI_APER_SIZE     32      /* in MB */
  150.  
  151. #define RADEON_PCIGART_TABLE_SIZE      (32*1024)
  152.  
  153. #define RADEON_IDLE_RETRY      16 /* Fall out of idle loops after this count */
  154. #define RADEON_TIMEOUT    4000000 /* Fall out of wait loops after this count */
  155.  
  156.  
  157. typedef struct RHDRec
  158. {
  159.   addr_t            MMIOBase;
  160.   size_t            MMIOMapSize;
  161.  
  162.   u32_t             lock;
  163.  
  164.   addr_t            FbFreeStart;
  165.   addr_t            FbFreeSize;
  166.  
  167.  /* visible part of the framebuffer */
  168. //  unsigned int      FbScanoutStart;
  169. //  unsigned int      FbScanoutSize;
  170.  
  171. //  u32_t            LinearAddr;           /* Frame buffer physical address     */
  172.  
  173.   addr_t            fbLocation;           /* Frame buffer physical address */
  174.   u32_t             mc_fb_location;
  175.   u32_t             mc_agp_location;
  176.   u32_t             mc_agp_location_hi;
  177.  
  178.   size_t            videoRam;
  179.  
  180.   u32_t             MemCntl;
  181.   u32_t             BusCntl;
  182.   unsigned long     FbMapSize;            /* Size of frame buffer, in bytes    */
  183.   unsigned long     FbSecureSize;         /* Size of secured fb area at end of
  184.                                             framebuffer */
  185.  
  186.   RADEONChipFamily  ChipFamily;
  187.   RADEONErrata      ChipErrata;
  188.  
  189.   char             *chipset;
  190.  
  191.   Bool              IsIGP;
  192.   Bool              IsMobility;
  193.   Bool              HasCRTC2;
  194.  
  195.   u32_t             bus;
  196.   u32_t             devfn;
  197.  
  198.   PCITAG            PciTag;
  199.   u16_t             PciDeviceID;
  200.  
  201.   u16_t             subvendor_id;
  202.   u16_t             subdevice_id;
  203.  
  204.   RADEONCardType    cardType;            /* Current card is a PCI card */
  205.  
  206.   u32_t             memBase[6];
  207.   u32_t             ioBase[6];
  208.   u32_t             memtype[6];
  209.   u32_t             memsize[6];
  210.  
  211.   struct mem_block  *fb_heap;
  212.   struct mem_block  *gart_heap;
  213.  
  214.   u32_t             displayWidth;
  215.   u32_t             displayHeight;
  216.  
  217.   u32_t             gart_type;
  218.   u32_t            *gart_table;
  219.   addr_t            gart_table_dma;
  220.   addr_t            gart_vm_start;
  221.   size_t            gart_size;
  222.  
  223.   u32_t*            ringBase;
  224.   u32_t             ring_rp;
  225.   u32_t             ring_wp;
  226.   u32_t             ringSize;
  227.   u32_t             ring_avail;
  228.  
  229.   u32_t             bufSize;
  230.   u32_t             pciAperSize;
  231.   u32_t             CPusecTimeout;
  232.  
  233.   int               __xmin;
  234.   int               __ymin;
  235.   int               __xmax;
  236.   int               __ymax;
  237.  
  238.   u32_t             gui_control;
  239.   u32_t             dst_pitch_offset;
  240.   u32_t             surface_cntl;
  241.  
  242.  
  243.   volatile u32_t    host_rp   __attribute__ ((aligned (128)));
  244.  
  245.   volatile u32_t    scratch0  __attribute__ ((aligned (128)));
  246.   volatile u32_t    scratch1;
  247.   volatile u32_t    scratch2;
  248.   volatile u32_t    scratch3;
  249.   volatile u32_t    scratch4;
  250.   volatile u32_t    scratch5;
  251.   volatile u32_t    scratch6;
  252.   volatile u32_t    scratch7;
  253.  
  254.   int               RamWidth  __attribute__ ((aligned (128)));
  255.   Bool              IsDDR;
  256.  
  257.   int               num_gb_pipes;
  258.   int               has_tcl;
  259.  
  260. }RHD_t, *RHDPtr;
  261.  
  262. extern RHD_t rhd;
  263.  
  264. #define RADEON_CP_PACKET0              0x00000000
  265. #define RADEON_CP_PACKET1              0x40000000
  266. #define RADEON_CP_PACKET2              0x80000000
  267. #define RADEON_CP_PACKET3              0xC0000000
  268.  
  269. # define RADEON_CNTL_PAINT             0x00009100
  270. # define RADEON_CNTL_BITBLT            0x00009200
  271. # define RADEON_CNTL_TRANBLT           0x00009C00
  272.  
  273. # define RADEON_CNTL_PAINT_POLYLINE    0x00009500
  274. # define RADEON_CNTL_PAINT_MULTI       0x00009A00
  275.  
  276. #if R300_PIO
  277.  
  278. #define BEGIN_ACCEL(n)      FIFOWait(n)
  279. #define FINISH_ACCEL()
  280. #define COMMIT_RING()
  281. #define OUT_ACCEL_REG(reg, val) OUTREG(reg, val)
  282.  
  283. #else
  284.  
  285. #define CP_PACKET0(reg, n)            \
  286.     (RADEON_CP_PACKET0 | ((n - 1 ) << 16) | ((reg) >> 2))
  287.  
  288. #define CP_PACKET1(reg0, reg1)            \
  289.         (RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2))
  290.  
  291. #define CP_PACKET2()                     \
  292.   (RADEON_CP_PACKET2)
  293.  
  294. #define CP_PACKET3( pkt, n )             \
  295.         (RADEON_CP_PACKET3 | (pkt) | ((n) << 16))
  296.  
  297.  
  298. #define BEGIN_RING( req ) do {                                     \
  299.      int avail = rhd.ring_rp-rhd.ring_wp;                          \
  300.      if (avail <=0 ) avail+= 0x4000;                               \
  301.      if( (req)+128 > avail)                                        \
  302.      {                                                             \
  303.         rhd.ring_rp = INREG(RADEON_CP_RB_RPTR);                    \
  304.         avail = rhd.ring_rp-rhd.ring_wp;                           \
  305.         if (avail <= 0) avail+= 0x4000;                            \
  306.         if( (req)+128 > avail){                                    \
  307.            unlock_device();                                        \
  308.            return 0;                                               \
  309.         };                                                         \
  310.      }                                                             \
  311.      ring = &rhd.ringBase[rhd.ring_wp];                            \
  312. }while(0)
  313.  
  314. #define ADVANCE_RING()
  315.  
  316. #define OUT_RING( x )        *ring++ = (x)
  317.  
  318. #define CP_REG(reg, val)                 \
  319. do {                                     \
  320.     ring[0]  = CP_PACKET0((reg), 1);     \
  321.     ring[1]  = (val);                    \
  322.     ring+=  2;                           \
  323. } while (0)
  324.  
  325. #define DRM_MEMORYBARRIER()  __asm__ volatile("lock; addl $0,0(%%esp)" : : : "memory");
  326.  
  327. #define COMMIT_RING() do {                             \
  328.   rhd.ring_wp = (ring - rhd.ringBase) & 0x3FFF;        \
  329.   /* Flush writes to ring */                           \
  330.     DRM_MEMORYBARRIER();                               \
  331.   /*GET_RING_HEAD( dev_priv );          */             \
  332.   OUTREG( RADEON_CP_RB_WPTR, rhd.ring_wp);             \
  333.     /* read from PCI bus to ensure correct posting */  \
  334. /*  INREG( RADEON_CP_RB_RPTR );    */                  \
  335. } while (0)
  336.  
  337. #define BEGIN_ACCEL(n)          BEGIN_RING(2*(n))
  338. #define FINISH_ACCEL()          COMMIT_RING()
  339.  
  340. #define OUT_ACCEL_REG(reg, val) CP_REG((reg), (val))
  341.  
  342. #endif
  343.  
  344. typedef struct {
  345.     int                 token;          /* id of the token */
  346.     const char *        name;           /* token name */
  347. } SymTabRec, *SymTabPtr;
  348.  
  349.  
  350. extern inline void lock_device()
  351. {
  352.      __asm__ __volatile__ (
  353.      "call *__imp__WaitMutex"
  354.      ::"b" (&rhd.lock));
  355. };
  356.  
  357. extern inline void unlock_device()
  358. {
  359.     rhd.lock = 0;
  360. }
  361.  
  362. extern inline void
  363. OUTREG8(u16_t offset, u8_t value)
  364. {
  365.   *(volatile u8_t *)((u8_t *)(rhd.MMIOBase + offset)) = value;
  366. }
  367.  
  368.  
  369. extern inline u32_t INREG(u16_t offset)
  370. {
  371.   return *(volatile u32_t *)((u8_t*)(rhd.MMIOBase + offset));
  372. }
  373.  
  374.  
  375. extern inline void OUTREG(u16_t offset, u32_t value)
  376. {
  377.   *(volatile u32_t *)((u8_t *)(rhd.MMIOBase + offset)) = value;
  378. }
  379.  
  380. //#define OUTREG( offset, value) \
  381. //  *(volatile u32_t *)((u8_t *)(rhd.MMIOBase + (u32_t)(offset))) = (u32_t)value
  382.  
  383.  
  384. extern inline u32_t _RHDRegRead(RHDPtr rhdPtr, u16_t offset)
  385. {
  386.   return *(volatile u32_t *)((u8_t*)(rhdPtr->MMIOBase + offset));
  387. }
  388.  
  389. extern inline void
  390. MASKREG(u16_t offset, u32_t value, u32_t mask)
  391. {
  392.   u32_t tmp;
  393.  
  394.   tmp = INREG(offset);
  395.   tmp &= ~mask;
  396.   tmp |= (value & mask);
  397.   OUTREG(offset, tmp);
  398. };
  399.  
  400.  
  401. #define INPLL( addr) RADEONINPLL( addr)
  402.  
  403. #define OUTPLL( addr, val) RADEONOUTPLL( addr, val)
  404.  
  405.  
  406. extern inline void
  407. _RHDRegWrite(RHDPtr rhdPtr, u16_t offset, u32_t value)
  408. {
  409.   *(volatile u32_t *)((u8_t *)(rhdPtr->MMIOBase + offset)) = value;
  410. }
  411.  
  412. extern inline void
  413. _RHDRegMask(RHDPtr rhdPtr, u16_t offset, u32_t value, u32_t mask)
  414. {
  415.   u32_t tmp;
  416.  
  417.   tmp = _RHDRegRead(rhdPtr, offset);
  418.   tmp &= ~mask;
  419.   tmp |= (value & mask);
  420.   _RHDRegWrite(rhdPtr, offset, tmp);
  421. };
  422.  
  423. #define RHDRegRead(ptr, offset) _RHDRegRead((ptr)->rhdPtr, (offset))
  424. #define RHDRegWrite(ptr, offset, value) _RHDRegWrite((ptr)->rhdPtr, (offset), (value))
  425. #define RHDRegMask(ptr, offset, value, mask) _RHDRegMask((ptr)->rhdPtr, (offset), (value), (mask))
  426.  
  427.  
  428. #define RHDFUNC(ptr)
  429.  
  430. #define DBG(x) x
  431. //  #define DBG(x)
  432.  
  433. #pragma pack (push,1)
  434. typedef struct s_cursor
  435. {
  436.    u32_t   magic;                           // 'CURS'
  437.    void  (*destroy)(struct s_cursor*);    // destructor
  438.    u32_t   fd;                              // next object in list
  439.    u32_t   bk;                              // prev object in list
  440.    u32_t   pid;                             // owner id
  441.  
  442.    void *base;                            // allocated memory
  443.    u32_t   hot_x;                           // hotspot coords
  444.    u32_t   hot_y;
  445. }cursor_t;
  446. #pragma pack (pop)
  447.  
  448. #define LOAD_FROM_FILE   0
  449. #define LOAD_FROM_MEM    1
  450. #define LOAD_INDIRECT    2
  451.  
  452. cursor_t *create_cursor(u32_t pid, void *src, u32_t flags);
  453. void __stdcall copy_cursor(void *img, void *src);
  454. void destroy_cursor(cursor_t *cursor);
  455. void __destroy_cursor(cursor_t *cursor);                // wrap
  456.  
  457. void __stdcall r500_SelectCursor(cursor_t *cursor);
  458. void __stdcall r500_SetCursor(cursor_t *cursor, int x, int y);
  459. void __stdcall r500_CursorRestore(int x, int y);
  460.  
  461.  
  462. typedef struct {
  463.     u32_t x ;
  464.     u32_t y ;
  465. } xPointFixed;
  466.  
  467. typedef u32_t   xFixed_16_16;
  468.  
  469. typedef xFixed_16_16  xFixed;
  470.  
  471. #define XFIXED_BITS 16
  472.  
  473. #define xFixedToInt(f)  (int) ((f) >> XFIXED_BITS)
  474. #define IntToxFixed(i)  ((xFixed) (i) << XFIXED_BITS)
  475.  
  476. #define xFixedToFloat(f) (((float) (f)) / 65536)
  477.  
  478. #define PICT_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) |  \
  479.                                          ((type) << 16) | \
  480.                                          ((a) << 12) | \
  481.                                          ((r) << 8) | \
  482.                                          ((g) << 4) | \
  483.                                          ((b)))
  484.  
  485. #define PICT_FORMAT_A(f)  (((f) >> 12) & 0x0f)
  486. #define PICT_FORMAT_RGB(f)  (((f)      ) & 0xfff)
  487.  
  488. #define PICT_TYPE_OTHER 0
  489. #define PICT_TYPE_A     1
  490. #define PICT_TYPE_ARGB  2
  491. #define PICT_TYPE_ABGR  3
  492. #define PICT_TYPE_COLOR 4
  493. #define PICT_TYPE_GRAY  5
  494.  
  495. typedef enum _PictFormatShort {
  496.    PICT_a8r8g8b8 =      PICT_FORMAT(32,PICT_TYPE_ARGB,8,8,8,8),
  497.    PICT_x8r8g8b8 =      PICT_FORMAT(32,PICT_TYPE_ARGB,0,8,8,8),
  498.    PICT_a8b8g8r8 =      PICT_FORMAT(32,PICT_TYPE_ABGR,8,8,8,8),
  499.    PICT_x8b8g8r8 =      PICT_FORMAT(32,PICT_TYPE_ABGR,0,8,8,8),
  500.  
  501. /* 24bpp formats */
  502.    PICT_r8g8b8 =        PICT_FORMAT(24,PICT_TYPE_ARGB,0,8,8,8),
  503.    PICT_b8g8r8 =        PICT_FORMAT(24,PICT_TYPE_ABGR,0,8,8,8),
  504.  
  505. /* 16bpp formats */
  506.    PICT_r5g6b5 =        PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,6,5),
  507.    PICT_b5g6r5 =        PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,6,5),
  508.  
  509.    PICT_a1r5g5b5 =      PICT_FORMAT(16,PICT_TYPE_ARGB,1,5,5,5),
  510.    PICT_x1r5g5b5 =      PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,5,5),
  511.    PICT_a1b5g5r5 =      PICT_FORMAT(16,PICT_TYPE_ABGR,1,5,5,5),
  512.    PICT_x1b5g5r5 =      PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,5,5),
  513.    PICT_a4r4g4b4 =      PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4),
  514.    PICT_x4r4g4b4 =      PICT_FORMAT(16,PICT_TYPE_ARGB,0,4,4,4),
  515.    PICT_a4b4g4r4 =      PICT_FORMAT(16,PICT_TYPE_ABGR,4,4,4,4),
  516.    PICT_x4b4g4r4 =      PICT_FORMAT(16,PICT_TYPE_ABGR,0,4,4,4),
  517.  
  518. /* 8bpp formats */
  519.    PICT_a8 =            PICT_FORMAT(8,PICT_TYPE_A,8,0,0,0),
  520.    PICT_r3g3b2 =        PICT_FORMAT(8,PICT_TYPE_ARGB,0,3,3,2),
  521.    PICT_b2g3r3 =        PICT_FORMAT(8,PICT_TYPE_ABGR,0,3,3,2),
  522.    PICT_a2r2g2b2 =      PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2),
  523.    PICT_a2b2g2r2 =      PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2),
  524.  
  525.    PICT_c8 =            PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0),
  526.    PICT_g8 =            PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
  527.  
  528.    PICT_x4a4 =          PICT_FORMAT(8,PICT_TYPE_A,4,0,0,0),
  529.  
  530.    PICT_x4c4 =          PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0),
  531.    PICT_x4g4 =          PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0),
  532.  
  533. /* 4bpp formats */
  534.    PICT_a4 =            PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0),
  535.    PICT_r1g2b1 =        PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1),
  536.    PICT_b1g2r1 =        PICT_FORMAT(4,PICT_TYPE_ABGR,0,1,2,1),
  537.    PICT_a1r1g1b1 =      PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1),
  538.    PICT_a1b1g1r1 =      PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1),
  539.  
  540.    PICT_c4 =            PICT_FORMAT(4,PICT_TYPE_COLOR,0,0,0,0),
  541.    PICT_g4 =            PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0),
  542.  
  543. /* 1bpp formats */
  544.    PICT_a1 =            PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0),
  545.  
  546.    PICT_g1 =            PICT_FORMAT(1,PICT_TYPE_GRAY,0,0,0,0),
  547. } PictFormatShort;
  548.  
  549. void dump_mem();
  550.  
  551.  
  552.  
  553. RHDPtr  FindPciDevice();
  554.  
  555. static __inline__ int drm_device_is_pcie(PCITAG pciTag);
  556. static void init_pipes(RHDPtr info);
  557. Bool   init_cp(RHDPtr info);
  558.  
  559. Bool    RHDPreInit();
  560.  
  561. void    R5xx2DInit();
  562.  
  563. int     Init3DEngine(RHDPtr info);
  564.  
  565. void    init_gart(RHDPtr info);
  566.  
  567. int     rhdInitHeap(RHDPtr rhdPtr);
  568.  
  569.  
  570.