Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm gixes from Dave Airlie:
- exynos: infinite loop regressions fixed
- i915: one regression
- radeon: one race condition on monitor probing
- noveau: two regressions
- tegra: one vblank regression fix

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
drm/tegra: dc: Add missing call to drm_vblank_on()
drm/nouveau/nv50/disp: Fix modeset on G94
drm/gk20a/fb: fix setting of large page size bit
drm/radeon: add locking around atombios scratch space usage
drm/i915: Fix obj->map_and_fenceable across tiling changes
drm/exynos: fix possible infinite loop issue
drm/exynos: g2d: fix null pointer dereference
drm/exynos: resolve infinite loop issue on non multi-platform
drm/exynos: resolve infinite loop issue on multi-platform

+103 -46
+33 -16
drivers/gpu/drm/exynos/exynos_drm_drv.c
··· 495 496 mutex_lock(&drm_component_lock); 497 498 list_for_each_entry(cdev, &drm_component_list, list) { 499 /* 500 * Add components to master only in case that crtc and ··· 591 goto err_unregister_mixer_drv; 592 #endif 593 594 #ifdef CONFIG_DRM_EXYNOS_G2D 595 ret = platform_driver_register(&g2d_driver); 596 if (ret < 0) 597 - goto err_unregister_hdmi_drv; 598 #endif 599 600 #ifdef CONFIG_DRM_EXYNOS_FIMC ··· 636 goto err_unregister_ipp_drv; 637 #endif 638 639 - match = exynos_drm_match_add(&pdev->dev); 640 - if (IS_ERR(match)) { 641 - ret = PTR_ERR(match); 642 - goto err_unregister_resources; 643 - } 644 - 645 - ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, 646 - match); 647 - if (ret < 0) 648 - goto err_unregister_resources; 649 - 650 return ret; 651 652 - err_unregister_resources: 653 - 654 #ifdef CONFIG_DRM_EXYNOS_IPP 655 - exynos_platform_device_ipp_unregister(); 656 err_unregister_ipp_drv: 657 platform_driver_unregister(&ipp_driver); 658 err_unregister_gsc_drv: ··· 661 662 #ifdef CONFIG_DRM_EXYNOS_G2D 663 platform_driver_unregister(&g2d_driver); 664 - err_unregister_hdmi_drv: 665 #endif 666 667 #ifdef CONFIG_DRM_EXYNOS_HDMI 668 platform_driver_unregister(&hdmi_driver); 669 err_unregister_mixer_drv: ··· 745 static int exynos_drm_init(void) 746 { 747 int ret; 748 749 exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, 750 NULL, 0);
··· 495 496 mutex_lock(&drm_component_lock); 497 498 + /* Do not retry to probe if there is no any kms driver regitered. */ 499 + if (list_empty(&drm_component_list)) { 500 + mutex_unlock(&drm_component_lock); 501 + return ERR_PTR(-ENODEV); 502 + } 503 + 504 list_for_each_entry(cdev, &drm_component_list, list) { 505 /* 506 * Add components to master only in case that crtc and ··· 585 goto err_unregister_mixer_drv; 586 #endif 587 588 + match = exynos_drm_match_add(&pdev->dev); 589 + if (IS_ERR(match)) { 590 + ret = PTR_ERR(match); 591 + goto err_unregister_hdmi_drv; 592 + } 593 + 594 + ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, 595 + match); 596 + if (ret < 0) 597 + goto err_unregister_hdmi_drv; 598 + 599 #ifdef CONFIG_DRM_EXYNOS_G2D 600 ret = platform_driver_register(&g2d_driver); 601 if (ret < 0) 602 + goto err_del_component_master; 603 #endif 604 605 #ifdef CONFIG_DRM_EXYNOS_FIMC ··· 619 goto err_unregister_ipp_drv; 620 #endif 621 622 return ret; 623 624 #ifdef CONFIG_DRM_EXYNOS_IPP 625 err_unregister_ipp_drv: 626 platform_driver_unregister(&ipp_driver); 627 err_unregister_gsc_drv: ··· 658 659 #ifdef CONFIG_DRM_EXYNOS_G2D 660 platform_driver_unregister(&g2d_driver); 661 + err_del_component_master: 662 #endif 663 + component_master_del(&pdev->dev, &exynos_drm_ops); 664 665 + err_unregister_hdmi_drv: 666 #ifdef CONFIG_DRM_EXYNOS_HDMI 667 platform_driver_unregister(&hdmi_driver); 668 err_unregister_mixer_drv: ··· 740 static int exynos_drm_init(void) 741 { 742 int ret; 743 + 744 + /* 745 + * Register device object only in case of Exynos SoC. 746 + * 747 + * Below codes resolves temporarily infinite loop issue incurred 748 + * by Exynos drm driver when using multi-platform kernel. 749 + * So these codes will be replaced with more generic way later. 750 + */ 751 + if (!of_machine_is_compatible("samsung,exynos3") && 752 + !of_machine_is_compatible("samsung,exynos4") && 753 + !of_machine_is_compatible("samsung,exynos5")) 754 + return -ENODEV; 755 756 exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, 757 NULL, 0);
+6 -3
drivers/gpu/drm/exynos/exynos_drm_g2d.c
··· 302 struct exynos_drm_subdrv *subdrv = &g2d->subdrv; 303 304 kfree(g2d->cmdlist_node); 305 - dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE, 306 - g2d->cmdlist_pool_virt, 307 - g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); 308 } 309 310 static struct g2d_cmdlist_node *g2d_get_cmdlist(struct g2d_data *g2d)
··· 302 struct exynos_drm_subdrv *subdrv = &g2d->subdrv; 303 304 kfree(g2d->cmdlist_node); 305 + 306 + if (g2d->cmdlist_pool_virt && g2d->cmdlist_pool) { 307 + dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE, 308 + g2d->cmdlist_pool_virt, 309 + g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); 310 + } 311 } 312 313 static struct g2d_cmdlist_node *g2d_get_cmdlist(struct g2d_data *g2d)
+3 -16
drivers/gpu/drm/i915/i915_gem_tiling.c
··· 364 * has to also include the unfenced register the GPU uses 365 * whilst executing a fenced command for an untiled object. 366 */ 367 - 368 - obj->map_and_fenceable = 369 - !i915_gem_obj_ggtt_bound(obj) || 370 - (i915_gem_obj_ggtt_offset(obj) + 371 - obj->base.size <= dev_priv->gtt.mappable_end && 372 - i915_gem_object_fence_ok(obj, args->tiling_mode)); 373 - 374 - /* Rebind if we need a change of alignment */ 375 - if (!obj->map_and_fenceable) { 376 - u32 unfenced_align = 377 - i915_gem_get_gtt_alignment(dev, obj->base.size, 378 - args->tiling_mode, 379 - false); 380 - if (i915_gem_obj_ggtt_offset(obj) & (unfenced_align - 1)) 381 - ret = i915_gem_object_ggtt_unbind(obj); 382 - } 383 384 if (ret == 0) { 385 obj->fence_dirty =
··· 364 * has to also include the unfenced register the GPU uses 365 * whilst executing a fenced command for an untiled object. 366 */ 367 + if (obj->map_and_fenceable && 368 + !i915_gem_object_fence_ok(obj, args->tiling_mode)) 369 + ret = i915_gem_object_ggtt_unbind(obj); 370 371 if (ret == 0) { 372 obj->fence_dirty =
+15 -1
drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c
··· 27 }; 28 29 static int 30 gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 31 struct nouveau_oclass *oclass, void *data, u32 size, 32 struct nouveau_object **pobject) ··· 62 .base.ofuncs = &(struct nouveau_ofuncs) { 63 .ctor = gk20a_fb_ctor, 64 .dtor = _nouveau_fb_dtor, 65 - .init = _nouveau_fb_init, 66 .fini = _nouveau_fb_fini, 67 }, 68 .memtype = nvc0_fb_memtype_valid,
··· 27 }; 28 29 static int 30 + gk20a_fb_init(struct nouveau_object *object) 31 + { 32 + struct gk20a_fb_priv *priv = (void *)object; 33 + int ret; 34 + 35 + ret = nouveau_fb_init(&priv->base); 36 + if (ret) 37 + return ret; 38 + 39 + nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ 40 + return 0; 41 + } 42 + 43 + static int 44 gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 45 struct nouveau_oclass *oclass, void *data, u32 size, 46 struct nouveau_object **pobject) ··· 48 .base.ofuncs = &(struct nouveau_ofuncs) { 49 .ctor = gk20a_fb_ctor, 50 .dtor = _nouveau_fb_dtor, 51 + .init = gk20a_fb_init, 52 .fini = _nouveau_fb_fini, 53 }, 54 .memtype = nvc0_fb_memtype_valid,
+23 -2
drivers/gpu/drm/nouveau/nv50_display.c
··· 791 } 792 793 static int 794 nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) 795 { 796 struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); ··· 1120 evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); 1121 evo_data(push, 0x00800000 | mode->clock); 1122 evo_data(push, (ilace == 2) ? 2 : 0); 1123 - evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 8); 1124 evo_data(push, 0x00000000); 1125 evo_data(push, (vactive << 16) | hactive); 1126 evo_data(push, ( vsynce << 16) | hsynce); 1127 evo_data(push, (vblanke << 16) | hblanke); 1128 evo_data(push, (vblanks << 16) | hblanks); 1129 evo_data(push, (vblan2e << 16) | vblan2s); 1130 - evo_data(push, vblankus); 1131 evo_data(push, 0x00000000); 1132 evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); 1133 evo_data(push, 0x00000311); ··· 1157 nv_connector = nouveau_crtc_connector_get(nv_crtc); 1158 nv50_crtc_set_dither(nv_crtc, false); 1159 nv50_crtc_set_scale(nv_crtc, false); 1160 nv50_crtc_set_color_vibrance(nv_crtc, false); 1161 nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); 1162 return 0;
··· 791 } 792 793 static int 794 + nv50_crtc_set_raster_vblank_dmi(struct nouveau_crtc *nv_crtc, u32 usec) 795 + { 796 + struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); 797 + u32 *push; 798 + 799 + push = evo_wait(mast, 8); 800 + if (!push) 801 + return -ENOMEM; 802 + 803 + evo_mthd(push, 0x0828 + (nv_crtc->index * 0x400), 1); 804 + evo_data(push, usec); 805 + evo_kick(push, mast); 806 + return 0; 807 + } 808 + 809 + static int 810 nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) 811 { 812 struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); ··· 1104 evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); 1105 evo_data(push, 0x00800000 | mode->clock); 1106 evo_data(push, (ilace == 2) ? 2 : 0); 1107 + evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 6); 1108 evo_data(push, 0x00000000); 1109 evo_data(push, (vactive << 16) | hactive); 1110 evo_data(push, ( vsynce << 16) | hsynce); 1111 evo_data(push, (vblanke << 16) | hblanke); 1112 evo_data(push, (vblanks << 16) | hblanks); 1113 evo_data(push, (vblan2e << 16) | vblan2s); 1114 + evo_mthd(push, 0x082c + (nv_crtc->index * 0x400), 1); 1115 evo_data(push, 0x00000000); 1116 evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); 1117 evo_data(push, 0x00000311); ··· 1141 nv_connector = nouveau_crtc_connector_get(nv_crtc); 1142 nv50_crtc_set_dither(nv_crtc, false); 1143 nv50_crtc_set_scale(nv_crtc, false); 1144 + 1145 + /* G94 only accepts this after setting scale */ 1146 + if (nv50_vers(mast) < GF110_DISP_CORE_CHANNEL_DMA) 1147 + nv50_crtc_set_raster_vblank_dmi(nv_crtc, vblankus); 1148 + 1149 nv50_crtc_set_color_vibrance(nv_crtc, false); 1150 nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); 1151 return 0;
+10 -1
drivers/gpu/drm/radeon/atom.c
··· 1217 return ret; 1218 } 1219 1220 - int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1221 { 1222 int r; 1223 ··· 1235 ctx->divmul[1] = 0; 1236 r = atom_execute_table_locked(ctx, index, params); 1237 mutex_unlock(&ctx->mutex); 1238 return r; 1239 } 1240
··· 1217 return ret; 1218 } 1219 1220 + int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uint32_t * params) 1221 { 1222 int r; 1223 ··· 1235 ctx->divmul[1] = 0; 1236 r = atom_execute_table_locked(ctx, index, params); 1237 mutex_unlock(&ctx->mutex); 1238 + return r; 1239 + } 1240 + 1241 + int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1242 + { 1243 + int r; 1244 + mutex_lock(&ctx->scratch_mutex); 1245 + r = atom_execute_table_scratch_unlocked(ctx, index, params); 1246 + mutex_unlock(&ctx->scratch_mutex); 1247 return r; 1248 } 1249
+2
drivers/gpu/drm/radeon/atom.h
··· 125 struct atom_context { 126 struct card_info *card; 127 struct mutex mutex; 128 void *bios; 129 uint32_t cmd_table, data_table; 130 uint16_t *iio; ··· 146 147 struct atom_context *atom_parse(struct card_info *, void *); 148 int atom_execute_table(struct atom_context *, int, uint32_t *); 149 int atom_asic_init(struct atom_context *); 150 void atom_destroy(struct atom_context *); 151 bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size,
··· 125 struct atom_context { 126 struct card_info *card; 127 struct mutex mutex; 128 + struct mutex scratch_mutex; 129 void *bios; 130 uint32_t cmd_table, data_table; 131 uint16_t *iio; ··· 145 146 struct atom_context *atom_parse(struct card_info *, void *); 147 int atom_execute_table(struct atom_context *, int, uint32_t *); 148 + int atom_execute_table_scratch_unlocked(struct atom_context *, int, uint32_t *); 149 int atom_asic_init(struct atom_context *); 150 void atom_destroy(struct atom_context *); 151 bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size,
+3 -1
drivers/gpu/drm/radeon/atombios_dp.c
··· 100 memset(&args, 0, sizeof(args)); 101 102 mutex_lock(&chan->mutex); 103 104 base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); 105 ··· 114 if (ASIC_IS_DCE4(rdev)) 115 args.v2.ucHPD_ID = chan->rec.hpd; 116 117 - atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 118 119 *ack = args.v1.ucReplyStatus; 120 ··· 148 149 r = recv_bytes; 150 done: 151 mutex_unlock(&chan->mutex); 152 153 return r;
··· 100 memset(&args, 0, sizeof(args)); 101 102 mutex_lock(&chan->mutex); 103 + mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); 104 105 base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); 106 ··· 113 if (ASIC_IS_DCE4(rdev)) 114 args.v2.ucHPD_ID = chan->rec.hpd; 115 116 + atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); 117 118 *ack = args.v1.ucReplyStatus; 119 ··· 147 148 r = recv_bytes; 149 done: 150 + mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); 151 mutex_unlock(&chan->mutex); 152 153 return r;
+3 -1
drivers/gpu/drm/radeon/atombios_i2c.c
··· 48 memset(&args, 0, sizeof(args)); 49 50 mutex_lock(&chan->mutex); 51 52 base = (unsigned char *)rdev->mode_info.atom_context->scratch; 53 ··· 83 args.ucSlaveAddr = slave_addr << 1; 84 args.ucLineNumber = chan->rec.i2c_id; 85 86 - atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 87 88 /* error */ 89 if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { ··· 96 radeon_atom_copy_swap(buf, base, num, false); 97 98 done: 99 mutex_unlock(&chan->mutex); 100 101 return r;
··· 48 memset(&args, 0, sizeof(args)); 49 50 mutex_lock(&chan->mutex); 51 + mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); 52 53 base = (unsigned char *)rdev->mode_info.atom_context->scratch; 54 ··· 82 args.ucSlaveAddr = slave_addr << 1; 83 args.ucLineNumber = chan->rec.i2c_id; 84 85 + atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); 86 87 /* error */ 88 if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { ··· 95 radeon_atom_copy_swap(buf, base, num, false); 96 97 done: 98 + mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); 99 mutex_unlock(&chan->mutex); 100 101 return r;
+1
drivers/gpu/drm/radeon/radeon_device.c
··· 952 } 953 954 mutex_init(&rdev->mode_info.atom_context->mutex); 955 radeon_atom_initialize_bios_scratch_regs(rdev->ddev); 956 atom_allocate_fb_scratch(rdev->mode_info.atom_context); 957 return 0;
··· 952 } 953 954 mutex_init(&rdev->mode_info.atom_context->mutex); 955 + mutex_init(&rdev->mode_info.atom_context->scratch_mutex); 956 radeon_atom_initialize_bios_scratch_regs(rdev->ddev); 957 atom_allocate_fb_scratch(rdev->mode_info.atom_context); 958 return 0;
+4 -5
drivers/gpu/drm/tegra/dc.c
··· 736 737 static void tegra_crtc_disable(struct drm_crtc *crtc) 738 { 739 - struct tegra_dc *dc = to_tegra_dc(crtc); 740 struct drm_device *drm = crtc->dev; 741 struct drm_plane *plane; 742 ··· 751 } 752 } 753 754 - drm_vblank_off(drm, dc->pipe); 755 } 756 757 static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, ··· 840 u32 value; 841 int err; 842 843 - drm_vblank_pre_modeset(crtc->dev, dc->pipe); 844 - 845 err = tegra_crtc_setup_clk(crtc, mode); 846 if (err) { 847 dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); ··· 893 unsigned int syncpt; 894 unsigned long value; 895 896 /* hardware initialization */ 897 reset_control_deassert(dc->rst); 898 usleep_range(10000, 20000); ··· 942 value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; 943 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); 944 945 - drm_vblank_post_modeset(crtc->dev, dc->pipe); 946 } 947 948 static void tegra_crtc_load_lut(struct drm_crtc *crtc)
··· 736 737 static void tegra_crtc_disable(struct drm_crtc *crtc) 738 { 739 struct drm_device *drm = crtc->dev; 740 struct drm_plane *plane; 741 ··· 752 } 753 } 754 755 + drm_crtc_vblank_off(crtc); 756 } 757 758 static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, ··· 841 u32 value; 842 int err; 843 844 err = tegra_crtc_setup_clk(crtc, mode); 845 if (err) { 846 dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); ··· 896 unsigned int syncpt; 897 unsigned long value; 898 899 + drm_crtc_vblank_off(crtc); 900 + 901 /* hardware initialization */ 902 reset_control_deassert(dc->rst); 903 usleep_range(10000, 20000); ··· 943 value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; 944 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); 945 946 + drm_crtc_vblank_on(crtc); 947 } 948 949 static void tegra_crtc_load_lut(struct drm_crtc *crtc)