comparison src/video/fbcon/SDL_fbriva.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
31 static int FifoEmptyCount = 0; 31 static int FifoEmptyCount = 0;
32 static int FifoFreeCount = 0; 32 static int FifoFreeCount = 0;
33 33
34 /* Wait for vertical retrace */ 34 /* Wait for vertical retrace */
35 static void 35 static void
36 WaitVBL (_THIS) 36 WaitVBL(_THIS)
37 { 37 {
38 volatile Uint8 *port = (Uint8 *) (mapped_io + PCIO_OFFSET + 0x3DA); 38 volatile Uint8 *port = (Uint8 *) (mapped_io + PCIO_OFFSET + 0x3DA);
39 39
40 while ((*port & 0x08)); 40 while ((*port & 0x08));
41 while (!(*port & 0x08)); 41 while (!(*port & 0x08));
42 } 42 }
43 static void 43 static void
44 NV3WaitIdle (_THIS) 44 NV3WaitIdle(_THIS)
45 { 45 {
46 RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET); 46 RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET);
47 while ((Rop->FifoFree < FifoEmptyCount) || 47 while ((Rop->FifoFree < FifoEmptyCount) ||
48 (*(mapped_io + PGRAPH_OFFSET + 0x000006B0) & 0x01)); 48 (*(mapped_io + PGRAPH_OFFSET + 0x000006B0) & 0x01));
49 } 49 }
50 static void 50 static void
51 NV4WaitIdle (_THIS) 51 NV4WaitIdle(_THIS)
52 { 52 {
53 RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET); 53 RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET);
54 while ((Rop->FifoFree < FifoEmptyCount) || 54 while ((Rop->FifoFree < FifoEmptyCount) ||
55 (*(mapped_io + PGRAPH_OFFSET + 0x00000700) & 0x01)); 55 (*(mapped_io + PGRAPH_OFFSET + 0x00000700) & 0x01));
56 } 56 }
57 57
58 #if 0 /* Not yet implemented? */ 58 #if 0 /* Not yet implemented? */
59 /* Sets video mem colorkey and accelerated blit function */ 59 /* Sets video mem colorkey and accelerated blit function */
60 static int 60 static int
61 SetHWColorKey (_THIS, SDL_Surface * surface, Uint32 key) 61 SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key)
62 { 62 {
63 return (0); 63 return (0);
64 } 64 }
65 65
66 /* Sets per surface hardware alpha value */ 66 /* Sets per surface hardware alpha value */
67 static int 67 static int
68 SetHWAlpha (_THIS, SDL_Surface * surface, Uint8 value) 68 SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 value)
69 { 69 {
70 return (0); 70 return (0);
71 } 71 }
72 #endif /* Not yet implemented */ 72 #endif /* Not yet implemented */
73 73
74 static int 74 static int
75 FillHWRect (_THIS, SDL_Surface * dst, SDL_Rect * rect, Uint32 color) 75 FillHWRect(_THIS, SDL_Surface * dst, SDL_Rect * rect, Uint32 color)
76 { 76 {
77 int dstX, dstY; 77 int dstX, dstY;
78 int dstW, dstH; 78 int dstW, dstH;
79 RivaBitmap *Bitmap = (RivaBitmap *) (mapped_io + BITMAP_OFFSET); 79 RivaBitmap *Bitmap = (RivaBitmap *) (mapped_io + BITMAP_OFFSET);
80 80
81 /* Don't blit to the display surface when switched away */ 81 /* Don't blit to the display surface when switched away */
82 if (switched_away) { 82 if (switched_away) {
83 return -2; /* no hardware access */ 83 return -2; /* no hardware access */
84 } 84 }
85 if (dst == this->screen) { 85 if (dst == this->screen) {
86 SDL_mutexP (hw_lock); 86 SDL_mutexP(hw_lock);
87 } 87 }
88 88
89 /* Set up the X/Y base coordinates */ 89 /* Set up the X/Y base coordinates */
90 dstW = rect->w; 90 dstW = rect->w;
91 dstH = rect->h; 91 dstH = rect->h;
92 FB_dst_to_xy (this, dst, &dstX, &dstY); 92 FB_dst_to_xy(this, dst, &dstX, &dstY);
93 93
94 /* Adjust for the current rectangle */ 94 /* Adjust for the current rectangle */
95 dstX += rect->x; 95 dstX += rect->x;
96 dstY += rect->y; 96 dstY += rect->y;
97 97
98 RIVA_FIFO_FREE (Bitmap, 1); 98 RIVA_FIFO_FREE(Bitmap, 1);
99 Bitmap->Color1A = color; 99 Bitmap->Color1A = color;
100 100
101 RIVA_FIFO_FREE (Bitmap, 2); 101 RIVA_FIFO_FREE(Bitmap, 2);
102 Bitmap->UnclippedRectangle[0].TopLeft = (dstX << 16) | dstY; 102 Bitmap->UnclippedRectangle[0].TopLeft = (dstX << 16) | dstY;
103 Bitmap->UnclippedRectangle[0].WidthHeight = (dstW << 16) | dstH; 103 Bitmap->UnclippedRectangle[0].WidthHeight = (dstW << 16) | dstH;
104 104
105 FB_AddBusySurface (dst); 105 FB_AddBusySurface(dst);
106 106
107 if (dst == this->screen) { 107 if (dst == this->screen) {
108 SDL_mutexV (hw_lock); 108 SDL_mutexV(hw_lock);
109 } 109 }
110 return (0); 110 return (0);
111 } 111 }
112 112
113 static int 113 static int
114 HWAccelBlit (SDL_Surface * src, SDL_Rect * srcrect, 114 HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
115 SDL_Surface * dst, SDL_Rect * dstrect) 115 SDL_Surface * dst, SDL_Rect * dstrect)
116 { 116 {
117 SDL_VideoDevice *this = current_video; 117 SDL_VideoDevice *this = current_video;
118 int srcX, srcY; 118 int srcX, srcY;
119 int dstX, dstY; 119 int dstX, dstY;
120 int dstW, dstH; 120 int dstW, dstH;
121 RivaScreenBlt *Blt = (RivaScreenBlt *) (mapped_io + BLT_OFFSET); 121 RivaScreenBlt *Blt = (RivaScreenBlt *) (mapped_io + BLT_OFFSET);
122 122
123 /* FIXME: For now, only blit to display surface */ 123 /* FIXME: For now, only blit to display surface */
124 if (dst->pitch != SDL_VideoSurface->pitch) { 124 if (dst->pitch != SDL_VideoSurface->pitch) {
125 return (src->map->sw_blit (src, srcrect, dst, dstrect)); 125 return (src->map->sw_blit(src, srcrect, dst, dstrect));
126 } 126 }
127 127
128 /* Don't blit to the display surface when switched away */ 128 /* Don't blit to the display surface when switched away */
129 if (switched_away) { 129 if (switched_away) {
130 return -2; /* no hardware access */ 130 return -2; /* no hardware access */
131 } 131 }
132 if (dst == this->screen) { 132 if (dst == this->screen) {
133 SDL_mutexP (hw_lock); 133 SDL_mutexP(hw_lock);
134 } 134 }
135 135
136 /* Calculate source and destination base coordinates (in pixels) */ 136 /* Calculate source and destination base coordinates (in pixels) */
137 dstW = dstrect->w; 137 dstW = dstrect->w;
138 dstH = dstrect->h; 138 dstH = dstrect->h;
139 FB_dst_to_xy (this, src, &srcX, &srcY); 139 FB_dst_to_xy(this, src, &srcX, &srcY);
140 FB_dst_to_xy (this, dst, &dstX, &dstY); 140 FB_dst_to_xy(this, dst, &dstX, &dstY);
141 141
142 /* Adjust for the current blit rectangles */ 142 /* Adjust for the current blit rectangles */
143 srcX += srcrect->x; 143 srcX += srcrect->x;
144 srcY += srcrect->y; 144 srcY += srcrect->y;
145 dstX += dstrect->x; 145 dstX += dstrect->x;
146 dstY += dstrect->y; 146 dstY += dstrect->y;
147 147
148 RIVA_FIFO_FREE (Blt, 3); 148 RIVA_FIFO_FREE(Blt, 3);
149 Blt->TopLeftSrc = (srcY << 16) | srcX; 149 Blt->TopLeftSrc = (srcY << 16) | srcX;
150 Blt->TopLeftDst = (dstY << 16) | dstX; 150 Blt->TopLeftDst = (dstY << 16) | dstX;
151 Blt->WidthHeight = (dstH << 16) | dstW; 151 Blt->WidthHeight = (dstH << 16) | dstW;
152 152
153 FB_AddBusySurface (src); 153 FB_AddBusySurface(src);
154 FB_AddBusySurface (dst); 154 FB_AddBusySurface(dst);
155 155
156 if (dst == this->screen) { 156 if (dst == this->screen) {
157 SDL_mutexV (hw_lock); 157 SDL_mutexV(hw_lock);
158 } 158 }
159 return (0); 159 return (0);
160 } 160 }
161 161
162 static int 162 static int
163 CheckHWBlit (_THIS, SDL_Surface * src, SDL_Surface * dst) 163 CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
164 { 164 {
165 int accelerated; 165 int accelerated;
166 166
167 /* Set initial acceleration on */ 167 /* Set initial acceleration on */
168 src->flags |= SDL_HWACCEL; 168 src->flags |= SDL_HWACCEL;
186 } 186 }
187 return (accelerated); 187 return (accelerated);
188 } 188 }
189 189
190 void 190 void
191 FB_RivaAccel (_THIS, __u32 card) 191 FB_RivaAccel(_THIS, __u32 card)
192 { 192 {
193 RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET); 193 RivaRop *Rop = (RivaRop *) (mapped_io + ROP_OFFSET);
194 194
195 /* We have hardware accelerated surface functions */ 195 /* We have hardware accelerated surface functions */
196 this->CheckHWBlit = CheckHWBlit; 196 this->CheckHWBlit = CheckHWBlit;