diff options
author | Eric Anholt <eric@anholt.net> | 2007-09-02 22:06:45 -0400 |
---|---|---|
committer | Dave Airlie <airlied@optimus.(none)> | 2007-10-14 20:38:20 -0400 |
commit | c153f45f9b7e30289157bba3ff5682291df16caa (patch) | |
tree | 33f21e1ebd83ec548751f3d490afe6230ab99972 /drivers/char/drm/i810_dma.c | |
parent | b589ee5943a9610ebaea6e4e3433f2ae4d812b0b (diff) |
drm: Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.
The data is now in kernel space, copied in/out as appropriate according to t
This results in DRM_COPY_{TO,FROM}_USER going away, and error paths to deal
with those failures. This also means that XFree86 4.2.0 support for i810 DR
is lost.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/i810_dma.c')
-rw-r--r-- | drivers/char/drm/i810_dma.c | 249 |
1 files changed, 73 insertions, 176 deletions
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c index 3f1aca87432f..8e841bdee6dc 100644 --- a/drivers/char/drm/i810_dma.c +++ b/drivers/char/drm/i810_dma.c | |||
@@ -429,98 +429,29 @@ static int i810_dma_initialize(struct drm_device * dev, | |||
429 | return 0; | 429 | return 0; |
430 | } | 430 | } |
431 | 431 | ||
432 | /* i810 DRM version 1.1 used a smaller init structure with different | 432 | static int i810_dma_init(struct drm_device *dev, void *data, |
433 | * ordering of values than is currently used (drm >= 1.2). There is | 433 | struct drm_file *file_priv) |
434 | * no defined way to detect the XFree version to correct this problem, | ||
435 | * however by checking using this procedure we can detect the correct | ||
436 | * thing to do. | ||
437 | * | ||
438 | * #1 Read the Smaller init structure from user-space | ||
439 | * #2 Verify the overlay_physical is a valid physical address, or NULL | ||
440 | * If it isn't then we have a v1.1 client. Fix up params. | ||
441 | * If it is, then we have a 1.2 client... get the rest of the data. | ||
442 | */ | ||
443 | static int i810_dma_init_compat(drm_i810_init_t * init, unsigned long arg) | ||
444 | { | ||
445 | |||
446 | /* Get v1.1 init data */ | ||
447 | if (copy_from_user(init, (drm_i810_pre12_init_t __user *) arg, | ||
448 | sizeof(drm_i810_pre12_init_t))) { | ||
449 | return -EFAULT; | ||
450 | } | ||
451 | |||
452 | if ((!init->overlay_physical) || (init->overlay_physical > 4096)) { | ||
453 | |||
454 | /* This is a v1.2 client, just get the v1.2 init data */ | ||
455 | DRM_INFO("Using POST v1.2 init.\n"); | ||
456 | if (copy_from_user(init, (drm_i810_init_t __user *) arg, | ||
457 | sizeof(drm_i810_init_t))) { | ||
458 | return -EFAULT; | ||
459 | } | ||
460 | } else { | ||
461 | |||
462 | /* This is a v1.1 client, fix the params */ | ||
463 | DRM_INFO("Using PRE v1.2 init.\n"); | ||
464 | init->pitch_bits = init->h; | ||
465 | init->pitch = init->w; | ||
466 | init->h = init->overlay_physical; | ||
467 | init->w = init->overlay_offset; | ||
468 | init->overlay_physical = 0; | ||
469 | init->overlay_offset = 0; | ||
470 | } | ||
471 | |||
472 | return 0; | ||
473 | } | ||
474 | |||
475 | static int i810_dma_init(struct inode *inode, struct drm_file *file_priv, | ||
476 | unsigned int cmd, unsigned long arg) | ||
477 | { | 434 | { |
478 | struct drm_device *dev = file_priv->head->dev; | ||
479 | drm_i810_private_t *dev_priv; | 435 | drm_i810_private_t *dev_priv; |
480 | drm_i810_init_t init; | 436 | drm_i810_init_t *init = data; |
481 | int retcode = 0; | 437 | int retcode = 0; |
482 | 438 | ||
483 | /* Get only the init func */ | 439 | switch (init->func) { |
484 | if (copy_from_user | ||
485 | (&init, (void __user *)arg, sizeof(drm_i810_init_func_t))) | ||
486 | return -EFAULT; | ||
487 | |||
488 | switch (init.func) { | ||
489 | case I810_INIT_DMA: | ||
490 | /* This case is for backward compatibility. It | ||
491 | * handles XFree 4.1.0 and 4.2.0, and has to | ||
492 | * do some parameter checking as described below. | ||
493 | * It will someday go away. | ||
494 | */ | ||
495 | retcode = i810_dma_init_compat(&init, arg); | ||
496 | if (retcode) | ||
497 | return retcode; | ||
498 | |||
499 | dev_priv = drm_alloc(sizeof(drm_i810_private_t), | ||
500 | DRM_MEM_DRIVER); | ||
501 | if (dev_priv == NULL) | ||
502 | return -ENOMEM; | ||
503 | retcode = i810_dma_initialize(dev, dev_priv, &init); | ||
504 | break; | ||
505 | |||
506 | default: | ||
507 | case I810_INIT_DMA_1_4: | 440 | case I810_INIT_DMA_1_4: |
508 | DRM_INFO("Using v1.4 init.\n"); | 441 | DRM_INFO("Using v1.4 init.\n"); |
509 | if (copy_from_user(&init, (drm_i810_init_t __user *) arg, | ||
510 | sizeof(drm_i810_init_t))) { | ||
511 | return -EFAULT; | ||
512 | } | ||
513 | dev_priv = drm_alloc(sizeof(drm_i810_private_t), | 442 | dev_priv = drm_alloc(sizeof(drm_i810_private_t), |
514 | DRM_MEM_DRIVER); | 443 | DRM_MEM_DRIVER); |
515 | if (dev_priv == NULL) | 444 | if (dev_priv == NULL) |
516 | return -ENOMEM; | 445 | return -ENOMEM; |
517 | retcode = i810_dma_initialize(dev, dev_priv, &init); | 446 | retcode = i810_dma_initialize(dev, dev_priv, init); |
518 | break; | 447 | break; |
519 | 448 | ||
520 | case I810_CLEANUP_DMA: | 449 | case I810_CLEANUP_DMA: |
521 | DRM_INFO("DMA Cleanup\n"); | 450 | DRM_INFO("DMA Cleanup\n"); |
522 | retcode = i810_dma_cleanup(dev); | 451 | retcode = i810_dma_cleanup(dev); |
523 | break; | 452 | break; |
453 | default: | ||
454 | return -EINVAL; | ||
524 | } | 455 | } |
525 | 456 | ||
526 | return retcode; | 457 | return retcode; |
@@ -997,45 +928,38 @@ static void i810_reclaim_buffers(struct drm_device * dev, | |||
997 | } | 928 | } |
998 | } | 929 | } |
999 | 930 | ||
1000 | static int i810_flush_ioctl(struct inode *inode, struct drm_file *file_priv, | 931 | static int i810_flush_ioctl(struct drm_device *dev, void *data, |
1001 | unsigned int cmd, unsigned long arg) | 932 | struct drm_file *file_priv) |
1002 | { | 933 | { |
1003 | struct drm_device *dev = file_priv->head->dev; | ||
1004 | |||
1005 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 934 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1006 | 935 | ||
1007 | i810_flush_queue(dev); | 936 | i810_flush_queue(dev); |
1008 | return 0; | 937 | return 0; |
1009 | } | 938 | } |
1010 | 939 | ||
1011 | static int i810_dma_vertex(struct inode *inode, struct drm_file *file_priv, | 940 | static int i810_dma_vertex(struct drm_device *dev, void *data, |
1012 | unsigned int cmd, unsigned long arg) | 941 | struct drm_file *file_priv) |
1013 | { | 942 | { |
1014 | struct drm_device *dev = file_priv->head->dev; | ||
1015 | struct drm_device_dma *dma = dev->dma; | 943 | struct drm_device_dma *dma = dev->dma; |
1016 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 944 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1017 | u32 *hw_status = dev_priv->hw_status_page; | 945 | u32 *hw_status = dev_priv->hw_status_page; |
1018 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) | 946 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) |
1019 | dev_priv->sarea_priv; | 947 | dev_priv->sarea_priv; |
1020 | drm_i810_vertex_t vertex; | 948 | drm_i810_vertex_t *vertex = data; |
1021 | |||
1022 | if (copy_from_user | ||
1023 | (&vertex, (drm_i810_vertex_t __user *) arg, sizeof(vertex))) | ||
1024 | return -EFAULT; | ||
1025 | 949 | ||
1026 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 950 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1027 | 951 | ||
1028 | DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", | 952 | DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", |
1029 | vertex.idx, vertex.used, vertex.discard); | 953 | vertex->idx, vertex->used, vertex->discard); |
1030 | 954 | ||
1031 | if (vertex.idx < 0 || vertex.idx > dma->buf_count) | 955 | if (vertex->idx < 0 || vertex->idx > dma->buf_count) |
1032 | return -EINVAL; | 956 | return -EINVAL; |
1033 | 957 | ||
1034 | i810_dma_dispatch_vertex(dev, | 958 | i810_dma_dispatch_vertex(dev, |
1035 | dma->buflist[vertex.idx], | 959 | dma->buflist[vertex->idx], |
1036 | vertex.discard, vertex.used); | 960 | vertex->discard, vertex->used); |
1037 | 961 | ||
1038 | atomic_add(vertex.used, &dev->counts[_DRM_STAT_SECONDARY]); | 962 | atomic_add(vertex->used, &dev->counts[_DRM_STAT_SECONDARY]); |
1039 | atomic_inc(&dev->counts[_DRM_STAT_DMA]); | 963 | atomic_inc(&dev->counts[_DRM_STAT_DMA]); |
1040 | sarea_priv->last_enqueue = dev_priv->counter - 1; | 964 | sarea_priv->last_enqueue = dev_priv->counter - 1; |
1041 | sarea_priv->last_dispatch = (int)hw_status[5]; | 965 | sarea_priv->last_dispatch = (int)hw_status[5]; |
@@ -1043,15 +967,10 @@ static int i810_dma_vertex(struct inode *inode, struct drm_file *file_priv, | |||
1043 | return 0; | 967 | return 0; |
1044 | } | 968 | } |
1045 | 969 | ||
1046 | static int i810_clear_bufs(struct inode *inode, struct drm_file *file_priv, | 970 | static int i810_clear_bufs(struct drm_device *dev, void *data, |
1047 | unsigned int cmd, unsigned long arg) | 971 | struct drm_file *file_priv) |
1048 | { | 972 | { |
1049 | struct drm_device *dev = file_priv->head->dev; | 973 | drm_i810_clear_t *clear = data; |
1050 | drm_i810_clear_t clear; | ||
1051 | |||
1052 | if (copy_from_user | ||
1053 | (&clear, (drm_i810_clear_t __user *) arg, sizeof(clear))) | ||
1054 | return -EFAULT; | ||
1055 | 974 | ||
1056 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 975 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1057 | 976 | ||
@@ -1060,16 +979,14 @@ static int i810_clear_bufs(struct inode *inode, struct drm_file *file_priv, | |||
1060 | return -EINVAL; | 979 | return -EINVAL; |
1061 | } | 980 | } |
1062 | 981 | ||
1063 | i810_dma_dispatch_clear(dev, clear.flags, | 982 | i810_dma_dispatch_clear(dev, clear->flags, |
1064 | clear.clear_color, clear.clear_depth); | 983 | clear->clear_color, clear->clear_depth); |
1065 | return 0; | 984 | return 0; |
1066 | } | 985 | } |
1067 | 986 | ||
1068 | static int i810_swap_bufs(struct inode *inode, struct drm_file *file_priv, | 987 | static int i810_swap_bufs(struct drm_device *dev, void *data, |
1069 | unsigned int cmd, unsigned long arg) | 988 | struct drm_file *file_priv) |
1070 | { | 989 | { |
1071 | struct drm_device *dev = file_priv->head->dev; | ||
1072 | |||
1073 | DRM_DEBUG("i810_swap_bufs\n"); | 990 | DRM_DEBUG("i810_swap_bufs\n"); |
1074 | 991 | ||
1075 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 992 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
@@ -1078,11 +995,9 @@ static int i810_swap_bufs(struct inode *inode, struct drm_file *file_priv, | |||
1078 | return 0; | 995 | return 0; |
1079 | } | 996 | } |
1080 | 997 | ||
1081 | static int i810_getage(struct inode *inode, struct drm_file *file_priv, | 998 | static int i810_getage(struct drm_device *dev, void *data, |
1082 | unsigned int cmd, | 999 | struct drm_file *file_priv) |
1083 | unsigned long arg) | ||
1084 | { | 1000 | { |
1085 | struct drm_device *dev = file_priv->head->dev; | ||
1086 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 1001 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1087 | u32 *hw_status = dev_priv->hw_status_page; | 1002 | u32 *hw_status = dev_priv->hw_status_page; |
1088 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) | 1003 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) |
@@ -1092,45 +1007,39 @@ static int i810_getage(struct inode *inode, struct drm_file *file_priv, | |||
1092 | return 0; | 1007 | return 0; |
1093 | } | 1008 | } |
1094 | 1009 | ||
1095 | static int i810_getbuf(struct inode *inode, struct drm_file *file_priv, | 1010 | static int i810_getbuf(struct drm_device *dev, void *data, |
1096 | unsigned int cmd, unsigned long arg) | 1011 | struct drm_file *file_priv) |
1097 | { | 1012 | { |
1098 | struct drm_device *dev = file_priv->head->dev; | ||
1099 | int retcode = 0; | 1013 | int retcode = 0; |
1100 | drm_i810_dma_t d; | 1014 | drm_i810_dma_t *d = data; |
1101 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 1015 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1102 | u32 *hw_status = dev_priv->hw_status_page; | 1016 | u32 *hw_status = dev_priv->hw_status_page; |
1103 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) | 1017 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) |
1104 | dev_priv->sarea_priv; | 1018 | dev_priv->sarea_priv; |
1105 | 1019 | ||
1106 | if (copy_from_user(&d, (drm_i810_dma_t __user *) arg, sizeof(d))) | ||
1107 | return -EFAULT; | ||
1108 | |||
1109 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1020 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1110 | 1021 | ||
1111 | d.granted = 0; | 1022 | d->granted = 0; |
1112 | 1023 | ||
1113 | retcode = i810_dma_get_buffer(dev, &d, file_priv); | 1024 | retcode = i810_dma_get_buffer(dev, d, file_priv); |
1114 | 1025 | ||
1115 | DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", | 1026 | DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", |
1116 | current->pid, retcode, d.granted); | 1027 | current->pid, retcode, d->granted); |
1117 | 1028 | ||
1118 | if (copy_to_user((void __user *) arg, &d, sizeof(d))) | ||
1119 | return -EFAULT; | ||
1120 | sarea_priv->last_dispatch = (int)hw_status[5]; | 1029 | sarea_priv->last_dispatch = (int)hw_status[5]; |
1121 | 1030 | ||
1122 | return retcode; | 1031 | return retcode; |
1123 | } | 1032 | } |
1124 | 1033 | ||
1125 | static int i810_copybuf(struct inode *inode, struct drm_file *file_priv, | 1034 | static int i810_copybuf(struct drm_device *dev, void *data, |
1126 | unsigned int cmd, unsigned long arg) | 1035 | struct drm_file *file_priv) |
1127 | { | 1036 | { |
1128 | /* Never copy - 2.4.x doesn't need it */ | 1037 | /* Never copy - 2.4.x doesn't need it */ |
1129 | return 0; | 1038 | return 0; |
1130 | } | 1039 | } |
1131 | 1040 | ||
1132 | static int i810_docopy(struct inode *inode, struct drm_file *file_priv, | 1041 | static int i810_docopy(struct drm_device *dev, void *data, |
1133 | unsigned int cmd, unsigned long arg) | 1042 | struct drm_file *file_priv) |
1134 | { | 1043 | { |
1135 | /* Never copy - 2.4.x doesn't need it */ | 1044 | /* Never copy - 2.4.x doesn't need it */ |
1136 | return 0; | 1045 | return 0; |
@@ -1196,29 +1105,25 @@ static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, | |||
1196 | ADVANCE_LP_RING(); | 1105 | ADVANCE_LP_RING(); |
1197 | } | 1106 | } |
1198 | 1107 | ||
1199 | static int i810_dma_mc(struct inode *inode, struct drm_file *file_priv, | 1108 | static int i810_dma_mc(struct drm_device *dev, void *data, |
1200 | unsigned int cmd, unsigned long arg) | 1109 | struct drm_file *file_priv) |
1201 | { | 1110 | { |
1202 | struct drm_device *dev = file_priv->head->dev; | ||
1203 | struct drm_device_dma *dma = dev->dma; | 1111 | struct drm_device_dma *dma = dev->dma; |
1204 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 1112 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1205 | u32 *hw_status = dev_priv->hw_status_page; | 1113 | u32 *hw_status = dev_priv->hw_status_page; |
1206 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) | 1114 | drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) |
1207 | dev_priv->sarea_priv; | 1115 | dev_priv->sarea_priv; |
1208 | drm_i810_mc_t mc; | 1116 | drm_i810_mc_t *mc = data; |
1209 | |||
1210 | if (copy_from_user(&mc, (drm_i810_mc_t __user *) arg, sizeof(mc))) | ||
1211 | return -EFAULT; | ||
1212 | 1117 | ||
1213 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1118 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1214 | 1119 | ||
1215 | if (mc.idx >= dma->buf_count || mc.idx < 0) | 1120 | if (mc->idx >= dma->buf_count || mc->idx < 0) |
1216 | return -EINVAL; | 1121 | return -EINVAL; |
1217 | 1122 | ||
1218 | i810_dma_dispatch_mc(dev, dma->buflist[mc.idx], mc.used, | 1123 | i810_dma_dispatch_mc(dev, dma->buflist[mc->idx], mc->used, |
1219 | mc.last_render); | 1124 | mc->last_render); |
1220 | 1125 | ||
1221 | atomic_add(mc.used, &dev->counts[_DRM_STAT_SECONDARY]); | 1126 | atomic_add(mc->used, &dev->counts[_DRM_STAT_SECONDARY]); |
1222 | atomic_inc(&dev->counts[_DRM_STAT_DMA]); | 1127 | atomic_inc(&dev->counts[_DRM_STAT_DMA]); |
1223 | sarea_priv->last_enqueue = dev_priv->counter - 1; | 1128 | sarea_priv->last_enqueue = dev_priv->counter - 1; |
1224 | sarea_priv->last_dispatch = (int)hw_status[5]; | 1129 | sarea_priv->last_dispatch = (int)hw_status[5]; |
@@ -1226,45 +1131,38 @@ static int i810_dma_mc(struct inode *inode, struct drm_file *file_priv, | |||
1226 | return 0; | 1131 | return 0; |
1227 | } | 1132 | } |
1228 | 1133 | ||
1229 | static int i810_rstatus(struct inode *inode, struct drm_file *file_priv, | 1134 | static int i810_rstatus(struct drm_device *dev, void *data, |
1230 | unsigned int cmd, unsigned long arg) | 1135 | struct drm_file *file_priv) |
1231 | { | 1136 | { |
1232 | struct drm_device *dev = file_priv->head->dev; | ||
1233 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 1137 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1234 | 1138 | ||
1235 | return (int)(((u32 *) (dev_priv->hw_status_page))[4]); | 1139 | return (int)(((u32 *) (dev_priv->hw_status_page))[4]); |
1236 | } | 1140 | } |
1237 | 1141 | ||
1238 | static int i810_ov0_info(struct inode *inode, struct drm_file *file_priv, | 1142 | static int i810_ov0_info(struct drm_device *dev, void *data, |
1239 | unsigned int cmd, unsigned long arg) | 1143 | struct drm_file *file_priv) |
1240 | { | 1144 | { |
1241 | struct drm_device *dev = file_priv->head->dev; | ||
1242 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 1145 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1243 | drm_i810_overlay_t data; | 1146 | drm_i810_overlay_t *ov = data; |
1147 | |||
1148 | ov->offset = dev_priv->overlay_offset; | ||
1149 | ov->physical = dev_priv->overlay_physical; | ||
1244 | 1150 | ||
1245 | data.offset = dev_priv->overlay_offset; | ||
1246 | data.physical = dev_priv->overlay_physical; | ||
1247 | if (copy_to_user | ||
1248 | ((drm_i810_overlay_t __user *) arg, &data, sizeof(data))) | ||
1249 | return -EFAULT; | ||
1250 | return 0; | 1151 | return 0; |
1251 | } | 1152 | } |
1252 | 1153 | ||
1253 | static int i810_fstatus(struct inode *inode, struct drm_file *file_priv, | 1154 | static int i810_fstatus(struct drm_device *dev, void *data, |
1254 | unsigned int cmd, unsigned long arg) | 1155 | struct drm_file *file_priv) |
1255 | { | 1156 | { |
1256 | struct drm_device *dev = file_priv->head->dev; | ||
1257 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 1157 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1258 | 1158 | ||
1259 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1159 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1260 | |||
1261 | return I810_READ(0x30008); | 1160 | return I810_READ(0x30008); |
1262 | } | 1161 | } |
1263 | 1162 | ||
1264 | static int i810_ov0_flip(struct inode *inode, struct drm_file *file_priv, | 1163 | static int i810_ov0_flip(struct drm_device *dev, void *data, |
1265 | unsigned int cmd, unsigned long arg) | 1164 | struct drm_file *file_priv) |
1266 | { | 1165 | { |
1267 | struct drm_device *dev = file_priv->head->dev; | ||
1268 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; | 1166 | drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; |
1269 | 1167 | ||
1270 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 1168 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
@@ -1299,10 +1197,9 @@ static int i810_do_cleanup_pageflip(struct drm_device * dev) | |||
1299 | return 0; | 1197 | return 0; |
1300 | } | 1198 | } |
1301 | 1199 | ||
1302 | static int i810_flip_bufs(struct inode *inode, struct drm_file *file_priv, | 1200 | static int i810_flip_bufs(struct drm_device *dev, void *data, |
1303 | unsigned int cmd, unsigned long arg) | 1201 | struct drm_file *file_priv) |
1304 | { | 1202 | { |
1305 | struct drm_device *dev = file_priv->head->dev; | ||
1306 | drm_i810_private_t *dev_priv = dev->dev_private; | 1203 | drm_i810_private_t *dev_priv = dev->dev_private; |
1307 | 1204 | ||
1308 | DRM_DEBUG("%s\n", __FUNCTION__); | 1205 | DRM_DEBUG("%s\n", __FUNCTION__); |
@@ -1355,22 +1252,22 @@ int i810_driver_dma_quiescent(struct drm_device * dev) | |||
1355 | return 0; | 1252 | return 0; |
1356 | } | 1253 | } |
1357 | 1254 | ||
1358 | drm_ioctl_desc_t i810_ioctls[] = { | 1255 | struct drm_ioctl_desc i810_ioctls[] = { |
1359 | [DRM_IOCTL_NR(DRM_I810_INIT)] = {i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 1256 | DRM_IOCTL_DEF(DRM_I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1360 | [DRM_IOCTL_NR(DRM_I810_VERTEX)] = {i810_dma_vertex, DRM_AUTH}, | 1257 | DRM_IOCTL_DEF(DRM_I810_VERTEX, i810_dma_vertex, DRM_AUTH), |
1361 | [DRM_IOCTL_NR(DRM_I810_CLEAR)] = {i810_clear_bufs, DRM_AUTH}, | 1258 | DRM_IOCTL_DEF(DRM_I810_CLEAR, i810_clear_bufs, DRM_AUTH), |
1362 | [DRM_IOCTL_NR(DRM_I810_FLUSH)] = {i810_flush_ioctl, DRM_AUTH}, | 1259 | DRM_IOCTL_DEF(DRM_I810_FLUSH, i810_flush_ioctl, DRM_AUTH), |
1363 | [DRM_IOCTL_NR(DRM_I810_GETAGE)] = {i810_getage, DRM_AUTH}, | 1260 | DRM_IOCTL_DEF(DRM_I810_GETAGE, i810_getage, DRM_AUTH), |
1364 | [DRM_IOCTL_NR(DRM_I810_GETBUF)] = {i810_getbuf, DRM_AUTH}, | 1261 | DRM_IOCTL_DEF(DRM_I810_GETBUF, i810_getbuf, DRM_AUTH), |
1365 | [DRM_IOCTL_NR(DRM_I810_SWAP)] = {i810_swap_bufs, DRM_AUTH}, | 1262 | DRM_IOCTL_DEF(DRM_I810_SWAP, i810_swap_bufs, DRM_AUTH), |
1366 | [DRM_IOCTL_NR(DRM_I810_COPY)] = {i810_copybuf, DRM_AUTH}, | 1263 | DRM_IOCTL_DEF(DRM_I810_COPY, i810_copybuf, DRM_AUTH), |
1367 | [DRM_IOCTL_NR(DRM_I810_DOCOPY)] = {i810_docopy, DRM_AUTH}, | 1264 | DRM_IOCTL_DEF(DRM_I810_DOCOPY, i810_docopy, DRM_AUTH), |
1368 | [DRM_IOCTL_NR(DRM_I810_OV0INFO)] = {i810_ov0_info, DRM_AUTH}, | 1265 | DRM_IOCTL_DEF(DRM_I810_OV0INFO, i810_ov0_info, DRM_AUTH), |
1369 | [DRM_IOCTL_NR(DRM_I810_FSTATUS)] = {i810_fstatus, DRM_AUTH}, | 1266 | DRM_IOCTL_DEF(DRM_I810_FSTATUS, i810_fstatus, DRM_AUTH), |
1370 | [DRM_IOCTL_NR(DRM_I810_OV0FLIP)] = {i810_ov0_flip, DRM_AUTH}, | 1267 | DRM_IOCTL_DEF(DRM_I810_OV0FLIP, i810_ov0_flip, DRM_AUTH), |
1371 | [DRM_IOCTL_NR(DRM_I810_MC)] = {i810_dma_mc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 1268 | DRM_IOCTL_DEF(DRM_I810_MC, i810_dma_mc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1372 | [DRM_IOCTL_NR(DRM_I810_RSTATUS)] = {i810_rstatus, DRM_AUTH}, | 1269 | DRM_IOCTL_DEF(DRM_I810_RSTATUS, i810_rstatus, DRM_AUTH), |
1373 | [DRM_IOCTL_NR(DRM_I810_FLIP)] = {i810_flip_bufs, DRM_AUTH} | 1270 | DRM_IOCTL_DEF(DRM_I810_FLIP, i810_flip_bufs, DRM_AUTH) |
1374 | }; | 1271 | }; |
1375 | 1272 | ||
1376 | int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); | 1273 | int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls); |