aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/r128_state.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-09-02 22:06:45 -0400
committerDave Airlie <airlied@optimus.(none)>2007-10-14 20:38:20 -0400
commitc153f45f9b7e30289157bba3ff5682291df16caa (patch)
tree33f21e1ebd83ec548751f3d490afe6230ab99972 /drivers/char/drm/r128_state.c
parentb589ee5943a9610ebaea6e4e3433f2ae4d812b0b (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/r128_state.c')
-rw-r--r--drivers/char/drm/r128_state.c210
1 files changed, 89 insertions, 121 deletions
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c
index 029f63b59a7d..b7f483cac6d4 100644
--- a/drivers/char/drm/r128_state.c
+++ b/drivers/char/drm/r128_state.c
@@ -1242,25 +1242,21 @@ static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple)
1242 * IOCTL functions 1242 * IOCTL functions
1243 */ 1243 */
1244 1244
1245static int r128_cce_clear(DRM_IOCTL_ARGS) 1245static int r128_cce_clear(struct drm_device *dev, void *data, struct drm_file *file_priv)
1246{ 1246{
1247 DRM_DEVICE;
1248 drm_r128_private_t *dev_priv = dev->dev_private; 1247 drm_r128_private_t *dev_priv = dev->dev_private;
1249 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; 1248 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
1250 drm_r128_clear_t clear; 1249 drm_r128_clear_t *clear = data;
1251 DRM_DEBUG("\n"); 1250 DRM_DEBUG("\n");
1252 1251
1253 LOCK_TEST_WITH_RETURN(dev, file_priv); 1252 LOCK_TEST_WITH_RETURN(dev, file_priv);
1254 1253
1255 DRM_COPY_FROM_USER_IOCTL(clear, (drm_r128_clear_t __user *) data,
1256 sizeof(clear));
1257
1258 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1254 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1259 1255
1260 if (sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS) 1256 if (sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS)
1261 sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; 1257 sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS;
1262 1258
1263 r128_cce_dispatch_clear(dev, &clear); 1259 r128_cce_dispatch_clear(dev, clear);
1264 COMMIT_RING(); 1260 COMMIT_RING();
1265 1261
1266 /* Make sure we restore the 3D state next time. 1262 /* Make sure we restore the 3D state next time.
@@ -1310,9 +1306,8 @@ static int r128_do_cleanup_pageflip(struct drm_device * dev)
1310 * They can & should be intermixed to support multiple 3d windows. 1306 * They can & should be intermixed to support multiple 3d windows.
1311 */ 1307 */
1312 1308
1313static int r128_cce_flip(DRM_IOCTL_ARGS) 1309static int r128_cce_flip(struct drm_device *dev, void *data, struct drm_file *file_priv)
1314{ 1310{
1315 DRM_DEVICE;
1316 drm_r128_private_t *dev_priv = dev->dev_private; 1311 drm_r128_private_t *dev_priv = dev->dev_private;
1317 DRM_DEBUG("%s\n", __FUNCTION__); 1312 DRM_DEBUG("%s\n", __FUNCTION__);
1318 1313
@@ -1329,9 +1324,8 @@ static int r128_cce_flip(DRM_IOCTL_ARGS)
1329 return 0; 1324 return 0;
1330} 1325}
1331 1326
1332static int r128_cce_swap(DRM_IOCTL_ARGS) 1327static int r128_cce_swap(struct drm_device *dev, void *data, struct drm_file *file_priv)
1333{ 1328{
1334 DRM_DEVICE;
1335 drm_r128_private_t *dev_priv = dev->dev_private; 1329 drm_r128_private_t *dev_priv = dev->dev_private;
1336 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; 1330 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
1337 DRM_DEBUG("%s\n", __FUNCTION__); 1331 DRM_DEBUG("%s\n", __FUNCTION__);
@@ -1351,14 +1345,13 @@ static int r128_cce_swap(DRM_IOCTL_ARGS)
1351 return 0; 1345 return 0;
1352} 1346}
1353 1347
1354static int r128_cce_vertex(DRM_IOCTL_ARGS) 1348static int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file *file_priv)
1355{ 1349{
1356 DRM_DEVICE;
1357 drm_r128_private_t *dev_priv = dev->dev_private; 1350 drm_r128_private_t *dev_priv = dev->dev_private;
1358 struct drm_device_dma *dma = dev->dma; 1351 struct drm_device_dma *dma = dev->dma;
1359 struct drm_buf *buf; 1352 struct drm_buf *buf;
1360 drm_r128_buf_priv_t *buf_priv; 1353 drm_r128_buf_priv_t *buf_priv;
1361 drm_r128_vertex_t vertex; 1354 drm_r128_vertex_t *vertex = data;
1362 1355
1363 LOCK_TEST_WITH_RETURN(dev, file_priv); 1356 LOCK_TEST_WITH_RETURN(dev, file_priv);
1364 1357
@@ -1367,27 +1360,24 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
1367 return -EINVAL; 1360 return -EINVAL;
1368 } 1361 }
1369 1362
1370 DRM_COPY_FROM_USER_IOCTL(vertex, (drm_r128_vertex_t __user *) data,
1371 sizeof(vertex));
1372
1373 DRM_DEBUG("pid=%d index=%d count=%d discard=%d\n", 1363 DRM_DEBUG("pid=%d index=%d count=%d discard=%d\n",
1374 DRM_CURRENTPID, vertex.idx, vertex.count, vertex.discard); 1364 DRM_CURRENTPID, vertex->idx, vertex->count, vertex->discard);
1375 1365
1376 if (vertex.idx < 0 || vertex.idx >= dma->buf_count) { 1366 if (vertex->idx < 0 || vertex->idx >= dma->buf_count) {
1377 DRM_ERROR("buffer index %d (of %d max)\n", 1367 DRM_ERROR("buffer index %d (of %d max)\n",
1378 vertex.idx, dma->buf_count - 1); 1368 vertex->idx, dma->buf_count - 1);
1379 return -EINVAL; 1369 return -EINVAL;
1380 } 1370 }
1381 if (vertex.prim < 0 || 1371 if (vertex->prim < 0 ||
1382 vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { 1372 vertex->prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) {
1383 DRM_ERROR("buffer prim %d\n", vertex.prim); 1373 DRM_ERROR("buffer prim %d\n", vertex->prim);
1384 return -EINVAL; 1374 return -EINVAL;
1385 } 1375 }
1386 1376
1387 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1377 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1388 VB_AGE_TEST_WITH_RETURN(dev_priv); 1378 VB_AGE_TEST_WITH_RETURN(dev_priv);
1389 1379
1390 buf = dma->buflist[vertex.idx]; 1380 buf = dma->buflist[vertex->idx];
1391 buf_priv = buf->dev_private; 1381 buf_priv = buf->dev_private;
1392 1382
1393 if (buf->file_priv != file_priv) { 1383 if (buf->file_priv != file_priv) {
@@ -1396,13 +1386,13 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
1396 return -EINVAL; 1386 return -EINVAL;
1397 } 1387 }
1398 if (buf->pending) { 1388 if (buf->pending) {
1399 DRM_ERROR("sending pending buffer %d\n", vertex.idx); 1389 DRM_ERROR("sending pending buffer %d\n", vertex->idx);
1400 return -EINVAL; 1390 return -EINVAL;
1401 } 1391 }
1402 1392
1403 buf->used = vertex.count; 1393 buf->used = vertex->count;
1404 buf_priv->prim = vertex.prim; 1394 buf_priv->prim = vertex->prim;
1405 buf_priv->discard = vertex.discard; 1395 buf_priv->discard = vertex->discard;
1406 1396
1407 r128_cce_dispatch_vertex(dev, buf); 1397 r128_cce_dispatch_vertex(dev, buf);
1408 1398
@@ -1410,14 +1400,13 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
1410 return 0; 1400 return 0;
1411} 1401}
1412 1402
1413static int r128_cce_indices(DRM_IOCTL_ARGS) 1403static int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file *file_priv)
1414{ 1404{
1415 DRM_DEVICE;
1416 drm_r128_private_t *dev_priv = dev->dev_private; 1405 drm_r128_private_t *dev_priv = dev->dev_private;
1417 struct drm_device_dma *dma = dev->dma; 1406 struct drm_device_dma *dma = dev->dma;
1418 struct drm_buf *buf; 1407 struct drm_buf *buf;
1419 drm_r128_buf_priv_t *buf_priv; 1408 drm_r128_buf_priv_t *buf_priv;
1420 drm_r128_indices_t elts; 1409 drm_r128_indices_t *elts = data;
1421 int count; 1410 int count;
1422 1411
1423 LOCK_TEST_WITH_RETURN(dev, file_priv); 1412 LOCK_TEST_WITH_RETURN(dev, file_priv);
@@ -1427,26 +1416,24 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1427 return -EINVAL; 1416 return -EINVAL;
1428 } 1417 }
1429 1418
1430 DRM_COPY_FROM_USER_IOCTL(elts, (drm_r128_indices_t __user *) data,
1431 sizeof(elts));
1432
1433 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,
1434 elts.idx, elts.start, elts.end, elts.discard); 1420 elts->idx, elts->start, elts->end, elts->discard);
1435 1421
1436 if (elts.idx < 0 || elts.idx >= dma->buf_count) { 1422 if (elts->idx < 0 || elts->idx >= dma->buf_count) {
1437 DRM_ERROR("buffer index %d (of %d max)\n", 1423 DRM_ERROR("buffer index %d (of %d max)\n",
1438 elts.idx, dma->buf_count - 1); 1424 elts->idx, dma->buf_count - 1);
1439 return -EINVAL; 1425 return -EINVAL;
1440 } 1426 }
1441 if (elts.prim < 0 || elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { 1427 if (elts->prim < 0 ||
1442 DRM_ERROR("buffer prim %d\n", elts.prim); 1428 elts->prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) {
1429 DRM_ERROR("buffer prim %d\n", elts->prim);
1443 return -EINVAL; 1430 return -EINVAL;
1444 } 1431 }
1445 1432
1446 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1433 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1447 VB_AGE_TEST_WITH_RETURN(dev_priv); 1434 VB_AGE_TEST_WITH_RETURN(dev_priv);
1448 1435
1449 buf = dma->buflist[elts.idx]; 1436 buf = dma->buflist[elts->idx];
1450 buf_priv = buf->dev_private; 1437 buf_priv = buf->dev_private;
1451 1438
1452 if (buf->file_priv != file_priv) { 1439 if (buf->file_priv != file_priv) {
@@ -1455,89 +1442,81 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1455 return -EINVAL; 1442 return -EINVAL;
1456 } 1443 }
1457 if (buf->pending) { 1444 if (buf->pending) {
1458 DRM_ERROR("sending pending buffer %d\n", elts.idx); 1445 DRM_ERROR("sending pending buffer %d\n", elts->idx);
1459 return -EINVAL; 1446 return -EINVAL;
1460 } 1447 }
1461 1448
1462 count = (elts.end - elts.start) / sizeof(u16); 1449 count = (elts->end - elts->start) / sizeof(u16);
1463 elts.start -= R128_INDEX_PRIM_OFFSET; 1450 elts->start -= R128_INDEX_PRIM_OFFSET;
1464 1451
1465 if (elts.start & 0x7) { 1452 if (elts->start & 0x7) {
1466 DRM_ERROR("misaligned buffer 0x%x\n", elts.start); 1453 DRM_ERROR("misaligned buffer 0x%x\n", elts->start);
1467 return -EINVAL; 1454 return -EINVAL;
1468 } 1455 }
1469 if (elts.start < buf->used) { 1456 if (elts->start < buf->used) {
1470 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);
1471 return -EINVAL; 1458 return -EINVAL;
1472 } 1459 }
1473 1460
1474 buf->used = elts.end; 1461 buf->used = elts->end;
1475 buf_priv->prim = elts.prim; 1462 buf_priv->prim = elts->prim;
1476 buf_priv->discard = elts.discard; 1463 buf_priv->discard = elts->discard;
1477 1464
1478 r128_cce_dispatch_indices(dev, buf, elts.start, elts.end, count); 1465 r128_cce_dispatch_indices(dev, buf, elts->start, elts->end, count);
1479 1466
1480 COMMIT_RING(); 1467 COMMIT_RING();
1481 return 0; 1468 return 0;
1482} 1469}
1483 1470
1484static int r128_cce_blit(DRM_IOCTL_ARGS) 1471static int r128_cce_blit(struct drm_device *dev, void *data, struct drm_file *file_priv)
1485{ 1472{
1486 DRM_DEVICE;
1487 struct drm_device_dma *dma = dev->dma; 1473 struct drm_device_dma *dma = dev->dma;
1488 drm_r128_private_t *dev_priv = dev->dev_private; 1474 drm_r128_private_t *dev_priv = dev->dev_private;
1489 drm_r128_blit_t blit; 1475 drm_r128_blit_t *blit = data;
1490 int ret; 1476 int ret;
1491 1477
1492 LOCK_TEST_WITH_RETURN(dev, file_priv); 1478 LOCK_TEST_WITH_RETURN(dev, file_priv);
1493 1479
1494 DRM_COPY_FROM_USER_IOCTL(blit, (drm_r128_blit_t __user *) data, 1480 DRM_DEBUG("pid=%d index=%d\n", DRM_CURRENTPID, blit->idx);
1495 sizeof(blit));
1496
1497 DRM_DEBUG("pid=%d index=%d\n", DRM_CURRENTPID, blit.idx);
1498 1481
1499 if (blit.idx < 0 || blit.idx >= dma->buf_count) { 1482 if (blit->idx < 0 || blit->idx >= dma->buf_count) {
1500 DRM_ERROR("buffer index %d (of %d max)\n", 1483 DRM_ERROR("buffer index %d (of %d max)\n",
1501 blit.idx, dma->buf_count - 1); 1484 blit->idx, dma->buf_count - 1);
1502 return -EINVAL; 1485 return -EINVAL;
1503 } 1486 }
1504 1487
1505 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1488 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1506 VB_AGE_TEST_WITH_RETURN(dev_priv); 1489 VB_AGE_TEST_WITH_RETURN(dev_priv);
1507 1490
1508 ret = r128_cce_dispatch_blit(dev, file_priv, &blit); 1491 ret = r128_cce_dispatch_blit(dev, file_priv, blit);
1509 1492
1510 COMMIT_RING(); 1493 COMMIT_RING();
1511 return ret; 1494 return ret;
1512} 1495}
1513 1496
1514static int r128_cce_depth(DRM_IOCTL_ARGS) 1497static int r128_cce_depth(struct drm_device *dev, void *data, struct drm_file *file_priv)
1515{ 1498{
1516 DRM_DEVICE;
1517 drm_r128_private_t *dev_priv = dev->dev_private; 1499 drm_r128_private_t *dev_priv = dev->dev_private;
1518 drm_r128_depth_t depth; 1500 drm_r128_depth_t *depth = data;
1519 int ret; 1501 int ret;
1520 1502
1521 LOCK_TEST_WITH_RETURN(dev, file_priv); 1503 LOCK_TEST_WITH_RETURN(dev, file_priv);
1522 1504
1523 DRM_COPY_FROM_USER_IOCTL(depth, (drm_r128_depth_t __user *) data,
1524 sizeof(depth));
1525
1526 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1505 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1527 1506
1528 ret = -EINVAL; 1507 ret = -EINVAL;
1529 switch (depth.func) { 1508 switch (depth->func) {
1530 case R128_WRITE_SPAN: 1509 case R128_WRITE_SPAN:
1531 ret = r128_cce_dispatch_write_span(dev, &depth); 1510 ret = r128_cce_dispatch_write_span(dev, depth);
1532 break; 1511 break;
1533 case R128_WRITE_PIXELS: 1512 case R128_WRITE_PIXELS:
1534 ret = r128_cce_dispatch_write_pixels(dev, &depth); 1513 ret = r128_cce_dispatch_write_pixels(dev, depth);
1535 break; 1514 break;
1536 case R128_READ_SPAN: 1515 case R128_READ_SPAN:
1537 ret = r128_cce_dispatch_read_span(dev, &depth); 1516 ret = r128_cce_dispatch_read_span(dev, depth);
1538 break; 1517 break;
1539 case R128_READ_PIXELS: 1518 case R128_READ_PIXELS:
1540 ret = r128_cce_dispatch_read_pixels(dev, &depth); 1519 ret = r128_cce_dispatch_read_pixels(dev, depth);
1541 break; 1520 break;
1542 } 1521 }
1543 1522
@@ -1545,19 +1524,15 @@ static int r128_cce_depth(DRM_IOCTL_ARGS)
1545 return ret; 1524 return ret;
1546} 1525}
1547 1526
1548static int r128_cce_stipple(DRM_IOCTL_ARGS) 1527static int r128_cce_stipple(struct drm_device *dev, void *data, struct drm_file *file_priv)
1549{ 1528{
1550 DRM_DEVICE;
1551 drm_r128_private_t *dev_priv = dev->dev_private; 1529 drm_r128_private_t *dev_priv = dev->dev_private;
1552 drm_r128_stipple_t stipple; 1530 drm_r128_stipple_t *stipple = data;
1553 u32 mask[32]; 1531 u32 mask[32];
1554 1532
1555 LOCK_TEST_WITH_RETURN(dev, file_priv); 1533 LOCK_TEST_WITH_RETURN(dev, file_priv);
1556 1534
1557 DRM_COPY_FROM_USER_IOCTL(stipple, (drm_r128_stipple_t __user *) data, 1535 if (DRM_COPY_FROM_USER(&mask, stipple->mask, 32 * sizeof(u32)))
1558 sizeof(stipple));
1559
1560 if (DRM_COPY_FROM_USER(&mask, stipple.mask, 32 * sizeof(u32)))
1561 return -EFAULT; 1536 return -EFAULT;
1562 1537
1563 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1538 RING_SPACE_TEST_WITH_RETURN(dev_priv);
@@ -1568,14 +1543,13 @@ static int r128_cce_stipple(DRM_IOCTL_ARGS)
1568 return 0; 1543 return 0;
1569} 1544}
1570 1545
1571static int r128_cce_indirect(DRM_IOCTL_ARGS) 1546static int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file *file_priv)
1572{ 1547{
1573 DRM_DEVICE;
1574 drm_r128_private_t *dev_priv = dev->dev_private; 1548 drm_r128_private_t *dev_priv = dev->dev_private;
1575 struct drm_device_dma *dma = dev->dma; 1549 struct drm_device_dma *dma = dev->dma;
1576 struct drm_buf *buf; 1550 struct drm_buf *buf;
1577 drm_r128_buf_priv_t *buf_priv; 1551 drm_r128_buf_priv_t *buf_priv;
1578 drm_r128_indirect_t indirect; 1552 drm_r128_indirect_t *indirect = data;
1579#if 0 1553#if 0
1580 RING_LOCALS; 1554 RING_LOCALS;
1581#endif 1555#endif
@@ -1587,19 +1561,17 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
1587 return -EINVAL; 1561 return -EINVAL;
1588 } 1562 }
1589 1563
1590 DRM_COPY_FROM_USER_IOCTL(indirect, (drm_r128_indirect_t __user *) data,
1591 sizeof(indirect));
1592
1593 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",
1594 indirect.idx, indirect.start, indirect.end, indirect.discard); 1565 indirect->idx, indirect->start, indirect->end,
1566 indirect->discard);
1595 1567
1596 if (indirect.idx < 0 || indirect.idx >= dma->buf_count) { 1568 if (indirect->idx < 0 || indirect->idx >= dma->buf_count) {
1597 DRM_ERROR("buffer index %d (of %d max)\n", 1569 DRM_ERROR("buffer index %d (of %d max)\n",
1598 indirect.idx, dma->buf_count - 1); 1570 indirect->idx, dma->buf_count - 1);
1599 return -EINVAL; 1571 return -EINVAL;
1600 } 1572 }
1601 1573
1602 buf = dma->buflist[indirect.idx]; 1574 buf = dma->buflist[indirect->idx];
1603 buf_priv = buf->dev_private; 1575 buf_priv = buf->dev_private;
1604 1576
1605 if (buf->file_priv != file_priv) { 1577 if (buf->file_priv != file_priv) {
@@ -1608,21 +1580,21 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
1608 return -EINVAL; 1580 return -EINVAL;
1609 } 1581 }
1610 if (buf->pending) { 1582 if (buf->pending) {
1611 DRM_ERROR("sending pending buffer %d\n", indirect.idx); 1583 DRM_ERROR("sending pending buffer %d\n", indirect->idx);
1612 return -EINVAL; 1584 return -EINVAL;
1613 } 1585 }
1614 1586
1615 if (indirect.start < buf->used) { 1587 if (indirect->start < buf->used) {
1616 DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n", 1588 DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n",
1617 indirect.start, buf->used); 1589 indirect->start, buf->used);
1618 return -EINVAL; 1590 return -EINVAL;
1619 } 1591 }
1620 1592
1621 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1593 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1622 VB_AGE_TEST_WITH_RETURN(dev_priv); 1594 VB_AGE_TEST_WITH_RETURN(dev_priv);
1623 1595
1624 buf->used = indirect.end; 1596 buf->used = indirect->end;
1625 buf_priv->discard = indirect.discard; 1597 buf_priv->discard = indirect->discard;
1626 1598
1627#if 0 1599#if 0
1628 /* Wait for the 3D stream to idle before the indirect buffer 1600 /* Wait for the 3D stream to idle before the indirect buffer
@@ -1637,17 +1609,16 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
1637 * X server. This is insecure and is thus only available to 1609 * X server. This is insecure and is thus only available to
1638 * privileged clients. 1610 * privileged clients.
1639 */ 1611 */
1640 r128_cce_dispatch_indirect(dev, buf, indirect.start, indirect.end); 1612 r128_cce_dispatch_indirect(dev, buf, indirect->start, indirect->end);
1641 1613
1642 COMMIT_RING(); 1614 COMMIT_RING();
1643 return 0; 1615 return 0;
1644} 1616}
1645 1617
1646static int r128_getparam(DRM_IOCTL_ARGS) 1618static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv)
1647{ 1619{
1648 DRM_DEVICE;
1649 drm_r128_private_t *dev_priv = dev->dev_private; 1620 drm_r128_private_t *dev_priv = dev->dev_private;
1650 drm_r128_getparam_t param; 1621 drm_r128_getparam_t *param = data;
1651 int value; 1622 int value;
1652 1623
1653 if (!dev_priv) { 1624 if (!dev_priv) {
@@ -1655,12 +1626,9 @@ static int r128_getparam(DRM_IOCTL_ARGS)
1655 return -EINVAL; 1626 return -EINVAL;
1656 } 1627 }
1657 1628
1658 DRM_COPY_FROM_USER_IOCTL(param, (drm_r128_getparam_t __user *) data,
1659 sizeof(param));
1660
1661 DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); 1629 DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
1662 1630
1663 switch (param.param) { 1631 switch (param->param) {
1664 case R128_PARAM_IRQ_NR: 1632 case R128_PARAM_IRQ_NR:
1665 value = dev->irq; 1633 value = dev->irq;
1666 break; 1634 break;
@@ -1668,7 +1636,7 @@ static int r128_getparam(DRM_IOCTL_ARGS)
1668 return -EINVAL; 1636 return -EINVAL;
1669 } 1637 }
1670 1638
1671 if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { 1639 if (DRM_COPY_TO_USER(param->value, &value, sizeof(int))) {
1672 DRM_ERROR("copy_to_user\n"); 1640 DRM_ERROR("copy_to_user\n");
1673 return -EFAULT; 1641 return -EFAULT;
1674 } 1642 }
@@ -1691,24 +1659,24 @@ void r128_driver_lastclose(struct drm_device * dev)
1691 r128_do_cleanup_cce(dev); 1659 r128_do_cleanup_cce(dev);
1692} 1660}
1693 1661
1694drm_ioctl_desc_t r128_ioctls[] = { 1662struct drm_ioctl_desc r128_ioctls[] = {
1695 [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),
1696 [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),
1697 [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),
1698 [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),
1699 [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),
1700 [DRM_IOCTL_NR(DRM_R128_RESET)] = {r128_engine_reset, DRM_AUTH}, 1668 DRM_IOCTL_DEF(DRM_R128_RESET, r128_engine_reset, DRM_AUTH),
1701 [DRM_IOCTL_NR(DRM_R128_FULLSCREEN)] = {r128_fullscreen, DRM_AUTH}, 1669 DRM_IOCTL_DEF(DRM_R128_FULLSCREEN, r128_fullscreen, DRM_AUTH),
1702 [DRM_IOCTL_NR(DRM_R128_SWAP)] = {r128_cce_swap, DRM_AUTH}, 1670 DRM_IOCTL_DEF(DRM_R128_SWAP, r128_cce_swap, DRM_AUTH),
1703 [DRM_IOCTL_NR(DRM_R128_FLIP)] = {r128_cce_flip, DRM_AUTH}, 1671 DRM_IOCTL_DEF(DRM_R128_FLIP, r128_cce_flip, DRM_AUTH),
1704 [DRM_IOCTL_NR(DRM_R128_CLEAR)] = {r128_cce_clear, DRM_AUTH}, 1672 DRM_IOCTL_DEF(DRM_R128_CLEAR, r128_cce_clear, DRM_AUTH),
1705 [DRM_IOCTL_NR(DRM_R128_VERTEX)] = {r128_cce_vertex, DRM_AUTH}, 1673 DRM_IOCTL_DEF(DRM_R128_VERTEX, r128_cce_vertex, DRM_AUTH),
1706 [DRM_IOCTL_NR(DRM_R128_INDICES)] = {r128_cce_indices, DRM_AUTH}, 1674 DRM_IOCTL_DEF(DRM_R128_INDICES, r128_cce_indices, DRM_AUTH),
1707 [DRM_IOCTL_NR(DRM_R128_BLIT)] = {r128_cce_blit, DRM_AUTH}, 1675 DRM_IOCTL_DEF(DRM_R128_BLIT, r128_cce_blit, DRM_AUTH),
1708 [DRM_IOCTL_NR(DRM_R128_DEPTH)] = {r128_cce_depth, DRM_AUTH}, 1676 DRM_IOCTL_DEF(DRM_R128_DEPTH, r128_cce_depth, DRM_AUTH),
1709 [DRM_IOCTL_NR(DRM_R128_STIPPLE)] = {r128_cce_stipple, DRM_AUTH}, 1677 DRM_IOCTL_DEF(DRM_R128_STIPPLE, r128_cce_stipple, DRM_AUTH),
1710 [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),
1711 [DRM_IOCTL_NR(DRM_R128_GETPARAM)] = {r128_getparam, DRM_AUTH}, 1679 DRM_IOCTL_DEF(DRM_R128_GETPARAM, r128_getparam, DRM_AUTH),
1712}; 1680};
1713 1681
1714int r128_max_ioctl = DRM_ARRAY_SIZE(r128_ioctls); 1682int r128_max_ioctl = DRM_ARRAY_SIZE(r128_ioctls);