aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-01-31 17:31:09 -0500
committerDave Airlie <airlied@redhat.com>2017-01-31 17:31:09 -0500
commit012bbe28c0e3a479ec7ba6f311710cf8409647d4 (patch)
tree9cfe299e0cfa72a078faa73d5c0a9263d2ebe8a2
parentbb7e98334157de206d7b1283377fdb4ea9e2e8c6 (diff)
parent55d6616585363ff2aa9430bfe1ff1345bdc0599a (diff)
Merge tag 'drm-misc-next-2017-01-30' of git://anongit.freedesktop.org/git/drm-misc into drm-next
Another round of -misc stuff: - Noralf debugfs cleanup cleanup (not yet everything, some more driver patches awaiting acks). - More doc work. - edid/infoframe fixes from Ville. - misc 1-patch fixes all over, as usual Noralf needs this for his tinydrm pull request. * tag 'drm-misc-next-2017-01-30' of git://anongit.freedesktop.org/git/drm-misc: (48 commits) drm/vc4: Remove vc4_debugfs_cleanup() dma/fence: Export enable-signaling tracepoint for emission by drivers drm/tilcdc: Remove tilcdc_debugfs_cleanup() drm/tegra: Remove tegra_debugfs_cleanup() drm/sti: Remove drm_debugfs_remove_files() calls drm/radeon: Remove drm_debugfs_remove_files() call drm/omap: Remove omap_debugfs_cleanup() drm/hdlcd: Remove hdlcd_debugfs_cleanup() drm/etnaviv: Remove etnaviv_debugfs_cleanup() drm/etnaviv: allow build with COMPILE_TEST drm/amd/amdgpu: Remove drm_debugfs_remove_files() call drm/prime: Clarify DMA-BUF/GEM Object lifetime drm/ttm: Make sure BOs being swapped out are cacheable drm/atomic: Remove drm_atomic_debugfs_cleanup() drm: drm_minor_register(): Clean up debugfs on failure drm: debugfs: Remove all files automatically on cleanup drm/fourcc: add vivante tiled layout format modifiers drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F drm/edid: Set AVI infoframe Q even when QS=0 drm/edid: Introduce drm_hdmi_avi_infoframe_quant_range() ...
-rw-r--r--Documentation/gpu/drm-kms.rst8
-rw-r--r--drivers/dma-buf/dma-fence.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c20
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c2
-rw-r--r--drivers/gpu/drm/arm/hdlcd_drv.c7
-rw-r--r--drivers/gpu/drm/bridge/dw-hdmi.c2
-rw-r--r--drivers/gpu/drm/drm_agpsupport.c2
-rw-r--r--drivers/gpu/drm/drm_atomic.c85
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c101
-rw-r--r--drivers/gpu/drm/drm_auth.c4
-rw-r--r--drivers/gpu/drm/drm_blend.c11
-rw-r--r--drivers/gpu/drm/drm_cache.c4
-rw-r--r--drivers/gpu/drm/drm_connector.c21
-rw-r--r--drivers/gpu/drm/drm_crtc.c51
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c28
-rw-r--r--drivers/gpu/drm/drm_crtc_internal.h1
-rw-r--r--drivers/gpu/drm/drm_debugfs.c29
-rw-r--r--drivers/gpu/drm/drm_dp_helper.c2
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c6
-rw-r--r--drivers/gpu/drm/drm_drv.c10
-rw-r--r--drivers/gpu/drm/drm_dumb_buffers.c4
-rw-r--r--drivers/gpu/drm/drm_edid.c65
-rw-r--r--drivers/gpu/drm/drm_encoder.c2
-rw-r--r--drivers/gpu/drm/drm_encoder_slave.c2
-rw-r--r--drivers/gpu/drm/drm_fb_cma_helper.c18
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c48
-rw-r--r--drivers/gpu/drm/drm_fops.c11
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c12
-rw-r--r--drivers/gpu/drm/drm_gem.c24
-rw-r--r--drivers/gpu/drm/drm_internal.h1
-rw-r--r--drivers/gpu/drm/drm_irq.c45
-rw-r--r--drivers/gpu/drm/drm_mm.c4
-rw-r--r--drivers/gpu/drm/drm_mode_config.c7
-rw-r--r--drivers/gpu/drm/drm_modes.c20
-rw-r--r--drivers/gpu/drm/drm_modeset_lock.c10
-rw-r--r--drivers/gpu/drm/drm_pci.c4
-rw-r--r--drivers/gpu/drm/drm_plane.c2
-rw-r--r--drivers/gpu/drm/drm_plane_helper.c9
-rw-r--r--drivers/gpu/drm/drm_platform.c2
-rw-r--r--drivers/gpu/drm/drm_prime.c19
-rw-r--r--drivers/gpu/drm/drm_probe_helper.c14
-rw-r--r--drivers/gpu/drm/drm_property.c4
-rw-r--r--drivers/gpu/drm/drm_sysfs.c2
-rw-r--r--drivers/gpu/drm/etnaviv/Kconfig2
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_drv.c7
-rw-r--r--drivers/gpu/drm/exynos/Kconfig2
-rw-r--r--drivers/gpu/drm/gma500/psb_drv.c6
-rw-r--r--drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c2
-rw-r--r--drivers/gpu/drm/i810/i810_dma.c24
-rw-r--r--drivers/gpu/drm/i810/i810_drv.c1
-rw-r--r--drivers/gpu/drm/i810/i810_drv.h1
-rw-r--r--drivers/gpu/drm/i915/intel_display.c4
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c4
-rw-r--r--drivers/gpu/drm/i915/intel_dp_mst.c3
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c20
-rw-r--r--drivers/gpu/drm/mga/mga_dma.c20
-rw-r--r--drivers/gpu/drm/mga/mga_drv.c37
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_debugfs.c9
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.c1
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c16
-rw-r--r--drivers/gpu/drm/radeon/radeon_dp_mst.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c2
-rw-r--r--drivers/gpu/drm/sti/sti_drv.c48
-rw-r--r--drivers/gpu/drm/sti/sti_dvo.c10
-rw-r--r--drivers/gpu/drm/sti/sti_hda.c11
-rw-r--r--drivers/gpu/drm/sti/sti_hdmi.c11
-rw-r--r--drivers/gpu/drm/sti/sti_tvout.c8
-rw-r--r--drivers/gpu/drm/tegra/drm.c7
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_drv.c12
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_drv.h2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c4
-rw-r--r--drivers/gpu/drm/vc4/vc4_debugfs.c6
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.c1
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.h1
-rw-r--r--drivers/gpu/drm/vc4/vc4_hdmi.c18
-rw-r--r--drivers/gpu/drm/vgem/vgem_fence.c4
-rw-r--r--include/drm/drmP.h15
-rw-r--r--include/drm/drm_atomic.h6
-rw-r--r--include/drm/drm_atomic_helper.h13
-rw-r--r--include/drm/drm_auth.h12
-rw-r--r--include/drm/drm_color_mgmt.h2
-rw-r--r--include/drm/drm_connector.h42
-rw-r--r--include/drm/drm_crtc.h60
-rw-r--r--include/drm/drm_dp_mst_helper.h14
-rw-r--r--include/drm/drm_drv.h32
-rw-r--r--include/drm/drm_edid.h10
-rw-r--r--include/drm/drm_encoder.h2
-rw-r--r--include/drm/drm_fb_cma_helper.h2
-rw-r--r--include/drm/drm_flip_work.h2
-rw-r--r--include/drm/drm_framebuffer.h15
-rw-r--r--include/drm/drm_gem.h16
-rw-r--r--include/drm/drm_irq.h4
-rw-r--r--include/drm/drm_mode_config.h12
-rw-r--r--include/drm/drm_mode_object.h13
-rw-r--r--include/drm/drm_modes.h2
-rw-r--r--include/drm/drm_modeset_helper_vtables.h146
-rw-r--r--include/drm/drm_modeset_lock.h2
-rw-r--r--include/drm/drm_plane.h24
-rw-r--r--include/drm/drm_property.h8
-rw-r--r--include/drm/drm_simple_kms_helper.h16
-rw-r--r--include/uapi/drm/drm_fourcc.h41
-rw-r--r--lib/prime_numbers.c3
107 files changed, 757 insertions, 796 deletions
diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
index 0c9abdc0ee31..4d4068855ec4 100644
--- a/Documentation/gpu/drm-kms.rst
+++ b/Documentation/gpu/drm-kms.rst
@@ -48,11 +48,17 @@ CRTC Abstraction
48================ 48================
49 49
50.. kernel-doc:: drivers/gpu/drm/drm_crtc.c 50.. kernel-doc:: drivers/gpu/drm/drm_crtc.c
51 :export: 51 :doc: overview
52
53CRTC Functions Reference
54--------------------------------
52 55
53.. kernel-doc:: include/drm/drm_crtc.h 56.. kernel-doc:: include/drm/drm_crtc.h
54 :internal: 57 :internal:
55 58
59.. kernel-doc:: drivers/gpu/drm/drm_crtc.c
60 :export:
61
56Frame Buffer Abstraction 62Frame Buffer Abstraction
57======================== 63========================
58 64
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index a1bfc098ea10..d1f1f456f5c4 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -28,6 +28,7 @@
28 28
29EXPORT_TRACEPOINT_SYMBOL(dma_fence_annotate_wait_on); 29EXPORT_TRACEPOINT_SYMBOL(dma_fence_annotate_wait_on);
30EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit); 30EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit);
31EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
31 32
32/* 33/*
33 * fence context counter: each execution context should have its own 34 * fence context counter: each execution context should have its own
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index f4f371fbce16..73863d465f98 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1133,7 +1133,6 @@ int amdgpu_debugfs_fence_init(struct amdgpu_device *adev);
1133 1133
1134#if defined(CONFIG_DEBUG_FS) 1134#if defined(CONFIG_DEBUG_FS)
1135int amdgpu_debugfs_init(struct drm_minor *minor); 1135int amdgpu_debugfs_init(struct drm_minor *minor);
1136void amdgpu_debugfs_cleanup(struct drm_minor *minor);
1137#endif 1136#endif
1138 1137
1139int amdgpu_debugfs_firmware_init(struct amdgpu_device *adev); 1138int amdgpu_debugfs_firmware_init(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index fe3bb94fe58d..2201303b9262 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1852,8 +1852,6 @@ failed:
1852 return r; 1852 return r;
1853} 1853}
1854 1854
1855static void amdgpu_debugfs_remove_files(struct amdgpu_device *adev);
1856
1857/** 1855/**
1858 * amdgpu_device_fini - tear down the driver 1856 * amdgpu_device_fini - tear down the driver
1859 * 1857 *
@@ -1893,7 +1891,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
1893 if (adev->asic_type >= CHIP_BONAIRE) 1891 if (adev->asic_type >= CHIP_BONAIRE)
1894 amdgpu_doorbell_fini(adev); 1892 amdgpu_doorbell_fini(adev);
1895 amdgpu_debugfs_regs_cleanup(adev); 1893 amdgpu_debugfs_regs_cleanup(adev);
1896 amdgpu_debugfs_remove_files(adev);
1897} 1894}
1898 1895
1899 1896
@@ -2507,19 +2504,6 @@ int amdgpu_debugfs_add_files(struct amdgpu_device *adev,
2507 return 0; 2504 return 0;
2508} 2505}
2509 2506
2510static void amdgpu_debugfs_remove_files(struct amdgpu_device *adev)
2511{
2512#if defined(CONFIG_DEBUG_FS)
2513 unsigned i;
2514
2515 for (i = 0; i < adev->debugfs_count; i++) {
2516 drm_debugfs_remove_files(adev->debugfs[i].files,
2517 adev->debugfs[i].num_files,
2518 adev->ddev->primary);
2519 }
2520#endif
2521}
2522
2523#if defined(CONFIG_DEBUG_FS) 2507#if defined(CONFIG_DEBUG_FS)
2524 2508
2525static ssize_t amdgpu_debugfs_regs_read(struct file *f, char __user *buf, 2509static ssize_t amdgpu_debugfs_regs_read(struct file *f, char __user *buf,
@@ -3153,10 +3137,6 @@ int amdgpu_debugfs_init(struct drm_minor *minor)
3153{ 3137{
3154 return 0; 3138 return 0;
3155} 3139}
3156
3157void amdgpu_debugfs_cleanup(struct drm_minor *minor)
3158{
3159}
3160#else 3140#else
3161static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) 3141static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
3162{ 3142{
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 2534adaebe30..ba2816b3cd07 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -686,7 +686,6 @@ static struct drm_driver kms_driver = {
686 DRIVER_USE_AGP | 686 DRIVER_USE_AGP |
687 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | 687 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
688 DRIVER_PRIME | DRIVER_RENDER | DRIVER_MODESET, 688 DRIVER_PRIME | DRIVER_RENDER | DRIVER_MODESET,
689 .dev_priv_size = 0,
690 .load = amdgpu_driver_load_kms, 689 .load = amdgpu_driver_load_kms,
691 .open = amdgpu_driver_open_kms, 690 .open = amdgpu_driver_open_kms,
692 .preclose = amdgpu_driver_preclose_kms, 691 .preclose = amdgpu_driver_preclose_kms,
@@ -701,7 +700,6 @@ static struct drm_driver kms_driver = {
701 .get_scanout_position = amdgpu_get_crtc_scanoutpos, 700 .get_scanout_position = amdgpu_get_crtc_scanoutpos,
702#if defined(CONFIG_DEBUG_FS) 701#if defined(CONFIG_DEBUG_FS)
703 .debugfs_init = amdgpu_debugfs_init, 702 .debugfs_init = amdgpu_debugfs_init,
704 .debugfs_cleanup = amdgpu_debugfs_cleanup,
705#endif 703#endif
706 .irq_preinstall = amdgpu_irq_preinstall, 704 .irq_preinstall = amdgpu_irq_preinstall,
707 .irq_postinstall = amdgpu_irq_postinstall, 705 .irq_postinstall = amdgpu_irq_postinstall,
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index e5f4f4a6546d..a2e5b04cdee3 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -255,12 +255,6 @@ static int hdlcd_debugfs_init(struct drm_minor *minor)
255 return drm_debugfs_create_files(hdlcd_debugfs_list, 255 return drm_debugfs_create_files(hdlcd_debugfs_list,
256 ARRAY_SIZE(hdlcd_debugfs_list), minor->debugfs_root, minor); 256 ARRAY_SIZE(hdlcd_debugfs_list), minor->debugfs_root, minor);
257} 257}
258
259static void hdlcd_debugfs_cleanup(struct drm_minor *minor)
260{
261 drm_debugfs_remove_files(hdlcd_debugfs_list,
262 ARRAY_SIZE(hdlcd_debugfs_list), minor);
263}
264#endif 258#endif
265 259
266static const struct file_operations fops = { 260static const struct file_operations fops = {
@@ -303,7 +297,6 @@ static struct drm_driver hdlcd_driver = {
303 .gem_prime_mmap = drm_gem_cma_prime_mmap, 297 .gem_prime_mmap = drm_gem_cma_prime_mmap,
304#ifdef CONFIG_DEBUG_FS 298#ifdef CONFIG_DEBUG_FS
305 .debugfs_init = hdlcd_debugfs_init, 299 .debugfs_init = hdlcd_debugfs_init,
306 .debugfs_cleanup = hdlcd_debugfs_cleanup,
307#endif 300#endif
308 .fops = &fops, 301 .fops = &fops,
309 .name = "hdlcd", 302 .name = "hdlcd",
diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 4fda0717e789..9a9ec27d9e28 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -2060,7 +2060,9 @@ __dw_hdmi_probe(struct platform_device *pdev,
2060 2060
2061 hdmi->bridge.driver_private = hdmi; 2061 hdmi->bridge.driver_private = hdmi;
2062 hdmi->bridge.funcs = &dw_hdmi_bridge_funcs; 2062 hdmi->bridge.funcs = &dw_hdmi_bridge_funcs;
2063#ifdef CONFIG_OF
2063 hdmi->bridge.of_node = pdev->dev.of_node; 2064 hdmi->bridge.of_node = pdev->dev.of_node;
2065#endif
2064 2066
2065 ret = dw_hdmi_fb_registered(hdmi); 2067 ret = dw_hdmi_fb_registered(hdmi);
2066 if (ret) 2068 if (ret)
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index d621c8a4cf00..c89953449e96 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -421,6 +421,8 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
421 head->base = head->agp_info.aper_base; 421 head->base = head->agp_info.aper_base;
422 return head; 422 return head;
423} 423}
424/* Only exported for i810.ko */
425EXPORT_SYMBOL(drm_agp_init);
424 426
425/** 427/**
426 * drm_legacy_agp_clear - Clear AGP resource list 428 * drm_legacy_agp_clear - Clear AGP resource list
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 6414bcf7f41b..e5b738660d66 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -195,8 +195,8 @@ EXPORT_SYMBOL(drm_atomic_state_default_clear);
195 * all locks. So someone else could sneak in and change the current modeset 195 * all locks. So someone else could sneak in and change the current modeset
196 * configuration. Which means that all the state assembled in @state is no 196 * configuration. Which means that all the state assembled in @state is no
197 * longer an atomic update to the current state, but to some arbitrary earlier 197 * longer an atomic update to the current state, but to some arbitrary earlier
198 * state. Which could break assumptions the driver's ->atomic_check likely 198 * state. Which could break assumptions the driver's
199 * relies on. 199 * &drm_mode_config_funcs.atomic_check likely relies on.
200 * 200 *
201 * Hence we must clear all cached state and completely start over, using this 201 * Hence we must clear all cached state and completely start over, using this
202 * function. 202 * function.
@@ -456,11 +456,10 @@ drm_atomic_replace_property_blob_from_id(struct drm_crtc *crtc,
456 * @property: the property to set 456 * @property: the property to set
457 * @val: the new property value 457 * @val: the new property value
458 * 458 *
459 * Use this instead of calling crtc->atomic_set_property directly. 459 * This function handles generic/core properties and calls out to driver's
460 * This function handles generic/core properties and calls out to 460 * &drm_crtc_funcs.atomic_set_property for driver properties. To ensure
461 * driver's ->atomic_set_property() for driver properties. To ensure 461 * consistent behavior you must call this function rather than the driver hook
462 * consistent behavior you must call this function rather than the 462 * directly.
463 * driver hook directly.
464 * 463 *
465 * RETURNS: 464 * RETURNS:
466 * Zero on success, error code on failure 465 * Zero on success, error code on failure
@@ -532,10 +531,10 @@ EXPORT_SYMBOL(drm_atomic_crtc_set_property);
532 * @property: the property to set 531 * @property: the property to set
533 * @val: return location for the property value 532 * @val: return location for the property value
534 * 533 *
535 * This function handles generic/core properties and calls out to 534 * This function handles generic/core properties and calls out to driver's
536 * driver's ->atomic_get_property() for driver properties. To ensure 535 * &drm_crtc_funcs.atomic_get_property for driver properties. To ensure
537 * consistent behavior you must call this function rather than the 536 * consistent behavior you must call this function rather than the driver hook
538 * driver hook directly. 537 * directly.
539 * 538 *
540 * RETURNS: 539 * RETURNS:
541 * Zero on success, error code on failure 540 * Zero on success, error code on failure
@@ -716,11 +715,10 @@ EXPORT_SYMBOL(drm_atomic_get_plane_state);
716 * @property: the property to set 715 * @property: the property to set
717 * @val: the new property value 716 * @val: the new property value
718 * 717 *
719 * Use this instead of calling plane->atomic_set_property directly. 718 * This function handles generic/core properties and calls out to driver's
720 * This function handles generic/core properties and calls out to 719 * &drm_plane_funcs.atomic_set_property for driver properties. To ensure
721 * driver's ->atomic_set_property() for driver properties. To ensure 720 * consistent behavior you must call this function rather than the driver hook
722 * consistent behavior you must call this function rather than the 721 * directly.
723 * driver hook directly.
724 * 722 *
725 * RETURNS: 723 * RETURNS:
726 * Zero on success, error code on failure 724 * Zero on success, error code on failure
@@ -791,10 +789,10 @@ EXPORT_SYMBOL(drm_atomic_plane_set_property);
791 * @property: the property to set 789 * @property: the property to set
792 * @val: return location for the property value 790 * @val: return location for the property value
793 * 791 *
794 * This function handles generic/core properties and calls out to 792 * This function handles generic/core properties and calls out to driver's
795 * driver's ->atomic_get_property() for driver properties. To ensure 793 * &drm_plane_funcs.atomic_get_property for driver properties. To ensure
796 * consistent behavior you must call this function rather than the 794 * consistent behavior you must call this function rather than the driver hook
797 * driver hook directly. 795 * directly.
798 * 796 *
799 * RETURNS: 797 * RETURNS:
800 * Zero on success, error code on failure 798 * Zero on success, error code on failure
@@ -1057,11 +1055,10 @@ EXPORT_SYMBOL(drm_atomic_get_connector_state);
1057 * @property: the property to set 1055 * @property: the property to set
1058 * @val: the new property value 1056 * @val: the new property value
1059 * 1057 *
1060 * Use this instead of calling connector->atomic_set_property directly. 1058 * This function handles generic/core properties and calls out to driver's
1061 * This function handles generic/core properties and calls out to 1059 * &drm_connector_funcs.atomic_set_property for driver properties. To ensure
1062 * driver's ->atomic_set_property() for driver properties. To ensure 1060 * consistent behavior you must call this function rather than the driver hook
1063 * consistent behavior you must call this function rather than the 1061 * directly.
1064 * driver hook directly.
1065 * 1062 *
1066 * RETURNS: 1063 * RETURNS:
1067 * Zero on success, error code on failure 1064 * Zero on success, error code on failure
@@ -1136,10 +1133,10 @@ static void drm_atomic_connector_print_state(struct drm_printer *p,
1136 * @property: the property to set 1133 * @property: the property to set
1137 * @val: return location for the property value 1134 * @val: return location for the property value
1138 * 1135 *
1139 * This function handles generic/core properties and calls out to 1136 * This function handles generic/core properties and calls out to driver's
1140 * driver's ->atomic_get_property() for driver properties. To ensure 1137 * &drm_connector_funcs.atomic_get_property for driver properties. To ensure
1141 * consistent behavior you must call this function rather than the 1138 * consistent behavior you must call this function rather than the driver hook
1142 * driver hook directly. 1139 * directly.
1143 * 1140 *
1144 * RETURNS: 1141 * RETURNS:
1145 * Zero on success, error code on failure 1142 * Zero on success, error code on failure
@@ -1312,12 +1309,11 @@ EXPORT_SYMBOL(drm_atomic_set_fb_for_plane);
1312 * implicit or explicit fencing. 1309 * implicit or explicit fencing.
1313 * 1310 *
1314 * This function will not set the fence to the state if it was set 1311 * This function will not set the fence to the state if it was set
1315 * via explicit fencing interfaces on the atomic ioctl. It will 1312 * via explicit fencing interfaces on the atomic ioctl. In that case it will
1316 * all drope the reference to the fence as we not storing it 1313 * drop the reference to the fence as we are not storing it anywhere.
1317 * anywhere. 1314 * Otherwise, if &drm_plane_state.fence is not set this function we just set it
1318 * 1315 * with the received implicit fence. In both cases this function consumes a
1319 * Otherwise, if plane_state->fence is not set this function we 1316 * reference for @fence.
1320 * just set it with the received implict fence.
1321 */ 1317 */
1322void 1318void
1323drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state, 1319drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
@@ -1616,7 +1612,7 @@ int drm_atomic_commit(struct drm_atomic_state *state)
1616EXPORT_SYMBOL(drm_atomic_commit); 1612EXPORT_SYMBOL(drm_atomic_commit);
1617 1613
1618/** 1614/**
1619 * drm_atomic_nonblocking_commit - atomic&nonblocking configuration commit 1615 * drm_atomic_nonblocking_commit - atomic nonblocking commit
1620 * @state: atomic configuration to check 1616 * @state: atomic configuration to check
1621 * 1617 *
1622 * Note that this function can return -EDEADLK if the driver needed to acquire 1618 * Note that this function can return -EDEADLK if the driver needed to acquire
@@ -1731,13 +1727,6 @@ int drm_atomic_debugfs_init(struct drm_minor *minor)
1731 ARRAY_SIZE(drm_atomic_debugfs_list), 1727 ARRAY_SIZE(drm_atomic_debugfs_list),
1732 minor->debugfs_root, minor); 1728 minor->debugfs_root, minor);
1733} 1729}
1734
1735int drm_atomic_debugfs_cleanup(struct drm_minor *minor)
1736{
1737 return drm_debugfs_remove_files(drm_atomic_debugfs_list,
1738 ARRAY_SIZE(drm_atomic_debugfs_list),
1739 minor);
1740}
1741#endif 1730#endif
1742 1731
1743/* 1732/*
@@ -1829,10 +1818,10 @@ static int atomic_set_prop(struct drm_atomic_state *state,
1829 * @plane_mask: plane mask for planes that were updated. 1818 * @plane_mask: plane mask for planes that were updated.
1830 * @ret: return value, can be -EDEADLK for a retry. 1819 * @ret: return value, can be -EDEADLK for a retry.
1831 * 1820 *
1832 * Before doing an update plane->old_fb is set to plane->fb, 1821 * Before doing an update &drm_plane.old_fb is set to &drm_plane.fb, but before
1833 * but before dropping the locks old_fb needs to be set to NULL 1822 * dropping the locks old_fb needs to be set to NULL and plane->fb updated. This
1834 * and plane->fb updated. This is a common operation for each 1823 * is a common operation for each atomic update, so this call is split off as a
1835 * atomic update, so this call is split off as a helper. 1824 * helper.
1836 */ 1825 */
1837void drm_atomic_clean_old_fb(struct drm_device *dev, 1826void drm_atomic_clean_old_fb(struct drm_device *dev,
1838 unsigned plane_mask, 1827 unsigned plane_mask,
@@ -1873,7 +1862,7 @@ EXPORT_SYMBOL(drm_atomic_clean_old_fb);
1873 * As a contrast, with implicit fencing the kernel keeps track of any 1862 * As a contrast, with implicit fencing the kernel keeps track of any
1874 * ongoing rendering, and automatically ensures that the atomic update waits 1863 * ongoing rendering, and automatically ensures that the atomic update waits
1875 * for any pending rendering to complete. For shared buffers represented with 1864 * for any pending rendering to complete. For shared buffers represented with
1876 * a &struct dma_buf this is tracked in &reservation_object structures. 1865 * a &struct dma_buf this is tracked in &struct reservation_object.
1877 * Implicit syncing is how Linux traditionally worked (e.g. DRI2/3 on X.org), 1866 * Implicit syncing is how Linux traditionally worked (e.g. DRI2/3 on X.org),
1878 * whereas explicit fencing is what Android wants. 1867 * whereas explicit fencing is what Android wants.
1879 * 1868 *
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index b26e3419027e..9a08445a7a7a 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -458,22 +458,25 @@ mode_fixup(struct drm_atomic_state *state)
458 * Check the state object to see if the requested state is physically possible. 458 * Check the state object to see if the requested state is physically possible.
459 * This does all the crtc and connector related computations for an atomic 459 * This does all the crtc and connector related computations for an atomic
460 * update and adds any additional connectors needed for full modesets and calls 460 * update and adds any additional connectors needed for full modesets and calls
461 * down into ->mode_fixup functions of the driver backend. 461 * down into &drm_crtc_helper_funcs.mode_fixup and
462 * 462 * &drm_encoder_helper_funcs.mode_fixup or
463 * crtc_state->mode_changed is set when the input mode is changed. 463 * &drm_encoder_helper_funcs.atomic_check functions of the driver backend.
464 * crtc_state->connectors_changed is set when a connector is added or 464 *
465 * removed from the crtc. 465 * &drm_crtc_state.mode_changed is set when the input mode is changed.
466 * crtc_state->active_changed is set when crtc_state->active changes, 466 * &drm_crtc_state.connectors_changed is set when a connector is added or
467 * which is used for dpms. 467 * removed from the crtc. &drm_crtc_state.active_changed is set when
468 * &drm_crtc_state.active changes, which is used for DPMS.
468 * See also: drm_atomic_crtc_needs_modeset() 469 * See also: drm_atomic_crtc_needs_modeset()
469 * 470 *
470 * IMPORTANT: 471 * IMPORTANT:
471 * 472 *
472 * Drivers which set ->mode_changed (e.g. in their ->atomic_check hooks if a 473 * Drivers which set &drm_crtc_state.mode_changed (e.g. in their
473 * plane update can't be done without a full modeset) _must_ call this function 474 * &drm_plane_helper_funcs.atomic_check hooks if a plane update can't be done
474 * afterwards after that change. It is permitted to call this function multiple 475 * without a full modeset) _must_ call this function afterwards after that
475 * times for the same update, e.g. when the ->atomic_check functions depend upon 476 * change. It is permitted to call this function multiple times for the same
476 * the adjusted dotclock for fifo space allocation and watermark computation. 477 * update, e.g. when the &drm_crtc_helper_funcs.atomic_check functions depend
478 * upon the adjusted dotclock for fifo space allocation and watermark
479 * computation.
477 * 480 *
478 * RETURNS: 481 * RETURNS:
479 * Zero for success or -errno 482 * Zero for success or -errno
@@ -584,9 +587,10 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
584 * 587 *
585 * Check the state object to see if the requested state is physically possible. 588 * Check the state object to see if the requested state is physically possible.
586 * This does all the plane update related checks using by calling into the 589 * This does all the plane update related checks using by calling into the
587 * ->atomic_check hooks provided by the driver. 590 * &drm_crtc_helper_funcs.atomic_check and &drm_plane_helper_funcs.atomic_check
591 * hooks provided by the driver.
588 * 592 *
589 * It also sets crtc_state->planes_changed to indicate that a crtc has 593 * It also sets &drm_crtc_state.planes_changed to indicate that a crtc has
590 * updated planes. 594 * updated planes.
591 * 595 *
592 * RETURNS: 596 * RETURNS:
@@ -648,14 +652,15 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
648 * Check the state object to see if the requested state is physically possible. 652 * Check the state object to see if the requested state is physically possible.
649 * Only crtcs and planes have check callbacks, so for any additional (global) 653 * Only crtcs and planes have check callbacks, so for any additional (global)
650 * checking that a driver needs it can simply wrap that around this function. 654 * checking that a driver needs it can simply wrap that around this function.
651 * Drivers without such needs can directly use this as their ->atomic_check() 655 * Drivers without such needs can directly use this as their
652 * callback. 656 * &drm_mode_config_funcs.atomic_check callback.
653 * 657 *
654 * This just wraps the two parts of the state checking for planes and modeset 658 * This just wraps the two parts of the state checking for planes and modeset
655 * state in the default order: First it calls drm_atomic_helper_check_modeset() 659 * state in the default order: First it calls drm_atomic_helper_check_modeset()
656 * and then drm_atomic_helper_check_planes(). The assumption is that the 660 * and then drm_atomic_helper_check_planes(). The assumption is that the
657 * ->atomic_check functions depend upon an updated adjusted_mode.clock to 661 * @drm_plane_helper_funcs.atomic_check and @drm_crtc_helper_funcs.atomic_check
658 * e.g. properly compute watermarks. 662 * functions depend upon an updated adjusted_mode.clock to e.g. properly compute
663 * watermarks.
659 * 664 *
660 * RETURNS: 665 * RETURNS:
661 * Zero for success or -errno 666 * Zero for success or -errno
@@ -1125,8 +1130,8 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks);
1125 * drm_atomic_helper_commit_tail - commit atomic update to hardware 1130 * drm_atomic_helper_commit_tail - commit atomic update to hardware
1126 * @old_state: atomic state object with old state structures 1131 * @old_state: atomic state object with old state structures
1127 * 1132 *
1128 * This is the default implemenation for the ->atomic_commit_tail() hook of the 1133 * This is the default implementation for the
1129 * &drm_mode_config_helper_funcs vtable. 1134 * &drm_mode_config_helper_funcs.atomic_commit_tail hook.
1130 * 1135 *
1131 * Note that the default ordering of how the various stages are called is to 1136 * Note that the default ordering of how the various stages are called is to
1132 * match the legacy modeset helper library closest. One peculiarity of that is 1137 * match the legacy modeset helper library closest. One peculiarity of that is
@@ -1203,8 +1208,8 @@ static void commit_work(struct work_struct *work)
1203 * drm_atomic_helper_setup_commit() and related functions. 1208 * drm_atomic_helper_setup_commit() and related functions.
1204 * 1209 *
1205 * Committing the actual hardware state is done through the 1210 * Committing the actual hardware state is done through the
1206 * ->atomic_commit_tail() callback of the &drm_mode_config_helper_funcs vtable, 1211 * &drm_mode_config_helper_funcs.atomic_commit_tail callback, or it's default
1207 * or it's default implementation drm_atomic_helper_commit_tail(). 1212 * implementation drm_atomic_helper_commit_tail().
1208 * 1213 *
1209 * RETURNS: 1214 * RETURNS:
1210 * Zero for success or -errno. 1215 * Zero for success or -errno.
@@ -1357,7 +1362,7 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock)
1357 return ret < 0 ? ret : 0; 1362 return ret < 0 ? ret : 0;
1358} 1363}
1359 1364
1360void release_crtc_commit(struct completion *completion) 1365static void release_crtc_commit(struct completion *completion)
1361{ 1366{
1362 struct drm_crtc_commit *commit = container_of(completion, 1367 struct drm_crtc_commit *commit = container_of(completion,
1363 typeof(*commit), 1368 typeof(*commit),
@@ -1373,14 +1378,15 @@ void release_crtc_commit(struct completion *completion)
1373 * 1378 *
1374 * This function prepares @state to be used by the atomic helper's support for 1379 * This function prepares @state to be used by the atomic helper's support for
1375 * nonblocking commits. Drivers using the nonblocking commit infrastructure 1380 * nonblocking commits. Drivers using the nonblocking commit infrastructure
1376 * should always call this function from their ->atomic_commit hook. 1381 * should always call this function from their
1382 * &drm_mode_config_funcs.atomic_commit hook.
1377 * 1383 *
1378 * To be able to use this support drivers need to use a few more helper 1384 * To be able to use this support drivers need to use a few more helper
1379 * functions. drm_atomic_helper_wait_for_dependencies() must be called before 1385 * functions. drm_atomic_helper_wait_for_dependencies() must be called before
1380 * actually committing the hardware state, and for nonblocking commits this call 1386 * actually committing the hardware state, and for nonblocking commits this call
1381 * must be placed in the async worker. See also drm_atomic_helper_swap_state() 1387 * must be placed in the async worker. See also drm_atomic_helper_swap_state()
1382 * and it's stall parameter, for when a driver's commit hooks look at the 1388 * and it's stall parameter, for when a driver's commit hooks look at the
1383 * ->state pointers of &struct drm_crtc, &drm_plane or &drm_connector directly. 1389 * &drm_crtc.state, &drm_plane.state or &drm_connector.state pointer directly.
1384 * 1390 *
1385 * Completion of the hardware commit step must be signalled using 1391 * Completion of the hardware commit step must be signalled using
1386 * drm_atomic_helper_commit_hw_done(). After this step the driver is not allowed 1392 * drm_atomic_helper_commit_hw_done(). After this step the driver is not allowed
@@ -1489,8 +1495,7 @@ static struct drm_crtc_commit *preceeding_commit(struct drm_crtc *crtc)
1489 * This function waits for all preceeding commits that touch the same CRTC as 1495 * This function waits for all preceeding commits that touch the same CRTC as
1490 * @old_state to both be committed to the hardware (as signalled by 1496 * @old_state to both be committed to the hardware (as signalled by
1491 * drm_atomic_helper_commit_hw_done) and executed by the hardware (as signalled 1497 * drm_atomic_helper_commit_hw_done) and executed by the hardware (as signalled
1492 * by calling drm_crtc_vblank_send_event on the event member of 1498 * by calling drm_crtc_vblank_send_event() on the &drm_crtc_state.event).
1493 * &drm_crtc_state).
1494 * 1499 *
1495 * This is part of the atomic helper support for nonblocking commits, see 1500 * This is part of the atomic helper support for nonblocking commits, see
1496 * drm_atomic_helper_setup_commit() for an overview. 1501 * drm_atomic_helper_setup_commit() for an overview.
@@ -1627,8 +1632,9 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
1627 * @state: atomic state object with new state structures 1632 * @state: atomic state object with new state structures
1628 * 1633 *
1629 * This function prepares plane state, specifically framebuffers, for the new 1634 * This function prepares plane state, specifically framebuffers, for the new
1630 * configuration. If any failure is encountered this function will call 1635 * configuration, by calling &drm_plane_helper_funcs.prepare_fb. If any failure
1631 * ->cleanup_fb on any already successfully prepared framebuffer. 1636 * is encountered this function will call &drm_plane_helper_funcs.cleanup_fb on
1637 * any already successfully prepared framebuffer.
1632 * 1638 *
1633 * Returns: 1639 * Returns:
1634 * 0 on success, negative error code on failure. 1640 * 0 on success, negative error code on failure.
@@ -1708,10 +1714,10 @@ static bool plane_crtc_active(const struct drm_plane_state *state)
1708 * 1714 *
1709 * Drivers may set the NO_DISABLE_AFTER_MODESET flag in @flags if the relevant 1715 * Drivers may set the NO_DISABLE_AFTER_MODESET flag in @flags if the relevant
1710 * display controllers require to disable a CRTC's planes when the CRTC is 1716 * display controllers require to disable a CRTC's planes when the CRTC is
1711 * disabled. This function would skip the ->atomic_disable call for a plane if 1717 * disabled. This function would skip the &drm_plane_helper_funcs.atomic_disable
1712 * the CRTC of the old plane state needs a modesetting operation. Of course, 1718 * call for a plane if the CRTC of the old plane state needs a modesetting
1713 * the drivers need to disable the planes in their CRTC disable callbacks 1719 * operation. Of course, the drivers need to disable the planes in their CRTC
1714 * since no one else would do that. 1720 * disable callbacks since no one else would do that.
1715 * 1721 *
1716 * The drm_atomic_helper_commit() default implementation doesn't set the 1722 * The drm_atomic_helper_commit() default implementation doesn't set the
1717 * ACTIVE_ONLY flag to most closely match the behaviour of the legacy helpers. 1723 * ACTIVE_ONLY flag to most closely match the behaviour of the legacy helpers.
@@ -1874,7 +1880,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
1874 * planes. 1880 * planes.
1875 * 1881 *
1876 * It is a bug to call this function without having implemented the 1882 * It is a bug to call this function without having implemented the
1877 * ->atomic_disable() plane hook. 1883 * &drm_plane_helper_funcs.atomic_disable plane hook.
1878 */ 1884 */
1879void 1885void
1880drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state, 1886drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state,
@@ -1961,8 +1967,8 @@ EXPORT_SYMBOL(drm_atomic_helper_cleanup_planes);
1961 * contains the old state. Also do any other cleanup required with that state. 1967 * contains the old state. Also do any other cleanup required with that state.
1962 * 1968 *
1963 * @stall must be set when nonblocking commits for this driver directly access 1969 * @stall must be set when nonblocking commits for this driver directly access
1964 * the ->state pointer of &drm_plane, &drm_crtc or &drm_connector. With the 1970 * the &drm_plane.state, &drm_crtc.state or &drm_connector.state pointer. With
1965 * current atomic helpers this is almost always the case, since the helpers 1971 * the current atomic helpers this is almost always the case, since the helpers
1966 * don't pass the right state structures to the callbacks. 1972 * don't pass the right state structures to the callbacks.
1967 */ 1973 */
1968void drm_atomic_helper_swap_state(struct drm_atomic_state *state, 1974void drm_atomic_helper_swap_state(struct drm_atomic_state *state,
@@ -2363,7 +2369,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
2363 if (ret != 0) 2369 if (ret != 0)
2364 return ret; 2370 return ret;
2365 2371
2366 drm_crtc_get_hv_timing(set->mode, &hdisplay, &vdisplay); 2372 drm_mode_get_hv_timing(set->mode, &hdisplay, &vdisplay);
2367 2373
2368 drm_atomic_set_fb_for_plane(primary_state, set->fb); 2374 drm_atomic_set_fb_for_plane(primary_state, set->fb);
2369 primary_state->crtc_x = 0; 2375 primary_state->crtc_x = 0;
@@ -2892,8 +2898,8 @@ EXPORT_SYMBOL(drm_atomic_helper_page_flip_target);
2892 * 2898 *
2893 * This is the main helper function provided by the atomic helper framework for 2899 * This is the main helper function provided by the atomic helper framework for
2894 * implementing the legacy DPMS connector interface. It computes the new desired 2900 * implementing the legacy DPMS connector interface. It computes the new desired
2895 * ->active state for the corresponding CRTC (if the connector is enabled) and 2901 * &drm_crtc_state.active state for the corresponding CRTC (if the connector is
2896 * updates it. 2902 * enabled) and updates it.
2897 * 2903 *
2898 * Returns: 2904 * Returns:
2899 * Returns 0 on success, negative errno numbers on failure. 2905 * Returns 0 on success, negative errno numbers on failure.
@@ -2965,11 +2971,11 @@ backoff:
2965EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); 2971EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
2966 2972
2967/** 2973/**
2968 * drm_atomic_helper_best_encoder - Helper for &drm_connector_helper_funcs 2974 * drm_atomic_helper_best_encoder - Helper for
2969 * ->best_encoder callback 2975 * &drm_connector_helper_funcs.best_encoder callback
2970 * @connector: Connector control structure 2976 * @connector: Connector control structure
2971 * 2977 *
2972 * This is a &drm_connector_helper_funcs ->best_encoder callback helper for 2978 * This is a &drm_connector_helper_funcs.best_encoder callback helper for
2973 * connectors that support exactly 1 encoder, statically determined at driver 2979 * connectors that support exactly 1 encoder, statically determined at driver
2974 * init time. 2980 * init time.
2975 */ 2981 */
@@ -3003,7 +3009,7 @@ EXPORT_SYMBOL(drm_atomic_helper_best_encoder);
3003 */ 3009 */
3004 3010
3005/** 3011/**
3006 * drm_atomic_helper_crtc_reset - default ->reset hook for CRTCs 3012 * drm_atomic_helper_crtc_reset - default &drm_crtc_funcs.reset hook for CRTCs
3007 * @crtc: drm CRTC 3013 * @crtc: drm CRTC
3008 * 3014 *
3009 * Resets the atomic state for @crtc by freeing the state pointer (which might 3015 * Resets the atomic state for @crtc by freeing the state pointer (which might
@@ -3110,7 +3116,7 @@ void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
3110EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state); 3116EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
3111 3117
3112/** 3118/**
3113 * drm_atomic_helper_plane_reset - default ->reset hook for planes 3119 * drm_atomic_helper_plane_reset - default &drm_plane_funcs.reset hook for planes
3114 * @plane: drm plane 3120 * @plane: drm plane
3115 * 3121 *
3116 * Resets the atomic state for @plane by freeing the state pointer (which might 3122 * Resets the atomic state for @plane by freeing the state pointer (which might
@@ -3214,8 +3220,9 @@ EXPORT_SYMBOL(drm_atomic_helper_plane_destroy_state);
3214 * @conn_state: connector state to assign 3220 * @conn_state: connector state to assign
3215 * 3221 *
3216 * Initializes the newly allocated @conn_state and assigns it to 3222 * Initializes the newly allocated @conn_state and assigns it to
3217 * #connector ->state, usually required when initializing the drivers 3223 * the &drm_conector->state pointer of @connector, usually required when
3218 * or when called from the ->reset hook. 3224 * initializing the drivers or when called from the &drm_connector_funcs.reset
3225 * hook.
3219 * 3226 *
3220 * This is useful for drivers that subclass the connector state. 3227 * This is useful for drivers that subclass the connector state.
3221 */ 3228 */
@@ -3231,7 +3238,7 @@ __drm_atomic_helper_connector_reset(struct drm_connector *connector,
3231EXPORT_SYMBOL(__drm_atomic_helper_connector_reset); 3238EXPORT_SYMBOL(__drm_atomic_helper_connector_reset);
3232 3239
3233/** 3240/**
3234 * drm_atomic_helper_connector_reset - default ->reset hook for connectors 3241 * drm_atomic_helper_connector_reset - default &drm_connector_funcs.reset hook for connectors
3235 * @connector: drm connector 3242 * @connector: drm connector
3236 * 3243 *
3237 * Resets the atomic state for @connector by freeing the state pointer (which 3244 * Resets the atomic state for @connector by freeing the state pointer (which
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 860cfe124c2a..7ff697389d74 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -40,8 +40,8 @@
40 * least once successfully became the device master (either through the 40 * least once successfully became the device master (either through the
41 * SET_MASTER IOCTL, or implicitly through opening the primary device node when 41 * SET_MASTER IOCTL, or implicitly through opening the primary device node when
42 * no one else is the current master that time) there exists one &drm_master. 42 * no one else is the current master that time) there exists one &drm_master.
43 * This is noted in the is_master member of &drm_file. All other clients have 43 * This is noted in &drm_file.is_master. All other clients have just a pointer
44 * just a pointer to the &drm_master they are associated with. 44 * to the &drm_master they are associated with.
45 * 45 *
46 * In addition only one &drm_master can be the current master for a &drm_device. 46 * In addition only one &drm_master can be the current master for a &drm_device.
47 * It can be switched through the DROP_MASTER and SET_MASTER IOCTL, or 47 * It can be switched through the DROP_MASTER and SET_MASTER IOCTL, or
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 1f2412c7ccfd..665aafc6ad68 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -40,9 +40,8 @@
40 * sub-pixel accuracy, which is scaled up to a pixel-aligned destination 40 * sub-pixel accuracy, which is scaled up to a pixel-aligned destination
41 * rectangle in the visible area of a &drm_crtc. The visible area of a CRTC is 41 * rectangle in the visible area of a &drm_crtc. The visible area of a CRTC is
42 * defined by the horizontal and vertical visible pixels (stored in @hdisplay 42 * defined by the horizontal and vertical visible pixels (stored in @hdisplay
43 * and @vdisplay) of the requested mode (stored in @mode in the 43 * and @vdisplay) of the requested mode (stored in &drm_crtc_state.mode). These
44 * &drm_crtc_state). These two rectangles are both stored in the 44 * two rectangles are both stored in the &drm_plane_state.
45 * &drm_plane_state.
46 * 45 *
47 * For the atomic ioctl the following standard (atomic) properties on the plane object 46 * For the atomic ioctl the following standard (atomic) properties on the plane object
48 * encode the basic plane composition model: 47 * encode the basic plane composition model:
@@ -215,7 +214,7 @@ EXPORT_SYMBOL(drm_rotation_simplify);
215 * for it in drm core. Drivers can then attach this property to planes to enable 214 * for it in drm core. Drivers can then attach this property to planes to enable
216 * support for configurable planes arrangement during blending operation. 215 * support for configurable planes arrangement during blending operation.
217 * Once mutable zpos property has been enabled, the DRM core will automatically 216 * Once mutable zpos property has been enabled, the DRM core will automatically
218 * calculate drm_plane_state->normalized_zpos values. Usually min should be set 217 * calculate &drm_plane_state.normalized_zpos values. Usually min should be set
219 * to 0 and max to maximal number of planes for given crtc - 1. 218 * to 0 and max to maximal number of planes for given crtc - 1.
220 * 219 *
221 * If zpos of some planes cannot be changed (like fixed background or 220 * If zpos of some planes cannot be changed (like fixed background or
@@ -367,8 +366,8 @@ done:
367 * For every CRTC this function checks new states of all planes assigned to 366 * For every CRTC this function checks new states of all planes assigned to
368 * it and calculates normalized zpos value for these planes. Planes are compared 367 * it and calculates normalized zpos value for these planes. Planes are compared
369 * first by their zpos values, then by plane id (if zpos is equal). The plane 368 * first by their zpos values, then by plane id (if zpos is equal). The plane
370 * with lowest zpos value is at the bottom. The plane_state->normalized_zpos is 369 * with lowest zpos value is at the bottom. The &drm_plane_state.normalized_zpos
371 * then filled with unique values from 0 to number of active planes in crtc 370 * is then filled with unique values from 0 to number of active planes in crtc
372 * minus one. 371 * minus one.
373 * 372 *
374 * RETURNS 373 * RETURNS
diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c
index 5066638928ec..c3b9aaccdf42 100644
--- a/drivers/gpu/drm/drm_cache.c
+++ b/drivers/gpu/drm/drm_cache.c
@@ -29,7 +29,9 @@
29 */ 29 */
30 30
31#include <linux/export.h> 31#include <linux/export.h>
32#include <drm/drmP.h> 32#include <linux/highmem.h>
33
34#include <drm/drm_cache.h>
33 35
34#if defined(CONFIG_X86) 36#if defined(CONFIG_X86)
35#include <asm/smp.h> 37#include <asm/smp.h>
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 799edd0d308e..e4d2c8a49076 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -38,18 +38,17 @@
38 * Hence they are reference-counted using drm_connector_reference() and 38 * Hence they are reference-counted using drm_connector_reference() and
39 * drm_connector_unreference(). 39 * drm_connector_unreference().
40 * 40 *
41 * KMS driver must create, initialize, register and attach at a struct 41 * KMS driver must create, initialize, register and attach at a &struct
42 * &drm_connector for each such sink. The instance is created as other KMS 42 * drm_connector for each such sink. The instance is created as other KMS
43 * objects and initialized by setting the following fields. 43 * objects and initialized by setting the following fields. The connector is
44 * 44 * initialized with a call to drm_connector_init() with a pointer to the
45 * The connector is then registered with a call to drm_connector_init() with a 45 * &struct drm_connector_funcs and a connector type, and then exposed to
46 * pointer to the connector functions and a connector type, and exposed through 46 * userspace with a call to drm_connector_register().
47 * sysfs with a call to drm_connector_register().
48 * 47 *
49 * Connectors must be attached to an encoder to be used. For devices that map 48 * Connectors must be attached to an encoder to be used. For devices that map
50 * connectors to encoders 1:1, the connector should be attached at 49 * connectors to encoders 1:1, the connector should be attached at
51 * initialization time with a call to drm_mode_connector_attach_encoder(). The 50 * initialization time with a call to drm_mode_connector_attach_encoder(). The
52 * driver must also set the &struct drm_connector encoder field to point to the 51 * driver must also set the &drm_connector.encoder field to point to the
53 * attached encoder. 52 * attached encoder.
54 * 53 *
55 * For connectors which are not fixed (like built-in panels) the driver needs to 54 * For connectors which are not fixed (like built-in panels) the driver needs to
@@ -497,7 +496,7 @@ static struct lockdep_map connector_list_iter_dep_map = {
497 * @dev: DRM device 496 * @dev: DRM device
498 * @iter: connector_list iterator 497 * @iter: connector_list iterator
499 * 498 *
500 * Sets @iter up to walk the connector list in &drm_mode_config of @dev. @iter 499 * Sets @iter up to walk the &drm_mode_config.connector_list of @dev. @iter
501 * must always be cleaned up again by calling drm_connector_list_iter_put(). 500 * must always be cleaned up again by calling drm_connector_list_iter_put().
502 * Iteration itself happens using drm_connector_list_iter_next() or 501 * Iteration itself happens using drm_connector_list_iter_next() or
503 * drm_for_each_connector_iter(). 502 * drm_for_each_connector_iter().
@@ -696,8 +695,8 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
696 * drivers this is only provided for backwards compatibility with existing 695 * drivers this is only provided for backwards compatibility with existing
697 * drivers, it remaps to controlling the "ACTIVE" property on the CRTC the 696 * drivers, it remaps to controlling the "ACTIVE" property on the CRTC the
698 * connector is linked to. Drivers should never set this property directly, 697 * connector is linked to. Drivers should never set this property directly,
699 * it is handled by the DRM core by calling the ->dpms() callback in 698 * it is handled by the DRM core by calling the &drm_connector_funcs.dpms
700 * &drm_connector_funcs. Atomic drivers should implement this hook using 699 * callback. Atomic drivers should implement this hook using
701 * drm_atomic_helper_connector_dpms(). This is the only property standard 700 * drm_atomic_helper_connector_dpms(). This is the only property standard
702 * connector property that userspace can change. 701 * connector property that userspace can change.
703 * PATH: 702 * PATH:
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index bd3c8b243447..6915f897bd8e 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -47,6 +47,27 @@
47#include "drm_internal.h" 47#include "drm_internal.h"
48 48
49/** 49/**
50 * DOC: overview
51 *
52 * A CRTC represents the overall display pipeline. It receives pixel data from
53 * &drm_plane and blends them together. The &drm_display_mode is also attached
54 * to the CRTC, specifying display timings. On the output side the data is fed
55 * to one or more &drm_encoder, which are then each connected to one
56 * &drm_connector.
57 *
58 * To create a CRTC, a KMS drivers allocates and zeroes an instances of
59 * &struct drm_crtc (possibly as part of a larger structure) and registers it
60 * with a call to drm_crtc_init_with_planes().
61 *
62 * The CRTC is also the entry point for legacy modeset operations, see
63 * &drm_crtc_funcs.set_config, legacy plane operations, see
64 * &drm_crtc_funcs.page_flip and &drm_crtc_funcs.cursor_set2, and other legacy
65 * operations like &drm_crtc_funcs.gamma_set. For atomic drivers all these
66 * features are controlled through &drm_property and
67 * &drm_mode_config_funcs.atomic_check and &drm_mode_config_funcs.atomic_check.
68 */
69
70/**
50 * drm_crtc_from_index - find the registered CRTC at an index 71 * drm_crtc_from_index - find the registered CRTC at an index
51 * @dev: DRM device 72 * @dev: DRM device
52 * @idx: index of registered CRTC to find for 73 * @idx: index of registered CRTC to find for
@@ -415,11 +436,12 @@ int drm_mode_getcrtc(struct drm_device *dev,
415} 436}
416 437
417/** 438/**
418 * drm_mode_set_config_internal - helper to call ->set_config 439 * drm_mode_set_config_internal - helper to call &drm_mode_config_funcs.set_config
419 * @set: modeset config to set 440 * @set: modeset config to set
420 * 441 *
421 * This is a little helper to wrap internal calls to the ->set_config driver 442 * This is a little helper to wrap internal calls to the
422 * interface. The only thing it adds is correct refcounting dance. 443 * &drm_mode_config_funcs.set_config driver interface. The only thing it adds is
444 * correct refcounting dance.
423 * 445 *
424 * Returns: 446 * Returns:
425 * Zero on success, negative errno on failure. 447 * Zero on success, negative errno on failure.
@@ -460,27 +482,6 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
460EXPORT_SYMBOL(drm_mode_set_config_internal); 482EXPORT_SYMBOL(drm_mode_set_config_internal);
461 483
462/** 484/**
463 * drm_crtc_get_hv_timing - Fetches hdisplay/vdisplay for given mode
464 * @mode: mode to query
465 * @hdisplay: hdisplay value to fill in
466 * @vdisplay: vdisplay value to fill in
467 *
468 * The vdisplay value will be doubled if the specified mode is a stereo mode of
469 * the appropriate layout.
470 */
471void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
472 int *hdisplay, int *vdisplay)
473{
474 struct drm_display_mode adjusted;
475
476 drm_mode_copy(&adjusted, mode);
477 drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE_ONLY);
478 *hdisplay = adjusted.crtc_hdisplay;
479 *vdisplay = adjusted.crtc_vdisplay;
480}
481EXPORT_SYMBOL(drm_crtc_get_hv_timing);
482
483/**
484 * drm_crtc_check_viewport - Checks that a framebuffer is big enough for the 485 * drm_crtc_check_viewport - Checks that a framebuffer is big enough for the
485 * CRTC viewport 486 * CRTC viewport
486 * @crtc: CRTC that framebuffer will be displayed on 487 * @crtc: CRTC that framebuffer will be displayed on
@@ -497,7 +498,7 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
497{ 498{
498 int hdisplay, vdisplay; 499 int hdisplay, vdisplay;
499 500
500 drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay); 501 drm_mode_get_hv_timing(mode, &hdisplay, &vdisplay);
501 502
502 if (crtc->state && 503 if (crtc->state &&
503 drm_rotation_90_or_270(crtc->primary->state->rotation)) 504 drm_rotation_90_or_270(crtc->primary->state->rotation))
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 1e281dd42e4b..44ba0e990d6c 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -53,9 +53,9 @@
53 * configuration on resume with drm_helper_resume_force_mode(). 53 * configuration on resume with drm_helper_resume_force_mode().
54 * 54 *
55 * Note that this helper library doesn't track the current power state of CRTCs 55 * Note that this helper library doesn't track the current power state of CRTCs
56 * and encoders. It can call callbacks like ->dpms() even though the hardware is 56 * and encoders. It can call callbacks like &drm_encoder_helper_funcs.dpms even
57 * already in the desired state. This deficiency has been fixed in the atomic 57 * though the hardware is already in the desired state. This deficiency has been
58 * helpers. 58 * fixed in the atomic helpers.
59 * 59 *
60 * The driver callbacks are mostly compatible with the atomic modeset helpers, 60 * The driver callbacks are mostly compatible with the atomic modeset helpers,
61 * except for the handling of the primary plane: Atomic helpers require that the 61 * except for the handling of the primary plane: Atomic helpers require that the
@@ -477,12 +477,12 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
477 * drm_crtc_helper_set_config - set a new config from userspace 477 * drm_crtc_helper_set_config - set a new config from userspace
478 * @set: mode set configuration 478 * @set: mode set configuration
479 * 479 *
480 * The drm_crtc_helper_set_config() helper function implements the set_config 480 * The drm_crtc_helper_set_config() helper function implements the of
481 * callback of &struct drm_crtc_funcs for drivers using the legacy CRTC helpers. 481 * &drm_crtc_funcs.set_config callback for drivers using the legacy CRTC
482 * helpers.
482 * 483 *
483 * It first tries to locate the best encoder for each connector by calling the 484 * It first tries to locate the best encoder for each connector by calling the
484 * connector ->best_encoder() (&struct drm_connector_helper_funcs) helper 485 * connector @drm_connector_helper_funcs.best_encoder helper operation.
485 * operation.
486 * 486 *
487 * After locating the appropriate encoders, the helper function will call the 487 * After locating the appropriate encoders, the helper function will call the
488 * mode_fixup encoder and CRTC helper operations to adjust the requested mode, 488 * mode_fixup encoder and CRTC helper operations to adjust the requested mode,
@@ -493,8 +493,7 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
493 * 493 *
494 * If the adjusted mode is identical to the current mode but changes to the 494 * If the adjusted mode is identical to the current mode but changes to the
495 * frame buffer need to be applied, the drm_crtc_helper_set_config() function 495 * frame buffer need to be applied, the drm_crtc_helper_set_config() function
496 * will call the CRTC ->mode_set_base() (&struct drm_crtc_helper_funcs) helper 496 * will call the CRTC &drm_crtc_helper_funcs.mode_set_base helper operation.
497 * operation.
498 * 497 *
499 * If the adjusted mode differs from the current mode, or if the 498 * If the adjusted mode differs from the current mode, or if the
500 * ->mode_set_base() helper operation is not provided, the helper function 499 * ->mode_set_base() helper operation is not provided, the helper function
@@ -851,14 +850,15 @@ static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc)
851 * @connector: affected connector 850 * @connector: affected connector
852 * @mode: DPMS mode 851 * @mode: DPMS mode
853 * 852 *
854 * The drm_helper_connector_dpms() helper function implements the ->dpms() 853 * The drm_helper_connector_dpms() helper function implements the
855 * callback of &struct drm_connector_funcs for drivers using the legacy CRTC helpers. 854 * &drm_connector_funcs.dpms callback for drivers using the legacy CRTC
855 * helpers.
856 * 856 *
857 * This is the main helper function provided by the CRTC helper framework for 857 * This is the main helper function provided by the CRTC helper framework for
858 * implementing the DPMS connector attribute. It computes the new desired DPMS 858 * implementing the DPMS connector attribute. It computes the new desired DPMS
859 * state for all encoders and CRTCs in the output mesh and calls the ->dpms() 859 * state for all encoders and CRTCs in the output mesh and calls the
860 * callbacks provided by the driver in &struct drm_crtc_helper_funcs and struct 860 * &drm_crtc_helper_funcs.dpms and &drm_encoder_helper_funcs.dpms callbacks
861 * &drm_encoder_helper_funcs appropriately. 861 * provided by the driver.
862 * 862 *
863 * This function is deprecated. New drivers must implement atomic modeset 863 * This function is deprecated. New drivers must implement atomic modeset
864 * support, for which this function is unsuitable. Instead drivers should use 864 * support, for which this function is unsuitable. Instead drivers should use
diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
index 724c329186d5..1bdcfd566695 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -177,7 +177,6 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
177#ifdef CONFIG_DEBUG_FS 177#ifdef CONFIG_DEBUG_FS
178struct drm_minor; 178struct drm_minor;
179int drm_atomic_debugfs_init(struct drm_minor *minor); 179int drm_atomic_debugfs_init(struct drm_minor *minor);
180int drm_atomic_debugfs_cleanup(struct drm_minor *minor);
181#endif 180#endif
182 181
183int drm_atomic_get_property(struct drm_mode_object *obj, 182int drm_atomic_get_property(struct drm_mode_object *obj,
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 37fd612d57a6..2290a74a6e46 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -81,7 +81,8 @@ static const struct file_operations drm_debugfs_fops = {
81 * \return Zero on success, non-zero on failure 81 * \return Zero on success, non-zero on failure
82 * 82 *
83 * Create a given set of debugfs files represented by an array of 83 * Create a given set of debugfs files represented by an array of
84 * gdm_debugfs_lists in the given root directory. 84 * &drm_info_list in the given root directory. These files will be removed
85 * automatically on drm_debugfs_cleanup().
85 */ 86 */
86int drm_debugfs_create_files(const struct drm_info_list *files, int count, 87int drm_debugfs_create_files(const struct drm_info_list *files, int count,
87 struct dentry *root, struct drm_minor *minor) 88 struct dentry *root, struct drm_minor *minor)
@@ -218,6 +219,19 @@ int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
218} 219}
219EXPORT_SYMBOL(drm_debugfs_remove_files); 220EXPORT_SYMBOL(drm_debugfs_remove_files);
220 221
222static void drm_debugfs_remove_all_files(struct drm_minor *minor)
223{
224 struct drm_info_node *node, *tmp;
225
226 mutex_lock(&minor->debugfs_lock);
227 list_for_each_entry_safe(node, tmp, &minor->debugfs_list, list) {
228 debugfs_remove(node->dent);
229 list_del(&node->list);
230 kfree(node);
231 }
232 mutex_unlock(&minor->debugfs_lock);
233}
234
221/** 235/**
222 * Cleanup the debugfs filesystem resources. 236 * Cleanup the debugfs filesystem resources.
223 * 237 *
@@ -229,7 +243,6 @@ EXPORT_SYMBOL(drm_debugfs_remove_files);
229int drm_debugfs_cleanup(struct drm_minor *minor) 243int drm_debugfs_cleanup(struct drm_minor *minor)
230{ 244{
231 struct drm_device *dev = minor->dev; 245 struct drm_device *dev = minor->dev;
232 int ret;
233 246
234 if (!minor->debugfs_root) 247 if (!minor->debugfs_root)
235 return 0; 248 return 0;
@@ -237,17 +250,9 @@ int drm_debugfs_cleanup(struct drm_minor *minor)
237 if (dev->driver->debugfs_cleanup) 250 if (dev->driver->debugfs_cleanup)
238 dev->driver->debugfs_cleanup(minor); 251 dev->driver->debugfs_cleanup(minor);
239 252
240 if (drm_core_check_feature(dev, DRIVER_ATOMIC)) { 253 drm_debugfs_remove_all_files(minor);
241 ret = drm_atomic_debugfs_cleanup(minor);
242 if (ret) {
243 DRM_ERROR("DRM: Failed to remove atomic debugfs entries\n");
244 return ret;
245 }
246 }
247
248 drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
249 254
250 debugfs_remove(minor->debugfs_root); 255 debugfs_remove_recursive(minor->debugfs_root);
251 minor->debugfs_root = NULL; 256 minor->debugfs_root = NULL;
252 257
253 return 0; 258 return 0;
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 3e6fe82c6d64..68908c1d5ca1 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -725,7 +725,7 @@ MODULE_PARM_DESC(dp_aux_i2c_speed_khz,
725/* 725/*
726 * Transfer a single I2C-over-AUX message and handle various error conditions, 726 * Transfer a single I2C-over-AUX message and handle various error conditions,
727 * retrying the transaction as appropriate. It is assumed that the 727 * retrying the transaction as appropriate. It is assumed that the
728 * aux->transfer function does not modify anything in the msg other than the 728 * &drm_dp_aux.transfer function does not modify anything in the msg other than the
729 * reply field. 729 * reply field.
730 * 730 *
731 * Returns bytes transferred on success, or a negative error code on failure. 731 * Returns bytes transferred on success, or a negative error code on failure.
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index aa644487749c..122a1b04bebc 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1086,7 +1086,7 @@ static void build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
1086} 1086}
1087 1087
1088static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, 1088static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
1089 struct device *dev, 1089 struct drm_device *dev,
1090 struct drm_dp_link_addr_reply_port *port_msg) 1090 struct drm_dp_link_addr_reply_port *port_msg)
1091{ 1091{
1092 struct drm_dp_mst_port *port; 1092 struct drm_dp_mst_port *port;
@@ -1104,7 +1104,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
1104 port->port_num = port_msg->port_number; 1104 port->port_num = port_msg->port_number;
1105 port->mgr = mstb->mgr; 1105 port->mgr = mstb->mgr;
1106 port->aux.name = "DPMST"; 1106 port->aux.name = "DPMST";
1107 port->aux.dev = dev; 1107 port->aux.dev = dev->dev;
1108 created = true; 1108 created = true;
1109 } else { 1109 } else {
1110 old_pdt = port->pdt; 1110 old_pdt = port->pdt;
@@ -2949,7 +2949,7 @@ static void drm_dp_destroy_connector_work(struct work_struct *work)
2949 * Return 0 for success, or negative error code on failure 2949 * Return 0 for success, or negative error code on failure
2950 */ 2950 */
2951int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, 2951int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr,
2952 struct device *dev, struct drm_dp_aux *aux, 2952 struct drm_device *dev, struct drm_dp_aux *aux,
2953 int max_dpcd_transaction_bytes, 2953 int max_dpcd_transaction_bytes,
2954 int max_payloads, int conn_base_id) 2954 int max_payloads, int conn_base_id)
2955{ 2955{
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 72116978ec06..6cbd67f4fbc5 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -221,7 +221,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
221 ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root); 221 ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
222 if (ret) { 222 if (ret) {
223 DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n"); 223 DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
224 return ret; 224 goto err_debugfs;
225 } 225 }
226 226
227 ret = device_add(minor->kdev); 227 ret = device_add(minor->kdev);
@@ -309,7 +309,7 @@ void drm_minor_release(struct drm_minor *minor)
309 * userspace the device instance can be published using drm_dev_register(). 309 * userspace the device instance can be published using drm_dev_register().
310 * 310 *
311 * There is also deprecated support for initalizing device instances using 311 * There is also deprecated support for initalizing device instances using
312 * bus-specific helpers and the ->load() callback. But due to 312 * bus-specific helpers and the &drm_driver.load callback. But due to
313 * backwards-compatibility needs the device instance have to be published too 313 * backwards-compatibility needs the device instance have to be published too
314 * early, which requires unpretty global locking to make safe and is therefore 314 * early, which requires unpretty global locking to make safe and is therefore
315 * only support for existing drivers not yet converted to the new scheme. 315 * only support for existing drivers not yet converted to the new scheme.
@@ -720,9 +720,9 @@ static void remove_compat_control_link(struct drm_device *dev)
720 * Never call this twice on any device! 720 * Never call this twice on any device!
721 * 721 *
722 * NOTE: To ensure backward compatibility with existing drivers method this 722 * NOTE: To ensure backward compatibility with existing drivers method this
723 * function calls the ->load() method after registering the device nodes, 723 * function calls the &drm_driver.load method after registering the device
724 * creating race conditions. Usage of the ->load() methods is therefore 724 * nodes, creating race conditions. Usage of the &drm_driver.load methods is
725 * deprecated, drivers must perform all initialization before calling 725 * therefore deprecated, drivers must perform all initialization before calling
726 * drm_dev_register(). 726 * drm_dev_register().
727 * 727 *
728 * RETURNS: 728 * RETURNS:
diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
index e5c61cda4ae3..10307cc16d75 100644
--- a/drivers/gpu/drm/drm_dumb_buffers.c
+++ b/drivers/gpu/drm/drm_dumb_buffers.c
@@ -42,8 +42,8 @@
42 * create dumb buffers suitable for scanout, which can then be used to create 42 * create dumb buffers suitable for scanout, which can then be used to create
43 * KMS frame buffers. 43 * KMS frame buffers.
44 * 44 *
45 * To support dumb objects drivers must implement the dumb_create, 45 * To support dumb objects drivers must implement the &drm_driver.dumb_create,
46 * dumb_destroy and dumb_map_offset operations from &struct drm_driver. See 46 * &drm_driver.dumb_destroy and &drm_driver.dumb_map_offset operations. See
47 * there for further details. 47 * there for further details.
48 * 48 *
49 * Note that dumb objects may not be used for gpu acceleration, as has been 49 * Note that dumb objects may not be used for gpu acceleration, as has been
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 4ff04aa84dd0..baa6ccb3e18b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3768,6 +3768,25 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
3768} 3768}
3769EXPORT_SYMBOL(drm_rgb_quant_range_selectable); 3769EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
3770 3770
3771/**
3772 * drm_default_rgb_quant_range - default RGB quantization range
3773 * @mode: display mode
3774 *
3775 * Determine the default RGB quantization range for the mode,
3776 * as specified in CEA-861.
3777 *
3778 * Return: The default RGB quantization range for the mode
3779 */
3780enum hdmi_quantization_range
3781drm_default_rgb_quant_range(const struct drm_display_mode *mode)
3782{
3783 /* All CEA modes other than VIC 1 use limited quantization range. */
3784 return drm_match_cea_mode(mode) > 1 ?
3785 HDMI_QUANTIZATION_RANGE_LIMITED :
3786 HDMI_QUANTIZATION_RANGE_FULL;
3787}
3788EXPORT_SYMBOL(drm_default_rgb_quant_range);
3789
3771static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, 3790static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,
3772 const u8 *hdmi) 3791 const u8 *hdmi)
3773{ 3792{
@@ -4273,6 +4292,52 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
4273} 4292}
4274EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode); 4293EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
4275 4294
4295/**
4296 * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
4297 * quantization range information
4298 * @frame: HDMI AVI infoframe
4299 * @mode: DRM display mode
4300 * @rgb_quant_range: RGB quantization range (Q)
4301 * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
4302 */
4303void
4304drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
4305 const struct drm_display_mode *mode,
4306 enum hdmi_quantization_range rgb_quant_range,
4307 bool rgb_quant_range_selectable)
4308{
4309 /*
4310 * CEA-861:
4311 * "A Source shall not send a non-zero Q value that does not correspond
4312 * to the default RGB Quantization Range for the transmitted Picture
4313 * unless the Sink indicates support for the Q bit in a Video
4314 * Capabilities Data Block."
4315 *
4316 * HDMI 2.0 recommends sending non-zero Q when it does match the
4317 * default RGB quantization range for the mode, even when QS=0.
4318 */
4319 if (rgb_quant_range_selectable ||
4320 rgb_quant_range == drm_default_rgb_quant_range(mode))
4321 frame->quantization_range = rgb_quant_range;
4322 else
4323 frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
4324
4325 /*
4326 * CEA-861-F:
4327 * "When transmitting any RGB colorimetry, the Source should set the
4328 * YQ-field to match the RGB Quantization Range being transmitted
4329 * (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
4330 * set YQ=1) and the Sink shall ignore the YQ-field."
4331 */
4332 if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
4333 frame->ycc_quantization_range =
4334 HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
4335 else
4336 frame->ycc_quantization_range =
4337 HDMI_YCC_QUANTIZATION_RANGE_FULL;
4338}
4339EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range);
4340
4276static enum hdmi_3d_structure 4341static enum hdmi_3d_structure
4277s3d_structure_from_display_mode(const struct drm_display_mode *mode) 4342s3d_structure_from_display_mode(const struct drm_display_mode *mode)
4278{ 4343{
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
index 487cfe3989e8..129450713bb7 100644
--- a/drivers/gpu/drm/drm_encoder.c
+++ b/drivers/gpu/drm/drm_encoder.c
@@ -98,7 +98,7 @@ void drm_encoder_unregister_all(struct drm_device *dev)
98 * 98 *
99 * Initialises a preallocated encoder. Encoder should be subclassed as part of 99 * Initialises a preallocated encoder. Encoder should be subclassed as part of
100 * driver encoder objects. At driver unload time drm_encoder_cleanup() should be 100 * driver encoder objects. At driver unload time drm_encoder_cleanup() should be
101 * called from the driver's destroy hook in &drm_encoder_funcs. 101 * called from the driver's &drm_encoder_funcs.destroy hook.
102 * 102 *
103 * Returns: 103 * Returns:
104 * Zero on success, error code on failure. 104 * Zero on success, error code on failure.
diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
index 4484785cd9ac..cf804389f5ec 100644
--- a/drivers/gpu/drm/drm_encoder_slave.c
+++ b/drivers/gpu/drm/drm_encoder_slave.c
@@ -43,7 +43,7 @@
43 * &drm_encoder_slave. The @slave_funcs field will be initialized with 43 * &drm_encoder_slave. The @slave_funcs field will be initialized with
44 * the hooks provided by the slave driver. 44 * the hooks provided by the slave driver.
45 * 45 *
46 * If @info->platform_data is non-NULL it will be used as the initial 46 * If @info.platform_data is non-NULL it will be used as the initial
47 * slave config. 47 * slave config.
48 * 48 *
49 * Returns 0 on success or a negative errno on failure, in particular, 49 * Returns 0 on success or a negative errno on failure, in particular,
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 4364abfb6a71..0ef8b284a4b8 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -622,3 +622,21 @@ void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state)
622 drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state); 622 drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
623} 623}
624EXPORT_SYMBOL(drm_fbdev_cma_set_suspend); 624EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
625
626/**
627 * drm_fbdev_cma_set_suspend_unlocked - wrapper around
628 * drm_fb_helper_set_suspend_unlocked
629 * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
630 * @state: desired state, zero to resume, non-zero to suspend
631 *
632 * Calls drm_fb_helper_set_suspend, which is a wrapper around
633 * fb_set_suspend implemented by fbdev core.
634 */
635void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
636 int state)
637{
638 if (fbdev_cma)
639 drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
640 state);
641}
642EXPORT_SYMBOL(drm_fbdev_cma_set_suspend_unlocked);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 0ab6aaacb7d6..c7fafa175755 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -66,11 +66,11 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
66 * Teardown is done with drm_fb_helper_fini(). 66 * Teardown is done with drm_fb_helper_fini().
67 * 67 *
68 * At runtime drivers should restore the fbdev console by calling 68 * At runtime drivers should restore the fbdev console by calling
69 * drm_fb_helper_restore_fbdev_mode_unlocked() from their ->lastclose callback. 69 * drm_fb_helper_restore_fbdev_mode_unlocked() from their &drm_driver.lastclose
70 * They should also notify the fb helper code from updates to the output 70 * callback. They should also notify the fb helper code from updates to the
71 * configuration by calling drm_fb_helper_hotplug_event(). For easier 71 * output configuration by calling drm_fb_helper_hotplug_event(). For easier
72 * integration with the output polling code in drm_crtc_helper.c the modeset 72 * integration with the output polling code in drm_crtc_helper.c the modeset
73 * code provides a ->output_poll_changed callback. 73 * code provides a &drm_mode_config_funcs.output_poll_changed callback.
74 * 74 *
75 * All other functions exported by the fb helper library can be used to 75 * All other functions exported by the fb helper library can be used to
76 * implement the fbdev driver interface by the driver. 76 * implement the fbdev driver interface by the driver.
@@ -79,7 +79,7 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
79 * hotplug detection using the fbdev helpers. The drm_fb_helper_prepare() 79 * hotplug detection using the fbdev helpers. The drm_fb_helper_prepare()
80 * helper must be called first to initialize the minimum required to make 80 * helper must be called first to initialize the minimum required to make
81 * hotplug detection work. Drivers also need to make sure to properly set up 81 * hotplug detection work. Drivers also need to make sure to properly set up
82 * the dev->mode_config.funcs member. After calling drm_kms_helper_poll_init() 82 * the &drm_mode_config.funcs member. After calling drm_kms_helper_poll_init()
83 * it is safe to enable interrupts and start processing hotplug events. At the 83 * it is safe to enable interrupts and start processing hotplug events. At the
84 * same time, drivers should initialize all modeset objects such as CRTCs, 84 * same time, drivers should initialize all modeset objects such as CRTCs,
85 * encoders and connectors. To finish up the fbdev helper initialization, the 85 * encoders and connectors. To finish up the fbdev helper initialization, the
@@ -88,9 +88,9 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
88 * should call drm_fb_helper_single_add_all_connectors() followed by 88 * should call drm_fb_helper_single_add_all_connectors() followed by
89 * drm_fb_helper_initial_config(). 89 * drm_fb_helper_initial_config().
90 * 90 *
91 * If &drm_framebuffer_funcs ->dirty is set, the 91 * If &drm_framebuffer_funcs.dirty is set, the
92 * drm_fb_helper_{cfb,sys}_{write,fillrect,copyarea,imageblit} functions will 92 * drm_fb_helper_{cfb,sys}_{write,fillrect,copyarea,imageblit} functions will
93 * accumulate changes and schedule &drm_fb_helper ->dirty_work to run right 93 * accumulate changes and schedule &drm_fb_helper.dirty_work to run right
94 * away. This worker then calls the dirty() function ensuring that it will 94 * away. This worker then calls the dirty() function ensuring that it will
95 * always run in process context since the fb_*() function could be running in 95 * always run in process context since the fb_*() function could be running in
96 * atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io 96 * atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io
@@ -247,7 +247,7 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
247} 247}
248 248
249/** 249/**
250 * drm_fb_helper_debug_enter - implementation for ->fb_debug_enter 250 * drm_fb_helper_debug_enter - implementation for &fb_ops.fb_debug_enter
251 * @info: fbdev registered by the helper 251 * @info: fbdev registered by the helper
252 */ 252 */
253int drm_fb_helper_debug_enter(struct fb_info *info) 253int drm_fb_helper_debug_enter(struct fb_info *info)
@@ -296,7 +296,7 @@ static struct drm_framebuffer *drm_mode_config_fb(struct drm_crtc *crtc)
296} 296}
297 297
298/** 298/**
299 * drm_fb_helper_debug_leave - implementation for ->fb_debug_leave 299 * drm_fb_helper_debug_leave - implementation for &fb_ops.fb_debug_leave
300 * @info: fbdev registered by the helper 300 * @info: fbdev registered by the helper
301 */ 301 */
302int drm_fb_helper_debug_leave(struct fb_info *info) 302int drm_fb_helper_debug_leave(struct fb_info *info)
@@ -445,7 +445,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
445 * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration 445 * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
446 * @fb_helper: fbcon to restore 446 * @fb_helper: fbcon to restore
447 * 447 *
448 * This should be called from driver's drm ->lastclose callback 448 * This should be called from driver's drm &drm_driver.lastclose callback
449 * when implementing an fbcon on top of kms using this helper. This ensures that 449 * when implementing an fbcon on top of kms using this helper. This ensures that
450 * the user isn't greeted with a black screen when e.g. X dies. 450 * the user isn't greeted with a black screen when e.g. X dies.
451 * 451 *
@@ -585,7 +585,7 @@ static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode)
585} 585}
586 586
587/** 587/**
588 * drm_fb_helper_blank - implementation for ->fb_blank 588 * drm_fb_helper_blank - implementation for &fb_ops.fb_blank
589 * @blank: desired blanking state 589 * @blank: desired blanking state
590 * @info: fbdev registered by the helper 590 * @info: fbdev registered by the helper
591 */ 591 */
@@ -912,7 +912,7 @@ static void drm_fb_helper_dirty(struct fb_info *info, u32 x, u32 y,
912 * @info: fb_info struct pointer 912 * @info: fb_info struct pointer
913 * @pagelist: list of dirty mmap framebuffer pages 913 * @pagelist: list of dirty mmap framebuffer pages
914 * 914 *
915 * This function is used as the &fb_deferred_io ->deferred_io 915 * This function is used as the &fb_deferred_io.deferred_io
916 * callback function for flushing the fbdev mmap writes. 916 * callback function for flushing the fbdev mmap writes.
917 */ 917 */
918void drm_fb_helper_deferred_io(struct fb_info *info, 918void drm_fb_helper_deferred_io(struct fb_info *info,
@@ -1103,7 +1103,7 @@ EXPORT_SYMBOL(drm_fb_helper_set_suspend);
1103 * due to all the printk activity. 1103 * due to all the printk activity.
1104 * 1104 *
1105 * This function can be called multiple times with the same state since 1105 * This function can be called multiple times with the same state since
1106 * &fb_info->state is checked to see if fbdev is running or not before locking. 1106 * &fb_info.state is checked to see if fbdev is running or not before locking.
1107 * 1107 *
1108 * Use drm_fb_helper_set_suspend() if you need to take the lock yourself. 1108 * Use drm_fb_helper_set_suspend() if you need to take the lock yourself.
1109 */ 1109 */
@@ -1181,7 +1181,7 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
1181} 1181}
1182 1182
1183/** 1183/**
1184 * drm_fb_helper_setcmap - implementation for ->fb_setcmap 1184 * drm_fb_helper_setcmap - implementation for &fb_ops.fb_setcmap
1185 * @cmap: cmap to set 1185 * @cmap: cmap to set
1186 * @info: fbdev registered by the helper 1186 * @info: fbdev registered by the helper
1187 */ 1187 */
@@ -1238,7 +1238,7 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
1238EXPORT_SYMBOL(drm_fb_helper_setcmap); 1238EXPORT_SYMBOL(drm_fb_helper_setcmap);
1239 1239
1240/** 1240/**
1241 * drm_fb_helper_check_var - implementation for ->fb_check_var 1241 * drm_fb_helper_check_var - implementation for &fb_ops.fb_check_var
1242 * @var: screeninfo to check 1242 * @var: screeninfo to check
1243 * @info: fbdev registered by the helper 1243 * @info: fbdev registered by the helper
1244 */ 1244 */
@@ -1338,7 +1338,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
1338EXPORT_SYMBOL(drm_fb_helper_check_var); 1338EXPORT_SYMBOL(drm_fb_helper_check_var);
1339 1339
1340/** 1340/**
1341 * drm_fb_helper_set_par - implementation for ->fb_set_par 1341 * drm_fb_helper_set_par - implementation for &fb_ops.fb_set_par
1342 * @info: fbdev registered by the helper 1342 * @info: fbdev registered by the helper
1343 * 1343 *
1344 * This will let fbcon do the mode init and is called at initialization time by 1344 * This will let fbcon do the mode init and is called at initialization time by
@@ -1422,7 +1422,7 @@ backoff:
1422} 1422}
1423 1423
1424/** 1424/**
1425 * drm_fb_helper_pan_display - implementation for ->fb_pan_display 1425 * drm_fb_helper_pan_display - implementation for &fb_ops.fb_pan_display
1426 * @var: updated screen information 1426 * @var: updated screen information
1427 * @info: fbdev registered by the helper 1427 * @info: fbdev registered by the helper
1428 */ 1428 */
@@ -1607,7 +1607,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
1607 * additional constraints need to set up their own limits. 1607 * additional constraints need to set up their own limits.
1608 * 1608 *
1609 * Drivers should call this (or their equivalent setup code) from their 1609 * Drivers should call this (or their equivalent setup code) from their
1610 * ->fb_probe callback. 1610 * &drm_fb_helper_funcs.fb_probe callback.
1611 */ 1611 */
1612void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 1612void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
1613 uint32_t depth) 1613 uint32_t depth)
@@ -1636,11 +1636,11 @@ EXPORT_SYMBOL(drm_fb_helper_fill_fix);
1636 * @fb_height: desired fb height 1636 * @fb_height: desired fb height
1637 * 1637 *
1638 * Sets up the variable fbdev metainformation from the given fb helper instance 1638 * Sets up the variable fbdev metainformation from the given fb helper instance
1639 * and the drm framebuffer allocated in fb_helper->fb. 1639 * and the drm framebuffer allocated in &drm_fb_helper.fb.
1640 * 1640 *
1641 * Drivers should call this (or their equivalent setup code) from their 1641 * Drivers should call this (or their equivalent setup code) from their
1642 * ->fb_probe callback after having allocated the fbdev backing 1642 * &drm_fb_helper_funcs.fb_probe callback after having allocated the fbdev
1643 * storage framebuffer. 1643 * backing storage framebuffer.
1644 */ 1644 */
1645void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 1645void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
1646 uint32_t fb_width, uint32_t fb_height) 1646 uint32_t fb_width, uint32_t fb_height)
@@ -2207,9 +2207,9 @@ out:
2207 * Note that this also registers the fbdev and so allows userspace to call into 2207 * Note that this also registers the fbdev and so allows userspace to call into
2208 * the driver through the fbdev interfaces. 2208 * the driver through the fbdev interfaces.
2209 * 2209 *
2210 * This function will call down into the ->fb_probe callback to let 2210 * This function will call down into the &drm_fb_helper_funcs.fb_probe callback
2211 * the driver allocate and initialize the fbdev info structure and the drm 2211 * to let the driver allocate and initialize the fbdev info structure and the
2212 * framebuffer used to back the fbdev. drm_fb_helper_fill_var() and 2212 * drm framebuffer used to back the fbdev. drm_fb_helper_fill_var() and
2213 * drm_fb_helper_fill_fix() are provided as helpers to setup simple default 2213 * drm_fb_helper_fill_fix() are provided as helpers to setup simple default
2214 * values for the fbdev info structure. 2214 * values for the fbdev info structure.
2215 * 2215 *
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index e22645375e60..afdf5b147f39 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -580,7 +580,7 @@ EXPORT_SYMBOL(drm_poll);
580 * kmalloc and @p must be the first member element. 580 * kmalloc and @p must be the first member element.
581 * 581 *
582 * This is the locked version of drm_event_reserve_init() for callers which 582 * This is the locked version of drm_event_reserve_init() for callers which
583 * already hold dev->event_lock. 583 * already hold &drm_device.event_lock.
584 * 584 *
585 * RETURNS: 585 * RETURNS:
586 * 586 *
@@ -621,7 +621,7 @@ EXPORT_SYMBOL(drm_event_reserve_init_locked);
621 * If callers embedded @p into a larger structure it must be allocated with 621 * If callers embedded @p into a larger structure it must be allocated with
622 * kmalloc and @p must be the first member element. 622 * kmalloc and @p must be the first member element.
623 * 623 *
624 * Callers which already hold dev->event_lock should use 624 * Callers which already hold &drm_device.event_lock should use
625 * drm_event_reserve_init_locked() instead. 625 * drm_event_reserve_init_locked() instead.
626 * 626 *
627 * RETURNS: 627 * RETURNS:
@@ -677,7 +677,7 @@ EXPORT_SYMBOL(drm_event_cancel_free);
677 * 677 *
678 * This function sends the event @e, initialized with drm_event_reserve_init(), 678 * This function sends the event @e, initialized with drm_event_reserve_init(),
679 * to its associated userspace DRM file. Callers must already hold 679 * to its associated userspace DRM file. Callers must already hold
680 * dev->event_lock, see drm_send_event() for the unlocked version. 680 * &drm_device.event_lock, see drm_send_event() for the unlocked version.
681 * 681 *
682 * Note that the core will take care of unlinking and disarming events when the 682 * Note that the core will take care of unlinking and disarming events when the
683 * corresponding DRM file is closed. Drivers need not worry about whether the 683 * corresponding DRM file is closed. Drivers need not worry about whether the
@@ -717,8 +717,9 @@ EXPORT_SYMBOL(drm_send_event_locked);
717 * @e: DRM event to deliver 717 * @e: DRM event to deliver
718 * 718 *
719 * This function sends the event @e, initialized with drm_event_reserve_init(), 719 * This function sends the event @e, initialized with drm_event_reserve_init(),
720 * to its associated userspace DRM file. This function acquires dev->event_lock, 720 * to its associated userspace DRM file. This function acquires
721 * see drm_send_event_locked() for callers which already hold this lock. 721 * &drm_device.event_lock, see drm_send_event_locked() for callers which already
722 * hold this lock.
722 * 723 *
723 * Note that the core will take care of unlinking and disarming events when the 724 * Note that the core will take care of unlinking and disarming events when the
724 * corresponding DRM file is closed. Drivers need not worry about whether the 725 * corresponding DRM file is closed. Drivers need not worry about whether the
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 588ccc3a2218..28a0108a1ab8 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -58,8 +58,8 @@
58 * fbdev framebuffer when the struct &struct drm_framebuffer is embedded into 58 * fbdev framebuffer when the struct &struct drm_framebuffer is embedded into
59 * the fbdev helper struct) drivers can manually clean up a framebuffer at 59 * the fbdev helper struct) drivers can manually clean up a framebuffer at
60 * module unload time with drm_framebuffer_unregister_private(). But doing this 60 * module unload time with drm_framebuffer_unregister_private(). But doing this
61 * is not recommended, and it's better to have a normal free-standing struct 61 * is not recommended, and it's better to have a normal free-standing &struct
62 * &drm_framebuffer. 62 * drm_framebuffer.
63 */ 63 */
64 64
65int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y, 65int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
@@ -470,7 +470,7 @@ int drm_mode_getfb(struct drm_device *dev,
470 * usb display-link, mipi manual update panels or edp panel self refresh modes. 470 * usb display-link, mipi manual update panels or edp panel self refresh modes.
471 * 471 *
472 * Modesetting drivers which always update the frontbuffer do not need to 472 * Modesetting drivers which always update the frontbuffer do not need to
473 * implement the corresponding ->dirty framebuffer callback. 473 * implement the corresponding &drm_framebuffer_funcs.dirty callback.
474 * 474 *
475 * Called by the user via ioctl. 475 * Called by the user via ioctl.
476 * 476 *
@@ -709,10 +709,10 @@ EXPORT_SYMBOL(drm_framebuffer_unregister_private);
709 * @fb: framebuffer to remove 709 * @fb: framebuffer to remove
710 * 710 *
711 * Cleanup framebuffer. This function is intended to be used from the drivers 711 * Cleanup framebuffer. This function is intended to be used from the drivers
712 * ->destroy callback. It can also be used to clean up driver private 712 * &drm_framebuffer_funcs.destroy callback. It can also be used to clean up
713 * framebuffers embedded into a larger structure. 713 * driver private framebuffers embedded into a larger structure.
714 * 714 *
715 * Note that this function does not remove the fb from active usuage - if it is 715 * Note that this function does not remove the fb from active usage - if it is
716 * still used anywhere, hilarity can ensue since userspace could call getfb on 716 * still used anywhere, hilarity can ensue since userspace could call getfb on
717 * the id and get back -EINVAL. Obviously no concern at driver unload time. 717 * the id and get back -EINVAL. Obviously no concern at driver unload time.
718 * 718 *
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 465bacd0a630..bc93de308673 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -316,8 +316,8 @@ EXPORT_SYMBOL(drm_gem_handle_delete);
316 * @dev: corresponding drm_device 316 * @dev: corresponding drm_device
317 * @handle: the dumb handle to remove 317 * @handle: the dumb handle to remove
318 * 318 *
319 * This implements the ->dumb_destroy kms driver callback for drivers which use 319 * This implements the &drm_driver.dumb_destroy kms driver callback for drivers
320 * gem to manage their backing storage. 320 * which use gem to manage their backing storage.
321 */ 321 */
322int drm_gem_dumb_destroy(struct drm_file *file, 322int drm_gem_dumb_destroy(struct drm_file *file,
323 struct drm_device *dev, 323 struct drm_device *dev,
@@ -333,9 +333,9 @@ EXPORT_SYMBOL(drm_gem_dumb_destroy);
333 * @obj: object to register 333 * @obj: object to register
334 * @handlep: pointer to return the created handle to the caller 334 * @handlep: pointer to return the created handle to the caller
335 * 335 *
336 * This expects the dev->object_name_lock to be held already and will drop it 336 * This expects the &drm_device.object_name_lock to be held already and will
337 * before returning. Used to avoid races in establishing new handles when 337 * drop it before returning. Used to avoid races in establishing new handles
338 * importing an object from either an flink name or a dma-buf. 338 * when importing an object from either an flink name or a dma-buf.
339 * 339 *
340 * Handles must be release again through drm_gem_handle_delete(). This is done 340 * Handles must be release again through drm_gem_handle_delete(). This is done
341 * when userspace closes @file_priv for all attached handles, or through the 341 * when userspace closes @file_priv for all attached handles, or through the
@@ -447,8 +447,8 @@ EXPORT_SYMBOL(drm_gem_free_mmap_offset);
447 * structures. 447 * structures.
448 * 448 *
449 * This routine allocates and attaches a fake offset for @obj, in cases where 449 * This routine allocates and attaches a fake offset for @obj, in cases where
450 * the virtual size differs from the physical size (ie. obj->size). Otherwise 450 * the virtual size differs from the physical size (ie. &drm_gem_object.size).
451 * just use drm_gem_create_mmap_offset(). 451 * Otherwise just use drm_gem_create_mmap_offset().
452 * 452 *
453 * This function is idempotent and handles an already allocated mmap offset 453 * This function is idempotent and handles an already allocated mmap offset
454 * transparently. Drivers do not need to check for this case. 454 * transparently. Drivers do not need to check for this case.
@@ -787,7 +787,7 @@ EXPORT_SYMBOL(drm_gem_object_release);
787 * @kref: kref of the object to free 787 * @kref: kref of the object to free
788 * 788 *
789 * Called after the last reference to the object has been lost. 789 * Called after the last reference to the object has been lost.
790 * Must be called holding &drm_device->struct_mutex. 790 * Must be called holding &drm_device.struct_mutex.
791 * 791 *
792 * Frees the object 792 * Frees the object
793 */ 793 */
@@ -813,7 +813,7 @@ EXPORT_SYMBOL(drm_gem_object_free);
813 * @obj: GEM buffer object 813 * @obj: GEM buffer object
814 * 814 *
815 * This releases a reference to @obj. Callers must not hold the 815 * This releases a reference to @obj. Callers must not hold the
816 * dev->struct_mutex lock when calling this function. 816 * &drm_device.struct_mutex lock when calling this function.
817 * 817 *
818 * See also __drm_gem_object_unreference(). 818 * See also __drm_gem_object_unreference().
819 */ 819 */
@@ -840,9 +840,9 @@ EXPORT_SYMBOL(drm_gem_object_unreference_unlocked);
840 * drm_gem_object_unreference - release a GEM BO reference 840 * drm_gem_object_unreference - release a GEM BO reference
841 * @obj: GEM buffer object 841 * @obj: GEM buffer object
842 * 842 *
843 * This releases a reference to @obj. Callers must hold the dev->struct_mutex 843 * This releases a reference to @obj. Callers must hold the
844 * lock when calling this function, even when the driver doesn't use 844 * &drm_device.struct_mutex lock when calling this function, even when the
845 * dev->struct_mutex for anything. 845 * driver doesn't use &drm_device.struct_mutex for anything.
846 * 846 *
847 * For drivers not encumbered with legacy locking use 847 * For drivers not encumbered with legacy locking use
848 * drm_gem_object_unreference_unlocked() instead. 848 * drm_gem_object_unreference_unlocked() instead.
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index a6213f814345..f37388cb2fde 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -31,6 +31,7 @@ void drm_lastclose(struct drm_device *dev);
31/* drm_pci.c */ 31/* drm_pci.c */
32int drm_irq_by_busid(struct drm_device *dev, void *data, 32int drm_irq_by_busid(struct drm_device *dev, void *data,
33 struct drm_file *file_priv); 33 struct drm_file *file_priv);
34void drm_pci_agp_destroy(struct drm_device *dev);
34 35
35/* drm_prime.c */ 36/* drm_prime.c */
36int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, 37int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 88c69e71102e..e06cf11ebb4a 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -95,7 +95,7 @@ static void store_vblank(struct drm_device *dev, unsigned int pipe,
95 * 95 *
96 * Only to be called from drm_crtc_vblank_on(). 96 * Only to be called from drm_crtc_vblank_on().
97 * 97 *
98 * Note: caller must hold dev->vbl_lock since this reads & writes 98 * Note: caller must hold &drm_device.vbl_lock since this reads & writes
99 * device vblank fields. 99 * device vblank fields.
100 */ 100 */
101static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe) 101static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe)
@@ -142,7 +142,7 @@ static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe
142 * Only necessary when going from off->on, to account for frames we 142 * Only necessary when going from off->on, to account for frames we
143 * didn't get an interrupt for. 143 * didn't get an interrupt for.
144 * 144 *
145 * Note: caller must hold dev->vbl_lock since this reads & writes 145 * Note: caller must hold &drm_device.vbl_lock since this reads & writes
146 * device vblank fields. 146 * device vblank fields.
147 */ 147 */
148static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe, 148static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
@@ -415,29 +415,6 @@ err:
415} 415}
416EXPORT_SYMBOL(drm_vblank_init); 416EXPORT_SYMBOL(drm_vblank_init);
417 417
418static void drm_irq_vgaarb_nokms(void *cookie, bool state)
419{
420 struct drm_device *dev = cookie;
421
422 if (dev->driver->vgaarb_irq) {
423 dev->driver->vgaarb_irq(dev, state);
424 return;
425 }
426
427 if (!dev->irq_enabled)
428 return;
429
430 if (state) {
431 if (dev->driver->irq_uninstall)
432 dev->driver->irq_uninstall(dev);
433 } else {
434 if (dev->driver->irq_preinstall)
435 dev->driver->irq_preinstall(dev);
436 if (dev->driver->irq_postinstall)
437 dev->driver->irq_postinstall(dev);
438 }
439}
440
441/** 418/**
442 * drm_irq_install - install IRQ handler 419 * drm_irq_install - install IRQ handler
443 * @dev: DRM device 420 * @dev: DRM device
@@ -449,7 +426,7 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state)
449 * 426 *
450 * This is the simplified helper interface provided for drivers with no special 427 * This is the simplified helper interface provided for drivers with no special
451 * needs. Drivers which need to install interrupt handlers for multiple 428 * needs. Drivers which need to install interrupt handlers for multiple
452 * interrupts must instead set drm_device->irq_enabled to signal the DRM core 429 * interrupts must instead set &drm_device.irq_enabled to signal the DRM core
453 * that vblank interrupts are available. 430 * that vblank interrupts are available.
454 * 431 *
455 * Returns: 432 * Returns:
@@ -492,9 +469,6 @@ int drm_irq_install(struct drm_device *dev, int irq)
492 return ret; 469 return ret;
493 } 470 }
494 471
495 if (drm_core_check_feature(dev, DRIVER_LEGACY))
496 vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL);
497
498 /* After installing handler */ 472 /* After installing handler */
499 if (dev->driver->irq_postinstall) 473 if (dev->driver->irq_postinstall)
500 ret = dev->driver->irq_postinstall(dev); 474 ret = dev->driver->irq_postinstall(dev);
@@ -519,7 +493,7 @@ EXPORT_SYMBOL(drm_irq_install);
519 * Calls the driver's irq_uninstall() function and unregisters the IRQ handler. 493 * Calls the driver's irq_uninstall() function and unregisters the IRQ handler.
520 * This should only be called by drivers which used drm_irq_install() to set up 494 * This should only be called by drivers which used drm_irq_install() to set up
521 * their interrupt handler. Other drivers must only reset 495 * their interrupt handler. Other drivers must only reset
522 * drm_device->irq_enabled to false. 496 * &drm_device.irq_enabled to false.
523 * 497 *
524 * Note that for kernel modesetting drivers it is a bug if this function fails. 498 * Note that for kernel modesetting drivers it is a bug if this function fails.
525 * The sanity checks are only to catch buggy user modesetting drivers which call 499 * The sanity checks are only to catch buggy user modesetting drivers which call
@@ -982,12 +956,11 @@ static void send_vblank_event(struct drm_device *dev,
982 * period. This helper function implements exactly the required vblank arming 956 * period. This helper function implements exactly the required vblank arming
983 * behaviour. 957 * behaviour.
984 * 958 *
985 * NOTE: Drivers using this to send out the event in &struct drm_crtc_state 959 * NOTE: Drivers using this to send out the &drm_crtc_state.event as part of an
986 * as part of an atomic commit must ensure that the next vblank happens at 960 * atomic commit must ensure that the next vblank happens at exactly the same
987 * exactly the same time as the atomic commit is committed to the hardware. This 961 * time as the atomic commit is committed to the hardware. This function itself
988 * function itself does **not** protect again the next vblank interrupt racing 962 * does **not** protect again the next vblank interrupt racing with either this
989 * with either this function call or the atomic commit operation. A possible 963 * function call or the atomic commit operation. A possible sequence could be:
990 * sequence could be:
991 * 964 *
992 * 1. Driver commits new hardware state into vblank-synchronized registers. 965 * 1. Driver commits new hardware state into vblank-synchronized registers.
993 * 2. A vblank happens, committing the hardware state. Also the corresponding 966 * 2. A vblank happens, committing the hardware state. Also the corresponding
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 229b3f525dee..e51876e588d6 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -552,8 +552,8 @@ EXPORT_SYMBOL(drm_mm_replace_node);
552 * objects to the roster, probably by walking an LRU list, but this can be 552 * objects to the roster, probably by walking an LRU list, but this can be
553 * freely implemented. Eviction candiates are added using 553 * freely implemented. Eviction candiates are added using
554 * drm_mm_scan_add_block() until a suitable hole is found or there are no 554 * drm_mm_scan_add_block() until a suitable hole is found or there are no
555 * further evictable objects. Eviction roster metadata is tracked in struct 555 * further evictable objects. Eviction roster metadata is tracked in &struct
556 * &drm_mm_scan. 556 * drm_mm_scan.
557 * 557 *
558 * The driver must walk through all objects again in exactly the reverse 558 * The driver must walk through all objects again in exactly the reverse
559 * order to restore the allocator state. Note that while the allocator is used 559 * order to restore the allocator state. Note that while the allocator is used
diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index ed1ee5a44a7b..884cc4d26fb5 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -421,7 +421,12 @@ void drm_mode_config_cleanup(struct drm_device *dev)
421 drm_connector_unreference(connector); 421 drm_connector_unreference(connector);
422 } 422 }
423 drm_connector_list_iter_put(&conn_iter); 423 drm_connector_list_iter_put(&conn_iter);
424 WARN_ON(!list_empty(&dev->mode_config.connector_list)); 424 if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
425 drm_connector_list_iter_get(dev, &conn_iter);
426 drm_for_each_connector_iter(connector, &conn_iter)
427 DRM_ERROR("connector %s leaked!\n", connector->name);
428 drm_connector_list_iter_put(&conn_iter);
429 }
425 430
426 list_for_each_entry_safe(property, pt, &dev->mode_config.property_list, 431 list_for_each_entry_safe(property, pt, &dev->mode_config.property_list,
427 head) { 432 head) {
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index e6b19bc9021a..a8616b1a8d22 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -797,6 +797,26 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
797EXPORT_SYMBOL(drm_mode_vrefresh); 797EXPORT_SYMBOL(drm_mode_vrefresh);
798 798
799/** 799/**
800 * drm_mode_get_hv_timing - Fetches hdisplay/vdisplay for given mode
801 * @mode: mode to query
802 * @hdisplay: hdisplay value to fill in
803 * @vdisplay: vdisplay value to fill in
804 *
805 * The vdisplay value will be doubled if the specified mode is a stereo mode of
806 * the appropriate layout.
807 */
808void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
809 int *hdisplay, int *vdisplay)
810{
811 struct drm_display_mode adjusted = *mode;
812
813 drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE_ONLY);
814 *hdisplay = adjusted.crtc_hdisplay;
815 *vdisplay = adjusted.crtc_vdisplay;
816}
817EXPORT_SYMBOL(drm_mode_get_hv_timing);
818
819/**
800 * drm_mode_set_crtcinfo - set CRTC modesetting timing parameters 820 * drm_mode_set_crtcinfo - set CRTC modesetting timing parameters
801 * @p: mode 821 * @p: mode
802 * @adjust_flags: a combination of adjustment flags 822 * @adjust_flags: a combination of adjustment flags
diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
index 3551ae31f143..bf60f2645e55 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -33,7 +33,7 @@
33 * to use &ww_mutex and acquire-contexts to avoid deadlocks. But because 33 * to use &ww_mutex and acquire-contexts to avoid deadlocks. But because
34 * the locking is more distributed around the driver code, we want a bit 34 * the locking is more distributed around the driver code, we want a bit
35 * of extra utility/tracking out of our acquire-ctx. This is provided 35 * of extra utility/tracking out of our acquire-ctx. This is provided
36 * by drm_modeset_lock / drm_modeset_acquire_ctx. 36 * by &struct drm_modeset_lock and &struct drm_modeset_acquire_ctx.
37 * 37 *
38 * For basic principles of &ww_mutex, see: Documentation/locking/ww-mutex-design.txt 38 * For basic principles of &ww_mutex, see: Documentation/locking/ww-mutex-design.txt
39 * 39 *
@@ -53,7 +53,7 @@
53 * drm_modeset_acquire_fini(&ctx); 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 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 56 * &drm_mode_config.mutex, for protecting everything else. Mostly this means
57 * probe state of connectors, and preventing hotplug add/removal of connectors. 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 59 * Finally there's a bunch of dedicated locks to protect drm core internal
@@ -71,7 +71,7 @@ static DEFINE_WW_CLASS(crtc_ww_class);
71 * drm_modeset_unlock_all() function. 71 * drm_modeset_unlock_all() function.
72 * 72 *
73 * This function is deprecated. It allocates a lock acquisition context and 73 * This function is deprecated. It allocates a lock acquisition context and
74 * stores it in the DRM device's ->mode_config. This facilitate conversion of 74 * stores it in &drm_device.mode_config. This facilitate conversion of
75 * existing code because it removes the need to manually deal with the 75 * existing code because it removes the need to manually deal with the
76 * acquisition context, but it is also brittle because the context is global 76 * acquisition context, but it is also brittle because the context is global
77 * and care must be taken not to nest calls. New code should use the 77 * and care must be taken not to nest calls. New code should use the
@@ -124,7 +124,7 @@ EXPORT_SYMBOL(drm_modeset_lock_all);
124 * drm_modeset_lock_all() function. 124 * drm_modeset_lock_all() function.
125 * 125 *
126 * This function is deprecated. It uses the lock acquisition context stored 126 * This function is deprecated. It uses the lock acquisition context stored
127 * in the DRM device's ->mode_config. This facilitates conversion of existing 127 * in &drm_device.mode_config. This facilitates conversion of existing
128 * code because it removes the need to manually deal with the acquisition 128 * code because it removes the need to manually deal with the acquisition
129 * context, but it is also brittle because the context is global and care must 129 * context, but it is also brittle because the context is global and care must
130 * be taken not to nest calls. New code should pass the acquisition context 130 * be taken not to nest calls. New code should pass the acquisition context
@@ -468,7 +468,7 @@ EXPORT_SYMBOL(drm_modeset_unlock);
468 * This function takes all modeset locks, suitable where a more fine-grained 468 * This function takes all modeset locks, suitable where a more fine-grained
469 * scheme isn't (yet) implemented. 469 * scheme isn't (yet) implemented.
470 * 470 *
471 * Unlike drm_modeset_lock_all(), it doesn't take the dev->mode_config.mutex 471 * Unlike drm_modeset_lock_all(), it doesn't take the &drm_mode_config.mutex
472 * since that lock isn't required for modeset state changes. Callers which 472 * since that lock isn't required for modeset state changes. Callers which
473 * need to grab that lock too need to do so outside of the acquire context 473 * need to grab that lock too need to do so outside of the acquire context
474 * @ctx. 474 * @ctx.
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index dc358f860aea..a3b356e70b35 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -191,7 +191,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
191static void drm_pci_agp_init(struct drm_device *dev) 191static void drm_pci_agp_init(struct drm_device *dev)
192{ 192{
193 if (drm_core_check_feature(dev, DRIVER_USE_AGP)) { 193 if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
194 if (drm_pci_device_is_agp(dev)) 194 if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
195 dev->agp = drm_agp_init(dev); 195 dev->agp = drm_agp_init(dev);
196 if (dev->agp) { 196 if (dev->agp) {
197 dev->agp->agp_mtrr = arch_phys_wc_add( 197 dev->agp->agp_mtrr = arch_phys_wc_add(
@@ -223,7 +223,7 @@ void drm_pci_agp_destroy(struct drm_device *dev)
223 * Try and register, if we fail to register, backout previous work. 223 * Try and register, if we fail to register, backout previous work.
224 * 224 *
225 * NOTE: This function is deprecated, please use drm_dev_alloc() and 225 * NOTE: This function is deprecated, please use drm_dev_alloc() and
226 * drm_dev_register() instead and remove your ->load() callback. 226 * drm_dev_register() instead and remove your &drm_driver.load callback.
227 * 227 *
228 * Return: 0 on success or a negative error code on failure. 228 * Return: 0 on success or a negative error code on failure.
229 */ 229 */
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index eed66be18329..c464fc4a874d 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -42,7 +42,7 @@
42 * 42 *
43 * Cursor and overlay planes are optional. All drivers should provide one 43 * Cursor and overlay planes are optional. All drivers should provide one
44 * primary plane per CRTC to avoid surprising userspace too much. See enum 44 * primary plane per CRTC to avoid surprising userspace too much. See enum
45 * &drm_plane_type for a more in-depth discussion of these special uapi-relevant 45 * drm_plane_type for a more in-depth discussion of these special uapi-relevant
46 * plane types. Special planes are associated with their CRTC by calling 46 * plane types. Special planes are associated with their CRTC by calling
47 * drm_crtc_init_with_planes(). 47 * drm_crtc_init_with_planes().
48 * 48 *
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 35d43607a47d..148688fb920a 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -39,9 +39,9 @@
39 * 39 *
40 * This helper library has two parts. The first part has support to implement 40 * This helper library has two parts. The first part has support to implement
41 * primary plane support on top of the normal CRTC configuration interface. 41 * primary plane support on top of the normal CRTC configuration interface.
42 * Since the legacy ->set_config interface ties the primary plane together with 42 * Since the legacy &drm_mode_config_funcs.set_config interface ties the primary
43 * the CRTC state this does not allow userspace to disable the primary plane 43 * plane together with the CRTC state this does not allow userspace to disable
44 * itself. To avoid too much duplicated code use 44 * the primary plane itself. To avoid too much duplicated code use
45 * drm_plane_helper_check_update() which can be used to enforce the same 45 * drm_plane_helper_check_update() which can be used to enforce the same
46 * restrictions as primary planes had thus. The default primary plane only 46 * restrictions as primary planes had thus. The default primary plane only
47 * expose XRBG8888 and ARGB8888 as valid pixel formats for the attached 47 * expose XRBG8888 and ARGB8888 as valid pixel formats for the attached
@@ -384,7 +384,8 @@ EXPORT_SYMBOL(drm_primary_helper_update);
384 * is called in response to a userspace SetPlane operation on the plane with a 384 * is called in response to a userspace SetPlane operation on the plane with a
385 * NULL framebuffer parameter. It unconditionally fails the disable call with 385 * NULL framebuffer parameter. It unconditionally fails the disable call with
386 * -EINVAL the only way to disable the primary plane without driver support is 386 * -EINVAL the only way to disable the primary plane without driver support is
387 * to disable the entier CRTC. Which does not match the plane ->disable hook. 387 * to disable the entire CRTC. Which does not match the plane
388 * &drm_plane_funcs.disable_plane hook.
388 * 389 *
389 * Note that some hardware may be able to disable the primary plane without 390 * Note that some hardware may be able to disable the primary plane without
390 * disabling the whole CRTC. Drivers for such hardware should provide their 391 * disabling the whole CRTC. Drivers for such hardware should provide their
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 7af3005a030c..56d2f93ed6b9 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -74,7 +74,7 @@ err_free:
74 * .load() function. 74 * .load() function.
75 * 75 *
76 * NOTE: This function is deprecated, please use drm_dev_alloc() and 76 * NOTE: This function is deprecated, please use drm_dev_alloc() and
77 * drm_dev_register() instead and remove your ->load() callback. 77 * drm_dev_register() instead and remove your &drm_driver.load callback.
78 * 78 *
79 * Return: 0 on success or a negative error code on failure. 79 * Return: 0 on success or a negative error code on failure.
80 */ 80 */
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 8d77b2462594..25aa4558f1b5 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -40,8 +40,11 @@
40 * On the export the dma_buf holds a reference to the exporting GEM 40 * On the export the dma_buf holds a reference to the exporting GEM
41 * object. It takes this reference in handle_to_fd_ioctl, when it 41 * object. It takes this reference in handle_to_fd_ioctl, when it
42 * first calls .prime_export and stores the exporting GEM object in 42 * first calls .prime_export and stores the exporting GEM object in
43 * the dma_buf priv. This reference is released when the dma_buf 43 * the dma_buf priv. This reference needs to be released when the
44 * object goes away in the driver .release function. 44 * final reference to the &dma_buf itself is dropped and its
45 * &dma_buf_ops.release function is called. For GEM-based drivers,
46 * the dma_buf should be exported using drm_gem_dmabuf_export() and
47 * then released by drm_gem_dmabuf_release().
45 * 48 *
46 * On the import the importing GEM object holds a reference to the 49 * On the import the importing GEM object holds a reference to the
47 * dma_buf (which in turn holds a ref to the exporting GEM object). 50 * dma_buf (which in turn holds a ref to the exporting GEM object).
@@ -51,6 +54,16 @@
51 * when the imported object is destroyed, we remove the attachment 54 * when the imported object is destroyed, we remove the attachment
52 * and drop the reference to the dma_buf. 55 * and drop the reference to the dma_buf.
53 * 56 *
57 * When all the references to the &dma_buf are dropped, i.e. when
58 * userspace has closed both handles to the imported GEM object (through the
59 * FD_TO_HANDLE IOCTL) and closed the file descriptor of the exported
60 * (through the HANDLE_TO_FD IOCTL) dma_buf, and all kernel-internal references
61 * are also gone, then the dma_buf gets destroyed. This can also happen as a
62 * part of the clean up procedure in the drm_release() function if userspace
63 * fails to properly clean up. Note that both the kernel and userspace (by
64 * keeeping the PRIME file descriptors open) can hold references onto a
65 * &dma_buf.
66 *
54 * Thus the chain of references always flows in one direction 67 * Thus the chain of references always flows in one direction
55 * (avoiding loops): importing_gem -> dmabuf -> exporting_gem 68 * (avoiding loops): importing_gem -> dmabuf -> exporting_gem
56 * 69 *
@@ -291,7 +304,7 @@ static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
291 * This wraps dma_buf_export() for use by generic GEM drivers that are using 304 * This wraps dma_buf_export() for use by generic GEM drivers that are using
292 * drm_gem_dmabuf_release(). In addition to calling dma_buf_export(), we take 305 * drm_gem_dmabuf_release(). In addition to calling dma_buf_export(), we take
293 * a reference to the &drm_device and the exported &drm_gem_object (stored in 306 * 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(). 307 * &dma_buf_export_info.priv) which is released by drm_gem_dmabuf_release().
295 * 308 *
296 * Returns the new dmabuf. 309 * Returns the new dmabuf.
297 */ 310 */
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 041a5504780f..93381454bdf7 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -43,7 +43,7 @@
43 * DOC: output probing helper overview 43 * DOC: output probing helper overview
44 * 44 *
45 * This library provides some helper code for output probing. It provides an 45 * This library provides some helper code for output probing. It provides an
46 * implementation of the core connector->fill_modes interface with 46 * implementation of the core &drm_connector_funcs.fill_modes interface with
47 * drm_helper_probe_single_connector_modes. 47 * drm_helper_probe_single_connector_modes.
48 * 48 *
49 * It also provides support for polling connectors with a work item and for 49 * It also provides support for polling connectors with a work item and for
@@ -187,9 +187,9 @@ drm_connector_detect(struct drm_connector *connector, bool force)
187 * be added to the connector's probed_modes list, then culled (based on validity 187 * be added to the connector's probed_modes list, then culled (based on validity
188 * and the @maxX, @maxY parameters) and put into the normal modes list. 188 * and the @maxX, @maxY parameters) and put into the normal modes list.
189 * 189 *
190 * Intended to be used as a generic implementation of the ->fill_modes() 190 * Intended to be used as a generic implementation of the
191 * @connector vfunc for drivers that use the CRTC helpers for output mode 191 * &drm_connector_funcs.fill_modes() vfunc for drivers that use the CRTC helpers
192 * filtering and detection. 192 * for output mode filtering and detection.
193 * 193 *
194 * The basic procedure is as follows 194 * The basic procedure is as follows
195 * 195 *
@@ -201,7 +201,7 @@ drm_connector_detect(struct drm_connector *connector, bool force)
201 * 201 *
202 * - debugfs 'override_edid' (used for testing only) 202 * - debugfs 'override_edid' (used for testing only)
203 * - firmware EDID (drm_load_edid_firmware()) 203 * - firmware EDID (drm_load_edid_firmware())
204 * - connector helper ->get_modes() vfunc 204 * - &drm_connector_helper_funcs.get_modes vfunc
205 * - if the connector status is connector_status_connected, standard 205 * - if the connector status is connector_status_connected, standard
206 * VESA DMT modes up to 1024x768 are automatically added 206 * VESA DMT modes up to 1024x768 are automatically added
207 * (drm_add_modes_noedid()) 207 * (drm_add_modes_noedid())
@@ -222,8 +222,8 @@ drm_connector_detect(struct drm_connector *connector, bool force)
222 * (if specified) 222 * (if specified)
223 * - drm_mode_validate_flag() checks the modes againt basic connector 223 * - drm_mode_validate_flag() checks the modes againt basic connector
224 * capabilites (interlace_allowed,doublescan_allowed,stereo_allowed) 224 * capabilites (interlace_allowed,doublescan_allowed,stereo_allowed)
225 * - the optional connector ->mode_valid() helper can perform driver and/or 225 * - the optional &drm_connector_helper_funcs.mode_valid helper can perform
226 * hardware specific checks 226 * driver and/or hardware specific checks
227 * 227 *
228 * 5. Any mode whose status is not OK is pruned from the connector's modes list, 228 * 5. Any mode whose status is not OK is pruned from the connector's modes list,
229 * accompanied by a debug message indicating the reason for the mode's 229 * accompanied by a debug message indicating the reason for the mode's
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 0d0e5dc0ee23..7fc070f3e49e 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -42,8 +42,8 @@
42 * drm_object_attach_property(). 42 * drm_object_attach_property().
43 * 43 *
44 * Property values are only 64bit. To support bigger piles of data (like gamma 44 * Property values are only 64bit. To support bigger piles of data (like gamma
45 * tables, color correction matrizes or large structures) a property can instead 45 * tables, color correction matrices or large structures) a property can instead
46 * point at a &drm_property_blob with that additional data 46 * point at a &drm_property_blob with that additional data.
47 * 47 *
48 * Properties are defined by their symbolic name, userspace must keep a 48 * Properties are defined by their symbolic name, userspace must keep a
49 * per-object mapping from those names to the property ID used in the atomic 49 * per-object mapping from those names to the property ID used in the atomic
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 9a37196c1bf1..513288b5c2f6 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -255,7 +255,7 @@ static const struct attribute_group *connector_dev_groups[] = {
255 * @connector: connector to add 255 * @connector: connector to add
256 * 256 *
257 * Create a connector device in sysfs, along with its associated connector 257 * Create a connector device in sysfs, along with its associated connector
258 * properties (so far, connection status, dpms, mode list & edid) and 258 * properties (so far, connection status, dpms, mode list and edid) and
259 * generate a hotplug event so userspace knows there's a new connector 259 * generate a hotplug event so userspace knows there's a new connector
260 * available. 260 * available.
261 */ 261 */
diff --git a/drivers/gpu/drm/etnaviv/Kconfig b/drivers/gpu/drm/etnaviv/Kconfig
index 656c061b439d..cc1731c5289c 100644
--- a/drivers/gpu/drm/etnaviv/Kconfig
+++ b/drivers/gpu/drm/etnaviv/Kconfig
@@ -2,7 +2,7 @@
2config DRM_ETNAVIV 2config DRM_ETNAVIV
3 tristate "ETNAVIV (DRM support for Vivante GPU IP cores)" 3 tristate "ETNAVIV (DRM support for Vivante GPU IP cores)"
4 depends on DRM 4 depends on DRM
5 depends on ARCH_MXC || ARCH_DOVE 5 depends on ARCH_MXC || ARCH_DOVE || (ARM && COMPILE_TEST)
6 depends on MMU 6 depends on MMU
7 select SHMEM 7 select SHMEM
8 select TMPFS 8 select TMPFS
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index b92c24e07cea..590be0d1dd95 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -258,12 +258,6 @@ static int etnaviv_debugfs_init(struct drm_minor *minor)
258 258
259 return ret; 259 return ret;
260} 260}
261
262static void etnaviv_debugfs_cleanup(struct drm_minor *minor)
263{
264 drm_debugfs_remove_files(etnaviv_debugfs_list,
265 ARRAY_SIZE(etnaviv_debugfs_list), minor);
266}
267#endif 261#endif
268 262
269/* 263/*
@@ -509,7 +503,6 @@ static struct drm_driver etnaviv_drm_driver = {
509 .gem_prime_mmap = etnaviv_gem_prime_mmap, 503 .gem_prime_mmap = etnaviv_gem_prime_mmap,
510#ifdef CONFIG_DEBUG_FS 504#ifdef CONFIG_DEBUG_FS
511 .debugfs_init = etnaviv_debugfs_init, 505 .debugfs_init = etnaviv_debugfs_init,
512 .debugfs_cleanup = etnaviv_debugfs_cleanup,
513#endif 506#endif
514 .ioctls = etnaviv_ioctls, 507 .ioctls = etnaviv_ioctls,
515 .num_ioctls = DRM_ETNAVIV_NUM_IOCTLS, 508 .num_ioctls = DRM_ETNAVIV_NUM_IOCTLS,
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index d706ca4e2f02..1d185347c64c 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -19,7 +19,6 @@ comment "CRTCs"
19config DRM_EXYNOS_FIMD 19config DRM_EXYNOS_FIMD
20 bool "FIMD" 20 bool "FIMD"
21 depends on !FB_S3C 21 depends on !FB_S3C
22 select FB_MODE_HELPERS
23 select MFD_SYSCON 22 select MFD_SYSCON
24 help 23 help
25 Choose this option if you want to use Exynos FIMD for DRM. 24 Choose this option if you want to use Exynos FIMD for DRM.
@@ -32,7 +31,6 @@ config DRM_EXYNOS5433_DECON
32config DRM_EXYNOS7_DECON 31config DRM_EXYNOS7_DECON
33 bool "DECON on Exynos7" 32 bool "DECON on Exynos7"
34 depends on !FB_S3C 33 depends on !FB_S3C
35 select FB_MODE_HELPERS
36 help 34 help
37 Choose this option if you want to use Exynos DECON for DRM. 35 Choose this option if you want to use Exynos DECON for DRM.
38 36
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 0dc7ba2fdc22..5ee93ff55608 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -406,11 +406,6 @@ out_err:
406 return ret; 406 return ret;
407} 407}
408 408
409static int psb_driver_device_is_agp(struct drm_device *dev)
410{
411 return 0;
412}
413
414static inline void get_brightness(struct backlight_device *bd) 409static inline void get_brightness(struct backlight_device *bd)
415{ 410{
416#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE 411#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
@@ -487,7 +482,6 @@ static struct drm_driver driver = {
487 .set_busid = drm_pci_set_busid, 482 .set_busid = drm_pci_set_busid,
488 483
489 .num_ioctls = ARRAY_SIZE(psb_ioctls), 484 .num_ioctls = ARRAY_SIZE(psb_ioctls),
490 .device_is_agp = psb_driver_device_is_agp,
491 .irq_preinstall = psb_irq_preinstall, 485 .irq_preinstall = psb_irq_preinstall,
492 .irq_postinstall = psb_irq_postinstall, 486 .irq_postinstall = psb_irq_postinstall,
493 .irq_uninstall = psb_irq_uninstall, 487 .irq_uninstall = psb_irq_uninstall,
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
index 7a6957ae4b44..16fe79053ee1 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
@@ -121,7 +121,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
121 121
122 hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj); 122 hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj);
123 if (IS_ERR(hi_fbdev->fb)) { 123 if (IS_ERR(hi_fbdev->fb)) {
124 ret = PTR_ERR(info); 124 ret = PTR_ERR(hi_fbdev->fb);
125 DRM_ERROR("failed to initialize framebuffer: %d\n", ret); 125 DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
126 goto out_release_fbi; 126 goto out_release_fbi;
127 } 127 }
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index ab4e6cbe1f8b..576a417690d4 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -1190,6 +1190,14 @@ static int i810_flip_bufs(struct drm_device *dev, void *data,
1190 1190
1191int i810_driver_load(struct drm_device *dev, unsigned long flags) 1191int i810_driver_load(struct drm_device *dev, unsigned long flags)
1192{ 1192{
1193 dev->agp = drm_agp_init(dev);
1194 if (dev->agp) {
1195 dev->agp->agp_mtrr = arch_phys_wc_add(
1196 dev->agp->agp_info.aper_base,
1197 dev->agp->agp_info.aper_size *
1198 1024 * 1024);
1199 }
1200
1193 /* Our userspace depends upon the agp mapping support. */ 1201 /* Our userspace depends upon the agp mapping support. */
1194 if (!dev->agp) 1202 if (!dev->agp)
1195 return -EINVAL; 1203 return -EINVAL;
@@ -1249,19 +1257,3 @@ const struct drm_ioctl_desc i810_ioctls[] = {
1249}; 1257};
1250 1258
1251int i810_max_ioctl = ARRAY_SIZE(i810_ioctls); 1259int i810_max_ioctl = ARRAY_SIZE(i810_ioctls);
1252
1253/**
1254 * Determine if the device really is AGP or not.
1255 *
1256 * All Intel graphics chipsets are treated as AGP, even if they are really
1257 * PCI-e.
1258 *
1259 * \param dev The device to be tested.
1260 *
1261 * \returns
1262 * A value of 1 is always retured to indictate every i810 is AGP.
1263 */
1264int i810_driver_device_is_agp(struct drm_device *dev)
1265{
1266 return 1;
1267}
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index 02504a7cfaf2..37fd0906f807 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -60,7 +60,6 @@ static struct drm_driver driver = {
60 .lastclose = i810_driver_lastclose, 60 .lastclose = i810_driver_lastclose,
61 .preclose = i810_driver_preclose, 61 .preclose = i810_driver_preclose,
62 .set_busid = drm_pci_set_busid, 62 .set_busid = drm_pci_set_busid,
63 .device_is_agp = i810_driver_device_is_agp,
64 .dma_quiescent = i810_driver_dma_quiescent, 63 .dma_quiescent = i810_driver_dma_quiescent,
65 .ioctls = i810_ioctls, 64 .ioctls = i810_ioctls,
66 .fops = &i810_driver_fops, 65 .fops = &i810_driver_fops,
diff --git a/drivers/gpu/drm/i810/i810_drv.h b/drivers/gpu/drm/i810/i810_drv.h
index 93ec5dc4e7d3..c73d2f2da57b 100644
--- a/drivers/gpu/drm/i810/i810_drv.h
+++ b/drivers/gpu/drm/i810/i810_drv.h
@@ -124,7 +124,6 @@ extern int i810_driver_load(struct drm_device *, unsigned long flags);
124extern void i810_driver_lastclose(struct drm_device *dev); 124extern void i810_driver_lastclose(struct drm_device *dev);
125extern void i810_driver_preclose(struct drm_device *dev, 125extern void i810_driver_preclose(struct drm_device *dev,
126 struct drm_file *file_priv); 126 struct drm_file *file_priv);
127extern int i810_driver_device_is_agp(struct drm_device *dev);
128 127
129extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 128extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
130extern const struct drm_ioctl_desc i810_ioctls[]; 129extern const struct drm_ioctl_desc i810_ioctls[];
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0f4272f98648..b3e773c9f872 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11092,7 +11092,7 @@ static int intel_modeset_setup_plane_state(struct drm_atomic_state *state,
11092 return PTR_ERR(plane_state); 11092 return PTR_ERR(plane_state);
11093 11093
11094 if (mode) 11094 if (mode)
11095 drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay); 11095 drm_mode_get_hv_timing(mode, &hdisplay, &vdisplay);
11096 else 11096 else
11097 hdisplay = vdisplay = 0; 11097 hdisplay = vdisplay = 0;
11098 11098
@@ -12981,7 +12981,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
12981 * computation to clearly distinguish it from the adjusted mode, which 12981 * computation to clearly distinguish it from the adjusted mode, which
12982 * can be changed by the connectors in the below retry loop. 12982 * can be changed by the connectors in the below retry loop.
12983 */ 12983 */
12984 drm_crtc_get_hv_timing(&pipe_config->base.mode, 12984 drm_mode_get_hv_timing(&pipe_config->base.mode,
12985 &pipe_config->pipe_src_w, 12985 &pipe_config->pipe_src_w,
12986 &pipe_config->pipe_src_h); 12986 &pipe_config->pipe_src_h);
12987 12987
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index e80d620846c8..3d8ac8aa7214 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1713,7 +1713,9 @@ found:
1713 * VESA DisplayPort Ver.1.2a - 5.1.1.1 Video Colorimetry 1713 * VESA DisplayPort Ver.1.2a - 5.1.1.1 Video Colorimetry
1714 */ 1714 */
1715 pipe_config->limited_color_range = 1715 pipe_config->limited_color_range =
1716 bpp != 18 && drm_match_cea_mode(adjusted_mode) > 1; 1716 bpp != 18 &&
1717 drm_default_rgb_quant_range(adjusted_mode) ==
1718 HDMI_QUANTIZATION_RANGE_LIMITED;
1717 } else { 1719 } else {
1718 pipe_config->limited_color_range = 1720 pipe_config->limited_color_range =
1719 intel_dp->limited_color_range; 1721 intel_dp->limited_color_range;
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 205fe4748ec5..38e3ca2f6f18 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -587,7 +587,8 @@ intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_ba
587 587
588 /* create encoders */ 588 /* create encoders */
589 intel_dp_create_fake_mst_encoders(intel_dig_port); 589 intel_dp_create_fake_mst_encoders(intel_dig_port);
590 ret = drm_dp_mst_topology_mgr_init(&intel_dp->mst_mgr, dev->dev, &intel_dp->aux, 16, 3, conn_base_id); 590 ret = drm_dp_mst_topology_mgr_init(&intel_dp->mst_mgr, dev,
591 &intel_dp->aux, 16, 3, conn_base_id);
591 if (ret) { 592 if (ret) {
592 intel_dp->can_mst = false; 593 intel_dp->can_mst = false;
593 return ret; 594 return ret;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 0bcfead14571..af16b0fa6b69 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -455,24 +455,23 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
455 const struct intel_crtc_state *crtc_state) 455 const struct intel_crtc_state *crtc_state)
456{ 456{
457 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); 457 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
458 const struct drm_display_mode *adjusted_mode =
459 &crtc_state->base.adjusted_mode;
458 union hdmi_infoframe frame; 460 union hdmi_infoframe frame;
459 int ret; 461 int ret;
460 462
461 ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, 463 ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
462 &crtc_state->base.adjusted_mode); 464 adjusted_mode);
463 if (ret < 0) { 465 if (ret < 0) {
464 DRM_ERROR("couldn't fill AVI infoframe\n"); 466 DRM_ERROR("couldn't fill AVI infoframe\n");
465 return; 467 return;
466 } 468 }
467 469
468 if (intel_hdmi->rgb_quant_range_selectable) { 470 drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode,
469 if (crtc_state->limited_color_range) 471 crtc_state->limited_color_range ?
470 frame.avi.quantization_range = 472 HDMI_QUANTIZATION_RANGE_LIMITED :
471 HDMI_QUANTIZATION_RANGE_LIMITED; 473 HDMI_QUANTIZATION_RANGE_FULL,
472 else 474 intel_hdmi->rgb_quant_range_selectable);
473 frame.avi.quantization_range =
474 HDMI_QUANTIZATION_RANGE_FULL;
475 }
476 475
477 intel_write_infoframe(encoder, crtc_state, &frame); 476 intel_write_infoframe(encoder, crtc_state, &frame);
478} 477}
@@ -1330,7 +1329,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
1330 /* See CEA-861-E - 5.1 Default Encoding Parameters */ 1329 /* See CEA-861-E - 5.1 Default Encoding Parameters */
1331 pipe_config->limited_color_range = 1330 pipe_config->limited_color_range =
1332 pipe_config->has_hdmi_sink && 1331 pipe_config->has_hdmi_sink &&
1333 drm_match_cea_mode(adjusted_mode) > 1; 1332 drm_default_rgb_quant_range(adjusted_mode) ==
1333 HDMI_QUANTIZATION_RANGE_LIMITED;
1334 } else { 1334 } else {
1335 pipe_config->limited_color_range = 1335 pipe_config->limited_color_range =
1336 intel_hdmi->limited_color_range; 1336 intel_hdmi->limited_color_range;
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index a1d8dd15b131..1ffdafea27e4 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -392,6 +392,24 @@ int mga_driver_load(struct drm_device *dev, unsigned long flags)
392 drm_mga_private_t *dev_priv; 392 drm_mga_private_t *dev_priv;
393 int ret; 393 int ret;
394 394
395 /* There are PCI versions of the G450. These cards have the
396 * same PCI ID as the AGP G450, but have an additional PCI-to-PCI
397 * bridge chip. We detect these cards, which are not currently
398 * supported by this driver, by looking at the device ID of the
399 * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the
400 * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
401 * device.
402 */
403 if ((dev->pdev->device == 0x0525) && dev->pdev->bus->self
404 && (dev->pdev->bus->self->vendor == 0x3388)
405 && (dev->pdev->bus->self->device == 0x0021)
406 && dev->agp) {
407 /* FIXME: This should be quirked in the pci core, but oh well
408 * the hw probably stopped existing. */
409 arch_phys_wc_del(dev->agp->agp_mtrr);
410 kfree(dev->agp);
411 dev->agp = NULL;
412 }
395 dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL); 413 dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL);
396 if (!dev_priv) 414 if (!dev_priv)
397 return -ENOMEM; 415 return -ENOMEM;
@@ -698,7 +716,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
698static int mga_do_dma_bootstrap(struct drm_device *dev, 716static int mga_do_dma_bootstrap(struct drm_device *dev,
699 drm_mga_dma_bootstrap_t *dma_bs) 717 drm_mga_dma_bootstrap_t *dma_bs)
700{ 718{
701 const int is_agp = (dma_bs->agp_mode != 0) && drm_pci_device_is_agp(dev); 719 const int is_agp = (dma_bs->agp_mode != 0) && dev->agp;
702 int err; 720 int err;
703 drm_mga_private_t *const dev_priv = 721 drm_mga_private_t *const dev_priv =
704 (drm_mga_private_t *) dev->dev_private; 722 (drm_mga_private_t *) dev->dev_private;
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index 25b2a1a424e6..63ba0699d107 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -37,8 +37,6 @@
37 37
38#include <drm/drm_pciids.h> 38#include <drm/drm_pciids.h>
39 39
40static int mga_driver_device_is_agp(struct drm_device *dev);
41
42static struct pci_device_id pciidlist[] = { 40static struct pci_device_id pciidlist[] = {
43 mga_PCI_IDS 41 mga_PCI_IDS
44}; 42};
@@ -66,7 +64,6 @@ static struct drm_driver driver = {
66 .lastclose = mga_driver_lastclose, 64 .lastclose = mga_driver_lastclose,
67 .set_busid = drm_pci_set_busid, 65 .set_busid = drm_pci_set_busid,
68 .dma_quiescent = mga_driver_dma_quiescent, 66 .dma_quiescent = mga_driver_dma_quiescent,
69 .device_is_agp = mga_driver_device_is_agp,
70 .get_vblank_counter = mga_get_vblank_counter, 67 .get_vblank_counter = mga_get_vblank_counter,
71 .enable_vblank = mga_enable_vblank, 68 .enable_vblank = mga_enable_vblank,
72 .disable_vblank = mga_disable_vblank, 69 .disable_vblank = mga_disable_vblank,
@@ -107,37 +104,3 @@ module_exit(mga_exit);
107MODULE_AUTHOR(DRIVER_AUTHOR); 104MODULE_AUTHOR(DRIVER_AUTHOR);
108MODULE_DESCRIPTION(DRIVER_DESC); 105MODULE_DESCRIPTION(DRIVER_DESC);
109MODULE_LICENSE("GPL and additional rights"); 106MODULE_LICENSE("GPL and additional rights");
110
111/**
112 * Determine if the device really is AGP or not.
113 *
114 * In addition to the usual tests performed by \c drm_device_is_agp, this
115 * function detects PCI G450 cards that appear to the system exactly like
116 * AGP G450 cards.
117 *
118 * \param dev The device to be tested.
119 *
120 * \returns
121 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned.
122 */
123static int mga_driver_device_is_agp(struct drm_device *dev)
124{
125 const struct pci_dev *const pdev = dev->pdev;
126
127 /* There are PCI versions of the G450. These cards have the
128 * same PCI ID as the AGP G450, but have an additional PCI-to-PCI
129 * bridge chip. We detect these cards, which are not currently
130 * supported by this driver, by looking at the device ID of the
131 * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the
132 * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the
133 * device.
134 */
135
136 if ((pdev->device == 0x0525) && pdev->bus->self
137 && (pdev->bus->self->vendor == 0x3388)
138 && (pdev->bus->self->device == 0x0021)) {
139 return 0;
140 }
141
142 return 2;
143}
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 7bd4683216d0..4df4f6ed4886 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -199,7 +199,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
199 if (!nvxx_device(device)->func->pci) 199 if (!nvxx_device(device)->func->pci)
200 getparam->value = 3; 200 getparam->value = 3;
201 else 201 else
202 if (drm_pci_device_is_agp(dev)) 202 if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
203 getparam->value = 0; 203 getparam->value = 0;
204 else 204 else
205 if (!pci_is_pcie(dev->pdev)) 205 if (!pci_is_pcie(dev->pdev))
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index cb85cb72dc1c..452da483ca01 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -3417,7 +3417,7 @@ nv50_mstm_new(struct nouveau_encoder *outp, struct drm_dp_aux *aux, int aux_max,
3417 mstm->outp = outp; 3417 mstm->outp = outp;
3418 mstm->mgr.cbs = &nv50_mstm; 3418 mstm->mgr.cbs = &nv50_mstm;
3419 3419
3420 ret = drm_dp_mst_topology_mgr_init(&mstm->mgr, dev->dev, aux, aux_max, 3420 ret = drm_dp_mst_topology_mgr_init(&mstm->mgr, dev, aux, aux_max,
3421 max_payloads, conn_base_id); 3421 max_payloads, conn_base_id);
3422 if (ret) 3422 if (ret)
3423 return ret; 3423 return ret;
diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c
index bf65862daf62..19b716745623 100644
--- a/drivers/gpu/drm/omapdrm/omap_debugfs.c
+++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c
@@ -123,13 +123,4 @@ int omap_debugfs_init(struct drm_minor *minor)
123 return ret; 123 return ret;
124} 124}
125 125
126void omap_debugfs_cleanup(struct drm_minor *minor)
127{
128 drm_debugfs_remove_files(omap_debugfs_list,
129 ARRAY_SIZE(omap_debugfs_list), minor);
130 if (dmm_is_available())
131 drm_debugfs_remove_files(omap_dmm_debugfs_list,
132 ARRAY_SIZE(omap_dmm_debugfs_list), minor);
133}
134
135#endif 126#endif
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 00aa214b7560..afe8f05b927b 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -719,7 +719,6 @@ static struct drm_driver omap_drm_driver = {
719 .disable_vblank = omap_irq_disable_vblank, 719 .disable_vblank = omap_irq_disable_vblank,
720#ifdef CONFIG_DEBUG_FS 720#ifdef CONFIG_DEBUG_FS
721 .debugfs_init = omap_debugfs_init, 721 .debugfs_init = omap_debugfs_init,
722 .debugfs_cleanup = omap_debugfs_cleanup,
723#endif 722#endif
724 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 723 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
725 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 724 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index b20377efd01b..36d93ce84a29 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -103,7 +103,6 @@ struct omap_drm_private {
103 103
104#ifdef CONFIG_DEBUG_FS 104#ifdef CONFIG_DEBUG_FS
105int omap_debugfs_init(struct drm_minor *minor); 105int omap_debugfs_init(struct drm_minor *minor);
106void omap_debugfs_cleanup(struct drm_minor *minor);
107void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m); 106void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m);
108void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m); 107void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
109void omap_gem_describe_objects(struct list_head *list, struct seq_file *m); 108void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 510ea371dacc..a8442f7196d6 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -121,7 +121,8 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
121 VRAM, also but everything into VRAM on AGP cards and older 121 VRAM, also but everything into VRAM on AGP cards and older
122 IGP chips to avoid image corruptions */ 122 IGP chips to avoid image corruptions */
123 if (p->ring == R600_RING_TYPE_UVD_INDEX && 123 if (p->ring == R600_RING_TYPE_UVD_INDEX &&
124 (i == 0 || drm_pci_device_is_agp(p->rdev->ddev) || 124 (i == 0 || pci_find_capability(p->rdev->ddev->pdev,
125 PCI_CAP_ID_AGP) ||
125 p->rdev->family == CHIP_RS780 || 126 p->rdev->family == CHIP_RS780 ||
126 p->rdev->family == CHIP_RS880)) { 127 p->rdev->family == CHIP_RS880)) {
127 128
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 8a1df2a1afbd..4b0c388be3f5 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1549,8 +1549,6 @@ failed:
1549 return r; 1549 return r;
1550} 1550}
1551 1551
1552static void radeon_debugfs_remove_files(struct radeon_device *rdev);
1553
1554/** 1552/**
1555 * radeon_device_fini - tear down the driver 1553 * radeon_device_fini - tear down the driver
1556 * 1554 *
@@ -1577,7 +1575,6 @@ void radeon_device_fini(struct radeon_device *rdev)
1577 rdev->rmmio = NULL; 1575 rdev->rmmio = NULL;
1578 if (rdev->family >= CHIP_BONAIRE) 1576 if (rdev->family >= CHIP_BONAIRE)
1579 radeon_doorbell_fini(rdev); 1577 radeon_doorbell_fini(rdev);
1580 radeon_debugfs_remove_files(rdev);
1581} 1578}
1582 1579
1583 1580
@@ -1954,16 +1951,3 @@ int radeon_debugfs_add_files(struct radeon_device *rdev,
1954#endif 1951#endif
1955 return 0; 1952 return 0;
1956} 1953}
1957
1958static void radeon_debugfs_remove_files(struct radeon_device *rdev)
1959{
1960#if defined(CONFIG_DEBUG_FS)
1961 unsigned i;
1962
1963 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->primary);
1967 }
1968#endif
1969}
diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
index 6d1237d6e1b8..7d5ada3980dc 100644
--- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
+++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
@@ -667,7 +667,7 @@ radeon_dp_mst_init(struct radeon_connector *radeon_connector)
667 return 0; 667 return 0;
668 668
669 radeon_connector->mst_mgr.cbs = &mst_cbs; 669 radeon_connector->mst_mgr.cbs = &mst_cbs;
670 return drm_dp_mst_topology_mgr_init(&radeon_connector->mst_mgr, dev->dev, 670 return drm_dp_mst_topology_mgr_init(&radeon_connector->mst_mgr, dev,
671 &radeon_connector->ddc_bus->aux, 16, 6, 671 &radeon_connector->ddc_bus->aux, 16, 6,
672 radeon_connector->base.base.id); 672 radeon_connector->base.base.id);
673} 673}
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 116cf0d23595..56f35c06742c 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -105,7 +105,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
105 dev->dev_private = (void *)rdev; 105 dev->dev_private = (void *)rdev;
106 106
107 /* update BUS flag */ 107 /* update BUS flag */
108 if (drm_pci_device_is_agp(dev)) { 108 if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP)) {
109 flags |= RADEON_IS_AGP; 109 flags |= RADEON_IS_AGP;
110 } else if (pci_is_pcie(dev->pdev)) { 110 } else if (pci_is_pcie(dev->pdev)) {
111 flags |= RADEON_IS_PCIE; 111 flags |= RADEON_IS_PCIE;
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 278a63f10d9f..acc056644cd0 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -89,38 +89,9 @@ static struct drm_info_list sti_drm_dbg_list[] = {
89 {"fps_get", sti_drm_fps_dbg_show, 0}, 89 {"fps_get", sti_drm_fps_dbg_show, 0},
90}; 90};
91 91
92static int sti_drm_debugfs_create(struct dentry *root,
93 struct drm_minor *minor,
94 const char *name,
95 const struct file_operations *fops)
96{
97 struct drm_device *dev = minor->dev;
98 struct drm_info_node *node;
99 struct dentry *ent;
100
101 ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops);
102 if (IS_ERR(ent))
103 return PTR_ERR(ent);
104
105 node = kmalloc(sizeof(*node), GFP_KERNEL);
106 if (!node) {
107 debugfs_remove(ent);
108 return -ENOMEM;
109 }
110
111 node->minor = minor;
112 node->dent = ent;
113 node->info_ent = (void *)fops;
114
115 mutex_lock(&minor->debugfs_lock);
116 list_add(&node->list, &minor->debugfs_list);
117 mutex_unlock(&minor->debugfs_lock);
118
119 return 0;
120}
121
122static int sti_drm_dbg_init(struct drm_minor *minor) 92static int sti_drm_dbg_init(struct drm_minor *minor)
123{ 93{
94 struct dentry *dentry;
124 int ret; 95 int ret;
125 96
126 ret = drm_debugfs_create_files(sti_drm_dbg_list, 97 ret = drm_debugfs_create_files(sti_drm_dbg_list,
@@ -129,10 +100,13 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
129 if (ret) 100 if (ret)
130 goto err; 101 goto err;
131 102
132 ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show", 103 dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR,
104 minor->debugfs_root, minor->dev,
133 &sti_drm_fps_fops); 105 &sti_drm_fps_fops);
134 if (ret) 106 if (!dentry) {
107 ret = -ENOMEM;
135 goto err; 108 goto err;
109 }
136 110
137 DRM_INFO("%s: debugfs installed\n", DRIVER_NAME); 111 DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
138 return 0; 112 return 0;
@@ -141,15 +115,6 @@ err:
141 return ret; 115 return ret;
142} 116}
143 117
144static void sti_drm_dbg_cleanup(struct drm_minor *minor)
145{
146 drm_debugfs_remove_files(sti_drm_dbg_list,
147 ARRAY_SIZE(sti_drm_dbg_list), minor);
148
149 drm_debugfs_remove_files((struct drm_info_list *)&sti_drm_fps_fops,
150 1, minor);
151}
152
153static void sti_atomic_schedule(struct sti_private *private, 118static void sti_atomic_schedule(struct sti_private *private,
154 struct drm_atomic_state *state) 119 struct drm_atomic_state *state)
155{ 120{
@@ -314,7 +279,6 @@ static struct drm_driver sti_driver = {
314 .gem_prime_mmap = drm_gem_cma_prime_mmap, 279 .gem_prime_mmap = drm_gem_cma_prime_mmap,
315 280
316 .debugfs_init = sti_drm_dbg_init, 281 .debugfs_init = sti_drm_dbg_init,
317 .debugfs_cleanup = sti_drm_dbg_cleanup,
318 282
319 .name = DRIVER_NAME, 283 .name = DRIVER_NAME,
320 .desc = DRIVER_DESC, 284 .desc = DRIVER_DESC,
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 411dc6ec976e..bb23318a44b7 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -195,13 +195,6 @@ static struct drm_info_list dvo_debugfs_files[] = {
195 { "dvo", dvo_dbg_show, 0, NULL }, 195 { "dvo", dvo_dbg_show, 0, NULL },
196}; 196};
197 197
198static void dvo_debugfs_exit(struct sti_dvo *dvo, struct drm_minor *minor)
199{
200 drm_debugfs_remove_files(dvo_debugfs_files,
201 ARRAY_SIZE(dvo_debugfs_files),
202 minor);
203}
204
205static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) 198static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
206{ 199{
207 unsigned int i; 200 unsigned int i;
@@ -514,9 +507,6 @@ static void sti_dvo_unbind(struct device *dev,
514 struct device *master, void *data) 507 struct device *master, void *data)
515{ 508{
516 struct sti_dvo *dvo = dev_get_drvdata(dev); 509 struct sti_dvo *dvo = dev_get_drvdata(dev);
517 struct drm_device *drm_dev = data;
518
519 dvo_debugfs_exit(dvo, drm_dev->primary);
520 510
521 drm_bridge_remove(dvo->bridge); 511 drm_bridge_remove(dvo->bridge);
522} 512}
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 66d37d78152a..0c0a75bc8bc3 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -365,13 +365,6 @@ static struct drm_info_list hda_debugfs_files[] = {
365 { "hda", hda_dbg_show, 0, NULL }, 365 { "hda", hda_dbg_show, 0, NULL },
366}; 366};
367 367
368static void hda_debugfs_exit(struct sti_hda *hda, struct drm_minor *minor)
369{
370 drm_debugfs_remove_files(hda_debugfs_files,
371 ARRAY_SIZE(hda_debugfs_files),
372 minor);
373}
374
375static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) 368static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
376{ 369{
377 unsigned int i; 370 unsigned int i;
@@ -739,10 +732,6 @@ err_sysfs:
739static void sti_hda_unbind(struct device *dev, 732static void sti_hda_unbind(struct device *dev,
740 struct device *master, void *data) 733 struct device *master, void *data)
741{ 734{
742 struct sti_hda *hda = dev_get_drvdata(dev);
743 struct drm_device *drm_dev = data;
744
745 hda_debugfs_exit(hda, drm_dev->primary);
746} 735}
747 736
748static const struct component_ops sti_hda_ops = { 737static const struct component_ops sti_hda_ops = {
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 5ef1d1fce6d1..c9151849d604 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -731,13 +731,6 @@ static struct drm_info_list hdmi_debugfs_files[] = {
731 { "hdmi", hdmi_dbg_show, 0, NULL }, 731 { "hdmi", hdmi_dbg_show, 0, NULL },
732}; 732};
733 733
734static void hdmi_debugfs_exit(struct sti_hdmi *hdmi, struct drm_minor *minor)
735{
736 drm_debugfs_remove_files(hdmi_debugfs_files,
737 ARRAY_SIZE(hdmi_debugfs_files),
738 minor);
739}
740
741static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor) 734static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
742{ 735{
743 unsigned int i; 736 unsigned int i;
@@ -1356,10 +1349,6 @@ err_sysfs:
1356static void sti_hdmi_unbind(struct device *dev, 1349static void sti_hdmi_unbind(struct device *dev,
1357 struct device *master, void *data) 1350 struct device *master, void *data)
1358{ 1351{
1359 struct sti_hdmi *hdmi = dev_get_drvdata(dev);
1360 struct drm_device *drm_dev = data;
1361
1362 hdmi_debugfs_exit(hdmi, drm_dev->primary);
1363} 1352}
1364 1353
1365static const struct component_ops sti_hdmi_ops = { 1354static const struct component_ops sti_hdmi_ops = {
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index ad46d3558d91..8b8ea717c121 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -567,13 +567,6 @@ static struct drm_info_list tvout_debugfs_files[] = {
567 { "tvout", tvout_dbg_show, 0, NULL }, 567 { "tvout", tvout_dbg_show, 0, NULL },
568}; 568};
569 569
570static void tvout_debugfs_exit(struct sti_tvout *tvout, struct drm_minor *minor)
571{
572 drm_debugfs_remove_files(tvout_debugfs_files,
573 ARRAY_SIZE(tvout_debugfs_files),
574 minor);
575}
576
577static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor) 570static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor)
578{ 571{
579 unsigned int i; 572 unsigned int i;
@@ -627,7 +620,6 @@ static void sti_tvout_early_unregister(struct drm_encoder *encoder)
627 if (!tvout->debugfs_registered) 620 if (!tvout->debugfs_registered)
628 return; 621 return;
629 622
630 tvout_debugfs_exit(tvout, encoder->dev->primary);
631 tvout->debugfs_registered = false; 623 tvout->debugfs_registered = false;
632} 624}
633 625
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 2d57f6278db1..ef215fef63d6 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -894,12 +894,6 @@ static int tegra_debugfs_init(struct drm_minor *minor)
894 ARRAY_SIZE(tegra_debugfs_list), 894 ARRAY_SIZE(tegra_debugfs_list),
895 minor->debugfs_root, minor); 895 minor->debugfs_root, minor);
896} 896}
897
898static void tegra_debugfs_cleanup(struct drm_minor *minor)
899{
900 drm_debugfs_remove_files(tegra_debugfs_list,
901 ARRAY_SIZE(tegra_debugfs_list), minor);
902}
903#endif 897#endif
904 898
905static struct drm_driver tegra_drm_driver = { 899static struct drm_driver tegra_drm_driver = {
@@ -917,7 +911,6 @@ static struct drm_driver tegra_drm_driver = {
917 911
918#if defined(CONFIG_DEBUG_FS) 912#if defined(CONFIG_DEBUG_FS)
919 .debugfs_init = tegra_debugfs_init, 913 .debugfs_init = tegra_debugfs_init,
920 .debugfs_cleanup = tegra_debugfs_cleanup,
921#endif 914#endif
922 915
923 .gem_free_object_unlocked = tegra_bo_free_object, 916 .gem_free_object_unlocked = tegra_bo_free_object,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index ec15585c7a27..919294a735fe 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -539,17 +539,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
539 539
540 return ret; 540 return ret;
541} 541}
542
543static void tilcdc_debugfs_cleanup(struct drm_minor *minor)
544{
545 struct tilcdc_module *mod;
546 drm_debugfs_remove_files(tilcdc_debugfs_list,
547 ARRAY_SIZE(tilcdc_debugfs_list), minor);
548
549 list_for_each_entry(mod, &module_list, list)
550 if (mod->funcs->debugfs_cleanup)
551 mod->funcs->debugfs_cleanup(mod, minor);
552}
553#endif 542#endif
554 543
555static const struct file_operations fops = { 544static const struct file_operations fops = {
@@ -589,7 +578,6 @@ static struct drm_driver tilcdc_driver = {
589 .gem_prime_mmap = drm_gem_cma_prime_mmap, 578 .gem_prime_mmap = drm_gem_cma_prime_mmap,
590#ifdef CONFIG_DEBUG_FS 579#ifdef CONFIG_DEBUG_FS
591 .debugfs_init = tilcdc_debugfs_init, 580 .debugfs_init = tilcdc_debugfs_init,
592 .debugfs_cleanup = tilcdc_debugfs_cleanup,
593#endif 581#endif
594 .fops = &fops, 582 .fops = &fops,
595 .name = "tilcdc", 583 .name = "tilcdc",
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index 0e71daf5b5cb..8caa11bc7aec 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -111,8 +111,6 @@ struct tilcdc_module_ops {
111#ifdef CONFIG_DEBUG_FS 111#ifdef CONFIG_DEBUG_FS
112 /* create debugfs nodes (can be NULL): */ 112 /* create debugfs nodes (can be NULL): */
113 int (*debugfs_init)(struct tilcdc_module *mod, struct drm_minor *minor); 113 int (*debugfs_init)(struct tilcdc_module *mod, struct drm_minor *minor);
114 /* cleanup debugfs nodes (can be NULL): */
115 void (*debugfs_cleanup)(struct tilcdc_module *mod, struct drm_minor *minor);
116#endif 114#endif
117}; 115};
118 116
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index d5063618efa7..86e3b233b722 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1670,7 +1670,6 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink)
1670 struct ttm_buffer_object *bo; 1670 struct ttm_buffer_object *bo;
1671 int ret = -EBUSY; 1671 int ret = -EBUSY;
1672 int put_count; 1672 int put_count;
1673 uint32_t swap_placement = (TTM_PL_FLAG_CACHED | TTM_PL_FLAG_SYSTEM);
1674 1673
1675 spin_lock(&glob->lru_lock); 1674 spin_lock(&glob->lru_lock);
1676 list_for_each_entry(bo, &glob->swap_lru, swap) { 1675 list_for_each_entry(bo, &glob->swap_lru, swap) {
@@ -1701,7 +1700,8 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink)
1701 * Move to system cached 1700 * Move to system cached
1702 */ 1701 */
1703 1702
1704 if ((bo->mem.placement & swap_placement) != swap_placement) { 1703 if (bo->mem.mem_type != TTM_PL_SYSTEM ||
1704 bo->ttm->caching_state != tt_cached) {
1705 struct ttm_mem_reg evict_mem; 1705 struct ttm_mem_reg evict_mem;
1706 1706
1707 evict_mem = bo->mem; 1707 evict_mem = bo->mem;
diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c
index caf817bac885..c4d5e6a8d6f2 100644
--- a/drivers/gpu/drm/vc4/vc4_debugfs.c
+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c
@@ -36,9 +36,3 @@ vc4_debugfs_init(struct drm_minor *minor)
36 return drm_debugfs_create_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES, 36 return drm_debugfs_create_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES,
37 minor->debugfs_root, minor); 37 minor->debugfs_root, minor);
38} 38}
39
40void
41vc4_debugfs_cleanup(struct drm_minor *minor)
42{
43 drm_debugfs_remove_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES, minor);
44}
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index ac09ca7ff430..e4f42ebee517 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -145,7 +145,6 @@ static struct drm_driver vc4_drm_driver = {
145 145
146#if defined(CONFIG_DEBUG_FS) 146#if defined(CONFIG_DEBUG_FS)
147 .debugfs_init = vc4_debugfs_init, 147 .debugfs_init = vc4_debugfs_init,
148 .debugfs_cleanup = vc4_debugfs_cleanup,
149#endif 148#endif
150 149
151 .gem_create_object = vc4_create_object, 150 .gem_create_object = vc4_create_object,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index affcdeb70aa9..78e3e5a43fb0 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -457,7 +457,6 @@ int vc4_crtc_get_vblank_timestamp(struct drm_device *dev, unsigned int crtc_id,
457 457
458/* vc4_debugfs.c */ 458/* vc4_debugfs.c */
459int vc4_debugfs_init(struct drm_minor *minor); 459int vc4_debugfs_init(struct drm_minor *minor);
460void vc4_debugfs_cleanup(struct drm_minor *minor);
461 460
462/* vc4_drv.c */ 461/* vc4_drv.c */
463void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); 462void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index c4cb2e26de32..93d5994f3a04 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -356,15 +356,11 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
356 return; 356 return;
357 } 357 }
358 358
359 if (vc4_encoder->rgb_range_selectable) { 359 drm_hdmi_avi_infoframe_quant_range(&frame.avi, mode,
360 if (vc4_encoder->limited_rgb_range) { 360 vc4_encoder->limited_rgb_range ?
361 frame.avi.quantization_range = 361 HDMI_QUANTIZATION_RANGE_LIMITED :
362 HDMI_QUANTIZATION_RANGE_LIMITED; 362 HDMI_QUANTIZATION_RANGE_FULL,
363 } else { 363 vc4_encoder->rgb_range_selectable);
364 frame.avi.quantization_range =
365 HDMI_QUANTIZATION_RANGE_FULL;
366 }
367 }
368 364
369 vc4_hdmi_write_infoframe(encoder, &frame); 365 vc4_hdmi_write_infoframe(encoder, &frame);
370} 366}
@@ -463,7 +459,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder,
463 csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR, 459 csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR,
464 VC4_HD_CSC_CTL_ORDER); 460 VC4_HD_CSC_CTL_ORDER);
465 461
466 if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) { 462 if (vc4_encoder->hdmi_monitor &&
463 drm_default_rgb_quant_range(mode) ==
464 HDMI_QUANTIZATION_RANGE_LIMITED) {
467 /* CEA VICs other than #1 requre limited range RGB 465 /* CEA VICs other than #1 requre limited range RGB
468 * output unless overridden by an AVI infoframe. 466 * output unless overridden by an AVI infoframe.
469 * Apply a colorspace conversion to squash 0-255 down 467 * Apply a colorspace conversion to squash 0-255 down
diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c
index da25dfe7b80e..3109c8308eb5 100644
--- a/drivers/gpu/drm/vgem/vgem_fence.c
+++ b/drivers/gpu/drm/vgem/vgem_fence.c
@@ -190,12 +190,12 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
190 190
191 /* Expose the fence via the dma-buf */ 191 /* Expose the fence via the dma-buf */
192 ret = 0; 192 ret = 0;
193 ww_mutex_lock(&resv->lock, NULL); 193 reservation_object_lock(resv, NULL);
194 if (arg->flags & VGEM_FENCE_WRITE) 194 if (arg->flags & VGEM_FENCE_WRITE)
195 reservation_object_add_excl_fence(resv, fence); 195 reservation_object_add_excl_fence(resv, fence);
196 else if ((ret = reservation_object_reserve_shared(resv)) == 0) 196 else if ((ret = reservation_object_reserve_shared(resv)) == 0)
197 reservation_object_add_shared_fence(resv, fence); 197 reservation_object_add_shared_fence(resv, fence);
198 ww_mutex_unlock(&resv->lock); 198 reservation_object_unlock(resv);
199 199
200 /* Record the fence in our idr for later signaling */ 200 /* Record the fence in our idr for later signaling */
201 if (ret == 0) { 201 if (ret == 0) {
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e5882d5a68e5..21a3a666a2fd 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -790,21 +790,6 @@ extern void drm_sysfs_hotplug_event(struct drm_device *dev);
790 790
791/*@}*/ 791/*@}*/
792 792
793/* PCI section */
794static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
795{
796 if (dev->driver->device_is_agp != NULL) {
797 int err = (*dev->driver->device_is_agp) (dev);
798
799 if (err != 2) {
800 return err;
801 }
802 }
803
804 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
805}
806void drm_pci_agp_destroy(struct drm_device *dev);
807
808extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); 793extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
809extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); 794extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
810#ifdef CONFIG_PCI 795#ifdef CONFIG_PCI
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index f96220ed4004..2e28fdca9c3d 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -123,7 +123,8 @@ struct drm_crtc_commit {
123 /** 123 /**
124 * @commit_entry: 124 * @commit_entry:
125 * 125 *
126 * Entry on the per-CRTC commit_list. Protected by crtc->commit_lock. 126 * Entry on the per-CRTC &drm_crtc.commit_list. Protected by
127 * $drm_crtc.commit_lock.
127 */ 128 */
128 struct list_head commit_entry; 129 struct list_head commit_entry;
129 130
@@ -429,7 +430,8 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
429 * 430 *
430 * For example if the CRTC mode has changed, and the hardware is able to enact 431 * For example if the CRTC mode has changed, and the hardware is able to enact
431 * the requested mode change without going through a full modeset, the driver 432 * the requested mode change without going through a full modeset, the driver
432 * should clear mode_changed during its ->atomic_check. 433 * should clear mode_changed in its &drm_mode_config_funcs.atomic_check
434 * implementation.
433 */ 435 */
434static inline bool 436static inline bool
435drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state) 437drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state)
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 9afcd3810785..d066e9491ae3 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -177,7 +177,8 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
177 * 177 *
178 * This iterates over the current state, useful (for example) when applying 178 * This iterates over the current state, useful (for example) when applying
179 * atomic state after it has been checked and swapped. To iterate over the 179 * atomic state after it has been checked and swapped. To iterate over the
180 * planes which *will* be attached (for ->atomic_check()) see 180 * planes which *will* be attached (more useful in code called from
181 * &drm_mode_config_funcs.atomic_check) see
181 * drm_atomic_crtc_state_for_each_plane(). 182 * drm_atomic_crtc_state_for_each_plane().
182 */ 183 */
183#define drm_atomic_crtc_for_each_plane(plane, crtc) \ 184#define drm_atomic_crtc_for_each_plane(plane, crtc) \
@@ -189,8 +190,9 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
189 * @crtc_state: the incoming crtc-state 190 * @crtc_state: the incoming crtc-state
190 * 191 *
191 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be 192 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
192 * attached if the specified state is applied. Useful during (for example) 193 * attached if the specified state is applied. Useful during for example
193 * ->atomic_check() operations, to validate the incoming state. 194 * in code called from &drm_mode_config_funcs.atomic_check operations, to
195 * validate the incoming state.
194 */ 196 */
195#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \ 197#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
196 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask) 198 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
@@ -202,8 +204,9 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
202 * @crtc_state: the incoming crtc-state 204 * @crtc_state: the incoming crtc-state
203 * 205 *
204 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be 206 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
205 * attached if the specified state is applied. Useful during (for example) 207 * attached if the specified state is applied. Useful during for example
206 * ->atomic_check() operations, to validate the incoming state. 208 * in code called from &drm_mode_config_funcs.atomic_check operations, to
209 * validate the incoming state.
207 * 210 *
208 * Compared to just drm_atomic_crtc_state_for_each_plane() this also fills in a 211 * Compared to just drm_atomic_crtc_state_for_each_plane() this also fills in a
209 * const plane_state. This is useful when a driver just wants to peek at other 212 * const plane_state. This is useful when a driver just wants to peek at other
diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h
index eecbc2f43f55..1eb4a52cad8d 100644
--- a/include/drm/drm_auth.h
+++ b/include/drm/drm_auth.h
@@ -43,18 +43,18 @@ struct drm_master {
43 struct kref refcount; 43 struct kref refcount;
44 struct drm_device *dev; 44 struct drm_device *dev;
45 /** 45 /**
46 * @unique: Unique identifier: e.g. busid. Protected by struct 46 * @unique: Unique identifier: e.g. busid. Protected by
47 * &drm_device master_mutex. 47 * &drm_device.master_mutex.
48 */ 48 */
49 char *unique; 49 char *unique;
50 /** 50 /**
51 * @unique_len: Length of unique field. Protected by &struct drm_device 51 * @unique_len: Length of unique field. Protected by
52 * master_mutex. 52 * &drm_device.master_mutex.
53 */ 53 */
54 int unique_len; 54 int unique_len;
55 /** 55 /**
56 * @magic_map: Map of used authentication tokens. Protected by struct 56 * @magic_map: Map of used authentication tokens. Protected by
57 * &drm_device master_mutex. 57 * &drm_device.master_mutex.
58 */ 58 */
59 struct idr magic_map; 59 struct idr magic_map;
60 struct drm_lock_data lock; 60 struct drm_lock_data lock;
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index c767238ac9d5..d9c2f680f5ae 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -34,7 +34,7 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
34 int gamma_size); 34 int gamma_size);
35 35
36/** 36/**
37 * drm_color_lut_extract - clamp&round LUT entries 37 * drm_color_lut_extract - clamp and round LUT entries
38 * @user_input: input value 38 * @user_input: input value
39 * @bit_precision: number of bits the hw LUT supports 39 * @bit_precision: number of bits the hw LUT supports
40 * 40 *
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index d489cc003b7e..e5e1eddd19fb 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -331,15 +331,15 @@ struct drm_connector_funcs {
331 * 331 *
332 * Entry point for output detection and basic mode validation. The 332 * Entry point for output detection and basic mode validation. The
333 * driver should reprobe the output if needed (e.g. when hotplug 333 * driver should reprobe the output if needed (e.g. when hotplug
334 * handling is unreliable), add all detected modes to connector->modes 334 * handling is unreliable), add all detected modes to &drm_connector.modes
335 * and filter out any the device can't support in any configuration. It 335 * and filter out any the device can't support in any configuration. It
336 * also needs to filter out any modes wider or higher than the 336 * also needs to filter out any modes wider or higher than the
337 * parameters max_width and max_height indicate. 337 * parameters max_width and max_height indicate.
338 * 338 *
339 * The drivers must also prune any modes no longer valid from 339 * The drivers must also prune any modes no longer valid from
340 * connector->modes. Furthermore it must update connector->status and 340 * &drm_connector.modes. Furthermore it must update
341 * connector->edid. If no EDID has been received for this output 341 * &drm_connector.status and &drm_connector.edid. If no EDID has been
342 * connector->edid must be NULL. 342 * received for this output connector->edid must be NULL.
343 * 343 *
344 * Drivers using the probe helpers should use 344 * Drivers using the probe helpers should use
345 * drm_helper_probe_single_connector_modes() or 345 * drm_helper_probe_single_connector_modes() or
@@ -348,7 +348,7 @@ struct drm_connector_funcs {
348 * 348 *
349 * RETURNS: 349 * RETURNS:
350 * 350 *
351 * The number of modes detected and filled into connector->modes. 351 * The number of modes detected and filled into &drm_connector.modes.
352 */ 352 */
353 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); 353 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
354 354
@@ -381,7 +381,7 @@ struct drm_connector_funcs {
381 * core drm connector interfaces. Everything added from this callback 381 * core drm connector interfaces. Everything added from this callback
382 * should be unregistered in the early_unregister callback. 382 * should be unregistered in the early_unregister callback.
383 * 383 *
384 * This is called while holding drm_connector->mutex. 384 * This is called while holding &drm_connector.mutex.
385 * 385 *
386 * Returns: 386 * Returns:
387 * 387 *
@@ -398,7 +398,7 @@ struct drm_connector_funcs {
398 * early in the driver unload sequence to disable userspace access 398 * early in the driver unload sequence to disable userspace access
399 * before data structures are torndown. 399 * before data structures are torndown.
400 * 400 *
401 * This is called while holding drm_connector->mutex. 401 * This is called while holding &drm_connector.mutex.
402 */ 402 */
403 void (*early_unregister)(struct drm_connector *connector); 403 void (*early_unregister)(struct drm_connector *connector);
404 404
@@ -418,9 +418,9 @@ struct drm_connector_funcs {
418 * Duplicate the current atomic state for this connector and return it. 418 * Duplicate the current atomic state for this connector and return it.
419 * The core and helpers guarantee that any atomic state duplicated with 419 * The core and helpers guarantee that any atomic state duplicated with
420 * this hook and still owned by the caller (i.e. not transferred to the 420 * this hook and still owned by the caller (i.e. not transferred to the
421 * driver by calling ->atomic_commit() from struct 421 * driver by calling &drm_mode_config_funcs.atomic_commit) will be
422 * &drm_mode_config_funcs) will be cleaned up by calling the 422 * cleaned up by calling the @atomic_destroy_state hook in this
423 * @atomic_destroy_state hook in this structure. 423 * structure.
424 * 424 *
425 * Atomic drivers which don't subclass &struct drm_connector_state should use 425 * Atomic drivers which don't subclass &struct drm_connector_state should use
426 * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the 426 * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the
@@ -428,7 +428,7 @@ struct drm_connector_funcs {
428 * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is 428 * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is
429 * duplicated in a consistent fashion across drivers. 429 * duplicated in a consistent fashion across drivers.
430 * 430 *
431 * It is an error to call this hook before connector->state has been 431 * It is an error to call this hook before &drm_connector.state has been
432 * initialized correctly. 432 * initialized correctly.
433 * 433 *
434 * NOTE: 434 * NOTE:
@@ -609,8 +609,8 @@ struct drm_connector {
609 609
610 /** 610 /**
611 * @mutex: Lock for general connector state, but currently only protects 611 * @mutex: Lock for general connector state, but currently only protects
612 * @registered. Most of the connector state is still protected by the 612 * @registered. Most of the connector state is still protected by
613 * mutex in &drm_mode_config. 613 * &drm_mode_config.mutex.
614 */ 614 */
615 struct mutex mutex; 615 struct mutex mutex;
616 616
@@ -636,22 +636,22 @@ struct drm_connector {
636 /** 636 /**
637 * @modes: 637 * @modes:
638 * Modes available on this connector (from fill_modes() + user). 638 * Modes available on this connector (from fill_modes() + user).
639 * Protected by dev->mode_config.mutex. 639 * Protected by &drm_mode_config.mutex.
640 */ 640 */
641 struct list_head modes; /* list of modes on this connector */ 641 struct list_head modes;
642 642
643 /** 643 /**
644 * @status: 644 * @status:
645 * One of the drm_connector_status enums (connected, not, or unknown). 645 * One of the drm_connector_status enums (connected, not, or unknown).
646 * Protected by dev->mode_config.mutex. 646 * Protected by &drm_mode_config.mutex.
647 */ 647 */
648 enum drm_connector_status status; 648 enum drm_connector_status status;
649 649
650 /** 650 /**
651 * @probed_modes: 651 * @probed_modes:
652 * These are modes added by probing with DDC or the BIOS, before 652 * These are modes added by probing with DDC or the BIOS, before
653 * filtering is applied. Used by the probe helpers.Protected by 653 * filtering is applied. Used by the probe helpers. Protected by
654 * dev->mode_config.mutex. 654 * &drm_mode_config.mutex.
655 */ 655 */
656 struct list_head probed_modes; 656 struct list_head probed_modes;
657 657
@@ -659,10 +659,10 @@ struct drm_connector {
659 * @display_info: Display information is filled from EDID information 659 * @display_info: Display information is filled from EDID information
660 * when a display is detected. For non hot-pluggable displays such as 660 * when a display is detected. For non hot-pluggable displays such as
661 * flat panels in embedded systems, the driver should initialize the 661 * flat panels in embedded systems, the driver should initialize the
662 * display_info.width_mm and display_info.height_mm fields with the 662 * &drm_display_info.width_mm and &drm_display_info.height_mm fields
663 * physical size of the display. 663 * with the physical size of the display.
664 * 664 *
665 * Protected by dev->mode_config.mutex. 665 * Protected by &drm_mode_config.mutex.
666 */ 666 */
667 struct drm_display_info display_info; 667 struct drm_display_info display_info;
668 const struct drm_connector_funcs *funcs; 668 const struct drm_connector_funcs *funcs;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 06c943d1e04c..8f0b195e4a59 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -81,8 +81,8 @@ struct drm_plane_helper_funcs;
81 * @enable: whether the CRTC should be enabled, gates all other state 81 * @enable: whether the CRTC should be enabled, gates all other state
82 * @active: whether the CRTC is actively displaying (used for DPMS) 82 * @active: whether the CRTC is actively displaying (used for DPMS)
83 * @planes_changed: planes on this crtc are updated 83 * @planes_changed: planes on this crtc are updated
84 * @mode_changed: crtc_state->mode or crtc_state->enable has been changed 84 * @mode_changed: @mode or @enable has been changed
85 * @active_changed: crtc_state->active has been toggled. 85 * @active_changed: @active has been toggled.
86 * @connectors_changed: connectors to this crtc have been updated 86 * @connectors_changed: connectors to this crtc have been updated
87 * @zpos_changed: zpos values of planes on this crtc have been updated 87 * @zpos_changed: zpos values of planes on this crtc have been updated
88 * @color_mgmt_changed: color management properties have changed (degamma or 88 * @color_mgmt_changed: color management properties have changed (degamma or
@@ -102,9 +102,10 @@ struct drm_plane_helper_funcs;
102 * 102 *
103 * Note that the distinction between @enable and @active is rather subtile: 103 * Note that the distinction between @enable and @active is rather subtile:
104 * Flipping @active while @enable is set without changing anything else may 104 * Flipping @active while @enable is set without changing anything else may
105 * never return in a failure from the ->atomic_check callback. Userspace assumes 105 * never return in a failure from the &drm_mode_config_funcs.atomic_check
106 * that a DPMS On will always succeed. In other words: @enable controls resource 106 * callback. Userspace assumes that a DPMS On will always succeed. In other
107 * assignment, @active controls the actual hardware state. 107 * words: @enable controls resource assignment, @active controls the actual
108 * hardware state.
108 * 109 *
109 * The three booleans active_changed, connectors_changed and mode_changed are 110 * The three booleans active_changed, connectors_changed and mode_changed are
110 * intended to indicate whether a full modeset is needed, rather than strictly 111 * intended to indicate whether a full modeset is needed, rather than strictly
@@ -346,8 +347,8 @@ struct drm_crtc_funcs {
346 * through the DRM_MODE_PAGE_FLIP_ASYNC flag). When an application 347 * through the DRM_MODE_PAGE_FLIP_ASYNC flag). When an application
347 * requests a page flip the DRM core verifies that the new frame buffer 348 * requests a page flip the DRM core verifies that the new frame buffer
348 * is large enough to be scanned out by the CRTC in the currently 349 * is large enough to be scanned out by the CRTC in the currently
349 * configured mode and then calls the CRTC ->page_flip() operation with a 350 * configured mode and then calls this hook with a pointer to the new
350 * pointer to the new frame buffer. 351 * frame buffer.
351 * 352 *
352 * The driver must wait for any pending rendering to the new framebuffer 353 * The driver must wait for any pending rendering to the new framebuffer
353 * to complete before executing the flip. It should also wait for any 354 * to complete before executing the flip. It should also wait for any
@@ -382,7 +383,7 @@ struct drm_crtc_funcs {
382 * RETURNS: 383 * RETURNS:
383 * 384 *
384 * 0 on success or a negative error code on failure. Note that if a 385 * 0 on success or a negative error code on failure. Note that if a
385 * ->page_flip() operation is already pending the callback should return 386 * page flip operation is already pending the callback should return
386 * -EBUSY. Pageflips on a disabled CRTC (either by setting a NULL mode 387 * -EBUSY. Pageflips on a disabled CRTC (either by setting a NULL mode
387 * or just runtime disabled through DPMS respectively the new atomic 388 * or just runtime disabled through DPMS respectively the new atomic
388 * "ACTIVE" state) should result in an -EINVAL error code. Note that 389 * "ACTIVE" state) should result in an -EINVAL error code. Note that
@@ -434,19 +435,19 @@ struct drm_crtc_funcs {
434 * @atomic_duplicate_state: 435 * @atomic_duplicate_state:
435 * 436 *
436 * Duplicate the current atomic state for this CRTC and return it. 437 * Duplicate the current atomic state for this CRTC and return it.
437 * The core and helpers gurantee that any atomic state duplicated with 438 * The core and helpers guarantee that any atomic state duplicated with
438 * this hook and still owned by the caller (i.e. not transferred to the 439 * this hook and still owned by the caller (i.e. not transferred to the
439 * driver by calling ->atomic_commit() from struct 440 * driver by calling &drm_mode_config_funcs.atomic_commit) will be
440 * &drm_mode_config_funcs) will be cleaned up by calling the 441 * cleaned up by calling the @atomic_destroy_state hook in this
441 * @atomic_destroy_state hook in this structure. 442 * structure.
442 * 443 *
443 * Atomic drivers which don't subclass &struct drm_crtc should use 444 * Atomic drivers which don't subclass &struct drm_crtc_state should use
444 * drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass the 445 * drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass the
445 * state structure to extend it with driver-private state should use 446 * state structure to extend it with driver-private state should use
446 * __drm_atomic_helper_crtc_duplicate_state() to make sure shared state is 447 * __drm_atomic_helper_crtc_duplicate_state() to make sure shared state is
447 * duplicated in a consistent fashion across drivers. 448 * duplicated in a consistent fashion across drivers.
448 * 449 *
449 * It is an error to call this hook before crtc->state has been 450 * It is an error to call this hook before &drm_crtc.state has been
450 * initialized correctly. 451 * initialized correctly.
451 * 452 *
452 * NOTE: 453 * NOTE:
@@ -559,7 +560,7 @@ struct drm_crtc_funcs {
559 * 560 *
560 * This optional hook should be used to unregister the additional 561 * This optional hook should be used to unregister the additional
561 * userspace interfaces attached to the crtc from 562 * userspace interfaces attached to the crtc from
562 * late_unregister(). It is called from drm_dev_unregister(), 563 * @late_register. It is called from drm_dev_unregister(),
563 * early in the driver unload sequence to disable userspace access 564 * early in the driver unload sequence to disable userspace access
564 * before data structures are torndown. 565 * before data structures are torndown.
565 */ 566 */
@@ -640,8 +641,8 @@ struct drm_crtc {
640 * 641 *
641 * This provides a read lock for the overall crtc state (mode, dpms 642 * This provides a read lock for the overall crtc state (mode, dpms
642 * state, ...) and a write lock for everything which can be update 643 * state, ...) and a write lock for everything which can be update
643 * without a full modeset (fb, cursor data, crtc properties ...). Full 644 * without a full modeset (fb, cursor data, crtc properties ...). A full
644 * modeset also need to grab dev->mode_config.connection_mutex. 645 * modeset also need to grab &drm_mode_config.connection_mutex.
645 */ 646 */
646 struct drm_modeset_lock mutex; 647 struct drm_modeset_lock mutex;
647 648
@@ -773,10 +774,8 @@ struct drm_crtc {
773 * @connectors: array of connectors to drive with this CRTC if possible 774 * @connectors: array of connectors to drive with this CRTC if possible
774 * @num_connectors: size of @connectors array 775 * @num_connectors: size of @connectors array
775 * 776 *
776 * Represents a single crtc the connectors that it drives with what mode 777 * This represents a modeset configuration for the legacy SETCRTC ioctl and is
777 * and from which framebuffer it scans out from. 778 * also used internally. Atomic drivers instead use &drm_atomic_state.
778 *
779 * This is used to set modes.
780 */ 779 */
781struct drm_mode_set { 780struct drm_mode_set {
782 struct drm_framebuffer *fb; 781 struct drm_framebuffer *fb;
@@ -825,15 +824,21 @@ static inline uint32_t drm_crtc_mask(const struct drm_crtc *crtc)
825 return 1 << drm_crtc_index(crtc); 824 return 1 << drm_crtc_index(crtc);
826} 825}
827 826
828void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
829 int *hdisplay, int *vdisplay);
830int drm_crtc_force_disable(struct drm_crtc *crtc); 827int drm_crtc_force_disable(struct drm_crtc *crtc);
831int drm_crtc_force_disable_all(struct drm_device *dev); 828int drm_crtc_force_disable_all(struct drm_device *dev);
832 829
833int drm_mode_set_config_internal(struct drm_mode_set *set); 830int drm_mode_set_config_internal(struct drm_mode_set *set);
834struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx); 831struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);
835 832
836/* Helpers */ 833/**
834 * drm_crtc_find - look up a CRTC object from its ID
835 * @dev: DRM device
836 * @id: &drm_mode_object ID
837 *
838 * This can be used to look up a CRTC from its userspace ID. Only used by
839 * drivers for legacy IOCTLs and interface, nowadays extensions to the KMS
840 * userspace interface should be done using &drm_property.
841 */
837static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, 842static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
838 uint32_t id) 843 uint32_t id)
839{ 844{
@@ -842,6 +847,13 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
842 return mo ? obj_to_crtc(mo) : NULL; 847 return mo ? obj_to_crtc(mo) : NULL;
843} 848}
844 849
850/**
851 * drm_for_each_crtc - iterate over all CRTCs
852 * @crtc: a &struct drm_crtc as the loop cursor
853 * @dev: the &struct drm_device
854 *
855 * Iterate over all CRTCs of @dev.
856 */
845#define drm_for_each_crtc(crtc, dev) \ 857#define drm_for_each_crtc(crtc, dev) \
846 list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head) 858 list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
847 859
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 003207670597..f4b4d154b98e 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -414,7 +414,7 @@ struct drm_dp_mst_topology_mgr {
414 /** 414 /**
415 * @dev: device pointer for adding i2c devices etc. 415 * @dev: device pointer for adding i2c devices etc.
416 */ 416 */
417 struct device *dev; 417 struct drm_device *dev;
418 /** 418 /**
419 * @cbs: callbacks for connector addition and destruction. 419 * @cbs: callbacks for connector addition and destruction.
420 */ 420 */
@@ -493,8 +493,8 @@ struct drm_dp_mst_topology_mgr {
493 int total_pbn; 493 int total_pbn;
494 494
495 /** 495 /**
496 * @qlock: protects @tx_msg_downq, the tx_slots in struct 496 * @qlock: protects @tx_msg_downq, the &drm_dp_mst_branch.txslost and
497 * &drm_dp_mst_branch and txmsg->state once they are queued 497 * &drm_dp_sideband_msg_tx.state once they are queued
498 */ 498 */
499 struct mutex qlock; 499 struct mutex qlock;
500 /** 500 /**
@@ -508,8 +508,7 @@ struct drm_dp_mst_topology_mgr {
508 struct mutex payload_lock; 508 struct mutex payload_lock;
509 /** 509 /**
510 * @proposed_vcpis: Array of pointers for the new VCPI allocation. The 510 * @proposed_vcpis: Array of pointers for the new VCPI allocation. The
511 * VCPI structure itself is embedded into the corresponding 511 * VCPI structure itself is &drm_dp_mst_port.vcpi.
512 * &drm_dp_mst_port structure.
513 */ 512 */
514 struct drm_dp_vcpi **proposed_vcpis; 513 struct drm_dp_vcpi **proposed_vcpis;
515 /** 514 /**
@@ -556,7 +555,10 @@ struct drm_dp_mst_topology_mgr {
556 struct work_struct destroy_connector_work; 555 struct work_struct destroy_connector_work;
557}; 556};
558 557
559int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id); 558int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr,
559 struct drm_device *dev, struct drm_dp_aux *aux,
560 int max_dpcd_transaction_bytes,
561 int max_payloads, int conn_base_id);
560 562
561void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr); 563void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr);
562 564
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 34ece393c639..732e85652d1e 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -81,7 +81,6 @@ struct drm_driver {
81 * Zero on success, non-zero value on failure. 81 * Zero on success, non-zero value on failure.
82 */ 82 */
83 int (*load) (struct drm_device *, unsigned long flags); 83 int (*load) (struct drm_device *, unsigned long flags);
84 int (*firstopen) (struct drm_device *);
85 int (*open) (struct drm_device *, struct drm_file *); 84 int (*open) (struct drm_device *, struct drm_file *);
86 void (*preclose) (struct drm_device *, struct drm_file *file_priv); 85 void (*preclose) (struct drm_device *, struct drm_file *file_priv);
87 void (*postclose) (struct drm_device *, struct drm_file *); 86 void (*postclose) (struct drm_device *, struct drm_file *);
@@ -103,9 +102,6 @@ struct drm_driver {
103 * 102 *
104 */ 103 */
105 void (*unload) (struct drm_device *); 104 void (*unload) (struct drm_device *);
106 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
107 int (*dma_quiescent) (struct drm_device *);
108 int (*context_dtor) (struct drm_device *dev, int context);
109 int (*set_busid)(struct drm_device *dev, struct drm_master *master); 105 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
110 106
111 /** 107 /**
@@ -151,20 +147,6 @@ struct drm_driver {
151 void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); 147 void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
152 148
153 /** 149 /**
154 * @device_is_agp:
155 *
156 * Called by drm_device_is_agp(). Typically used to determine if a card
157 * is really attached to AGP or not.
158 *
159 * Returns:
160 *
161 * One of three values is returned depending on whether or not the
162 * card is absolutely not AGP (return of 0), absolutely is AGP
163 * (return of 1), or may or may not be AGP (return of 2).
164 */
165 int (*device_is_agp) (struct drm_device *dev);
166
167 /**
168 * @get_scanout_position: 150 * @get_scanout_position:
169 * 151 *
170 * Called by vblank timestamping code. 152 * Called by vblank timestamping code.
@@ -314,7 +296,7 @@ struct drm_driver {
314 /** 296 /**
315 * @gem_free_object_unlocked: deconstructor for drm_gem_objects 297 * @gem_free_object_unlocked: deconstructor for drm_gem_objects
316 * 298 *
317 * This is for drivers which are not encumbered with dev->struct_mutex 299 * This is for drivers which are not encumbered with &drm_device.struct_mutex
318 * legacy locking schemes. Use this hook instead of @gem_free_object. 300 * legacy locking schemes. Use this hook instead of @gem_free_object.
319 */ 301 */
320 void (*gem_free_object_unlocked) (struct drm_gem_object *obj); 302 void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
@@ -359,9 +341,6 @@ struct drm_driver {
359 int (*gem_prime_mmap)(struct drm_gem_object *obj, 341 int (*gem_prime_mmap)(struct drm_gem_object *obj,
360 struct vm_area_struct *vma); 342 struct vm_area_struct *vma);
361 343
362 /* vga arb irq handler */
363 void (*vgaarb_irq)(struct drm_device *dev, bool state);
364
365 /** 344 /**
366 * @dumb_create: 345 * @dumb_create:
367 * 346 *
@@ -430,13 +409,20 @@ struct drm_driver {
430 char *date; 409 char *date;
431 410
432 u32 driver_features; 411 u32 driver_features;
433 int dev_priv_size;
434 const struct drm_ioctl_desc *ioctls; 412 const struct drm_ioctl_desc *ioctls;
435 int num_ioctls; 413 int num_ioctls;
436 const struct file_operations *fops; 414 const struct file_operations *fops;
437 415
416 /* Everything below here is for legacy driver, never use! */
417 /* private: */
418
438 /* List of devices hanging off this driver with stealth attach. */ 419 /* List of devices hanging off this driver with stealth attach. */
439 struct list_head legacy_dev_list; 420 struct list_head legacy_dev_list;
421 int (*firstopen) (struct drm_device *);
422 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
423 int (*dma_quiescent) (struct drm_device *);
424 int (*context_dtor) (struct drm_device *dev, int context);
425 int dev_priv_size;
440}; 426};
441 427
442extern __printf(6, 7) 428extern __printf(6, 7)
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 38eabf65f19d..43fb0ac5eb9c 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -24,6 +24,7 @@
24#define __DRM_EDID_H__ 24#define __DRM_EDID_H__
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/hdmi.h>
27 28
28struct drm_device; 29struct drm_device;
29struct i2c_adapter; 30struct i2c_adapter;
@@ -322,8 +323,6 @@ struct cea_sad {
322struct drm_encoder; 323struct drm_encoder;
323struct drm_connector; 324struct drm_connector;
324struct drm_display_mode; 325struct drm_display_mode;
325struct hdmi_avi_infoframe;
326struct hdmi_vendor_infoframe;
327 326
328void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); 327void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
329int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads); 328int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
@@ -346,6 +345,11 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
346int 345int
347drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 346drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
348 const struct drm_display_mode *mode); 347 const struct drm_display_mode *mode);
348void
349drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
350 const struct drm_display_mode *mode,
351 enum hdmi_quantization_range rgb_quant_range,
352 bool rgb_quant_range_selectable);
349 353
350/** 354/**
351 * drm_eld_mnl - Get ELD monitor name length in bytes. 355 * drm_eld_mnl - Get ELD monitor name length in bytes.
@@ -442,6 +446,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
442bool drm_detect_hdmi_monitor(struct edid *edid); 446bool drm_detect_hdmi_monitor(struct edid *edid);
443bool drm_detect_monitor_audio(struct edid *edid); 447bool drm_detect_monitor_audio(struct edid *edid);
444bool drm_rgb_quant_range_selectable(struct edid *edid); 448bool drm_rgb_quant_range_selectable(struct edid *edid);
449enum hdmi_quantization_range
450drm_default_rgb_quant_range(const struct drm_display_mode *mode);
445int drm_add_modes_noedid(struct drm_connector *connector, 451int drm_add_modes_noedid(struct drm_connector *connector,
446 int hdisplay, int vdisplay); 452 int hdisplay, int vdisplay);
447void drm_set_preferred_mode(struct drm_connector *connector, 453void drm_set_preferred_mode(struct drm_connector *connector,
diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
index 5f58f65344e0..8d8245ec0181 100644
--- a/include/drm/drm_encoder.h
+++ b/include/drm/drm_encoder.h
@@ -75,7 +75,7 @@ struct drm_encoder_funcs {
75 * 75 *
76 * This optional hook should be used to unregister the additional 76 * This optional hook should be used to unregister the additional
77 * userspace interfaces attached to the encoder from 77 * userspace interfaces attached to the encoder from
78 * late_unregister(). It is called from drm_dev_unregister(), 78 * @late_register. It is called from drm_dev_unregister(),
79 * early in the driver unload sequence to disable userspace access 79 * early in the driver unload sequence to disable userspace access
80 * before data structures are torndown. 80 * before data structures are torndown.
81 */ 81 */
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 9f4e34ea99fd..8dd6e5585e51 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -26,6 +26,8 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
26void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma); 26void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
27void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma); 27void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
28void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state); 28void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
29void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
30 int state);
29 31
30void drm_fb_cma_destroy(struct drm_framebuffer *fb); 32void drm_fb_cma_destroy(struct drm_framebuffer *fb);
31int drm_fb_cma_create_handle(struct drm_framebuffer *fb, 33int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h
index d387cf06ae05..21c3d512d25c 100644
--- a/include/drm/drm_flip_work.h
+++ b/include/drm/drm_flip_work.h
@@ -54,7 +54,7 @@ typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val);
54/** 54/**
55 * struct drm_flip_task - flip work task 55 * struct drm_flip_task - flip work task
56 * @node: list entry element 56 * @node: list entry element
57 * @data: data to pass to work->func 57 * @data: data to pass to &drm_flip_work.func
58 */ 58 */
59struct drm_flip_task { 59struct drm_flip_task {
60 struct list_head node; 60 struct list_head node;
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index 046c35e54099..04c77eee9c20 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -40,8 +40,8 @@ struct drm_framebuffer_funcs {
40 * 40 *
41 * Clean up framebuffer resources, specifically also unreference the 41 * Clean up framebuffer resources, specifically also unreference the
42 * backing storage. The core guarantees to call this function for every 42 * backing storage. The core guarantees to call this function for every
43 * framebuffer successfully created by ->fb_create() in 43 * framebuffer successfully created by calling
44 * &drm_mode_config_funcs. Drivers must also call 44 * &drm_mode_config_funcs.fb_create. Drivers must also call
45 * drm_framebuffer_cleanup() to release DRM core resources for this 45 * drm_framebuffer_cleanup() to release DRM core resources for this
46 * framebuffer. 46 * framebuffer.
47 */ 47 */
@@ -112,8 +112,8 @@ struct drm_framebuffer {
112 */ 112 */
113 struct drm_device *dev; 113 struct drm_device *dev;
114 /** 114 /**
115 * @head: Place on the dev->mode_config.fb_list, access protected by 115 * @head: Place on the &drm_mode_config.fb_list, access protected by
116 * dev->mode_config.fb_lock. 116 * &drm_mode_config.fb_lock.
117 */ 117 */
118 struct list_head head; 118 struct list_head head;
119 119
@@ -187,8 +187,7 @@ struct drm_framebuffer {
187 */ 187 */
188 int hot_y; 188 int hot_y;
189 /** 189 /**
190 * @filp_head: Placed on &struct drm_file fbs list_head, protected by 190 * @filp_head: Placed on &drm_file.fbs, protected by &drm_file.fbs_lock.
191 * fbs_lock in the same structure.
192 */ 191 */
193 struct list_head filp_head; 192 struct list_head filp_head;
194}; 193};
@@ -260,8 +259,8 @@ static inline void drm_framebuffer_assign(struct drm_framebuffer **p,
260 * @fb: the loop cursor 259 * @fb: the loop cursor
261 * @dev: the DRM device 260 * @dev: the DRM device
262 * 261 *
263 * Iterate over all framebuffers of @dev. User must hold the fb_lock from 262 * Iterate over all framebuffers of @dev. User must hold
264 * &drm_mode_config. 263 * &drm_mode_config.fb_lock.
265 */ 264 */
266#define drm_for_each_fb(fb, dev) \ 265#define drm_for_each_fb(fb, dev) \
267 for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), \ 266 for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), \
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 9f63736e6163..449a41b56ffc 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -63,7 +63,7 @@ struct drm_gem_object {
63 * drops to 0 any global names (e.g. the id in the flink namespace) will 63 * drops to 0 any global names (e.g. the id in the flink namespace) will
64 * be cleared. 64 * be cleared.
65 * 65 *
66 * Protected by dev->object_name_lock. 66 * Protected by &drm_device.object_name_lock.
67 */ 67 */
68 unsigned handle_count; 68 unsigned handle_count;
69 69
@@ -106,8 +106,8 @@ struct drm_gem_object {
106 * @name: 106 * @name:
107 * 107 *
108 * Global name for this object, starts at 1. 0 means unnamed. 108 * Global name for this object, starts at 1. 0 means unnamed.
109 * Access is covered by dev->object_name_lock. This is used by the GEM_FLINK 109 * Access is covered by &drm_device.object_name_lock. This is used by
110 * and GEM_OPEN ioctls. 110 * the GEM_FLINK and GEM_OPEN ioctls.
111 */ 111 */
112 int name; 112 int name;
113 113
@@ -150,7 +150,7 @@ struct drm_gem_object {
150 * through importing or exporting). We break the resulting reference 150 * through importing or exporting). We break the resulting reference
151 * loop when the last gem handle for this object is released. 151 * loop when the last gem handle for this object is released.
152 * 152 *
153 * Protected by obj->object_name_lock. 153 * Protected by &drm_device.object_name_lock.
154 */ 154 */
155 struct dma_buf *dma_buf; 155 struct dma_buf *dma_buf;
156 156
@@ -163,7 +163,7 @@ struct drm_gem_object {
163 * attachment point for the device. This is invariant over the lifetime 163 * attachment point for the device. This is invariant over the lifetime
164 * of a gem object. 164 * of a gem object.
165 * 165 *
166 * The driver's ->gem_free_object callback is responsible for cleaning 166 * The &drm_driver.gem_free_object callback is responsible for cleaning
167 * up the dma_buf attachment and references acquired at import time. 167 * up the dma_buf attachment and references acquired at import time.
168 * 168 *
169 * Note that the drm gem/prime core does not depend upon drivers setting 169 * Note that the drm gem/prime core does not depend upon drivers setting
@@ -204,7 +204,7 @@ drm_gem_object_reference(struct drm_gem_object *obj)
204 * @obj: GEM buffer object 204 * @obj: GEM buffer object
205 * 205 *
206 * This function is meant to be used by drivers which are not encumbered with 206 * This function is meant to be used by drivers which are not encumbered with
207 * dev->struct_mutex legacy locking and which are using the 207 * &drm_device.struct_mutex legacy locking and which are using the
208 * gem_free_object_unlocked callback. It avoids all the locking checks and 208 * gem_free_object_unlocked callback. It avoids all the locking checks and
209 * locking overhead of drm_gem_object_unreference() and 209 * locking overhead of drm_gem_object_unreference() and
210 * drm_gem_object_unreference_unlocked(). 210 * drm_gem_object_unreference_unlocked().
@@ -212,8 +212,8 @@ drm_gem_object_reference(struct drm_gem_object *obj)
212 * Drivers should never call this directly in their code. Instead they should 212 * Drivers should never call this directly in their code. Instead they should
213 * wrap it up into a ``driver_gem_object_unreference(struct driver_gem_object 213 * wrap it up into a ``driver_gem_object_unreference(struct driver_gem_object
214 * *obj)`` wrapper function, and use that. Shared code should never call this, to 214 * *obj)`` wrapper function, and use that. Shared code should never call this, to
215 * avoid breaking drivers by accident which still depend upon dev->struct_mutex 215 * avoid breaking drivers by accident which still depend upon
216 * locking. 216 * &drm_device.struct_mutex locking.
217 */ 217 */
218static inline void 218static inline void
219__drm_gem_object_unreference(struct drm_gem_object *obj) 219__drm_gem_object_unreference(struct drm_gem_object *obj)
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
index 18cfd11307e1..2fb880462a57 100644
--- a/include/drm/drm_irq.h
+++ b/include/drm/drm_irq.h
@@ -67,7 +67,7 @@ struct drm_vblank_crtc {
67 * @disable_timer: Disable timer for the delayed vblank disabling 67 * @disable_timer: Disable timer for the delayed vblank disabling
68 * hysteresis logic. Vblank disabling is controlled through the 68 * hysteresis logic. Vblank disabling is controlled through the
69 * drm_vblank_offdelay module option and the setting of the 69 * drm_vblank_offdelay module option and the setting of the
70 * max_vblank_count value in the &drm_device structure. 70 * &drm_device.max_vblank_count value.
71 */ 71 */
72 struct timer_list disable_timer; 72 struct timer_list disable_timer;
73 73
@@ -92,7 +92,7 @@ struct drm_vblank_crtc {
92 */ 92 */
93 atomic_t refcount; /* number of users of vblank interruptsper crtc */ 93 atomic_t refcount; /* number of users of vblank interruptsper crtc */
94 /** 94 /**
95 * @last: Protected by dev->vbl_lock, used for wraparound handling. 95 * @last: Protected by &drm_device.vbl_lock, used for wraparound handling.
96 */ 96 */
97 u32 last; 97 u32 last;
98 /** 98 /**
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 17942c0f32a8..5a29978062d3 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -132,8 +132,8 @@ struct drm_mode_config_funcs {
132 * that before calling this hook. 132 * that before calling this hook.
133 * 133 *
134 * See the documentation of @atomic_commit for an exhaustive list of 134 * See the documentation of @atomic_commit for an exhaustive list of
135 * error conditions which don't have to be checked at the 135 * error conditions which don't have to be checked at the in this
136 * ->atomic_check() stage? 136 * callback.
137 * 137 *
138 * See the documentation for &struct drm_atomic_state for how exactly 138 * See the documentation for &struct drm_atomic_state for how exactly
139 * an atomic modeset update is described. 139 * an atomic modeset update is described.
@@ -198,10 +198,10 @@ struct drm_mode_config_funcs {
198 * completed. These events are per-CRTC and can be distinguished by the 198 * completed. These events are per-CRTC and can be distinguished by the
199 * CRTC index supplied in &drm_event to userspace. 199 * CRTC index supplied in &drm_event to userspace.
200 * 200 *
201 * The drm core will supply a &struct drm_event in the event 201 * The drm core will supply a &struct drm_event in each CRTC's
202 * member of each CRTC's &drm_crtc_state structure. See the 202 * &drm_crtc_state.event. See the documentation for
203 * documentation for &drm_crtc_state for more details about the precise 203 * &drm_crtc_state.event for more details about the precise semantics of
204 * semantics of this event. 204 * this event.
205 * 205 *
206 * NOTE: 206 * NOTE:
207 * 207 *
diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h
index 43460b21d112..2c017adf6d74 100644
--- a/include/drm/drm_mode_object.h
+++ b/include/drm/drm_mode_object.h
@@ -86,10 +86,15 @@ struct drm_object_properties {
86 * 86 *
87 * Note that atomic drivers do not store mutable properties in this 87 * Note that atomic drivers do not store mutable properties in this
88 * array, but only the decoded values in the corresponding state 88 * array, but only the decoded values in the corresponding state
89 * structure. The decoding is done using the ->atomic_get_property and 89 * structure. The decoding is done using the &drm_crtc.atomic_get_property and
90 * ->atomic_set_property hooks of the corresponding object. Hence atomic 90 * &drm_crtc.atomic_set_property hooks for &struct drm_crtc. For
91 * drivers should not use drm_object_property_set_value() and 91 * &struct drm_plane the hooks are &drm_plane_funcs.atomic_get_property and
92 * drm_object_property_get_value() on mutable objects, i.e. those 92 * &drm_plane_funcs.atomic_set_property. And for &struct drm_connector
93 * the hooks are &drm_connector_funcs.atomic_get_property and
94 * &drm_connector_funcs.atomic_set_property .
95 *
96 * Hence atomic drivers should not use drm_object_property_set_value()
97 * and drm_object_property_get_value() on mutable objects, i.e. those
93 * without the DRM_MODE_PROP_IMMUTABLE flag set. 98 * without the DRM_MODE_PROP_IMMUTABLE flag set.
94 */ 99 */
95 uint64_t values[DRM_OBJECT_MAX_PROPERTY]; 100 uint64_t values[DRM_OBJECT_MAX_PROPERTY];
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index 9934d91619c1..6dd34280e892 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -459,6 +459,8 @@ int of_get_drm_display_mode(struct device_node *np,
459void drm_mode_set_name(struct drm_display_mode *mode); 459void drm_mode_set_name(struct drm_display_mode *mode);
460int drm_mode_hsync(const struct drm_display_mode *mode); 460int drm_mode_hsync(const struct drm_display_mode *mode);
461int drm_mode_vrefresh(const struct drm_display_mode *mode); 461int drm_mode_vrefresh(const struct drm_display_mode *mode);
462void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
463 int *hdisplay, int *vdisplay);
462 464
463void drm_mode_set_crtcinfo(struct drm_display_mode *p, 465void drm_mode_set_crtcinfo(struct drm_display_mode *p,
464 int adjust_flags); 466 int adjust_flags);
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 46f5b349f059..091c42205667 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -111,9 +111,9 @@ struct drm_crtc_helper_funcs {
111 * This callback is used to validate a mode. The parameter mode is the 111 * This callback is used to validate a mode. The parameter mode is the
112 * display mode that userspace requested, adjusted_mode is the mode the 112 * display mode that userspace requested, adjusted_mode is the mode the
113 * encoders need to be fed with. Note that this is the inverse semantics 113 * encoders need to be fed with. Note that this is the inverse semantics
114 * of the meaning for the &drm_encoder and &drm_bridge 114 * of the meaning for the &drm_encoder and &drm_bridge_funcs.mode_fixup
115 * ->mode_fixup() functions. If the CRTC cannot support the requested 115 * vfunc. If the CRTC cannot support the requested conversion from mode
116 * conversion from mode to adjusted_mode it should reject the modeset. 116 * to adjusted_mode it should reject the modeset.
117 * 117 *
118 * This function is used by both legacy CRTC helpers and atomic helpers. 118 * This function is used by both legacy CRTC helpers and atomic helpers.
119 * With atomic helpers it is optional. 119 * With atomic helpers it is optional.
@@ -134,17 +134,18 @@ struct drm_crtc_helper_funcs {
134 * 134 *
135 * Also beware that neither core nor helpers filter modes before 135 * Also beware that neither core nor helpers filter modes before
136 * passing them to the driver: While the list of modes that is 136 * passing them to the driver: While the list of modes that is
137 * advertised to userspace is filtered using the connector's 137 * advertised to userspace is filtered using the
138 * ->mode_valid() callback, neither the core nor the helpers do any 138 * &drm_connector.mode_valid callback, neither the core nor the helpers
139 * filtering on modes passed in from userspace when setting a mode. It 139 * do any filtering on modes passed in from userspace when setting a
140 * is therefore possible for userspace to pass in a mode that was 140 * mode. It is therefore possible for userspace to pass in a mode that
141 * previously filtered out using ->mode_valid() or add a custom mode 141 * was previously filtered out using &drm_connector.mode_valid or add a
142 * that wasn't probed from EDID or similar to begin with. Even though 142 * custom mode that wasn't probed from EDID or similar to begin with.
143 * this is an advanced feature and rarely used nowadays, some users rely 143 * Even though this is an advanced feature and rarely used nowadays,
144 * on being able to specify modes manually so drivers must be prepared 144 * some users rely on being able to specify modes manually so drivers
145 * to deal with it. Specifically this means that all drivers need not 145 * must be prepared to deal with it. Specifically this means that all
146 * only validate modes in ->mode_valid() but also in ->mode_fixup() to 146 * drivers need not only validate modes in &drm_connector.mode_valid but
147 * make sure invalid modes passed in from userspace are rejected. 147 * also in this or in the &drm_encoder_helper_funcs.mode_fixup callback
148 * to make sure invalid modes passed in from userspace are rejected.
148 * 149 *
149 * RETURNS: 150 * RETURNS:
150 * 151 *
@@ -205,7 +206,7 @@ struct drm_crtc_helper_funcs {
205 * optimized fast-path instead of a full mode set operation with all the 206 * optimized fast-path instead of a full mode set operation with all the
206 * resulting flickering. If it is not present 207 * resulting flickering. If it is not present
207 * drm_crtc_helper_set_config() will fall back to a full modeset, using 208 * drm_crtc_helper_set_config() will fall back to a full modeset, using
208 * the ->mode_set() callback. Since it can't update other planes it's 209 * the @mode_set callback. Since it can't update other planes it's
209 * incompatible with atomic modeset support. 210 * incompatible with atomic modeset support.
210 * 211 *
211 * This callback is only used by the CRTC helpers and deprecated. 212 * This callback is only used by the CRTC helpers and deprecated.
@@ -238,8 +239,7 @@ struct drm_crtc_helper_funcs {
238 /** 239 /**
239 * @load_lut: 240 * @load_lut:
240 * 241 *
241 * Load a LUT prepared with the @gamma_set functions from 242 * Load a LUT prepared with the &drm_fb_helper_funcs.gamma_set vfunc.
242 * &drm_fb_helper_funcs.
243 * 243 *
244 * This callback is optional and is only used by the fbdev emulation 244 * This callback is optional and is only used by the fbdev emulation
245 * helpers. 245 * helpers.
@@ -257,10 +257,11 @@ struct drm_crtc_helper_funcs {
257 * 257 *
258 * This callback should be used to disable the CRTC. With the atomic 258 * This callback should be used to disable the CRTC. With the atomic
259 * drivers it is called after all encoders connected to this CRTC have 259 * drivers it is called after all encoders connected to this CRTC have
260 * been shut off already using their own ->disable hook. If that 260 * been shut off already using their own
261 * sequence is too simple drivers can just add their own hooks and call 261 * &drm_encoder_helper_funcs.disable hook. If that sequence is too
262 * it from this CRTC callback here by looping over all encoders 262 * simple drivers can just add their own hooks and call it from this
263 * connected to it using for_each_encoder_on_crtc(). 263 * CRTC callback here by looping over all encoders connected to it using
264 * for_each_encoder_on_crtc().
264 * 265 *
265 * This hook is used both by legacy CRTC helpers and atomic helpers. 266 * This hook is used both by legacy CRTC helpers and atomic helpers.
266 * Atomic drivers don't need to implement it if there's no need to 267 * Atomic drivers don't need to implement it if there's no need to
@@ -289,10 +290,10 @@ struct drm_crtc_helper_funcs {
289 * 290 *
290 * This callback should be used to enable the CRTC. With the atomic 291 * This callback should be used to enable the CRTC. With the atomic
291 * drivers it is called before all encoders connected to this CRTC are 292 * drivers it is called before all encoders connected to this CRTC are
292 * enabled through the encoder's own ->enable hook. If that sequence is 293 * enabled through the encoder's own &drm_encoder_helper_funcs.enable
293 * too simple drivers can just add their own hooks and call it from this 294 * hook. If that sequence is too simple drivers can just add their own
294 * CRTC callback here by looping over all encoders connected to it using 295 * hooks and call it from this CRTC callback here by looping over all
295 * for_each_encoder_on_crtc(). 296 * encoders connected to it using for_each_encoder_on_crtc().
296 * 297 *
297 * This hook is used only by atomic helpers, for symmetry with @disable. 298 * This hook is used only by atomic helpers, for symmetry with @disable.
298 * Atomic drivers don't need to implement it if there's no need to 299 * Atomic drivers don't need to implement it if there's no need to
@@ -316,16 +317,16 @@ struct drm_crtc_helper_funcs {
316 * beforehand. This is calling order used by the default helper 317 * beforehand. This is calling order used by the default helper
317 * implementation in drm_atomic_helper_check(). 318 * implementation in drm_atomic_helper_check().
318 * 319 *
319 * When using drm_atomic_helper_check_planes() CRTCs' ->atomic_check() 320 * When using drm_atomic_helper_check_planes() this hook is called
320 * hooks are called after the ones for planes, which allows drivers to 321 * after the &drm_plane_helper_funcs.atomc_check hook for planes, which
321 * assign shared resources requested by planes in the CRTC callback 322 * allows drivers to assign shared resources requested by planes in this
322 * here. For more complicated dependencies the driver can call the provided 323 * callback here. For more complicated dependencies the driver can call
323 * check helpers multiple times until the computed state has a final 324 * the provided check helpers multiple times until the computed state
324 * configuration and everything has been checked. 325 * has a final configuration and everything has been checked.
325 * 326 *
326 * This function is also allowed to inspect any other object's state and 327 * This function is also allowed to inspect any other object's state and
327 * can add more state objects to the atomic commit if needed. Care must 328 * can add more state objects to the atomic commit if needed. Care must
328 * be taken though to ensure that state check&compute functions for 329 * be taken though to ensure that state check and compute functions for
329 * these added states are all called, and derived state in other objects 330 * these added states are all called, and derived state in other objects
330 * all updated. Again the recommendation is to just call check helpers 331 * all updated. Again the recommendation is to just call check helpers
331 * until a maximal configuration is reached. 332 * until a maximal configuration is reached.
@@ -400,10 +401,11 @@ struct drm_crtc_helper_funcs {
400 * 401 *
401 * This callback should be used to disable the CRTC. With the atomic 402 * This callback should be used to disable the CRTC. With the atomic
402 * drivers it is called after all encoders connected to this CRTC have 403 * drivers it is called after all encoders connected to this CRTC have
403 * been shut off already using their own ->disable hook. If that 404 * been shut off already using their own
404 * sequence is too simple drivers can just add their own hooks and call 405 * &drm_encoder_helper_funcs.disable hook. If that sequence is too
405 * it from this CRTC callback here by looping over all encoders 406 * simple drivers can just add their own hooks and call it from this
406 * connected to it using for_each_encoder_on_crtc(). 407 * CRTC callback here by looping over all encoders connected to it using
408 * for_each_encoder_on_crtc().
407 * 409 *
408 * This hook is used only by atomic helpers. Atomic drivers don't 410 * This hook is used only by atomic helpers. Atomic drivers don't
409 * need to implement it if there's no need to disable anything at the 411 * need to implement it if there's no need to disable anything at the
@@ -483,16 +485,18 @@ struct drm_encoder_helper_funcs {
483 * Also beware that neither core nor helpers filter modes before 485 * Also beware that neither core nor helpers filter modes before
484 * passing them to the driver: While the list of modes that is 486 * passing them to the driver: While the list of modes that is
485 * advertised to userspace is filtered using the connector's 487 * advertised to userspace is filtered using the connector's
486 * ->mode_valid() callback, neither the core nor the helpers do any 488 * &drm_connector_helper_funcs.mode_valid callback, neither the core nor
487 * filtering on modes passed in from userspace when setting a mode. It 489 * the helpers do any filtering on modes passed in from userspace when
488 * is therefore possible for userspace to pass in a mode that was 490 * setting a mode. It is therefore possible for userspace to pass in a
489 * previously filtered out using ->mode_valid() or add a custom mode 491 * mode that was previously filtered out using
490 * that wasn't probed from EDID or similar to begin with. Even though 492 * &drm_connector_helper_funcs.mode_valid or add a custom mode that
491 * this is an advanced feature and rarely used nowadays, some users rely 493 * wasn't probed from EDID or similar to begin with. Even though this
492 * on being able to specify modes manually so drivers must be prepared 494 * is an advanced feature and rarely used nowadays, some users rely on
493 * to deal with it. Specifically this means that all drivers need not 495 * being able to specify modes manually so drivers must be prepared to
494 * only validate modes in ->mode_valid() but also in ->mode_fixup() to 496 * deal with it. Specifically this means that all drivers need not only
495 * make sure invalid modes passed in from userspace are rejected. 497 * validate modes in &drm_connector.mode_valid but also in this or in
498 * the &drm_crtc_helper_funcs.mode_fixup callback to make sure
499 * invalid modes passed in from userspace are rejected.
496 * 500 *
497 * RETURNS: 501 * RETURNS:
498 * 502 *
@@ -544,7 +548,7 @@ struct drm_encoder_helper_funcs {
544 * use this hook, because the helper library calls it only once and not 548 * use this hook, because the helper library calls it only once and not
545 * every time the display pipeline is suspend using either DPMS or the 549 * every time the display pipeline is suspend using either DPMS or the
546 * new "ACTIVE" property. Such drivers should instead move all their 550 * new "ACTIVE" property. Such drivers should instead move all their
547 * encoder setup into the ->enable() callback. 551 * encoder setup into the @enable callback.
548 * 552 *
549 * This callback is used both by the legacy CRTC helpers and the atomic 553 * This callback is used both by the legacy CRTC helpers and the atomic
550 * modeset helpers. It is optional in the atomic helpers. 554 * modeset helpers. It is optional in the atomic helpers.
@@ -570,7 +574,7 @@ struct drm_encoder_helper_funcs {
570 * use this hook, because the helper library calls it only once and not 574 * use this hook, because the helper library calls it only once and not
571 * every time the display pipeline is suspended using either DPMS or the 575 * every time the display pipeline is suspended using either DPMS or the
572 * new "ACTIVE" property. Such drivers should instead move all their 576 * new "ACTIVE" property. Such drivers should instead move all their
573 * encoder setup into the ->enable() callback. 577 * encoder setup into the @enable callback.
574 * 578 *
575 * This callback is used by the atomic modeset helpers in place of the 579 * This callback is used by the atomic modeset helpers in place of the
576 * @mode_set callback, if set by the driver. It is optional and should 580 * @mode_set callback, if set by the driver. It is optional and should
@@ -621,10 +625,10 @@ struct drm_encoder_helper_funcs {
621 * 625 *
622 * This callback should be used to disable the encoder. With the atomic 626 * This callback should be used to disable the encoder. With the atomic
623 * drivers it is called before this encoder's CRTC has been shut off 627 * drivers it is called before this encoder's CRTC has been shut off
624 * using the CRTC's own ->disable hook. If that sequence is too simple 628 * using their own &drm_crtc_helper_funcs.disable hook. If that
625 * drivers can just add their own driver private encoder hooks and call 629 * sequence is too simple drivers can just add their own driver private
626 * them from CRTC's callback by looping over all encoders connected to 630 * encoder hooks and call them from CRTC's callback by looping over all
627 * it using for_each_encoder_on_crtc(). 631 * encoders connected to it using for_each_encoder_on_crtc().
628 * 632 *
629 * This hook is used both by legacy CRTC helpers and atomic helpers. 633 * This hook is used both by legacy CRTC helpers and atomic helpers.
630 * Atomic drivers don't need to implement it if there's no need to 634 * Atomic drivers don't need to implement it if there's no need to
@@ -651,10 +655,10 @@ struct drm_encoder_helper_funcs {
651 * 655 *
652 * This callback should be used to enable the encoder. With the atomic 656 * This callback should be used to enable the encoder. With the atomic
653 * drivers it is called after this encoder's CRTC has been enabled using 657 * drivers it is called after this encoder's CRTC has been enabled using
654 * the CRTC's own ->enable hook. If that sequence is too simple drivers 658 * their own &drm_crtc_helper_funcs.enable hook. If that sequence is
655 * can just add their own driver private encoder hooks and call them 659 * too simple drivers can just add their own driver private encoder
656 * from CRTC's callback by looping over all encoders connected to it 660 * hooks and call them from CRTC's callback by looping over all encoders
657 * using for_each_encoder_on_crtc(). 661 * connected to it using for_each_encoder_on_crtc().
658 * 662 *
659 * This hook is used only by atomic helpers, for symmetry with @disable. 663 * This hook is used only by atomic helpers, for symmetry with @disable.
660 * Atomic drivers don't need to implement it if there's no need to 664 * Atomic drivers don't need to implement it if there's no need to
@@ -716,7 +720,7 @@ struct drm_connector_helper_funcs {
716 * @get_modes: 720 * @get_modes:
717 * 721 *
718 * This function should fill in all modes currently valid for the sink 722 * This function should fill in all modes currently valid for the sink
719 * into the connector->probed_modes list. It should also update the 723 * into the &drm_connector.probed_modes list. It should also update the
720 * EDID property by calling drm_mode_connector_update_edid_property(). 724 * EDID property by calling drm_mode_connector_update_edid_property().
721 * 725 *
722 * The usual way to implement this is to cache the EDID retrieved in the 726 * The usual way to implement this is to cache the EDID retrieved in the
@@ -725,8 +729,9 @@ struct drm_connector_helper_funcs {
725 * them by calling drm_add_edid_modes(). But connectors that driver a 729 * them by calling drm_add_edid_modes(). But connectors that driver a
726 * fixed panel can also manually add specific modes using 730 * fixed panel can also manually add specific modes using
727 * drm_mode_probed_add(). Drivers which manually add modes should also 731 * drm_mode_probed_add(). Drivers which manually add modes should also
728 * make sure that the @display_info, @width_mm and @height_mm fields of the 732 * make sure that the &drm_connector.display_info,
729 * &struct drm_connector are filled in. 733 * &drm_connector.width_mm and &drm_connector.height_mm fields are
734 * filled in.
730 * 735 *
731 * Virtual drivers that just want some standard VESA mode with a given 736 * Virtual drivers that just want some standard VESA mode with a given
732 * resolution can call drm_add_modes_noedid(), and mark the preferred 737 * resolution can call drm_add_modes_noedid(), and mark the preferred
@@ -735,7 +740,7 @@ struct drm_connector_helper_funcs {
735 * Finally drivers that support audio probably want to update the ELD 740 * Finally drivers that support audio probably want to update the ELD
736 * data, too, using drm_edid_to_eld(). 741 * data, too, using drm_edid_to_eld().
737 * 742 *
738 * This function is only called after the ->detect() hook has indicated 743 * This function is only called after the @detect hook has indicated
739 * that a sink is connected and when the EDID isn't overridden through 744 * that a sink is connected and when the EDID isn't overridden through
740 * sysfs or the kernel commandline. 745 * sysfs or the kernel commandline.
741 * 746 *
@@ -768,8 +773,8 @@ struct drm_connector_helper_funcs {
768 * 773 *
769 * RETURNS: 774 * RETURNS:
770 * 775 *
771 * Either MODE_OK or one of the failure reasons in enum 776 * Either &drm_mode_status.MODE_OK or one of the failure reasons in &enum
772 * &drm_mode_status. 777 * drm_mode_status.
773 */ 778 */
774 enum drm_mode_status (*mode_valid)(struct drm_connector *connector, 779 enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
775 struct drm_display_mode *mode); 780 struct drm_display_mode *mode);
@@ -875,7 +880,7 @@ struct drm_plane_helper_funcs {
875 * RETURNS: 880 * RETURNS:
876 * 881 *
877 * 0 on success or one of the following negative error codes allowed by 882 * 0 on success or one of the following negative error codes allowed by
878 * the atomic_commit hook in &drm_mode_config_funcs. When using helpers 883 * the &drm_mode_config_funcs.atomic_commit vfunc. When using helpers
879 * this callback is the only one which can fail an atomic commit, 884 * this callback is the only one which can fail an atomic commit,
880 * everything else must complete successfully. 885 * everything else must complete successfully.
881 */ 886 */
@@ -898,7 +903,7 @@ struct drm_plane_helper_funcs {
898 * 903 *
899 * Drivers should check plane specific constraints in this hook. 904 * Drivers should check plane specific constraints in this hook.
900 * 905 *
901 * When using drm_atomic_helper_check_planes() plane's ->atomic_check() 906 * When using drm_atomic_helper_check_planes() plane's @atomic_check
902 * hooks are called before the ones for CRTCs, which allows drivers to 907 * hooks are called before the ones for CRTCs, which allows drivers to
903 * request shared resources that the CRTC controls here. For more 908 * request shared resources that the CRTC controls here. For more
904 * complicated dependencies the driver can call the provided check helpers 909 * complicated dependencies the driver can call the provided check helpers
@@ -907,7 +912,7 @@ struct drm_plane_helper_funcs {
907 * 912 *
908 * This function is also allowed to inspect any other object's state and 913 * This function is also allowed to inspect any other object's state and
909 * can add more state objects to the atomic commit if needed. Care must 914 * can add more state objects to the atomic commit if needed. Care must
910 * be taken though to ensure that state check&compute functions for 915 * be taken though to ensure that state check and compute functions for
911 * these added states are all called, and derived state in other objects 916 * these added states are all called, and derived state in other objects
912 * all updated. Again the recommendation is to just call check helpers 917 * all updated. Again the recommendation is to just call check helpers
913 * until a maximal configuration is reached. 918 * until a maximal configuration is reached.
@@ -936,8 +941,8 @@ struct drm_plane_helper_funcs {
936 * @atomic_update: 941 * @atomic_update:
937 * 942 *
938 * Drivers should use this function to update the plane state. This 943 * Drivers should use this function to update the plane state. This
939 * hook is called in-between the ->atomic_begin() and 944 * hook is called in-between the &drm_crtc_helper_funcs.atomic_begin and
940 * ->atomic_flush() of &drm_crtc_helper_funcs. 945 * drm_crtc_helper_funcs.atomic_flush callbacks.
941 * 946 *
942 * Note that the power state of the display pipe when this function is 947 * Note that the power state of the display pipe when this function is
943 * called depends upon the exact helpers and calling sequence the driver 948 * called depends upon the exact helpers and calling sequence the driver
@@ -953,14 +958,15 @@ struct drm_plane_helper_funcs {
953 * @atomic_disable: 958 * @atomic_disable:
954 * 959 *
955 * Drivers should use this function to unconditionally disable a plane. 960 * Drivers should use this function to unconditionally disable a plane.
956 * This hook is called in-between the ->atomic_begin() and 961 * This hook is called in-between the
957 * ->atomic_flush() of &drm_crtc_helper_funcs. It is an alternative to 962 * &drm_crtc_helper_funcs.atomic_begin and
963 * drm_crtc_helper_funcs.atomic_flush callbacks. It is an alternative to
958 * @atomic_update, which will be called for disabling planes, too, if 964 * @atomic_update, which will be called for disabling planes, too, if
959 * the @atomic_disable hook isn't implemented. 965 * the @atomic_disable hook isn't implemented.
960 * 966 *
961 * This hook is also useful to disable planes in preparation of a modeset, 967 * This hook is also useful to disable planes in preparation of a modeset,
962 * by calling drm_atomic_helper_disable_planes_on_crtc() from the 968 * by calling drm_atomic_helper_disable_planes_on_crtc() from the
963 * ->disable() hook in &drm_crtc_helper_funcs. 969 * &drm_crtc_helper_funcs.disable hook.
964 * 970 *
965 * Note that the power state of the display pipe when this function is 971 * Note that the power state of the display pipe when this function is
966 * called depends upon the exact helpers and calling sequence the driver 972 * called depends upon the exact helpers and calling sequence the driver
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index d918ce45ec2c..96d39fbd12ca 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -64,7 +64,7 @@ struct drm_modeset_acquire_ctx {
64/** 64/**
65 * struct drm_modeset_lock - used for locking modeset resources. 65 * struct drm_modeset_lock - used for locking modeset resources.
66 * @mutex: resource locking 66 * @mutex: resource locking
67 * @head: used to hold it's place on state->locked list when 67 * @head: used to hold it's place on &drm_atomi_state.locked list when
68 * part of an atomic update 68 * part of an atomic update
69 * 69 *
70 * Used for locking CRTCs and other modeset resources. 70 * Used for locking CRTCs and other modeset resources.
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index e049bc52fb07..20867b4371ab 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -247,11 +247,11 @@ struct drm_plane_funcs {
247 * @atomic_duplicate_state: 247 * @atomic_duplicate_state:
248 * 248 *
249 * Duplicate the current atomic state for this plane and return it. 249 * Duplicate the current atomic state for this plane and return it.
250 * The core and helpers gurantee that any atomic state duplicated with 250 * The core and helpers guarantee that any atomic state duplicated with
251 * this hook and still owned by the caller (i.e. not transferred to the 251 * this hook and still owned by the caller (i.e. not transferred to the
252 * driver by calling ->atomic_commit() from struct 252 * driver by calling &drm_mode_config_funcs.atomic_commit) will be
253 * &drm_mode_config_funcs) will be cleaned up by calling the 253 * cleaned up by calling the @atomic_destroy_state hook in this
254 * @atomic_destroy_state hook in this structure. 254 * structure.
255 * 255 *
256 * Atomic drivers which don't subclass &struct drm_plane_state should use 256 * Atomic drivers which don't subclass &struct drm_plane_state should use
257 * drm_atomic_helper_plane_duplicate_state(). Drivers that subclass the 257 * drm_atomic_helper_plane_duplicate_state(). Drivers that subclass the
@@ -259,7 +259,7 @@ struct drm_plane_funcs {
259 * __drm_atomic_helper_plane_duplicate_state() to make sure shared state is 259 * __drm_atomic_helper_plane_duplicate_state() to make sure shared state is
260 * duplicated in a consistent fashion across drivers. 260 * duplicated in a consistent fashion across drivers.
261 * 261 *
262 * It is an error to call this hook before plane->state has been 262 * It is an error to call this hook before &drm_plane.state has been
263 * initialized correctly. 263 * initialized correctly.
264 * 264 *
265 * NOTE: 265 * NOTE:
@@ -372,7 +372,7 @@ struct drm_plane_funcs {
372 * 372 *
373 * This optional hook should be used to unregister the additional 373 * This optional hook should be used to unregister the additional
374 * userspace interfaces attached to the plane from 374 * userspace interfaces attached to the plane from
375 * late_unregister(). It is called from drm_dev_unregister(), 375 * @late_register. It is called from drm_dev_unregister(),
376 * early in the driver unload sequence to disable userspace access 376 * early in the driver unload sequence to disable userspace access
377 * before data structures are torndown. 377 * before data structures are torndown.
378 */ 378 */
@@ -423,8 +423,8 @@ enum drm_plane_type {
423 * 423 *
424 * Primary planes represent a "main" plane for a CRTC. Primary planes 424 * Primary planes represent a "main" plane for a CRTC. Primary planes
425 * are the planes operated upon by CRTC modesetting and flipping 425 * are the planes operated upon by CRTC modesetting and flipping
426 * operations described in the page_flip and set_config hooks in struct 426 * operations described in the &drm_crtc_funcs.page_flip and
427 * &drm_crtc_funcs. 427 * &drm_crtc_funcs.set_config hooks.
428 */ 428 */
429 DRM_PLANE_TYPE_PRIMARY, 429 DRM_PLANE_TYPE_PRIMARY,
430 430
@@ -470,9 +470,9 @@ struct drm_plane {
470 /** 470 /**
471 * @mutex: 471 * @mutex:
472 * 472 *
473 * Protects modeset plane state, together with the mutex of &drm_crtc 473 * Protects modeset plane state, together with the &drm_crtc.mutex of
474 * this plane is linked to (when active, getting actived or getting 474 * CRTC this plane is linked to (when active, getting activated or
475 * disabled). 475 * getting disabled).
476 */ 476 */
477 struct drm_modeset_lock mutex; 477 struct drm_modeset_lock mutex;
478 478
@@ -580,7 +580,7 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
580 * 580 *
581 * Iterate over all legacy planes of @dev, excluding primary and cursor planes. 581 * Iterate over all legacy planes of @dev, excluding primary and cursor planes.
582 * This is useful for implementing userspace apis when userspace is not 582 * This is useful for implementing userspace apis when userspace is not
583 * universal plane aware. See also enum &drm_plane_type. 583 * universal plane aware. See also &enum drm_plane_type.
584 */ 584 */
585#define drm_for_each_legacy_plane(plane, dev) \ 585#define drm_for_each_legacy_plane(plane, dev) \
586 list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \ 586 list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h
index 43c4b6a2046d..f66fdb47551c 100644
--- a/include/drm/drm_property.h
+++ b/include/drm/drm_property.h
@@ -30,7 +30,7 @@
30/** 30/**
31 * struct drm_property_enum - symbolic values for enumerations 31 * struct drm_property_enum - symbolic values for enumerations
32 * @value: numeric property value for this enum entry 32 * @value: numeric property value for this enum entry
33 * @head: list of enum values, linked to enum_list in &drm_property 33 * @head: list of enum values, linked to &drm_property.enum_list
34 * @name: symbolic name for the enum 34 * @name: symbolic name for the enum
35 * 35 *
36 * For enumeration and bitmask properties this structure stores the symbolic 36 * For enumeration and bitmask properties this structure stores the symbolic
@@ -191,9 +191,9 @@ struct drm_property {
191 * struct drm_property_blob - Blob data for &drm_property 191 * struct drm_property_blob - Blob data for &drm_property
192 * @base: base KMS object 192 * @base: base KMS object
193 * @dev: DRM device 193 * @dev: DRM device
194 * @head_global: entry on the global blob list in &drm_mode_config 194 * @head_global: entry on the global blob list in
195 * property_blob_list. 195 * &drm_mode_config.property_blob_list.
196 * @head_file: entry on the per-file blob list in &drm_file blobs list. 196 * @head_file: entry on the per-file blob list in &drm_file.blobs list.
197 * @length: size of the blob in bytes, invariant over the lifetime of the object 197 * @length: size of the blob in bytes, invariant over the lifetime of the object
198 * @data: actual data, embedded at the end of this structure 198 * @data: actual data, embedded at the end of this structure
199 * 199 *
diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
index fe8c4ba905ac..fffbb95a0915 100644
--- a/include/drm/drm_simple_kms_helper.h
+++ b/include/drm/drm_simple_kms_helper.h
@@ -10,6 +10,10 @@
10#ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H 10#ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H
11#define __LINUX_DRM_SIMPLE_KMS_HELPER_H 11#define __LINUX_DRM_SIMPLE_KMS_HELPER_H
12 12
13#include <drm/drm_crtc.h>
14#include <drm/drm_encoder.h>
15#include <drm/drm_plane.h>
16
13struct drm_simple_display_pipe; 17struct drm_simple_display_pipe;
14 18
15/** 19/**
@@ -73,9 +77,9 @@ struct drm_simple_display_pipe_funcs {
73 /** 77 /**
74 * @prepare_fb: 78 * @prepare_fb:
75 * 79 *
76 * Optional, called by &struct drm_plane_helper_funcs ->prepare_fb . 80 * Optional, called by &drm_plane_helper_funcs.prepare_fb. Please read
77 * Please read the documentation for the ->prepare_fb hook in 81 * the documentation for the &drm_plane_helper_funcs.prepare_fb hook for
78 * &struct drm_plane_helper_funcs for more details. 82 * more details.
79 */ 83 */
80 int (*prepare_fb)(struct drm_simple_display_pipe *pipe, 84 int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
81 struct drm_plane_state *plane_state); 85 struct drm_plane_state *plane_state);
@@ -83,9 +87,9 @@ struct drm_simple_display_pipe_funcs {
83 /** 87 /**
84 * @cleanup_fb: 88 * @cleanup_fb:
85 * 89 *
86 * Optional, called by &struct drm_plane_helper_funcs ->cleanup_fb . 90 * Optional, called by &drm_plane_helper_funcs.cleanup_fb. Please read
87 * Please read the documentation for the ->cleanup_fb hook in 91 * the documentation for the &drm_plane_helper_funcs.cleanup_fb hook for
88 * &struct drm_plane_helper_funcs for more details. 92 * more details.
89 */ 93 */
90 void (*cleanup_fb)(struct drm_simple_display_pipe *pipe, 94 void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
91 struct drm_plane_state *plane_state); 95 struct drm_plane_state *plane_state);
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 1596d53c9ccf..ef20abb8119b 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -167,6 +167,7 @@ extern "C" {
167#define DRM_FORMAT_MOD_VENDOR_NV 0x03 167#define DRM_FORMAT_MOD_VENDOR_NV 0x03
168#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 168#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
169#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 169#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05
170#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06
170/* add more to the end as needed */ 171/* add more to the end as needed */
171 172
172#define fourcc_mod_code(vendor, val) \ 173#define fourcc_mod_code(vendor, val) \
@@ -251,6 +252,46 @@ extern "C" {
251 */ 252 */
252#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) 253#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
253 254
255/* Vivante framebuffer modifiers */
256
257/*
258 * Vivante 4x4 tiling layout
259 *
260 * This is a simple tiled layout using tiles of 4x4 pixels in a row-major
261 * layout.
262 */
263#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1)
264
265/*
266 * Vivante 64x64 super-tiling layout
267 *
268 * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile
269 * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row-
270 * major layout.
271 *
272 * For more information: see
273 * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling
274 */
275#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2)
276
277/*
278 * Vivante 4x4 tiling layout for dual-pipe
279 *
280 * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a
281 * different base address. Offsets from the base addresses are therefore halved
282 * compared to the non-split tiled layout.
283 */
284#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3)
285
286/*
287 * Vivante 64x64 super-tiling layout for dual-pipe
288 *
289 * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile
290 * starts at a different base address. Offsets from the base addresses are
291 * therefore halved compared to the non-split super-tiled layout.
292 */
293#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4)
294
254#if defined(__cplusplus) 295#if defined(__cplusplus)
255} 296}
256#endif 297#endif
diff --git a/lib/prime_numbers.c b/lib/prime_numbers.c
index c9b3c29614aa..550eec457c2e 100644
--- a/lib/prime_numbers.c
+++ b/lib/prime_numbers.c
@@ -124,7 +124,8 @@ static bool expand_to_next_prime(unsigned long x)
124 return false; 124 return false;
125 125
126 sz = round_up(sz, BITS_PER_LONG); 126 sz = round_up(sz, BITS_PER_LONG);
127 new = kmalloc(sizeof(*new) + bitmap_size(sz), GFP_KERNEL); 127 new = kmalloc(sizeof(*new) + bitmap_size(sz),
128 GFP_KERNEL | __GFP_NOWARN);
128 if (!new) 129 if (!new)
129 return false; 130 return false;
130 131