Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

Merge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-core-next

* 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next:
  drm/nouveau: fix earlier mistake when fixing merge conflict
  drm/nvc0: fix thinko in instmem suspend/resume
  drm/nouveau: Workaround missing GPIO tables on an Apple iMac G4 NV18.
  drm/nouveau: Add TV-out quirk for an MSI nForce2 IGP.
  drm/nv50-nvc0: ramht_size is meant to be in bytes, not entries
  drm/nouveau: punt some more log messages to debug level
  drm/nouveau: remove warning about unknown tmds table revisions
  drm/nouveau: check for error when allocating/mapping dummy page
  drm/nouveau: fix race condition when under memory pressure
  drm/nv50: fix minor thinko from nvc0 changes
  drm/nouveau: Don't try DDC on the dummy I2C channel.
parents 0537398b 625db6b7
Loading
Loading
Loading
Loading
+28 −14
Original line number Diff line number Diff line
@@ -2166,7 +2166,7 @@ peek_fb(struct drm_device *dev, struct io_mapping *fb,
	uint32_t val = 0;

	if (off < pci_resource_len(dev->pdev, 1)) {
		uint32_t __iomem *p =
		uint8_t __iomem *p =
			io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0);

		val = ioread32(p + (off & ~PAGE_MASK));
@@ -2182,7 +2182,7 @@ poke_fb(struct drm_device *dev, struct io_mapping *fb,
	uint32_t off, uint32_t val)
{
	if (off < pci_resource_len(dev->pdev, 1)) {
		uint32_t __iomem *p =
		uint8_t __iomem *p =
			io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0);

		iowrite32(val, p + (off & ~PAGE_MASK));
@@ -4587,7 +4587,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
			return 1;
		}

		NV_TRACE(dev, "0x%04X: parsing output script 0\n", script);
		NV_DEBUG_KMS(dev, "0x%04X: parsing output script 0\n", script);
		nouveau_bios_run_init_table(dev, script, dcbent);
	} else
	if (pxclk == -1) {
@@ -4597,7 +4597,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
			return 1;
		}

		NV_TRACE(dev, "0x%04X: parsing output script 1\n", script);
		NV_DEBUG_KMS(dev, "0x%04X: parsing output script 1\n", script);
		nouveau_bios_run_init_table(dev, script, dcbent);
	} else
	if (pxclk == -2) {
@@ -4610,7 +4610,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
			return 1;
		}

		NV_TRACE(dev, "0x%04X: parsing output script 2\n", script);
		NV_DEBUG_KMS(dev, "0x%04X: parsing output script 2\n", script);
		nouveau_bios_run_init_table(dev, script, dcbent);
	} else
	if (pxclk > 0) {
@@ -4622,7 +4622,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
			return 1;
		}

		NV_TRACE(dev, "0x%04X: parsing clock script 0\n", script);
		NV_DEBUG_KMS(dev, "0x%04X: parsing clock script 0\n", script);
		nouveau_bios_run_init_table(dev, script, dcbent);
	} else
	if (pxclk < 0) {
@@ -4634,7 +4634,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
			return 1;
		}

		NV_TRACE(dev, "0x%04X: parsing clock script 1\n", script);
		NV_DEBUG_KMS(dev, "0x%04X: parsing clock script 1\n", script);
		nouveau_bios_run_init_table(dev, script, dcbent);
	}

