drm nouveau fixes for 5.10-rc4

nouveau:
 - atomic modesetting regression fix
 - ttm pre-nv50 fix
 - connector NULL ptr deref fix
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJfsZIJAAoJEAx081l5xIa+2HkP/AzENGcpenWcpJf+qabAGS7B
 3ofu7AOFjLsnXT3PFGEPsoWCk4v0Eu9o0E9V2xevVVwDdoNue+fZ9cHkIoNsD6cL
 iDOmZPWcmyuAKDJedBESAP9ivjzmRVOwCPaTWINuhkOqFBgEmBXT/npLyg5iT36l
 vYWx1MCFGNvFadTfiBbwc+rNi1qNhPX3+TEUD0Tki7UUkB6Q+Yzifc5KSQAHmxnq
 ACdeKB6uHWvQzzw4dLYYm5I2iUfqpnC++otqjAtpjhiIx2Iuus1vZWiyTK2WfAEy
 Q7R4DkI4u9r/BiiAxoAjiSceyaAxL2dlbDyMr6dfoGQrffzaiM6UOHwB9FaSfe2b
 G5s7VJEQj1Bl42OvVuH+X8iZlzkPhh4SXfP02/nDhnYhz6agcLOFndcLGCeHp4AX
 Om5RPMH23p7bHJ92YqvTHzgCZHtG4SXc/fUG8KLFlRd+6Xgbl7mprfO/+H8Jvyt/
 nrLzITNksvXY3zPXOrMERzNo0658sj4KuxOOXwz/eRDTah2DQe0xxu5tMRzUiclm
 plC4zEmRLusIcyrM7Aa8APh5GxsJ4eyOj2wx5V508eUhFIEyZ/ia83K/7olUG7/+
 HGXTHtF3qd3CejGtya27ejgiNXRUTqniUvFFT8VQqISocEJ8R2zEO6FH0cdk+rnL
 7baFeSvHzSfEEc3Wmls8
 =bjmv
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2020-11-15 13:07:36 -08:00
commit a6af8718b9
3 changed files with 24 additions and 22 deletions

View File

@ -455,7 +455,7 @@ nv50_outp_get_old_connector(struct nouveau_encoder *outp,
* DAC * DAC
*****************************************************************************/ *****************************************************************************/
static void static void
nv50_dac_disable(struct drm_encoder *encoder) nv50_dac_disable(struct drm_encoder *encoder, struct drm_atomic_state *state)
{ {
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nv50_core *core = nv50_disp(encoder->dev)->core; struct nv50_core *core = nv50_disp(encoder->dev)->core;
@ -467,7 +467,7 @@ nv50_dac_disable(struct drm_encoder *encoder)
} }
static void static void
nv50_dac_enable(struct drm_encoder *encoder) nv50_dac_enable(struct drm_encoder *encoder, struct drm_atomic_state *state)
{ {
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
@ -525,8 +525,8 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
static const struct drm_encoder_helper_funcs static const struct drm_encoder_helper_funcs
nv50_dac_help = { nv50_dac_help = {
.atomic_check = nv50_outp_atomic_check, .atomic_check = nv50_outp_atomic_check,
.enable = nv50_dac_enable, .atomic_enable = nv50_dac_enable,
.disable = nv50_dac_disable, .atomic_disable = nv50_dac_disable,
.detect = nv50_dac_detect .detect = nv50_dac_detect
}; };
@ -1055,7 +1055,7 @@ nv50_dp_bpc_to_depth(unsigned int bpc)
} }
static void static void
nv50_msto_enable(struct drm_encoder *encoder) nv50_msto_enable(struct drm_encoder *encoder, struct drm_atomic_state *state)
{ {
struct nv50_head *head = nv50_head(encoder->crtc); struct nv50_head *head = nv50_head(encoder->crtc);
struct nv50_head_atom *armh = nv50_head_atom(head->base.base.state); struct nv50_head_atom *armh = nv50_head_atom(head->base.base.state);
@ -1101,7 +1101,7 @@ nv50_msto_enable(struct drm_encoder *encoder)
} }
static void static void
nv50_msto_disable(struct drm_encoder *encoder) nv50_msto_disable(struct drm_encoder *encoder, struct drm_atomic_state *state)
{ {
struct nv50_msto *msto = nv50_msto(encoder); struct nv50_msto *msto = nv50_msto(encoder);
struct nv50_mstc *mstc = msto->mstc; struct nv50_mstc *mstc = msto->mstc;
@ -1118,8 +1118,8 @@ nv50_msto_disable(struct drm_encoder *encoder)
static const struct drm_encoder_helper_funcs static const struct drm_encoder_helper_funcs
nv50_msto_help = { nv50_msto_help = {
.disable = nv50_msto_disable, .atomic_disable = nv50_msto_disable,
.enable = nv50_msto_enable, .atomic_enable = nv50_msto_enable,
.atomic_check = nv50_msto_atomic_check, .atomic_check = nv50_msto_atomic_check,
}; };
@ -1645,8 +1645,7 @@ nv50_sor_disable(struct drm_encoder *encoder,
} }
static void static void
nv50_sor_enable(struct drm_encoder *encoder, nv50_sor_enable(struct drm_encoder *encoder, struct drm_atomic_state *state)
struct drm_atomic_state *state)
{ {
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
@ -1873,7 +1872,7 @@ nv50_pior_atomic_check(struct drm_encoder *encoder,
} }
static void static void
nv50_pior_disable(struct drm_encoder *encoder) nv50_pior_disable(struct drm_encoder *encoder, struct drm_atomic_state *state)
{ {
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nv50_core *core = nv50_disp(encoder->dev)->core; struct nv50_core *core = nv50_disp(encoder->dev)->core;
@ -1885,7 +1884,7 @@ nv50_pior_disable(struct drm_encoder *encoder)
} }
static void static void
nv50_pior_enable(struct drm_encoder *encoder) nv50_pior_enable(struct drm_encoder *encoder, struct drm_atomic_state *state)
{ {
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc); struct nouveau_crtc *nv_crtc = nouveau_crtc(encoder->crtc);
@ -1921,14 +1920,14 @@ nv50_pior_enable(struct drm_encoder *encoder)
} }
core->func->pior->ctrl(core, nv_encoder->or, ctrl, asyh); core->func->pior->ctrl(core, nv_encoder->or, ctrl, asyh);
nv_encoder->crtc = encoder->crtc; nv_encoder->crtc = &nv_crtc->base;
} }
static const struct drm_encoder_helper_funcs static const struct drm_encoder_helper_funcs
nv50_pior_help = { nv50_pior_help = {
.atomic_check = nv50_pior_atomic_check, .atomic_check = nv50_pior_atomic_check,
.enable = nv50_pior_enable, .atomic_enable = nv50_pior_enable,
.disable = nv50_pior_disable, .atomic_disable = nv50_pior_disable,
}; };
static void static void

