Subversion Repositories Kolibri OS

Rev

Rev 818 | 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. #define COMPIZ       5
  7. #define PIXMAP       6
  8. #define PIXBLIT      7
  9. #define PIXLOCK      8
  10. #define PIXUNLOCK    9
  11. #define PIXDESTROY  10
  12. #define TRANSBLIT   11
  13.  
  14.  
  15. typedef unsigned int color_t;
  16.  
  17. typedef struct
  18. {
  19.   pixmap_t  *dstpix;
  20.  
  21.   int     x;
  22.   int     y;
  23.   u32_t   w;
  24.   u32_t   h;
  25.   color_t color;
  26. }draw_t;
  27.  
  28. typedef struct
  29. {
  30.   pixmap_t  *dstpix;
  31.  
  32.   int x;
  33.   int y;
  34.   int w;
  35.   int h;
  36.  
  37.   color_t bkcolor;
  38.   color_t fcolor;
  39.  
  40.   u32_t   bmp0;
  41.   u32_t   bmp1;
  42. }fill_t;
  43.  
  44. typedef struct
  45. {
  46.   int src_x;
  47.   int src_y;
  48.   int dst_x;
  49.   int dst_y;
  50.   int w;
  51.   int h;
  52. }blit_t;
  53.  
  54. typedef struct
  55. {
  56.   int x0;
  57.   int y0;
  58.   int x1;
  59.   int y1;
  60.   u32 color;
  61. }line2p_t;
  62.  
  63. typedef struct
  64. {
  65.   pixmap_t  *pixmap;
  66.   void      *usermap;
  67.   u32_t      format;
  68.   u32_t      pitch;
  69.  
  70.   u32_t      width;
  71.   u32_t      height;
  72. }userpixmap_t;
  73.  
  74. typedef struct
  75. {
  76.   pixmap_t  *dstpix;
  77.   int        dst_x;
  78.   int        dst_y;
  79.  
  80.   pixmap_t  *srcpix;
  81.   int        src_x;
  82.   int        src_y;
  83.   int        w;
  84.   int        h;
  85. }pixblit_t;
  86.  
  87.  
  88. int LineClip( int *x1, int *y1, int *x2, int *y2 );
  89. int BlockClip( int *x1, int *y1, int *x2, int* y2);
  90.  
  91. int DrawRect(draw_t * draw);
  92. int FillRect(fill_t * fill);
  93.  
  94. int Line2P(line2p_t *draw);
  95.  
  96. int Blit(blit_t *blit);
  97.  
  98. int RadeonComposite( blit_t *blit);
  99.  
  100. int CreatePixmap(userpixmap_t *io);
  101. int DestroyPixmap(userpixmap_t *io);
  102. int LockPixmap(userpixmap_t *io);
  103. int UnlockPixmap(userpixmap_t *io);
  104.  
  105. int PixBlit(pixblit_t* blit);
  106.  
  107.  
  108. # define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
  109. #       define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
  110. # define RADEON_GMC_BRUSH_SOLID_COLOR     (13 << 4)
  111. # define RADEON_GMC_BRUSH_NONE            (15 << 4)
  112. # define RADEON_GMC_DST_16BPP             (4 << 8)
  113. # define RADEON_GMC_DST_24BPP             (5 << 8)
  114. # define RADEON_GMC_DST_32BPP             (6 << 8)
  115. # define RADEON_GMC_DST_DATATYPE_SHIFT     8
  116. # define RADEON_GMC_SRC_DATATYPE_COLOR    (3 << 12)
  117. # define RADEON_DP_SRC_SOURCE_MEMORY      (2 << 24)
  118. # define RADEON_DP_SRC_SOURCE_HOST_DATA   (3 << 24)
  119. # define RADEON_GMC_CLR_CMP_CNTL_DIS      (1 << 28)
  120. # define RADEON_GMC_WR_MSK_DIS            (1 << 30)
  121. # define RADEON_ROP3_S                 0x00cc0000
  122. # define RADEON_ROP3_P                 0x00f00000
  123.  
  124. #define RADEON_CP_PACKET0              0x00000000
  125. #define RADEON_CP_PACKET1              0x40000000
  126. #define RADEON_CP_PACKET2              0x80000000
  127. #define RADEON_CP_PACKET3              0xC0000000
  128.  
  129. # define RADEON_CNTL_PAINT             0x00009100
  130. # define RADEON_CNTL_BITBLT            0x00009200
  131. # define RADEON_CNTL_TRANBLT           0x00009C00
  132.  
  133.  
  134. # define RADEON_CNTL_PAINT_POLYLINE    0x00009500
  135. # define RADEON_CNTL_PAINT_MULTI       0x00009A00
  136.  
  137. #define CP_PACKET0(reg, n)            \
  138.         (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
  139.  
  140. #define CP_PACKET1(reg0, reg1)            \
  141.         (RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2))
  142.  
  143. #define CP_PACKET2()              \
  144.   (RADEON_CP_PACKET2)
  145.  
  146. #define CP_PACKET3( pkt, n )            \
  147.         (RADEON_CP_PACKET3 | (pkt) | ((n) << 16))
  148.  
  149. #define BEGIN_RING( n ) do {            \
  150.   ring = rhd.ring_base;                 \
  151.   write = rhd.ring_wp;                  \
  152. } while (0)
  153.  
  154. #define ADVANCE_RING()
  155.  
  156. #define OUT_RING( x ) do {        \
  157.         ring[write++] = (x);                                            \
  158. } while (0)
  159.  
  160. #define OUT_RING_REG(reg, val)            \
  161. do {                                                                    \
  162.     OUT_RING(CP_PACKET0(reg, 0));                                       \
  163.     OUT_RING(val);                                                      \
  164. } while (0)
  165.  
  166. #define DRM_MEMORYBARRIER()  __asm volatile("lock; addl $0,0(%%esp)" : : : "memory");
  167.  
  168. #define COMMIT_RING() do {                            \
  169.   rhd.ring_wp = write & 0x1FFF;                       \
  170.   /* Flush writes to ring */                          \
  171.   DRM_MEMORYBARRIER();                                \
  172.   /*GET_RING_HEAD( dev_priv );          */            \
  173.   OUTREG( RADEON_CP_RB_WPTR, rhd.ring_wp);            \
  174.         /* read from PCI bus to ensure correct posting */               \
  175.   INREG( RADEON_CP_RB_RPTR );                         \
  176. } while (0)
  177.  
  178.  
  179.