@@ -5357,19 +5357,17 @@ static int parse_bit_tmds_tbl_entry(struct drm_device *dev, struct nvbios *bios,
	}

	tmdstableptr = ROM16(bios->data[bitentry->offset]);

	if (tmdstableptr == 0x0) {
	if (!tmdstableptr) {
		NV_ERROR(dev, "Pointer to TMDS table invalid\n");
		return -EINVAL;
	}

	/* nv50+ has v2.0, but we don't parse it atm */
	if (bios->data[tmdstableptr] != 0x11) {
		NV_WARN(dev,
			"TMDS table revision %d.%d not currently supported\n",
	NV_INFO(dev, "TMDS table version %d.%d\n",
		bios->data[tmdstableptr] >> 4, bios->data[tmdstableptr] & 0xf);

	/* nv50+ has v2.0, but we don't parse it atm */
	if (bios->data[tmdstableptr] != 0x11)
		return -ENOSYS;
	}

	/*
	 * These two scripts are odd: they don't seem to get run even when
@@ -5809,6 +5807,22 @@ parse_dcb_gpio_table(struct nvbios *bios)
			gpio->line = tvdac_gpio[1] >> 4;
			gpio->invert = tvdac_gpio[0] & 2;
		}
	} else {
		/*
		 * No systematic way to store GPIO info on pre-v2.2
		 * DCBs, try to match the PCI device IDs.
		 */

		/* Apple iMac G4 NV18 */
		if (dev->pdev->device == 0x0189 &&
		    dev->pdev->subsystem_vendor == 0x10de &&
		    dev->pdev->subsystem_device == 0x0010) {
			struct dcb_gpio_entry *gpio = new_gpio_entry(bios);

			gpio->tag = DCB_GPIO_TVDAC0;
			gpio->line = 4;
		}

	}

	if (!gpio_table_ptr)
+15 −0
Original line number Diff line number Diff line
@@ -36,6 +36,21 @@
#include <linux/log2.h>
#include <linux/slab.h>

int
nouveau_bo_sync_gpu(struct nouveau_bo *nvbo, struct nouveau_channel *chan)
{
	struct nouveau_fence *prev_fence = nvbo->bo.sync_obj;
	int ret;

	if (!prev_fence || nouveau_fence_channel(prev_fence) == chan)
		return 0;

	spin_lock(&nvbo->bo.lock);
	ret = ttm_bo_wait(&nvbo->bo, false, false, false);
	spin_unlock(&nvbo->bo.lock);
	return ret;
}

static void
nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
{
+4 −2
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
	int i;

	for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
		struct nouveau_i2c_chan *i2c;
		struct nouveau_i2c_chan *i2c = NULL;
		struct nouveau_encoder *nv_encoder;
		struct drm_mode_object *obj;
		int id;
@@ -117,6 +117,8 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
		if (!obj)
			continue;
		nv_encoder = nouveau_encoder(obj_to_encoder(obj));

		if (nv_encoder->dcb->i2c_index < 0xf)
			i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);

		if (i2c && nouveau_probe_i2c_addr(i2c, 0x50)) {
+1 −0
Original line number Diff line number Diff line
@@ -1165,6 +1165,7 @@ extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index);
extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val);
extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index);
extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val);
extern int nouveau_bo_sync_gpu(struct nouveau_bo *, struct nouveau_channel *);

/* nouveau_fence.c */
struct nouveau_fence;
+26 −10
Original line number Diff line number Diff line
@@ -361,17 +361,12 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,

	list_for_each_entry(nvbo, list, entry) {
		struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index];
		struct nouveau_fence *prev_fence = nvbo->bo.sync_obj;

		if (prev_fence && nouveau_fence_channel(prev_fence) != chan) {
			spin_lock(&nvbo->bo.lock);
			ret = ttm_bo_wait(&nvbo->bo, false, false, false);
			spin_unlock(&nvbo->bo.lock);
		ret = nouveau_bo_sync_gpu(nvbo, chan);
		if (unlikely(ret)) {
				NV_ERROR(dev, "fail wait other chan\n");
			NV_ERROR(dev, "fail pre-validate sync\n");
			return ret;
		}
		}

		ret = nouveau_gem_set_domain(nvbo->gem, b->read_domains,
					     b->write_domains,
@@ -381,7 +376,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
			return ret;
		}

		nvbo->channel = chan;
		nvbo->channel = (b->read_domains & (1 << 31)) ? NULL : chan;
		ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement,
				      false, false, false);
		nvbo->channel = NULL;
@@ -390,6 +385,12 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
			return ret;
		}

		ret = nouveau_bo_sync_gpu(nvbo, chan);
		if (unlikely(ret)) {
			NV_ERROR(dev, "fail post-validate sync\n");
			return ret;
		}

		if (nvbo->bo.offset == b->presumed.offset &&
		    ((nvbo->bo.mem.mem_type == TTM_PL_VRAM &&
		      b->presumed.domain & NOUVEAU_GEM_DOMAIN_VRAM) ||
@@ -615,6 +616,21 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,

	mutex_lock(&dev->struct_mutex);

	/* Mark push buffers as being used on PFIFO, the validation code
	 * will then make sure that if the pushbuf bo moves, that they
	 * happen on the kernel channel, which will in turn cause a sync
	 * to happen before we try and submit the push buffer.
	 */
	for (i = 0; i < req->nr_push; i++) {
		if (push[i].bo_index >= req->nr_buffers) {
			NV_ERROR(dev, "push %d buffer not in list\n", i);
			ret = -EINVAL;
			goto out;
		}

		bo[push[i].bo_index].read_domains |= (1 << 31);
	}

	/* Validate buffer list */
	ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo, req->buffers,
					   req->nr_buffers, &op, &do_reloc);
Loading