Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'drm-misc-next-2016-12-08' of git://anongit.freedesktop.org/git/drm-misc into drm-next

Another pile of misc stuff, final one for 4.10. If there's some serious
bugfix still I'll send you a pull for drm-misc-next-fixes (like we do with
intel), otherwise this is it and next pull next year for 4.11.

Most interesting bits are probably Chris' fb helper fixes against mst
hotplug oopses.

* tag 'drm-misc-next-2016-12-08' of git://anongit.freedesktop.org/git/drm-misc: (22 commits)
drm: Take ownership of the dmabuf->obj when exporting
drm: Allow CAP_PRIME on !MODESET
drm/fence: add drm_crtc_create_fence()
drm/bridge: analogix: Don't return -EINVAL when panel doesn't support PSR
drm/atomic: doc: remove old comment about nonblocking commits
drm: Don't block the kworker waiting for mode_config.mutex in output_poll()
drm: Return -ENOTSUPP when called for KMS cap with a non-KMS driver
drm/amdgpu: don't add files at control minor debugfs directory
drm: allow changing DPMS mode
drm/qxl: fix use of uninitialized variable
drm/qxl: Don't register debugfs for control minors
drm/radeon: don't add files at control minor debugfs directory
drm/vmwgfx: Switch to mode_cmd2
drm/vgem: Use ww_mutex_(un)lock even with a NULL context
drm: Make the connector .detect() callback optional
drm/bridge: tc358767: don't warn if display side ASSR enable fails
drm: Initialise drm_mm.head_node.allocated
drm: Fix locking cargo-cult in encoder/plane init/cleanup
drm/doc: Fix indenting in drm_modeset_lock.c comment
drm: Protect fb_helper list manipulation with a mutex
...

