Merge tag 'drm-fixes-2020-11-16' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Dave Airlie:
"Nouveau fixes:

- atomic modesetting regression fix

- ttm pre-nv50 fix

- connector NULL ptr deref fix"

* tag 'drm-fixes-2020-11-16' of git://anongit.freedesktop.org/drm/drm:
drm/nouveau/kms/nv50-: Use atomic encoder callbacks everywhere
drm/nouveau/ttm: avoid using nouveau_drm.ttm.type_vram prior to nv50
drm/nouveau/kms: Fix NULL pointer dereference in nouveau_connector_detect_depth

Changed files
+24 -22
drivers
gpu
drm
+14 -15
drivers/gpu/drm/nouveau/dispnv50/disp.c
··· 455 455 * DAC 456 456 *****************************************************************************/ 457 457 static void 458 - nv50_dac_disable(struct drm_encoder *encoder) 458 + nv50_dac_disable(struct drm_encoder *encoder, struct drm_atomic_state *state) 459 459 { 460 460 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 461 461 struct nv50_core *core = nv50_disp(encoder->dev)->core; ··· 467 467 } 468 468 469 469 static void 470 - nv50_dac_enable(struct drm_encoder *encoder) 470 + nv50_dac_enable(struct drm_encoder *encoder, struct drm_atomic_state *state) 471 471 { 472 472 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 473 473 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); ··· 525 525 static const struct drm_encoder_helper_funcs 526 526 nv50_dac_help = { 527 527 .atomic_check = nv50_outp_atomic_check, 528 - .enable = nv50_dac_enable, 529 - .disable = nv50_dac_disable, 528 + .atomic_enable = nv50_dac_enable, 529 + .atomic_disable = nv50_dac_disable, 530 530 .detect = nv50_dac_detect 531 531 }; 532 532 ··· 1055 1055 } 1056 1056 1057 1057 static void 1058 - nv50_msto_enable(struct drm_encoder *encoder) 1058 + nv50_msto_enable(struct drm_encoder *encoder, struct drm_atomic_state *state) 1059 1059 { 1060 1060 struct nv50_head *head = nv50_head(encoder->crtc); 1061 1061 struct nv50_head_atom *armh = nv50_head_atom(head->base.base.state); ··· 1101 1101 } 1102 1102 1103 1103 static void 1104 - nv50_msto_disable(struct drm_encoder *encoder) 1104 + nv50_msto_disable(struct drm_encoder *encoder, struct drm_atomic_state *state) 1105 1105 { 1106 1106 struct nv50_msto *msto = nv50_msto(encoder); 1107 1107 struct nv50_mstc *mstc = msto->mstc; ··· 1118 1118 1119 1119 static const struct drm_encoder_helper_funcs 1120 1120 nv50_msto_help = { 1121 - .disable = nv50_msto_disable, 1122 - .enable = nv50_msto_enable, 1121 + .atomic_disable = nv50_msto_disable, 1122 + .atomic_enable = nv50_msto_enable, 1123 1123 .atomic_check = nv50_msto_atomic_check, 1124 1124 }; 1125 1125 ··· 1645 1645 } 1646 1646 1647 1647 static void 1648 - nv50_sor_enable(struct drm_encoder *encoder, 1649 - struct drm_atomic_state *state) 1648 + nv50_sor_enable(struct drm_encoder *encoder, struct drm_atomic_state *state) 1650 1649 { 1651 1650 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 1652 1651 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); ··· 1872 1873 } 1873 1874 1874 1875 static void 1875 - nv50_pior_disable(struct drm_encoder *encoder) 1876 + nv50_pior_disable(struct drm_encoder *encoder, struct drm_atomic_state *state) 1876 1877 { 1877 1878 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 1878 1879 struct nv50_core *core = nv50_disp(encoder->dev)->core; ··· 1884 1885 } 1885 1886 1886 1887 static void 1887 - nv50_pior_enable(struct drm_encoder *encoder) 1888 + nv50_pior_enable(struct drm_encoder *encoder, struct drm_atomic_state *state) 1888 1889 { 1889 1890 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 1890 1891 struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); ··· 1920 1921 } 1921 1922 1922 1923 core->func->pior->ctrl(core, nv_encoder->or, ctrl, asyh); 1923 - nv_encoder->crtc = encoder->crtc; 1924 + nv_encoder->crtc = &nv_crtc->base; 1924 1925 } 1925 1926 1926 1927 static const struct drm_encoder_helper_funcs 1927 1928 nv50_pior_help = { 1928 1929 .atomic_check = nv50_pior_atomic_check, 1929 - .enable = nv50_pior_enable, 1930 - .disable = nv50_pior_disable, 1930 + .atomic_enable = nv50_pior_enable, 1931 + .atomic_disable = nv50_pior_disable, 1931 1932 }; 1932 1933 1933 1934 static void
+1 -2
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 350 350 351 351 if (domain & NOUVEAU_GEM_DOMAIN_VRAM) { 352 352 struct nvif_mmu *mmu = &drm->client.mmu; 353 - const u8 type = mmu->type[drm->ttm.type_vram].type; 354 353 355 354 pl[*n].mem_type = TTM_PL_VRAM; 356 355 pl[*n].flags = flags & ~TTM_PL_FLAG_CACHED; 357 356 358 357 /* Some BARs do not support being ioremapped WC */ 359 358 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA && 360 - type & NVIF_MEM_UNCACHED) 359 + mmu->type[drm->ttm.type_vram].type & NVIF_MEM_UNCACHED) 361 360 pl[*n].flags &= ~TTM_PL_FLAG_WC; 362 361 363 362 (*n)++;
+9 -5
drivers/gpu/drm/nouveau/nouveau_connector.c
··· 532 532 nouveau_connector_set_edid(struct nouveau_connector *nv_connector, 533 533 struct edid *edid) 534 534 { 535 - struct edid *old_edid = nv_connector->edid; 535 + if (nv_connector->edid != edid) { 536 + struct edid *old_edid = nv_connector->edid; 536 537 537 - drm_connector_update_edid_property(&nv_connector->base, edid); 538 - kfree(old_edid); 539 - nv_connector->edid = edid; 538 + drm_connector_update_edid_property(&nv_connector->base, edid); 539 + kfree(old_edid); 540 + nv_connector->edid = edid; 541 + } 540 542 } 541 543 542 544 static enum drm_connector_status ··· 671 669 /* Try retrieving EDID via DDC */ 672 670 if (!drm->vbios.fp_no_ddc) { 673 671 status = nouveau_connector_detect(connector, force); 674 - if (status == connector_status_connected) 672 + if (status == connector_status_connected) { 673 + edid = nv_connector->edid; 675 674 goto out; 675 + } 676 676 } 677 677 678 678 /* On some laptops (Sony, i'm looking at you) there appears to