Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. #define FILL_RECT  1
  3. #define DRAW_RECT  2
  4. #define LINE_2P    3
  5. #define BLIT       4
  6.  
  7.  
  8. typedef unsigned int color_t;
  9. typedef unsigned int u32_t;
  10.  
  11. typedef struct
  12. {
  13.   int x;
  14.   int y;
  15.   int w;
  16.   int h;
  17.   u32 color;
  18. }draw_t;
  19.  
  20. typedef struct
  21. {
  22.   int x;
  23.   int y;
  24.   int w;
  25.   int h;
  26.  
  27.   color_t bkcolor;
  28.   color_t fcolor;
  29.  
  30.   u32_t   bmp0;
  31.   u32_t   bmp1;
  32. }fill_t;
  33.  
  34. typedef struct
  35. {
  36.   int src_x;
  37.   int src_y;
  38.   int dst_x;
  39.   int dst_y;
  40.   int w;
  41.   int h;
  42. }blit_t;
  43.  
  44. typedef struct
  45. {
  46.   int x0;
  47.   int y0;
  48.   int x1;
  49.   int y1;
  50.   u32 color;
  51. }line2p_t;
  52.  
  53. int LineClip( int *x1, int *y1, int *x2, int *y2 );
  54. int BlockClip( int *x1, int *y1, int *x2, int* y2);
  55.  
  56. int DrawRect(draw_t * draw);
  57. int FillRect(fill_t * fill);
  58.  
  59. int Line2P(line2p_t *draw);
  60.  
  61. int Blit(blit_t *blit);
  62.  
  63. # define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
  64. #       define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
  65. # define RADEON_GMC_BRUSH_SOLID_COLOR     (13 << 4)
  66. # define RADEON_GMC_BRUSH_NONE            (15 << 4)
  67. # define RADEON_GMC_DST_16BPP             (4 << 8)
  68. # define RADEON_GMC_DST_24BPP             (5 << 8)
  69. # define RADEON_GMC_DST_32BPP             (6 << 8)
  70. # define RADEON_GMC_DST_DATATYPE_SHIFT     8
  71. # define RADEON_GMC_SRC_DATATYPE_COLOR    (3 << 12)
  72. # define RADEON_DP_SRC_SOURCE_MEMORY      (2 << 24)
  73. # define RADEON_DP_SRC_SOURCE_HOST_DATA   (3 << 24)
  74. # define RADEON_GMC_CLR_CMP_CNTL_DIS      (1 << 28)
  75. # define RADEON_GMC_WR_MSK_DIS            (1 << 30)
  76. # define RADEON_ROP3_S                 0x00cc0000
  77. # define RADEON_ROP3_P                 0x00f00000
  78.  
  79. #define RADEON_CP_PACKET0              0x00000000
  80. #define RADEON_CP_PACKET1              0x40000000
  81. #define RADEON_CP_PACKET2              0x80000000
  82. #define RADEON_CP_PACKET3              0xC0000000
  83.  
  84. # define RADEON_CNTL_PAINT             0x00009100
  85. # define RADEON_CNTL_BITBLT            0x00009200
  86.  
  87. # define RADEON_CNTL_PAINT_POLYLINE    0x00009500
  88. # define RADEON_CNTL_PAINT_MULTI       0x00009A00
  89.  
  90. #define CP_PACKET0(reg, n)            \
  91.         (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
  92.  
  93. #define CP_PACKET1(reg0, reg1)            \
  94.         (RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2))
  95.  
  96. #define CP_PACKET2()              \
  97.   (RADEON_CP_PACKET2)
  98.  
  99. #define CP_PACKET3( pkt, n )            \
  100.         (RADEON_CP_PACKET3 | (pkt) | ((n) << 16))
  101.  
  102. #define BEGIN_RING( n ) do {            \
  103.   ring = rhd.ring_base;                 \
  104.   write = rhd.ring_wp;                  \
  105. } while (0)
  106.  
  107. #define ADVANCE_RING()
  108.  
  109. #define OUT_RING( x ) do {        \
  110.         ring[write++] = (x);                                            \
  111. } while (0)
  112.  
  113. #define OUT_RING_REG(reg, val)            \
  114. do {                                                                    \
  115.     OUT_RING(CP_PACKET0(reg, 0));                                       \
  116.     OUT_RING(val);                                                      \
  117. } while (0)
  118.  
  119. #define DRM_MEMORYBARRIER()  __asm volatile("lock; addl $0,0(%%esp)" : : : "memory");
  120.  
  121. #define COMMIT_RING() do {                            \
  122.   rhd.ring_wp = write & 0x1FFF;                       \
  123.   /* Flush writes to ring */                          \
  124.   DRM_MEMORYBARRIER();                                \
  125.   /*GET_RING_HEAD( dev_priv );          */            \
  126.   OUTREG( RADEON_CP_RB_WPTR, rhd.ring_wp);            \
  127.         /* read from PCI bus to ensure correct posting */               \
  128.   INREG( RADEON_CP_RB_RPTR );                         \
  129. } while (0)
  130.  
  131.