+188 -414
-6
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2499 2499 adev->debugfs_count = i; 2500 2500 #if defined(CONFIG_DEBUG_FS) 2501 2501 drm_debugfs_create_files(files, nfiles, 2502 - adev->ddev->control->debugfs_root, 2503 - adev->ddev->control); 2504 - drm_debugfs_create_files(files, nfiles, 2505 2502 adev->ddev->primary->debugfs_root, 2506 2503 adev->ddev->primary); 2507 2504 #endif ··· 2511 2514 unsigned i; 2512 2515 2513 2516 for (i = 0; i < adev->debugfs_count; i++) { 2514 - drm_debugfs_remove_files(adev->debugfs[i].files, 2515 - adev->debugfs[i].num_files, 2516 - adev->ddev->control); 2517 2517 drm_debugfs_remove_files(adev->debugfs[i].files, 2518 2518 adev->debugfs[i].num_files, 2519 2519 adev->ddev->primary);
-7
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
··· 424 424 return 0; 425 425 } 426 426 427 - static enum drm_connector_status 428 - dce_virtual_detect(struct drm_connector *connector, bool force) 429 - { 430 - return connector_status_connected; 431 - } 432 - 433 427 static int 434 428 dce_virtual_set_property(struct drm_connector *connector, 435 429 struct drm_property *property, ··· 452 458 453 459 static const struct drm_connector_funcs dce_virtual_connector_funcs = { 454 460 .dpms = dce_virtual_dpms, 455 - .detect = dce_virtual_detect, 456 461 .fill_modes = drm_helper_probe_single_connector_modes, 457 462 .set_property = dce_virtual_set_property, 458 463 .destroy = dce_virtual_destroy,
-7
drivers/gpu/drm/arc/arcpgu_sim.c
··· 41 41 return count; 42 42 } 43 43 44 - static enum drm_connector_status 45 - arcpgu_drm_connector_detect(struct drm_connector *connector, bool force) 46 - { 47 - return connector_status_connected; 48 - } 49 - 50 44 static void arcpgu_drm_connector_destroy(struct drm_connector *connector) 51 45 { 52 46 drm_connector_unregister(connector); ··· 55 61 static const struct drm_connector_funcs arcpgu_drm_connector_funcs = { 56 62 .dpms = drm_helper_connector_dpms, 57 63 .reset = drm_atomic_helper_connector_reset, 58 - .detect = arcpgu_drm_connector_detect, 59 64 .fill_modes = drm_helper_probe_single_connector_modes, 60 65 .destroy = arcpgu_drm_connector_destroy, 61 66 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/ast/ast_mode.c
··· 839 839 kfree(connector); 840 840 } 841 841 842 - static enum drm_connector_status 843 - ast_connector_detect(struct drm_connector *connector, bool force) 844 - { 845 - return connector_status_connected; 846 - } 847 - 848 842 static const struct drm_connector_helper_funcs ast_connector_helper_funcs = { 849 843 .mode_valid = ast_mode_valid, 850 844 .get_modes = ast_get_modes, ··· 847 853 848 854 static const struct drm_connector_funcs ast_connector_funcs = { 849 855 .dpms = drm_helper_connector_dpms, 850 - .detect = ast_connector_detect, 851 856 .fill_modes = drm_helper_probe_single_connector_modes, 852 857 .destroy = ast_connector_destroy, 853 858 };
-7
drivers/gpu/drm/bochs/bochs_kms.c
··· 216 216 return NULL; 217 217 } 218 218 219 - static enum drm_connector_status bochs_connector_detect(struct drm_connector 220 - *connector, bool force) 221 - { 222 - return connector_status_connected; 223 - } 224 - 225 219 static const struct drm_connector_helper_funcs bochs_connector_connector_helper_funcs = { 226 220 .get_modes = bochs_connector_get_modes, 227 221 .mode_valid = bochs_connector_mode_valid, ··· 224 230 225 231 static const struct drm_connector_funcs bochs_connector_connector_funcs = { 226 232 .dpms = drm_helper_connector_dpms, 227 - .detect = bochs_connector_detect, 228 233 .fill_modes = drm_helper_probe_single_connector_modes, 229 234 .destroy = drm_connector_cleanup, 230 235 };
+2 -2
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
··· 112 112 struct edp_vsc_psr psr_vsc; 113 113 114 114 if (!dp->psr_support) 115 - return -EINVAL; 115 + return 0; 116 116 117 117 /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ 118 118 memset(&psr_vsc, 0, sizeof(psr_vsc)); ··· 135 135 struct edp_vsc_psr psr_vsc; 136 136 137 137 if (!dp->psr_support) 138 - return -EINVAL; 138 + return 0; 139 139 140 140 /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */ 141 141 memset(&psr_vsc, 0, sizeof(psr_vsc));
-7
drivers/gpu/drm/bridge/nxp-ptn3460.c
··· 239 239 .get_modes = ptn3460_get_modes, 240 240 }; 241 241 242 - static enum drm_connector_status ptn3460_detect(struct drm_connector *connector, 243 - bool force) 244 - { 245 - return connector_status_connected; 246 - } 247 - 248 242 static const struct drm_connector_funcs ptn3460_connector_funcs = { 249 243 .dpms = drm_atomic_helper_connector_dpms, 250 244 .fill_modes = drm_helper_probe_single_connector_modes, 251 - .detect = ptn3460_detect, 252 245 .destroy = drm_connector_cleanup, 253 246 .reset = drm_atomic_helper_connector_reset, 254 247 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/bridge/parade-ps8622.c
··· 477 477 .get_modes = ps8622_get_modes, 478 478 }; 479 479 480 - static enum drm_connector_status ps8622_detect(struct drm_connector *connector, 481 - bool force) 482 - { 483 - return connector_status_connected; 484 - } 485 - 486 480 static const struct drm_connector_funcs ps8622_connector_funcs = { 487 481 .dpms = drm_atomic_helper_connector_dpms, 488 482 .fill_modes = drm_helper_probe_single_connector_modes, 489 - .detect = ps8622_detect, 490 483 .destroy = drm_connector_cleanup, 491 484 .reset = drm_atomic_helper_connector_reset, 492 485 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+1 -8
drivers/gpu/drm/bridge/tc358767.c
··· 908 908 goto err_dpcd_read; 909 909 910 910 if (tmp[0] != tc->assr) { 911 - dev_warn(dev, "Failed to switch display ASSR to %d, falling back to unscrambled mode\n", 911 + dev_dbg(dev, "Failed to switch display ASSR to %d, falling back to unscrambled mode\n", 912 912 tc->assr); 913 913 /* trying with disabled scrambler */ 914 914 tc->link.scrambler_dis = 1; ··· 1038 1038 return ret; 1039 1039 } 1040 1040 1041 - static enum drm_connector_status 1042 - tc_connector_detect(struct drm_connector *connector, bool force) 1043 - { 1044 - return connector_status_connected; 1045 - } 1046 - 1047 1041 static void tc_bridge_pre_enable(struct drm_bridge *bridge) 1048 1042 { 1049 1043 struct tc_data *tc = bridge_to_tc(bridge); ··· 1162 1168 static const struct drm_connector_funcs tc_connector_funcs = { 1163 1169 .dpms = drm_atomic_helper_connector_dpms, 1164 1170 .fill_modes = drm_helper_probe_single_connector_modes, 1165 - .detect = tc_connector_detect, 1166 1171 .destroy = drm_connector_cleanup, 1167 1172 .reset = drm_atomic_helper_connector_reset, 1168 1173 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/cirrus/cirrus_mode.c
··· 498 498 return NULL; 499 499 } 500 500 501 - static enum drm_connector_status cirrus_vga_detect(struct drm_connector 502 - *connector, bool force) 503 - { 504 - return connector_status_connected; 505 - } 506 - 507 501 static void cirrus_connector_destroy(struct drm_connector *connector) 508 502 { 509 503 drm_connector_cleanup(connector); ··· 511 517 512 518 static const struct drm_connector_funcs cirrus_vga_connector_funcs = { 513 519 .dpms = drm_helper_connector_dpms, 514 - .detect = cirrus_vga_detect, 515 520 .fill_modes = drm_helper_probe_single_connector_modes, 516 521 .destroy = cirrus_connector_destroy, 517 522 };
+1 -15
drivers/gpu/drm/drm_atomic.c
··· 1864 1864 * helpers and for the DRM event handling for existing userspace. 1865 1865 */ 1866 1866 1867 - static struct dma_fence *get_crtc_fence(struct drm_crtc *crtc) 1868 - { 1869 - struct dma_fence *fence; 1870 - 1871 - fence = kzalloc(sizeof(*fence), GFP_KERNEL); 1872 - if (!fence) 1873 - return NULL; 1874 - 1875 - dma_fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock, 1876 - crtc->fence_context, ++crtc->fence_seqno); 1877 - 1878 - return fence; 1879 - } 1880 - 1881 1867 struct drm_out_fence_state { 1882 1868 s64 __user *out_fence_ptr; 1883 1869 struct sync_file *sync_file; ··· 1945 1959 f[*num_fences].out_fence_ptr = fence_ptr; 1946 1960 *fence_state = f; 1947 1961 1948 - fence = get_crtc_fence(crtc); 1962 + fence = drm_crtc_create_fence(crtc); 1949 1963 if (!fence) 1950 1964 return -ENOMEM; 1951 1965
+2 -5
drivers/gpu/drm/drm_atomic_helper.c
··· 1234 1234 * function implements nonblocking commits, using 1235 1235 * drm_atomic_helper_setup_commit() and related functions. 1236 1236 * 1237 - * Note that right now this function does not support nonblocking commits, hence 1238 - * driver writers must implement their own version for now. 1239 - * 1240 1237 * Committing the actual hardware state is done through the 1241 1238 * ->atomic_commit_tail() callback of the &drm_mode_config_helper_funcs vtable, 1242 1239 * or it's default implementation drm_atomic_helper_commit_tail(). ··· 2882 2885 fail: 2883 2886 if (ret == -EDEADLK) 2884 2887 goto backoff; 2885 - 2886 - connector->dpms = old_mode; 2888 + if (ret != 0) 2889 + connector->dpms = old_mode; 2887 2890 drm_atomic_state_put(state); 2888 2891 return ret; 2889 2892
+17 -1
drivers/gpu/drm/drm_crtc.c
··· 152 152 #endif 153 153 } 154 154 155 + static const struct dma_fence_ops drm_crtc_fence_ops; 156 + 155 157 static struct drm_crtc *fence_to_crtc(struct dma_fence *fence) 156 158 { 157 159 BUG_ON(fence->ops != &drm_crtc_fence_ops); ··· 179 177 return true; 180 178 } 181 179 182 - const struct dma_fence_ops drm_crtc_fence_ops = { 180 + static const struct dma_fence_ops drm_crtc_fence_ops = { 183 181 .get_driver_name = drm_crtc_fence_get_driver_name, 184 182 .get_timeline_name = drm_crtc_fence_get_timeline_name, 185 183 .enable_signaling = drm_crtc_fence_enable_signaling, 186 184 .wait = dma_fence_default_wait, 187 185 }; 186 + 187 + struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc) 188 + { 189 + struct dma_fence *fence; 190 + 191 + fence = kzalloc(sizeof(*fence), GFP_KERNEL); 192 + if (!fence) 193 + return NULL; 194 + 195 + dma_fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock, 196 + crtc->fence_context, ++crtc->fence_seqno); 197 + 198 + return fence; 199 + } 188 200 189 201 /** 190 202 * drm_crtc_init_with_planes - Initialise a new CRTC object with
+1 -1
drivers/gpu/drm/drm_crtc_internal.h
··· 43 43 int drm_crtc_register_all(struct drm_device *dev); 44 44 void drm_crtc_unregister_all(struct drm_device *dev); 45 45 46 - extern const struct dma_fence_ops drm_crtc_fence_ops; 46 + struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc); 47 47 48 48 /* IOCTLs */ 49 49 int drm_mode_getcrtc(struct drm_device *dev,
+1 -8
drivers/gpu/drm/drm_encoder.c
··· 110 110 { 111 111 int ret; 112 112 113 - drm_modeset_lock_all(dev); 114 - 115 113 ret = drm_mode_object_get(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); 116 114 if (ret) 117 - goto out_unlock; 115 + return ret; 118 116 119 117 encoder->dev = dev; 120 118 encoder->encoder_type = encoder_type; ··· 140 142 if (ret) 141 143 drm_mode_object_unregister(dev, &encoder->base); 142 144 143 - out_unlock: 144 - drm_modeset_unlock_all(dev); 145 - 146 145 return ret; 147 146 } 148 147 EXPORT_SYMBOL(drm_encoder_init); ··· 159 164 * the indices on the drm_encoder after us in the encoder_list. 160 165 */ 161 166 162 - drm_modeset_lock_all(dev); 163 167 drm_mode_object_unregister(dev, &encoder->base); 164 168 kfree(encoder->name); 165 169 list_del(&encoder->head); 166 170 dev->mode_config.num_encoder--; 167 - drm_modeset_unlock_all(dev); 168 171 169 172 memset(encoder, 0, sizeof(*encoder)); 170 173 }
+53 -56
drivers/gpu/drm/drm_fb_helper.c
··· 49 49 "Enable legacy fbdev emulation [default=true]"); 50 50 51 51 static LIST_HEAD(kernel_fb_helper_list); 52 + static DEFINE_MUTEX(kernel_fb_helper_lock); 52 53 53 54 /** 54 55 * DOC: fbdev helpers ··· 98 97 * mmap page writes. 99 98 */ 100 99 100 + #define drm_fb_helper_for_each_connector(fbh, i__) \ 101 + for (({ lockdep_assert_held(&(fbh)->dev->mode_config.mutex); }), \ 102 + i__ = 0; i__ < (fbh)->connector_count; i__++) 103 + 101 104 /** 102 105 * drm_fb_helper_single_add_all_connectors() - add all connectors to fbdev 103 106 * emulation helper ··· 135 130 mutex_unlock(&dev->mode_config.mutex); 136 131 return 0; 137 132 fail: 138 - for (i = 0; i < fb_helper->connector_count; i++) { 133 + drm_fb_helper_for_each_connector(fb_helper, i) { 139 134 struct drm_fb_helper_connector *fb_helper_connector = 140 135 fb_helper->connector_info[i]; 141 136 ··· 570 565 continue; 571 566 572 567 /* Walk the connectors & encoders on this fb turning them on/off */ 573 - for (j = 0; j < fb_helper->connector_count; j++) { 568 + drm_fb_helper_for_each_connector(fb_helper, j) { 574 569 connector = fb_helper->connector_info[j]->connector; 575 570 connector->funcs->dpms(connector, dpms_mode); 576 571 drm_object_property_set_value(&connector->base, ··· 856 851 if (!drm_fbdev_emulation) 857 852 return; 858 853 854 + mutex_lock(&kernel_fb_helper_lock); 859 855 if (!list_empty(&fb_helper->kernel_fb_list)) { 860 856 list_del(&fb_helper->kernel_fb_list); 861 857 if (list_empty(&kernel_fb_helper_list)) { 862 858 unregister_sysrq_key('v', &sysrq_drm_fb_helper_restore_op); 863 859 } 864 860 } 861 + mutex_unlock(&kernel_fb_helper_lock); 865 862 866 863 drm_fb_helper_crtc_free(fb_helper); 867 864 ··· 1476 1469 int ret = 0; 1477 1470 int crtc_count = 0; 1478 1471 int i; 1479 - struct fb_info *info; 1480 1472 struct drm_fb_helper_surface_size sizes; 1481 1473 int gamma_size = 0; 1482 1474 ··· 1491 1485 sizes.surface_depth = sizes.surface_bpp = preferred_bpp; 1492 1486 1493 1487 /* first up get a count of crtcs now in use and new min/maxes width/heights */ 1494 - for (i = 0; i < fb_helper->connector_count; i++) { 1488 + drm_fb_helper_for_each_connector(fb_helper, i) { 1495 1489 struct drm_fb_helper_connector *fb_helper_conn = fb_helper->connector_info[i]; 1496 1490 struct drm_cmdline_mode *cmdline_mode; 1497 1491 ··· 1578 1572 if (ret < 0) 1579 1573 return ret; 1580 1574 1581 - info = fb_helper->fbdev; 1582 - 1583 1575 /* 1584 1576 * Set the fb pointer - usually drm_setup_crtcs does this for hotplug 1585 1577 * events, but at init time drm_setup_crtcs needs to be called before ··· 1588 1584 for (i = 0; i < fb_helper->crtc_count; i++) 1589 1585 if (fb_helper->crtc_info[i].mode_set.num_connectors) 1590 1586 fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; 1591 - 1592 - 1593 - info->var.pixclock = 0; 1594 - if (register_framebuffer(info) < 0) 1595 - return -EINVAL; 1596 - 1597 - dev_info(fb_helper->dev->dev, "fb%d: %s frame buffer device\n", 1598 - info->node, info->fix.id); 1599 - 1600 - if (list_empty(&kernel_fb_helper_list)) { 1601 - register_sysrq_key('v', &sysrq_drm_fb_helper_restore_op); 1602 - } 1603 - 1604 - list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list); 1605 1587 1606 1588 return 0; 1607 1589 } ··· 1720 1730 int count = 0; 1721 1731 int i; 1722 1732 1723 - for (i = 0; i < fb_helper->connector_count; i++) { 1733 + drm_fb_helper_for_each_connector(fb_helper, i) { 1724 1734 connector = fb_helper->connector_info[i]->connector; 1725 1735 count += connector->funcs->fill_modes(connector, maxX, maxY); 1726 1736 } ··· 1820 1830 struct drm_connector *connector; 1821 1831 int i = 0; 1822 1832 1823 - for (i = 0; i < fb_helper->connector_count; i++) { 1833 + drm_fb_helper_for_each_connector(fb_helper, i) { 1824 1834 connector = fb_helper->connector_info[i]->connector; 1825 1835 enabled[i] = drm_connector_enabled(connector, true); 1826 1836 DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id, ··· 1831 1841 if (any_enabled) 1832 1842 return; 1833 1843 1834 - for (i = 0; i < fb_helper->connector_count; i++) { 1844 + drm_fb_helper_for_each_connector(fb_helper, i) { 1835 1845 connector = fb_helper->connector_info[i]->connector; 1836 1846 enabled[i] = drm_connector_enabled(connector, false); 1837 1847 } ··· 1852 1862 return false; 1853 1863 1854 1864 count = 0; 1855 - for (i = 0; i < fb_helper->connector_count; i++) { 1865 + drm_fb_helper_for_each_connector(fb_helper, i) { 1856 1866 if (enabled[i]) 1857 1867 count++; 1858 1868 } ··· 1863 1873 1864 1874 /* check the command line or if nothing common pick 1024x768 */ 1865 1875 can_clone = true; 1866 - for (i = 0; i < fb_helper->connector_count; i++) { 1876 + drm_fb_helper_for_each_connector(fb_helper, i) { 1867 1877 if (!enabled[i]) 1868 1878 continue; 1869 1879 fb_helper_conn = fb_helper->connector_info[i]; ··· 1889 1899 can_clone = true; 1890 1900 dmt_mode = drm_mode_find_dmt(fb_helper->dev, 1024, 768, 60, false); 1891 1901 1892 - for (i = 0; i < fb_helper->connector_count; i++) { 1893 - 1902 + drm_fb_helper_for_each_connector(fb_helper, i) { 1894 1903 if (!enabled[i]) 1895 1904 continue; 1896 1905 ··· 1920 1931 int i; 1921 1932 int hoffset = 0, voffset = 0; 1922 1933 1923 - for (i = 0; i < fb_helper->connector_count; i++) { 1934 + drm_fb_helper_for_each_connector(fb_helper, i) { 1924 1935 fb_helper_conn = fb_helper->connector_info[i]; 1925 1936 if (!fb_helper_conn->connector->has_tile) 1926 1937 continue; ··· 1954 1965 int i; 1955 1966 1956 1967 retry: 1957 - for (i = 0; i < fb_helper->connector_count; i++) { 1968 + drm_fb_helper_for_each_connector(fb_helper, i) { 1958 1969 fb_helper_conn = fb_helper->connector_info[i]; 1959 1970 1960 1971 if (conn_configured & BIT_ULL(i)) ··· 2102 2113 return best_score; 2103 2114 } 2104 2115 2105 - static void drm_setup_crtcs(struct drm_fb_helper *fb_helper) 2116 + static void drm_setup_crtcs(struct drm_fb_helper *fb_helper, 2117 + u32 width, u32 height) 2106 2118 { 2107 2119 struct drm_device *dev = fb_helper->dev; 2108 2120 struct drm_fb_helper_crtc **crtcs; 2109 2121 struct drm_display_mode **modes; 2110 2122 struct drm_fb_offset *offsets; 2111 2123 bool *enabled; 2112 - int width, height; 2113 2124 int i; 2114 2125 2115 2126 DRM_DEBUG_KMS("\n"); 2127 + if (drm_fb_helper_probe_connector_modes(fb_helper, width, height) == 0) 2128 + DRM_DEBUG_KMS("No connectors reported connected with modes\n"); 2116 2129 2117 - width = dev->mode_config.max_width; 2118 - height = dev->mode_config.max_height; 2130 + /* prevent concurrent modification of connector_count by hotplug */ 2131 + lockdep_assert_held(&fb_helper->dev->mode_config.mutex); 2119 2132 2120 2133 crtcs = kcalloc(fb_helper->connector_count, 2121 2134 sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL); ··· 2131 2140 DRM_ERROR("Memory allocation failed\n"); 2132 2141 goto out; 2133 2142 } 2134 - 2135 2143 2136 2144 drm_enable_connectors(fb_helper, enabled); 2137 2145 ··· 2160 2170 drm_fb_helper_modeset_release(fb_helper, 2161 2171 &fb_helper->crtc_info[i].mode_set); 2162 2172 2163 - for (i = 0; i < fb_helper->connector_count; i++) { 2173 + drm_fb_helper_for_each_connector(fb_helper, i) { 2164 2174 struct drm_display_mode *mode = modes[i]; 2165 2175 struct drm_fb_helper_crtc *fb_crtc = crtcs[i]; 2166 2176 struct drm_fb_offset *offset = &offsets[i]; ··· 2237 2247 int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel) 2238 2248 { 2239 2249 struct drm_device *dev = fb_helper->dev; 2240 - int count = 0; 2250 + struct fb_info *info; 2251 + int ret; 2241 2252 2242 2253 if (!drm_fbdev_emulation) 2243 2254 return 0; 2244 2255 2245 2256 mutex_lock(&dev->mode_config.mutex); 2246 - count = drm_fb_helper_probe_connector_modes(fb_helper, 2247 - dev->mode_config.max_width, 2248 - dev->mode_config.max_height); 2257 + drm_setup_crtcs(fb_helper, 2258 + dev->mode_config.max_width, 2259 + dev->mode_config.max_height); 2260 + ret = drm_fb_helper_single_fb_probe(fb_helper, bpp_sel); 2249 2261 mutex_unlock(&dev->mode_config.mutex); 2250 - /* 2251 - * we shouldn't end up with no modes here. 2252 - */ 2253 - if (count == 0) 2254 - dev_info(fb_helper->dev->dev, "No connectors reported connected with modes\n"); 2262 + if (ret) 2263 + return ret; 2255 2264 2256 - drm_setup_crtcs(fb_helper); 2265 + info = fb_helper->fbdev; 2266 + info->var.pixclock = 0; 2267 + ret = register_framebuffer(info); 2268 + if (ret < 0) 2269 + return ret; 2257 2270 2258 - return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel); 2271 + dev_info(dev->dev, "fb%d: %s frame buffer device\n", 2272 + info->node, info->fix.id); 2273 + 2274 + mutex_lock(&kernel_fb_helper_lock); 2275 + if (list_empty(&kernel_fb_helper_list)) 2276 + register_sysrq_key('v', &sysrq_drm_fb_helper_restore_op); 2277 + 2278 + list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list); 2279 + mutex_unlock(&kernel_fb_helper_lock); 2280 + 2281 + return 0; 2259 2282 } 2260 2283 EXPORT_SYMBOL(drm_fb_helper_initial_config); 2261 2284 ··· 2296 2293 int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) 2297 2294 { 2298 2295 struct drm_device *dev = fb_helper->dev; 2299 - u32 max_width, max_height; 2300 2296 2301 2297 if (!drm_fbdev_emulation) 2302 2298 return 0; 2303 2299 2304 - mutex_lock(&fb_helper->dev->mode_config.mutex); 2300 + mutex_lock(&dev->mode_config.mutex); 2305 2301 if (!fb_helper->fb || !drm_fb_helper_is_bound(fb_helper)) { 2306 2302 fb_helper->delayed_hotplug = true; 2307 - mutex_unlock(&fb_helper->dev->mode_config.mutex); 2303 + mutex_unlock(&dev->mode_config.mutex); 2308 2304 return 0; 2309 2305 } 2310 2306 DRM_DEBUG_KMS("\n"); 2311 2307 2312 - max_width = fb_helper->fb->width; 2313 - max_height = fb_helper->fb->height; 2308 + drm_setup_crtcs(fb_helper, fb_helper->fb->width, fb_helper->fb->height); 2314 2309 2315 - drm_fb_helper_probe_connector_modes(fb_helper, max_width, max_height); 2316 - mutex_unlock(&fb_helper->dev->mode_config.mutex); 2310 + mutex_unlock(&dev->mode_config.mutex); 2317 2311 2318 - drm_modeset_lock_all(dev); 2319 - drm_setup_crtcs(fb_helper); 2320 - drm_modeset_unlock_all(dev); 2321 2312 drm_fb_helper_set_par(fb_helper->fbdev); 2322 2313 2323 2314 return 0;
+20 -13
drivers/gpu/drm/drm_ioctl.c
··· 229 229 struct drm_crtc *crtc; 230 230 231 231 req->value = 0; 232 + 233 + /* Only some caps make sense with UMS/render-only drivers. */ 234 + switch (req->capability) { 235 + case DRM_CAP_TIMESTAMP_MONOTONIC: 236 + req->value = drm_timestamp_monotonic; 237 + return 0; 238 + case DRM_CAP_PRIME: 239 + req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT : 0; 240 + req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT : 0; 241 + return 0; 242 + } 243 + 244 + /* Other caps only work with KMS drivers */ 245 + if (!drm_core_check_feature(dev, DRIVER_MODESET)) 246 + return -ENOTSUPP; 247 + 232 248 switch (req->capability) { 233 249 case DRM_CAP_DUMB_BUFFER: 234 250 if (dev->driver->dumb_create) ··· 259 243 case DRM_CAP_DUMB_PREFER_SHADOW: 260 244 req->value = dev->mode_config.prefer_shadow; 261 245 break; 262 - case DRM_CAP_PRIME: 263 - req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT : 0; 264 - req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT : 0; 265 - break; 266 - case DRM_CAP_TIMESTAMP_MONOTONIC: 267 - req->value = drm_timestamp_monotonic; 268 - break; 269 246 case DRM_CAP_ASYNC_PAGE_FLIP: 270 247 req->value = dev->mode_config.async_page_flip; 271 248 break; 272 249 case DRM_CAP_PAGE_FLIP_TARGET: 273 - if (drm_core_check_feature(dev, DRIVER_MODESET)) { 274 - req->value = 1; 275 - drm_for_each_crtc(crtc, dev) { 276 - if (!crtc->funcs->page_flip_target) 277 - req->value = 0; 278 - } 250 + req->value = 1; 251 + drm_for_each_crtc(crtc, dev) { 252 + if (!crtc->funcs->page_flip_target) 253 + req->value = 0; 279 254 } 280 255 break; 281 256 case DRM_CAP_CURSOR_WIDTH:
+1
drivers/gpu/drm/drm_mm.c
··· 905 905 906 906 /* Clever trick to avoid a special case in the free hole tracking. */ 907 907 INIT_LIST_HEAD(&mm->head_node.node_list); 908 + mm->head_node.allocated = 0; 908 909 mm->head_node.hole_follows = 1; 909 910 mm->head_node.scanned_block = 0; 910 911 mm->head_node.scanned_prev_free = 0;
+5 -5
drivers/gpu/drm/drm_modeset_lock.c
··· 52 52 * drm_modeset_drop_locks(&ctx); 53 53 * drm_modeset_acquire_fini(&ctx); 54 54 * 55 - * On top of of these per-object locks using &ww_mutex there's also an overall 56 - * dev->mode_config.lock, for protecting everything else. Mostly this means 57 - * probe state of connectors, and preventing hotplug add/removal of connectors. 55 + * On top of of these per-object locks using &ww_mutex there's also an overall 56 + * dev->mode_config.lock, for protecting everything else. Mostly this means 57 + * probe state of connectors, and preventing hotplug add/removal of connectors. 58 58 * 59 - * Finally there's a bunch of dedicated locks to protect drm core internal 60 - * lists and lookup data structures. 59 + * Finally there's a bunch of dedicated locks to protect drm core internal 60 + * lists and lookup data structures. 61 61 */ 62 62 63 63 static DEFINE_WW_CLASS(crtc_ww_class);
+2 -2
drivers/gpu/drm/drm_plane.c
··· 221 221 { 222 222 struct drm_device *dev = plane->dev; 223 223 224 - drm_modeset_lock_all(dev); 224 + drm_modeset_lock_fini(&plane->mutex); 225 + 225 226 kfree(plane->format_types); 226 227 drm_mode_object_unregister(dev, &plane->base); 227 228 ··· 237 236 dev->mode_config.num_total_plane--; 238 237 if (plane->type == DRM_PLANE_TYPE_OVERLAY) 239 238 dev->mode_config.num_overlay_plane--; 240 - drm_modeset_unlock_all(dev); 241 239 242 240 WARN_ON(plane->state && !plane->funcs->atomic_destroy_state); 243 241 if (plane->state && plane->funcs->atomic_destroy_state)
+7 -5
drivers/gpu/drm/drm_prime.c
··· 290 290 * 291 291 * This wraps dma_buf_export() for use by generic GEM drivers that are using 292 292 * drm_gem_dmabuf_release(). In addition to calling dma_buf_export(), we take 293 - * a reference to the drm_device which is released by drm_gem_dmabuf_release(). 293 + * a reference to the &drm_device and the exported &drm_gem_object (stored in 294 + * exp_info->priv) which is released by drm_gem_dmabuf_release(). 294 295 * 295 296 * Returns the new dmabuf. 296 297 */ ··· 301 300 struct dma_buf *dma_buf; 302 301 303 302 dma_buf = dma_buf_export(exp_info); 304 - if (!IS_ERR(dma_buf)) 305 - drm_dev_ref(dev); 303 + if (IS_ERR(dma_buf)) 304 + return dma_buf; 305 + 306 + drm_dev_ref(dev); 307 + drm_gem_object_reference(exp_info->priv); 306 308 307 309 return dma_buf; 308 310 } ··· 476 472 */ 477 473 obj->dma_buf = dmabuf; 478 474 get_dma_buf(obj->dma_buf); 479 - /* Grab a new ref since the callers is now used by the dma-buf */ 480 - drm_gem_object_reference(obj); 481 475 482 476 return dmabuf; 483 477 }
+16 -4
drivers/gpu/drm/drm_probe_helper.c
··· 152 152 } 153 153 EXPORT_SYMBOL(drm_kms_helper_poll_enable_locked); 154 154 155 + static enum drm_connector_status 156 + drm_connector_detect(struct drm_connector *connector, bool force) 157 + { 158 + return connector->funcs->detect ? 159 + connector->funcs->detect(connector, force) : 160 + connector_status_connected; 161 + } 162 + 155 163 /** 156 164 * drm_helper_probe_single_connector_modes - get complete set of display modes 157 165 * @connector: connector to probe ··· 247 239 if (connector->funcs->force) 248 240 connector->funcs->force(connector); 249 241 } else { 250 - connector->status = connector->funcs->detect(connector, true); 242 + connector->status = drm_connector_detect(connector, true); 251 243 } 252 244 253 245 /* ··· 392 384 if (!drm_kms_helper_poll) 393 385 goto out; 394 386 395 - mutex_lock(&dev->mode_config.mutex); 387 + if (!mutex_trylock(&dev->mode_config.mutex)) { 388 + repoll = true; 389 + goto out; 390 + } 391 + 396 392 drm_for_each_connector(connector, dev) { 397 393 398 394 /* Ignore forced connectors. */ ··· 417 405 418 406 repoll = true; 419 407 420 - connector->status = connector->funcs->detect(connector, false); 408 + connector->status = drm_connector_detect(connector, false); 421 409 if (old_status != connector->status) { 422 410 const char *old, *new; 423 411 ··· 577 565 578 566 old_status = connector->status; 579 567 580 - connector->status = connector->funcs->detect(connector, false); 568 + connector->status = drm_connector_detect(connector, false); 581 569 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", 582 570 connector->base.id, 583 571 connector->name,
-7
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
··· 58 58 drm_connector_cleanup(connector); 59 59 } 60 60 61 - static enum drm_connector_status 62 - fsl_dcu_drm_connector_detect(struct drm_connector *connector, bool force) 63 - { 64 - return connector_status_connected; 65 - } 66 - 67 61 static const struct drm_connector_funcs fsl_dcu_drm_connector_funcs = { 68 62 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 69 63 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 70 64 .destroy = fsl_dcu_drm_connector_destroy, 71 - .detect = fsl_dcu_drm_connector_detect, 72 65 .dpms = drm_atomic_helper_connector_dpms, 73 66 .fill_modes = drm_helper_probe_single_connector_modes, 74 67 .reset = drm_atomic_helper_connector_reset,
-14
drivers/gpu/drm/gma500/cdv_intel_lvds.c
··· 387 387 } 388 388 389 389 /** 390 - * Detect the LVDS connection. 391 - * 392 - * This always returns CONNECTOR_STATUS_CONNECTED. 393 - * This connector should only have 394 - * been set up if the LVDS was actually connected anyway. 395 - */ 396 - static enum drm_connector_status cdv_intel_lvds_detect( 397 - struct drm_connector *connector, bool force) 398 - { 399 - return connector_status_connected; 400 - } 401 - 402 - /** 403 390 * Return the list of DDC modes if available, or the BIOS fixed mode otherwise. 404 391 */ 405 392 static int cdv_intel_lvds_get_modes(struct drm_connector *connector) ··· 508 521 509 522 static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = { 510 523 .dpms = drm_helper_connector_dpms, 511 - .detect = cdv_intel_lvds_detect, 512 524 .fill_modes = drm_helper_probe_single_connector_modes, 513 525 .set_property = cdv_intel_lvds_set_property, 514 526 .destroy = cdv_intel_lvds_destroy,
-14
drivers/gpu/drm/gma500/psb_intel_lvds.c
··· 500 500 } 501 501 502 502 /* 503 - * Detect the LVDS connection. 504 - * 505 - * This always returns CONNECTOR_STATUS_CONNECTED. 506 - * This connector should only have 507 - * been set up if the LVDS was actually connected anyway. 508 - */ 509 - static enum drm_connector_status psb_intel_lvds_detect(struct drm_connector 510 - *connector, bool force) 511 - { 512 - return connector_status_connected; 513 - } 514 - 515 - /* 516 503 * Return the list of DDC modes if available, or the BIOS fixed mode otherwise. 517 504 */ 518 505 static int psb_intel_lvds_get_modes(struct drm_connector *connector) ··· 630 643 631 644 const struct drm_connector_funcs psb_intel_lvds_connector_funcs = { 632 645 .dpms = drm_helper_connector_dpms, 633 - .detect = psb_intel_lvds_detect, 634 646 .fill_modes = drm_helper_probe_single_connector_modes, 635 647 .set_property = psb_intel_lvds_set_property, 636 648 .destroy = psb_intel_lvds_destroy,
-7
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
··· 39 39 return drm_encoder_find(connector->dev, connector->encoder_ids[0]); 40 40 } 41 41 42 - static enum drm_connector_status hibmc_connector_detect(struct drm_connector 43 - *connector, bool force) 44 - { 45 - return connector_status_connected; 46 - } 47 - 48 42 static const struct drm_connector_helper_funcs 49 43 hibmc_connector_helper_funcs = { 50 44 .get_modes = hibmc_connector_get_modes, ··· 48 54 49 55 static const struct drm_connector_funcs hibmc_connector_funcs = { 50 56 .dpms = drm_atomic_helper_connector_dpms, 51 - .detect = hibmc_connector_detect, 52 57 .fill_modes = drm_helper_probe_single_connector_modes, 53 58 .destroy = drm_connector_cleanup, 54 59 .reset = drm_atomic_helper_connector_reset,
-7
drivers/gpu/drm/i915/intel_dsi.c
··· 1298 1298 } 1299 1299 } 1300 1300 1301 - static enum drm_connector_status 1302 - intel_dsi_detect(struct drm_connector *connector, bool force) 1303 - { 1304 - return connector_status_connected; 1305 - } 1306 - 1307 1301 static int intel_dsi_get_modes(struct drm_connector *connector) 1308 1302 { 1309 1303 struct intel_connector *intel_connector = to_intel_connector(connector); ··· 1401 1407 1402 1408 static const struct drm_connector_funcs intel_dsi_connector_funcs = { 1403 1409 .dpms = drm_atomic_helper_connector_dpms, 1404 - .detect = intel_dsi_detect, 1405 1410 .late_register = intel_connector_register, 1406 1411 .early_unregister = intel_connector_unregister, 1407 1412 .destroy = intel_dsi_connector_destroy,
-7
drivers/gpu/drm/imx/imx-ldb.c
··· 101 101 const struct bus_mux *lvds_mux; 102 102 }; 103 103 104 - static enum drm_connector_status imx_ldb_connector_detect( 105 - struct drm_connector *connector, bool force) 106 - { 107 - return connector_status_connected; 108 - } 109 - 110 104 static void imx_ldb_ch_set_bus_format(struct imx_ldb_channel *imx_ldb_ch, 111 105 u32 bus_format) 112 106 { ··· 391 397 static const struct drm_connector_funcs imx_ldb_connector_funcs = { 392 398 .dpms = drm_atomic_helper_connector_dpms, 393 399 .fill_modes = drm_helper_probe_single_connector_modes, 394 - .detect = imx_ldb_connector_detect, 395 400 .destroy = imx_drm_connector_destroy, 396 401 .reset = drm_atomic_helper_connector_reset, 397 402 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/imx/imx-tve.c
··· 227 227 TVE_TVDAC_TEST_MODE_MASK, 1); 228 228 } 229 229 230 - static enum drm_connector_status imx_tve_connector_detect( 231 - struct drm_connector *connector, bool force) 232 - { 233 - return connector_status_connected; 234 - } 235 - 236 230 static int imx_tve_connector_get_modes(struct drm_connector *connector) 237 231 { 238 232 struct imx_tve *tve = con_to_tve(connector); ··· 346 352 static const struct drm_connector_funcs imx_tve_connector_funcs = { 347 353 .dpms = drm_atomic_helper_connector_dpms, 348 354 .fill_modes = drm_helper_probe_single_connector_modes, 349 - .detect = imx_tve_connector_detect, 350 355 .destroy = imx_drm_connector_destroy, 351 356 .reset = drm_atomic_helper_connector_reset, 352 357 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/imx/parallel-display.c
··· 49 49 return container_of(e, struct imx_parallel_display, encoder); 50 50 } 51 51 52 - static enum drm_connector_status imx_pd_connector_detect( 53 - struct drm_connector *connector, bool force) 54 - { 55 - return connector_status_connected; 56 - } 57 - 58 52 static int imx_pd_connector_get_modes(struct drm_connector *connector) 59 53 { 60 54 struct imx_parallel_display *imxpd = con_to_imxpd(connector); ··· 137 143 static const struct drm_connector_funcs imx_pd_connector_funcs = { 138 144 .dpms = drm_atomic_helper_connector_dpms, 139 145 .fill_modes = drm_helper_probe_single_connector_modes, 140 - .detect = imx_pd_connector_detect, 141 146 .destroy = imx_drm_connector_destroy, 142 147 .reset = drm_atomic_helper_connector_reset, 143 148 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/mediatek/mtk_dsi.c
··· 594 594 mtk_output_dsi_enable(dsi); 595 595 } 596 596 597 - static enum drm_connector_status mtk_dsi_connector_detect( 598 - struct drm_connector *connector, bool force) 599 - { 600 - return connector_status_connected; 601 - } 602 - 603 597 static int mtk_dsi_connector_get_modes(struct drm_connector *connector) 604 598 { 605 599 struct mtk_dsi *dsi = connector_to_dsi(connector); ··· 610 616 611 617 static const struct drm_connector_funcs mtk_dsi_connector_funcs = { 612 618 .dpms = drm_atomic_helper_connector_dpms, 613 - .detect = mtk_dsi_connector_detect, 614 619 .fill_modes = drm_helper_probe_single_connector_modes, 615 620 .destroy = drm_connector_cleanup, 616 621 .reset = drm_atomic_helper_connector_reset,
-7
drivers/gpu/drm/mgag200/mgag200_mode.c
··· 1658 1658 return NULL; 1659 1659 } 1660 1660 1661 - static enum drm_connector_status mga_vga_detect(struct drm_connector 1662 - *connector, bool force) 1663 - { 1664 - return connector_status_connected; 1665 - } 1666 - 1667 1661 static void mga_connector_destroy(struct drm_connector *connector) 1668 1662 { 1669 1663 struct mga_connector *mga_connector = to_mga_connector(connector); ··· 1674 1680 1675 1681 static const struct drm_connector_funcs mga_vga_connector_funcs = { 1676 1682 .dpms = drm_helper_connector_dpms, 1677 - .detect = mga_vga_detect, 1678 1683 .fill_modes = drm_helper_probe_single_connector_modes, 1679 1684 .destroy = mga_connector_destroy, 1680 1685 };
-6
drivers/gpu/drm/qxl/qxl_debugfs.c
··· 123 123 qdev->debugfs_count = i; 124 124 #if defined(CONFIG_DEBUG_FS) 125 125 drm_debugfs_create_files(files, nfiles, 126 - qdev->ddev->control->debugfs_root, 127 - qdev->ddev->control); 128 - drm_debugfs_create_files(files, nfiles, 129 126 qdev->ddev->primary->debugfs_root, 130 127 qdev->ddev->primary); 131 128 #endif ··· 135 138 unsigned i; 136 139 137 140 for (i = 0; i < qdev->debugfs_count; i++) { 138 - drm_debugfs_remove_files(qdev->debugfs[i].files, 139 - qdev->debugfs[i].num_files, 140 - qdev->ddev->control); 141 141 drm_debugfs_remove_files(qdev->debugfs[i].files, 142 142 qdev->debugfs[i].num_files, 143 143 qdev->ddev->primary);
+1 -1
drivers/gpu/drm/qxl/qxl_release.c
··· 134 134 release = kmalloc(size, GFP_KERNEL); 135 135 if (!release) { 136 136 DRM_ERROR("Out of memory\n"); 137 - return 0; 137 + return -ENOMEM; 138 138 } 139 139 release->base.ops = NULL; 140 140 release->type = type;
-6
drivers/gpu/drm/radeon/radeon_device.c
··· 1949 1949 rdev->debugfs_count = i; 1950 1950 #if defined(CONFIG_DEBUG_FS) 1951 1951 drm_debugfs_create_files(files, nfiles, 1952 - rdev->ddev->control->debugfs_root, 1953 - rdev->ddev->control); 1954 - drm_debugfs_create_files(files, nfiles, 1955 1952 rdev->ddev->primary->debugfs_root, 1956 1953 rdev->ddev->primary); 1957 1954 #endif ··· 1961 1964 unsigned i; 1962 1965 1963 1966 for (i = 0; i < rdev->debugfs_count; i++) { 1964 - drm_debugfs_remove_files(rdev->debugfs[i].files, 1965 - rdev->debugfs[i].num_files, 1966 - rdev->ddev->control); 1967 1967 drm_debugfs_remove_files(rdev->debugfs[i].files, 1968 1968 rdev->debugfs[i].num_files, 1969 1969 rdev->ddev->primary);
-7
drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
··· 61 61 .get_modes = rcar_du_lvds_connector_get_modes, 62 62 }; 63 63 64 - static enum drm_connector_status 65 - rcar_du_lvds_connector_detect(struct drm_connector *connector, bool force) 66 - { 67 - return connector_status_connected; 68 - } 69 - 70 64 static const struct drm_connector_funcs connector_funcs = { 71 65 .dpms = drm_atomic_helper_connector_dpms, 72 66 .reset = drm_atomic_helper_connector_reset, 73 - .detect = rcar_du_lvds_connector_detect, 74 67 .fill_modes = drm_helper_probe_single_connector_modes, 75 68 .destroy = drm_connector_cleanup, 76 69 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/rockchip/dw-mipi-dsi.c
··· 969 969 .mode_valid = dw_mipi_dsi_mode_valid, 970 970 }; 971 971 972 - static enum drm_connector_status 973 - dw_mipi_dsi_detect(struct drm_connector *connector, bool force) 974 - { 975 - return connector_status_connected; 976 - } 977 - 978 972 static void dw_mipi_dsi_drm_connector_destroy(struct drm_connector *connector) 979 973 { 980 974 drm_connector_unregister(connector); ··· 978 984 static struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = { 979 985 .dpms = drm_atomic_helper_connector_dpms, 980 986 .fill_modes = drm_helper_probe_single_connector_modes, 981 - .detect = dw_mipi_dsi_detect, 982 987 .destroy = dw_mipi_dsi_drm_connector_destroy, 983 988 .reset = drm_atomic_helper_connector_reset, 984 989 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/shmobile/shmob_drm_crtc.c
··· 669 669 drm_connector_cleanup(connector); 670 670 } 671 671 672 - static enum drm_connector_status 673 - shmob_drm_connector_detect(struct drm_connector *connector, bool force) 674 - { 675 - return connector_status_connected; 676 - } 677 - 678 672 static const struct drm_connector_funcs connector_funcs = { 679 673 .dpms = drm_helper_connector_dpms, 680 - .detect = shmob_drm_connector_detect, 681 674 .fill_modes = drm_helper_probe_single_connector_modes, 682 675 .destroy = shmob_drm_connector_destroy, 683 676 };
-7
drivers/gpu/drm/sti/sti_hda.c
··· 642 642 .mode_valid = sti_hda_connector_mode_valid, 643 643 }; 644 644 645 - static enum drm_connector_status 646 - sti_hda_connector_detect(struct drm_connector *connector, bool force) 647 - { 648 - return connector_status_connected; 649 - } 650 - 651 645 static int sti_hda_late_register(struct drm_connector *connector) 652 646 { 653 647 struct sti_hda_connector *hda_connector ··· 659 665 static const struct drm_connector_funcs sti_hda_connector_funcs = { 660 666 .dpms = drm_atomic_helper_connector_dpms, 661 667 .fill_modes = drm_helper_probe_single_connector_modes, 662 - .detect = sti_hda_connector_detect, 663 668 .destroy = drm_connector_cleanup, 664 669 .reset = drm_atomic_helper_connector_reset, 665 670 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-7
drivers/gpu/drm/sun4i/sun4i_rgb.c
··· 110 110 .mode_valid = sun4i_rgb_mode_valid, 111 111 }; 112 112 113 - static enum drm_connector_status 114 - sun4i_rgb_connector_detect(struct drm_connector *connector, bool force) 115 - { 116 - return connector_status_connected; 117 - } 118 - 119 113 static void 120 114 sun4i_rgb_connector_destroy(struct drm_connector *connector) 121 115 { ··· 123 129 124 130 static struct drm_connector_funcs sun4i_rgb_con_funcs = { 125 131 .dpms = drm_atomic_helper_connector_dpms, 126 - .detect = sun4i_rgb_connector_detect, 127 132 .fill_modes = drm_helper_probe_single_connector_modes, 128 133 .destroy = sun4i_rgb_connector_destroy, 129 134 .reset = drm_atomic_helper_connector_reset,
-7
drivers/gpu/drm/sun4i/sun4i_tv.c
··· 537 537 .mode_valid = sun4i_tv_comp_mode_valid, 538 538 }; 539 539 540 - static enum drm_connector_status 541 - sun4i_tv_comp_connector_detect(struct drm_connector *connector, bool force) 542 - { 543 - return connector_status_connected; 544 - } 545 - 546 540 static void 547 541 sun4i_tv_comp_connector_destroy(struct drm_connector *connector) 548 542 { ··· 545 551 546 552 static struct drm_connector_funcs sun4i_tv_comp_connector_funcs = { 547 553 .dpms = drm_atomic_helper_connector_dpms, 548 - .detect = sun4i_tv_comp_connector_detect, 549 554 .fill_modes = drm_helper_probe_single_connector_modes, 550 555 .destroy = sun4i_tv_comp_connector_destroy, 551 556 .reset = drm_atomic_helper_connector_reset,
-8
drivers/gpu/drm/tilcdc/tilcdc_panel.c
··· 144 144 drm_connector_cleanup(connector); 145 145 } 146 146 147 - static enum drm_connector_status panel_connector_detect( 148 - struct drm_connector *connector, 149 - bool force) 150 - { 151 - return connector_status_connected; 152 - } 153 - 154 147 static int panel_connector_get_modes(struct drm_connector *connector) 155 148 { 156 149 struct drm_device *dev = connector->dev; ··· 190 197 static const struct drm_connector_funcs panel_connector_funcs = { 191 198 .destroy = panel_connector_destroy, 192 199 .dpms = drm_atomic_helper_connector_dpms, 193 - .detect = panel_connector_detect, 194 200 .fill_modes = drm_helper_probe_single_connector_modes, 195 201 .reset = drm_atomic_helper_connector_reset, 196 202 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+2 -3
drivers/gpu/drm/vgem/vgem_fence.c
··· 126 126 return PTR_ERR(dmabuf); 127 127 128 128 obj->dma_buf = dmabuf; 129 - drm_gem_object_reference(obj); 130 129 return 0; 131 130 } 132 131 ··· 190 191 191 192 /* Expose the fence via the dma-buf */ 192 193 ret = 0; 193 - mutex_lock(&resv->lock.base); 194 + ww_mutex_lock(&resv->lock, NULL); 194 195 if (arg->flags & VGEM_FENCE_WRITE) 195 196 reservation_object_add_excl_fence(resv, fence); 196 197 else if ((ret = reservation_object_reserve_shared(resv)) == 0) 197 198 reservation_object_add_shared_fence(resv, fence); 198 - mutex_unlock(&resv->lock.base); 199 + ww_mutex_unlock(&resv->lock); 199 200 200 201 /* Record the fence in our idr for later signaling */ 201 202 if (ret == 0) {
+10 -9
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
··· 465 465 466 466 static int vmw_fb_kms_framebuffer(struct fb_info *info) 467 467 { 468 - struct drm_mode_fb_cmd mode_cmd; 468 + struct drm_mode_fb_cmd2 mode_cmd; 469 469 struct vmw_fb_par *par = info->par; 470 470 struct fb_var_screeninfo *var = &info->var; 471 471 struct drm_framebuffer *cur_fb; 472 472 struct vmw_framebuffer *vfb; 473 - int ret = 0; 473 + int ret = 0, depth; 474 474 size_t new_bo_size; 475 475 476 - ret = vmw_fb_compute_depth(var, &mode_cmd.depth); 476 + ret = vmw_fb_compute_depth(var, &depth); 477 477 if (ret) 478 478 return ret; 479 479 480 480 mode_cmd.width = var->xres; 481 481 mode_cmd.height = var->yres; 482 - mode_cmd.bpp = var->bits_per_pixel; 483 - mode_cmd.pitch = ((mode_cmd.bpp + 7) / 8) * mode_cmd.width; 482 + mode_cmd.pitches[0] = ((var->bits_per_pixel + 7) / 8) * mode_cmd.width; 483 + mode_cmd.pixel_format = 484 + drm_mode_legacy_fb_format(var->bits_per_pixel, 485 + ((var->bits_per_pixel + 7) / 8) * mode_cmd.width); 484 486 485 487 cur_fb = par->set_fb; 486 488 if (cur_fb && cur_fb->width == mode_cmd.width && 487 489 cur_fb->height == mode_cmd.height && 488 - cur_fb->bits_per_pixel == mode_cmd.bpp && 489 - cur_fb->depth == mode_cmd.depth && 490 - cur_fb->pitches[0] == mode_cmd.pitch) 490 + cur_fb->pixel_format == mode_cmd.pixel_format && 491 + cur_fb->pitches[0] == mode_cmd.pitches[0]) 491 492 return 0; 492 493 493 494 /* Need new buffer object ? */ 494 - new_bo_size = (size_t) mode_cmd.pitch * (size_t) mode_cmd.height; 495 + new_bo_size = (size_t) mode_cmd.pitches[0] * (size_t) mode_cmd.height; 495 496 ret = vmw_fb_kms_detach(par, 496 497 par->bo_size < new_bo_size || 497 498 par->bo_size > 2*new_bo_size,
+42 -74
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 516 516 static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, 517 517 struct vmw_surface *surface, 518 518 struct vmw_framebuffer **out, 519 - const struct drm_mode_fb_cmd 519 + const struct drm_mode_fb_cmd2 520 520 *mode_cmd, 521 521 bool is_dmabuf_proxy) 522 522 ··· 525 525 struct vmw_framebuffer_surface *vfbs; 526 526 enum SVGA3dSurfaceFormat format; 527 527 int ret; 528 + struct drm_format_name_buf format_name; 528 529 529 530 /* 3D is only supported on HWv8 and newer hosts */ 530 531 if (dev_priv->active_display_unit == vmw_du_legacy) ··· 549 548 return -EINVAL; 550 549 } 551 550 552 - switch (mode_cmd->depth) { 553 - case 32: 551 + switch (mode_cmd->pixel_format) { 552 + case DRM_FORMAT_ARGB8888: 554 553 format = SVGA3D_A8R8G8B8; 555 554 break; 556 - case 24: 555 + case DRM_FORMAT_XRGB8888: 557 556 format = SVGA3D_X8R8G8B8; 558 557 break; 559 - case 16: 558 + case DRM_FORMAT_RGB565: 560 559 format = SVGA3D_R5G6B5; 561 560 break; 562 - case 15: 561 + case DRM_FORMAT_XRGB1555: 563 562 format = SVGA3D_A1R5G5B5; 564 563 break; 565 564 default: 566 - DRM_ERROR("Invalid color depth: %d\n", mode_cmd->depth); 565 + DRM_ERROR("Invalid pixel format: %s\n", 566 + drm_get_format_name(mode_cmd->pixel_format, &format_name)); 567 567 return -EINVAL; 568 568 } 569 569 ··· 583 581 goto out_err1; 584 582 } 585 583 586 - /* XXX get the first 3 from the surface info */ 587 - vfbs->base.base.bits_per_pixel = mode_cmd->bpp; 588 - vfbs->base.base.pitches[0] = mode_cmd->pitch; 589 - vfbs->base.base.depth = mode_cmd->depth; 590 - vfbs->base.base.width = mode_cmd->width; 591 - vfbs->base.base.height = mode_cmd->height; 584 + drm_helper_mode_fill_fb_struct(&vfbs->base.base, mode_cmd); 592 585 vfbs->surface = vmw_surface_reference(surface); 593 - vfbs->base.user_handle = mode_cmd->handle; 586 + vfbs->base.user_handle = mode_cmd->handles[0]; 594 587 vfbs->is_dmabuf_proxy = is_dmabuf_proxy; 595 588 596 589 *out = &vfbs->base; ··· 752 755 * 0 on success, error code otherwise 753 756 */ 754 757 static int vmw_create_dmabuf_proxy(struct drm_device *dev, 755 - const struct drm_mode_fb_cmd *mode_cmd, 758 + const struct drm_mode_fb_cmd2 *mode_cmd, 756 759 struct vmw_dma_buffer *dmabuf_mob, 757 760 struct vmw_surface **srf_out) 758 761 { ··· 760 763 struct drm_vmw_size content_base_size; 761 764 struct vmw_resource *res; 762 765 unsigned int bytes_pp; 766 + struct drm_format_name_buf format_name; 763 767 int ret; 764 768 765 - switch (mode_cmd->depth) { 766 - case 32: 767 - case 24: 769 + switch (mode_cmd->pixel_format) { 770 + case DRM_FORMAT_ARGB8888: 771 + case DRM_FORMAT_XRGB8888: 768 772 format = SVGA3D_X8R8G8B8; 769 773 bytes_pp = 4; 770 774 break; 771 775 772 - case 16: 773 - case 15: 776 + case DRM_FORMAT_RGB565: 777 + case DRM_FORMAT_XRGB1555: 774 778 format = SVGA3D_R5G6B5; 775 779 bytes_pp = 2; 776 780 break; ··· 782 784 break; 783 785 784 786 default: 785 - DRM_ERROR("Invalid framebuffer format %d\n", mode_cmd->depth); 787 + DRM_ERROR("Invalid framebuffer format %s\n", 788 + drm_get_format_name(mode_cmd->pixel_format, &format_name)); 786 789 return -EINVAL; 787 790 } 788 791 789 - content_base_size.width = mode_cmd->pitch / bytes_pp; 792 + content_base_size.width = mode_cmd->pitches[0] / bytes_pp; 790 793 content_base_size.height = mode_cmd->height; 791 794 content_base_size.depth = 1; 792 795 ··· 825 826 static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv, 826 827 struct vmw_dma_buffer *dmabuf, 827 828 struct vmw_framebuffer **out, 828 - const struct drm_mode_fb_cmd 829 + const struct drm_mode_fb_cmd2 829 830 *mode_cmd) 830 831 831 832 { 832 833 struct drm_device *dev = dev_priv->dev; 833 834 struct vmw_framebuffer_dmabuf *vfbd; 834 835 unsigned int requested_size; 836 + struct drm_format_name_buf format_name; 835 837 int ret; 836 838 837 - requested_size = mode_cmd->height * mode_cmd->pitch; 839 + requested_size = mode_cmd->height * mode_cmd->pitches[0]; 838 840 if (unlikely(requested_size > dmabuf->base.num_pages * PAGE_SIZE)) { 839 841 DRM_ERROR("Screen buffer object size is too small " 840 842 "for requested mode.\n"); ··· 844 844 845 845 /* Limited framebuffer color depth support for screen objects */ 846 846 if (dev_priv->active_display_unit == vmw_du_screen_object) { 847 - switch (mode_cmd->depth) { 848 - case 32: 849 - case 24: 850 - /* Only support 32 bpp for 32 and 24 depth fbs */ 851 - if (mode_cmd->bpp == 32) 852 - break; 853 - 854 - DRM_ERROR("Invalid color depth/bbp: %d %d\n", 855 - mode_cmd->depth, mode_cmd->bpp); 856 - return -EINVAL; 857 - case 16: 858 - case 15: 859 - /* Only support 16 bpp for 16 and 15 depth fbs */ 860 - if (mode_cmd->bpp == 16) 861 - break; 862 - 863 - DRM_ERROR("Invalid color depth/bbp: %d %d\n", 864 - mode_cmd->depth, mode_cmd->bpp); 865 - return -EINVAL; 847 + switch (mode_cmd->pixel_format) { 848 + case DRM_FORMAT_XRGB8888: 849 + case DRM_FORMAT_ARGB8888: 850 + break; 851 + case DRM_FORMAT_XRGB1555: 852 + case DRM_FORMAT_RGB565: 853 + break; 866 854 default: 867 - DRM_ERROR("Invalid color depth: %d\n", mode_cmd->depth); 855 + DRM_ERROR("Invalid pixel format: %s\n", 856 + drm_get_format_name(mode_cmd->pixel_format, &format_name)); 868 857 return -EINVAL; 869 858 } 870 859 } ··· 864 875 goto out_err1; 865 876 } 866 877 867 - vfbd->base.base.bits_per_pixel = mode_cmd->bpp; 868 - vfbd->base.base.pitches[0] = mode_cmd->pitch; 869 - vfbd->base.base.depth = mode_cmd->depth; 870 - vfbd->base.base.width = mode_cmd->width; 871 - vfbd->base.base.height = mode_cmd->height; 878 + drm_helper_mode_fill_fb_struct(&vfbd->base.base, mode_cmd); 872 879 vfbd->base.dmabuf = true; 873 880 vfbd->buffer = vmw_dmabuf_reference(dmabuf); 874 - vfbd->base.user_handle = mode_cmd->handle; 881 + vfbd->base.user_handle = mode_cmd->handles[0]; 875 882 *out = &vfbd->base; 876 883 877 884 ret = drm_framebuffer_init(dev, &vfbd->base.base, ··· 901 916 struct vmw_dma_buffer *dmabuf, 902 917 struct vmw_surface *surface, 903 918 bool only_2d, 904 - const struct drm_mode_fb_cmd *mode_cmd) 919 + const struct drm_mode_fb_cmd2 *mode_cmd) 905 920 { 906 921 struct vmw_framebuffer *vfb = NULL; 907 922 bool is_dmabuf_proxy = false; ··· 956 971 957 972 static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, 958 973 struct drm_file *file_priv, 959 - const struct drm_mode_fb_cmd2 *mode_cmd2) 974 + const struct drm_mode_fb_cmd2 *mode_cmd) 960 975 { 961 976 struct vmw_private *dev_priv = vmw_priv(dev); 962 977 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; ··· 964 979 struct vmw_surface *surface = NULL; 965 980 struct vmw_dma_buffer *bo = NULL; 966 981 struct ttm_base_object *user_obj; 967 - struct drm_mode_fb_cmd mode_cmd; 968 - const struct drm_format_info *info; 969 982 int ret; 970 - 971 - info = drm_format_info(mode_cmd2->pixel_format); 972 - if (!info || !info->depth) { 973 - struct drm_format_name_buf format_name; 974 - DRM_ERROR("Unsupported framebuffer format %s\n", 975 - drm_get_format_name(mode_cmd2->pixel_format, &format_name)); 976 - return ERR_PTR(-EINVAL); 977 - } 978 - 979 - mode_cmd.width = mode_cmd2->width; 980 - mode_cmd.height = mode_cmd2->height; 981 - mode_cmd.pitch = mode_cmd2->pitches[0]; 982 - mode_cmd.handle = mode_cmd2->handles[0]; 983 - mode_cmd.depth = info->depth; 984 - mode_cmd.bpp = info->cpp[0] * 8; 985 983 986 984 /** 987 985 * This code should be conditioned on Screen Objects not being used. ··· 973 1005 */ 974 1006 975 1007 if (!vmw_kms_validate_mode_vram(dev_priv, 976 - mode_cmd.pitch, 977 - mode_cmd.height)) { 1008 + mode_cmd->pitches[0], 1009 + mode_cmd->height)) { 978 1010 DRM_ERROR("Requested mode exceed bounding box limit.\n"); 979 1011 return ERR_PTR(-ENOMEM); 980 1012 } ··· 988 1020 * command stream using user-space handles. 989 1021 */ 990 1022 991 - user_obj = ttm_base_object_lookup(tfile, mode_cmd.handle); 1023 + user_obj = ttm_base_object_lookup(tfile, mode_cmd->handles[0]); 992 1024 if (unlikely(user_obj == NULL)) { 993 1025 DRM_ERROR("Could not locate requested kms frame buffer.\n"); 994 1026 return ERR_PTR(-ENOENT); ··· 1000 1032 1001 1033 /* returns either a dmabuf or surface */ 1002 1034 ret = vmw_user_lookup_handle(dev_priv, tfile, 1003 - mode_cmd.handle, 1035 + mode_cmd->handles[0], 1004 1036 &surface, &bo); 1005 1037 if (ret) 1006 1038 goto err_out; 1007 1039 1008 1040 vfb = vmw_kms_new_framebuffer(dev_priv, bo, surface, 1009 1041 !(dev_priv->capabilities & SVGA_CAP_3D), 1010 - &mode_cmd); 1042 + mode_cmd); 1011 1043 if (IS_ERR(vfb)) { 1012 1044 ret = PTR_ERR(vfb); 1013 1045 goto err_out;
+1 -1
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
··· 248 248 struct vmw_dma_buffer *dmabuf, 249 249 struct vmw_surface *surface, 250 250 bool only_2d, 251 - const struct drm_mode_fb_cmd *mode_cmd); 251 + const struct drm_mode_fb_cmd2 *mode_cmd); 252 252 int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv, 253 253 unsigned unit, 254 254 u32 max_width,
+3
include/drm/drm_connector.h
··· 262 262 * connector due to a user request. force can be used by the driver to 263 263 * avoid expensive, destructive operations during automated probing. 264 264 * 265 + * This callback is optional, if not implemented the connector will be 266 + * considered as always being attached. 267 + * 265 268 * FIXME: 266 269 * 267 270 * Note that this hook is only called by the probe helper. It's not in