Skip to content

Commit b882dda

Browse files
Ben Skeggsgregkh
authored andcommitted
drm/nouveau/kms/nv50: workaround EFI GOP window channel format differences
[ Upstream commit e78b1b5 ] Should fix some initial modeset failures on (at least) Ampere boards. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7f422cd commit b882dda

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,33 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
22022202
interlock[NV50_DISP_INTERLOCK_CORE] = 0;
22032203
}
22042204

2205+
/* Finish updating head(s)...
2206+
*
2207+
* NVD is rather picky about both where window assignments can change,
2208+
* *and* about certain core and window channel states matching.
2209+
*
2210+
* The EFI GOP driver on newer GPUs configures window channels with a
2211+
* different output format to what we do, and the core channel update
2212+
* in the assign_windows case above would result in a state mismatch.
2213+
*
2214+
* Delay some of the head update until after that point to workaround
2215+
* the issue. This only affects the initial modeset.
2216+
*
2217+
* TODO: handle this better when adding flexible window mapping
2218+
*/
2219+
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
2220+
struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
2221+
struct nv50_head *head = nv50_head(crtc);
2222+
2223+
NV_ATOMIC(drm, "%s: set %04x (clr %04x)\n", crtc->name,
2224+
asyh->set.mask, asyh->clr.mask);
2225+
2226+
if (asyh->set.mask) {
2227+
nv50_head_flush_set_wndw(head, asyh);
2228+
interlock[NV50_DISP_INTERLOCK_CORE] = 1;
2229+
}
2230+
}
2231+
22052232
/* Update plane(s). */
22062233
for_each_new_plane_in_state(state, plane, new_plane_state, i) {
22072234
struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);

‎drivers/gpu/drm/nouveau/dispnv50/head.c‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,23 @@ nv50_head_flush_clr(struct nv50_head *head,
4949
}
5050

5151
void
52-
nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh)
52+
nv50_head_flush_set_wndw(struct nv50_head *head, struct nv50_head_atom *asyh)
5353
{
54-
if (asyh->set.view ) head->func->view (head, asyh);
55-
if (asyh->set.mode ) head->func->mode (head, asyh);
56-
if (asyh->set.core ) head->func->core_set(head, asyh);
5754
if (asyh->set.olut ) {
5855
asyh->olut.offset = nv50_lut_load(&head->olut,
5956
asyh->olut.buffer,
6057
asyh->state.gamma_lut,
6158
asyh->olut.load);
6259
head->func->olut_set(head, asyh);
6360
}
61+
}
62+
63+
void
64+
nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh)
65+
{
66+
if (asyh->set.view ) head->func->view (head, asyh);
67+
if (asyh->set.mode ) head->func->mode (head, asyh);
68+
if (asyh->set.core ) head->func->core_set(head, asyh);
6469
if (asyh->set.curs ) head->func->curs_set(head, asyh);
6570
if (asyh->set.base ) head->func->base (head, asyh);
6671
if (asyh->set.ovly ) head->func->ovly (head, asyh);

‎drivers/gpu/drm/nouveau/dispnv50/head.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct nv50_head {
2121

2222
struct nv50_head *nv50_head_create(struct drm_device *, int index);
2323
void nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh);
24+
void nv50_head_flush_set_wndw(struct nv50_head *head, struct nv50_head_atom *asyh);
2425
void nv50_head_flush_clr(struct nv50_head *head,
2526
struct nv50_head_atom *asyh, bool flush);
2627

0 commit comments

Comments
 (0)