Skip to content

Commit dd22dfa

Browse files
committed
Merge branch 'linux-5.6' of git://github.com/skeggsb/linux into drm-next
- Rewrite of the ACR (formerly "secure boot") code, both to support Turing, support multiple FW revisions, and to make life easier when having to debug HW/FW bring-up in the future - Support for TU10x graphics engine, TU11x not available yet as FW isn't ready - Proper page 'kind' mappings for Turing - 10-bit LUT support - GP10B (Tegra) fixes - Misc other fixes Signed-off-by: Dave Airlie <[email protected]> From: Ben Skeggs <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/ <CACAvsv5GKasg9-hEUwp9+aHVJg+nbQ0LukXyudgj6=YKu96jWQ@mail.gmail.com
2 parents 6fc376f + afa3b96 commit dd22dfa

File tree

208 files changed

+8123
-7774
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+8123
-7774
lines changed

drivers/gpu/drm/nouveau/dispnv04/arb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void
5454
nv04_calc_arb(struct nv_fifo_info *fifo, struct nv_sim_state *arb)
5555
{
5656
int pagemiss, cas, width, bpp;
57-
int nvclks, mclks, pclks, crtpagemiss;
57+
int nvclks, mclks, crtpagemiss;
5858
int found, mclk_extra, mclk_loop, cbs, m1, p1;
5959
int mclk_freq, pclk_freq, nvclk_freq;
6060
int us_m, us_n, us_p, crtc_drain_rate;
@@ -69,7 +69,6 @@ nv04_calc_arb(struct nv_fifo_info *fifo, struct nv_sim_state *arb)
6969
bpp = arb->bpp;
7070
cbs = 128;
7171

72-
pclks = 2;
7372
nvclks = 10;
7473
mclks = 13 + cas;
7574
mclk_extra = 3;

drivers/gpu/drm/nouveau/dispnv04/tvnv17.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -644,16 +644,13 @@ static int nv17_tv_create_resources(struct drm_encoder *encoder,
644644
int i;
645645

646646
if (nouveau_tv_norm) {
647-
for (i = 0; i < num_tv_norms; i++) {
648-
if (!strcmp(nv17_tv_norm_names[i], nouveau_tv_norm)) {
649-
tv_enc->tv_norm = i;
650-
break;
651-
}
652-
}
653-
654-
if (i == num_tv_norms)
647+
i = match_string(nv17_tv_norm_names, num_tv_norms,
648+
nouveau_tv_norm);
649+
if (i < 0)
655650
NV_WARN(drm, "Invalid TV norm setting \"%s\"\n",
656651
nouveau_tv_norm);
652+
else
653+
tv_enc->tv_norm = i;
657654
}
658655

659656
drm_mode_create_tv_properties(dev, num_tv_norms, nv17_tv_norm_names);

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@ base907c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
7575
}
7676
}
7777

78-
static void
79-
base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
78+
static bool
79+
base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size)
8080
{
81-
asyw->xlut.i.mode = 7;
81+
if (size != 256 && size != 1024)
82+
return false;
83+
84+
asyw->xlut.i.mode = size == 1024 ? 4 : 7;
8285
asyw->xlut.i.enable = 2;
8386
asyw->xlut.i.load = head907d_olut_load;
87+
return true;
8488
}
8589

8690
static inline u32
@@ -160,6 +164,7 @@ base907c = {
160164
.csc_set = base907c_csc_set,
161165
.csc_clr = base907c_csc_clr,
162166
.olut_core = true,
167+
.ilut_size = 1024,
163168
.xlut_set = base907c_xlut_set,
164169
.xlut_clr = base907c_xlut_clr,
165170
.image_set = base907c_image_set,

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

Lines changed: 67 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ struct nv50_mstm {
660660
struct nouveau_encoder *outp;
661661

662662
struct drm_dp_mst_topology_mgr mgr;
663-
struct nv50_msto *msto[4];
664663

665664
bool modified;
666665
bool disabled;
@@ -726,7 +725,6 @@ nv50_msto_cleanup(struct nv50_msto *msto)
726725
drm_dp_mst_deallocate_vcpi(&mstm->mgr, mstc->port);
727726

728727
msto->mstc = NULL;
729-
msto->head = NULL;
730728
msto->disabled = false;
731729
}
732730

@@ -872,7 +870,6 @@ nv50_msto_enable(struct drm_encoder *encoder)
872870
mstm->outp->update(mstm->outp, head->base.index, armh, proto,
873871
nv50_dp_bpc_to_depth(armh->or.bpc));
874872

875-
msto->head = head;
876873
msto->mstc = mstc;
877874
mstm->modified = true;
878875
}
@@ -913,45 +910,40 @@ nv50_msto = {
913910
.destroy = nv50_msto_destroy,
914911
};
915912

