Subversion Repositories Kolibri OS

Rev

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