Commit dd22dfa6 authored by Dave Airlie's avatar Dave Airlie
Browse files

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: default avatarDave Airlie <airlied@redhat.com>
From: Ben Skeggs <skeggsb@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ <CACAvsv5GKasg9-hEUwp9+aHVJg+nbQ0LukXyudgj6=YKu96jWQ@mail.gmail.com
parents 6fc376f0 afa3b96b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ static void
nv04_calc_arb(struct nv_fifo_info *fifo, struct nv_sim_state *arb)
{
	int pagemiss, cas, width, bpp;
	int nvclks, mclks, pclks, crtpagemiss;
	int nvclks, mclks, crtpagemiss;
	int found, mclk_extra, mclk_loop, cbs, m1, p1;
	int mclk_freq, pclk_freq, nvclk_freq;
	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)
	bpp = arb->bpp;
	cbs = 128;

	pclks = 2;
	nvclks = 10;
	mclks = 13 + cas;
	mclk_extra = 3;
+5 −8
Original line number Diff line number Diff line
@@ -644,16 +644,13 @@ static int nv17_tv_create_resources(struct drm_encoder *encoder,
	int i;

	if (nouveau_tv_norm) {
		for (i = 0; i < num_tv_norms; i++) {
			if (!strcmp(nv17_tv_norm_names[i], nouveau_tv_norm)) {
				tv_enc->tv_norm = i;
				break;
			}
		}

		if (i == num_tv_norms)
		i = match_string(nv17_tv_norm_names, num_tv_norms,
				 nouveau_tv_norm);
		if (i < 0)
			NV_WARN(drm, "Invalid TV norm setting \"%s\"\n",
				nouveau_tv_norm);
		else
			tv_enc->tv_norm = i;
	}

	drm_mode_create_tv_properties(dev, num_tv_norms, nv17_tv_norm_names);
+8 −3
Original line number Diff line number Diff line
@@ -75,12 +75,16 @@ base907c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
	}
}

static void
base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
static bool
base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw, int size)
{
	asyw->xlut.i.mode = 7;
	if (size != 256 && size != 1024)
		return false;

	asyw->xlut.i.mode = size == 1024 ? 4 : 7;
	asyw->xlut.i.enable = 2;
	asyw->xlut.i.load = head907d_olut_load;
	return true;
}

static inline u32
@@ -160,6 +164,7 @@ base907c = {
	.csc_set = base907c_csc_set,
	.csc_clr = base907c_csc_clr,
	.olut_core = true,
	.ilut_size = 1024,
	.xlut_set = base907c_xlut_set,
	.xlut_clr = base907c_xlut_clr,
	.image_set = base907c_image_set,
+67 −44
Original line number Diff line number Diff line
@@ -660,7 +660,6 @@ struct nv50_mstm {
	struct nouveau_encoder *outp;

	struct drm_dp_mst_topology_mgr mgr;
	struct nv50_msto *msto[4];

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

	msto->mstc = NULL;
	msto->head = NULL;
	msto->disabled = false;
}

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

	msto->head = head;
	msto->mstc = mstc;
	mstm->modified = true;
}
@@ -913,45 +910,40 @@ nv50_msto = {
	.destroy = nv50_msto_destroy,
};

static int
nv50_msto_new(struct drm_device *dev, u32 heads, const char *name, int id,
	      struct nv50_msto **pmsto)
static struct nv50_msto *
nv50_msto_new(struct drm_device *dev, struct nv50_head *head, int id)
{
	struct nv50_msto *msto;
	int ret;

	if (!(msto = *pmsto = kzalloc(sizeof(*msto), GFP_KERNEL)))
		return -ENOMEM;
	msto = kzalloc(sizeof(*msto), GFP_KERNEL);
	if (!msto)
		return ERR_PTR(-ENOMEM);

	ret = drm_encoder_init(dev, &msto->encoder, &nv50_msto,
			       DRM_MODE_ENCODER_DPMST, "%s-mst-%d", name, id);
			       DRM_MODE_ENCODER_DPMST, "mst-%d", id);
	if (ret) {
		kfree(*pmsto);
		*pmsto = NULL;
		return ret;
		kfree(msto);
		return ERR_PTR(ret);
	}

	drm_encoder_helper_add(&msto->encoder, &nv50_msto_help);
	msto->encoder.possible_crtcs = heads;
	return 0;
	msto->encoder.possible_crtcs = drm_crtc_mask(&head->base.base);
	msto->head = head;
	return msto;
}

static struct drm_encoder *
nv50_mstc_atomic_best_encoder(struct drm_connector *connector,
			      struct drm_connector_state *connector_state)
{
	struct nv50_head *head = nv50_head(connector_state->crtc);
	struct nv50_mstc *mstc = nv50_mstc(connector);
	struct drm_crtc *crtc = connector_state->crtc;

	return &mstc->mstm->msto[head->base.index]->encoder;
}

static struct drm_encoder *
nv50_mstc_best_encoder(struct drm_connector *connector)
{
	struct nv50_mstc *mstc = nv50_mstc(connector);
	if (!(mstc->mstm->outp->dcb->heads & drm_crtc_mask(crtc)))
		return NULL;

	return &mstc->mstm->msto[0]->encoder;
	return &nv50_head(crtc)->msto->encoder;
}