916-
static int
917-
nv50_msto_new(struct drm_device *dev, u32 heads, const char *name, int id,
918-
struct nv50_msto **pmsto)
913+
static struct nv50_msto *
914+
nv50_msto_new(struct drm_device *dev, struct nv50_head *head, int id)
919915
{
920916
struct nv50_msto *msto;
921917
int ret;
922918

923-
if (!(msto = *pmsto = kzalloc(sizeof(*msto), GFP_KERNEL)))
924-
return -ENOMEM;
919+
msto = kzalloc(sizeof(*msto), GFP_KERNEL);
920+
if (!msto)
921+
return ERR_PTR(-ENOMEM);
925922

926923
ret = drm_encoder_init(dev, &msto->encoder, &nv50_msto,
927-
DRM_MODE_ENCODER_DPMST, "%s-mst-%d", name, id);
924+
DRM_MODE_ENCODER_DPMST, "mst-%d", id);
928925
if (ret) {
929-
kfree(*pmsto);
930-
*pmsto = NULL;
931-
return ret;
926+
kfree(msto);
927+
return ERR_PTR(ret);
932928
}
933929

934930
drm_encoder_helper_add(&msto->encoder, &nv50_msto_help);
935-
msto->encoder.possible_crtcs = heads;
936-
return 0;
931+
msto->encoder.possible_crtcs = drm_crtc_mask(&head->base.base);
932+
msto->head = head;
933+
return msto;
937934
}
938935

939936
static struct drm_encoder *
940937
nv50_mstc_atomic_best_encoder(struct drm_connector *connector,
941938
struct drm_connector_state *connector_state)
942939
{
943-
struct nv50_head *head = nv50_head(connector_state->crtc);
944940
struct nv50_mstc *mstc = nv50_mstc(connector);
941+
struct drm_crtc *crtc = connector_state->crtc;
945942

946-
return &mstc->mstm->msto[head->base.index]->encoder;
947-
}
948-
949-
static struct drm_encoder *
950-
nv50_mstc_best_encoder(struct drm_connector *connector)
951-
{
952-
struct nv50_mstc *mstc = nv50_mstc(connector);
943+
if (!(mstc->mstm->outp->dcb->heads & drm_crtc_mask(crtc)))
944+
return NULL;
953945

954-
return &mstc->mstm->msto[0]->encoder;
946+
return &nv50_head(crtc)->msto->encoder;
955947
}
956948

