diff options
Diffstat (limited to 'drivers/char/drm/r128_state.c')
-rw-r--r-- | drivers/char/drm/r128_state.c | 351 |
1 files changed, 160 insertions, 191 deletions
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c index 7b334fb7d649..b7f483cac6d4 100644 --- a/drivers/char/drm/r128_state.c +++ b/drivers/char/drm/r128_state.c | |||
@@ -776,8 +776,9 @@ static void r128_cce_dispatch_indices(struct drm_device * dev, | |||
776 | sarea_priv->nbox = 0; | 776 | sarea_priv->nbox = 0; |
777 | } | 777 | } |
778 | 778 | ||
779 | static int r128_cce_dispatch_blit(DRMFILE filp, | 779 | static int r128_cce_dispatch_blit(struct drm_device * dev, |
780 | struct drm_device * dev, drm_r128_blit_t * blit) | 780 | struct drm_file *file_priv, |
781 | drm_r128_blit_t * blit) | ||
781 | { | 782 | { |
782 | drm_r128_private_t *dev_priv = dev->dev_private; | 783 | drm_r128_private_t *dev_priv = dev->dev_private; |
783 | struct drm_device_dma *dma = dev->dma; | 784 | struct drm_device_dma *dma = dev->dma; |
@@ -809,7 +810,7 @@ static int r128_cce_dispatch_blit(DRMFILE filp, | |||
809 | break; | 810 | break; |
810 | default: | 811 | default: |
811 | DRM_ERROR("invalid blit format %d\n", blit->format); | 812 | DRM_ERROR("invalid blit format %d\n", blit->format); |
812 | return DRM_ERR(EINVAL); | 813 | return -EINVAL; |
813 | } | 814 | } |
814 | 815 | ||
815 | /* Flush the pixel cache, and mark the contents as Read Invalid. | 816 | /* Flush the pixel cache, and mark the contents as Read Invalid. |
@@ -829,14 +830,14 @@ static int r128_cce_dispatch_blit(DRMFILE filp, | |||
829 | buf = dma->buflist[blit->idx]; | 830 | buf = dma->buflist[blit->idx]; |
830 | buf_priv = buf->dev_private; | 831 | buf_priv = buf->dev_private; |
831 | 832 | ||
832 | if (buf->filp != filp) { | 833 | if (buf->file_priv != file_priv) { |
833 | DRM_ERROR("process %d using buffer owned by %p\n", | 834 | DRM_ERROR("process %d using buffer owned by %p\n", |
834 | DRM_CURRENTPID, buf->filp); | 835 | DRM_CURRENTPID, buf->file_priv); |
835 | return DRM_ERR(EINVAL); | 836 | return -EINVAL; |
836 | } | 837 | } |
837 | if (buf->pending) { | 838 | if (buf->pending) { |
838 | DRM_ERROR("sending pending buffer %d\n", blit->idx); | 839 | DRM_ERROR("sending pending buffer %d\n", blit->idx); |
839 | return DRM_ERR(EINVAL); | 840 | return -EINVAL; |
840 | } | 841 | } |
841 | 842 | ||
842 | buf_priv->discard = 1; | 843 | buf_priv->discard = 1; |
@@ -900,22 +901,22 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev, | |||
900 | 901 | ||
901 | count = depth->n; | 902 | count = depth->n; |
902 | if (count > 4096 || count <= 0) | 903 | if (count > 4096 || count <= 0) |
903 | return DRM_ERR(EMSGSIZE); | 904 | return -EMSGSIZE; |
904 | 905 | ||
905 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { | 906 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { |
906 | return DRM_ERR(EFAULT); | 907 | return -EFAULT; |
907 | } | 908 | } |
908 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { | 909 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { |
909 | return DRM_ERR(EFAULT); | 910 | return -EFAULT; |
910 | } | 911 | } |
911 | 912 | ||
912 | buffer_size = depth->n * sizeof(u32); | 913 | buffer_size = depth->n * sizeof(u32); |
913 | buffer = drm_alloc(buffer_size, DRM_MEM_BUFS); | 914 | buffer = drm_alloc(buffer_size, DRM_MEM_BUFS); |
914 | if (buffer == NULL) | 915 | if (buffer == NULL) |
915 | return DRM_ERR(ENOMEM); | 916 | return -ENOMEM; |
916 | if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { | 917 | if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { |
917 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); | 918 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); |
918 | return DRM_ERR(EFAULT); | 919 | return -EFAULT; |
919 | } | 920 | } |
920 | 921 | ||
921 | mask_size = depth->n * sizeof(u8); | 922 | mask_size = depth->n * sizeof(u8); |
@@ -923,12 +924,12 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev, | |||
923 | mask = drm_alloc(mask_size, DRM_MEM_BUFS); | 924 | mask = drm_alloc(mask_size, DRM_MEM_BUFS); |
924 | if (mask == NULL) { | 925 | if (mask == NULL) { |
925 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); | 926 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); |
926 | return DRM_ERR(ENOMEM); | 927 | return -ENOMEM; |
927 | } | 928 | } |
928 | if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { | 929 | if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { |
929 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); | 930 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); |
930 | drm_free(mask, mask_size, DRM_MEM_BUFS); | 931 | drm_free(mask, mask_size, DRM_MEM_BUFS); |
931 | return DRM_ERR(EFAULT); | 932 | return -EFAULT; |
932 | } | 933 | } |
933 | 934 | ||
934 | for (i = 0; i < count; i++, x++) { | 935 | for (i = 0; i < count; i++, x++) { |
@@ -996,28 +997,28 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, | |||
996 | 997 | ||
997 | count = depth->n; | 998 | count = depth->n; |
998 | if (count > 4096 || count <= 0) | 999 | if (count > 4096 || count <= 0) |
999 | return DRM_ERR(EMSGSIZE); | 1000 | return -EMSGSIZE; |
1000 | 1001 | ||
1001 | xbuf_size = count * sizeof(*x); | 1002 | xbuf_size = count * sizeof(*x); |
1002 | ybuf_size = count * sizeof(*y); | 1003 | ybuf_size = count * sizeof(*y); |
1003 | x = drm_alloc(xbuf_size, DRM_MEM_BUFS); | 1004 | x = drm_alloc(xbuf_size, DRM_MEM_BUFS); |
1004 | if (x == NULL) { | 1005 | if (x == NULL) { |
1005 | return DRM_ERR(ENOMEM); | 1006 | return -ENOMEM; |
1006 | } | 1007 | } |
1007 | y = drm_alloc(ybuf_size, DRM_MEM_BUFS); | 1008 | y = drm_alloc(ybuf_size, DRM_MEM_BUFS); |
1008 | if (y == NULL) { | 1009 | if (y == NULL) { |
1009 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1010 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1010 | return DRM_ERR(ENOMEM); | 1011 | return -ENOMEM; |
1011 | } | 1012 | } |
1012 | if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { | 1013 | if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { |
1013 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1014 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1014 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1015 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1015 | return DRM_ERR(EFAULT); | 1016 | return -EFAULT; |
1016 | } | 1017 | } |
1017 | if (DRM_COPY_FROM_USER(y, depth->y, xbuf_size)) { | 1018 | if (DRM_COPY_FROM_USER(y, depth->y, xbuf_size)) { |
1018 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1019 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1019 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1020 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1020 | return DRM_ERR(EFAULT); | 1021 | return -EFAULT; |
1021 | } | 1022 | } |
1022 | 1023 | ||
1023 | buffer_size = depth->n * sizeof(u32); | 1024 | buffer_size = depth->n * sizeof(u32); |
@@ -1025,13 +1026,13 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, | |||
1025 | if (buffer == NULL) { | 1026 | if (buffer == NULL) { |
1026 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1027 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1027 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1028 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1028 | return DRM_ERR(ENOMEM); | 1029 | return -ENOMEM; |
1029 | } | 1030 | } |
1030 | if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { | 1031 | if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { |
1031 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1032 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1032 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1033 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1033 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); | 1034 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); |
1034 | return DRM_ERR(EFAULT); | 1035 | return -EFAULT; |
1035 | } | 1036 | } |
1036 | 1037 | ||
1037 | if (depth->mask) { | 1038 | if (depth->mask) { |
@@ -1041,14 +1042,14 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, | |||
1041 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1042 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1042 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1043 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1043 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); | 1044 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); |
1044 | return DRM_ERR(ENOMEM); | 1045 | return -ENOMEM; |
1045 | } | 1046 | } |
1046 | if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { | 1047 | if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { |
1047 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1048 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1048 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1049 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1049 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); | 1050 | drm_free(buffer, buffer_size, DRM_MEM_BUFS); |
1050 | drm_free(mask, mask_size, DRM_MEM_BUFS); | 1051 | drm_free(mask, mask_size, DRM_MEM_BUFS); |
1051 | return DRM_ERR(EFAULT); | 1052 | return -EFAULT; |
1052 | } | 1053 | } |
1053 | 1054 | ||
1054 | for (i = 0; i < count; i++) { | 1055 | for (i = 0; i < count; i++) { |
@@ -1115,13 +1116,13 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev, | |||
1115 | 1116 | ||
1116 | count = depth->n; | 1117 | count = depth->n; |
1117 | if (count > 4096 || count <= 0) | 1118 | if (count > 4096 || count <= 0) |
1118 | return DRM_ERR(EMSGSIZE); | 1119 | return -EMSGSIZE; |
1119 | 1120 | ||
1120 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { | 1121 | if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { |
1121 | return DRM_ERR(EFAULT); | 1122 | return -EFAULT; |
1122 | } | 1123 | } |
1123 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { | 1124 | if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { |
1124 | return DRM_ERR(EFAULT); | 1125 | return -EFAULT; |
1125 | } | 1126 | } |
1126 | 1127 | ||
1127 | BEGIN_RING(7); | 1128 | BEGIN_RING(7); |
@@ -1159,7 +1160,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev, | |||
1159 | 1160 | ||
1160 | count = depth->n; | 1161 | count = depth->n; |
1161 | if (count > 4096 || count <= 0) | 1162 | if (count > 4096 || count <= 0) |
1162 | return DRM_ERR(EMSGSIZE); | 1163 | return -EMSGSIZE; |
1163 | 1164 | ||
1164 | if (count > dev_priv->depth_pitch) { | 1165 | if (count > dev_priv->depth_pitch) { |
1165 | count = dev_priv->depth_pitch; | 1166 | count = dev_priv->depth_pitch; |
@@ -1169,22 +1170,22 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev, | |||
1169 | ybuf_size = count * sizeof(*y); | 1170 | ybuf_size = count * sizeof(*y); |
1170 | x = drm_alloc(xbuf_size, DRM_MEM_BUFS); | 1171 | x = drm_alloc(xbuf_size, DRM_MEM_BUFS); |
1171 | if (x == NULL) { | 1172 | if (x == NULL) { |
1172 | return DRM_ERR(ENOMEM); | 1173 | return -ENOMEM; |
1173 | } | 1174 | } |
1174 | y = drm_alloc(ybuf_size, DRM_MEM_BUFS); | 1175 | y = drm_alloc(ybuf_size, DRM_MEM_BUFS); |
1175 | if (y == NULL) { | 1176 | if (y == NULL) { |
1176 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1177 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1177 | return DRM_ERR(ENOMEM); | 1178 | return -ENOMEM; |
1178 | } | 1179 | } |
1179 | if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { | 1180 | if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { |
1180 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1181 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1181 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1182 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1182 | return DRM_ERR(EFAULT); | 1183 | return -EFAULT; |
1183 | } | 1184 | } |
1184 | if (DRM_COPY_FROM_USER(y, depth->y, ybuf_size)) { | 1185 | if (DRM_COPY_FROM_USER(y, depth->y, ybuf_size)) { |
1185 | drm_free(x, xbuf_size, DRM_MEM_BUFS); | 1186 | drm_free(x, xbuf_size, DRM_MEM_BUFS); |
1186 | drm_free(y, ybuf_size, DRM_MEM_BUFS); | 1187 | drm_free(y, ybuf_size, DRM_MEM_BUFS); |
1187 | return DRM_ERR(EFAULT); | 1188 | return -EFAULT; |
1188 | } | 1189 | } |
1189 | 1190 | ||
1190 | for (i = 0; i < count; i++) { | 1191 | for (i = 0; i < count; i++) { |
@@ -1241,25 +1242,21 @@ static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple) | |||
1241 | * IOCTL functions | 1242 | * IOCTL functions |
1242 | */ | 1243 | */ |
1243 | 1244 | ||
1244 | static int r128_cce_clear(DRM_IOCTL_ARGS) | 1245 | static int r128_cce_clear(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1245 | { | 1246 | { |
1246 | DRM_DEVICE; | ||
1247 | drm_r128_private_t *dev_priv = dev->dev_private; | 1247 | drm_r128_private_t *dev_priv = dev->dev_private; |
1248 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 1248 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
1249 | drm_r128_clear_t clear; | 1249 | drm_r128_clear_t *clear = data; |
1250 | DRM_DEBUG("\n"); | 1250 | DRM_DEBUG("\n"); |
1251 | 1251 | ||
1252 | LOCK_TEST_WITH_RETURN(dev, filp); | 1252 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1253 | |||
1254 | DRM_COPY_FROM_USER_IOCTL(clear, (drm_r128_clear_t __user *) data, | ||
1255 | sizeof(clear)); | ||
1256 | 1253 | ||
1257 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1254 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1258 | 1255 | ||
1259 | if (sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS) | 1256 | if (sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS) |
1260 | sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; | 1257 | sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; |
1261 | 1258 | ||
1262 | r128_cce_dispatch_clear(dev, &clear); | 1259 | r128_cce_dispatch_clear(dev, clear); |
1263 | COMMIT_RING(); | 1260 | COMMIT_RING(); |
1264 | 1261 | ||
1265 | /* Make sure we restore the 3D state next time. | 1262 | /* Make sure we restore the 3D state next time. |
@@ -1309,13 +1306,12 @@ static int r128_do_cleanup_pageflip(struct drm_device * dev) | |||
1309 | * They can & should be intermixed to support multiple 3d windows. | 1306 | * They can & should be intermixed to support multiple 3d windows. |
1310 | */ | 1307 | */ |
1311 | 1308 | ||
1312 | static int r128_cce_flip(DRM_IOCTL_ARGS) | 1309 | static int r128_cce_flip(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1313 | { | 1310 | { |
1314 | DRM_DEVICE; | ||
1315 | drm_r128_private_t *dev_priv = dev->dev_private; | 1311 | drm_r128_private_t *dev_priv = dev->dev_private; |
1316 | DRM_DEBUG("%s\n", __FUNCTION__); | 1312 | DRM_DEBUG("%s\n", __FUNCTION__); |
1317 | 1313 | ||
1318 | LOCK_TEST_WITH_RETURN(dev, filp); | 1314 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1319 | 1315 | ||
1320 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1316 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1321 | 1317 | ||
@@ -1328,14 +1324,13 @@ static int r128_cce_flip(DRM_IOCTL_ARGS) | |||
1328 | return 0; | 1324 | return 0; |
1329 | } | 1325 | } |
1330 | 1326 | ||
1331 | static int r128_cce_swap(DRM_IOCTL_ARGS) | 1327 | static int r128_cce_swap(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1332 | { | 1328 | { |
1333 | DRM_DEVICE; | ||
1334 | drm_r128_private_t *dev_priv = dev->dev_private; | 1329 | drm_r128_private_t *dev_priv = dev->dev_private; |
1335 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; | 1330 | drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; |
1336 | DRM_DEBUG("%s\n", __FUNCTION__); | 1331 | DRM_DEBUG("%s\n", __FUNCTION__); |
1337 | 1332 | ||
1338 | LOCK_TEST_WITH_RETURN(dev, filp); | 1333 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1339 | 1334 | ||
1340 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1335 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1341 | 1336 | ||
@@ -1350,58 +1345,54 @@ static int r128_cce_swap(DRM_IOCTL_ARGS) | |||
1350 | return 0; | 1345 | return 0; |
1351 | } | 1346 | } |
1352 | 1347 | ||
1353 | static int r128_cce_vertex(DRM_IOCTL_ARGS) | 1348 | static int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1354 | { | 1349 | { |
1355 | DRM_DEVICE; | ||
1356 | drm_r128_private_t *dev_priv = dev->dev_private; | 1350 | drm_r128_private_t *dev_priv = dev->dev_private; |
1357 | struct drm_device_dma *dma = dev->dma; | 1351 | struct drm_device_dma *dma = dev->dma; |
1358 | struct drm_buf *buf; | 1352 | struct drm_buf *buf; |
1359 | drm_r128_buf_priv_t *buf_priv; | 1353 | drm_r128_buf_priv_t *buf_priv; |
1360 | drm_r128_vertex_t vertex; | 1354 | drm_r128_vertex_t *vertex = data; |
1361 | 1355 | ||
1362 | LOCK_TEST_WITH_RETURN(dev, filp); | 1356 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1363 | 1357 | ||
1364 | if (!dev_priv) { | 1358 | if (!dev_priv) { |
1365 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | 1359 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); |
1366 | return DRM_ERR(EINVAL); | 1360 | return -EINVAL; |
1367 | } | 1361 | } |
1368 | 1362 | ||
1369 | DRM_COPY_FROM_USER_IOCTL(vertex, (drm_r128_vertex_t __user *) data, | ||
1370 | sizeof(vertex)); | ||
1371 | |||
1372 | DRM_DEBUG("pid=%d index=%d count=%d discard=%d\n", | 1363 | DRM_DEBUG("pid=%d index=%d count=%d discard=%d\n", |
1373 | DRM_CURRENTPID, vertex.idx, vertex.count, vertex.discard); | 1364 | DRM_CURRENTPID, vertex->idx, vertex->count, vertex->discard); |
1374 | 1365 | ||
1375 | if (vertex.idx < 0 || vertex.idx >= dma->buf_count) { | 1366 | if (vertex->idx < 0 || vertex->idx >= dma->buf_count) { |
1376 | DRM_ERROR("buffer index %d (of %d max)\n", | 1367 | DRM_ERROR("buffer index %d (of %d max)\n", |
1377 | vertex.idx, dma->buf_count - 1); | 1368 | vertex->idx, dma->buf_count - 1); |
1378 | return DRM_ERR(EINVAL); | 1369 | return -EINVAL; |
1379 | } | 1370 | } |
1380 | if (vertex.prim < 0 || | 1371 | if (vertex->prim < 0 || |
1381 | vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { | 1372 | vertex->prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { |
1382 | DRM_ERROR("buffer prim %d\n", vertex.prim); | 1373 | DRM_ERROR("buffer prim %d\n", vertex->prim); |
1383 | return DRM_ERR(EINVAL); | 1374 | return -EINVAL; |
1384 | } | 1375 | } |
1385 | 1376 | ||
1386 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1377 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1387 | VB_AGE_TEST_WITH_RETURN(dev_priv); | 1378 | VB_AGE_TEST_WITH_RETURN(dev_priv); |
1388 | 1379 | ||
1389 | buf = dma->buflist[vertex.idx]; | 1380 | buf = dma->buflist[vertex->idx]; |
1390 | buf_priv = buf->dev_private; | 1381 | buf_priv = buf->dev_private; |
1391 | 1382 | ||
1392 | if (buf->filp != filp) { | 1383 | if (buf->file_priv != file_priv) { |
1393 | DRM_ERROR("process %d using buffer owned by %p\n", | 1384 | DRM_ERROR("process %d using buffer owned by %p\n", |
1394 | DRM_CURRENTPID, buf->filp); | 1385 | DRM_CURRENTPID, buf->file_priv); |
1395 | return DRM_ERR(EINVAL); | 1386 | return -EINVAL; |
1396 | } | 1387 | } |
1397 | if (buf->pending) { | 1388 | if (buf->pending) { |
1398 | DRM_ERROR("sending pending buffer %d\n", vertex.idx); | 1389 | DRM_ERROR("sending pending buffer %d\n", vertex->idx); |
1399 | return DRM_ERR(EINVAL); | 1390 | return -EINVAL; |
1400 | } | 1391 | } |
1401 | 1392 | ||
1402 | buf->used = vertex.count; | 1393 | buf->used = vertex->count; |
1403 | buf_priv->prim = vertex.prim; | 1394 | buf_priv->prim = vertex->prim; |
1404 | buf_priv->discard = vertex.discard; | 1395 | buf_priv->discard = vertex->discard; |
1405 | 1396 | ||
1406 | r128_cce_dispatch_vertex(dev, buf); | 1397 | r128_cce_dispatch_vertex(dev, buf); |
1407 | 1398 | ||
@@ -1409,134 +1400,123 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS) | |||
1409 | return 0; | 1400 | return 0; |
1410 | } | 1401 | } |
1411 | 1402 | ||
1412 | static int r128_cce_indices(DRM_IOCTL_ARGS) | 1403 | static int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1413 | { | 1404 | { |
1414 | DRM_DEVICE; | ||
1415 | drm_r128_private_t *dev_priv = dev->dev_private; | 1405 | drm_r128_private_t *dev_priv = dev->dev_private; |
1416 | struct drm_device_dma *dma = dev->dma; | 1406 | struct drm_device_dma *dma = dev->dma; |
1417 | struct drm_buf *buf; | 1407 | struct drm_buf *buf; |
1418 | drm_r128_buf_priv_t *buf_priv; | 1408 | drm_r128_buf_priv_t *buf_priv; |
1419 | drm_r128_indices_t elts; | 1409 | drm_r128_indices_t *elts = data; |
1420 | int count; | 1410 | int count; |
1421 | 1411 | ||
1422 | LOCK_TEST_WITH_RETURN(dev, filp); | 1412 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1423 | 1413 | ||
1424 | if (!dev_priv) { | 1414 | if (!dev_priv) { |
1425 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | 1415 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); |
1426 | return DRM_ERR(EINVAL); | 1416 | return -EINVAL; |
1427 | } | 1417 | } |
1428 | 1418 | ||
1429 | DRM_COPY_FROM_USER_IOCTL(elts, (drm_r128_indices_t __user *) data, | ||
1430 | sizeof(elts)); | ||
1431 | |||
1432 | DRM_DEBUG("pid=%d buf=%d s=%d e=%d d=%d\n", DRM_CURRENTPID, | 1419 | DRM_DEBUG("pid=%d buf=%d s=%d e=%d d=%d\n", DRM_CURRENTPID, |
1433 | elts.idx, elts.start, elts.end, elts.discard); | 1420 | elts->idx, elts->start, elts->end, elts->discard); |
1434 | 1421 | ||
1435 | if (elts.idx < 0 || elts.idx >= dma->buf_count) { | 1422 | if (elts->idx < 0 || elts->idx >= dma->buf_count) { |
1436 | DRM_ERROR("buffer index %d (of %d max)\n", | 1423 | DRM_ERROR("buffer index %d (of %d max)\n", |
1437 | elts.idx, dma->buf_count - 1); | 1424 | elts->idx, dma->buf_count - 1); |
1438 | return DRM_ERR(EINVAL); | 1425 | return -EINVAL; |
1439 | } | 1426 | } |
1440 | if (elts.prim < 0 || elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { | 1427 | if (elts->prim < 0 || |
1441 | DRM_ERROR("buffer prim %d\n", elts.prim); | 1428 | elts->prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { |
1442 | return DRM_ERR(EINVAL); | 1429 | DRM_ERROR("buffer prim %d\n", elts->prim); |
1430 | return -EINVAL; | ||
1443 | } | 1431 | } |
1444 | 1432 | ||
1445 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1433 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1446 | VB_AGE_TEST_WITH_RETURN(dev_priv); | 1434 | VB_AGE_TEST_WITH_RETURN(dev_priv); |
1447 | 1435 | ||
1448 | buf = dma->buflist[elts.idx]; | 1436 | buf = dma->buflist[elts->idx]; |
1449 | buf_priv = buf->dev_private; | 1437 | buf_priv = buf->dev_private; |
1450 | 1438 | ||
1451 | if (buf->filp != filp) { | 1439 | if (buf->file_priv != file_priv) { |
1452 | DRM_ERROR("process %d using buffer owned by %p\n", | 1440 | DRM_ERROR("process %d using buffer owned by %p\n", |
1453 | DRM_CURRENTPID, buf->filp); | 1441 | DRM_CURRENTPID, buf->file_priv); |
1454 | return DRM_ERR(EINVAL); | 1442 | return -EINVAL; |
1455 | } | 1443 | } |
1456 | if (buf->pending) { | 1444 | if (buf->pending) { |
1457 | DRM_ERROR("sending pending buffer %d\n", elts.idx); | 1445 | DRM_ERROR("sending pending buffer %d\n", elts->idx); |
1458 | return DRM_ERR(EINVAL); | 1446 | return -EINVAL; |
1459 | } | 1447 | } |
1460 | 1448 | ||
1461 | count = (elts.end - elts.start) / sizeof(u16); | 1449 | count = (elts->end - elts->start) / sizeof(u16); |
1462 | elts.start -= R128_INDEX_PRIM_OFFSET; | 1450 | elts->start -= R128_INDEX_PRIM_OFFSET; |
1463 | 1451 | ||
1464 | if (elts.start & 0x7) { | 1452 | if (elts->start & 0x7) { |
1465 | DRM_ERROR("misaligned buffer 0x%x\n", elts.start); | 1453 | DRM_ERROR("misaligned buffer 0x%x\n", elts->start); |
1466 | return DRM_ERR(EINVAL); | 1454 | return -EINVAL; |
1467 | } | 1455 | } |
1468 | if (elts.start < buf->used) { | 1456 | if (elts->start < buf->used) { |
1469 | DRM_ERROR("no header 0x%x - 0x%x\n", elts.start, buf->used); | 1457 | DRM_ERROR("no header 0x%x - 0x%x\n", elts->start, buf->used); |
1470 | return DRM_ERR(EINVAL); | 1458 | return -EINVAL; |
1471 | } | 1459 | } |
1472 | 1460 | ||
1473 | buf->used = elts.end; | 1461 | buf->used = elts->end; |
1474 | buf_priv->prim = elts.prim; | 1462 | buf_priv->prim = elts->prim; |
1475 | buf_priv->discard = elts.discard; | 1463 | buf_priv->discard = elts->discard; |
1476 | 1464 | ||
1477 | r128_cce_dispatch_indices(dev, buf, elts.start, elts.end, count); | 1465 | r128_cce_dispatch_indices(dev, buf, elts->start, elts->end, count); |
1478 | 1466 | ||
1479 | COMMIT_RING(); | 1467 | COMMIT_RING(); |
1480 | return 0; | 1468 | return 0; |
1481 | } | 1469 | } |
1482 | 1470 | ||
1483 | static int r128_cce_blit(DRM_IOCTL_ARGS) | 1471 | static int r128_cce_blit(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1484 | { | 1472 | { |
1485 | DRM_DEVICE; | ||
1486 | struct drm_device_dma *dma = dev->dma; | 1473 | struct drm_device_dma *dma = dev->dma; |
1487 | drm_r128_private_t *dev_priv = dev->dev_private; | 1474 | drm_r128_private_t *dev_priv = dev->dev_private; |
1488 | drm_r128_blit_t blit; | 1475 | drm_r128_blit_t *blit = data; |
1489 | int ret; | 1476 | int ret; |
1490 | 1477 | ||
1491 | LOCK_TEST_WITH_RETURN(dev, filp); | 1478 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1492 | |||
1493 | DRM_COPY_FROM_USER_IOCTL(blit, (drm_r128_blit_t __user *) data, | ||
1494 | sizeof(blit)); | ||
1495 | 1479 | ||
1496 | DRM_DEBUG("pid=%d index=%d\n", DRM_CURRENTPID, blit.idx); | 1480 | DRM_DEBUG("pid=%d index=%d\n", DRM_CURRENTPID, blit->idx); |
1497 | 1481 | ||
1498 | if (blit.idx < 0 || blit.idx >= dma->buf_count) { | 1482 | if (blit->idx < 0 || blit->idx >= dma->buf_count) { |
1499 | DRM_ERROR("buffer index %d (of %d max)\n", | 1483 | DRM_ERROR("buffer index %d (of %d max)\n", |
1500 | blit.idx, dma->buf_count - 1); | 1484 | blit->idx, dma->buf_count - 1); |
1501 | return DRM_ERR(EINVAL); | 1485 | return -EINVAL; |
1502 | } | 1486 | } |
1503 | 1487 | ||
1504 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1488 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1505 | VB_AGE_TEST_WITH_RETURN(dev_priv); | 1489 | VB_AGE_TEST_WITH_RETURN(dev_priv); |
1506 | 1490 | ||
1507 | ret = r128_cce_dispatch_blit(filp, dev, &blit); | 1491 | ret = r128_cce_dispatch_blit(dev, file_priv, blit); |
1508 | 1492 | ||
1509 | COMMIT_RING(); | 1493 | COMMIT_RING(); |
1510 | return ret; | 1494 | return ret; |
1511 | } | 1495 | } |
1512 | 1496 | ||
1513 | static int r128_cce_depth(DRM_IOCTL_ARGS) | 1497 | static int r128_cce_depth(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1514 | { | 1498 | { |
1515 | DRM_DEVICE; | ||
1516 | drm_r128_private_t *dev_priv = dev->dev_private; | 1499 | drm_r128_private_t *dev_priv = dev->dev_private; |
1517 | drm_r128_depth_t depth; | 1500 | drm_r128_depth_t *depth = data; |
1518 | int ret; | 1501 | int ret; |
1519 | 1502 | ||
1520 | LOCK_TEST_WITH_RETURN(dev, filp); | 1503 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1521 | |||
1522 | DRM_COPY_FROM_USER_IOCTL(depth, (drm_r128_depth_t __user *) data, | ||
1523 | sizeof(depth)); | ||
1524 | 1504 | ||
1525 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1505 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1526 | 1506 | ||
1527 | ret = DRM_ERR(EINVAL); | 1507 | ret = -EINVAL; |
1528 | switch (depth.func) { | 1508 | switch (depth->func) { |
1529 | case R128_WRITE_SPAN: | 1509 | case R128_WRITE_SPAN: |
1530 | ret = r128_cce_dispatch_write_span(dev, &depth); | 1510 | ret = r128_cce_dispatch_write_span(dev, depth); |
1531 | break; | 1511 | break; |
1532 | case R128_WRITE_PIXELS: | 1512 | case R128_WRITE_PIXELS: |
1533 | ret = r128_cce_dispatch_write_pixels(dev, &depth); | 1513 | ret = r128_cce_dispatch_write_pixels(dev, depth); |
1534 | break; | 1514 | break; |
1535 | case R128_READ_SPAN: | 1515 | case R128_READ_SPAN: |
1536 | ret = r128_cce_dispatch_read_span(dev, &depth); | 1516 | ret = r128_cce_dispatch_read_span(dev, depth); |
1537 | break; | 1517 | break; |
1538 | case R128_READ_PIXELS: | 1518 | case R128_READ_PIXELS: |
1539 | ret = r128_cce_dispatch_read_pixels(dev, &depth); | 1519 | ret = r128_cce_dispatch_read_pixels(dev, depth); |
1540 | break; | 1520 | break; |
1541 | } | 1521 | } |
1542 | 1522 | ||
@@ -1544,20 +1524,16 @@ static int r128_cce_depth(DRM_IOCTL_ARGS) | |||
1544 | return ret; | 1524 | return ret; |
1545 | } | 1525 | } |
1546 | 1526 | ||
1547 | static int r128_cce_stipple(DRM_IOCTL_ARGS) | 1527 | static int r128_cce_stipple(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1548 | { | 1528 | { |
1549 | DRM_DEVICE; | ||
1550 | drm_r128_private_t *dev_priv = dev->dev_private; | 1529 | drm_r128_private_t *dev_priv = dev->dev_private; |
1551 | drm_r128_stipple_t stipple; | 1530 | drm_r128_stipple_t *stipple = data; |
1552 | u32 mask[32]; | 1531 | u32 mask[32]; |
1553 | 1532 | ||
1554 | LOCK_TEST_WITH_RETURN(dev, filp); | 1533 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1555 | |||
1556 | DRM_COPY_FROM_USER_IOCTL(stipple, (drm_r128_stipple_t __user *) data, | ||
1557 | sizeof(stipple)); | ||
1558 | 1534 | ||
1559 | if (DRM_COPY_FROM_USER(&mask, stipple.mask, 32 * sizeof(u32))) | 1535 | if (DRM_COPY_FROM_USER(&mask, stipple->mask, 32 * sizeof(u32))) |
1560 | return DRM_ERR(EFAULT); | 1536 | return -EFAULT; |
1561 | 1537 | ||
1562 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1538 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1563 | 1539 | ||
@@ -1567,61 +1543,58 @@ static int r128_cce_stipple(DRM_IOCTL_ARGS) | |||
1567 | return 0; | 1543 | return 0; |
1568 | } | 1544 | } |
1569 | 1545 | ||
1570 | static int r128_cce_indirect(DRM_IOCTL_ARGS) | 1546 | static int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1571 | { | 1547 | { |
1572 | DRM_DEVICE; | ||
1573 | drm_r128_private_t *dev_priv = dev->dev_private; | 1548 | drm_r128_private_t *dev_priv = dev->dev_private; |
1574 | struct drm_device_dma *dma = dev->dma; | 1549 | struct drm_device_dma *dma = dev->dma; |
1575 | struct drm_buf *buf; | 1550 | struct drm_buf *buf; |
1576 | drm_r128_buf_priv_t *buf_priv; | 1551 | drm_r128_buf_priv_t *buf_priv; |
1577 | drm_r128_indirect_t indirect; | 1552 | drm_r128_indirect_t *indirect = data; |
1578 | #if 0 | 1553 | #if 0 |
1579 | RING_LOCALS; | 1554 | RING_LOCALS; |
1580 | #endif | 1555 | #endif |
1581 | 1556 | ||
1582 | LOCK_TEST_WITH_RETURN(dev, filp); | 1557 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
1583 | 1558 | ||
1584 | if (!dev_priv) { | 1559 | if (!dev_priv) { |
1585 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | 1560 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); |
1586 | return DRM_ERR(EINVAL); | 1561 | return -EINVAL; |
1587 | } | 1562 | } |
1588 | 1563 | ||
1589 | DRM_COPY_FROM_USER_IOCTL(indirect, (drm_r128_indirect_t __user *) data, | ||
1590 | sizeof(indirect)); | ||
1591 | |||
1592 | DRM_DEBUG("indirect: idx=%d s=%d e=%d d=%d\n", | 1564 | DRM_DEBUG("indirect: idx=%d s=%d e=%d d=%d\n", |
1593 | indirect.idx, indirect.start, indirect.end, indirect.discard); | 1565 | indirect->idx, indirect->start, indirect->end, |
1566 | indirect->discard); | ||
1594 | 1567 | ||
1595 | if (indirect.idx < 0 || indirect.idx >= dma->buf_count) { | 1568 | if (indirect->idx < 0 || indirect->idx >= dma->buf_count) { |
1596 | DRM_ERROR("buffer index %d (of %d max)\n", | 1569 | DRM_ERROR("buffer index %d (of %d max)\n", |
1597 | indirect.idx, dma->buf_count - 1); | 1570 | indirect->idx, dma->buf_count - 1); |
1598 | return DRM_ERR(EINVAL); | 1571 | return -EINVAL; |
1599 | } | 1572 | } |
1600 | 1573 | ||
1601 | buf = dma->buflist[indirect.idx]; | 1574 | buf = dma->buflist[indirect->idx]; |
1602 | buf_priv = buf->dev_private; | 1575 | buf_priv = buf->dev_private; |
1603 | 1576 | ||
1604 | if (buf->filp != filp) { | 1577 | if (buf->file_priv != file_priv) { |
1605 | DRM_ERROR("process %d using buffer owned by %p\n", | 1578 | DRM_ERROR("process %d using buffer owned by %p\n", |
1606 | DRM_CURRENTPID, buf->filp); | 1579 | DRM_CURRENTPID, buf->file_priv); |
1607 | return DRM_ERR(EINVAL); | 1580 | return -EINVAL; |
1608 | } | 1581 | } |
1609 | if (buf->pending) { | 1582 | if (buf->pending) { |
1610 | DRM_ERROR("sending pending buffer %d\n", indirect.idx); | 1583 | DRM_ERROR("sending pending buffer %d\n", indirect->idx); |
1611 | return DRM_ERR(EINVAL); | 1584 | return -EINVAL; |
1612 | } | 1585 | } |
1613 | 1586 | ||
1614 | if (indirect.start < buf->used) { | 1587 | if (indirect->start < buf->used) { |
1615 | DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n", | 1588 | DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n", |
1616 | indirect.start, buf->used); | 1589 | indirect->start, buf->used); |
1617 | return DRM_ERR(EINVAL); | 1590 | return -EINVAL; |
1618 | } | 1591 | } |
1619 | 1592 | ||
1620 | RING_SPACE_TEST_WITH_RETURN(dev_priv); | 1593 | RING_SPACE_TEST_WITH_RETURN(dev_priv); |
1621 | VB_AGE_TEST_WITH_RETURN(dev_priv); | 1594 | VB_AGE_TEST_WITH_RETURN(dev_priv); |
1622 | 1595 | ||
1623 | buf->used = indirect.end; | 1596 | buf->used = indirect->end; |
1624 | buf_priv->discard = indirect.discard; | 1597 | buf_priv->discard = indirect->discard; |
1625 | 1598 | ||
1626 | #if 0 | 1599 | #if 0 |
1627 | /* Wait for the 3D stream to idle before the indirect buffer | 1600 | /* Wait for the 3D stream to idle before the indirect buffer |
@@ -1636,46 +1609,42 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS) | |||
1636 | * X server. This is insecure and is thus only available to | 1609 | * X server. This is insecure and is thus only available to |
1637 | * privileged clients. | 1610 | * privileged clients. |
1638 | */ | 1611 | */ |
1639 | r128_cce_dispatch_indirect(dev, buf, indirect.start, indirect.end); | 1612 | r128_cce_dispatch_indirect(dev, buf, indirect->start, indirect->end); |
1640 | 1613 | ||
1641 | COMMIT_RING(); | 1614 | COMMIT_RING(); |
1642 | return 0; | 1615 | return 0; |
1643 | } | 1616 | } |
1644 | 1617 | ||
1645 | static int r128_getparam(DRM_IOCTL_ARGS) | 1618 | static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1646 | { | 1619 | { |
1647 | DRM_DEVICE; | ||
1648 | drm_r128_private_t *dev_priv = dev->dev_private; | 1620 | drm_r128_private_t *dev_priv = dev->dev_private; |
1649 | drm_r128_getparam_t param; | 1621 | drm_r128_getparam_t *param = data; |
1650 | int value; | 1622 | int value; |
1651 | 1623 | ||
1652 | if (!dev_priv) { | 1624 | if (!dev_priv) { |
1653 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | 1625 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); |
1654 | return DRM_ERR(EINVAL); | 1626 | return -EINVAL; |
1655 | } | 1627 | } |
1656 | 1628 | ||
1657 | DRM_COPY_FROM_USER_IOCTL(param, (drm_r128_getparam_t __user *) data, | ||
1658 | sizeof(param)); | ||
1659 | |||
1660 | DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); | 1629 | DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); |
1661 | 1630 | ||
1662 | switch (param.param) { | 1631 | switch (param->param) { |
1663 | case R128_PARAM_IRQ_NR: | 1632 | case R128_PARAM_IRQ_NR: |
1664 | value = dev->irq; | 1633 | value = dev->irq; |
1665 | break; | 1634 | break; |
1666 | default: | 1635 | default: |
1667 | return DRM_ERR(EINVAL); | 1636 | return -EINVAL; |
1668 | } | 1637 | } |
1669 | 1638 | ||
1670 | if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { | 1639 | if (DRM_COPY_TO_USER(param->value, &value, sizeof(int))) { |
1671 | DRM_ERROR("copy_to_user\n"); | 1640 | DRM_ERROR("copy_to_user\n"); |
1672 | return DRM_ERR(EFAULT); | 1641 | return -EFAULT; |
1673 | } | 1642 | } |
1674 | 1643 | ||
1675 | return 0; | 1644 | return 0; |
1676 | } | 1645 | } |
1677 | 1646 | ||
1678 | void r128_driver_preclose(struct drm_device * dev, DRMFILE filp) | 1647 | void r128_driver_preclose(struct drm_device * dev, struct drm_file *file_priv) |
1679 | { | 1648 | { |
1680 | if (dev->dev_private) { | 1649 | if (dev->dev_private) { |
1681 | drm_r128_private_t *dev_priv = dev->dev_private; | 1650 | drm_r128_private_t *dev_priv = dev->dev_private; |
@@ -1690,24 +1659,24 @@ void r128_driver_lastclose(struct drm_device * dev) | |||
1690 | r128_do_cleanup_cce(dev); | 1659 | r128_do_cleanup_cce(dev); |
1691 | } | 1660 | } |
1692 | 1661 | ||
1693 | drm_ioctl_desc_t r128_ioctls[] = { | 1662 | struct drm_ioctl_desc r128_ioctls[] = { |
1694 | [DRM_IOCTL_NR(DRM_R128_INIT)] = {r128_cce_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 1663 | DRM_IOCTL_DEF(DRM_R128_INIT, r128_cce_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1695 | [DRM_IOCTL_NR(DRM_R128_CCE_START)] = {r128_cce_start, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 1664 | DRM_IOCTL_DEF(DRM_R128_CCE_START, r128_cce_start, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1696 | [DRM_IOCTL_NR(DRM_R128_CCE_STOP)] = {r128_cce_stop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 1665 | DRM_IOCTL_DEF(DRM_R128_CCE_STOP, r128_cce_stop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1697 | [DRM_IOCTL_NR(DRM_R128_CCE_RESET)] = {r128_cce_reset, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 1666 | DRM_IOCTL_DEF(DRM_R128_CCE_RESET, r128_cce_reset, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1698 | [DRM_IOCTL_NR(DRM_R128_CCE_IDLE)] = {r128_cce_idle, DRM_AUTH}, | 1667 | DRM_IOCTL_DEF(DRM_R128_CCE_IDLE, r128_cce_idle, DRM_AUTH), |
1699 | [DRM_IOCTL_NR(DRM_R128_RESET)] = {r128_engine_reset, DRM_AUTH}, | 1668 | DRM_IOCTL_DEF(DRM_R128_RESET, r128_engine_reset, DRM_AUTH), |
1700 | [DRM_IOCTL_NR(DRM_R128_FULLSCREEN)] = {r128_fullscreen, DRM_AUTH}, | 1669 | DRM_IOCTL_DEF(DRM_R128_FULLSCREEN, r128_fullscreen, DRM_AUTH), |
1701 | [DRM_IOCTL_NR(DRM_R128_SWAP)] = {r128_cce_swap, DRM_AUTH}, | 1670 | DRM_IOCTL_DEF(DRM_R128_SWAP, r128_cce_swap, DRM_AUTH), |
1702 | [DRM_IOCTL_NR(DRM_R128_FLIP)] = {r128_cce_flip, DRM_AUTH}, | 1671 | DRM_IOCTL_DEF(DRM_R128_FLIP, r128_cce_flip, DRM_AUTH), |
1703 | [DRM_IOCTL_NR(DRM_R128_CLEAR)] = {r128_cce_clear, DRM_AUTH}, | 1672 | DRM_IOCTL_DEF(DRM_R128_CLEAR, r128_cce_clear, DRM_AUTH), |
1704 | [DRM_IOCTL_NR(DRM_R128_VERTEX)] = {r128_cce_vertex, DRM_AUTH}, | 1673 | DRM_IOCTL_DEF(DRM_R128_VERTEX, r128_cce_vertex, DRM_AUTH), |
1705 | [DRM_IOCTL_NR(DRM_R128_INDICES)] = {r128_cce_indices, DRM_AUTH}, | 1674 | DRM_IOCTL_DEF(DRM_R128_INDICES, r128_cce_indices, DRM_AUTH), |
1706 | [DRM_IOCTL_NR(DRM_R128_BLIT)] = {r128_cce_blit, DRM_AUTH}, | 1675 | DRM_IOCTL_DEF(DRM_R128_BLIT, r128_cce_blit, DRM_AUTH), |
1707 | [DRM_IOCTL_NR(DRM_R128_DEPTH)] = {r128_cce_depth, DRM_AUTH}, | 1676 | DRM_IOCTL_DEF(DRM_R128_DEPTH, r128_cce_depth, DRM_AUTH), |
1708 | [DRM_IOCTL_NR(DRM_R128_STIPPLE)] = {r128_cce_stipple, DRM_AUTH}, | 1677 | DRM_IOCTL_DEF(DRM_R128_STIPPLE, r128_cce_stipple, DRM_AUTH), |
1709 | [DRM_IOCTL_NR(DRM_R128_INDIRECT)] = {r128_cce_indirect, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 1678 | DRM_IOCTL_DEF(DRM_R128_INDIRECT, r128_cce_indirect, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1710 | [DRM_IOCTL_NR(DRM_R128_GETPARAM)] = {r128_getparam, DRM_AUTH}, | 1679 | DRM_IOCTL_DEF(DRM_R128_GETPARAM, r128_getparam, DRM_AUTH), |
1711 | }; | 1680 | }; |
1712 | 1681 | ||
1713 | int r128_max_ioctl = DRM_ARRAY_SIZE(r128_ioctls); | 1682 | int r128_max_ioctl = DRM_ARRAY_SIZE(r128_ioctls); |