static enum drm_mode_status
@@ -1038,7 +1030,6 @@ static const struct drm_connector_helper_funcs
nv50_mstc_help = {
	.get_modes = nv50_mstc_get_modes,
	.mode_valid = nv50_mstc_mode_valid,
	.best_encoder = nv50_mstc_best_encoder,
	.atomic_best_encoder = nv50_mstc_atomic_best_encoder,
	.atomic_check = nv50_mstc_atomic_check,
	.detect_ctx = nv50_mstc_detect,
@@ -1071,8 +1062,9 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct drm_dp_mst_port *port,
	      const char *path, struct nv50_mstc **pmstc)
{
	struct drm_device *dev = mstm->outp->base.base.dev;
	struct drm_crtc *crtc;
	struct nv50_mstc *mstc;
	int ret, i;
	int ret;

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

	for (i = 0; i < ARRAY_SIZE(mstm->msto) && mstm->msto[i]; i++)
		drm_connector_attach_encoder(&mstc->connector, &mstm->msto[i]->encoder);
	drm_for_each_crtc(crtc, dev) {
		if (!(mstm->outp->dcb->heads & drm_crtc_mask(crtc)))
			continue;

		drm_connector_attach_encoder(&mstc->connector,
					     &nv50_head(crtc)->msto->encoder);
	}

	drm_object_attach_property(&mstc->connector.base, dev->mode_config.path_property, 0);
	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,
	const int max_payloads = hweight8(outp->dcb->heads);
	struct drm_device *dev = outp->base.base.dev;
	struct nv50_mstm *mstm;
	int ret, i;
	int ret;
	u8 dpcd;

	/* 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,
	if (ret)
		return ret;

	for (i = 0; i < max_payloads; i++) {
		ret = nv50_msto_new(dev, outp->dcb->heads, outp->base.base.name,
				    i, &mstm->msto[i]);
		if (ret)
			return ret;
	}

	return 0;
}

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

static bool nv50_has_mst(struct nouveau_drm *drm)
{
	struct nvkm_bios *bios = nvxx_bios(&drm->client.device);
	u32 data;
	u8 ver, hdr, cnt, len;

	data = nvbios_dp_table(bios, &ver, &hdr, &cnt, &len);
	return data && ver >= 0x40 && (nvbios_rd08(bios, data + 0x08) & 0x04);
}

static int
nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe)
{
	struct nouveau_connector *nv_connector = nouveau_connector(connector);
	struct nouveau_drm *drm = nouveau_drm(connector->dev);
	struct nvkm_bios *bios = nvxx_bios(&drm->client.device);
	struct nvkm_i2c *i2c = nvxx_i2c(&drm->client.device);
	struct nouveau_encoder *nv_encoder;
	struct drm_encoder *encoder;
	u8 ver, hdr, cnt, len;
	u32 data;
	int type, ret;

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

		if (nv_connector->type != DCB_CONNECTOR_eDP &&
		    (data = nvbios_dp_table(bios, &ver, &hdr, &cnt, &len)) &&
		    ver >= 0x40 && (nvbios_rd08(bios, data + 0x08) & 0x04)) {
			ret = nv50_mstm_new(nv_encoder, &nv_connector->aux, 16,
					    nv_connector->base.base.id,
		    nv50_has_mst(drm)) {
			ret = nv50_mstm_new(nv_encoder, &nv_connector->aux,
					    16, nv_connector->base.base.id,
					    &nv_encoder->dp.mstm);
			if (ret)
				return ret;
@@ -2323,6 +2319,7 @@ nv50_display_create(struct drm_device *dev)
	struct nv50_disp *disp;
	struct dcb_output *dcbe;
	int crtcs, ret, i;
	bool has_mst = nv50_has_mst(drm);

	disp = kzalloc(sizeof(*disp), GFP_KERNEL);
	if (!disp)
@@ -2371,13 +2368,39 @@ nv50_display_create(struct drm_device *dev)
		crtcs = 0x3;

	for (i = 0; i < fls(crtcs); i++) {
		struct nv50_head *head;

		if (!(crtcs & (1 << i)))
			continue;
		ret = nv50_head_create(dev, i);
		if (ret)

		head = nv50_head_create(dev, i);
		if (IS_ERR(head)) {
			ret = PTR_ERR(head);
			goto out;
		}

		if (has_mst) {
			head->msto = nv50_msto_new(dev, head, i);
			if (IS_ERR(head->msto)) {
				ret = PTR_ERR(head->msto);
				head->msto = NULL;
				goto out;
			}

			/*
			 * FIXME: This is a hack to workaround the following
			 * issues:
			 *
			 * https://gitlab.gnome.org/GNOME/mutter/issues/759
			 * https://gitlab.freedesktop.org/xorg/xserver/merge_requests/277
			 *
			 * Once these issues are closed, this should be
			 * removed
			 */
			head->msto->encoder.possible_crtcs = crtcs;
		}
	}

	/* create encoder/connector objects based on VBIOS DCB table */
	for (i = 0, dcbe = &dcb->entry[0]; i < dcb->entries; i++, dcbe++) {
		connector = nouveau_connector_create(dev, dcbe);
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@

#include "nouveau_display.h"

struct nv50_msto;

struct nv50_disp {
	struct nvif_disp *disp;
	struct nv50_core *core;
Loading