diff options
Diffstat (limited to 'drivers/gpu/drm/r128/r128_state.c')
-rw-r--r-- | drivers/gpu/drm/r128/r128_state.c | 121 |
1 files changed, 53 insertions, 68 deletions
diff --git a/drivers/gpu/drm/r128/r128_state.c b/drivers/gpu/drm/r128/r128_state.c index af2665cf4718..077af1f2f9b4 100644 --- a/drivers/gpu/drm/r128/r128_state.c +++ b/drivers/gpu/drm/r128/r128_state.c | |||
@@ -37,8 +37,8 @@ | |||
37 | * CCE hardware state programming functions | 37 | * CCE hardware state programming functions |
38 | */ | 38 | */ |
39 | 39 | ||
40 | static void r128_emit_clip_rects(drm_r128_private_t * dev_priv, | 40 | static void r128_emit_clip_rects(drm_r128_private_t *dev_priv, |
41 | struct drm_clip_rect * boxes, int count) | 41 | struct drm_clip_rect *boxes, int count) |
42 | { | 42 | { |
43 | u32 aux_sc_cntl = 0x00000000; | 43 | u32 aux_sc_cntl = 0x00000000; |
44 | RING_LOCALS; | 44 | RING_LOCALS; |
@@ -80,7 +80,7 @@ static void r128_emit_clip_rects(drm_r128_private_t * dev_priv, | |||
80 | ADVANCE_RING(); | 80 | ADVANCE_RING(); |
81 | } | 81 | } |
82 | 82 | ||
83 | static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv) | 83 | static __inline__ void r128_emit_core(drm_r128_private_t *dev_priv) |
84 | { | 84 | { |
85 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 85 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
86 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; | 86 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; |
@@ -95,7 +95,7 @@ static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv) | |||
95 | ADVANCE_RING(); | 95 | ADVANCE_RING(); |
96 | } | 96 | } |
97 | 97 | ||
98 | static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv) | 98 | static __inline__ void r128_emit_context(drm_r128_private_t *dev_priv) |
99 | { | 99 | { |
100 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 100 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
101 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; | 101 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; |
@@ -121,7 +121,7 @@ static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv) | |||
121 | ADVANCE_RING(); | 121 | ADVANCE_RING(); |
122 | } | 122 | } |
123 | 123 | ||
124 | static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv) | 124 | static __inline__ void r128_emit_setup(drm_r128_private_t *dev_priv) |
125 | { | 125 | { |
126 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 126 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
127 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; | 127 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; |
@@ -137,7 +137,7 @@ static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv) | |||
137 | ADVANCE_RING(); | 137 | ADVANCE_RING(); |
138 | } | 138 | } |
139 | 139 | ||
140 | static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv) | 140 | static __inline__ void r128_emit_masks(drm_r128_private_t *dev_priv) |
141 | { | 141 | { |
142 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 142 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
143 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; | 143 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; |
@@ -156,7 +156,7 @@ static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv) | |||
156 | ADVANCE_RING(); | 156 | ADVANCE_RING(); |
157 | } | 157 | } |
158 | 158 | ||
159 | static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv) | 159 | static __inline__ void r128_emit_window(drm_r128_private_t *dev_priv) |
160 | { | 160 | { |
161 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 161 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
162 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; | 162 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; |
@@ -171,7 +171,7 @@ static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv) | |||
171 | ADVANCE_RING(); | 171 | ADVANCE_RING(); |
172 | } | 172 | } |
173 | 173 | ||
174 | static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv) | 174 | static __inline__ void r128_emit_tex0(drm_r128_private_t *dev_priv) |
175 | { | 175 | { |
176 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 176 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
177 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; | 177 | drm_r128_context_regs_t *ctx = &sarea_priv->context_state; |
@@ -187,9 +187,8 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv) | |||
187 | OUT_RING(tex->tex_cntl); | 187 | OUT_RING(tex->tex_cntl); |
188 | OUT_RING(tex->tex_combine_cntl); | 188 | OUT_RING(tex->tex_combine_cntl); |
189 | OUT_RING(ctx->tex_size_pitch_c); | 189 | OUT_RING(ctx->tex_size_pitch_c); |
190 | for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) { | 190 | for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) |
191 | OUT_RING(tex->tex_offset[i]); | 191 | OUT_RING(tex->tex_offset[i]); |
192 | } | ||
193 | 192 | ||
194 | OUT_RING(CCE_PACKET0(R128_CONSTANT_COLOR_C, 1)); | 193 | OUT_RING(CCE_PACKET0(R128_CONSTANT_COLOR_C, 1)); |
195 | OUT_RING(ctx->constant_color_c); | 194 | OUT_RING(ctx->constant_color_c); |
@@ -198,7 +197,7 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv) | |||
198 | ADVANCE_RING(); | 197 | ADVANCE_RING(); |
199 | } | 198 | } |
200 | 199 | ||
201 | static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv) | 200 | static __inline__ void r128_emit_tex1(drm_r128_private_t *dev_priv) |
202 | { | 201 | { |
203 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 202 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
204 | drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; | 203 | drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; |
@@ -211,9 +210,8 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv) | |||
211 | OUT_RING(CCE_PACKET0(R128_SEC_TEX_CNTL_C, 1 + R128_MAX_TEXTURE_LEVELS)); | 210 | OUT_RING(CCE_PACKET0(R128_SEC_TEX_CNTL_C, 1 + R128_MAX_TEXTURE_LEVELS)); |
212 | OUT_RING(tex->tex_cntl); | 211 | OUT_RING(tex->tex_cntl); |
213 | OUT_RING(tex->tex_combine_cntl); | 212 | OUT_RING(tex->tex_combine_cntl); |
214 | for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) { | 213 | for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) |
215 | OUT_RING(tex->tex_offset[i]); | 214 | OUT_RING(tex->tex_offset[i]); |
216 | } | ||
217 | 215 | ||
218 | OUT_RING(CCE_PACKET0(R128_SEC_TEXTURE_BORDER_COLOR_C, 0)); | 216 | OUT_RING(CCE_PACKET0(R128_SEC_TEXTURE_BORDER_COLOR_C, 0)); |
219 | OUT_RING(tex->tex_border_color); | 217 | OUT_RING(tex->tex_border_color); |
@@ -221,7 +219,7 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv) | |||
221 | ADVANCE_RING(); | 219 | ADVANCE_RING(); |
222 | } | 220 | } |
223 | 221 | ||
224 | static void r128_emit_state(drm_r128_private_t * dev_priv) | 222 | static void r128_emit_state(drm_r128_private_t *dev_priv) |
225 | { | 223 | { |
226 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 224 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
227 | unsigned int dirty = sarea_priv->dirty; | 225 | unsigned int dirty = sarea_priv->dirty; |
@@ -274,7 +272,7 @@ static void r128_emit_state(drm_r128_private_t * dev_priv) | |||
274 | * Performance monitoring functions | 272 | * Performance monitoring functions |
275 | */ | 273 | */ |
276 | 274 | ||
277 | static void r128_clear_box(drm_r128_private_t * dev_priv, | 275 | static void r128_clear_box(drm_r128_private_t *dev_priv, |
278 | int x, int y, int w, int h, int r, int g, int b) | 276 | int x, int y, int w, int h, int r, int g, int b) |
279 | { | 277 | { |
280 | u32 pitch, offset; | 278 | u32 pitch, offset; |
@@ -321,13 +319,12 @@ static void r128_clear_box(drm_r128_private_t * dev_priv, | |||
321 | ADVANCE_RING(); | 319 | ADVANCE_RING(); |
322 | } | 320 | } |
323 | 321 | ||
324 | static void r128_cce_performance_boxes(drm_r128_private_t * dev_priv) | 322 | static void r128_cce_performance_boxes(drm_r128_private_t *dev_priv) |
325 | { | 323 | { |
326 | if (atomic_read(&dev_priv->idle_count) == 0) { | 324 | if (atomic_read(&dev_priv->idle_count) == 0) |
327 | r128_clear_box(dev_priv, 64, 4, 8, 8, 0, 255, 0); | 325 | r128_clear_box(dev_priv, 64, 4, 8, 8, 0, 255, 0); |
328 | } else { | 326 | else |
329 | atomic_set(&dev_priv->idle_count, 0); | 327 | atomic_set(&dev_priv->idle_count, 0); |
330 | } | ||
331 | } | 328 | } |
332 | 329 | ||
333 | #endif | 330 | #endif |
@@ -352,8 +349,8 @@ static void r128_print_dirty(const char *msg, unsigned int flags) | |||
352 | (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : ""); | 349 | (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : ""); |
353 | } | 350 | } |
354 | 351 | ||
355 | static void r128_cce_dispatch_clear(struct drm_device * dev, | 352 | static void r128_cce_dispatch_clear(struct drm_device *dev, |
356 | drm_r128_clear_t * clear) | 353 | drm_r128_clear_t *clear) |
357 | { | 354 | { |
358 | drm_r128_private_t *dev_priv = dev->dev_private; | 355 | drm_r128_private_t *dev_priv = dev->dev_private; |
359 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 356 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
@@ -458,7 +455,7 @@ static void r128_cce_dispatch_clear(struct drm_device * dev, | |||
458 | } | 455 | } |
459 | } | 456 | } |
460 | 457 | ||
461 | static void r128_cce_dispatch_swap(struct drm_device * dev) | 458 | static void r128_cce_dispatch_swap(struct drm_device *dev) |
462 | { | 459 | { |
463 | drm_r128_private_t *dev_priv = dev->dev_private; | 460 | drm_r128_private_t *dev_priv = dev->dev_private; |
464 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 461 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
@@ -524,7 +521,7 @@ static void r128_cce_dispatch_swap(struct drm_device * dev) | |||
524 | ADVANCE_RING(); | 521 | ADVANCE_RING(); |
525 | } | 522 | } |
526 | 523 | ||
527 | static void r128_cce_dispatch_flip(struct drm_device * dev) | 524 | static void r128_cce_dispatch_flip(struct drm_device *dev) |
528 | { | 525 | { |
529 | drm_r128_private_t *dev_priv = dev->dev_private; | 526 | drm_r128_private_t *dev_priv = dev->dev_private; |
530 | RING_LOCALS; | 527 | RING_LOCALS; |
@@ -542,11 +539,10 @@ static void r128_cce_dispatch_flip(struct drm_device * dev) | |||
542 | R128_WAIT_UNTIL_PAGE_FLIPPED(); | 539 | R128_WAIT_UNTIL_PAGE_FLIPPED(); |
543 | OUT_RING(CCE_PACKET0(R128_CRTC_OFFSET, 0)); | 540 | OUT_RING(CCE_PACKET0(R128_CRTC_OFFSET, 0)); |
544 | 541 | ||
545 | if (dev_priv->current_page == 0) { | 542 | if (dev_priv->current_page == 0) |
546 | OUT_RING(dev_priv->back_offset); | 543 | OUT_RING(dev_priv->back_offset); |
547 | } else { | 544 | else |
548 | OUT_RING(dev_priv->front_offset); | 545 | OUT_RING(dev_priv->front_offset); |
549 | } | ||
550 | 546 | ||
551 | ADVANCE_RING(); | 547 | ADVANCE_RING(); |
552 | 548 | ||
@@ -566,7 +562,7 @@ static void r128_cce_dispatch_flip(struct drm_device * dev) | |||
566 | ADVANCE_RING(); | 562 | ADVANCE_RING(); |
567 | } | 563 | } |
568 | 564 | ||
569 | static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf) | 565 | static void r128_cce_dispatch_vertex(struct drm_device *dev, struct drm_buf *buf) |
570 | { | 566 | { |
571 | drm_r128_private_t *dev_priv = dev->dev_private; | 567 | drm_r128_private_t *dev_priv = dev->dev_private; |
572 | drm_r128_buf_priv_t *buf_priv = buf->dev_private; | 568 | drm_r128_buf_priv_t *buf_priv = buf->dev_private; |
@@ -585,9 +581,8 @@ static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * b | |||
585 | if (buf->used) { | 581 | if (buf->used) { |
586 | buf_priv->dispatched = 1; | 582 | buf_priv->dispatched = 1; |
587 | 583 | ||
588 | if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) { | 584 | if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) |
589 | r128_emit_state(dev_priv); | 585 | r128_emit_state(dev_priv); |
590 | } | ||
591 | 586 | ||
592 | do { | 587 | do { |
593 | /* Emit the next set of up to three cliprects */ | 588 | /* Emit the next set of up to three cliprects */ |
@@ -636,8 +631,8 @@ static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * b | |||
636 | sarea_priv->nbox = 0; | 631 | sarea_priv->nbox = 0; |
637 | } | 632 | } |
638 | 633 | ||
639 | static void r128_cce_dispatch_indirect(struct drm_device * dev, | 634 | static void r128_cce_dispatch_indirect(struct drm_device *dev, |
640 | struct drm_buf * buf, int start, int end) | 635 | struct drm_buf *buf, int start, int end) |
641 | { | 636 | { |
642 | drm_r128_private_t *dev_priv = dev->dev_private; | 637 | drm_r128_private_t *dev_priv = dev->dev_private; |
643 | drm_r128_buf_priv_t *buf_priv = buf->dev_private; | 638 | drm_r128_buf_priv_t *buf_priv = buf->dev_private; |
@@ -691,8 +686,8 @@ static void r128_cce_dispatch_indirect(struct drm_device * dev, | |||
691 | dev_priv->sarea_priv->last_dispatch++; | 686 | dev_priv->sarea_priv->last_dispatch++; |
692 | } | 687 | } |
693 | 688 | ||
694 | static void r128_cce_dispatch_indices(struct drm_device * dev, | 689 | static void r128_cce_dispatch_indices(struct drm_device *dev, |
695 | struct drm_buf * buf, | 690 | struct drm_buf *buf, |
696 | int start, int end, int count) | 691 | int start, int end, int count) |
697 | { | 692 | { |
698 | drm_r128_private_t *dev_priv = dev->dev_private; | 693 | drm_r128_private_t *dev_priv = dev->dev_private; |
@@ -713,9 +708,8 @@ static void r128_cce_dispatch_indices(struct drm_device * dev, | |||
713 | if (start != end) { | 708 | if (start != end) { |
714 | buf_priv->dispatched = 1; | 709 | buf_priv->dispatched = 1; |
715 | 710 | ||
716 | if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) { | 711 | if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) |
717 | r128_emit_state(dev_priv); | 712 | r128_emit_state(dev_priv); |
718 | } | ||
719 | 713 | ||
720 | dwords = (end - start + 3) / sizeof(u32); | 714 | dwords = (end - start + 3) / sizeof(u32); |
721 | 715 | ||
@@ -775,9 +769,9 @@ static void r128_cce_dispatch_indices(struct drm_device * dev, | |||
775 | sarea_priv->nbox = 0; | 769 | sarea_priv->nbox = 0; |
776 | } | 770 | } |
777 | 771 | ||
778 | static int r128_cce_dispatch_blit(struct drm_device * dev, | 772 | static int r128_cce_dispatch_blit(struct drm_device *dev, |
779 | struct drm_file *file_priv, | 773 | struct drm_file *file_priv, |
780 | drm_r128_blit_t * blit) | 774 | drm_r128_blit_t *blit) |
781 | { | 775 | { |
782 | drm_r128_private_t *dev_priv = dev->dev_private; | 776 | drm_r128_private_t *dev_priv = dev->dev_private; |
783 | struct drm_device_dma *dma = dev->dma; | 777 | struct drm_device_dma *dma = dev->dma; |
@@ -887,8 +881,8 @@ static int r128_cce_dispatch_blit(struct drm_device * dev, | |||
887 | * have hardware stencil support. | 881 | * have hardware stencil support. |
888 | */ | 882 | */ |
889 | 883 | ||
890 | static int r128_cce_dispatch_write_span(struct drm_device * dev, | 884 | static int r128_cce_dispatch_write_span(struct drm_device *dev, |
891 | drm_r128_depth_t * depth) | 885 | drm_r128_depth_t *depth) |
892 | { | 886 | { |
893 | drm_r128_private_t *dev_priv = dev->dev_private; | 887 | drm_r128_private_t *dev_priv = dev->dev_private; |
894 | int count, x, y; | 888 | int count, x, y; |
@@ -902,12 +896,10 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev, | |||
902 | if (count > 4096 || count <= 0) | 896 | if (count > 4096 || count <= 0) |
903 | return -EMSGSIZE; | 897 | return -EMSGSIZE; |
904 | 898 | ||
905 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { | 899 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) |
906 | return -EFAULT; | 900 | return -EFAULT; |
907 | } | 901 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) |
908 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { | ||
909 | return -EFAULT; | 902 | return -EFAULT; |
910 | } | ||
911 | 903 | ||
912 | buffer_size = depth->n * sizeof(u32); | 904 | buffer_size = depth->n * sizeof(u32); |
913 | buffer = kmalloc(buffer_size, GFP_KERNEL); | 905 | buffer = kmalloc(buffer_size, GFP_KERNEL); |
@@ -983,8 +975,8 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev, | |||
983 | return 0; | 975 | return 0; |
984 | } | 976 | } |
985 | 977 | ||
986 | static int r128_cce_dispatch_write_pixels(struct drm_device * dev, | 978 | static int r128_cce_dispatch_write_pixels(struct drm_device *dev, |
987 | drm_r128_depth_t * depth) | 979 | drm_r128_depth_t *depth) |
988 | { | 980 | { |
989 | drm_r128_private_t *dev_priv = dev->dev_private; | 981 | drm_r128_private_t *dev_priv = dev->dev_private; |
990 | int count, *x, *y; | 982 | int count, *x, *y; |
@@ -1001,9 +993,8 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, | |||
1001 | xbuf_size = count * sizeof(*x); | 993 | xbuf_size = count * sizeof(*x); |
1002 | ybuf_size = count * sizeof(*y); | 994 | ybuf_size = count * sizeof(*y); |
1003 | x = kmalloc(xbuf_size, GFP_KERNEL); | 995 | x = kmalloc(xbuf_size, GFP_KERNEL); |
1004 | if (x == NULL) { | 996 | if (x == NULL) |
1005 | return -ENOMEM; | 997 | return -ENOMEM; |
1006 | } | ||
1007 | y = kmalloc(ybuf_size, GFP_KERNEL); | 998 | y = kmalloc(ybuf_size, GFP_KERNEL); |
1008 | if (y == NULL) { | 999 | if (y == NULL) { |
1009 | kfree(x); | 1000 | kfree(x); |
@@ -1105,8 +1096,8 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, | |||
1105 | return 0; | 1096 | return 0; |
1106 | } | 1097 | } |
1107 | 1098 | ||
1108 | static int r128_cce_dispatch_read_span(struct drm_device * dev, | 1099 | static int r128_cce_dispatch_read_span(struct drm_device *dev, |
1109 | drm_r128_depth_t * depth) | 1100 | drm_r128_depth_t *depth) |
1110 | { | 1101 | { |
1111 | drm_r128_private_t *dev_priv = dev->dev_private; | 1102 | drm_r128_private_t *dev_priv = dev->dev_private; |
1112 | int count, x, y; | 1103 | int count, x, y; |
@@ -1117,12 +1108,10 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev, | |||
1117 | if (count > 4096 || count <= 0) | 1108 | if (count > 4096 || count <= 0) |
1118 | return -EMSGSIZE; | 1109 | return -EMSGSIZE; |
1119 | 1110 | ||
1120 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { | 1111 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) |
1121 | return -EFAULT; | 1112 | return -EFAULT; |
1122 | } | 1113 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) |
1123 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { | ||
1124 | return -EFAULT; | 1114 | return -EFAULT; |
1125 | } | ||
1126 | 1115 | ||
1127 | BEGIN_RING(7); | 1116 | BEGIN_RING(7); |
1128 | 1117 | ||
@@ -1148,8 +1137,8 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev, | |||
1148 | return 0; | 1137 | return 0; |
1149 | } | 1138 | } |
1150 | 1139 | ||
1151 | static int r128_cce_dispatch_read_pixels(struct drm_device * dev, | 1140 | static int r128_cce_dispatch_read_pixels(struct drm_device *dev, |
1152 | drm_r128_depth_t * depth) | 1141 | drm_r128_depth_t *depth) |
1153 | { | 1142 | { |
1154 | drm_r128_private_t *dev_priv = dev->dev_private; | 1143 | drm_r128_private_t *dev_priv = dev->dev_private; |
1155 | int count, *x, *y; | 1144 | int count, *x, *y; |
@@ -1161,16 +1150,14 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev, | |||
1161 | if (count > 4096 || count <= 0) | 1150 | if (count > 4096 || count <= 0) |
1162 | return -EMSGSIZE; | 1151 | return -EMSGSIZE; |
1163 | 1152 | ||
1164 | if (count > dev_priv->depth_pitch) { | 1153 | if (count > dev_priv->depth_pitch) |
1165 | count = dev_priv->depth_pitch; | 1154 | count = dev_priv->depth_pitch; |
1166 | } | ||
1167 | 1155 | ||
1168 | xbuf_size = count * sizeof(*x); | 1156 | xbuf_size = count * sizeof(*x); |
1169 | ybuf_size = count * sizeof(*y); | 1157 | ybuf_size = count * sizeof(*y); |
1170 | x = kmalloc(xbuf_size, GFP_KERNEL); | 1158 | x = kmalloc(xbuf_size, GFP_KERNEL); |
1171 | if (x == NULL) { | 1159 | if (x == NULL) |
1172 | return -ENOMEM; | 1160 | return -ENOMEM; |
1173 | } | ||
1174 | y = kmalloc(ybuf_size, GFP_KERNEL); | 1161 | y = kmalloc(ybuf_size, GFP_KERNEL); |
1175 | if (y == NULL) { | 1162 | if (y == NULL) { |
1176 | kfree(x); | 1163 | kfree(x); |
@@ -1220,7 +1207,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev, | |||
1220 | * Polygon stipple | 1207 | * Polygon stipple |
1221 | */ | 1208 | */ |
1222 | 1209 | ||
1223 | static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple) | 1210 | static void r128_cce_dispatch_stipple(struct drm_device *dev, u32 *stipple) |
1224 | { | 1211 | { |
1225 | drm_r128_private_t *dev_priv = dev->dev_private; | 1212 | drm_r128_private_t *dev_priv = dev->dev_private; |
1226 | int i; | 1213 | int i; |
@@ -1230,9 +1217,8 @@ static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple) | |||
1230 | BEGIN_RING(33); | 1217 | BEGIN_RING(33); |
1231 | 1218 | ||
1232 | OUT_RING(CCE_PACKET0(R128_BRUSH_DATA0, 31)); | 1219 | OUT_RING(CCE_PACKET0(R128_BRUSH_DATA0, 31)); |
1233 | for (i = 0; i < 32; i++) { | 1220 | for (i = 0; i < 32; i++) |
1234 | OUT_RING(stipple[i]); | 1221 | OUT_RING(stipple[i]); |
1235 | } | ||
1236 | 1222 | ||
1237 | ADVANCE_RING(); | 1223 | ADVANCE_RING(); |
1238 | } | 1224 | } |
@@ -1269,7 +1255,7 @@ static int r128_cce_clear(struct drm_device *dev, void *data, struct drm_file *f | |||
1269 | return 0; | 1255 | return 0; |
1270 | } | 1256 | } |
1271 | 1257 | ||
1272 | static int r128_do_init_pageflip(struct drm_device * dev) | 1258 | static int r128_do_init_pageflip(struct drm_device *dev) |
1273 | { | 1259 | { |
1274 | drm_r128_private_t *dev_priv = dev->dev_private; | 1260 | drm_r128_private_t *dev_priv = dev->dev_private; |
1275 | DRM_DEBUG("\n"); | 1261 | DRM_DEBUG("\n"); |
@@ -1288,7 +1274,7 @@ static int r128_do_init_pageflip(struct drm_device * dev) | |||
1288 | return 0; | 1274 | return 0; |
1289 | } | 1275 | } |
1290 | 1276 | ||
1291 | static int r128_do_cleanup_pageflip(struct drm_device * dev) | 1277 | static int r128_do_cleanup_pageflip(struct drm_device *dev) |
1292 | { | 1278 | { |
1293 | drm_r128_private_t *dev_priv = dev->dev_private; | 1279 | drm_r128_private_t *dev_priv = dev->dev_private; |
1294 | DRM_DEBUG("\n"); | 1280 | DRM_DEBUG("\n"); |
@@ -1645,17 +1631,16 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fi | |||
1645 | return 0; | 1631 | return 0; |
1646 | } | 1632 | } |
1647 | 1633 | ||
1648 | void r128_driver_preclose(struct drm_device * dev, struct drm_file *file_priv) | 1634 | void r128_driver_preclose(struct drm_device *dev, struct drm_file *file_priv) |
1649 | { | 1635 | { |
1650 | if (dev->dev_private) { | 1636 | if (dev->dev_private) { |
1651 | drm_r128_private_t *dev_priv = dev->dev_private; | 1637 | drm_r128_private_t *dev_priv = dev->dev_private; |
1652 | if (dev_priv->page_flipping) { | 1638 | if (dev_priv->page_flipping) |
1653 | r128_do_cleanup_pageflip(dev); | 1639 | r128_do_cleanup_pageflip(dev); |
1654 | } | ||
1655 | } | 1640 | } |
1656 | } | 1641 | } |
1657 | 1642 | ||
1658 | void r128_driver_lastclose(struct drm_device * dev) | 1643 | void r128_driver_lastclose(struct drm_device *dev) |
1659 | { | 1644 | { |
1660 | r128_do_cleanup_cce(dev); | 1645 | r128_do_cleanup_cce(dev); |
1661 | } | 1646 | } |