Skip to content

Commit 3f29eac

Browse files
committed
Merge branch 'linux-5.8' of git://github.com/skeggsb/linux into drm-next
- HDMI/DP audio HDA fixes - display hang fix for Volta/Turing - GK20A regression fix. Signed-off-by: Dave Airlie <[email protected]> From: Ben Skeggs <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/ <CACAvsv4PW6tAZY6Uvrhi5OV+4rDXvrtNcoq2w_i35YajByj+ew@mail.gmail.com
2 parents 9ca1f47 + dd67cab commit 3f29eac

File tree

17 files changed

+276
-41
lines changed

17 files changed

+276
-41
lines changed

drivers/gpu/drm/nouveau/dispnv50/disp.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ nv50_outp_release(struct nouveau_encoder *nv_encoder)
277277
}
278278

279279
static int
280-
nv50_outp_acquire(struct nouveau_encoder *nv_encoder)
280+
nv50_outp_acquire(struct nouveau_encoder *nv_encoder, bool hda)
281281
{
282282
struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
283283
struct nv50_disp *disp = nv50_disp(drm->dev);
@@ -289,6 +289,7 @@ nv50_outp_acquire(struct nouveau_encoder *nv_encoder)
289289
.base.method = NV50_DISP_MTHD_V1_ACQUIRE,
290290
.base.hasht = nv_encoder->dcb->hasht,
291291
.base.hashm = nv_encoder->dcb->hashm,
292+
.info.hda = hda,
292293
};
293294
int ret;
294295

@@ -393,7 +394,7 @@ nv50_dac_enable(struct drm_encoder *encoder)
393394
struct nv50_head_atom *asyh = nv50_head_atom(nv_crtc->base.state);
394395
struct nv50_core *core = nv50_disp(encoder->dev)->core;
395396

396-
nv50_outp_acquire(nv_encoder);
397+
nv50_outp_acquire(nv_encoder, false);
397398

398399
core->func->dac->ctrl(core, nv_encoder->or, 1 << nv_crtc->index, asyh);
399400
asyh->or.depth = 0;
@@ -510,7 +511,7 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id,
510511
if (!nv_connector || !nv_crtc || nv_encoder->or != port ||
511512
nv_crtc->index != dev_id)
512513
continue;
513-
*enabled = drm_detect_monitor_audio(nv_connector->edid);
514+
*enabled = nv_encoder->audio;
514515
if (*enabled) {
515516
ret = drm_eld_size(nv_connector->base.eld);
516517
memcpy(buf, nv_connector->base.eld,
@@ -600,6 +601,7 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
600601
(0x0100 << nv_crtc->index),
601602
};
602603

604+
nv_encoder->audio = false;
603605
nvif_mthd(&disp->disp->object, 0, &args, sizeof(args));
604606

605607
nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
@@ -636,6 +638,7 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
636638

637639
nvif_mthd(&disp->disp->object, 0, &args,
638640
sizeof(args.base) + drm_eld_size(args.data));
641+
nv_encoder->audio = true;
639642

640643
nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
641644
nv_crtc->index);
@@ -966,7 +969,7 @@ nv50_msto_enable(struct drm_encoder *encoder)
966969
DRM_DEBUG_KMS("Failed to allocate VCPI\n");
967970

968971
if (!mstm->links++)
969-
nv50_outp_acquire(mstm->outp);
972+
nv50_outp_acquire(mstm->outp, false /*XXX: MST audio.*/);
970973

971974
if (mstm->outp->link & 1)
972975
proto = 0x8;
@@ -1560,12 +1563,18 @@ nv50_sor_enable(struct drm_encoder *encoder)
15601563
struct nouveau_drm *drm = nouveau_drm(dev);
15611564
struct nouveau_connector *nv_connector;
15621565
struct nvbios *bios = &drm->vbios;
1566+
bool hda = false;
15631567
u8 proto = 0xf;
15641568
u8 depth = 0x0;
15651569

15661570
nv_connector = nouveau_encoder_connector_get(nv_encoder);
15671571
nv_encoder->crtc = encoder->crtc;
1568-
nv50_outp_acquire(nv_encoder);
1572+
1573+
if ((disp->disp->object.oclass == GT214_DISP ||
1574+
disp->disp->object.oclass >= GF110_DISP) &&
1575+
drm_detect_monitor_audio(nv_connector->edid))
1576+
hda = true;
1577+
nv50_outp_acquire(nv_encoder, hda);
15691578

