Pull drm fixes from Dave Airlie: "Regular drm fixes, nothing too outstanding, I'm guessing Easter was slowing people down. i915: - FEC enable fix - BXT display lanes fix ttm: - fix reinit for reloading drivers regression imx: - DP CSC fix sun4i: - module unload/load fix vc4: - memory leak fix - compile fix dw-hdmi: - rockchip scdc overflow fix sched: - docs fix vmwgfx: - dma api layering fix" * tag 'drm-fixes-2019-04-26' of git://anongit.freedesktop.org/drm/drm: drm/bridge: dw-hdmi: fix SCDC configuration for ddc-i2c-bus drm/vmwgfx: Fix dma API layer violation drm/vc4: Fix compilation error reported by kbuild test bot drm/sun4i: Unbind components before releasing DRM and memory drm/vc4: Fix memory leak during gpu reset. drm/sched: Fix description of drm_sched_stop drm/imx: don't skip DP channel disable for background plane gpu: ipu-v3: dp: fix CSC handling drm/ttm: fix re-init of global structures drm/sun4i: Fix component unbinding and component master deletion drm/sun4i: Set device driver data at bind time for use in unbind drm/sun4i: Add missing drm_atomic_helper_shutdown at driver unbind drm/i915: Restore correct bxt_ddi_phy_calc_lane_lat_optim_mask() calculation drm/i915: Do not enable FEC without DSC drm: bridge: dw-hdmi: Fix overflow workaround for Rockchip SoCs
Unified · Split
| @@ -1046,6 +1046,10 @@ static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi) · 1045 unmodified lines | ||
| 1046 | 1046 | if (hdmi->version < 0x200a) |
| 1047 | 1047 | return false; |
| 1048 | 1048 | |
| 1049 | + /* Disable if no DDC bus */ | |
| 1050 | + if (!hdmi->ddc) | |
| 1051 | + return false; | |
| 1052 | + | |
| 1049 | 1053 | /* Disable if SCDC is not supported, or if an HF-VSDB block is absent */ |
| 1050 | 1054 | if (!display->hdmi.scdc.supported || |
| 1051 | 1055 | !display->hdmi.scdc.scrambling.supported) |
| @@ -1684,13 +1688,13 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, · 632 unmodified lines | ||
| 1684 | 1688 | * Source Devices compliant shall set the |
| 1685 | 1689 | * Source Version = 1. |
| 1686 | 1690 | */ |
| 1687 | − drm_scdc_readb(&hdmi->i2c->adap, SCDC_SINK_VERSION, | |
| 1691 | + drm_scdc_readb(hdmi->ddc, SCDC_SINK_VERSION, | |
| 1688 | 1692 | &bytes); |
| 1689 | − drm_scdc_writeb(&hdmi->i2c->adap, SCDC_SOURCE_VERSION, | |
| 1693 | + drm_scdc_writeb(hdmi->ddc, SCDC_SOURCE_VERSION, | |
| 1690 | 1694 | min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION)); |
| 1691 | 1695 | |
| 1692 | 1696 | /* Enabled Scrambling in the Sink */ |
| 1693 | − drm_scdc_set_scrambling(&hdmi->i2c->adap, 1); | |
| 1697 | + drm_scdc_set_scrambling(hdmi->ddc, 1); | |
| 1694 | 1698 | |
| 1695 | 1699 | /* |
| 1696 | 1700 | * To activate the scrambler feature, you must ensure |
| @@ -1706,7 +1710,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, · 9 unmodified lines | ||
| 1706 | 1710 | hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL); |
| 1707 | 1711 | hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, |
| 1708 | 1712 | HDMI_MC_SWRSTZ); |
| 1709 | − drm_scdc_set_scrambling(&hdmi->i2c->adap, 0); | |
| 1713 | + drm_scdc_set_scrambling(hdmi->ddc, 0); | |
| 1710 | 1714 | } |
| 1711 | 1715 | } |
| 1712 | 1716 | |
| @@ -1800,6 +1804,8 @@ static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) · 87 unmodified lines | ||
| 1800 | 1804 | * iteration for others. |
| 1801 | 1805 | * The Amlogic Meson GX SoCs (v2.01a) have been identified as needing |
| 1802 | 1806 | * the workaround with a single iteration. |
| 1807 | + * The Rockchip RK3288 SoC (v2.00a) and RK3328/RK3399 SoCs (v2.11a) have | |
| 1808 | + * been identified as needing the workaround with a single iteration. | |
| 1803 | 1809 | */ |
| 1804 | 1810 | |
| 1805 | 1811 | switch (hdmi->version) { |
| @@ -1808,7 +1814,9 @@ static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) · 2 unmodified lines | ||
| 1808 | 1814 | break; |
| 1809 | 1815 | case 0x131a: |
| 1810 | 1816 | case 0x132a: |
| 1817 | + case 0x200a: | |
| 1811 | 1818 | case 0x201a: |
| 1819 | + case 0x211a: | |
| 1812 | 1820 | case 0x212a: |
| 1813 | 1821 | count = 1; |
| 1814 | 1822 | break; |
| @@ -3862,14 +3862,16 @@ static int intel_ddi_compute_config(struct intel_encoder *encoder, · 3861 unmodified lines | ||
| 3862 | 3862 | ret = intel_hdmi_compute_config(encoder, pipe_config, conn_state); |
| 3863 | 3863 | else |
| 3864 | 3864 | ret = intel_dp_compute_config(encoder, pipe_config, conn_state); |
| 3865 | + if (ret) | |
| 3866 | + return ret; | |
| 3865 | 3867 | |
| 3866 | − if (IS_GEN9_LP(dev_priv) && ret) | |
| 3868 | + if (IS_GEN9_LP(dev_priv)) | |
| 3867 | 3869 | pipe_config->lane_lat_optim_mask = |
| 3868 | 3870 | bxt_ddi_phy_calc_lane_lat_optim_mask(pipe_config->lane_count); |
| 3869 | 3871 | |
| 3870 | 3872 | intel_ddi_compute_min_voltage_level(dev_priv, pipe_config); |
| 3871 | 3873 | |
| 3872 | − return ret; | |
| 3874 | + return 0; | |
| 3873 | 3875 | |
| 3874 | 3876 | } |
| 3875 | 3877 | |
| @@ -1886,6 +1886,9 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp, · 1885 unmodified lines | ||
| 1886 | 1886 | int pipe_bpp; |
| 1887 | 1887 | int ret; |
| 1888 | 1888 | |
| 1889 | + pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) && | |
| 1890 | + intel_dp_supports_fec(intel_dp, pipe_config); | |
| 1891 | + | |
| 1889 | 1892 | if (!intel_dp_supports_dsc(intel_dp, pipe_config)) |
| 1890 | 1893 | return -EINVAL; |
| 1891 | 1894 | |
| @@ -2116,9 +2119,6 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 224 unmodified lines | ||
| 2116 | 2119 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) |
| 2117 | 2120 | return -EINVAL; |
| 2118 | 2121 | |
| 2119 | − pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) && | |
| 2120 | − intel_dp_supports_fec(intel_dp, pipe_config); | |
| 2121 | − | |
| 2122 | 2122 | ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state); |
| 2123 | 2123 | if (ret < 0) |
| 2124 | 2124 | return ret; |
| @@ -71,7 +71,7 @@ static void ipu_crtc_disable_planes(struct ipu_crtc *ipu_crtc, · 70 unmodified lines | ||
| 71 | 71 | if (disable_partial) |
| 72 | 72 | ipu_plane_disable(ipu_crtc->plane[1], true); |
| 73 | 73 | if (disable_full) |
| 74 | − ipu_plane_disable(ipu_crtc->plane[0], false); | |
| 74 | + ipu_plane_disable(ipu_crtc->plane[0], true); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, |
| @@ -366,10 +366,9 @@ void drm_sched_increase_karma(struct drm_sched_job *bad) · 365 unmodified lines | ||
| 366 | 366 | EXPORT_SYMBOL(drm_sched_increase_karma); |
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | − * drm_sched_hw_job_reset - stop the scheduler if it contains the bad job | |
| 369 | + * drm_sched_stop - stop the scheduler | |
| 370 | 370 | * |
| 371 | 371 | * @sched: scheduler instance |
| 372 | − * @bad: bad scheduler job | |
| 373 | 372 | * |
| 374 | 373 | */ |
| 375 | 374 | void drm_sched_stop(struct drm_gpu_scheduler *sched) |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/of_reserved_mem.h> |
| 17 | 17 | |
| 18 | 18 | #include <drm/drmP.h> |
| 19 | +#include <drm/drm_atomic_helper.h> | |
| 19 | 20 | #include <drm/drm_fb_cma_helper.h> |
| 20 | 21 | #include <drm/drm_fb_helper.h> |
| 21 | 22 | #include <drm/drm_gem_cma_helper.h> |
| @@ -85,6 +86,8 @@ static int sun4i_drv_bind(struct device *dev) · 63 unmodified lines | ||
| 85 | 86 | ret = -ENOMEM; |
| 86 | 87 | goto free_drm; |
| 87 | 88 | } |
| 89 | + | |
| 90 | + dev_set_drvdata(dev, drm); | |
| 88 | 91 | drm->dev_private = drv; |
| 89 | 92 | INIT_LIST_HEAD(&drv->frontend_list); |
| 90 | 93 | INIT_LIST_HEAD(&drv->engine_list); |
| @@ -144,8 +147,12 @@ static void sun4i_drv_unbind(struct device *dev) · 53 unmodified lines | ||
| 144 | 147 | |
| 145 | 148 | drm_dev_unregister(drm); |
| 146 | 149 | drm_kms_helper_poll_fini(drm); |
| 150 | + drm_atomic_helper_shutdown(drm); | |
| 147 | 151 | drm_mode_config_cleanup(drm); |
| 152 | + | |
| 153 | + component_unbind_all(dev, NULL); | |
| 148 | 154 | of_reserved_mem_device_release(dev); |
| 155 | + | |
| 149 | 156 | drm_dev_put(drm); |
| 150 | 157 | } |
| 151 | 158 | |
| @@ -395,6 +402,8 @@ static int sun4i_drv_probe(struct platform_device *pdev) · 243 unmodified lines | ||
| 395 | 402 | |
| 396 | 403 | static int sun4i_drv_remove(struct platform_device *pdev) |
| 397 | 404 | { |
| 405 | + component_master_del(&pdev->dev, &sun4i_drv_master_ops); | |
| 406 | + | |
| 398 | 407 | return 0; |
| 399 | 408 | } |
| 400 | 409 | |
| @@ -49,9 +49,8 @@ static void ttm_bo_global_kobj_release(struct kobject *kobj); · 48 unmodified lines | ||
| 49 | 49 | * ttm_global_mutex - protecting the global BO state |
| 50 | 50 | */ |
| 51 | 51 | DEFINE_MUTEX(ttm_global_mutex); |
| 52 | −struct ttm_bo_global ttm_bo_glob = { | |
| 53 | − .use_count = 0 | |
| 54 | −}; | |
| 52 | +unsigned ttm_bo_glob_use_count; | |
| 53 | +struct ttm_bo_global ttm_bo_glob; | |
| 55 | 54 | |
| 56 | 55 | static struct attribute ttm_bo_count = { |
| 57 | 56 | .name = "bo_count", |
| @@ -1531,12 +1530,13 @@ static void ttm_bo_global_release(void) · 1473 unmodified lines | ||
| 1531 | 1530 | struct ttm_bo_global *glob = &ttm_bo_glob; |
| 1532 | 1531 | |
| 1533 | 1532 | mutex_lock(&ttm_global_mutex); |
| 1534 | − if (--glob->use_count > 0) | |
| 1533 | + if (--ttm_bo_glob_use_count > 0) | |
| 1535 | 1534 | goto out; |
| 1536 | 1535 | |
| 1537 | 1536 | kobject_del(&glob->kobj); |
| 1538 | 1537 | kobject_put(&glob->kobj); |
| 1539 | 1538 | ttm_mem_global_release(&ttm_mem_glob); |
| 1539 | + memset(glob, 0, sizeof(*glob)); | |
| 1540 | 1540 | out: |
| 1541 | 1541 | mutex_unlock(&ttm_global_mutex); |
| 1542 | 1542 | } |
| @@ -1548,7 +1548,7 @@ static int ttm_bo_global_init(void) · 5 unmodified lines | ||
| 1548 | 1548 | unsigned i; |
| 1549 | 1549 | |
| 1550 | 1550 | mutex_lock(&ttm_global_mutex); |
| 1551 | − if (++glob->use_count > 1) | |
| 1551 | + if (++ttm_bo_glob_use_count > 1) | |
| 1552 | 1552 | goto out; |
| 1553 | 1553 | |
| 1554 | 1554 | ret = ttm_mem_global_init(&ttm_mem_glob); |
| @@ -461,8 +461,8 @@ out_no_zone: · 460 unmodified lines | ||
| 461 | 461 | |
| 462 | 462 | void ttm_mem_global_release(struct ttm_mem_global *glob) |
| 463 | 463 | { |
| 464 | − unsigned int i; | |
| 465 | 464 | struct ttm_mem_zone *zone; |
| 465 | + unsigned int i; | |
| 466 | 466 | |
| 467 | 467 | /* let the page allocator first stop the shrink work. */ |
| 468 | 468 | ttm_page_alloc_fini(); |
| @@ -475,9 +475,10 @@ void ttm_mem_global_release(struct ttm_mem_global *glob) · 6 unmodified lines | ||
| 475 | 475 | zone = glob->zones[i]; |
| 476 | 476 | kobject_del(&zone->kobj); |
| 477 | 477 | kobject_put(&zone->kobj); |
| 478 | − } | |
| 478 | + } | |
| 479 | 479 | kobject_del(&glob->kobj); |
| 480 | 480 | kobject_put(&glob->kobj); |
| 481 | + memset(glob, 0, sizeof(*glob)); | |
| 481 | 482 | } |
| 482 | 483 | |
| 483 | 484 | static void ttm_check_swapping(struct ttm_mem_global *glob) |
| @@ -1042,7 +1042,7 @@ static void · 1041 unmodified lines | ||
| 1042 | 1042 | vc4_crtc_reset(struct drm_crtc *crtc) |
| 1043 | 1043 | { |
| 1044 | 1044 | if (crtc->state) |
| 1045 | − __drm_atomic_helper_crtc_destroy_state(crtc->state); | |
| 1045 | + vc4_crtc_destroy_state(crtc, crtc->state); | |
| 1046 | 1046 | |
| 1047 | 1047 | crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL); |
| 1048 | 1048 | if (crtc->state) |
| @@ -545,30 +545,14 @@ static void vmw_get_initial_size(struct vmw_private *dev_priv) · 544 unmodified lines | ||
| 545 | 545 | dev_priv->initial_height = height; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | −/** | |
| 549 | − * vmw_assume_iommu - Figure out whether coherent dma-remapping might be | |
| 550 | − * taking place. | |
| 551 | − * @dev: Pointer to the struct drm_device. | |
| 552 | − * | |
| 553 | − * Return: true if iommu present, false otherwise. | |
| 554 | − */ | |
| 555 | −static bool vmw_assume_iommu(struct drm_device *dev) | |
| 556 | −{ | |
| 557 | − const struct dma_map_ops *ops = get_dma_ops(dev->dev); | |
| 558 | − | |
| 559 | − return !dma_is_direct(ops) && ops && | |
| 560 | − ops->map_page != dma_direct_map_page; | |
| 561 | −} | |
| 562 | − | |
| 563 | 548 | /** |
| 564 | 549 | * vmw_dma_select_mode - Determine how DMA mappings should be set up for this |
| 565 | 550 | * system. |
| 566 | 551 | * |
| 567 | 552 | * @dev_priv: Pointer to a struct vmw_private |
| 568 | 553 | * |
| 569 | − * This functions tries to determine the IOMMU setup and what actions | |
| 570 | − * need to be taken by the driver to make system pages visible to the | |
| 571 | − * device. | |
| 554 | + * This functions tries to determine what actions need to be taken by the | |
| 555 | + * driver to make system pages visible to the device. | |
| 572 | 556 | * If this function decides that DMA is not possible, it returns -EINVAL. |
| 573 | 557 | * The driver may then try to disable features of the device that require |
| 574 | 558 | * DMA. |
| @@ -578,23 +562,16 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) · 3 unmodified lines | ||
| 578 | 562 | static const char *names[vmw_dma_map_max] = { |
| 579 | 563 | [vmw_dma_phys] = "Using physical TTM page addresses.", |
| 580 | 564 | [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", |
| 581 | − [vmw_dma_map_populate] = "Keeping DMA mappings.", | |
| 565 | + [vmw_dma_map_populate] = "Caching DMA mappings.", | |
| 582 | 566 | [vmw_dma_map_bind] = "Giving up DMA mappings early."}; |
| 583 | 567 | |
| 584 | 568 | if (vmw_force_coherent) |
| 585 | 569 | dev_priv->map_mode = vmw_dma_alloc_coherent; |
| 586 | − else if (vmw_assume_iommu(dev_priv->dev)) | |
| 587 | − dev_priv->map_mode = vmw_dma_map_populate; | |
| 588 | − else if (!vmw_force_iommu) | |
| 589 | − dev_priv->map_mode = vmw_dma_phys; | |
| 590 | − else if (IS_ENABLED(CONFIG_SWIOTLB) && swiotlb_nr_tbl()) | |
| 591 | − dev_priv->map_mode = vmw_dma_alloc_coherent; | |
| 570 | + else if (vmw_restrict_iommu) | |
| 571 | + dev_priv->map_mode = vmw_dma_map_bind; | |
| 592 | 572 | else |
| 593 | 573 | dev_priv->map_mode = vmw_dma_map_populate; |
| 594 | 574 | |
| 595 | − if (dev_priv->map_mode == vmw_dma_map_populate && vmw_restrict_iommu) | |
| 596 | − dev_priv->map_mode = vmw_dma_map_bind; | |
| 597 | − | |
| 598 | 575 | /* No TTM coherent page pool? FIXME: Ask TTM instead! */ |
| 599 | 576 | if (!(IS_ENABLED(CONFIG_SWIOTLB) || IS_ENABLED(CONFIG_INTEL_IOMMU)) && |
| 600 | 577 | (dev_priv->map_mode == vmw_dma_alloc_coherent)) |
| @@ -195,7 +195,8 @@ int ipu_dp_setup_channel(struct ipu_dp *dp, · 194 unmodified lines | ||
| 195 | 195 | ipu_dp_csc_init(flow, flow->foreground.in_cs, flow->out_cs, |
| 196 | 196 | DP_COM_CONF_CSC_DEF_BOTH); |
| 197 | 197 | } else { |
| 198 | − if (flow->foreground.in_cs == flow->out_cs) | |
| 198 | + if (flow->foreground.in_cs == IPUV3_COLORSPACE_UNKNOWN || | |
| 199 | + flow->foreground.in_cs == flow->out_cs) | |
| 199 | 200 | /* |
| 200 | 201 | * foreground identical to output, apply color |
| 201 | 202 | * conversion on background |
| @@ -261,6 +262,8 @@ void ipu_dp_disable_channel(struct ipu_dp *dp, bool sync) · 59 unmodified lines | ||
| 261 | 262 | struct ipu_dp_priv *priv = flow->priv; |
| 262 | 263 | u32 reg, csc; |
| 263 | 264 | |
| 265 | + dp->in_cs = IPUV3_COLORSPACE_UNKNOWN; | |
| 266 | + | |
| 264 | 267 | if (!dp->foreground) |
| 265 | 268 | return; |
| 266 | 269 | |
| @@ -268,8 +271,9 @@ void ipu_dp_disable_channel(struct ipu_dp *dp, bool sync) · 1 unmodified line | ||
| 268 | 271 | |
| 269 | 272 | reg = readl(flow->base + DP_COM_CONF); |
| 270 | 273 | csc = reg & DP_COM_CONF_CSC_DEF_MASK; |
| 271 | − if (csc == DP_COM_CONF_CSC_DEF_FG) | |
| 272 | − reg &= ~DP_COM_CONF_CSC_DEF_MASK; | |
| 274 | + reg &= ~DP_COM_CONF_CSC_DEF_MASK; | |
| 275 | + if (csc == DP_COM_CONF_CSC_DEF_BOTH || csc == DP_COM_CONF_CSC_DEF_BG) | |
| 276 | + reg |= DP_COM_CONF_CSC_DEF_BG; | |
| 273 | 277 | |
| 274 | 278 | reg &= ~DP_COM_CONF_FG_EN; |
| 275 | 279 | writel(reg, flow->base + DP_COM_CONF); |
| @@ -347,6 +351,8 @@ int ipu_dp_init(struct ipu_soc *ipu, struct device *dev, unsigned long base) · 71 unmodified lines | ||
| 347 | 351 | mutex_init(&priv->mutex); |
| 348 | 352 | |
| 349 | 353 | for (i = 0; i < IPUV3_NUM_FLOWS; i++) { |
| 354 | + priv->flow[i].background.in_cs = IPUV3_COLORSPACE_UNKNOWN; | |
| 355 | + priv->flow[i].foreground.in_cs = IPUV3_COLORSPACE_UNKNOWN; | |
| 350 | 356 | priv->flow[i].foreground.foreground = true; |
| 351 | 357 | priv->flow[i].base = priv->base + ipu_dp_flow_base[i]; |
| 352 | 358 | priv->flow[i].priv = priv; |
| @@ -420,7 +420,6 @@ extern struct ttm_bo_global { · 419 unmodified lines | ||
| 420 | 420 | /** |
| 421 | 421 | * Protected by ttm_global_mutex. |
| 422 | 422 | */ |
| 423 | − unsigned int use_count; | |
| 424 | 423 | struct list_head device_list; |
| 425 | 424 | |
| 426 | 425 | /** |