diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-09 09:09:29 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-09 09:09:29 -0400 |
commit | 054d5c9238f3c577ad51195c3ee7803613f322cc (patch) | |
tree | ff7d9f5c0e0ddf14230ba28f28ef69a2c0a0debf /drivers/gpu/drm/i810 | |
parent | 11e4afb49b7fa1fc8e1ffd850c1806dd86a08204 (diff) | |
parent | 2192482ee5ce5d5d4a6cec0c351b2d3a744606eb (diff) |
Merge branch 'devel-stable' into devel
Diffstat (limited to 'drivers/gpu/drm/i810')
-rw-r--r-- | drivers/gpu/drm/i810/i810_dma.c | 125 | ||||
-rw-r--r-- | drivers/gpu/drm/i810/i810_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i810/i810_drv.h | 65 |
3 files changed, 102 insertions, 90 deletions
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 997d91707ad2..0e6c131313d9 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/interrupt.h> /* For task queue support */ | 37 | #include <linux/interrupt.h> /* For task queue support */ |
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/smp_lock.h> | ||
40 | #include <linux/pagemap.h> | 41 | #include <linux/pagemap.h> |
41 | 42 | ||
42 | #define I810_BUF_FREE 2 | 43 | #define I810_BUF_FREE 2 |
@@ -60,9 +61,8 @@ static struct drm_buf *i810_freelist_get(struct drm_device * dev) | |||
60 | /* In use is already a pointer */ | 61 | /* In use is already a pointer */ |
61 | used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, | 62 | used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, |
62 | I810_BUF_CLIENT); | 63 | I810_BUF_CLIENT); |
63 | if (used == I810_BUF_FREE) { | 64 | if (used == I810_BUF_FREE) |
64 | return buf; | 65 | return buf; |
65 | } | ||
66 | } | 66 | } |
67 | return NULL; | 67 | return NULL; |
68 | } | 68 | } |
@@ -71,7 +71,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. | 71 | * yet, the hardware updates in use for us once its on the ring buffer. |
72 | */ | 72 | */ |
73 | 73 | ||
74 | static int i810_freelist_put(struct drm_device * dev, struct drm_buf * buf) | 74 | static int i810_freelist_put(struct drm_device *dev, struct drm_buf *buf) |
75 | { | 75 | { |
76 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 76 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
77 | int used; | 77 | int used; |
@@ -121,7 +121,7 @@ static const struct file_operations i810_buffer_fops = { | |||
121 | .fasync = drm_fasync, | 121 | .fasync = drm_fasync, |
122 | }; | 122 | }; |
123 | 123 | ||
124 | static int i810_map_buffer(struct drm_buf * buf, struct drm_file *file_priv) | 124 | static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv) |
125 | { | 125 | { |
126 | struct drm_device *dev = file_priv->minor->dev; | 126 | struct drm_device *dev = file_priv->minor->dev; |
127 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 127 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
@@ -152,7 +152,7 @@ static int i810_map_buffer(struct drm_buf * buf, struct drm_file *file_priv) | |||
152 | return retcode; | 152 | return retcode; |
153 | } | 153 | } |
154 | 154 | ||
155 | static int i810_unmap_buffer(struct drm_buf * buf) | 155 | static int i810_unmap_buffer(struct drm_buf *buf) |
156 | { | 156 | { |
157 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 157 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
158 | int retcode = 0; | 158 | int retcode = 0; |
@@ -172,7 +172,7 @@ static int i810_unmap_buffer(struct drm_buf * buf) | |||
172 | return retcode; | 172 | return retcode; |
173 | } | 173 | } |
174 | 174 | ||
175 | static int i810_dma_get_buffer(struct drm_device * dev, drm_i810_dma_t * d, | 175 | static int i810_dma_get_buffer(struct drm_device *dev, drm_i810_dma_t *d, |
176 | struct drm_file *file_priv) | 176 | struct drm_file *file_priv) |
177 | { | 177 | { |
178 | struct drm_buf *buf; | 178 | struct drm_buf *buf; |
@@ -202,7 +202,7 @@ static int i810_dma_get_buffer(struct drm_device * dev, drm_i810_dma_t * d, | |||
202 | return retcode; | 202 | return retcode; |
203 | } | 203 | } |
204 | 204 | ||
205 | static int i810_dma_cleanup(struct drm_device * dev) | 205 | static int i810_dma_cleanup(struct drm_device *dev) |
206 | { | 206 | { |
207 | struct drm_device_dma *dma = dev->dma; | 207 | struct drm_device_dma *dma = dev->dma; |
208 | 208 | ||
@@ -218,9 +218,8 @@ static int i810_dma_cleanup(struct drm_device * dev) | |||
218 | drm_i810_private_t *dev_priv = | 218 | drm_i810_private_t *dev_priv = |
219 | (drm_i810_private_t *) dev->dev_private; | 219 | (drm_i810_private_t *) dev->dev_private; |
220 | 220 | ||
221 | if (dev_priv->ring.virtual_start) { | 221 | if (dev_priv->ring.virtual_start) |
222 | drm_core_ioremapfree(&dev_priv->ring.map, dev); | 222 | drm_core_ioremapfree(&dev_priv->ring.map, dev); |
223 | } | ||
224 | if (dev_priv->hw_status_page) { | 223 | if (dev_priv->hw_status_page) { |
225 | pci_free_consistent(dev->pdev, PAGE_SIZE, | 224 | pci_free_consistent(dev->pdev, PAGE_SIZE, |
226 | dev_priv->hw_status_page, | 225 | dev_priv->hw_status_page, |
@@ -242,7 +241,7 @@ static int i810_dma_cleanup(struct drm_device * dev) | |||
242 | return 0; | 241 | return 0; |
243 | } | 242 | } |
244 | 243 | ||
245 | static int i810_wait_ring(struct drm_device * dev, int n) | 244 | static int i810_wait_ring(struct drm_device *dev, int n) |
246 | { | 245 | { |
247 | drm_i810_private_t *dev_priv = dev->dev_private; | 246 | drm_i810_private_t *dev_priv = dev->dev_private; |
248 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); | 247 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); |
@@ -271,11 +270,11 @@ static int i810_wait_ring(struct drm_device * dev, int n) | |||
271 | udelay(1); | 270 | udelay(1); |
272 | } | 271 | } |
273 | 272 | ||
274 | out_wait_ring: | 273 | out_wait_ring: |
275 | return iters; | 274 | return iters; |
276 | } | 275 | } |
277 | 276 | ||
278 | static void i810_kernel_lost_context(struct drm_device * dev) | 277 | static void i810_kernel_lost_context(struct drm_device *dev) |
279 | { | 278 | { |
280 | drm_i810_private_t *dev_priv = dev->dev_private; | 279 | drm_i810_private_t *dev_priv = dev->dev_private; |
281 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); | 280 | drm_i810_ring_buffer_t *ring = &(dev_priv->ring); |
@@ -287,7 +286,7 @@ static void i810_kernel_lost_context(struct drm_device * dev) | |||
287 | ring->space += ring->Size; | 286 | ring->space += ring->Size; |
288 | } | 287 | } |
289 | 288 | ||
290 | static int i810_freelist_init(struct drm_device * dev, drm_i810_private_t * dev_priv) | 289 | static int i810_freelist_init(struct drm_device *dev, drm_i810_private_t *dev_priv) |
291 | { | 290 | { |
292 | struct drm_device_dma *dma = dev->dma; | 291 | struct drm_device_dma *dma = dev->dma; |
293 | int my_idx = 24; | 292 | int my_idx = 24; |
@@ -322,9 +321,9 @@ static int i810_freelist_init(struct drm_device * dev, drm_i810_private_t * dev_ | |||
322 | return 0; | 321 | return 0; |
323 | } | 322 | } |
324 | 323 | ||
325 | static int i810_dma_initialize(struct drm_device * dev, | 324 | static int i810_dma_initialize(struct drm_device *dev, |
326 | drm_i810_private_t * dev_priv, | 325 | drm_i810_private_t *dev_priv, |
327 | drm_i810_init_t * init) | 326 | drm_i810_init_t *init) |
328 | { | 327 | { |
329 | struct drm_map_list *r_list; | 328 | struct drm_map_list *r_list; |
330 | memset(dev_priv, 0, sizeof(drm_i810_private_t)); | 329 | memset(dev_priv, 0, sizeof(drm_i810_private_t)); |
@@ -462,7 +461,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 | 461 | * Use 'volatile' & local var tmp to force the emitted values to be |
463 | * identical to the verified ones. | 462 | * identical to the verified ones. |
464 | */ | 463 | */ |
465 | static void i810EmitContextVerified(struct drm_device * dev, | 464 | static void i810EmitContextVerified(struct drm_device *dev, |
466 | volatile unsigned int *code) | 465 | volatile unsigned int *code) |
467 | { | 466 | { |
468 | drm_i810_private_t *dev_priv = dev->dev_private; | 467 | drm_i810_private_t *dev_priv = dev->dev_private; |
@@ -495,7 +494,7 @@ static void i810EmitContextVerified(struct drm_device * dev, | |||
495 | ADVANCE_LP_RING(); | 494 | ADVANCE_LP_RING(); |
496 | } | 495 | } |
497 | 496 | ||
498 | static void i810EmitTexVerified(struct drm_device * dev, volatile unsigned int *code) | 497 | static void i810EmitTexVerified(struct drm_device *dev, volatile unsigned int *code) |
499 | { | 498 | { |
500 | drm_i810_private_t *dev_priv = dev->dev_private; | 499 | drm_i810_private_t *dev_priv = dev->dev_private; |
501 | int i, j = 0; | 500 | int i, j = 0; |
@@ -528,7 +527,7 @@ static void i810EmitTexVerified(struct drm_device * dev, volatile unsigned int * | |||
528 | 527 | ||
529 | /* Need to do some additional checking when setting the dest buffer. | 528 | /* Need to do some additional checking when setting the dest buffer. |
530 | */ | 529 | */ |
531 | static void i810EmitDestVerified(struct drm_device * dev, | 530 | static void i810EmitDestVerified(struct drm_device *dev, |
532 | volatile unsigned int *code) | 531 | volatile unsigned int *code) |
533 | { | 532 | { |
534 | drm_i810_private_t *dev_priv = dev->dev_private; | 533 | drm_i810_private_t *dev_priv = dev->dev_private; |
@@ -563,7 +562,7 @@ static void i810EmitDestVerified(struct drm_device * dev, | |||
563 | ADVANCE_LP_RING(); | 562 | ADVANCE_LP_RING(); |
564 | } | 563 | } |
565 | 564 | ||
566 | static void i810EmitState(struct drm_device * dev) | 565 | static void i810EmitState(struct drm_device *dev) |
567 | { | 566 | { |
568 | drm_i810_private_t *dev_priv = dev->dev_private; | 567 | drm_i810_private_t *dev_priv = dev->dev_private; |
569 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; | 568 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; |
@@ -594,7 +593,7 @@ static void i810EmitState(struct drm_device * dev) | |||
594 | 593 | ||
595 | /* need to verify | 594 | /* need to verify |
596 | */ | 595 | */ |
597 | static void i810_dma_dispatch_clear(struct drm_device * dev, int flags, | 596 | static void i810_dma_dispatch_clear(struct drm_device *dev, int flags, |
598 | unsigned int clear_color, | 597 | unsigned int clear_color, |
599 | unsigned int clear_zval) | 598 | unsigned int clear_zval) |
600 | { | 599 | { |
@@ -669,7 +668,7 @@ static void i810_dma_dispatch_clear(struct drm_device * dev, int flags, | |||
669 | } | 668 | } |
670 | } | 669 | } |
671 | 670 | ||
672 | static void i810_dma_dispatch_swap(struct drm_device * dev) | 671 | static void i810_dma_dispatch_swap(struct drm_device *dev) |
673 | { | 672 | { |
674 | drm_i810_private_t *dev_priv = dev->dev_private; | 673 | drm_i810_private_t *dev_priv = dev->dev_private; |
675 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; | 674 | drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; |
@@ -715,8 +714,8 @@ static void i810_dma_dispatch_swap(struct drm_device * dev) | |||
715 | } | 714 | } |
716 | } | 715 | } |
717 | 716 | ||
718 | static void i810_dma_dispatch_vertex(struct drm_device * dev, | 717 | static void i810_dma_dispatch_vertex(struct drm_device *dev, |
719 | struct drm_buf * buf, int discard, int used) | 718 | struct drm_buf *buf, int discard, int used) |
720 | { | 719 | { |
721 | drm_i810_private_t *dev_priv = dev->dev_private; | 720 | drm_i810_private_t *dev_priv = dev->dev_private; |
722 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; | 721 | drm_i810_buf_priv_t *buf_priv = buf->dev_private; |
@@ -795,7 +794,7 @@ static void i810_dma_dispatch_vertex(struct drm_device * dev, | |||
795 | } | 794 | } |
796 | } | 795 | } |
797 | 796 | ||
798 | static void i810_dma_dispatch_flip(struct drm_device * dev) | 797 | static void i810_dma_dispatch_flip(struct drm_device *dev) |
799 | { | 798 | { |
800 | drm_i810_private_t *dev_priv = dev->dev_private; | 799 | drm_i810_private_t *dev_priv = dev->dev_private; |
801 | int pitch = dev_priv->pitch; | 800 | int pitch = dev_priv->pitch; |
@@ -841,7 +840,7 @@ static void i810_dma_dispatch_flip(struct drm_device * dev) | |||
841 | 840 | ||
842 | } | 841 | } |
843 | 842 | ||
844 | static void i810_dma_quiescent(struct drm_device * dev) | 843 | static void i810_dma_quiescent(struct drm_device *dev) |
845 | { | 844 | { |
846 | drm_i810_private_t *dev_priv = dev->dev_private; | 845 | drm_i810_private_t *dev_priv = dev->dev_private; |
847 | RING_LOCALS; | 846 | RING_LOCALS; |
@@ -858,7 +857,7 @@ static void i810_dma_quiescent(struct drm_device * dev) | |||
858 | i810_wait_ring(dev, dev_priv->ring.Size - 8); | 857 | i810_wait_ring(dev, dev_priv->ring.Size - 8); |
859 | } | 858 | } |
860 | 859 | ||
861 | static int i810_flush_queue(struct drm_device * dev) | 860 | static int i810_flush_queue(struct drm_device *dev) |
862 | { | 861 | { |
863 | drm_i810_private_t *dev_priv = dev->dev_private; | 862 | drm_i810_private_t *dev_priv = dev->dev_private; |
864 | struct drm_device_dma *dma = dev->dma; | 863 | struct drm_device_dma *dma = dev->dma; |
@@ -891,7 +890,7 @@ static int i810_flush_queue(struct drm_device * dev) | |||
891 | } | 890 | } |
892 | 891 | ||
893 | /* Must be called with the lock held */ | 892 | /* Must be called with the lock held */ |
894 | static void i810_reclaim_buffers(struct drm_device * dev, | 893 | static void i810_reclaim_buffers(struct drm_device *dev, |
895 | struct drm_file *file_priv) | 894 | struct drm_file *file_priv) |
896 | { | 895 | { |
897 | struct drm_device_dma *dma = dev->dma; | 896 | struct drm_device_dma *dma = dev->dma; |
@@ -969,9 +968,8 @@ static int i810_clear_bufs(struct drm_device *dev, void *data, | |||
969 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 968 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
970 | 969 | ||
971 | /* GH: Someone's doing nasty things... */ | 970 | /* GH: Someone's doing nasty things... */ |
972 | if (!dev->dev_private) { | 971 | if (!dev->dev_private) |
973 | return -EINVAL; | 972 | return -EINVAL; |
974 | } | ||
975 | 973 | ||
976 | i810_dma_dispatch_clear(dev, clear->flags, | 974 | i810_dma_dispatch_clear(dev, clear->flags, |
977 | clear->clear_color, clear->clear_depth); | 975 | clear->clear_color, clear->clear_depth); |
@@ -1039,7 +1037,7 @@ static int i810_docopy(struct drm_device *dev, void *data, | |||
1039 | return 0; | 1037 | return 0; |
1040 | } | 1038 | } |
1041 | 1039 | ||
1042 | static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, int used, | 1040 | static void i810_dma_dispatch_mc(struct drm_device *dev, struct drm_buf *buf, int used, |
1043 | unsigned int last_render) | 1041 | unsigned int last_render) |
1044 | { | 1042 | { |
1045 | drm_i810_private_t *dev_priv = dev->dev_private; | 1043 | drm_i810_private_t *dev_priv = dev->dev_private; |
@@ -1053,9 +1051,8 @@ static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, | |||
1053 | i810_kernel_lost_context(dev); | 1051 | i810_kernel_lost_context(dev); |
1054 | 1052 | ||
1055 | u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_HARDWARE); | 1053 | u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_HARDWARE); |
1056 | if (u != I810_BUF_CLIENT) { | 1054 | if (u != I810_BUF_CLIENT) |
1057 | DRM_DEBUG("MC found buffer that isn't mine!\n"); | 1055 | DRM_DEBUG("MC found buffer that isn't mine!\n"); |
1058 | } | ||
1059 | 1056 | ||
1060 | if (used > 4 * 1024) | 1057 | if (used > 4 * 1024) |
1061 | used = 0; | 1058 | used = 0; |
@@ -1160,7 +1157,7 @@ static int i810_ov0_flip(struct drm_device *dev, void *data, | |||
1160 | 1157 | ||
1161 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1158 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1162 | 1159 | ||
1163 | //Tell the overlay to update | 1160 | /* Tell the overlay to update */ |
1164 | I810_WRITE(0x30000, dev_priv->overlay_physical | 0x80000000); | 1161 | I810_WRITE(0x30000, dev_priv->overlay_physical | 0x80000000); |
1165 | 1162 | ||
1166 | return 0; | 1163 | return 0; |
@@ -1168,7 +1165,7 @@ static int i810_ov0_flip(struct drm_device *dev, void *data, | |||
1168 | 1165 | ||
1169 | /* Not sure why this isn't set all the time: | 1166 | /* Not sure why this isn't set all the time: |
1170 | */ | 1167 | */ |
1171 | static void i810_do_init_pageflip(struct drm_device * dev) | 1168 | static void i810_do_init_pageflip(struct drm_device *dev) |
1172 | { | 1169 | { |
1173 | drm_i810_private_t *dev_priv = dev->dev_private; | 1170 | drm_i810_private_t *dev_priv = dev->dev_private; |
1174 | 1171 | ||
@@ -1178,7 +1175,7 @@ static void i810_do_init_pageflip(struct drm_device * dev) | |||
1178 | dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; | 1175 | dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; |
1179 | } | 1176 | } |
1180 | 1177 | ||
1181 | static int i810_do_cleanup_pageflip(struct drm_device * dev) | 1178 | static int i810_do_cleanup_pageflip(struct drm_device *dev) |
1182 | { | 1179 | { |
1183 | drm_i810_private_t *dev_priv = dev->dev_private; | 1180 | drm_i810_private_t *dev_priv = dev->dev_private; |
1184 | 1181 | ||
@@ -1218,49 +1215,61 @@ int i810_driver_load(struct drm_device *dev, unsigned long flags) | |||
1218 | return 0; | 1215 | return 0; |
1219 | } | 1216 | } |
1220 | 1217 | ||
1221 | void i810_driver_lastclose(struct drm_device * dev) | 1218 | void i810_driver_lastclose(struct drm_device *dev) |
1222 | { | 1219 | { |
1223 | i810_dma_cleanup(dev); | 1220 | i810_dma_cleanup(dev); |
1224 | } | 1221 | } |
1225 | 1222 | ||
1226 | void i810_driver_preclose(struct drm_device * dev, struct drm_file *file_priv) | 1223 | void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv) |
1227 | { | 1224 | { |
1228 | if (dev->dev_private) { | 1225 | if (dev->dev_private) { |
1229 | drm_i810_private_t *dev_priv = dev->dev_private; | 1226 | drm_i810_private_t *dev_priv = dev->dev_private; |
1230 | if (dev_priv->page_flipping) { | 1227 | if (dev_priv->page_flipping) |
1231 | i810_do_cleanup_pageflip(dev); | 1228 | i810_do_cleanup_pageflip(dev); |
1232 | } | ||
1233 | } | 1229 | } |
1234 | } | 1230 | } |
1235 | 1231 | ||
1236 | void i810_driver_reclaim_buffers_locked(struct drm_device * dev, | 1232 | void i810_driver_reclaim_buffers_locked(struct drm_device *dev, |
1237 | struct drm_file *file_priv) | 1233 | struct drm_file *file_priv) |
1238 | { | 1234 | { |
1239 | i810_reclaim_buffers(dev, file_priv); | 1235 | i810_reclaim_buffers(dev, file_priv); |
1240 | } | 1236 | } |
1241 | 1237 | ||
1242 | int i810_driver_dma_quiescent(struct drm_device * dev) | 1238 | int i810_driver_dma_quiescent(struct drm_device *dev) |
1243 | { | 1239 | { |
1244 | i810_dma_quiescent(dev); | 1240 | i810_dma_quiescent(dev); |
1245 | return 0; | 1241 | return 0; |
1246 | } | 1242 | } |
1247 | 1243 | ||
1244 | /* | ||
1245 | * call the drm_ioctl under the big kernel lock because | ||
1246 | * to lock against the i810_mmap_buffers function. | ||
1247 | */ | ||
1248 | long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
1249 | { | ||
1250 | int ret; | ||
1251 | lock_kernel(); | ||
1252 | ret = drm_ioctl(file, cmd, arg); | ||
1253 | unlock_kernel(); | ||
1254 | return ret; | ||
1255 | } | ||
1256 | |||
1248 | struct drm_ioctl_desc i810_ioctls[] = { | 1257 | struct drm_ioctl_desc i810_ioctls[] = { |
1249 | DRM_IOCTL_DEF(DRM_I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 1258 | DRM_IOCTL_DEF(DRM_I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED), |
1250 | DRM_IOCTL_DEF(DRM_I810_VERTEX, i810_dma_vertex, DRM_AUTH), | 1259 | DRM_IOCTL_DEF(DRM_I810_VERTEX, i810_dma_vertex, DRM_AUTH|DRM_UNLOCKED), |
1251 | DRM_IOCTL_DEF(DRM_I810_CLEAR, i810_clear_bufs, DRM_AUTH), | 1260 | DRM_IOCTL_DEF(DRM_I810_CLEAR, i810_clear_bufs, DRM_AUTH|DRM_UNLOCKED), |
1252 | DRM_IOCTL_DEF(DRM_I810_FLUSH, i810_flush_ioctl, DRM_AUTH), | 1261 | DRM_IOCTL_DEF(DRM_I810_FLUSH, i810_flush_ioctl, DRM_AUTH|DRM_UNLOCKED), |
1253 | DRM_IOCTL_DEF(DRM_I810_GETAGE, i810_getage, DRM_AUTH), | 1262 | DRM_IOCTL_DEF(DRM_I810_GETAGE, i810_getage, DRM_AUTH|DRM_UNLOCKED), |
1254 | DRM_IOCTL_DEF(DRM_I810_GETBUF, i810_getbuf, DRM_AUTH), | 1263 | DRM_IOCTL_DEF(DRM_I810_GETBUF, i810_getbuf, DRM_AUTH|DRM_UNLOCKED), |
1255 | DRM_IOCTL_DEF(DRM_I810_SWAP, i810_swap_bufs, DRM_AUTH), | 1264 | DRM_IOCTL_DEF(DRM_I810_SWAP, i810_swap_bufs, DRM_AUTH|DRM_UNLOCKED), |
1256 | DRM_IOCTL_DEF(DRM_I810_COPY, i810_copybuf, DRM_AUTH), | 1265 | DRM_IOCTL_DEF(DRM_I810_COPY, i810_copybuf, DRM_AUTH|DRM_UNLOCKED), |
1257 | DRM_IOCTL_DEF(DRM_I810_DOCOPY, i810_docopy, DRM_AUTH), | 1266 | DRM_IOCTL_DEF(DRM_I810_DOCOPY, i810_docopy, DRM_AUTH|DRM_UNLOCKED), |
1258 | DRM_IOCTL_DEF(DRM_I810_OV0INFO, i810_ov0_info, DRM_AUTH), | 1267 | DRM_IOCTL_DEF(DRM_I810_OV0INFO, i810_ov0_info, DRM_AUTH|DRM_UNLOCKED), |
1259 | DRM_IOCTL_DEF(DRM_I810_FSTATUS, i810_fstatus, DRM_AUTH), | 1268 | DRM_IOCTL_DEF(DRM_I810_FSTATUS, i810_fstatus, DRM_AUTH|DRM_UNLOCKED), |
1260 | DRM_IOCTL_DEF(DRM_I810_OV0FLIP, i810_ov0_flip, DRM_AUTH), | 1269 | DRM_IOCTL_DEF(DRM_I810_OV0FLIP, i810_ov0_flip, DRM_AUTH|DRM_UNLOCKED), |
1261 | DRM_IOCTL_DEF(DRM_I810_MC, i810_dma_mc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 1270 | DRM_IOCTL_DEF(DRM_I810_MC, i810_dma_mc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED), |
1262 | DRM_IOCTL_DEF(DRM_I810_RSTATUS, i810_rstatus, DRM_AUTH), | 1271 | DRM_IOCTL_DEF(DRM_I810_RSTATUS, i810_rstatus, DRM_AUTH|DRM_UNLOCKED), |
1263 | DRM_IOCTL_DEF(DRM_I810_FLIP, i810_flip_bufs, DRM_AUTH) | 1272 | DRM_IOCTL_DEF(DRM_I810_FLIP, i810_flip_bufs, DRM_AUTH|DRM_UNLOCKED), |
1264 | }; | 1273 | }; |
1265 | 1274 | ||
1266 | int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); | 1275 | int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); |
@@ -1276,7 +1285,7 @@ int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); | |||
1276 | * \returns | 1285 | * \returns |
1277 | * A value of 1 is always retured to indictate every i810 is AGP. | 1286 | * A value of 1 is always retured to indictate every i810 is AGP. |
1278 | */ | 1287 | */ |
1279 | int i810_driver_device_is_agp(struct drm_device * dev) | 1288 | int i810_driver_device_is_agp(struct drm_device *dev) |
1280 | { | 1289 | { |
1281 | return 1; | 1290 | return 1; |
1282 | } | 1291 | } |
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c index c1e02752e023..b4250b2cac1f 100644 --- a/drivers/gpu/drm/i810/i810_drv.c +++ b/drivers/gpu/drm/i810/i810_drv.c | |||
@@ -59,7 +59,7 @@ static struct drm_driver driver = { | |||
59 | .owner = THIS_MODULE, | 59 | .owner = THIS_MODULE, |
60 | .open = drm_open, | 60 | .open = drm_open, |
61 | .release = drm_release, | 61 | .release = drm_release, |
62 | .unlocked_ioctl = drm_ioctl, | 62 | .unlocked_ioctl = i810_ioctl, |
63 | .mmap = drm_mmap, | 63 | .mmap = drm_mmap, |
64 | .poll = drm_poll, | 64 | .poll = drm_poll, |
65 | .fasync = drm_fasync, | 65 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/i810/i810_drv.h b/drivers/gpu/drm/i810/i810_drv.h index 21e2691f28f9..c9339f481795 100644 --- a/drivers/gpu/drm/i810/i810_drv.h +++ b/drivers/gpu/drm/i810/i810_drv.h | |||
@@ -115,56 +115,59 @@ 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 long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | ||
129 | extern struct drm_ioctl_desc i810_ioctls[]; | 130 | extern struct drm_ioctl_desc i810_ioctls[]; |
130 | extern int i810_max_ioctl; | 131 | extern int i810_max_ioctl; |
131 | 132 | ||
132 | #define I810_BASE(reg) ((unsigned long) \ | 133 | #define I810_BASE(reg) ((unsigned long) \ |
133 | dev_priv->mmio_map->handle) | 134 | dev_priv->mmio_map->handle) |
134 | #define I810_ADDR(reg) (I810_BASE(reg) + reg) | 135 | #define I810_ADDR(reg) (I810_BASE(reg) + reg) |
135 | #define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg) | 136 | #define I810_DEREF(reg) (*(__volatile__ int *)I810_ADDR(reg)) |
136 | #define I810_READ(reg) I810_DEREF(reg) | 137 | #define I810_READ(reg) I810_DEREF(reg) |
137 | #define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0) | 138 | #define I810_WRITE(reg, val) do { I810_DEREF(reg) = val; } while (0) |
138 | #define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg) | 139 | #define I810_DEREF16(reg) (*(__volatile__ u16 *)I810_ADDR(reg)) |
139 | #define I810_READ16(reg) I810_DEREF16(reg) | 140 | #define I810_READ16(reg) I810_DEREF16(reg) |
140 | #define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) | 141 | #define I810_WRITE16(reg, val) do { I810_DEREF16(reg) = val; } while (0) |
141 | 142 | ||
142 | #define I810_VERBOSE 0 | 143 | #define I810_VERBOSE 0 |
143 | #define RING_LOCALS unsigned int outring, ringmask; \ | 144 | #define RING_LOCALS unsigned int outring, ringmask; \ |
144 | volatile char *virt; | 145 | volatile char *virt; |
145 | 146 | ||
146 | #define BEGIN_LP_RING(n) do { \ | 147 | #define BEGIN_LP_RING(n) do { \ |
147 | if (I810_VERBOSE) \ | 148 | if (I810_VERBOSE) \ |
148 | DRM_DEBUG("BEGIN_LP_RING(%d)\n", n); \ | 149 | DRM_DEBUG("BEGIN_LP_RING(%d)\n", n); \ |
149 | if (dev_priv->ring.space < n*4) \ | 150 | if (dev_priv->ring.space < n*4) \ |
150 | i810_wait_ring(dev, n*4); \ | 151 | i810_wait_ring(dev, n*4); \ |
151 | dev_priv->ring.space -= n*4; \ | 152 | dev_priv->ring.space -= n*4; \ |
152 | outring = dev_priv->ring.tail; \ | 153 | outring = dev_priv->ring.tail; \ |
153 | ringmask = dev_priv->ring.tail_mask; \ | 154 | ringmask = dev_priv->ring.tail_mask; \ |
154 | virt = dev_priv->ring.virtual_start; \ | 155 | virt = dev_priv->ring.virtual_start; \ |
155 | } while (0) | 156 | } while (0) |
156 | 157 | ||
157 | #define ADVANCE_LP_RING() do { \ | 158 | #define ADVANCE_LP_RING() do { \ |
158 | if (I810_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n"); \ | 159 | if (I810_VERBOSE) \ |
160 | DRM_DEBUG("ADVANCE_LP_RING\n"); \ | ||
159 | dev_priv->ring.tail = outring; \ | 161 | dev_priv->ring.tail = outring; \ |
160 | I810_WRITE(LP_RING + RING_TAIL, outring); \ | 162 | I810_WRITE(LP_RING + RING_TAIL, outring); \ |
161 | } while(0) | 163 | } while (0) |
162 | 164 | ||
163 | #define OUT_RING(n) do { \ | 165 | #define OUT_RING(n) do { \ |
164 | if (I810_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ | 166 | if (I810_VERBOSE) \ |
165 | *(volatile unsigned int *)(virt + outring) = n; \ | 167 | DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \ |
166 | outring += 4; \ | 168 | *(volatile unsigned int *)(virt + outring) = n; \ |
167 | outring &= ringmask; \ | 169 | outring += 4; \ |
170 | outring &= ringmask; \ | ||
168 | } while (0) | 171 | } while (0) |
169 | 172 | ||
170 | #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) | 173 | #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) |