aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 4c95b5fd9df3..799e1490cf24 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1073,6 +1073,9 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
1073 uint32_t __user *encoder_id; 1073 uint32_t __user *encoder_id;
1074 struct drm_mode_group *mode_group; 1074 struct drm_mode_group *mode_group;
1075 1075
1076 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1077 return -EINVAL;
1078
1076 mutex_lock(&dev->mode_config.mutex); 1079 mutex_lock(&dev->mode_config.mutex);
1077 1080
1078 /* 1081 /*
@@ -1244,6 +1247,9 @@ int drm_mode_getcrtc(struct drm_device *dev,
1244 struct drm_mode_object *obj; 1247 struct drm_mode_object *obj;
1245 int ret = 0; 1248 int ret = 0;
1246 1249
1250 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1251 return -EINVAL;
1252
1247 mutex_lock(&dev->mode_config.mutex); 1253 mutex_lock(&dev->mode_config.mutex);
1248 1254
1249 obj = drm_mode_object_find(dev, crtc_resp->crtc_id, 1255 obj = drm_mode_object_find(dev, crtc_resp->crtc_id,
@@ -1312,6 +1318,9 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
1312 uint64_t __user *prop_values; 1318 uint64_t __user *prop_values;
1313 uint32_t __user *encoder_ptr; 1319 uint32_t __user *encoder_ptr;
1314 1320
1321 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1322 return -EINVAL;
1323
1315 memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo)); 1324 memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
1316 1325
1317 DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id); 1326 DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id);
@@ -1431,6 +1440,9 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
1431 struct drm_encoder *encoder; 1440 struct drm_encoder *encoder;
1432 int ret = 0; 1441 int ret = 0;
1433 1442
1443 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1444 return -EINVAL;
1445
1434 mutex_lock(&dev->mode_config.mutex); 1446 mutex_lock(&dev->mode_config.mutex);
1435 obj = drm_mode_object_find(dev, enc_resp->encoder_id, 1447 obj = drm_mode_object_find(dev, enc_resp->encoder_id,
1436 DRM_MODE_OBJECT_ENCODER); 1448 DRM_MODE_OBJECT_ENCODER);
@@ -1486,6 +1498,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1486 int ret = 0; 1498 int ret = 0;
1487 int i; 1499 int i;
1488 1500
1501 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1502 return -EINVAL;
1503
1489 mutex_lock(&dev->mode_config.mutex); 1504 mutex_lock(&dev->mode_config.mutex);
1490 obj = drm_mode_object_find(dev, crtc_req->crtc_id, 1505 obj = drm_mode_object_find(dev, crtc_req->crtc_id,
1491 DRM_MODE_OBJECT_CRTC); 1506 DRM_MODE_OBJECT_CRTC);
@@ -1603,6 +1618,9 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
1603 struct drm_crtc *crtc; 1618 struct drm_crtc *crtc;
1604 int ret = 0; 1619 int ret = 0;
1605 1620
1621 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1622 return -EINVAL;
1623
1606 if (!req->flags) { 1624 if (!req->flags) {
1607 DRM_ERROR("no operation set\n"); 1625 DRM_ERROR("no operation set\n");
1608 return -EINVAL; 1626 return -EINVAL;
@@ -1667,6 +1685,9 @@ int drm_mode_addfb(struct drm_device *dev,
1667 struct drm_framebuffer *fb; 1685 struct drm_framebuffer *fb;
1668 int ret = 0; 1686 int ret = 0;
1669 1687
1688 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1689 return -EINVAL;
1690
1670 if ((config->min_width > r->width) || (r->width > config->max_width)) { 1691 if ((config->min_width > r->width) || (r->width > config->max_width)) {
1671 DRM_ERROR("mode new framebuffer width not within limits\n"); 1692 DRM_ERROR("mode new framebuffer width not within limits\n");
1672 return -EINVAL; 1693 return -EINVAL;
@@ -1724,6 +1745,9 @@ int drm_mode_rmfb(struct drm_device *dev,
1724 int ret = 0; 1745 int ret = 0;
1725 int found = 0; 1746 int found = 0;
1726 1747
1748 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1749 return -EINVAL;
1750
1727 mutex_lock(&dev->mode_config.mutex); 1751 mutex_lock(&dev->mode_config.mutex);
1728 obj = drm_mode_object_find(dev, *id, DRM_MODE_OBJECT_FB); 1752 obj = drm_mode_object_find(dev, *id, DRM_MODE_OBJECT_FB);
1729 /* TODO check that we realy get a framebuffer back. */ 1753 /* TODO check that we realy get a framebuffer back. */
@@ -1780,6 +1804,9 @@ int drm_mode_getfb(struct drm_device *dev,
1780 struct drm_framebuffer *fb; 1804 struct drm_framebuffer *fb;
1781 int ret = 0; 1805 int ret = 0;
1782 1806
1807 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1808 return -EINVAL;
1809
1783 mutex_lock(&dev->mode_config.mutex); 1810 mutex_lock(&dev->mode_config.mutex);
1784 obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB); 1811 obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB);
1785 if (!obj) { 1812 if (!obj) {
@@ -1813,6 +1840,9 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
1813 int num_clips; 1840 int num_clips;
1814 int ret = 0; 1841 int ret = 0;
1815 1842
1843 if (!drm_core_check_feature(dev, DRIVER_MODESET))
1844 return -EINVAL;
1845
1816 mutex_lock(&dev->mode_config.mutex); 1846 mutex_lock(&dev->mode_config.mutex);
1817 obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB); 1847 obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB);
1818 if (!obj) { 1848 if (!obj) {
@@ -1996,6 +2026,9 @@ int drm_mode_attachmode_ioctl(struct drm_device *dev,
1996 struct drm_mode_modeinfo *umode = &mode_cmd->mode; 2026 struct drm_mode_modeinfo *umode = &mode_cmd->mode;
1997 int ret = 0; 2027 int ret = 0;
1998 2028
2029 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2030 return -EINVAL;
2031
1999 mutex_lock(&dev->mode_config.mutex); 2032 mutex_lock(&dev->mode_config.mutex);
2000 2033
2001 obj = drm_mode_object_find(dev, mode_cmd->connector_id, DRM_MODE_OBJECT_CONNECTOR); 2034 obj = drm_mode_object_find(dev, mode_cmd->connector_id, DRM_MODE_OBJECT_CONNECTOR);
@@ -2042,6 +2075,9 @@ int drm_mode_detachmode_ioctl(struct drm_device *dev,
2042 struct drm_mode_modeinfo *umode = &mode_cmd->mode; 2075 struct drm_mode_modeinfo *umode = &mode_cmd->mode;
2043 int ret = 0; 2076 int ret = 0;
2044 2077
2078 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2079 return -EINVAL;
2080
2045 mutex_lock(&dev->mode_config.mutex); 2081 mutex_lock(&dev->mode_config.mutex);
2046 2082
2047 obj = drm_mode_object_find(dev, mode_cmd->connector_id, DRM_MODE_OBJECT_CONNECTOR); 2083 obj = drm_mode_object_find(dev, mode_cmd->connector_id, DRM_MODE_OBJECT_CONNECTOR);
@@ -2211,6 +2247,9 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
2211 uint64_t __user *values_ptr; 2247 uint64_t __user *values_ptr;
2212 uint32_t __user *blob_length_ptr; 2248 uint32_t __user *blob_length_ptr;
2213 2249
2250 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2251 return -EINVAL;
2252
2214 mutex_lock(&dev->mode_config.mutex); 2253 mutex_lock(&dev->mode_config.mutex);
2215 obj = drm_mode_object_find(dev, out_resp->prop_id, DRM_MODE_OBJECT_PROPERTY); 2254 obj = drm_mode_object_find(dev, out_resp->prop_id, DRM_MODE_OBJECT_PROPERTY);
2216 if (!obj) { 2255 if (!obj) {
@@ -2333,6 +2372,9 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
2333 int ret = 0; 2372 int ret = 0;
2334 void *blob_ptr; 2373 void *blob_ptr;
2335 2374
2375 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2376 return -EINVAL;
2377
2336 mutex_lock(&dev->mode_config.mutex); 2378 mutex_lock(&dev->mode_config.mutex);
2337 obj = drm_mode_object_find(dev, out_resp->blob_id, DRM_MODE_OBJECT_BLOB); 2379 obj = drm_mode_object_find(dev, out_resp->blob_id, DRM_MODE_OBJECT_BLOB);
2338 if (!obj) { 2380 if (!obj) {
@@ -2393,6 +2435,9 @@ int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
2393 int ret = -EINVAL; 2435 int ret = -EINVAL;
2394 int i; 2436 int i;
2395 2437
2438 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2439 return -EINVAL;
2440
2396 mutex_lock(&dev->mode_config.mutex); 2441 mutex_lock(&dev->mode_config.mutex);
2397 2442
2398 obj = drm_mode_object_find(dev, out_resp->connector_id, DRM_MODE_OBJECT_CONNECTOR); 2443 obj = drm_mode_object_find(dev, out_resp->connector_id, DRM_MODE_OBJECT_CONNECTOR);
@@ -2509,6 +2554,9 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
2509 int size; 2554 int size;
2510 int ret = 0; 2555 int ret = 0;
2511 2556
2557 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2558 return -EINVAL;
2559
2512 mutex_lock(&dev->mode_config.mutex); 2560 mutex_lock(&dev->mode_config.mutex);
2513 obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC); 2561 obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC);
2514 if (!obj) { 2562 if (!obj) {
@@ -2560,6 +2608,9 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
2560 int size; 2608 int size;
2561 int ret = 0; 2609 int ret = 0;
2562 2610
2611 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2612 return -EINVAL;
2613
2563 mutex_lock(&dev->mode_config.mutex); 2614 mutex_lock(&dev->mode_config.mutex);
2564 obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC); 2615 obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC);
2565 if (!obj) { 2616 if (!obj) {