Subversion Repositories Kolibri OS

Rev

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