15701579
switch (nv_encoder->dcb->type) {
15711580
case DCB_OUTPUT_TMDS:
@@ -1775,7 +1784,7 @@ nv50_pior_enable(struct drm_encoder *encoder)
17751784
u8 owner = 1 << nv_crtc->index;
17761785
u8 proto;
17771786

1778-
nv50_outp_acquire(nv_encoder);
1787+
nv50_outp_acquire(nv_encoder, false);
17791788

17801789
switch (asyh->or.bpc) {
17811790
case 10: asyh->or.depth = 0x6; break;

drivers/gpu/drm/nouveau/dispnv50/wndw.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ nv50_wndw_atomic_check_release(struct nv50_wndw *wndw,
192192
wndw->func->release(wndw, asyw, asyh);
193193
asyw->ntfy.handle = 0;
194194
asyw->sema.handle = 0;
195+
asyw->xlut.handle = 0;
196+
memset(asyw->image.handle, 0x00, sizeof(asyw->image.handle));
195197
}
196198

197199
static int
@@ -519,7 +521,8 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state)
519521
return PTR_ERR(ctxdma);
520522
}
521523

522-
asyw->image.handle[0] = ctxdma->object.handle;
524+
if (asyw->visible)
525+
asyw->image.handle[0] = ctxdma->object.handle;
523526
}
524527

525528
asyw->state.fence = dma_resv_get_excl_rcu(nvbo->bo.base.resv);

drivers/gpu/drm/nouveau/include/nvif/cl5070.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ struct nv50_disp_acquire_v0 {
4646
__u8 version;
4747
__u8 or;
4848
__u8 link;
49-
__u8 pad03[5];
49+
__u8 hda;
50+
__u8 pad04[4];
5051
};
5152