957949
static enum drm_mode_status
@@ -1038,7 +1030,6 @@ static const struct drm_connector_helper_funcs
10381030
nv50_mstc_help = {
10391031
.get_modes = nv50_mstc_get_modes,
10401032
.mode_valid = nv50_mstc_mode_valid,
1041-
.best_encoder = nv50_mstc_best_encoder,
10421033
.atomic_best_encoder = nv50_mstc_atomic_best_encoder,
10431034
.atomic_check = nv50_mstc_atomic_check,
10441035
.detect_ctx = nv50_mstc_detect,
@@ -1071,8 +1062,9 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct drm_dp_mst_port *port,
10711062
const char *path, struct nv50_mstc **pmstc)
10721063
{
10731064
struct drm_device *dev = mstm->outp->base.base.dev;
1065+
struct drm_crtc *crtc;
10741066
struct nv50_mstc *mstc;
1075-
int ret, i;
1067+
int ret;
10761068

10771069
if (!(mstc = *pmstc = kzalloc(sizeof(*mstc), GFP_KERNEL)))
10781070
return -ENOMEM;
@@ -1092,8 +1084,13 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct drm_dp_mst_port *port,
10921084
mstc->connector.funcs->reset(&mstc->connector);
10931085
nouveau_conn_attach_properties(&mstc->connector);
10941086

1095-
for (i = 0; i < ARRAY_SIZE(mstm->msto) && mstm->msto[i]; i++)
1096-
drm_connector_attach_encoder(&mstc->connector, &mstm->msto[i]->encoder);
1087+
drm_for_each_crtc(crtc, dev) {
1088+
if (!(mstm->outp->dcb->heads & drm_crtc_mask(crtc)))
1089+
continue;
1090+
1091+
drm_connector_attach_encoder(&mstc->connector,
1092+
&nv50_head(crtc)->msto->encoder);
1093+
}
10971094

10981095
drm_object_attach_property(&mstc->connector.base, dev->mode_config.path_property, 0);
10991096
drm_object_attach_property(&mstc->connector.base, dev->mode_config.tile_property, 0);
@@ -1367,7 +1364,7 @@ nv50_mstm_new(struct nouveau_encoder *outp, struct drm_dp_aux *aux, int aux_max,
13671364
const int max_payloads = hweight8(outp->dcb->heads);
13681365
struct drm_device *dev = outp->base.base.dev;
13691366
struct nv50_mstm *mstm;
1370-
int ret, i;
1367+
int ret;
13711368
u8 dpcd;
13721369

13731370
/* This is a workaround for some monitors not functioning
@@ -1390,13 +1387,6 @@ nv50_mstm_new(struct nouveau_encoder *outp, struct drm_dp_aux *aux, int aux_max,
13901387
if (ret)
13911388
return ret;
13921389

1393-
for (i = 0; i < max_payloads; i++) {
1394-
ret = nv50_msto_new(dev, outp->dcb->heads, outp->base.base.name,
1395-
i, &mstm->msto[i]);
1396-
if (ret)
1397-
return ret;
1398-
}
1399-
14001390
return 0;
14011391
}
14021392

@@ -1569,17 +1559,24 @@ nv50_sor_func = {
15691559
.destroy = nv50_sor_destroy,
15701560
};
15711561

1562+
static bool nv50_has_mst(struct nouveau_drm *drm)
1563+
{
1564+
struct nvkm_bios *bios = nvxx_bios(&drm->client.device);
1565+
u32 data;
1566+
u8 ver, hdr, cnt, len;
1567+
1568+
data = nvbios_dp_table(bios, &ver, &hdr, &cnt, &len);
1569+
return data && ver >= 0x40 && (nvbios_rd08(bios, data + 0x08) & 0x04);
1570+
}
1571+
15721572
static int
15731573
nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe)
15741574
{
15751575
struct nouveau_connector *nv_connector = nouveau_connector(connector);
15761576
struct nouveau_drm *drm = nouveau_drm(connector->dev);
1577-
struct nvkm_bios *bios = nvxx_bios(&drm->client.device);
15781577
struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
15791578
struct nouveau_encoder *nv_encoder;
15801579
struct drm_encoder *encoder;
1581-
u8 ver, hdr, cnt, len;
1582-
u32 data;
15831580
int type, ret;
15841581

15851582
switch (dcbe->type) {
@@ -1624,10 +1621,9 @@ nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe)
16241621
}
16251622

16261623
if (nv_connector->type != DCB_CONNECTOR_eDP &&
1627-
(data = nvbios_dp_table(bios, &ver, &hdr, &cnt, &len)) &&
1628-
ver >= 0x40 && (nvbios_rd08(bios, data + 0x08) & 0x04)) {
1629-
ret = nv50_mstm_new(nv_encoder, &nv_connector->aux, 16,
1630-
nv_connector->base.base.id,
1624+
nv50_has_mst(drm)) {
1625+
ret = nv50_mstm_new(nv_encoder, &nv_connector->aux,
1626+
16, nv_connector->base.base.id,
16311627
&nv_encoder->dp.mstm);
16321628
if (ret)
16331629
return ret;
@@ -2323,6 +2319,7 @@ nv50_display_create(struct drm_device *dev)
23232319
struct nv50_disp *disp;
23242320
struct dcb_output *dcbe;
23252321
int crtcs, ret, i;
2322+
bool has_mst = nv50_has_mst(drm);
23262323

23272324
disp = kzalloc(sizeof(*disp), GFP_KERNEL);
23282325
if (!disp)
@@ -2371,11 +2368,37 @@ nv50_display_create(struct drm_device *dev)
23712368
crtcs = 0x3;
23722369

23732370
for (i = 0; i < fls(crtcs); i++) {
2371+
struct nv50_head *head;
2372+
23742373
if (!(crtcs & (1 << i)))
23752374
continue;
2376-
ret = nv50_head_create(dev, i);
2377-
if (ret)
2375+
2376+
head = nv50_head_create(dev, i);
2377+
if (IS_ERR(head)) {
2378+
ret = PTR_ERR(head);
23782379
goto out;
2380+
}
2381+
2382+
if (has_mst) {
2383+
head->msto = nv50_msto_new(dev, head, i);
2384+
if (IS_ERR(head->msto)) {
2385+
ret = PTR_ERR(head->msto);
2386+
head->msto = NULL;
2387+
goto out;
2388+
}
2389+
2390+
/*
2391+
* FIXME: This is a hack to workaround the following
2392+
* issues:
2393+
*
2394+
* https://gitlab.gnome.org/GNOME/mutter/issues/759
2395+
* https://gitlab.freedesktop.org/xorg/xserver/merge_requests/277
2396+
*
2397+
* Once these issues are closed, this should be
2398+
* removed
2399+
*/
2400+
head->msto->encoder.possible_crtcs = crtcs;
2401+
}
23792402
}
23802403

23812404
/* create encoder/connector objects based on VBIOS DCB table */

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "nouveau_display.h"
66

7+
struct nv50_msto;
8+
79
struct nv50_disp {
810
struct nvif_disp *disp;
911
struct nv50_core *core;

0 commit comments

Comments
 (0)