diff options
Diffstat (limited to 'drivers/gpu/drm/i810')
-rw-r--r-- | drivers/gpu/drm/i810/i810_dma.c | 81 | ||||
-rw-r--r-- | drivers/gpu/drm/i810/i810_drv.h | 64 |
2 files changed, 71 insertions, 74 deletions
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 997d91707ad2..09c86ed89927 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -60,9 +60,8 @@ static struct drm_buf *i810_freelist_get(struct drm_device * dev) | |||
60 | /* In use is already a pointer */ | 60 | /* In use is already a pointer */ |
61 | used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, | 61 | used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, |
62 | I810_BUF_CLIENT); | 62 | I810_BUF_CLIENT); |
63 | if (used == I810_BUF_FREE) { | 63 | if (used == I810_BUF_FREE) |
64 | return buf; | 64 | return buf; |
65 | } | ||
66 | } | 65 | } |
67 | return NULL; | 66 | return NULL; |
68 | } | 67 | } |
@@ -71,7 +70,7 @@ static struct drm_buf *i810_freelist_get(struct drm_device * dev) | |||
71 | * yet, the hardware updates in use for us once its on the ring buffer. | 70 | * yet, the hardware updates in use for us once its on the ring buffer. |
72 | */ | 71 | */ |
73 | 72 | ||
74 | static int i810_freelist_put(struct drm_device * dev, struct drm_buf * buf) | 73 | static int i810_freelist_put(struct drm_device *dev, struct drm_buf *buf) |
75 | { | 74 | { |
76 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 75 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
77 | int used; | 76 | int used; |
@@ -121,7 +120,7 @@ static const struct file_operations i810_buffer_fops = { | |||
121 | .fasync = drm_fasync, | 120 | .fasync = drm_fasync, |
122 | }; | 121 | }; |
123 | 122 | ||
124 | static int i810_map_buffer(struct drm_buf * buf, struct drm_file *file_priv) | 123 | static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv) |
125 | { | 124 | { |
126 | struct drm_device *dev = file_priv->minor->dev; | 125 | struct drm_device *dev = file_priv->minor->dev; |
127 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 126 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
@@ -152,7 +151,7 @@ static int i810_map_buffer(struct drm_buf * buf, struct drm_file *file_priv) | |||
152 | return retcode; | 151 | return retcode; |
153 | } | 152 | } |
154 | 153 | ||
155 | static int i810_unmap_buffer(struct drm_buf * buf) | 154 | static int i810_unmap_buffer(struct drm_buf *buf) |
156 | { | 155 | { |
157 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 156 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
158 | int retcode = 0; | 157 | int retcode = 0; |
@@ -172,7 +171,7 @@ static int i810_unmap_buffer(struct drm_buf * buf) | |||
172 | return retcode; | 171 | return retcode; |
173 | } | 172 | } |
174 | 173 | ||
175 | static int i810_dma_get_buffer(struct drm_device * dev, drm_i810_dma_t * d, | 174 | static int i810_dma_get_buffer(struct drm_device *dev, drm_i810_dma_t *d, |
176 | struct drm_file *file_priv) | 175 | struct drm_file *file_priv) |
177 | { | 176 | { |
178 | struct drm_buf *buf; | 177 | struct drm_buf *buf; |
@@ -202,7 +201,7 @@ static int i810_dma_get_buffer(struct drm_device * dev, drm_i810_dma_t * d, | |||
202 | return retcode; | 201 | return retcode; |
203 | } | 202 | } |
204 | 203 | ||
205 | static int i810_dma_cleanup(struct drm_device * dev) | 204 | static int i810_dma_cleanup(struct drm_device *dev) |
206 | { | 205 | { |
207 | struct drm_device_dma *dma = dev->dma; | 206 | struct drm_device_dma *dma = dev->dma; |
208 | 207 | ||
@@ -218,9 +217,8 @@ static int i810_dma_cleanup(struct drm_device * dev) | |||
218 | drm_i810_private_t *dev_priv = | 217 | drm_i810_private_t *dev_priv = |
219 | (drm_i810_private_t *) dev->dev_private; | 218 | (drm_i810_private_t *) dev->dev_private; |
220 | 219 | ||
221 | if (dev_priv->ring.virtual_start) { | 220 | if (dev_priv->ring.virtual_start) |
222 | drm_core_ioremapfree(&dev_priv->ring.map, dev); | 221 | drm_core_ioremapfree(&dev_priv->ring.map, dev); |
223 | } | ||
224 | if (dev_priv->hw_status_page) { | 222 | if (dev_priv->hw_status_page) { |
225 | pci_free_consistent(dev->pdev, PAGE_SIZE, | 223 | pci_free_consistent(dev->pdev, PAGE_SIZE, |
226 | dev_priv->hw_status_page, | 224 | dev_priv->hw_status_page, |
@@ -242,7 +240,7 @@ static int i810_dma_cleanup(struct drm_device * dev) | |||
242 | return 0; | 240 | return 0; |
243 | } | 241 | } |
244 | 242 | ||
245 | static int i810_wait_ring(struct drm_device * dev, int n) | 243 | static int i810_wait_ring(struct drm_device *dev, int n) |
246 | { | 244 | { |
247 | drm_i810_private_t *dev_priv = dev->dev_private; | 245 | drm_i810_private_t *dev_priv = dev->dev_private; |
248 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); | 246 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); |
@@ -271,11 +269,11 @@ static int i810_wait_ring(struct drm_device * dev, int n) | |||
271 | udelay(1); | 269 | udelay(1); |
272 | } | 270 | } |
273 | 271 | ||
274 | out_wait_ring: | 272 | out_wait_ring: |
275 | return iters; | 273 | return iters; |
276 | } | 274 | } |
277 | 275 | ||
278 | static void i810_kernel_lost_context(struct drm_device * dev) | 276 | static void i810_kernel_lost_context(struct drm_device *dev) |
279 | { | 277 | { |
280 | drm_i810_private_t *dev_priv = dev->dev_private; | 278 | drm_i810_private_t *dev_priv = dev->dev_private; |
281 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); | 279 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); |
@@ -287,7 +285,7 @@ static void i810_kernel_lost_context(struct drm_device * dev) | |||
287 | ring->space += ring->Size; | 285 | ring->space += ring->Size; |
288 | } | 286 | } |
289 | 287 | ||
290 | static int i810_freelist_init(struct drm_device * dev, drm_i810_private_t * dev_priv) | 288 | static int i810_freelist_init(struct drm_device *dev, drm_i810_private_t *dev_priv) |
291 | { | 289 | { |
292 | struct drm_device_dma *dma = dev->dma; | 290 | struct drm_device_dma *dma = dev->dma; |
293 | int my_idx = 24; | 291 | int my_idx = 24; |
@@ -322,9 +320,9 @@ static int i810_freelist_init(struct drm_device * dev, drm_i810_private_t * dev_ | |||
322 | return 0; | 320 | return 0; |
323 | } | 321 | } |
324 | 322 | ||
325 | static int i810_dma_initialize(struct drm_device * dev, | 323 | static int i810_dma_initialize(struct drm_device *dev, |
326 | drm_i810_private_t * dev_priv, | 324 | drm_i810_private_t *dev_priv, |
327 | drm_i810_init_t * init) | 325 | drm_i810_init_t *init) |
328 | { | 326 | { |
329 | struct drm_map_list *r_list; | 327 | struct drm_map_list *r_list; |
330 | memset(dev_priv, 0, sizeof(drm_i810_private_t)); | 328 | memset(dev_priv, 0, sizeof(drm_i810_private_t)); |
@@ -462,7 +460,7 @@ static int i810_dma_init(struct drm_device *dev, void *data, | |||
462 | * Use 'volatile' & local var tmp to force the emitted values to be | 460 | * Use 'volatile' & local var tmp to force the emitted values to be |
463 | * identical to the verified ones. | 461 | * identical to the verified ones. |
464 | */ | 462 | */ |
465 | static void i810EmitContextVerified(struct drm_device * dev, | 463 | static void i810EmitContextVerified(struct drm_device *dev, |
466 | volatile unsigned int *code) | 464 | volatile unsigned int *code) |
467 | { | 465 | { |
468 | drm_i810_private_t *dev_priv = dev->dev_private; | 466 | drm_i810_private_t *dev_priv = dev->dev_private; |
@@ -495,7 +493,7 @@ static void i810EmitContextVerified(struct drm_device * dev, | |||
495 | ADVANCE_LP_RING(); | 493 | ADVANCE_LP_RING(); |
496 | } | 494 | } |
497 | 495 | ||
498 | static void i810EmitTexVerified(struct drm_device * dev, volatile unsigned int *code) | 496 | static void i810EmitTexVerified(struct drm_device *dev, volatile unsigned int *code) |
499 | { | 497 | { |
500 | drm_i810_private_t *dev_priv = dev->dev_private; | 498 | drm_i810_private_t *dev_priv = dev->dev_private; |
501 | int i, j = 0; | 499 | int i, j = 0; |
@@ -528,7 +526,7 @@ static void i810EmitTexVerified(struct drm_device * dev, volatile unsigned int * | |||
528 | 526 | ||
529 | /* Need to do some additional checking when setting the dest buffer. | 527 | /* Need to do some additional checking when setting the dest buffer. |
530 | */ | 528 | */ |
531 | static void i810EmitDestVerified(struct drm_device * dev, | 529 | static void i810EmitDestVerified(struct drm_device *dev, |
532 | volatile unsigned int *code) | 530 | volatile unsigned int *code) |
533 | { | 531 | { |
534 | drm_i810_private_t *dev_priv = dev->dev_private; | 532 | drm_i810_private_t *dev_priv = dev->dev_private; |
@@ -563,7 +561,7 @@ static void i810EmitDestVerified(struct drm_device * dev, | |||
563 | ADVANCE_LP_RING(); | 561 | ADVANCE_LP_RING(); |
564 | } | 562 | } |
565 | 563 | ||
566 | static void i810EmitState(struct drm_device * dev) | 564 | static void i810EmitState(struct drm_device *dev) |
567 | { | 565 | { |
568 | drm_i810_private_t *dev_priv = dev->dev_private; | 566 | drm_i810_private_t *dev_priv = dev->dev_private; |
569 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; | 567 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; |
@@ -594,7 +592,7 @@ static void i810EmitState(struct drm_device * dev) | |||
594 | 592 | ||
595 | /* need to verify | 593 | /* need to verify |
596 | */ | 594 | */ |
597 | static void i810_dma_dispatch_clear(struct drm_device * dev, int flags, | 595 | static void i810_dma_dispatch_clear(struct drm_device *dev, int flags, |
598 | unsigned int clear_color, | 596 | unsigned int clear_color, |
599 | unsigned int clear_zval) | 597 | unsigned int clear_zval) |
600 | { | 598 | { |
@@ -669,7 +667,7 @@ static void i810_dma_dispatch_clear(struct drm_device * dev, int flags, | |||
669 | } | 667 | } |
670 | } | 668 | } |
671 | 669 | ||
672 | static void i810_dma_dispatch_swap(struct drm_device * dev) | 670 | static void i810_dma_dispatch_swap(struct drm_device *dev) |
673 | { | 671 | { |
674 | drm_i810_private_t *dev_priv = dev->dev_private; | 672 | drm_i810_private_t *dev_priv = dev->dev_private; |
675 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; | 673 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; |
@@ -715,8 +713,8 @@ static void i810_dma_dispatch_swap(struct drm_device * dev) | |||
715 | } | 713 | } |
716 | } | 714 | } |
717 | 715 | ||
718 | static void i810_dma_dispatch_vertex(struct drm_device * dev, | 716 | static void i810_dma_dispatch_vertex(struct drm_device *dev, |
719 | struct drm_buf * buf, int discard, int used) | 717 | struct drm_buf *buf, int discard, int used) |
720 | { | 718 | { |
721 | drm_i810_private_t *dev_priv = dev->dev_private; | 719 | drm_i810_private_t *dev_priv = dev->dev_private; |
722 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 720 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
@@ -795,7 +793,7 @@ static void i810_dma_dispatch_vertex(struct drm_device * dev, | |||
795 | } | 793 | } |
796 | } | 794 | } |
797 | 795 | ||
798 | static void i810_dma_dispatch_flip(struct drm_device * dev) | 796 | static void i810_dma_dispatch_flip(struct drm_device *dev) |
799 | { | 797 | { |
800 | drm_i810_private_t *dev_priv = dev->dev_private; | 798 | drm_i810_private_t *dev_priv = dev->dev_private; |
801 | int pitch = dev_priv->pitch; | 799 | int pitch = dev_priv->pitch; |
@@ -841,7 +839,7 @@ static void i810_dma_dispatch_flip(struct drm_device * dev) | |||
841 | 839 | ||
842 | } | 840 | } |
843 | 841 | ||
844 | static void i810_dma_quiescent(struct drm_device * dev) | 842 | static void i810_dma_quiescent(struct drm_device *dev) |
845 | { | 843 | { |
846 | drm_i810_private_t *dev_priv = dev->dev_private; | 844 | drm_i810_private_t *dev_priv = dev->dev_private; |
847 | RING_LOCALS; | 845 | RING_LOCALS; |
@@ -858,7 +856,7 @@ static void i810_dma_quiescent(struct drm_device * dev) | |||
858 | i810_wait_ring(dev, dev_priv->ring.Size - 8); | 856 | i810_wait_ring(dev, dev_priv->ring.Size - 8); |
859 | } | 857 | } |
860 | 858 | ||
861 | static int i810_flush_queue(struct drm_device * dev) | 859 | static int i810_flush_queue(struct drm_device *dev) |
862 | { | 860 | { |
863 | drm_i810_private_t *dev_priv = dev->dev_private; | 861 | drm_i810_private_t *dev_priv = dev->dev_private; |
864 | struct drm_device_dma *dma = dev->dma; | 862 | struct drm_device_dma *dma = dev->dma; |
@@ -891,7 +889,7 @@ static int i810_flush_queue(struct drm_device * dev) | |||
891 | } | 889 | } |
892 | 890 | ||
893 | /* Must be called with the lock held */ | 891 | /* Must be called with the lock held */ |
894 | static void i810_reclaim_buffers(struct drm_device * dev, | 892 | static void i810_reclaim_buffers(struct drm_device *dev, |
895 | struct drm_file *file_priv) | 893 | struct drm_file *file_priv) |
896 | { | 894 | { |
897 | struct drm_device_dma *dma = dev->dma; | 895 | struct drm_device_dma *dma = dev->dma; |
@@ -969,9 +967,8 @@ static int i810_clear_bufs(struct drm_device *dev, void *data, | |||
969 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 967 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
970 | 968 | ||
971 | /* GH: Someone's doing nasty things... */ | 969 | /* GH: Someone's doing nasty things... */ |
972 | if (!dev->dev_private) { | 970 | if (!dev->dev_private) |
973 | return -EINVAL; | 971 | return -EINVAL; |
974 | } | ||
975 | 972 | ||
976 | i810_dma_dispatch_clear(dev, clear->flags, | 973 | i810_dma_dispatch_clear(dev, clear->flags, |
977 | clear->clear_color, clear->clear_depth); | 974 | clear->clear_color, clear->clear_depth); |
@@ -1039,7 +1036,7 @@ static int i810_docopy(struct drm_device *dev, void *data, | |||
1039 | return 0; | 1036 | return 0; |
1040 | } | 1037 | } |
1041 | 1038 | ||
1042 | static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, int used, | 1039 | static void i810_dma_dispatch_mc(struct drm_device *dev, struct drm_buf *buf, int used, |
1043 | unsigned int last_render) | 1040 | unsigned int last_render) |
1044 | { | 1041 | { |
1045 | drm_i810_private_t *dev_priv = dev->dev_private; | 1042 | drm_i810_private_t *dev_priv = dev->dev_private; |
@@ -1053,9 +1050,8 @@ static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, | |||
1053 | i810_kernel_lost_context(dev); | 1050 | i810_kernel_lost_context(dev); |
1054 | 1051 | ||
1055 | u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_HARDWARE); | 1052 | u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_HARDWARE); |
1056 | if (u != I810_BUF_CLIENT) { | 1053 | if (u != I810_BUF_CLIENT) |
1057 | DRM_DEBUG("MC found buffer that isn't mine!\n"); | 1054 | DRM_DEBUG("MC found buffer that isn't mine!\n"); |
1058 | } | ||
1059 | 1055 | ||
1060 | if (used > 4 * 1024) | 1056 | if (used > 4 * 1024) |
1061 | used = 0; | 1057 | used = 0; |
@@ -1160,7 +1156,7 @@ static int i810_ov0_flip(struct drm_device *dev, void *data, | |||
1160 | 1156 | ||
1161 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1157 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1162 | 1158 | ||
1163 | //Tell the overlay to update | 1159 | /* Tell the overlay to update */ |
1164 | I810_WRITE(0x30000, dev_priv->overlay_physical | 0x80000000); | 1160 | I810_WRITE(0x30000, dev_priv->overlay_physical | 0x80000000); |
1165 | 1161 | ||
1166 | return 0; | 1162 | return 0; |
@@ -1168,7 +1164,7 @@ static int i810_ov0_flip(struct drm_device *dev, void *data, | |||
1168 | 1164 | ||
1169 | /* Not sure why this isn't set all the time: | 1165 | /* Not sure why this isn't set all the time: |
1170 | */ | 1166 | */ |
1171 | static void i810_do_init_pageflip(struct drm_device * dev) | 1167 | static void i810_do_init_pageflip(struct drm_device *dev) |
1172 | { | 1168 | { |
1173 | drm_i810_private_t *dev_priv = dev->dev_private; | 1169 | drm_i810_private_t *dev_priv = dev->dev_private; |
1174 | 1170 | ||
@@ -1178,7 +1174,7 @@ static void i810_do_init_pageflip(struct drm_device * dev) | |||
1178 | dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; | 1174 | dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; |
1179 | } | 1175 | } |
1180 | 1176 | ||
1181 | static int i810_do_cleanup_pageflip(struct drm_device * dev) | 1177 | static int i810_do_cleanup_pageflip(struct drm_device *dev) |
1182 | { | 1178 | { |
1183 | drm_i810_private_t *dev_priv = dev->dev_private; | 1179 | drm_i810_private_t *dev_priv = dev->dev_private; |
1184 | 1180 | ||
@@ -1218,28 +1214,27 @@ int i810_driver_load(struct drm_device *dev, unsigned long flags) | |||
1218 | return 0; | 1214 | return 0; |
1219 | } | 1215 | } |
1220 | 1216 | ||
1221 | void i810_driver_lastclose(struct drm_device * dev) | 1217 | void i810_driver_lastclose(struct drm_device *dev) |
1222 | { | 1218 | { |
1223 | i810_dma_cleanup(dev); | 1219 | i810_dma_cleanup(dev); |
1224 | } | 1220 | } |
1225 | 1221 | ||
1226 | void i810_driver_preclose(struct drm_device * dev, struct drm_file *file_priv) | 1222 | void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv) |
1227 | { | 1223 | { |
1228 | if (dev->dev_private) { | 1224 | if (dev->dev_private) { |
1229 | drm_i810_private_t *dev_priv = dev->dev_private; | 1225 | drm_i810_private_t *dev_priv = dev->dev_private; |
1230 | if (dev_priv->page_flipping) { | 1226 | if (dev_priv->page_flipping) |
1231 | i810_do_cleanup_pageflip(dev); | 1227 | i810_do_cleanup_pageflip(dev); |
1232 | } | ||
1233 | } | 1228 | } |
1234 | } | 1229 | } |
1235 | 1230 | ||
1236 | void i810_driver_reclaim_buffers_locked(struct drm_device * dev, | 1231 | void i810_driver_reclaim_buffers_locked(struct drm_device *dev, |
1237 | struct drm_file *file_priv) | 1232 | struct drm_file *file_priv) |
1238 | { | 1233 | { |
1239 | i810_reclaim_buffers(dev, file_priv); | 1234 | i810_reclaim_buffers(dev, file_priv); |
1240 | } | 1235 | } |
1241 | 1236 | ||
1242 | int i810_driver_dma_quiescent(struct drm_device * dev) | 1237 | int i810_driver_dma_quiescent(struct drm_device *dev) |
1243 | { | 1238 | { |
1244 | i810_dma_quiescent(dev); | 1239 | i810_dma_quiescent(dev); |
1245 | return 0; | 1240 | return 0; |
@@ -1276,7 +1271,7 @@ int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); | |||
1276 | * \returns | 1271 | * \returns |
1277 | * A value of 1 is always retured to indictate every i810 is AGP. | 1272 | * A value of 1 is always retured to indictate every i810 is AGP. |
1278 | */ | 1273 | */ |
1279 | int i810_driver_device_is_agp(struct drm_device * dev) | 1274 | int i810_driver_device_is_agp(struct drm_device *dev) |
1280 | { | 1275 | { |
1281 | return 1; | 1276 | return 1; |
1282 | } | 1277 | } |
diff --git a/drivers/gpu/drm/i810/i810_drv.h b/drivers/gpu/drm/i810/i810_drv.h index 21e2691f28f9..0743fe90f1e3 100644 --- a/drivers/gpu/drm/i810/i810_drv.h +++ b/drivers/gpu/drm/i810/i810_drv.h | |||
@@ -115,16 +115,16 @@ typedef struct drm_i810_private { | |||
115 | } drm_i810_private_t; | 115 | } drm_i810_private_t; |
116 | 116 | ||
117 | /* i810_dma.c */ | 117 | /* i810_dma.c */ |
118 | extern int i810_driver_dma_quiescent(struct drm_device * dev); | 118 | extern int i810_driver_dma_quiescent(struct drm_device *dev); |
119 | extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev, | 119 | extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev, |
120 | struct drm_file *file_priv); | 120 | struct drm_file *file_priv); |
121 | extern int i810_driver_load(struct drm_device *, unsigned long flags); | 121 | extern int i810_driver_load(struct drm_device *, unsigned long flags); |
122 | extern void i810_driver_lastclose(struct drm_device * dev); | 122 | extern void i810_driver_lastclose(struct drm_device *dev); |
123 | extern void i810_driver_preclose(struct drm_device * dev, | 123 | extern void i810_driver_preclose(struct drm_device *dev, |
124 | struct drm_file *file_priv); | 124 | struct drm_file *file_priv); |
125 | extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev, | 125 | extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev, |
126 | struct drm_file *file_priv); | 126 | struct drm_file *file_priv); |
127 | extern int i810_driver_device_is_agp(struct drm_device * dev); | 127 | extern int i810_driver_device_is_agp(struct drm_device *dev); |
128 | 128 | ||
129 | extern struct drm_ioctl_desc i810_ioctls[]; | 129 | extern struct drm_ioctl_desc i810_ioctls[]; |
130 | extern int i810_max_ioctl; | 130 | extern int i810_max_ioctl; |
@@ -132,39 +132,41 @@ extern int i810_max_ioctl; | |||
132 | #define I810_BASE(reg) ((unsigned long) \ | 132 | #define I810_BASE(reg) ((unsigned long) \ |
133 | dev_priv->mmio_map->handle) | 133 | dev_priv->mmio_map->handle) |
134 | #define I810_ADDR(reg) (I810_BASE(reg) + reg) | 134 | #define I810_ADDR(reg) (I810_BASE(reg) + reg) |
135 | #define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg) | 135 | #define I810_DEREF(reg) (*(__volatile__ int *)I810_ADDR(reg)) |
136 | #define I810_READ(reg) I810_DEREF(reg) | 136 | #define I810_READ(reg) I810_DEREF(reg) |
137 | #define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0) | 137 | #define I810_WRITE(reg, val) do { I810_DEREF(reg) = val; } while (0) |
138 | #define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg) | 138 | #define I810_DEREF16(reg) (*(__volatile__ u16 *)I810_ADDR(reg)) |
139 | #define I810_READ16(reg) I810_DEREF16(reg) | 139 | #define I810_READ16(reg) I810_DEREF16(reg) |
140 | #define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) | 140 | #define I810_WRITE16(reg, val) do { I810_DEREF16(reg) = val; } while (0) |
141 | 141 | ||
142 | #define I810_VERBOSE 0 | 142 | #define I810_VERBOSE 0 |
143 | #define RING_LOCALS unsigned int outring, ringmask; \ | 143 | #define RING_LOCALS unsigned int outring, ringmask; \ |
144 | volatile char *virt; | 144 | volatile char *virt; |
145 | 145 | ||
146 | #define BEGIN_LP_RING(n) do { \ | 146 | #define BEGIN_LP_RING(n) do { \ |
147 | if (I810_VERBOSE) \ | 147 | if (I810_VERBOSE) \ |
148 | DRM_DEBUG("BEGIN_LP_RING(%d)\n", n); \ | 148 | DRM_DEBUG("BEGIN_LP_RING(%d)\n", n); \ |
149 | if (dev_priv->ring.space < n*4) \ | 149 | if (dev_priv->ring.space < n*4) \ |
150 | i810_wait_ring(dev, n*4); \ | 150 | i810_wait_ring(dev, n*4); \ |
151 | dev_priv->ring.space -= n*4; \ | 151 | dev_priv->ring.space -= n*4; \ |
152 | outring = dev_priv->ring.tail; \ | 152 | outring = dev_priv->ring.tail; \ |
153 | ringmask = dev_priv->ring.tail_mask; \ | 153 | ringmask = dev_priv->ring.tail_mask; \ |
154 | virt = dev_priv->ring.virtual_start; \ | 154 | virt = dev_priv->ring.virtual_start; \ |
155 | } while (0) | 155 | } while (0) |
156 | 156 | ||
157 | #define ADVANCE_LP_RING() do { \ | 157 | #define ADVANCE_LP_RING() do { \ |
158 | if (I810_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ | 158 | if (I810_VERBOSE) \ |
159 | DRM_DEBUG("ADVANCE_LP_RING\n"); \ | ||
159 | dev_priv->ring.tail = outring; \ | 160 | dev_priv->ring.tail = outring; \ |
160 | I810_WRITE(LP_RING + RING_TAIL, outring); \ | 161 | I810_WRITE(LP_RING + RING_TAIL, outring); \ |
161 | } while(0) | 162 | } while (0) |
162 | 163 | ||
163 | #define OUT_RING(n) do { \ | 164 | #define OUT_RING(n) do { \ |
164 | if (I810_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ | 165 | if (I810_VERBOSE) \ |
165 | *(volatile unsigned int *)(virt + outring) = n; \ | 166 | DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ |
166 | outring += 4; \ | 167 | *(volatile unsigned int *)(virt + outring) = n; \ |
167 | outring &= ringmask; \ | 168 | outring += 4; \ |
169 | outring &= ringmask; \ | ||
168 | } while (0) | 170 | } while (0) |
169 | 171 | ||
170 | #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) | 172 | #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) |