5253
struct nv50_disp_dac_load_v0 {

drivers/gpu/drm/nouveau/nouveau_encoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct nouveau_encoder {
5252
* actually programmed on the hw, not the proposed crtc */
5353
struct drm_crtc *crtc;
5454
u32 ctrl;
55+
bool audio;
5556

5657
struct drm_display_mode mode;
5758
int last_dpms;

drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ nvkm-y += nvkm/engine/disp/sorgf119.o
3939
nvkm-y += nvkm/engine/disp/sorgk104.o
4040
nvkm-y += nvkm/engine/disp/sorgm107.o
4141
nvkm-y += nvkm/engine/disp/sorgm200.o
42+
nvkm-y += nvkm/engine/disp/sorgp100.o
4243
nvkm-y += nvkm/engine/disp/sorgv100.o
4344
nvkm-y += nvkm/engine/disp/sortu102.o
4445

drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ gp100_disp = {
3636
.super = gf119_disp_super,
3737
.root = &gp100_disp_root_oclass,
3838
.head = { .cnt = gf119_head_cnt, .new = gf119_head_new },
39-
.sor = { .cnt = gf119_sor_cnt, .new = gm200_sor_new },
39+
.sor = { .cnt = gf119_sor_cnt, .new = gp100_sor_new },
4040
};
4141

4242
int

drivers/gpu/drm/nouveau/nvkm/engine/disp/gp102.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ gp102_disp = {
6363
.super = gf119_disp_super,
6464
.root = &gp102_disp_root_oclass,
6565
.head = { .cnt = gf119_head_cnt, .new = gf119_head_new },
66-
.sor = { .cnt = gf119_sor_cnt, .new = gm200_sor_new },
66+
.sor = { .cnt = gf119_sor_cnt, .new = gp100_sor_new },
6767
};
6868

6969
int

drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ void
2727
gm200_hdmi_scdc(struct nvkm_ior *ior, int head, u8 scdc)
2828
{
2929
struct nvkm_device *device = ior->disp->engine.subdev.device;
30-
const u32 hoff = head * 0x800;
30+
const u32 soff = nv50_ior_base(ior);
3131
const u32 ctrl = scdc & 0x3;
3232

33-
nvkm_mask(device, 0x61c5bc + hoff, 0x00000003, ctrl);
33+
nvkm_mask(device, 0x61c5bc + soff, 0x00000003, ctrl);
3434

3535
ior->tmds.high_speed = !!(scdc & 0x2);
3636
}

drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ int gf119_sor_new(struct nvkm_disp *, int);
201201
int gk104_sor_new(struct nvkm_disp *, int);
202202
int gm107_sor_new(struct nvkm_disp *, int);
203203
int gm200_sor_new(struct nvkm_disp *, int);
204+
int gp100_sor_new(struct nvkm_disp *, int);
204205

205206
int gv100_sor_cnt(struct nvkm_disp *, unsigned long *);
206207
int gv100_sor_new(struct nvkm_disp *, int);

drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,44 @@ nvkm_outp_acquire_ior(struct nvkm_outp *outp, u8 user, struct nvkm_ior *ior)
111111
return 0;
112112
}
113113

114+
static inline int
115+
nvkm_outp_acquire_hda(struct nvkm_outp *outp, enum nvkm_ior_type type,
116+
u8 user, bool hda)
117+
{
118+
struct nvkm_ior *ior;
119+
120+
/* First preference is to reuse the OR that is currently armed
121+
* on HW, if any, in order to prevent unnecessary switching.
122+
*/
123+
list_for_each_entry(ior, &outp->disp->ior, head) {
124+
if (!ior->identity && !!ior->func->hda.hpd == hda &&
125+
!ior->asy.outp && ior->arm.outp == outp)
126+
return nvkm_outp_acquire_ior(outp, user, ior);
127+
}
128+
129+
/* Failing that, a completely unused OR is the next best thing. */
130+
list_for_each_entry(ior, &outp->disp->ior, head) {
131+
if (!ior->identity && !!ior->func->hda.hpd == hda &&
132+
!ior->asy.outp && ior->type == type && !ior->arm.outp &&
133+
(ior->func->route.set || ior->id == __ffs(outp->info.or)))
134+
return nvkm_outp_acquire_ior(outp, user, ior);
135+
}
136+
137+
/* Last resort is to assign an OR that's already active on HW,
138+
* but will be released during the next modeset.
139+
*/
140+
list_for_each_entry(ior, &outp->disp->ior, head) {
141+
if (!ior->identity && !!ior->func->hda.hpd == hda &&
142+
!ior->asy.outp && ior->type == type &&
143+
(ior->func->route.set || ior->id == __ffs(outp->info.or)))
144+
return nvkm_outp_acquire_ior(outp, user, ior);
145+
}
146+
147+
return -ENOSPC;
148+
}
149+
114150
int
115-
nvkm_outp_acquire(struct nvkm_outp *outp, u8 user)
151+
nvkm_outp_acquire(struct nvkm_outp *outp, u8 user, bool hda)
116152
{
117153
struct nvkm_ior *ior = outp->ior;
118154
enum nvkm_ior_proto proto;
@@ -137,32 +173,25 @@ nvkm_outp_acquire(struct nvkm_outp *outp, u8 user)
137173
return nvkm_outp_acquire_ior(outp, user, ior);
138174
}
139175

140-
/* First preference is to reuse the OR that is currently armed
141-
* on HW, if any, in order to prevent unnecessary switching.
176+
/* If we don't need HDA, first try to acquire an OR that doesn't
177+
* support it to leave free the ones that do.
142178
*/
143-
list_for_each_entry(ior, &outp->disp->ior, head) {
144-
if (!ior->identity && !ior->asy.outp && ior->arm.outp == outp)
145-
return nvkm_outp_acquire_ior(outp, user, ior);
146-
}
179+
if (!hda) {
180+
if (!nvkm_outp_acquire_hda(outp, type, user, false))
181+
return 0;
147182

148-
/* Failing that, a completely unused OR is the next best thing. */
149-
list_for_each_entry(ior, &outp->disp->ior, head) {
150-
if (!ior->identity &&
151-
!ior->asy.outp && ior->type == type && !ior->arm.outp &&
152-
(ior->func->route.set || ior->id == __ffs(outp->info.or)))
153-
return nvkm_outp_acquire_ior(outp, user, ior);
183+
/* Use a HDA-supporting SOR anyway. */
184+
return nvkm_outp_acquire_hda(outp, type, user, true);
154185
}
155186

156-
/* Last resort is to assign an OR that's already active on HW,
157-
* but will be released during the next modeset.
158-
*/
159-
list_for_each_entry(ior, &outp->disp->ior, head) {
160-
if (!ior->identity && !ior->asy.outp && ior->type == type &&
161-
(ior->func->route.set || ior->id == __ffs(outp->info.or)))
162-
return nvkm_outp_acquire_ior(outp, user, ior);
163-
}
187+
/* We want HDA, try to acquire an OR that supports it. */
188+
if (!nvkm_outp_acquire_hda(outp, type, user, true))
189+
return 0;
164190

165-
return -ENOSPC;
191+
/* There weren't any free ORs that support HDA, grab one that
192+
* doesn't and at least allow display to work still.
193+
*/
194+
return nvkm_outp_acquire_hda(outp, type, user, false);
166195
}
167196

168197
void

0 commit comments

Comments
 (0)