View File

@ -350,14 +350,13 @@ set_placement_list(struct nouveau_drm *drm, struct ttm_place *pl, unsigned *n,
if (domain & NOUVEAU_GEM_DOMAIN_VRAM) { if (domain & NOUVEAU_GEM_DOMAIN_VRAM) {
struct nvif_mmu *mmu = &drm->client.mmu; struct nvif_mmu *mmu = &drm->client.mmu;
const u8 type = mmu->type[drm->ttm.type_vram].type;
pl[*n].mem_type = TTM_PL_VRAM; pl[*n].mem_type = TTM_PL_VRAM;
pl[*n].flags = flags & ~TTM_PL_FLAG_CACHED; pl[*n].flags = flags & ~TTM_PL_FLAG_CACHED;
/* Some BARs do not support being ioremapped WC */ /* Some BARs do not support being ioremapped WC */
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA && if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA &&
type & NVIF_MEM_UNCACHED) mmu->type[drm->ttm.type_vram].type & NVIF_MEM_UNCACHED)
pl[*n].flags &= ~TTM_PL_FLAG_WC; pl[*n].flags &= ~TTM_PL_FLAG_WC;
(*n)++; (*n)++;

View File

@ -532,11 +532,13 @@ static void
nouveau_connector_set_edid(struct nouveau_connector *nv_connector, nouveau_connector_set_edid(struct nouveau_connector *nv_connector,
struct edid *edid) struct edid *edid)
{ {
struct edid *old_edid = nv_connector->edid; if (nv_connector->edid != edid) {
struct edid *old_edid = nv_connector->edid;
drm_connector_update_edid_property(&nv_connector->base, edid); drm_connector_update_edid_property(&nv_connector->base, edid);
kfree(old_edid); kfree(old_edid);
nv_connector->edid = edid; nv_connector->edid = edid;
}
} }
static enum drm_connector_status static enum drm_connector_status
@ -669,8 +671,10 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)
/* Try retrieving EDID via DDC */ /* Try retrieving EDID via DDC */
if (!drm->vbios.fp_no_ddc) { if (!drm->vbios.fp_no_ddc) {
status = nouveau_connector_detect(connector, force); status = nouveau_connector_detect(connector, force);
if (status == connector_status_connected) if (status == connector_status_connected) {
edid = nv_connector->edid;
goto out; goto out;
}
} }
/* On some laptops (Sony, i'm looking at you) there appears to /* On some laptops (Sony, i'm looking at you) there appears to