Subversion Repositories Kolibri OS

Rev

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.  
  6. typedef unsigned int color_t;
  7. typedef unsigned int u32_t;
  8.  
  9. typedef struct
  10. {
  11.   int x;
  12.   int y;
  13.   int w;
  14.   int h;
  15.   u32 color;
  16. }draw_t;
  17.  
  18. typedef struct
  19. {
  20.   int x;
  21.   int y;
  22.   int w;
  23.   int h;
  24.  
  25.   color_t bkcolor;
  26.   color_t fcolor;
  27.  
  28.   u32_t   bmp0;
  29.   u32_t   bmp1;
  30. }fill_t;
  31.  
  32. typedef struct
  33. {
  34.   int x0;
  35.   int y0;
  36.   int x1;
  37.   int y1;
  38.   u32 color;
  39. }line2p_t;
  40.  
  41. int LineClip( int *x1, int *y1, int *x2, int *y2 );
  42. int BlockClip( int *x1, int *y1, int *x2, int* y2);
  43.  
  44. int DrawRect(draw_t * draw);
  45. int FillRect(fill_t * fill);
  46.  
  47. int Line2P(line2p_t *draw);
  48.  
  49.  
  50. # define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
  51. #       define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
  52. #       define RADEON_GMC_BRUSH_SOLID_COLOR     (13 << 4)
  53. #       define RADEON_GMC_BRUSH_NONE            (15 << 4)
  54. #       define RADEON_GMC_DST_16BPP             (4 << 8)
  55. #       define RADEON_GMC_DST_24BPP             (5 << 8)
  56. #       define RADEON_GMC_DST_32BPP             (6 << 8)
  57. #       define RADEON_GMC_DST_DATATYPE_SHIFT    8
  58. #       define RADEON_GMC_SRC_DATATYPE_COLOR    (3 << 12)
  59. #       define RADEON_DP_SRC_SOURCE_MEMORY      (2 << 24)
  60. #       define RADEON_DP_SRC_SOURCE_HOST_DATA   (3 << 24)
  61. #       define RADEON_GMC_CLR_CMP_CNTL_DIS      (1 << 28)
  62. #       define RADEON_GMC_WR_MSK_DIS            (1 << 30)
  63. #       define RADEON_ROP3_S                    0x00cc0000
  64. # define RADEON_ROP3_P      0x00f00000
  65.  
  66. #define RADEON_CP_PACKET3              0xC0000000
  67.  
  68. # define RADEON_CNTL_PAINT             0x00009100
  69. # define RADEON_CNTL_PAINT_POLYLINE    0x00009500
  70. # define RADEON_CNTL_PAINT_MULTI       0x00009A00
  71.  
  72. #define CP_PACKET3( pkt, n )            \
  73.         (RADEON_CP_PACKET3 | (pkt) | ((n) << 16))
  74.  
  75. #define BEGIN_RING( n ) do {            \
  76.   ring = rhd.ring_base;                 \
  77.   write = rhd.ring_wp;                  \
  78. } while (0)
  79.  
  80. #define OUT_RING( x ) do {        \
  81.         ring[write++] = (x);                                            \
  82. } while (0)
  83.  
  84. #define DRM_MEMORYBARRIER()  __asm volatile("lock; addl $0,0(%%esp)" : : : "memory");
  85.  
  86. #define COMMIT_RING() do {                            \
  87.   rhd.ring_wp = write & 0x1FFF;                       \
  88.   /* Flush writes to ring */                          \
  89.   DRM_MEMORYBARRIER();                                \
  90.   /*GET_RING_HEAD( dev_priv );          */            \
  91.   OUTREG( RADEON_CP_RB_WPTR, rhd.ring_wp);            \
  92.         /* read from PCI bus to ensure correct posting */               \
  93.   INREG( RADEON_CP_RB_RPTR );                         \
  94. } while (0)
  95.  
  96.